decord/source/design/components/Checkbox/native/Checkbox.native.tsx

72 lines
2.9 KiB
TypeScript
Raw Normal View History

// Module ID: 9520
// Function ID: 9521
2026-07-20 16:05:17 +00:00
// Name: Checkbox
// Dependencies: [17, 21, 4606, 4325, 1114, 5024, 5668, 4602, 2]
2026-07-20 16:05:17 +00:00
// Exports: Checkbox
// Module 9520 (Checkbox)
import useA11yRolesNative from "useA11yRolesNative" /* 4325 */;
import Text_Text from "Text/Text" /* 4602 */;
import Stack_Stack from "Stack/Stack" /* 5024 */;
import FormCheckbox from "FormCheckbox" /* 5668 */;
import get_ActivityIndicator from "module_17" /* 17 */;
2026-08-24 06:08:38 +00:00
import jsxProd from "jsxProd" /* 21 */;
import createStyles from "createStyles" /* 4606 */;
import size from "module_2" /* 2 */;
2026-07-23 10:11:24 +00:00
({ Pressable: c2, View: c3 } = get_ActivityIndicator);
({ jsx: closure_4, jsxs: hasOwnProperty } = jsxProd);
let closure_6 = createStyles.createStyles({ textContainer: { flex: 1 }, labelContainer: { minHeight: 24, justifyContent: "center" } });
const result = size.fileFinishedImporting("design/components/Checkbox/native/Checkbox.native.tsx");
2026-07-20 16:05:17 +00:00
export const Checkbox = function Checkbox(onToggle) {
({ label, description, required, checked } = onToggle);
2026-07-23 10:11:24 +00:00
onToggle = onToggle.onToggle;
const tmp = closure_6();
const checkboxA11yNative = useA11yRolesNative.useCheckboxA11yNative({ checked });
const obj2 = { accessibilityRole: checkboxA11yNative.accessibilityRole, accessibilityLabel: null, accessibilityState: null, onPress: null, children: null };
2026-07-20 16:05:17 +00:00
let str = "";
let str2 = "";
if (required) {
const intl = tmp2(1114).intl;
2026-07-20 16:05:17 +00:00
const _HermesInternal = HermesInternal;
str2 = " (" + intl.string(tmp2(1114).t.EkokLy) + ")";
2026-07-20 16:05:17 +00:00
}
const sum = label + str2;
if (null != description) {
const _HermesInternal2 = HermesInternal;
str = ", " + description;
}
obj2.accessibilityLabel = sum + str;
obj2.accessibilityState = checkboxA11yNative.accessibilityState;
obj2.onPress = function onPress() {
2026-07-20 16:05:17 +00:00
return onToggle(!checked);
};
const items = [React4(FormCheckbox.FormCheckbox, { checked }), ];
const obj3 = { style: tmp.textContainer, children: null };
const obj4 = { style: tmp.labelContainer, children: null };
2026-07-20 16:05:17 +00:00
const items1 = [label, ];
if (required) {
const obj5 = { variant: "text-md/bold", color: "text-feedback-critical", "aria-label": null, children: null };
const intl2 = tmp2(1114).intl;
obj5["aria-label"] = intl2.string(tmp2(1114).t.EkokLy);
obj5.children = [" ", "*"];
required = tmp10(tmp2(4602).Text, obj5);
2026-07-20 16:05:17 +00:00
}
items1[1] = required;
obj4.children = hasOwnProperty(Text_Text.Text, { variant: "text-md/medium", children: items1 });
const items2 = [React4(React3, obj4), ];
2026-07-29 08:29:29 +00:00
let tmp5Result = null != description;
if (tmp5Result) {
const obj6 = { variant: "text-sm/normal", color: "text-subtle", children: description };
tmp5Result = tmp5(tmp2(4602).Text, obj6);
2026-07-20 16:05:17 +00:00
}
const obj7 = { direction: "horizontal", children: null };
2026-07-29 08:29:29 +00:00
items2[1] = tmp5Result;
obj3.children = items2;
items[1] = hasOwnProperty(React3, obj3);
obj7.children = items;
obj2.children = hasOwnProperty(Stack_Stack.Stack, obj7);
return React4(React2, obj2);
2026-07-20 16:05:17 +00:00
};