@cdx-ui/primitives 0.0.1-beta.64 → 0.0.1-beta.66
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +35 -36
- package/lib/commonjs/CLAUDE.md +64 -12
- package/lib/commonjs/avatar/{createAvatarRoot.js → AvatarRoot.js} +10 -6
- package/lib/commonjs/avatar/AvatarRoot.js.map +1 -0
- package/lib/commonjs/avatar/index.js +14 -24
- package/lib/commonjs/avatar/index.js.map +1 -1
- package/lib/commonjs/button/{createButtonRoot.js → ButtonRoot.js} +13 -9
- package/lib/commonjs/button/ButtonRoot.js.map +1 -0
- package/lib/commonjs/button/index.js +7 -24
- package/lib/commonjs/button/index.js.map +1 -1
- package/lib/commonjs/checkbox/{createCheckboxGroup.js → CheckboxGroup.js} +20 -12
- package/lib/commonjs/checkbox/CheckboxGroup.js.map +1 -0
- package/lib/commonjs/checkbox/CheckboxRoot.js +103 -0
- package/lib/commonjs/checkbox/CheckboxRoot.js.map +1 -0
- package/lib/commonjs/checkbox/CheckboxRoot.web.js +94 -0
- package/lib/commonjs/checkbox/CheckboxRoot.web.js.map +1 -0
- package/lib/commonjs/checkbox/index.js +21 -24
- package/lib/commonjs/checkbox/index.js.map +1 -1
- package/lib/commonjs/chip/ChipRoot.js +147 -0
- package/lib/commonjs/chip/ChipRoot.js.map +1 -0
- package/lib/commonjs/chip/context.js +11 -0
- package/lib/commonjs/chip/context.js.map +1 -0
- package/lib/commonjs/chip/index.js +14 -10
- package/lib/commonjs/chip/index.js.map +1 -1
- package/lib/commonjs/dialog/DialogClose.js +32 -0
- package/lib/commonjs/dialog/DialogClose.js.map +1 -0
- package/lib/commonjs/dialog/{createDialogPopup.js → DialogPopup.js} +18 -14
- package/lib/commonjs/dialog/DialogPopup.js.map +1 -0
- package/lib/commonjs/dialog/{createDialogRoot.js → DialogRoot.js} +11 -8
- package/lib/commonjs/dialog/DialogRoot.js.map +1 -0
- package/lib/commonjs/dialog/DialogTrigger.js +32 -0
- package/lib/commonjs/dialog/DialogTrigger.js.map +1 -0
- package/lib/commonjs/dialog/index.js +28 -41
- package/lib/commonjs/dialog/index.js.map +1 -1
- package/lib/commonjs/field/FieldLabel.js +48 -0
- package/lib/commonjs/field/FieldLabel.js.map +1 -0
- package/lib/commonjs/field/FieldLabel.web.js +60 -0
- package/lib/commonjs/field/FieldLabel.web.js.map +1 -0
- package/lib/commonjs/field/FieldRoot.js +38 -0
- package/lib/commonjs/field/FieldRoot.js.map +1 -0
- package/lib/commonjs/field/index.js +14 -40
- package/lib/commonjs/field/index.js.map +1 -1
- package/lib/commonjs/form/FormRoot.js +25 -0
- package/lib/commonjs/form/FormRoot.js.map +1 -0
- package/lib/commonjs/{dialog/createDialogFooter.js → form/FormRoot.web.js} +14 -8
- package/lib/commonjs/form/FormRoot.web.js.map +1 -0
- package/lib/commonjs/form/index.js +7 -9
- package/lib/commonjs/form/index.js.map +1 -1
- package/lib/commonjs/index.js +42 -5
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/input/{createInputField.js → InputField.android.js} +36 -38
- package/lib/commonjs/input/InputField.android.js.map +1 -0
- package/lib/commonjs/input/InputField.js +92 -0
- package/lib/commonjs/input/InputField.js.map +1 -0
- package/lib/commonjs/input/InputField.web.js +131 -0
- package/lib/commonjs/input/InputField.web.js.map +1 -0
- package/lib/commonjs/input/{createInputRoot.js → InputRoot.js} +29 -27
- package/lib/commonjs/input/InputRoot.js.map +1 -0
- package/lib/commonjs/input/index.js +21 -16
- package/lib/commonjs/input/index.js.map +1 -1
- package/lib/commonjs/link/{createLink.js → LinkRoot.js} +20 -20
- package/lib/commonjs/link/LinkRoot.js.map +1 -0
- package/lib/commonjs/link/index.js +3 -3
- package/lib/commonjs/link/index.js.map +1 -1
- package/lib/commonjs/list-item/{createListItemRoot.js → ListItemRoot.js} +48 -68
- package/lib/commonjs/list-item/ListItemRoot.js.map +1 -0
- package/lib/commonjs/list-item/context.js.map +1 -1
- package/lib/commonjs/list-item/index.js +7 -36
- package/lib/commonjs/list-item/index.js.map +1 -1
- package/lib/commonjs/otp-input/{createOtpInputField.js → OtpInputField.js} +24 -8
- package/lib/commonjs/otp-input/OtpInputField.js.map +1 -0
- package/lib/commonjs/otp-input/index.js +39 -16
- package/lib/commonjs/otp-input/index.js.map +1 -1
- package/lib/commonjs/otp-input/{createOtpInputRoot.js → useOtpInput.js} +33 -49
- package/lib/commonjs/otp-input/useOtpInput.js.map +1 -0
- package/lib/commonjs/overlay/useDismissOverlay.js +0 -2
- package/lib/commonjs/overlay/useDismissOverlay.js.map +1 -1
- package/lib/commonjs/overlay/useEscapeKey.js +0 -2
- package/lib/commonjs/overlay/useEscapeKey.js.map +1 -1
- package/lib/commonjs/{progress/createProgressIndicator.js → progress-bar/ProgressBarIndicator.js} +12 -9
- package/lib/commonjs/progress-bar/ProgressBarIndicator.js.map +1 -0
- package/lib/commonjs/{progress/createProgressRoot.js → progress-bar/ProgressBarRoot.js} +9 -5
- package/lib/commonjs/progress-bar/ProgressBarRoot.js.map +1 -0
- package/lib/commonjs/progress-bar/context.js.map +1 -0
- package/lib/commonjs/progress-bar/index.js +27 -0
- package/lib/commonjs/progress-bar/index.js.map +1 -0
- package/lib/commonjs/{progress → progress-bar}/types.js.map +1 -1
- package/lib/commonjs/radio/{createRadioGroup.js → RadioGroup.js} +18 -10
- package/lib/commonjs/radio/RadioGroup.js.map +1 -0
- package/lib/commonjs/radio/RadioRoot.js +99 -0
- package/lib/commonjs/radio/RadioRoot.js.map +1 -0
- package/lib/commonjs/radio/RadioRoot.web.js +91 -0
- package/lib/commonjs/radio/RadioRoot.web.js.map +1 -0
- package/lib/commonjs/radio/index.js +21 -20
- package/lib/commonjs/radio/index.js.map +1 -1
- package/lib/commonjs/select/{createSelectContent.js → SelectContent.js} +14 -11
- package/lib/commonjs/select/SelectContent.js.map +1 -0
- package/lib/commonjs/select/{createSelectItem.js → SelectItem.js} +18 -15
- package/lib/commonjs/select/SelectItem.js.map +1 -0
- package/lib/commonjs/select/{createSelectRoot.js → SelectRoot.js} +11 -8
- package/lib/commonjs/select/SelectRoot.js.map +1 -0
- package/lib/commonjs/select/SelectTrigger.js +72 -0
- package/lib/commonjs/select/SelectTrigger.js.map +1 -0
- package/lib/commonjs/select/SelectTrigger.web.js +175 -0
- package/lib/commonjs/select/SelectTrigger.web.js.map +1 -0
- package/lib/commonjs/select/context.js +3 -12
- package/lib/commonjs/select/context.js.map +1 -1
- package/lib/commonjs/select/index.js +41 -32
- package/lib/commonjs/select/index.js.map +1 -1
- package/lib/commonjs/select/useContentFocus.js +1 -1
- package/lib/commonjs/select/useSelectTrigger.js +206 -0
- package/lib/commonjs/select/useSelectTrigger.js.map +1 -0
- package/lib/commonjs/select/useSelectTrigger.web.js +192 -0
- package/lib/commonjs/select/useSelectTrigger.web.js.map +1 -0
- package/lib/commonjs/slot/index.js +19 -0
- package/lib/commonjs/slot/index.js.map +1 -0
- package/lib/commonjs/switch/index.js +7 -9
- package/lib/commonjs/switch/index.js.map +1 -1
- package/lib/commonjs/switch/useSwitch.js +81 -0
- package/lib/commonjs/switch/useSwitch.js.map +1 -0
- package/lib/commonjs/tile/{createTileGroup.js → TileGroup.js} +11 -12
- package/lib/commonjs/tile/TileGroup.js.map +1 -0
- package/lib/commonjs/tile/TileRoot.js +129 -0
- package/lib/commonjs/tile/TileRoot.js.map +1 -0
- package/lib/commonjs/tile/index.js +14 -36
- package/lib/commonjs/tile/index.js.map +1 -1
- package/lib/commonjs/utils/dataAttributes.js +6 -0
- package/lib/commonjs/utils/dataAttributes.js.map +1 -1
- package/lib/commonjs/utils/dataAttributes.web.js +25 -0
- package/lib/commonjs/utils/dataAttributes.web.js.map +1 -1
- package/lib/commonjs/utils/domDataAttributes.js +30 -0
- package/lib/commonjs/utils/domDataAttributes.js.map +1 -1
- package/lib/module/CLAUDE.md +64 -12
- package/lib/module/avatar/{createAvatarRoot.js → AvatarRoot.js} +9 -4
- package/lib/module/avatar/AvatarRoot.js.map +1 -0
- package/lib/module/avatar/index.js +2 -23
- package/lib/module/avatar/index.js.map +1 -1
- package/lib/module/button/{createButtonRoot.js → ButtonRoot.js} +13 -8
- package/lib/module/button/ButtonRoot.js.map +1 -0
- package/lib/module/button/index.js +1 -23
- package/lib/module/button/index.js.map +1 -1
- package/lib/module/checkbox/{createCheckboxGroup.js → CheckboxGroup.js} +20 -11
- package/lib/module/checkbox/CheckboxGroup.js.map +1 -0
- package/lib/module/checkbox/CheckboxRoot.js +99 -0
- package/lib/module/checkbox/CheckboxRoot.js.map +1 -0
- package/lib/module/checkbox/CheckboxRoot.web.js +90 -0
- package/lib/module/checkbox/CheckboxRoot.web.js.map +1 -0
- package/lib/module/checkbox/index.js +3 -23
- package/lib/module/checkbox/index.js.map +1 -1
- package/lib/module/chip/ChipRoot.js +142 -0
- package/lib/module/chip/ChipRoot.js.map +1 -0
- package/lib/module/chip/context.js +5 -0
- package/lib/module/chip/context.js.map +1 -0
- package/lib/module/chip/index.js +2 -9
- package/lib/module/chip/index.js.map +1 -1
- package/lib/module/dialog/DialogClose.js +28 -0
- package/lib/module/dialog/DialogClose.js.map +1 -0
- package/lib/module/dialog/{createDialogPopup.js → DialogPopup.js} +19 -14
- package/lib/module/dialog/DialogPopup.js.map +1 -0
- package/lib/module/dialog/{createDialogRoot.js → DialogRoot.js} +11 -7
- package/lib/module/dialog/DialogRoot.js.map +1 -0
- package/lib/module/dialog/DialogTrigger.js +28 -0
- package/lib/module/dialog/DialogTrigger.js.map +1 -0
- package/lib/module/dialog/index.js +5 -42
- package/lib/module/dialog/index.js.map +1 -1
- package/lib/module/field/FieldLabel.js +44 -0
- package/lib/module/field/FieldLabel.js.map +1 -0
- package/lib/module/field/FieldLabel.web.js +55 -0
- package/lib/module/field/FieldLabel.web.js.map +1 -0
- package/lib/module/field/FieldRoot.js +34 -0
- package/lib/module/field/FieldRoot.js.map +1 -0
- package/lib/module/field/index.js +2 -39
- package/lib/module/field/index.js.map +1 -1
- package/lib/module/form/FormRoot.js +21 -0
- package/lib/module/form/FormRoot.js.map +1 -0
- package/lib/module/form/FormRoot.web.js +22 -0
- package/lib/module/form/FormRoot.web.js.map +1 -0
- package/lib/module/form/index.js +1 -8
- package/lib/module/form/index.js.map +1 -1
- package/lib/module/index.js +5 -3
- package/lib/module/index.js.map +1 -1
- package/lib/module/input/{createInputField.js → InputField.android.js} +36 -37
- package/lib/module/input/InputField.android.js.map +1 -0
- package/lib/module/input/InputField.js +88 -0
- package/lib/module/input/InputField.js.map +1 -0
- package/lib/module/input/InputField.web.js +126 -0
- package/lib/module/input/InputField.web.js.map +1 -0
- package/lib/module/input/{createInputRoot.js → InputRoot.js} +29 -25
- package/lib/module/input/InputRoot.js.map +1 -0
- package/lib/module/input/index.js +3 -15
- package/lib/module/input/index.js.map +1 -1
- package/lib/module/link/{createLink.js → LinkRoot.js} +21 -19
- package/lib/module/link/LinkRoot.js.map +1 -0
- package/lib/module/link/index.js +1 -1
- package/lib/module/link/index.js.map +1 -1
- package/lib/module/list-item/{createListItemRoot.js → ListItemRoot.js} +49 -68
- package/lib/module/list-item/ListItemRoot.js.map +1 -0
- package/lib/module/list-item/context.js.map +1 -1
- package/lib/module/list-item/index.js +1 -35
- package/lib/module/list-item/index.js.map +1 -1
- package/lib/module/otp-input/{createOtpInputField.js → OtpInputField.js} +24 -7
- package/lib/module/otp-input/OtpInputField.js.map +1 -0
- package/lib/module/otp-input/index.js +3 -15
- package/lib/module/otp-input/index.js.map +1 -1
- package/lib/module/otp-input/{createOtpInputRoot.js → useOtpInput.js} +33 -48
- package/lib/module/otp-input/useOtpInput.js.map +1 -0
- package/lib/module/overlay/useDismissOverlay.js +0 -2
- package/lib/module/overlay/useDismissOverlay.js.map +1 -1
- package/lib/module/overlay/useEscapeKey.js +0 -2
- package/lib/module/overlay/useEscapeKey.js.map +1 -1
- package/lib/module/{progress/createProgressIndicator.js → progress-bar/ProgressBarIndicator.js} +11 -7
- package/lib/module/progress-bar/ProgressBarIndicator.js.map +1 -0
- package/lib/module/{progress/createProgressRoot.js → progress-bar/ProgressBarRoot.js} +8 -3
- package/lib/module/progress-bar/ProgressBarRoot.js.map +1 -0
- package/lib/module/progress-bar/context.js.map +1 -0
- package/lib/module/progress-bar/index.js +6 -0
- package/lib/module/progress-bar/index.js.map +1 -0
- package/lib/module/{progress → progress-bar}/types.js.map +1 -1
- package/lib/module/radio/{createRadioGroup.js → RadioGroup.js} +18 -9
- package/lib/module/radio/RadioGroup.js.map +1 -0
- package/lib/module/radio/RadioRoot.js +95 -0
- package/lib/module/radio/RadioRoot.js.map +1 -0
- package/lib/module/radio/RadioRoot.web.js +87 -0
- package/lib/module/radio/RadioRoot.web.js.map +1 -0
- package/lib/module/radio/index.js +3 -19
- package/lib/module/radio/index.js.map +1 -1
- package/lib/module/select/{createSelectContent.js → SelectContent.js} +14 -11
- package/lib/module/select/SelectContent.js.map +1 -0
- package/lib/module/select/{createSelectItem.js → SelectItem.js} +18 -14
- package/lib/module/select/SelectItem.js.map +1 -0
- package/lib/module/select/{createSelectRoot.js → SelectRoot.js} +11 -7
- package/lib/module/select/SelectRoot.js.map +1 -0
- package/lib/module/select/SelectTrigger.js +67 -0
- package/lib/module/select/SelectTrigger.js.map +1 -0
- package/lib/module/select/SelectTrigger.web.js +170 -0
- package/lib/module/select/SelectTrigger.web.js.map +1 -0
- package/lib/module/select/context.js +1 -8
- package/lib/module/select/context.js.map +1 -1
- package/lib/module/select/index.js +5 -31
- package/lib/module/select/index.js.map +1 -1
- package/lib/module/select/useContentFocus.js +1 -1
- package/lib/module/select/useSelectTrigger.js +202 -0
- package/lib/module/select/useSelectTrigger.js.map +1 -0
- package/lib/module/select/useSelectTrigger.web.js +188 -0
- package/lib/module/select/useSelectTrigger.web.js.map +1 -0
- package/lib/module/slot/index.js +4 -0
- package/lib/module/slot/index.js.map +1 -0
- package/lib/module/switch/index.js +1 -8
- package/lib/module/switch/index.js.map +1 -1
- package/lib/module/switch/useSwitch.js +77 -0
- package/lib/module/switch/useSwitch.js.map +1 -0
- package/lib/module/tile/{createTileGroup.js → TileGroup.js} +10 -9
- package/lib/module/tile/TileGroup.js.map +1 -0
- package/lib/module/tile/{createTileRoot.js → TileRoot.js} +52 -54
- package/lib/module/tile/TileRoot.js.map +1 -0
- package/lib/module/tile/index.js +2 -35
- package/lib/module/tile/index.js.map +1 -1
- package/lib/module/utils/dataAttributes.js +1 -1
- package/lib/module/utils/dataAttributes.js.map +1 -1
- package/lib/module/utils/dataAttributes.web.js +24 -0
- package/lib/module/utils/dataAttributes.web.js.map +1 -1
- package/lib/module/utils/domDataAttributes.js +29 -0
- package/lib/module/utils/domDataAttributes.js.map +1 -1
- package/lib/typescript/avatar/AvatarRoot.d.ts +8 -0
- package/lib/typescript/avatar/AvatarRoot.d.ts.map +1 -0
- package/lib/typescript/avatar/index.d.ts +3 -10
- package/lib/typescript/avatar/index.d.ts.map +1 -1
- package/lib/typescript/avatar/types.d.ts +1 -17
- package/lib/typescript/avatar/types.d.ts.map +1 -1
- package/lib/typescript/button/ButtonRoot.d.ts +9 -0
- package/lib/typescript/button/ButtonRoot.d.ts.map +1 -0
- package/lib/typescript/button/index.d.ts +2 -10
- package/lib/typescript/button/index.d.ts.map +1 -1
- package/lib/typescript/button/types.d.ts +1 -34
- package/lib/typescript/button/types.d.ts.map +1 -1
- package/lib/typescript/checkbox/CheckboxGroup.d.ts +9 -0
- package/lib/typescript/checkbox/CheckboxGroup.d.ts.map +1 -0
- package/lib/typescript/checkbox/CheckboxRoot.d.ts +6 -0
- package/lib/typescript/checkbox/CheckboxRoot.d.ts.map +1 -0
- package/lib/typescript/checkbox/CheckboxRoot.web.d.ts +6 -0
- package/lib/typescript/checkbox/CheckboxRoot.web.d.ts.map +1 -0
- package/lib/typescript/checkbox/index.d.ts +4 -10
- package/lib/typescript/checkbox/index.d.ts.map +1 -1
- package/lib/typescript/checkbox/types.d.ts +0 -17
- package/lib/typescript/checkbox/types.d.ts.map +1 -1
- package/lib/typescript/checkbox/useCheckboxRoot.d.ts +1 -1
- package/lib/typescript/chip/ChipRoot.d.ts +7 -0
- package/lib/typescript/chip/ChipRoot.d.ts.map +1 -0
- package/lib/typescript/chip/context.d.ts +6 -0
- package/lib/typescript/chip/context.d.ts.map +1 -0
- package/lib/typescript/chip/index.d.ts +3 -8
- package/lib/typescript/chip/index.d.ts.map +1 -1
- package/lib/typescript/chip/types.d.ts +3 -4
- package/lib/typescript/chip/types.d.ts.map +1 -1
- package/lib/typescript/dialog/DialogClose.d.ts +5 -0
- package/lib/typescript/dialog/DialogClose.d.ts.map +1 -0
- package/lib/typescript/dialog/DialogPopup.d.ts +14 -0
- package/lib/typescript/dialog/DialogPopup.d.ts.map +1 -0
- package/lib/typescript/dialog/DialogRoot.d.ts +7 -0
- package/lib/typescript/dialog/DialogRoot.d.ts.map +1 -0
- package/lib/typescript/dialog/DialogTrigger.d.ts +5 -0
- package/lib/typescript/dialog/DialogTrigger.d.ts.map +1 -0
- package/lib/typescript/dialog/index.d.ts +6 -17
- package/lib/typescript/dialog/index.d.ts.map +1 -1
- package/lib/typescript/dialog/types.d.ts +2 -24
- package/lib/typescript/dialog/types.d.ts.map +1 -1
- package/lib/typescript/field/FieldLabel.d.ts +12 -0
- package/lib/typescript/field/FieldLabel.d.ts.map +1 -0
- package/lib/typescript/field/FieldLabel.web.d.ts +24 -0
- package/lib/typescript/field/FieldLabel.web.d.ts.map +1 -0
- package/lib/typescript/field/FieldRoot.d.ts +8 -0
- package/lib/typescript/field/FieldRoot.d.ts.map +1 -0
- package/lib/typescript/field/index.d.ts +3 -12
- package/lib/typescript/field/index.d.ts.map +1 -1
- package/lib/typescript/field/types.d.ts +0 -20
- package/lib/typescript/field/types.d.ts.map +1 -1
- package/lib/typescript/form/FormRoot.d.ts +8 -0
- package/lib/typescript/form/FormRoot.d.ts.map +1 -0
- package/lib/typescript/form/FormRoot.web.d.ts +8 -0
- package/lib/typescript/form/FormRoot.web.d.ts.map +1 -0
- package/lib/typescript/form/index.d.ts +2 -5
- package/lib/typescript/form/index.d.ts.map +1 -1
- package/lib/typescript/form/types.d.ts +8 -9
- package/lib/typescript/form/types.d.ts.map +1 -1
- package/lib/typescript/index.d.ts +5 -3
- package/lib/typescript/index.d.ts.map +1 -1
- package/lib/typescript/input/InputField.android.d.ts +5 -0
- package/lib/typescript/input/InputField.android.d.ts.map +1 -0
- package/lib/typescript/input/InputField.d.ts +5 -0
- package/lib/typescript/input/InputField.d.ts.map +1 -0
- package/lib/typescript/input/InputField.web.d.ts +6 -0
- package/lib/typescript/input/InputField.web.d.ts.map +1 -0
- package/lib/typescript/input/InputRoot.d.ts +5 -0
- package/lib/typescript/input/InputRoot.d.ts.map +1 -0
- package/lib/typescript/input/index.d.ts +4 -8
- package/lib/typescript/input/index.d.ts.map +1 -1
- package/lib/typescript/input/types.d.ts +20 -39
- package/lib/typescript/input/types.d.ts.map +1 -1
- package/lib/typescript/link/LinkRoot.d.ts +9 -0
- package/lib/typescript/link/LinkRoot.d.ts.map +1 -0
- package/lib/typescript/link/index.d.ts +1 -1
- package/lib/typescript/link/index.d.ts.map +1 -1
- package/lib/typescript/list-item/ListItemRoot.d.ts +7 -0
- package/lib/typescript/list-item/ListItemRoot.d.ts.map +1 -0
- package/lib/typescript/list-item/context.d.ts +3 -3
- package/lib/typescript/list-item/context.d.ts.map +1 -1
- package/lib/typescript/list-item/index.d.ts +2 -14
- package/lib/typescript/list-item/index.d.ts.map +1 -1
- package/lib/typescript/list-item/types.d.ts +4 -52
- package/lib/typescript/list-item/types.d.ts.map +1 -1
- package/lib/typescript/otp-input/OtpInputField.d.ts +19 -0
- package/lib/typescript/otp-input/OtpInputField.d.ts.map +1 -0
- package/lib/typescript/otp-input/index.d.ts +4 -8
- package/lib/typescript/otp-input/index.d.ts.map +1 -1
- package/lib/typescript/otp-input/types.d.ts +0 -9
- package/lib/typescript/otp-input/types.d.ts.map +1 -1
- package/lib/typescript/otp-input/useOtpInput.d.ts +19 -0
- package/lib/typescript/otp-input/useOtpInput.d.ts.map +1 -0
- package/lib/typescript/overlay/useDismissOverlay.d.ts.map +1 -1
- package/lib/typescript/overlay/useEscapeKey.d.ts.map +1 -1
- package/lib/typescript/progress-bar/ProgressBarIndicator.d.ts +6 -0
- package/lib/typescript/progress-bar/ProgressBarIndicator.d.ts.map +1 -0
- package/lib/typescript/progress-bar/ProgressBarRoot.d.ts +6 -0
- package/lib/typescript/progress-bar/ProgressBarRoot.d.ts.map +1 -0
- package/lib/typescript/progress-bar/context.d.ts.map +1 -0
- package/lib/typescript/progress-bar/index.d.ts +6 -0
- package/lib/typescript/progress-bar/index.d.ts.map +1 -0
- package/lib/typescript/{progress → progress-bar}/types.d.ts +1 -4
- package/lib/typescript/progress-bar/types.d.ts.map +1 -0
- package/lib/typescript/radio/RadioGroup.d.ts +9 -0
- package/lib/typescript/radio/RadioGroup.d.ts.map +1 -0
- package/lib/typescript/radio/RadioRoot.d.ts +6 -0
- package/lib/typescript/radio/RadioRoot.d.ts.map +1 -0
- package/lib/typescript/radio/RadioRoot.web.d.ts +6 -0
- package/lib/typescript/radio/RadioRoot.web.d.ts.map +1 -0
- package/lib/typescript/radio/index.d.ts +4 -9
- package/lib/typescript/radio/index.d.ts.map +1 -1
- package/lib/typescript/radio/types.d.ts +0 -11
- package/lib/typescript/radio/types.d.ts.map +1 -1
- package/lib/typescript/radio/useRadioRoot.d.ts +1 -1
- package/lib/typescript/select/SelectContent.d.ts +9 -0
- package/lib/typescript/select/SelectContent.d.ts.map +1 -0
- package/lib/typescript/select/SelectItem.d.ts +8 -0
- package/lib/typescript/select/SelectItem.d.ts.map +1 -0
- package/lib/typescript/select/SelectRoot.d.ts +8 -0
- package/lib/typescript/select/SelectRoot.d.ts.map +1 -0
- package/lib/typescript/select/SelectTrigger.d.ts +9 -0
- package/lib/typescript/select/SelectTrigger.d.ts.map +1 -0
- package/lib/typescript/select/SelectTrigger.web.d.ts +13 -0
- package/lib/typescript/select/SelectTrigger.web.d.ts.map +1 -0
- package/lib/typescript/select/context.d.ts +1 -11
- package/lib/typescript/select/context.d.ts.map +1 -1
- package/lib/typescript/select/index.d.ts +6 -12
- package/lib/typescript/select/index.d.ts.map +1 -1
- package/lib/typescript/select/types.d.ts +1 -9
- package/lib/typescript/select/types.d.ts.map +1 -1
- package/lib/typescript/select/useContentFocus.d.ts +1 -1
- package/lib/typescript/select/useSelectTrigger.d.ts +77 -0
- package/lib/typescript/select/useSelectTrigger.d.ts.map +1 -0
- package/lib/typescript/select/useSelectTrigger.web.d.ts +16 -0
- package/lib/typescript/select/useSelectTrigger.web.d.ts.map +1 -0
- package/lib/typescript/slot/index.d.ts +2 -0
- package/lib/typescript/slot/index.d.ts.map +1 -0
- package/lib/typescript/switch/index.d.ts +2 -6
- package/lib/typescript/switch/index.d.ts.map +1 -1
- package/lib/typescript/switch/types.d.ts +35 -6
- package/lib/typescript/switch/types.d.ts.map +1 -1
- package/lib/typescript/switch/useSwitch.d.ts +20 -0
- package/lib/typescript/switch/useSwitch.d.ts.map +1 -0
- package/lib/typescript/tile/TileGroup.d.ts +5 -0
- package/lib/typescript/tile/TileGroup.d.ts.map +1 -0
- package/lib/typescript/tile/TileRoot.d.ts +5 -0
- package/lib/typescript/tile/TileRoot.d.ts.map +1 -0
- package/lib/typescript/tile/index.d.ts +3 -13
- package/lib/typescript/tile/index.d.ts.map +1 -1
- package/lib/typescript/tile/types.d.ts +7 -18
- package/lib/typescript/tile/types.d.ts.map +1 -1
- package/lib/typescript/utils/dataAttributes.d.ts +1 -1
- package/lib/typescript/utils/dataAttributes.d.ts.map +1 -1
- package/lib/typescript/utils/dataAttributes.web.d.ts +16 -0
- package/lib/typescript/utils/dataAttributes.web.d.ts.map +1 -1
- package/lib/typescript/utils/domDataAttributes.d.ts +13 -0
- package/lib/typescript/utils/domDataAttributes.d.ts.map +1 -1
- package/package.json +3 -2
- package/src/CLAUDE.md +64 -12
- package/src/avatar/AvatarRoot.tsx +39 -0
- package/src/avatar/index.ts +3 -43
- package/src/avatar/types.ts +1 -47
- package/src/button/ButtonRoot.tsx +115 -0
- package/src/button/index.ts +3 -0
- package/src/button/types.ts +1 -52
- package/src/checkbox/CheckboxGroup.tsx +50 -0
- package/src/checkbox/CheckboxRoot.tsx +102 -0
- package/src/checkbox/CheckboxRoot.web.tsx +92 -0
- package/src/checkbox/index.ts +4 -42
- package/src/checkbox/types.ts +1 -32
- package/src/chip/ChipRoot.tsx +168 -0
- package/src/chip/context.tsx +4 -0
- package/src/chip/index.ts +3 -18
- package/src/chip/types.ts +3 -6
- package/src/dialog/DialogClose.tsx +26 -0
- package/src/dialog/DialogPopup.tsx +162 -0
- package/src/dialog/DialogRoot.tsx +72 -0
- package/src/dialog/DialogTrigger.tsx +26 -0
- package/src/dialog/index.tsx +5 -86
- package/src/dialog/types.ts +2 -56
- package/src/field/FieldLabel.tsx +43 -0
- package/src/field/FieldLabel.web.tsx +71 -0
- package/src/field/FieldRoot.tsx +39 -0
- package/src/field/index.tsx +3 -68
- package/src/field/types.tsx +0 -34
- package/src/form/FormRoot.tsx +18 -0
- package/src/form/FormRoot.web.tsx +17 -0
- package/src/form/index.tsx +2 -12
- package/src/form/types.tsx +9 -11
- package/src/index.ts +9 -3
- package/src/input/InputField.android.tsx +107 -0
- package/src/input/InputField.tsx +100 -0
- package/src/input/InputField.web.tsx +141 -0
- package/src/input/InputRoot.tsx +104 -0
- package/src/input/index.tsx +4 -38
- package/src/input/types.ts +21 -53
- package/src/link/LinkRoot.tsx +108 -0
- package/src/link/index.tsx +1 -1
- package/src/list-item/ListItemRoot.tsx +183 -0
- package/src/list-item/context.tsx +2 -2
- package/src/list-item/index.ts +2 -79
- package/src/list-item/types.ts +4 -81
- package/src/otp-input/OtpInputField.tsx +122 -0
- package/src/otp-input/index.ts +16 -0
- package/src/otp-input/types.ts +0 -23
- package/src/otp-input/useOtpInput.ts +156 -0
- package/src/overlay/useDismissOverlay.ts +0 -2
- package/src/overlay/useEscapeKey.ts +0 -2
- package/src/progress-bar/ProgressBarIndicator.tsx +34 -0
- package/src/{progress/createProgressRoot.tsx → progress-bar/ProgressBarRoot.tsx} +17 -9
- package/src/progress-bar/index.ts +5 -0
- package/src/{progress → progress-bar}/types.ts +1 -14
- package/src/radio/{createRadioGroup.tsx → RadioGroup.tsx} +31 -13
- package/src/radio/RadioRoot.tsx +98 -0
- package/src/radio/RadioRoot.web.tsx +90 -0
- package/src/radio/index.ts +4 -36
- package/src/radio/types.ts +0 -22
- package/src/select/SelectContent.tsx +120 -0
- package/src/select/SelectItem.tsx +139 -0
- package/src/select/SelectRoot.tsx +154 -0
- package/src/select/SelectTrigger.tsx +82 -0
- package/src/select/SelectTrigger.web.tsx +238 -0
- package/src/select/context.tsx +1 -10
- package/src/select/index.ts +17 -0
- package/src/select/types.ts +1 -32
- package/src/select/useContentFocus.ts +1 -1
- package/src/select/useSelectTrigger.ts +345 -0
- package/src/select/useSelectTrigger.web.ts +267 -0
- package/src/slot/index.ts +1 -0
- package/src/switch/index.ts +7 -16
- package/src/switch/types.ts +35 -10
- package/src/switch/useSwitch.ts +75 -0
- package/src/tile/TileGroup.tsx +137 -0
- package/src/tile/{createTileRoot.tsx → TileRoot.tsx} +58 -45
- package/src/tile/index.ts +2 -72
- package/src/tile/types.ts +7 -39
- package/src/utils/dataAttributes.ts +4 -1
- package/src/utils/dataAttributes.web.ts +24 -0
- package/src/utils/domDataAttributes.ts +31 -0
- package/lib/commonjs/avatar/createAvatarBadge.js +0 -20
- package/lib/commonjs/avatar/createAvatarBadge.js.map +0 -1
- package/lib/commonjs/avatar/createAvatarIcon.js +0 -30
- package/lib/commonjs/avatar/createAvatarIcon.js.map +0 -1
- package/lib/commonjs/avatar/createAvatarImage.js +0 -51
- package/lib/commonjs/avatar/createAvatarImage.js.map +0 -1
- package/lib/commonjs/avatar/createAvatarRoot.js.map +0 -1
- package/lib/commonjs/avatar/createAvatarText.js +0 -50
- package/lib/commonjs/avatar/createAvatarText.js.map +0 -1
- package/lib/commonjs/button/createButtonGroup.js +0 -80
- package/lib/commonjs/button/createButtonGroup.js.map +0 -1
- package/lib/commonjs/button/createButtonIcon.js +0 -18
- package/lib/commonjs/button/createButtonIcon.js.map +0 -1
- package/lib/commonjs/button/createButtonRoot.js.map +0 -1
- package/lib/commonjs/button/createButtonSpinner.js +0 -34
- package/lib/commonjs/button/createButtonSpinner.js.map +0 -1
- package/lib/commonjs/button/createButtonText.js +0 -39
- package/lib/commonjs/button/createButtonText.js.map +0 -1
- package/lib/commonjs/checkbox/createCheckboxGroup.js.map +0 -1
- package/lib/commonjs/checkbox/createCheckboxIcon.js +0 -29
- package/lib/commonjs/checkbox/createCheckboxIcon.js.map +0 -1
- package/lib/commonjs/checkbox/createCheckboxIndicator.js +0 -47
- package/lib/commonjs/checkbox/createCheckboxIndicator.js.map +0 -1
- package/lib/commonjs/checkbox/createCheckboxLabel.js +0 -46
- package/lib/commonjs/checkbox/createCheckboxLabel.js.map +0 -1
- package/lib/commonjs/checkbox/createCheckboxRoot.js +0 -99
- package/lib/commonjs/checkbox/createCheckboxRoot.js.map +0 -1
- package/lib/commonjs/checkbox/createCheckboxRoot.web.js +0 -95
- package/lib/commonjs/checkbox/createCheckboxRoot.web.js.map +0 -1
- package/lib/commonjs/chip/createChipRoot.js +0 -132
- package/lib/commonjs/chip/createChipRoot.js.map +0 -1
- package/lib/commonjs/dialog/createDialogClose.js +0 -37
- package/lib/commonjs/dialog/createDialogClose.js.map +0 -1
- package/lib/commonjs/dialog/createDialogContent.js +0 -21
- package/lib/commonjs/dialog/createDialogContent.js.map +0 -1
- package/lib/commonjs/dialog/createDialogDescription.js +0 -30
- package/lib/commonjs/dialog/createDialogDescription.js.map +0 -1
- package/lib/commonjs/dialog/createDialogFooter.js.map +0 -1
- package/lib/commonjs/dialog/createDialogHeader.js +0 -21
- package/lib/commonjs/dialog/createDialogHeader.js.map +0 -1
- package/lib/commonjs/dialog/createDialogPopup.js.map +0 -1
- package/lib/commonjs/dialog/createDialogRoot.js.map +0 -1
- package/lib/commonjs/dialog/createDialogTitle.js +0 -21
- package/lib/commonjs/dialog/createDialogTitle.js.map +0 -1
- package/lib/commonjs/dialog/createDialogTrigger.js +0 -37
- package/lib/commonjs/dialog/createDialogTrigger.js.map +0 -1
- package/lib/commonjs/field/createFieldError.js +0 -41
- package/lib/commonjs/field/createFieldError.js.map +0 -1
- package/lib/commonjs/field/createFieldErrorIcon.js +0 -18
- package/lib/commonjs/field/createFieldErrorIcon.js.map +0 -1
- package/lib/commonjs/field/createFieldErrorText.js +0 -18
- package/lib/commonjs/field/createFieldErrorText.js.map +0 -1
- package/lib/commonjs/field/createFieldHelper.js +0 -41
- package/lib/commonjs/field/createFieldHelper.js.map +0 -1
- package/lib/commonjs/field/createFieldHelperText.js +0 -18
- package/lib/commonjs/field/createFieldHelperText.js.map +0 -1
- package/lib/commonjs/field/createFieldLabel.js +0 -36
- package/lib/commonjs/field/createFieldLabel.js.map +0 -1
- package/lib/commonjs/field/createFieldRoot.js +0 -35
- package/lib/commonjs/field/createFieldRoot.js.map +0 -1
- package/lib/commonjs/form/createFormRoot.js +0 -21
- package/lib/commonjs/form/createFormRoot.js.map +0 -1
- package/lib/commonjs/input/createInputField.js.map +0 -1
- package/lib/commonjs/input/createInputRoot.js.map +0 -1
- package/lib/commonjs/input/createInputSlot.js +0 -44
- package/lib/commonjs/input/createInputSlot.js.map +0 -1
- package/lib/commonjs/link/createLink.js.map +0 -1
- package/lib/commonjs/list-item/createListItemContent.js +0 -30
- package/lib/commonjs/list-item/createListItemContent.js.map +0 -1
- package/lib/commonjs/list-item/createListItemDescription.js +0 -25
- package/lib/commonjs/list-item/createListItemDescription.js.map +0 -1
- package/lib/commonjs/list-item/createListItemLeadingSlot.js +0 -34
- package/lib/commonjs/list-item/createListItemLeadingSlot.js.map +0 -1
- package/lib/commonjs/list-item/createListItemMeta.js +0 -25
- package/lib/commonjs/list-item/createListItemMeta.js.map +0 -1
- package/lib/commonjs/list-item/createListItemRoot.js.map +0 -1
- package/lib/commonjs/list-item/createListItemSectionHeader.js +0 -54
- package/lib/commonjs/list-item/createListItemSectionHeader.js.map +0 -1
- package/lib/commonjs/list-item/createListItemTitle.js +0 -25
- package/lib/commonjs/list-item/createListItemTitle.js.map +0 -1
- package/lib/commonjs/list-item/createListItemTrailingSlot.js +0 -28
- package/lib/commonjs/list-item/createListItemTrailingSlot.js.map +0 -1
- package/lib/commonjs/otp-input/createOtpInputCell.js +0 -29
- package/lib/commonjs/otp-input/createOtpInputCell.js.map +0 -1
- package/lib/commonjs/otp-input/createOtpInputField.js.map +0 -1
- package/lib/commonjs/otp-input/createOtpInputRoot.js.map +0 -1
- package/lib/commonjs/progress/context.js.map +0 -1
- package/lib/commonjs/progress/createProgressIndicator.js.map +0 -1
- package/lib/commonjs/progress/createProgressRoot.js.map +0 -1
- package/lib/commonjs/progress/index.js +0 -25
- package/lib/commonjs/progress/index.js.map +0 -1
- package/lib/commonjs/radio/createRadioGroup.js.map +0 -1
- package/lib/commonjs/radio/createRadioIndicator.js +0 -43
- package/lib/commonjs/radio/createRadioIndicator.js.map +0 -1
- package/lib/commonjs/radio/createRadioLabel.js +0 -38
- package/lib/commonjs/radio/createRadioLabel.js.map +0 -1
- package/lib/commonjs/radio/createRadioRoot.js +0 -95
- package/lib/commonjs/radio/createRadioRoot.js.map +0 -1
- package/lib/commonjs/radio/createRadioRoot.web.js +0 -87
- package/lib/commonjs/radio/createRadioRoot.web.js.map +0 -1
- package/lib/commonjs/select/createSelectContent.js.map +0 -1
- package/lib/commonjs/select/createSelectIcon.js +0 -43
- package/lib/commonjs/select/createSelectIcon.js.map +0 -1
- package/lib/commonjs/select/createSelectItem.js.map +0 -1
- package/lib/commonjs/select/createSelectItemLabel.js +0 -41
- package/lib/commonjs/select/createSelectItemLabel.js.map +0 -1
- package/lib/commonjs/select/createSelectRoot.js.map +0 -1
- package/lib/commonjs/select/createSelectTrigger.js +0 -192
- package/lib/commonjs/select/createSelectTrigger.js.map +0 -1
- package/lib/commonjs/select/createSelectValue.js +0 -53
- package/lib/commonjs/select/createSelectValue.js.map +0 -1
- package/lib/commonjs/switch/createSwitchRoot.js +0 -73
- package/lib/commonjs/switch/createSwitchRoot.js.map +0 -1
- package/lib/commonjs/tile/createTileContent.js +0 -30
- package/lib/commonjs/tile/createTileContent.js.map +0 -1
- package/lib/commonjs/tile/createTileDescription.js +0 -28
- package/lib/commonjs/tile/createTileDescription.js.map +0 -1
- package/lib/commonjs/tile/createTileGroup.js.map +0 -1
- package/lib/commonjs/tile/createTileIndicator.js +0 -46
- package/lib/commonjs/tile/createTileIndicator.js.map +0 -1
- package/lib/commonjs/tile/createTileLeadingSlot.js +0 -34
- package/lib/commonjs/tile/createTileLeadingSlot.js.map +0 -1
- package/lib/commonjs/tile/createTileRoot.js +0 -133
- package/lib/commonjs/tile/createTileRoot.js.map +0 -1
- package/lib/commonjs/tile/createTileTitle.js +0 -28
- package/lib/commonjs/tile/createTileTitle.js.map +0 -1
- package/lib/commonjs/tile/createTileTrailingSlot.js +0 -35
- package/lib/commonjs/tile/createTileTrailingSlot.js.map +0 -1
- package/lib/module/avatar/createAvatarBadge.js +0 -15
- package/lib/module/avatar/createAvatarBadge.js.map +0 -1
- package/lib/module/avatar/createAvatarIcon.js +0 -25
- package/lib/module/avatar/createAvatarIcon.js.map +0 -1
- package/lib/module/avatar/createAvatarImage.js +0 -46
- package/lib/module/avatar/createAvatarImage.js.map +0 -1
- package/lib/module/avatar/createAvatarRoot.js.map +0 -1
- package/lib/module/avatar/createAvatarText.js +0 -45
- package/lib/module/avatar/createAvatarText.js.map +0 -1
- package/lib/module/button/createButtonGroup.js +0 -74
- package/lib/module/button/createButtonGroup.js.map +0 -1
- package/lib/module/button/createButtonIcon.js +0 -13
- package/lib/module/button/createButtonIcon.js.map +0 -1
- package/lib/module/button/createButtonRoot.js.map +0 -1
- package/lib/module/button/createButtonSpinner.js +0 -29
- package/lib/module/button/createButtonSpinner.js.map +0 -1
- package/lib/module/button/createButtonText.js +0 -34
- package/lib/module/button/createButtonText.js.map +0 -1
- package/lib/module/checkbox/createCheckboxGroup.js.map +0 -1
- package/lib/module/checkbox/createCheckboxIcon.js +0 -24
- package/lib/module/checkbox/createCheckboxIcon.js.map +0 -1
- package/lib/module/checkbox/createCheckboxIndicator.js +0 -42
- package/lib/module/checkbox/createCheckboxIndicator.js.map +0 -1
- package/lib/module/checkbox/createCheckboxLabel.js +0 -41
- package/lib/module/checkbox/createCheckboxLabel.js.map +0 -1
- package/lib/module/checkbox/createCheckboxRoot.js +0 -94
- package/lib/module/checkbox/createCheckboxRoot.js.map +0 -1
- package/lib/module/checkbox/createCheckboxRoot.web.js +0 -91
- package/lib/module/checkbox/createCheckboxRoot.web.js.map +0 -1
- package/lib/module/chip/createChipRoot.js +0 -126
- package/lib/module/chip/createChipRoot.js.map +0 -1
- package/lib/module/dialog/createDialogClose.js +0 -31
- package/lib/module/dialog/createDialogClose.js.map +0 -1
- package/lib/module/dialog/createDialogContent.js +0 -15
- package/lib/module/dialog/createDialogContent.js.map +0 -1
- package/lib/module/dialog/createDialogDescription.js +0 -24
- package/lib/module/dialog/createDialogDescription.js.map +0 -1
- package/lib/module/dialog/createDialogFooter.js +0 -15
- package/lib/module/dialog/createDialogFooter.js.map +0 -1
- package/lib/module/dialog/createDialogHeader.js +0 -15
- package/lib/module/dialog/createDialogHeader.js.map +0 -1
- package/lib/module/dialog/createDialogPopup.js.map +0 -1
- package/lib/module/dialog/createDialogRoot.js.map +0 -1
- package/lib/module/dialog/createDialogTitle.js +0 -15
- package/lib/module/dialog/createDialogTitle.js.map +0 -1
- package/lib/module/dialog/createDialogTrigger.js +0 -31
- package/lib/module/dialog/createDialogTrigger.js.map +0 -1
- package/lib/module/field/createFieldError.js +0 -35
- package/lib/module/field/createFieldError.js.map +0 -1
- package/lib/module/field/createFieldErrorIcon.js +0 -13
- package/lib/module/field/createFieldErrorIcon.js.map +0 -1
- package/lib/module/field/createFieldErrorText.js +0 -13
- package/lib/module/field/createFieldErrorText.js.map +0 -1
- package/lib/module/field/createFieldHelper.js +0 -35
- package/lib/module/field/createFieldHelper.js.map +0 -1
- package/lib/module/field/createFieldHelperText.js +0 -13
- package/lib/module/field/createFieldHelperText.js.map +0 -1
- package/lib/module/field/createFieldLabel.js +0 -31
- package/lib/module/field/createFieldLabel.js.map +0 -1
- package/lib/module/field/createFieldRoot.js +0 -29
- package/lib/module/field/createFieldRoot.js.map +0 -1
- package/lib/module/form/createFormRoot.js +0 -15
- package/lib/module/form/createFormRoot.js.map +0 -1
- package/lib/module/input/createInputField.js.map +0 -1
- package/lib/module/input/createInputRoot.js.map +0 -1
- package/lib/module/input/createInputSlot.js +0 -39
- package/lib/module/input/createInputSlot.js.map +0 -1
- package/lib/module/link/createLink.js.map +0 -1
- package/lib/module/list-item/createListItemContent.js +0 -24
- package/lib/module/list-item/createListItemContent.js.map +0 -1
- package/lib/module/list-item/createListItemDescription.js +0 -19
- package/lib/module/list-item/createListItemDescription.js.map +0 -1
- package/lib/module/list-item/createListItemLeadingSlot.js +0 -28
- package/lib/module/list-item/createListItemLeadingSlot.js.map +0 -1
- package/lib/module/list-item/createListItemMeta.js +0 -19
- package/lib/module/list-item/createListItemMeta.js.map +0 -1
- package/lib/module/list-item/createListItemRoot.js.map +0 -1
- package/lib/module/list-item/createListItemSectionHeader.js +0 -48
- package/lib/module/list-item/createListItemSectionHeader.js.map +0 -1
- package/lib/module/list-item/createListItemTitle.js +0 -19
- package/lib/module/list-item/createListItemTitle.js.map +0 -1
- package/lib/module/list-item/createListItemTrailingSlot.js +0 -22
- package/lib/module/list-item/createListItemTrailingSlot.js.map +0 -1
- package/lib/module/otp-input/createOtpInputCell.js +0 -24
- package/lib/module/otp-input/createOtpInputCell.js.map +0 -1
- package/lib/module/otp-input/createOtpInputField.js.map +0 -1
- package/lib/module/otp-input/createOtpInputRoot.js.map +0 -1
- package/lib/module/progress/context.js.map +0 -1
- package/lib/module/progress/createProgressIndicator.js.map +0 -1
- package/lib/module/progress/createProgressRoot.js.map +0 -1
- package/lib/module/progress/index.js +0 -15
- package/lib/module/progress/index.js.map +0 -1
- package/lib/module/radio/createRadioGroup.js.map +0 -1
- package/lib/module/radio/createRadioIndicator.js +0 -38
- package/lib/module/radio/createRadioIndicator.js.map +0 -1
- package/lib/module/radio/createRadioLabel.js +0 -33
- package/lib/module/radio/createRadioLabel.js.map +0 -1
- package/lib/module/radio/createRadioRoot.js +0 -90
- package/lib/module/radio/createRadioRoot.js.map +0 -1
- package/lib/module/radio/createRadioRoot.web.js +0 -82
- package/lib/module/radio/createRadioRoot.web.js.map +0 -1
- package/lib/module/select/createSelectContent.js.map +0 -1
- package/lib/module/select/createSelectIcon.js +0 -38
- package/lib/module/select/createSelectIcon.js.map +0 -1
- package/lib/module/select/createSelectItem.js.map +0 -1
- package/lib/module/select/createSelectItemLabel.js +0 -36
- package/lib/module/select/createSelectItemLabel.js.map +0 -1
- package/lib/module/select/createSelectRoot.js.map +0 -1
- package/lib/module/select/createSelectTrigger.js +0 -187
- package/lib/module/select/createSelectTrigger.js.map +0 -1
- package/lib/module/select/createSelectValue.js +0 -48
- package/lib/module/select/createSelectValue.js.map +0 -1
- package/lib/module/switch/createSwitchRoot.js +0 -67
- package/lib/module/switch/createSwitchRoot.js.map +0 -1
- package/lib/module/tile/createTileContent.js +0 -24
- package/lib/module/tile/createTileContent.js.map +0 -1
- package/lib/module/tile/createTileDescription.js +0 -22
- package/lib/module/tile/createTileDescription.js.map +0 -1
- package/lib/module/tile/createTileGroup.js.map +0 -1
- package/lib/module/tile/createTileIndicator.js +0 -40
- package/lib/module/tile/createTileIndicator.js.map +0 -1
- package/lib/module/tile/createTileLeadingSlot.js +0 -28
- package/lib/module/tile/createTileLeadingSlot.js.map +0 -1
- package/lib/module/tile/createTileRoot.js.map +0 -1
- package/lib/module/tile/createTileTitle.js +0 -22
- package/lib/module/tile/createTileTitle.js.map +0 -1
- package/lib/module/tile/createTileTrailingSlot.js +0 -29
- package/lib/module/tile/createTileTrailingSlot.js.map +0 -1
- package/lib/typescript/avatar/createAvatarBadge.d.ts +0 -4
- package/lib/typescript/avatar/createAvatarBadge.d.ts.map +0 -1
- package/lib/typescript/avatar/createAvatarIcon.d.ts +0 -4
- package/lib/typescript/avatar/createAvatarIcon.d.ts.map +0 -1
- package/lib/typescript/avatar/createAvatarImage.d.ts +0 -4
- package/lib/typescript/avatar/createAvatarImage.d.ts.map +0 -1
- package/lib/typescript/avatar/createAvatarRoot.d.ts +0 -4
- package/lib/typescript/avatar/createAvatarRoot.d.ts.map +0 -1
- package/lib/typescript/avatar/createAvatarText.d.ts +0 -4
- package/lib/typescript/avatar/createAvatarText.d.ts.map +0 -1
- package/lib/typescript/button/createButtonGroup.d.ts +0 -4
- package/lib/typescript/button/createButtonGroup.d.ts.map +0 -1
- package/lib/typescript/button/createButtonIcon.d.ts +0 -2
- package/lib/typescript/button/createButtonIcon.d.ts.map +0 -1
- package/lib/typescript/button/createButtonRoot.d.ts +0 -6
- package/lib/typescript/button/createButtonRoot.d.ts.map +0 -1
- package/lib/typescript/button/createButtonSpinner.d.ts +0 -4
- package/lib/typescript/button/createButtonSpinner.d.ts.map +0 -1
- package/lib/typescript/button/createButtonText.d.ts +0 -4
- package/lib/typescript/button/createButtonText.d.ts.map +0 -1
- package/lib/typescript/checkbox/createCheckboxGroup.d.ts +0 -3
- package/lib/typescript/checkbox/createCheckboxGroup.d.ts.map +0 -1
- package/lib/typescript/checkbox/createCheckboxIcon.d.ts +0 -3
- package/lib/typescript/checkbox/createCheckboxIcon.d.ts.map +0 -1
- package/lib/typescript/checkbox/createCheckboxIndicator.d.ts +0 -5
- package/lib/typescript/checkbox/createCheckboxIndicator.d.ts.map +0 -1
- package/lib/typescript/checkbox/createCheckboxLabel.d.ts +0 -5
- package/lib/typescript/checkbox/createCheckboxLabel.d.ts.map +0 -1
- package/lib/typescript/checkbox/createCheckboxRoot.d.ts +0 -2
- package/lib/typescript/checkbox/createCheckboxRoot.d.ts.map +0 -1
- package/lib/typescript/checkbox/createCheckboxRoot.web.d.ts +0 -6
- package/lib/typescript/checkbox/createCheckboxRoot.web.d.ts.map +0 -1
- package/lib/typescript/chip/createChipRoot.d.ts +0 -4
- package/lib/typescript/chip/createChipRoot.d.ts.map +0 -1
- package/lib/typescript/dialog/createDialogClose.d.ts +0 -4
- package/lib/typescript/dialog/createDialogClose.d.ts.map +0 -1
- package/lib/typescript/dialog/createDialogContent.d.ts +0 -4
- package/lib/typescript/dialog/createDialogContent.d.ts.map +0 -1
- package/lib/typescript/dialog/createDialogDescription.d.ts +0 -4
- package/lib/typescript/dialog/createDialogDescription.d.ts.map +0 -1
- package/lib/typescript/dialog/createDialogFooter.d.ts +0 -4
- package/lib/typescript/dialog/createDialogFooter.d.ts.map +0 -1
- package/lib/typescript/dialog/createDialogHeader.d.ts +0 -4
- package/lib/typescript/dialog/createDialogHeader.d.ts.map +0 -1
- package/lib/typescript/dialog/createDialogPopup.d.ts +0 -4
- package/lib/typescript/dialog/createDialogPopup.d.ts.map +0 -1
- package/lib/typescript/dialog/createDialogRoot.d.ts +0 -4
- package/lib/typescript/dialog/createDialogRoot.d.ts.map +0 -1
- package/lib/typescript/dialog/createDialogTitle.d.ts +0 -4
- package/lib/typescript/dialog/createDialogTitle.d.ts.map +0 -1
- package/lib/typescript/dialog/createDialogTrigger.d.ts +0 -4
- package/lib/typescript/dialog/createDialogTrigger.d.ts.map +0 -1
- package/lib/typescript/field/createFieldError.d.ts +0 -5
- package/lib/typescript/field/createFieldError.d.ts.map +0 -1
- package/lib/typescript/field/createFieldErrorIcon.d.ts +0 -5
- package/lib/typescript/field/createFieldErrorIcon.d.ts.map +0 -1
- package/lib/typescript/field/createFieldErrorText.d.ts +0 -5
- package/lib/typescript/field/createFieldErrorText.d.ts.map +0 -1
- package/lib/typescript/field/createFieldHelper.d.ts +0 -5
- package/lib/typescript/field/createFieldHelper.d.ts.map +0 -1
- package/lib/typescript/field/createFieldHelperText.d.ts +0 -5
- package/lib/typescript/field/createFieldHelperText.d.ts.map +0 -1
- package/lib/typescript/field/createFieldLabel.d.ts +0 -6
- package/lib/typescript/field/createFieldLabel.d.ts.map +0 -1
- package/lib/typescript/field/createFieldRoot.d.ts +0 -6
- package/lib/typescript/field/createFieldRoot.d.ts.map +0 -1
- package/lib/typescript/form/createFormRoot.d.ts +0 -4
- package/lib/typescript/form/createFormRoot.d.ts.map +0 -1
- package/lib/typescript/input/createInputField.d.ts +0 -4
- package/lib/typescript/input/createInputField.d.ts.map +0 -1
- package/lib/typescript/input/createInputRoot.d.ts +0 -4
- package/lib/typescript/input/createInputRoot.d.ts.map +0 -1
- package/lib/typescript/input/createInputSlot.d.ts +0 -4
- package/lib/typescript/input/createInputSlot.d.ts.map +0 -1
- package/lib/typescript/link/createLink.d.ts +0 -6
- package/lib/typescript/link/createLink.d.ts.map +0 -1
- package/lib/typescript/list-item/createListItemContent.d.ts +0 -3
- package/lib/typescript/list-item/createListItemContent.d.ts.map +0 -1
- package/lib/typescript/list-item/createListItemDescription.d.ts +0 -3
- package/lib/typescript/list-item/createListItemDescription.d.ts.map +0 -1
- package/lib/typescript/list-item/createListItemLeadingSlot.d.ts +0 -4
- package/lib/typescript/list-item/createListItemLeadingSlot.d.ts.map +0 -1
- package/lib/typescript/list-item/createListItemMeta.d.ts +0 -3
- package/lib/typescript/list-item/createListItemMeta.d.ts.map +0 -1
- package/lib/typescript/list-item/createListItemRoot.d.ts +0 -4
- package/lib/typescript/list-item/createListItemRoot.d.ts.map +0 -1
- package/lib/typescript/list-item/createListItemSectionHeader.d.ts +0 -4
- package/lib/typescript/list-item/createListItemSectionHeader.d.ts.map +0 -1
- package/lib/typescript/list-item/createListItemTitle.d.ts +0 -3
- package/lib/typescript/list-item/createListItemTitle.d.ts.map +0 -1
- package/lib/typescript/list-item/createListItemTrailingSlot.d.ts +0 -3
- package/lib/typescript/list-item/createListItemTrailingSlot.d.ts.map +0 -1
- package/lib/typescript/otp-input/createOtpInputCell.d.ts +0 -4
- package/lib/typescript/otp-input/createOtpInputCell.d.ts.map +0 -1
- package/lib/typescript/otp-input/createOtpInputField.d.ts +0 -4
- package/lib/typescript/otp-input/createOtpInputField.d.ts.map +0 -1
- package/lib/typescript/otp-input/createOtpInputRoot.d.ts +0 -4
- package/lib/typescript/otp-input/createOtpInputRoot.d.ts.map +0 -1
- package/lib/typescript/progress/context.d.ts.map +0 -1
- package/lib/typescript/progress/createProgressIndicator.d.ts +0 -3
- package/lib/typescript/progress/createProgressIndicator.d.ts.map +0 -1
- package/lib/typescript/progress/createProgressRoot.d.ts +0 -4
- package/lib/typescript/progress/createProgressRoot.d.ts.map +0 -1
- package/lib/typescript/progress/index.d.ts +0 -10
- package/lib/typescript/progress/index.d.ts.map +0 -1
- package/lib/typescript/progress/types.d.ts.map +0 -1
- package/lib/typescript/radio/createRadioGroup.d.ts +0 -3
- package/lib/typescript/radio/createRadioGroup.d.ts.map +0 -1
- package/lib/typescript/radio/createRadioIndicator.d.ts +0 -5
- package/lib/typescript/radio/createRadioIndicator.d.ts.map +0 -1
- package/lib/typescript/radio/createRadioLabel.d.ts +0 -5
- package/lib/typescript/radio/createRadioLabel.d.ts.map +0 -1
- package/lib/typescript/radio/createRadioRoot.d.ts +0 -3
- package/lib/typescript/radio/createRadioRoot.d.ts.map +0 -1
- package/lib/typescript/radio/createRadioRoot.web.d.ts +0 -3
- package/lib/typescript/radio/createRadioRoot.web.d.ts.map +0 -1
- package/lib/typescript/select/createSelectContent.d.ts +0 -4
- package/lib/typescript/select/createSelectContent.d.ts.map +0 -1
- package/lib/typescript/select/createSelectIcon.d.ts +0 -2
- package/lib/typescript/select/createSelectIcon.d.ts.map +0 -1
- package/lib/typescript/select/createSelectItem.d.ts +0 -6
- package/lib/typescript/select/createSelectItem.d.ts.map +0 -1
- package/lib/typescript/select/createSelectItemLabel.d.ts +0 -4
- package/lib/typescript/select/createSelectItemLabel.d.ts.map +0 -1
- package/lib/typescript/select/createSelectRoot.d.ts +0 -4
- package/lib/typescript/select/createSelectRoot.d.ts.map +0 -1
- package/lib/typescript/select/createSelectTrigger.d.ts +0 -7
- package/lib/typescript/select/createSelectTrigger.d.ts.map +0 -1
- package/lib/typescript/select/createSelectValue.d.ts +0 -4
- package/lib/typescript/select/createSelectValue.d.ts.map +0 -1
- package/lib/typescript/switch/createSwitchRoot.d.ts +0 -3
- package/lib/typescript/switch/createSwitchRoot.d.ts.map +0 -1
- package/lib/typescript/tile/createTileContent.d.ts +0 -3
- package/lib/typescript/tile/createTileContent.d.ts.map +0 -1
- package/lib/typescript/tile/createTileDescription.d.ts +0 -3
- package/lib/typescript/tile/createTileDescription.d.ts.map +0 -1
- package/lib/typescript/tile/createTileGroup.d.ts +0 -4
- package/lib/typescript/tile/createTileGroup.d.ts.map +0 -1
- package/lib/typescript/tile/createTileIndicator.d.ts +0 -4
- package/lib/typescript/tile/createTileIndicator.d.ts.map +0 -1
- package/lib/typescript/tile/createTileLeadingSlot.d.ts +0 -4
- package/lib/typescript/tile/createTileLeadingSlot.d.ts.map +0 -1
- package/lib/typescript/tile/createTileRoot.d.ts +0 -4
- package/lib/typescript/tile/createTileRoot.d.ts.map +0 -1
- package/lib/typescript/tile/createTileTitle.d.ts +0 -3
- package/lib/typescript/tile/createTileTitle.d.ts.map +0 -1
- package/lib/typescript/tile/createTileTrailingSlot.d.ts +0 -9
- package/lib/typescript/tile/createTileTrailingSlot.d.ts.map +0 -1
- package/src/avatar/createAvatarBadge.tsx +0 -12
- package/src/avatar/createAvatarIcon.tsx +0 -16
- package/src/avatar/createAvatarImage.tsx +0 -40
- package/src/avatar/createAvatarRoot.tsx +0 -23
- package/src/avatar/createAvatarText.tsx +0 -39
- package/src/button/createButtonGroup.tsx +0 -88
- package/src/button/createButtonIcon.tsx +0 -8
- package/src/button/createButtonRoot.tsx +0 -102
- package/src/button/createButtonSpinner.tsx +0 -20
- package/src/button/createButtonText.tsx +0 -23
- package/src/button/index.tsx +0 -53
- package/src/checkbox/createCheckboxGroup.tsx +0 -32
- package/src/checkbox/createCheckboxIcon.tsx +0 -18
- package/src/checkbox/createCheckboxIndicator.tsx +0 -43
- package/src/checkbox/createCheckboxLabel.tsx +0 -42
- package/src/checkbox/createCheckboxRoot.tsx +0 -100
- package/src/checkbox/createCheckboxRoot.web.tsx +0 -83
- package/src/chip/createChipRoot.tsx +0 -144
- package/src/dialog/createDialogClose.tsx +0 -27
- package/src/dialog/createDialogContent.tsx +0 -11
- package/src/dialog/createDialogDescription.tsx +0 -20
- package/src/dialog/createDialogFooter.tsx +0 -11
- package/src/dialog/createDialogHeader.tsx +0 -11
- package/src/dialog/createDialogPopup.tsx +0 -146
- package/src/dialog/createDialogRoot.tsx +0 -66
- package/src/dialog/createDialogTitle.tsx +0 -11
- package/src/dialog/createDialogTrigger.tsx +0 -27
- package/src/field/createFieldError.tsx +0 -32
- package/src/field/createFieldErrorIcon.tsx +0 -9
- package/src/field/createFieldErrorText.tsx +0 -9
- package/src/field/createFieldHelper.tsx +0 -28
- package/src/field/createFieldHelperText.tsx +0 -9
- package/src/field/createFieldLabel.tsx +0 -33
- package/src/field/createFieldRoot.tsx +0 -27
- package/src/form/createFormRoot.tsx +0 -13
- package/src/input/createInputField.tsx +0 -120
- package/src/input/createInputRoot.tsx +0 -92
- package/src/input/createInputSlot.tsx +0 -39
- package/src/link/createLink.tsx +0 -89
- package/src/list-item/createListItemContent.tsx +0 -23
- package/src/list-item/createListItemDescription.tsx +0 -19
- package/src/list-item/createListItemLeadingSlot.tsx +0 -30
- package/src/list-item/createListItemMeta.tsx +0 -17
- package/src/list-item/createListItemRoot.tsx +0 -195
- package/src/list-item/createListItemSectionHeader.tsx +0 -53
- package/src/list-item/createListItemTitle.tsx +0 -17
- package/src/list-item/createListItemTrailingSlot.tsx +0 -21
- package/src/otp-input/createOtpInputCell.tsx +0 -22
- package/src/otp-input/createOtpInputField.tsx +0 -98
- package/src/otp-input/createOtpInputRoot.tsx +0 -179
- package/src/otp-input/index.tsx +0 -34
- package/src/progress/createProgressIndicator.tsx +0 -35
- package/src/progress/index.ts +0 -28
- package/src/radio/createRadioIndicator.tsx +0 -32
- package/src/radio/createRadioLabel.tsx +0 -28
- package/src/radio/createRadioRoot.tsx +0 -100
- package/src/radio/createRadioRoot.web.tsx +0 -81
- package/src/select/createSelectContent.tsx +0 -115
- package/src/select/createSelectIcon.tsx +0 -28
- package/src/select/createSelectItem.tsx +0 -121
- package/src/select/createSelectItemLabel.tsx +0 -30
- package/src/select/createSelectRoot.tsx +0 -134
- package/src/select/createSelectTrigger.tsx +0 -241
- package/src/select/createSelectValue.tsx +0 -38
- package/src/select/index.tsx +0 -73
- package/src/switch/createSwitchRoot.tsx +0 -72
- package/src/tile/createTileContent.tsx +0 -23
- package/src/tile/createTileDescription.tsx +0 -19
- package/src/tile/createTileGroup.tsx +0 -134
- package/src/tile/createTileIndicator.tsx +0 -38
- package/src/tile/createTileLeadingSlot.tsx +0 -30
- package/src/tile/createTileTitle.tsx +0 -19
- package/src/tile/createTileTrailingSlot.tsx +0 -25
- /package/lib/commonjs/{progress → progress-bar}/context.js +0 -0
- /package/lib/commonjs/{progress → progress-bar}/types.js +0 -0
- /package/lib/module/{progress → progress-bar}/context.js +0 -0
- /package/lib/module/{progress → progress-bar}/types.js +0 -0
- /package/lib/typescript/{progress → progress-bar}/context.d.ts +0 -0
- /package/src/{progress → progress-bar}/context.tsx +0 -0
|
@@ -1,195 +0,0 @@
|
|
|
1
|
-
import React, { forwardRef, useMemo } from 'react';
|
|
2
|
-
import type { PressableProps } from 'react-native';
|
|
3
|
-
import { composeEventHandlers, mergeRefs } from '@cdx-ui/utils';
|
|
4
|
-
import { useFocus, useFocusRing } from '@react-native-aria/focus';
|
|
5
|
-
import { useHover, usePress } from '@react-native-aria/interactions';
|
|
6
|
-
import { dataAttributes } from '../utils/dataAttributes';
|
|
7
|
-
import { ListItemProvider } from './context';
|
|
8
|
-
import type { IListItemProps, IListItemPressablePassthrough } from './types';
|
|
9
|
-
|
|
10
|
-
function listItemRootDataAttrs(
|
|
11
|
-
size: IListItemProps['size'],
|
|
12
|
-
showSeparator: boolean | undefined,
|
|
13
|
-
crossAlign: IListItemProps['crossAlign'],
|
|
14
|
-
) {
|
|
15
|
-
return dataAttributes({
|
|
16
|
-
slot: 'list-item',
|
|
17
|
-
size: size ?? 'default',
|
|
18
|
-
separator: showSeparator ?? true,
|
|
19
|
-
crossAlign: crossAlign ?? 'center',
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
function rowStyleForCrossAlign(crossAlign: IListItemProps['crossAlign']) {
|
|
24
|
-
return {
|
|
25
|
-
flexDirection: 'row' as const,
|
|
26
|
-
alignSelf: 'stretch' as const,
|
|
27
|
-
alignItems: crossAlign === 'start' ? ('flex-start' as const) : ('center' as const),
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export const createListItemRoot = <V, P>(
|
|
32
|
-
BaseView: React.ComponentType<V>,
|
|
33
|
-
BasePressable: React.ComponentType<P>,
|
|
34
|
-
) =>
|
|
35
|
-
forwardRef(
|
|
36
|
-
(
|
|
37
|
-
{
|
|
38
|
-
asChild = false,
|
|
39
|
-
children,
|
|
40
|
-
onPress,
|
|
41
|
-
size = 'default',
|
|
42
|
-
showSeparator = true,
|
|
43
|
-
crossAlign = 'center',
|
|
44
|
-
isDisabled = false,
|
|
45
|
-
style,
|
|
46
|
-
...restProps
|
|
47
|
-
}: IListItemProps,
|
|
48
|
-
ref: React.Ref<unknown>,
|
|
49
|
-
) => {
|
|
50
|
-
const childOnPress = React.isValidElement(children)
|
|
51
|
-
? ((children.props as { onPress?: unknown }).onPress as
|
|
52
|
-
| IListItemProps['onPress']
|
|
53
|
-
| undefined)
|
|
54
|
-
: undefined;
|
|
55
|
-
|
|
56
|
-
// asChild always wins when explicitly set with a valid element — even when the press
|
|
57
|
-
// surface is built internally by the child (e.g. `Link` adds its onPress via `useLink`,
|
|
58
|
-
// not as a JSX-level prop). The clone path below preserves the child's own press by
|
|
59
|
-
// *omitting* `onPress` when there is nothing to compose.
|
|
60
|
-
const asChildInteractive = asChild && React.isValidElement(children);
|
|
61
|
-
const isPressableRoot = !!onPress && !asChildInteractive;
|
|
62
|
-
|
|
63
|
-
const pressState = usePress({
|
|
64
|
-
isDisabled: !isPressableRoot || isDisabled,
|
|
65
|
-
});
|
|
66
|
-
const isPressed = pressState.isPressed;
|
|
67
|
-
const pressProps = pressState.pressProps as Pick<PressableProps, 'onPressIn' | 'onPressOut'>;
|
|
68
|
-
const { hoverProps, isHovered } = useHover();
|
|
69
|
-
const { isFocused, focusProps } = useFocus();
|
|
70
|
-
const { isFocusVisible, focusProps: focusRingProps } = useFocusRing() as {
|
|
71
|
-
isFocusVisible: boolean;
|
|
72
|
-
focusProps: typeof focusProps;
|
|
73
|
-
};
|
|
74
|
-
|
|
75
|
-
const slotAttrs = listItemRootDataAttrs(size, showSeparator, crossAlign);
|
|
76
|
-
|
|
77
|
-
const contextValue = useMemo(
|
|
78
|
-
() => ({
|
|
79
|
-
isPressed: isPressableRoot ? isPressed : false,
|
|
80
|
-
isHovered,
|
|
81
|
-
isDisabled,
|
|
82
|
-
crossAlign: crossAlign ?? 'center',
|
|
83
|
-
}),
|
|
84
|
-
[isPressableRoot, isPressed, isHovered, isDisabled, crossAlign],
|
|
85
|
-
);
|
|
86
|
-
|
|
87
|
-
if (asChildInteractive) {
|
|
88
|
-
const child = children as React.ReactElement<Record<string, unknown>>;
|
|
89
|
-
|
|
90
|
-
const childProps = child.props as { disabled?: boolean; isDisabled?: boolean };
|
|
91
|
-
const childDisabled = !!(childProps.isDisabled ?? childProps.disabled);
|
|
92
|
-
const resolvedDisabled = isDisabled || childDisabled;
|
|
93
|
-
|
|
94
|
-
const cloneProps: Record<string, unknown> = {
|
|
95
|
-
...restProps,
|
|
96
|
-
...slotAttrs,
|
|
97
|
-
...dataAttributes({
|
|
98
|
-
disabled: resolvedDisabled,
|
|
99
|
-
}),
|
|
100
|
-
...(resolvedDisabled && { accessibilityState: { disabled: true } }),
|
|
101
|
-
disabled: resolvedDisabled,
|
|
102
|
-
ref: mergeRefs(ref, child.props.ref as React.Ref<unknown>),
|
|
103
|
-
style: [rowStyleForCrossAlign(crossAlign), style, child.props.style],
|
|
104
|
-
};
|
|
105
|
-
|
|
106
|
-
// Only override the child's `onPress` when we have something to add (a parent handler)
|
|
107
|
-
// or need to suppress (disabled). Otherwise leave the child's own onPress alone — e.g.
|
|
108
|
-
// `Link` builds its navigation handler inside `useLink`, not as a JSX-level prop, and
|
|
109
|
-
// overriding here would shadow it.
|
|
110
|
-
if (resolvedDisabled) {
|
|
111
|
-
cloneProps.onPress = undefined;
|
|
112
|
-
} else if (onPress) {
|
|
113
|
-
cloneProps.onPress = composeEventHandlers(childOnPress, onPress);
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
return (
|
|
117
|
-
<ListItemProvider
|
|
118
|
-
value={{
|
|
119
|
-
isPressed: false,
|
|
120
|
-
isHovered: false,
|
|
121
|
-
isDisabled: resolvedDisabled,
|
|
122
|
-
crossAlign: crossAlign ?? 'center',
|
|
123
|
-
}}
|
|
124
|
-
>
|
|
125
|
-
{React.cloneElement(child, cloneProps)}
|
|
126
|
-
</ListItemProvider>
|
|
127
|
-
);
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
if (isPressableRoot) {
|
|
131
|
-
const interactionAttrs = dataAttributes({
|
|
132
|
-
active: isPressed,
|
|
133
|
-
hover: isHovered,
|
|
134
|
-
focus: isFocused,
|
|
135
|
-
focusVisible: isFocusVisible,
|
|
136
|
-
disabled: isDisabled,
|
|
137
|
-
});
|
|
138
|
-
|
|
139
|
-
const {
|
|
140
|
-
onPressIn: onPressInProp,
|
|
141
|
-
onPressOut: onPressOutProp,
|
|
142
|
-
onHoverIn: onHoverInProp,
|
|
143
|
-
onHoverOut: onHoverOutProp,
|
|
144
|
-
onFocus: onFocusProp,
|
|
145
|
-
onBlur: onBlurProp,
|
|
146
|
-
} = restProps as IListItemPressablePassthrough & {
|
|
147
|
-
onFocus?: (...args: unknown[]) => unknown;
|
|
148
|
-
onBlur?: (...args: unknown[]) => unknown;
|
|
149
|
-
};
|
|
150
|
-
|
|
151
|
-
return (
|
|
152
|
-
<ListItemProvider value={contextValue}>
|
|
153
|
-
<BasePressable
|
|
154
|
-
{...(restProps as P)}
|
|
155
|
-
{...slotAttrs}
|
|
156
|
-
{...interactionAttrs}
|
|
157
|
-
{...(isDisabled && { accessibilityState: { disabled: true } })}
|
|
158
|
-
disabled={isDisabled}
|
|
159
|
-
ref={ref as React.Ref<P>}
|
|
160
|
-
style={[rowStyleForCrossAlign(crossAlign), style]}
|
|
161
|
-
onPress={isDisabled ? undefined : onPress}
|
|
162
|
-
onPressIn={composeEventHandlers(onPressInProp, pressProps.onPressIn)}
|
|
163
|
-
onPressOut={composeEventHandlers(onPressOutProp, pressProps.onPressOut)}
|
|
164
|
-
onHoverIn={composeEventHandlers(onHoverInProp, hoverProps.onHoverIn)}
|
|
165
|
-
onHoverOut={composeEventHandlers(onHoverOutProp, hoverProps.onHoverOut)}
|
|
166
|
-
onFocus={composeEventHandlers(
|
|
167
|
-
composeEventHandlers(onFocusProp, focusProps.onFocus),
|
|
168
|
-
focusRingProps.onFocus,
|
|
169
|
-
)}
|
|
170
|
-
onBlur={composeEventHandlers(
|
|
171
|
-
composeEventHandlers(onBlurProp, focusProps.onBlur),
|
|
172
|
-
focusRingProps.onBlur,
|
|
173
|
-
)}
|
|
174
|
-
>
|
|
175
|
-
{children}
|
|
176
|
-
</BasePressable>
|
|
177
|
-
</ListItemProvider>
|
|
178
|
-
);
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
return (
|
|
182
|
-
<ListItemProvider value={contextValue}>
|
|
183
|
-
<BaseView
|
|
184
|
-
{...(restProps as V)}
|
|
185
|
-
{...slotAttrs}
|
|
186
|
-
{...(isDisabled ? dataAttributes({ disabled: true }) : undefined)}
|
|
187
|
-
ref={ref as React.Ref<V>}
|
|
188
|
-
style={[rowStyleForCrossAlign(crossAlign), style]}
|
|
189
|
-
>
|
|
190
|
-
{children}
|
|
191
|
-
</BaseView>
|
|
192
|
-
</ListItemProvider>
|
|
193
|
-
);
|
|
194
|
-
},
|
|
195
|
-
);
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import React, { forwardRef } from 'react';
|
|
2
|
-
import { View } from 'react-native';
|
|
3
|
-
import { dataAttributes } from '../utils/dataAttributes';
|
|
4
|
-
import type { IListItemSectionHeaderProps } from './types';
|
|
5
|
-
|
|
6
|
-
const row = {
|
|
7
|
-
flexDirection: 'row' as const,
|
|
8
|
-
alignItems: 'center' as const,
|
|
9
|
-
justifyContent: 'space-between' as const,
|
|
10
|
-
gap: 8,
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
const labelCell = {
|
|
14
|
-
flex: 1,
|
|
15
|
-
minWidth: 0,
|
|
16
|
-
/** Keeps the label column from stretching to a taller trailing sibling (e.g. Chip). */
|
|
17
|
-
alignSelf: 'center' as const,
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
const trailingCell = {
|
|
21
|
-
flexShrink: 0,
|
|
22
|
-
/** Prevents the trailing slot from stretching vertically and “filling” the row. */
|
|
23
|
-
alignSelf: 'center' as const,
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
export const createListItemSectionHeader = <T,>(Base: React.ComponentType<T>) =>
|
|
27
|
-
forwardRef(
|
|
28
|
-
(
|
|
29
|
-
{
|
|
30
|
-
children,
|
|
31
|
-
trailing,
|
|
32
|
-
showDivider = true,
|
|
33
|
-
style,
|
|
34
|
-
accessibilityRole = 'header',
|
|
35
|
-
...props
|
|
36
|
-
}: IListItemSectionHeaderProps,
|
|
37
|
-
ref: React.Ref<unknown>,
|
|
38
|
-
) => (
|
|
39
|
-
<Base
|
|
40
|
-
{...(props as T)}
|
|
41
|
-
{...dataAttributes({
|
|
42
|
-
slot: 'list-section-header',
|
|
43
|
-
divider: showDivider,
|
|
44
|
-
})}
|
|
45
|
-
accessibilityRole={accessibilityRole}
|
|
46
|
-
ref={ref as React.Ref<T>}
|
|
47
|
-
style={[row, style]}
|
|
48
|
-
>
|
|
49
|
-
<View style={labelCell}>{children}</View>
|
|
50
|
-
{trailing ? <View style={trailingCell}>{trailing}</View> : null}
|
|
51
|
-
</Base>
|
|
52
|
-
),
|
|
53
|
-
);
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import React, { forwardRef } from 'react';
|
|
2
|
-
import { dataAttributes } from '../utils/dataAttributes';
|
|
3
|
-
import type { IListItemTitleProps } from './types';
|
|
4
|
-
|
|
5
|
-
export const createListItemTitle = <T,>(Base: React.ComponentType<T>) =>
|
|
6
|
-
forwardRef(({ children, style, ...props }: IListItemTitleProps, ref: React.Ref<unknown>) => (
|
|
7
|
-
<Base
|
|
8
|
-
{...(props as T)}
|
|
9
|
-
{...dataAttributes({
|
|
10
|
-
slot: 'list-item-title',
|
|
11
|
-
})}
|
|
12
|
-
ref={ref as React.Ref<T>}
|
|
13
|
-
style={style}
|
|
14
|
-
>
|
|
15
|
-
{children}
|
|
16
|
-
</Base>
|
|
17
|
-
));
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import React, { forwardRef } from 'react';
|
|
2
|
-
import { dataAttributes } from '../utils/dataAttributes';
|
|
3
|
-
import type { IListItemTrailingSlotProps } from './types';
|
|
4
|
-
|
|
5
|
-
const shrinkZero = { flexShrink: 0 as const };
|
|
6
|
-
|
|
7
|
-
export const createListItemTrailingSlot = <T,>(Base: React.ComponentType<T>) =>
|
|
8
|
-
forwardRef(
|
|
9
|
-
({ children, style, ...props }: IListItemTrailingSlotProps, ref: React.Ref<unknown>) => (
|
|
10
|
-
<Base
|
|
11
|
-
{...(props as T)}
|
|
12
|
-
{...dataAttributes({
|
|
13
|
-
slot: 'list-item-trailing',
|
|
14
|
-
})}
|
|
15
|
-
ref={ref as React.Ref<T>}
|
|
16
|
-
style={[shrinkZero, style]}
|
|
17
|
-
>
|
|
18
|
-
{children}
|
|
19
|
-
</Base>
|
|
20
|
-
),
|
|
21
|
-
);
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import type React from 'react';
|
|
2
|
-
import type { PropsWithChildren } from 'react';
|
|
3
|
-
import { forwardRef } from 'react';
|
|
4
|
-
import { useOtpInputContext } from './context';
|
|
5
|
-
import type { IOtpInputCellProps } from './types';
|
|
6
|
-
|
|
7
|
-
export const createOtpInputCell = <T,>(BaseCell: React.ComponentType<T>) =>
|
|
8
|
-
forwardRef<unknown, PropsWithChildren<IOtpInputCellProps & T>>(({ children, ...props }, ref) => {
|
|
9
|
-
const { isDisabled, isInvalid, isReadOnly } = useOtpInputContext();
|
|
10
|
-
|
|
11
|
-
return (
|
|
12
|
-
<BaseCell
|
|
13
|
-
ref={ref}
|
|
14
|
-
isDisabled={isDisabled}
|
|
15
|
-
isInvalid={isInvalid}
|
|
16
|
-
isReadOnly={isReadOnly}
|
|
17
|
-
{...(props as T)}
|
|
18
|
-
>
|
|
19
|
-
{children}
|
|
20
|
-
</BaseCell>
|
|
21
|
-
);
|
|
22
|
-
});
|
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
import type React from 'react';
|
|
2
|
-
import { forwardRef, useMemo } from 'react';
|
|
3
|
-
import { Platform, type TextInput, type TextInputKeyPressEvent } from 'react-native';
|
|
4
|
-
import { mergeRefs } from '@cdx-ui/utils';
|
|
5
|
-
import { useOtpCellIndexContext, useOtpInputContext } from './context';
|
|
6
|
-
import type { IOtpInputFieldProps } from './types';
|
|
7
|
-
|
|
8
|
-
export const createOtpInputField = <T,>(BaseField: React.ComponentType<T>) =>
|
|
9
|
-
forwardRef<TextInput, IOtpInputFieldProps & Omit<T, keyof IOtpInputFieldProps>>((props, ref) => {
|
|
10
|
-
const { cellIndex } = useOtpCellIndexContext();
|
|
11
|
-
const {
|
|
12
|
-
value,
|
|
13
|
-
cellCount,
|
|
14
|
-
isDisabled,
|
|
15
|
-
isReadOnly,
|
|
16
|
-
smsOtpAutofill,
|
|
17
|
-
getCellProps,
|
|
18
|
-
cellTestIdPrefix,
|
|
19
|
-
rootAccessibilityLabel,
|
|
20
|
-
setFieldRef,
|
|
21
|
-
handleFieldChange,
|
|
22
|
-
handleFieldKeyPress,
|
|
23
|
-
} = useOtpInputContext();
|
|
24
|
-
|
|
25
|
-
const char = cellIndex < value.length ? (value[cellIndex] ?? '') : '';
|
|
26
|
-
const extra = getCellProps?.(cellIndex) ?? {};
|
|
27
|
-
|
|
28
|
-
const accessibilityLabel = useMemo(() => {
|
|
29
|
-
const fromExtra = extra.accessibilityLabel;
|
|
30
|
-
if (typeof fromExtra === 'string' && fromExtra !== '') {
|
|
31
|
-
return fromExtra;
|
|
32
|
-
}
|
|
33
|
-
if (rootAccessibilityLabel) {
|
|
34
|
-
return `${rootAccessibilityLabel}, ${String(cellIndex + 1)} of ${String(cellCount)}`;
|
|
35
|
-
}
|
|
36
|
-
return `OTP digit ${String(cellIndex + 1)} of ${String(cellCount)}`;
|
|
37
|
-
}, [cellCount, cellIndex, extra.accessibilityLabel, rootAccessibilityLabel]);
|
|
38
|
-
|
|
39
|
-
const autofillProps = useMemo(() => {
|
|
40
|
-
if (!smsOtpAutofill || cellIndex !== 0) {
|
|
41
|
-
return {};
|
|
42
|
-
}
|
|
43
|
-
return Platform.select<Record<string, unknown>>({
|
|
44
|
-
web: { autoComplete: 'one-time-code' },
|
|
45
|
-
ios: { textContentType: 'oneTimeCode' },
|
|
46
|
-
android: { autoComplete: 'sms-otp' },
|
|
47
|
-
default: {},
|
|
48
|
-
});
|
|
49
|
-
}, [cellIndex, smsOtpAutofill]);
|
|
50
|
-
|
|
51
|
-
const editable = !(isDisabled || isReadOnly);
|
|
52
|
-
|
|
53
|
-
const { style: extraStyle, accessibilityLabel: _omitExtraA11y, ...extraRest } = extra;
|
|
54
|
-
void _omitExtraA11y;
|
|
55
|
-
const {
|
|
56
|
-
style: incomingStyle,
|
|
57
|
-
value: _omitValue,
|
|
58
|
-
defaultValue: _omitDefault,
|
|
59
|
-
onChangeText: _omitOnChange,
|
|
60
|
-
...incomingRest
|
|
61
|
-
} = props as IOtpInputFieldProps;
|
|
62
|
-
void _omitValue;
|
|
63
|
-
void _omitDefault;
|
|
64
|
-
void _omitOnChange;
|
|
65
|
-
|
|
66
|
-
// Default digit OTP (`number-pad`). Root `getCellProps` is spread after and may override `keyboardType`.
|
|
67
|
-
return (
|
|
68
|
-
<BaseField
|
|
69
|
-
ref={mergeRefs(ref, (el: TextInput | null) => {
|
|
70
|
-
setFieldRef(cellIndex, el);
|
|
71
|
-
})}
|
|
72
|
-
accessibilityLabel={accessibilityLabel}
|
|
73
|
-
aria-label={accessibilityLabel}
|
|
74
|
-
accessible
|
|
75
|
-
autoFocus={cellIndex === 0 && editable && value.length === 0}
|
|
76
|
-
editable={editable}
|
|
77
|
-
keyboardType="number-pad"
|
|
78
|
-
returnKeyType="done"
|
|
79
|
-
selectTextOnFocus
|
|
80
|
-
testID={
|
|
81
|
-
cellTestIdPrefix
|
|
82
|
-
? `${cellTestIdPrefix}:${String(cellIndex)}:textField:changeText`
|
|
83
|
-
: undefined
|
|
84
|
-
}
|
|
85
|
-
value={char}
|
|
86
|
-
onChangeText={(text: string) => {
|
|
87
|
-
handleFieldChange(cellIndex, text);
|
|
88
|
-
}}
|
|
89
|
-
onKeyPress={(e: TextInputKeyPressEvent) => {
|
|
90
|
-
handleFieldKeyPress(cellIndex, e.nativeEvent.key);
|
|
91
|
-
}}
|
|
92
|
-
{...autofillProps}
|
|
93
|
-
{...(extraRest as object)}
|
|
94
|
-
{...(incomingRest as T)}
|
|
95
|
-
style={[extraStyle, incomingStyle]}
|
|
96
|
-
/>
|
|
97
|
-
);
|
|
98
|
-
});
|
|
@@ -1,179 +0,0 @@
|
|
|
1
|
-
import type React from 'react';
|
|
2
|
-
import { forwardRef, useCallback, useEffect, useLayoutEffect, useMemo, useRef } from 'react';
|
|
3
|
-
import type { TextInput } from 'react-native';
|
|
4
|
-
import { useFormControlContext } from '@cdx-ui/utils';
|
|
5
|
-
import { applyOtpInputChange } from './utils/applyValueChange';
|
|
6
|
-
import { OtpCellIndexProvider, OtpInputProvider } from './context';
|
|
7
|
-
import { filterAllowedCharacters, filterByRegExp, filterDigits } from './utils/filterValue';
|
|
8
|
-
import type { IOtpInputRootProps } from './types';
|
|
9
|
-
|
|
10
|
-
export const createOtpInputRoot = <RootProps,>(
|
|
11
|
-
BaseRoot: React.ComponentType<RootProps>,
|
|
12
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- slot components are generic across design systems
|
|
13
|
-
OtpCell: React.ComponentType<any>,
|
|
14
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
15
|
-
OtpField: React.ComponentType<any>,
|
|
16
|
-
) =>
|
|
17
|
-
forwardRef<unknown, IOtpInputRootProps & RootProps>(
|
|
18
|
-
(
|
|
19
|
-
{
|
|
20
|
-
cellCount,
|
|
21
|
-
value,
|
|
22
|
-
onChangeText,
|
|
23
|
-
onComplete,
|
|
24
|
-
isDisabled: isDisabledProp,
|
|
25
|
-
isInvalid: isInvalidProp,
|
|
26
|
-
isReadOnly: isReadOnlyProp,
|
|
27
|
-
smsOtpAutofill = true,
|
|
28
|
-
filterInput,
|
|
29
|
-
allowedCharacters,
|
|
30
|
-
characterPattern,
|
|
31
|
-
getCellProps,
|
|
32
|
-
cellTestIdPrefix,
|
|
33
|
-
accessibilityLabel: rootAccessibilityLabel,
|
|
34
|
-
...rest
|
|
35
|
-
},
|
|
36
|
-
ref,
|
|
37
|
-
) => {
|
|
38
|
-
const form = useFormControlContext();
|
|
39
|
-
const isDisabled = isDisabledProp ?? form.isDisabled ?? false;
|
|
40
|
-
const isInvalid = isInvalidProp ?? form.isInvalid ?? false;
|
|
41
|
-
const isReadOnly = isReadOnlyProp ?? form.isReadOnly ?? false;
|
|
42
|
-
|
|
43
|
-
const fieldRefs = useRef<(TextInput | null)[]>([]);
|
|
44
|
-
const focusAfterApply = useRef<number | null>(null);
|
|
45
|
-
const prevLenRef = useRef(value.length);
|
|
46
|
-
const prevValueRef = useRef(value);
|
|
47
|
-
|
|
48
|
-
const filter = useMemo(() => {
|
|
49
|
-
if (filterInput) {
|
|
50
|
-
return filterInput;
|
|
51
|
-
}
|
|
52
|
-
if (allowedCharacters !== undefined) {
|
|
53
|
-
return filterAllowedCharacters(allowedCharacters);
|
|
54
|
-
}
|
|
55
|
-
if (characterPattern !== undefined) {
|
|
56
|
-
return filterByRegExp(characterPattern);
|
|
57
|
-
}
|
|
58
|
-
return filterDigits;
|
|
59
|
-
}, [filterInput, allowedCharacters, characterPattern]);
|
|
60
|
-
|
|
61
|
-
const setFieldRef = useCallback((index: number, el: TextInput | null) => {
|
|
62
|
-
fieldRefs.current[index] = el;
|
|
63
|
-
}, []);
|
|
64
|
-
|
|
65
|
-
const focusCell = useCallback(
|
|
66
|
-
(index: number) => {
|
|
67
|
-
const safe = Math.max(0, Math.min(index, cellCount - 1));
|
|
68
|
-
fieldRefs.current[safe]?.focus();
|
|
69
|
-
},
|
|
70
|
-
[cellCount],
|
|
71
|
-
);
|
|
72
|
-
|
|
73
|
-
const handleFieldChange = useCallback(
|
|
74
|
-
(index: number, text: string) => {
|
|
75
|
-
const { nextValue, focusIndex } = applyOtpInputChange(
|
|
76
|
-
value,
|
|
77
|
-
index,
|
|
78
|
-
text,
|
|
79
|
-
cellCount,
|
|
80
|
-
filter,
|
|
81
|
-
);
|
|
82
|
-
if (nextValue !== value) {
|
|
83
|
-
onChangeText(nextValue);
|
|
84
|
-
}
|
|
85
|
-
focusAfterApply.current = focusIndex;
|
|
86
|
-
},
|
|
87
|
-
[cellCount, filter, onChangeText, value],
|
|
88
|
-
);
|
|
89
|
-
|
|
90
|
-
const handleFieldKeyPress = useCallback(
|
|
91
|
-
(index: number, key: string) => {
|
|
92
|
-
if (key !== 'Backspace') {
|
|
93
|
-
return;
|
|
94
|
-
}
|
|
95
|
-
const char = index < value.length ? value[index] : '';
|
|
96
|
-
if (!char && index > 0) {
|
|
97
|
-
focusCell(index - 1);
|
|
98
|
-
}
|
|
99
|
-
},
|
|
100
|
-
[focusCell, value],
|
|
101
|
-
);
|
|
102
|
-
|
|
103
|
-
useLayoutEffect(() => {
|
|
104
|
-
if (focusAfterApply.current !== null) {
|
|
105
|
-
const i = focusAfterApply.current;
|
|
106
|
-
focusAfterApply.current = null;
|
|
107
|
-
fieldRefs.current[i]?.focus();
|
|
108
|
-
}
|
|
109
|
-
});
|
|
110
|
-
|
|
111
|
-
useEffect(() => {
|
|
112
|
-
const prevLen = prevLenRef.current;
|
|
113
|
-
const prevVal = prevValueRef.current;
|
|
114
|
-
const isFull = value.length === cellCount;
|
|
115
|
-
const becameFullByLength = isFull && prevLen < cellCount;
|
|
116
|
-
const correctedWhileFull = isFull && prevLen === cellCount && prevVal !== value;
|
|
117
|
-
|
|
118
|
-
if (becameFullByLength || correctedWhileFull) {
|
|
119
|
-
onComplete?.();
|
|
120
|
-
}
|
|
121
|
-
prevLenRef.current = value.length;
|
|
122
|
-
prevValueRef.current = value;
|
|
123
|
-
}, [cellCount, onComplete, value]);
|
|
124
|
-
|
|
125
|
-
const contextValue = useMemo(
|
|
126
|
-
() => ({
|
|
127
|
-
cellCount,
|
|
128
|
-
value,
|
|
129
|
-
isDisabled,
|
|
130
|
-
isInvalid,
|
|
131
|
-
isReadOnly,
|
|
132
|
-
smsOtpAutofill,
|
|
133
|
-
filter,
|
|
134
|
-
getCellProps,
|
|
135
|
-
cellTestIdPrefix,
|
|
136
|
-
rootAccessibilityLabel,
|
|
137
|
-
setFieldRef,
|
|
138
|
-
handleFieldChange,
|
|
139
|
-
handleFieldKeyPress,
|
|
140
|
-
}),
|
|
141
|
-
[
|
|
142
|
-
cellCount,
|
|
143
|
-
value,
|
|
144
|
-
isDisabled,
|
|
145
|
-
isInvalid,
|
|
146
|
-
isReadOnly,
|
|
147
|
-
smsOtpAutofill,
|
|
148
|
-
filter,
|
|
149
|
-
getCellProps,
|
|
150
|
-
cellTestIdPrefix,
|
|
151
|
-
rootAccessibilityLabel,
|
|
152
|
-
setFieldRef,
|
|
153
|
-
handleFieldChange,
|
|
154
|
-
handleFieldKeyPress,
|
|
155
|
-
],
|
|
156
|
-
);
|
|
157
|
-
|
|
158
|
-
// Hermes drops outer-scope closure vars from its environment record when
|
|
159
|
-
// they are only referenced inside a nested callback (Array.from). Using a
|
|
160
|
-
// for-loop keeps OtpCell/OtpField references in the render function's own
|
|
161
|
-
// scope, avoiding the Hermes closure-capture bug.
|
|
162
|
-
const cells: React.ReactElement[] = [];
|
|
163
|
-
for (let i = 0; i < cellCount; i++) {
|
|
164
|
-
cells.push(
|
|
165
|
-
<OtpCellIndexProvider key={i} value={{ cellIndex: i }}>
|
|
166
|
-
<OtpCell>
|
|
167
|
-
<OtpField />
|
|
168
|
-
</OtpCell>
|
|
169
|
-
</OtpCellIndexProvider>,
|
|
170
|
-
);
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
return (
|
|
174
|
-
<BaseRoot ref={ref as React.Ref<unknown>} {...(rest as RootProps)}>
|
|
175
|
-
<OtpInputProvider value={contextValue}>{cells}</OtpInputProvider>
|
|
176
|
-
</BaseRoot>
|
|
177
|
-
);
|
|
178
|
-
},
|
|
179
|
-
);
|
package/src/otp-input/index.tsx
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import type React from 'react';
|
|
2
|
-
import { createOtpInputCell } from './createOtpInputCell';
|
|
3
|
-
import { createOtpInputField } from './createOtpInputField';
|
|
4
|
-
import { createOtpInputRoot } from './createOtpInputRoot';
|
|
5
|
-
import type { IOtpInputComponentType } from './types';
|
|
6
|
-
|
|
7
|
-
export { applyOtpInputChange } from './utils/applyValueChange';
|
|
8
|
-
export { filterAllowedCharacters, filterByRegExp, filterDigits } from './utils/filterValue';
|
|
9
|
-
export type * from './types';
|
|
10
|
-
|
|
11
|
-
export function createOtpInput<
|
|
12
|
-
RootProps,
|
|
13
|
-
CellProps,
|
|
14
|
-
FieldProps,
|
|
15
|
-
RootRef = unknown,
|
|
16
|
-
FieldRef = unknown,
|
|
17
|
-
>(BaseComponents: {
|
|
18
|
-
Root: React.ComponentType<RootProps>;
|
|
19
|
-
Cell: React.ComponentType<CellProps>;
|
|
20
|
-
Field: React.ComponentType<FieldProps>;
|
|
21
|
-
}) {
|
|
22
|
-
const Cell = createOtpInputCell(BaseComponents.Cell);
|
|
23
|
-
const Field = createOtpInputField(BaseComponents.Field);
|
|
24
|
-
const Root = createOtpInputRoot(BaseComponents.Root, Cell, Field);
|
|
25
|
-
|
|
26
|
-
Root.displayName = 'OtpInputPrimitive';
|
|
27
|
-
Cell.displayName = 'OtpInputPrimitive.Cell';
|
|
28
|
-
Field.displayName = 'OtpInputPrimitive.Field';
|
|
29
|
-
|
|
30
|
-
return Object.assign(Root, {
|
|
31
|
-
Cell,
|
|
32
|
-
Field,
|
|
33
|
-
}) as IOtpInputComponentType<RootProps, CellProps, FieldProps, RootRef, FieldRef>;
|
|
34
|
-
}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import type React from 'react';
|
|
2
|
-
import { forwardRef, useMemo, type PropsWithoutRef } from 'react';
|
|
3
|
-
import type { ViewStyle } from 'react-native';
|
|
4
|
-
import { dataAttributes } from '../utils/dataAttributes';
|
|
5
|
-
import { useProgressContext } from './context';
|
|
6
|
-
|
|
7
|
-
type PercentString = `${number}%`;
|
|
8
|
-
|
|
9
|
-
export const createProgressIndicator = <T, R = unknown>(BaseIndicator: React.ComponentType<T>) =>
|
|
10
|
-
forwardRef<R, PropsWithoutRef<T>>((props, ref) => {
|
|
11
|
-
const { style, ...rest } = props as PropsWithoutRef<T> & { style?: object };
|
|
12
|
-
const { percent, state, max, value } = useProgressContext();
|
|
13
|
-
|
|
14
|
-
const filledStyle = useMemo((): ViewStyle => {
|
|
15
|
-
const pct = `${String(percent)}%` as PercentString;
|
|
16
|
-
return { width: pct, height: '100%' };
|
|
17
|
-
}, [percent]);
|
|
18
|
-
|
|
19
|
-
const dataAttrs = dataAttributes({
|
|
20
|
-
state,
|
|
21
|
-
value: value === null ? undefined : String(value),
|
|
22
|
-
max: String(max),
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
return (
|
|
26
|
-
<BaseIndicator
|
|
27
|
-
ref={ref as React.Ref<R>}
|
|
28
|
-
{...({
|
|
29
|
-
...rest,
|
|
30
|
-
...dataAttrs,
|
|
31
|
-
style: [filledStyle, style],
|
|
32
|
-
} as T)}
|
|
33
|
-
/>
|
|
34
|
-
);
|
|
35
|
-
});
|
package/src/progress/index.ts
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import type React from 'react';
|
|
2
|
-
import { createProgressIndicator } from './createProgressIndicator';
|
|
3
|
-
import { createProgressRoot } from './createProgressRoot';
|
|
4
|
-
import type { IProgressComponentType } from './types';
|
|
5
|
-
|
|
6
|
-
export type { IProgressProps, IProgressComponentType, ProgressDataState } from './types';
|
|
7
|
-
export type { ProgressContextValue } from './context';
|
|
8
|
-
export { useProgressContext } from './context';
|
|
9
|
-
|
|
10
|
-
export function createProgress<
|
|
11
|
-
RootProps,
|
|
12
|
-
IndicatorProps,
|
|
13
|
-
RootRef = unknown,
|
|
14
|
-
IndicatorRef = unknown,
|
|
15
|
-
>(components: {
|
|
16
|
-
Root: React.ComponentType<RootProps>;
|
|
17
|
-
Indicator: React.ComponentType<IndicatorProps>;
|
|
18
|
-
}) {
|
|
19
|
-
const Progress = createProgressRoot<RootProps, RootRef>(components.Root);
|
|
20
|
-
const Indicator = createProgressIndicator<IndicatorProps, IndicatorRef>(components.Indicator);
|
|
21
|
-
|
|
22
|
-
Progress.displayName = 'ProgressPrimitive';
|
|
23
|
-
Indicator.displayName = 'ProgressPrimitive.Indicator';
|
|
24
|
-
|
|
25
|
-
return Object.assign(Progress, {
|
|
26
|
-
Indicator,
|
|
27
|
-
}) as IProgressComponentType<RootProps, IndicatorProps, RootRef, IndicatorRef>;
|
|
28
|
-
}
|