@cdx-ui/primitives 0.0.1-beta.65 → 0.0.1-beta.67
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
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { useCallback, useRef } from 'react';
|
|
2
|
+
import { useFocusRing } from '@react-native-aria/focus';
|
|
3
|
+
import { useHover } from '@react-native-aria/interactions';
|
|
4
|
+
import { useToggleState } from '@react-stately/toggle';
|
|
5
|
+
import { useFormControlContext } from '@cdx-ui/utils';
|
|
6
|
+
import { dataAttributes } from '../utils/dataAttributes';
|
|
7
|
+
import type { ISwitchProps, IUseSwitchReturn } from './types';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Headless behavioral primitive for `Switch`.
|
|
11
|
+
*
|
|
12
|
+
* Owns the controlled/uncontrolled toggle state, ARIA `role="switch"` semantics
|
|
13
|
+
* (consumers must wire `aria-checked`/`accessibilityRole` to the host element they
|
|
14
|
+
* render), and interaction tracking (hover, focus-visible). Surfaces a
|
|
15
|
+
* platform-aware `dataAttrs` object so the styled layer can emit interaction-state
|
|
16
|
+
* `data-*` attributes (Standard 1) without re-implementing the toggle machinery.
|
|
17
|
+
*
|
|
18
|
+
* Standards mapping (per `.cursor/plans/primitive_design_standards_0d0ca4b1.plan.md`):
|
|
19
|
+
* - Standard 3 #1 — controlled state via `useToggleState`.
|
|
20
|
+
* - Standard 3 #2 — `role="switch"` semantics (consumer wires to host).
|
|
21
|
+
*
|
|
22
|
+
* The styled layer renders the host element (`RNSwitch` on native, a custom
|
|
23
|
+
* `Pressable` + `View` toggle on web) and is the sole owner of className/styling
|
|
24
|
+
* machinery — primitives never carry Uniwind className passthrough.
|
|
25
|
+
*/
|
|
26
|
+
export function useSwitch(props: ISwitchProps = {}): IUseSwitchReturn {
|
|
27
|
+
const { disabled, isDisabled, isChecked, isInvalid, defaultValue, value, onValueChange } = props;
|
|
28
|
+
|
|
29
|
+
const formControlContext = useFormControlContext();
|
|
30
|
+
const controlledValue = value ?? isChecked;
|
|
31
|
+
|
|
32
|
+
const state = useToggleState({
|
|
33
|
+
defaultSelected: defaultValue ?? false,
|
|
34
|
+
isSelected: controlledValue,
|
|
35
|
+
onChange: onValueChange,
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
const checked = controlledValue ?? state.isSelected;
|
|
39
|
+
|
|
40
|
+
const hostRef = useRef<unknown>(null);
|
|
41
|
+
const { isHovered, hoverProps } = useHover({}, hostRef);
|
|
42
|
+
const { isFocusVisible, focusProps } = useFocusRing() as {
|
|
43
|
+
isFocusVisible: boolean;
|
|
44
|
+
focusProps: { onFocus?: () => void; onBlur?: () => void };
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
const isDisabledResolved = Boolean(disabled || isDisabled || formControlContext.isDisabled);
|
|
48
|
+
const isInvalidResolved = Boolean(isInvalid || formControlContext.isInvalid);
|
|
49
|
+
|
|
50
|
+
const setChecked = useCallback(
|
|
51
|
+
(next: boolean) => {
|
|
52
|
+
state.setSelected(next);
|
|
53
|
+
},
|
|
54
|
+
[state],
|
|
55
|
+
);
|
|
56
|
+
|
|
57
|
+
return {
|
|
58
|
+
checked,
|
|
59
|
+
isDisabled: isDisabledResolved,
|
|
60
|
+
isInvalid: isInvalidResolved,
|
|
61
|
+
isHovered,
|
|
62
|
+
isFocusVisible,
|
|
63
|
+
setChecked,
|
|
64
|
+
hoverProps,
|
|
65
|
+
focusProps,
|
|
66
|
+
dataAttrs: dataAttributes({
|
|
67
|
+
hover: isHovered,
|
|
68
|
+
disabled: isDisabledResolved,
|
|
69
|
+
invalid: isInvalidResolved,
|
|
70
|
+
checked,
|
|
71
|
+
focusVisible: isFocusVisible,
|
|
72
|
+
}),
|
|
73
|
+
hostRef,
|
|
74
|
+
};
|
|
75
|
+
}
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import { forwardRef, useCallback, useMemo, type ComponentRef } from 'react';
|
|
2
|
+
import { View, type ViewProps } from 'react-native';
|
|
3
|
+
import { useControllableState } from '@cdx-ui/utils';
|
|
4
|
+
import { Slot } from '../slot';
|
|
5
|
+
import { TileGroupContextProvider } from './context';
|
|
6
|
+
import type { ITileGroupProps, TileGroupType } from './types';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Internal widening of the public discriminated union: the runtime accepts any value
|
|
10
|
+
* shape and reads `type` to decide branch behavior. The public API stays narrow.
|
|
11
|
+
*/
|
|
12
|
+
type WidenedTileGroupProps = ViewProps & {
|
|
13
|
+
asChild?: boolean;
|
|
14
|
+
type: TileGroupType;
|
|
15
|
+
value?: string | string[];
|
|
16
|
+
defaultValue?: string | string[];
|
|
17
|
+
onValueChange?: (value: string | string[]) => void;
|
|
18
|
+
max?: number;
|
|
19
|
+
isDisabled?: boolean;
|
|
20
|
+
'aria-label'?: string;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export type TileGroupProps = ITileGroupProps;
|
|
24
|
+
|
|
25
|
+
export const TileGroup = forwardRef<ComponentRef<typeof View>, TileGroupProps>((props, ref) => {
|
|
26
|
+
const {
|
|
27
|
+
asChild = false,
|
|
28
|
+
children,
|
|
29
|
+
type,
|
|
30
|
+
value: valueProp,
|
|
31
|
+
defaultValue,
|
|
32
|
+
onValueChange,
|
|
33
|
+
max: maxProp,
|
|
34
|
+
isDisabled = false,
|
|
35
|
+
'aria-label': ariaLabel,
|
|
36
|
+
...rest
|
|
37
|
+
} = props as WidenedTileGroupProps;
|
|
38
|
+
|
|
39
|
+
const max = maxProp ?? Number.POSITIVE_INFINITY;
|
|
40
|
+
|
|
41
|
+
const defaultProp =
|
|
42
|
+
defaultValue !== undefined ? defaultValue : type === 'multiple' ? [] : undefined;
|
|
43
|
+
|
|
44
|
+
const [state, setState] = useControllableState<string | string[] | undefined>({
|
|
45
|
+
prop: valueProp,
|
|
46
|
+
defaultProp,
|
|
47
|
+
onChange: (next) => {
|
|
48
|
+
if (next !== undefined) {
|
|
49
|
+
onValueChange?.(next);
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
const isSelected = useCallback(
|
|
55
|
+
(tileValue: string) => {
|
|
56
|
+
if (type === 'single') {
|
|
57
|
+
return state === tileValue;
|
|
58
|
+
}
|
|
59
|
+
return Array.isArray(state) && state.includes(tileValue);
|
|
60
|
+
},
|
|
61
|
+
[type, state],
|
|
62
|
+
);
|
|
63
|
+
|
|
64
|
+
const isTileDisabledByGroup = useCallback(
|
|
65
|
+
(tileValue: string) => {
|
|
66
|
+
if (isDisabled) {
|
|
67
|
+
return true;
|
|
68
|
+
}
|
|
69
|
+
if (type !== 'multiple') {
|
|
70
|
+
return false;
|
|
71
|
+
}
|
|
72
|
+
const arr = Array.isArray(state) ? state : [];
|
|
73
|
+
if (arr.length < max) {
|
|
74
|
+
return false;
|
|
75
|
+
}
|
|
76
|
+
return !arr.includes(tileValue);
|
|
77
|
+
},
|
|
78
|
+
[isDisabled, type, state, max],
|
|
79
|
+
);
|
|
80
|
+
|
|
81
|
+
const toggleValue = useCallback(
|
|
82
|
+
(tileValue: string) => {
|
|
83
|
+
if (isDisabled) {
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
if (type === 'single') {
|
|
87
|
+
if (state === tileValue) {
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
setState(tileValue);
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
const arr = Array.isArray(state) ? [...state] : [];
|
|
94
|
+
const idx = arr.indexOf(tileValue);
|
|
95
|
+
if (idx >= 0) {
|
|
96
|
+
arr.splice(idx, 1);
|
|
97
|
+
setState(arr);
|
|
98
|
+
} else if (arr.length < max) {
|
|
99
|
+
arr.push(tileValue);
|
|
100
|
+
setState(arr);
|
|
101
|
+
}
|
|
102
|
+
},
|
|
103
|
+
[isDisabled, type, state, setState, max],
|
|
104
|
+
);
|
|
105
|
+
|
|
106
|
+
const contextValue = useMemo(
|
|
107
|
+
() => ({
|
|
108
|
+
type,
|
|
109
|
+
value: state,
|
|
110
|
+
toggleValue,
|
|
111
|
+
isSelected,
|
|
112
|
+
isTileDisabledByGroup,
|
|
113
|
+
isGroupDisabled: isDisabled,
|
|
114
|
+
max,
|
|
115
|
+
}),
|
|
116
|
+
[type, state, toggleValue, isSelected, isTileDisabledByGroup, isDisabled, max],
|
|
117
|
+
);
|
|
118
|
+
|
|
119
|
+
const role = type === 'single' ? 'radiogroup' : 'group';
|
|
120
|
+
const Comp = asChild ? Slot : View;
|
|
121
|
+
|
|
122
|
+
return (
|
|
123
|
+
<TileGroupContextProvider value={contextValue}>
|
|
124
|
+
<Comp
|
|
125
|
+
ref={ref}
|
|
126
|
+
role={role}
|
|
127
|
+
{...(type === 'single' ? { accessibilityRole: 'radiogroup' as const } : {})}
|
|
128
|
+
{...(ariaLabel ? { 'aria-label': ariaLabel, accessibilityLabel: ariaLabel } : {})}
|
|
129
|
+
{...(rest as ViewProps)}
|
|
130
|
+
>
|
|
131
|
+
{children}
|
|
132
|
+
</Comp>
|
|
133
|
+
</TileGroupContextProvider>
|
|
134
|
+
);
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
TileGroup.displayName = 'TileGroup';
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { forwardRef, useMemo, type ComponentRef } from 'react';
|
|
2
|
+
import { Pressable, type PressableProps } from 'react-native';
|
|
3
|
+
import { composeEventHandlers, useControllableState } from '@cdx-ui/utils';
|
|
4
|
+
import { useFocus, useFocusRing } from '@react-native-aria/focus';
|
|
4
5
|
import { useHover, usePress } from '@react-native-aria/interactions';
|
|
5
|
-
import {
|
|
6
|
+
import { Slot } from '../slot';
|
|
7
|
+
import { dataAttributes, mergeDataAttributes } from '../utils/dataAttributes';
|
|
6
8
|
import { TileProvider, useOptionalTileGroupContext } from './context';
|
|
7
9
|
import type { ITileProps, ITilePressablePassthrough } from './types';
|
|
8
10
|
|
|
@@ -12,9 +14,12 @@ const rowStyle = {
|
|
|
12
14
|
alignItems: 'center' as const,
|
|
13
15
|
};
|
|
14
16
|
|
|
15
|
-
export
|
|
16
|
-
|
|
17
|
-
|
|
17
|
+
export interface TileRootProps extends ITileProps {}
|
|
18
|
+
|
|
19
|
+
export const TileRoot = forwardRef<ComponentRef<typeof Pressable>, TileRootProps>(
|
|
20
|
+
(
|
|
21
|
+
{
|
|
22
|
+
asChild = false,
|
|
18
23
|
value,
|
|
19
24
|
disabled: disabledProp = false,
|
|
20
25
|
isSelected: controlledSelected,
|
|
@@ -25,14 +30,12 @@ export const createTileRoot = <T,>(BasePressable: React.ComponentType<T>) =>
|
|
|
25
30
|
onFocus,
|
|
26
31
|
onBlur,
|
|
27
32
|
style,
|
|
28
|
-
/** Consumed by styled `withStyleContext` root. */
|
|
29
|
-
context: _styleContext,
|
|
30
33
|
...rest
|
|
31
|
-
}
|
|
32
|
-
|
|
34
|
+
},
|
|
35
|
+
ref,
|
|
36
|
+
) => {
|
|
33
37
|
const group = useOptionalTileGroupContext();
|
|
34
38
|
|
|
35
|
-
// Standalone selection state — only meaningful when no group owns selection.
|
|
36
39
|
const [standaloneSelected = false, setStandaloneSelected] = useControllableState<boolean>({
|
|
37
40
|
prop: controlledSelected,
|
|
38
41
|
defaultProp: defaultSelected ?? false,
|
|
@@ -47,6 +50,10 @@ export const createTileRoot = <T,>(BasePressable: React.ComponentType<T>) =>
|
|
|
47
50
|
const cannotToggle = isDisabled;
|
|
48
51
|
|
|
49
52
|
const { focusProps, isFocused } = useFocus();
|
|
53
|
+
const { isFocusVisible, focusProps: focusRingProps } = useFocusRing() as {
|
|
54
|
+
isFocusVisible: boolean;
|
|
55
|
+
focusProps: typeof focusProps;
|
|
56
|
+
};
|
|
50
57
|
const { pressProps, isPressed } = usePress({ isDisabled: cannotToggle });
|
|
51
58
|
const { hoverProps, isHovered } = useHover();
|
|
52
59
|
|
|
@@ -79,46 +86,52 @@ export const createTileRoot = <T,>(BasePressable: React.ComponentType<T>) =>
|
|
|
79
86
|
}
|
|
80
87
|
});
|
|
81
88
|
|
|
82
|
-
const sharedHandlers = {
|
|
83
|
-
onPress: isDisabled ? undefined : composedOnPress,
|
|
84
|
-
onPressIn: composeEventHandlers(passthrough.onPressIn, pressProps.onPressIn),
|
|
85
|
-
onPressOut: composeEventHandlers(passthrough.onPressOut, pressProps.onPressOut),
|
|
86
|
-
onHoverIn: composeEventHandlers(passthrough.onHoverIn, hoverProps.onHoverIn),
|
|
87
|
-
onHoverOut: composeEventHandlers(passthrough.onHoverOut, hoverProps.onHoverOut),
|
|
88
|
-
onFocus: composeEventHandlers(onFocus, focusProps.onFocus),
|
|
89
|
-
onBlur: composeEventHandlers(onBlur, focusProps.onBlur),
|
|
90
|
-
} as const;
|
|
91
|
-
|
|
92
89
|
const role = selectionType === 'single' ? 'radio' : 'checkbox';
|
|
93
90
|
|
|
94
|
-
const
|
|
95
|
-
accessibilityRole: role,
|
|
96
|
-
role,
|
|
97
|
-
accessibilityState,
|
|
98
|
-
'aria-checked': isSelected,
|
|
99
|
-
...(isDisabled ? { 'aria-disabled': true as const } : {}),
|
|
100
|
-
...dataAttributes({
|
|
101
|
-
slot: 'tile',
|
|
102
|
-
state: isSelected ? 'selected' : 'unselected',
|
|
103
|
-
disabled: isDisabled,
|
|
104
|
-
active: isPressed,
|
|
105
|
-
hover: isHovered,
|
|
106
|
-
focused: isFocused,
|
|
107
|
-
}),
|
|
108
|
-
};
|
|
91
|
+
const Comp = asChild ? Slot : Pressable;
|
|
109
92
|
|
|
110
93
|
return (
|
|
111
94
|
<TileProvider value={tileContext}>
|
|
112
|
-
<
|
|
113
|
-
{
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
{
|
|
117
|
-
{
|
|
95
|
+
<Comp
|
|
96
|
+
ref={ref}
|
|
97
|
+
accessibilityRole={role}
|
|
98
|
+
role={role}
|
|
99
|
+
accessibilityState={accessibilityState}
|
|
100
|
+
aria-checked={isSelected}
|
|
101
|
+
{...(isDisabled ? { 'aria-disabled': true as const } : {})}
|
|
102
|
+
disabled={isDisabled}
|
|
103
|
+
{...(rest as PressableProps)}
|
|
104
|
+
{...mergeDataAttributes(
|
|
105
|
+
rest,
|
|
106
|
+
dataAttributes({
|
|
107
|
+
state: isSelected ? 'selected' : 'unselected',
|
|
108
|
+
disabled: isDisabled,
|
|
109
|
+
active: isPressed,
|
|
110
|
+
hover: isHovered,
|
|
111
|
+
focus: isFocused,
|
|
112
|
+
focusVisible: isFocusVisible,
|
|
113
|
+
}),
|
|
114
|
+
)}
|
|
118
115
|
style={[rowStyle, style]}
|
|
116
|
+
onPress={isDisabled ? undefined : composedOnPress}
|
|
117
|
+
onPressIn={composeEventHandlers(passthrough.onPressIn, pressProps.onPressIn)}
|
|
118
|
+
onPressOut={composeEventHandlers(passthrough.onPressOut, pressProps.onPressOut)}
|
|
119
|
+
onHoverIn={composeEventHandlers(passthrough.onHoverIn, hoverProps.onHoverIn)}
|
|
120
|
+
onHoverOut={composeEventHandlers(passthrough.onHoverOut, hoverProps.onHoverOut)}
|
|
121
|
+
onFocus={composeEventHandlers(
|
|
122
|
+
composeEventHandlers(onFocus, focusProps.onFocus),
|
|
123
|
+
focusRingProps.onFocus,
|
|
124
|
+
)}
|
|
125
|
+
onBlur={composeEventHandlers(
|
|
126
|
+
composeEventHandlers(onBlur, focusProps.onBlur),
|
|
127
|
+
focusRingProps.onBlur,
|
|
128
|
+
)}
|
|
119
129
|
>
|
|
120
130
|
{children}
|
|
121
|
-
</
|
|
131
|
+
</Comp>
|
|
122
132
|
</TileProvider>
|
|
123
133
|
);
|
|
124
|
-
}
|
|
134
|
+
},
|
|
135
|
+
);
|
|
136
|
+
|
|
137
|
+
TileRoot.displayName = 'TileRoot';
|
package/src/tile/index.ts
CHANGED
|
@@ -1,19 +1,5 @@
|
|
|
1
|
-
import type React from 'react';
|
|
2
|
-
import { createTileContent } from './createTileContent';
|
|
3
|
-
import { createTileDescription } from './createTileDescription';
|
|
4
|
-
import { createTileGroup } from './createTileGroup';
|
|
5
|
-
import { createTileIndicator } from './createTileIndicator';
|
|
6
|
-
import { createTileLeadingSlot } from './createTileLeadingSlot';
|
|
7
|
-
import { createTileRoot } from './createTileRoot';
|
|
8
|
-
import { createTileTitle } from './createTileTitle';
|
|
9
|
-
import { createTileTrailingSlot } from './createTileTrailingSlot';
|
|
10
|
-
import type { ITileComponentType } from './types';
|
|
11
|
-
|
|
12
1
|
export type {
|
|
13
|
-
ITileComponentType,
|
|
14
|
-
ITileContentProps,
|
|
15
2
|
ITileContextValue,
|
|
16
|
-
ITileDescriptionProps,
|
|
17
3
|
ITileGroupMultipleProps,
|
|
18
4
|
ITileGroupProps,
|
|
19
5
|
ITileGroupSingleProps,
|
|
@@ -22,67 +8,11 @@ export type {
|
|
|
22
8
|
ITileLeadingSlotProps,
|
|
23
9
|
ITilePressablePassthrough,
|
|
24
10
|
ITileProps,
|
|
25
|
-
ITileTitleProps,
|
|
26
11
|
ITileTrailingSlotProps,
|
|
27
12
|
TileGroupType,
|
|
28
13
|
TileGroupValue,
|
|
29
14
|
} from './types';
|
|
30
15
|
|
|
31
16
|
export { TileProvider, useTileContext } from './context';
|
|
32
|
-
|
|
33
|
-
export
|
|
34
|
-
Pressable,
|
|
35
|
-
Leading,
|
|
36
|
-
Content,
|
|
37
|
-
Title,
|
|
38
|
-
Description,
|
|
39
|
-
Indicator,
|
|
40
|
-
TrailingSlot,
|
|
41
|
-
Group,
|
|
42
|
-
>(BaseComponents: {
|
|
43
|
-
Pressable: React.ComponentType<Pressable>;
|
|
44
|
-
LeadingSlot: React.ComponentType<Leading>;
|
|
45
|
-
Content: React.ComponentType<Content>;
|
|
46
|
-
Title: React.ComponentType<Title>;
|
|
47
|
-
Description: React.ComponentType<Description>;
|
|
48
|
-
Indicator: React.ComponentType<Indicator>;
|
|
49
|
-
TrailingSlot: React.ComponentType<TrailingSlot>;
|
|
50
|
-
Group: React.ComponentType<Group>;
|
|
51
|
-
}) {
|
|
52
|
-
const Tile = createTileRoot(BaseComponents.Pressable);
|
|
53
|
-
const Group = createTileGroup(BaseComponents.Group);
|
|
54
|
-
const LeadingSlot = createTileLeadingSlot(BaseComponents.LeadingSlot);
|
|
55
|
-
const Content = createTileContent(BaseComponents.Content);
|
|
56
|
-
const Title = createTileTitle(BaseComponents.Title);
|
|
57
|
-
const Description = createTileDescription(BaseComponents.Description);
|
|
58
|
-
const Indicator = createTileIndicator(BaseComponents.Indicator);
|
|
59
|
-
const TrailingSlot = createTileTrailingSlot(BaseComponents.TrailingSlot);
|
|
60
|
-
|
|
61
|
-
Tile.displayName = 'TilePrimitive';
|
|
62
|
-
Group.displayName = 'TilePrimitive.Group';
|
|
63
|
-
LeadingSlot.displayName = 'TilePrimitive.LeadingSlot';
|
|
64
|
-
Content.displayName = 'TilePrimitive.Content';
|
|
65
|
-
Title.displayName = 'TilePrimitive.Title';
|
|
66
|
-
Description.displayName = 'TilePrimitive.Description';
|
|
67
|
-
Indicator.displayName = 'TilePrimitive.Indicator';
|
|
68
|
-
TrailingSlot.displayName = 'TilePrimitive.TrailingSlot';
|
|
69
|
-
|
|
70
|
-
return Object.assign(Tile, {
|
|
71
|
-
Group,
|
|
72
|
-
LeadingSlot,
|
|
73
|
-
Content,
|
|
74
|
-
Title,
|
|
75
|
-
Description,
|
|
76
|
-
Indicator,
|
|
77
|
-
TrailingSlot,
|
|
78
|
-
}) as ITileComponentType<
|
|
79
|
-
Pressable,
|
|
80
|
-
Leading,
|
|
81
|
-
Content,
|
|
82
|
-
Title,
|
|
83
|
-
Description,
|
|
84
|
-
Indicator,
|
|
85
|
-
TrailingSlot,
|
|
86
|
-
Group
|
|
87
|
-
>;
|
|
88
|
-
}
|
|
17
|
+
export { TileRoot, type TileRootProps } from './TileRoot';
|
|
18
|
+
export { TileGroup, type TileGroupProps } from './TileGroup';
|
package/src/tile/types.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { PressableProps, TextProps, ViewProps } from 'react-native';
|
|
3
|
-
import type { WithStyleContextProps } from '@cdx-ui/utils';
|
|
1
|
+
import type { PressableProps, ViewProps } from 'react-native';
|
|
4
2
|
|
|
5
3
|
export type TileGroupType = 'single' | 'multiple';
|
|
6
4
|
|
|
7
5
|
export type TileGroupValue = string | string[] | undefined;
|
|
8
6
|
|
|
9
|
-
interface ITileGroupBaseProps extends ViewProps
|
|
7
|
+
interface ITileGroupBaseProps extends ViewProps {
|
|
8
|
+
/** Merge group props onto a single child instead of rendering the default View. */
|
|
9
|
+
asChild?: boolean;
|
|
10
10
|
/** Disables the whole group. */
|
|
11
11
|
isDisabled?: boolean;
|
|
12
12
|
/** Accessible name for the group (radiogroup / group). */
|
|
@@ -68,8 +68,9 @@ export type ITilePressablePassthrough = Partial<
|
|
|
68
68
|
Pick<PressableProps, 'onPressIn' | 'onPressOut' | 'onHoverIn' | 'onHoverOut'>
|
|
69
69
|
>;
|
|
70
70
|
|
|
71
|
-
export interface ITileProps
|
|
72
|
-
|
|
71
|
+
export interface ITileProps extends PressableProps, ITilePressablePassthrough {
|
|
72
|
+
/** Merge tile props onto a single child instead of rendering the default Pressable. */
|
|
73
|
+
asChild?: boolean;
|
|
73
74
|
/**
|
|
74
75
|
* Identifies this tile within `Tile.Group`. Must be unique within the group.
|
|
75
76
|
* Standalone tiles still require a value (useful for form submission, analytics, etc.).
|
|
@@ -103,9 +104,6 @@ export interface ITileLeadingSlotProps extends ViewProps {
|
|
|
103
104
|
'aria-hidden'?: boolean;
|
|
104
105
|
}
|
|
105
106
|
|
|
106
|
-
export type ITileContentProps = ViewProps;
|
|
107
|
-
export type ITileTitleProps = TextProps;
|
|
108
|
-
export type ITileDescriptionProps = TextProps;
|
|
109
107
|
export interface ITileIndicatorProps extends ViewProps {
|
|
110
108
|
/**
|
|
111
109
|
* Explicit indicator visual. When inside a `Tile.Group`, auto-infers from `type`
|
|
@@ -114,7 +112,6 @@ export interface ITileIndicatorProps extends ViewProps {
|
|
|
114
112
|
* a radio-style visual is needed.
|
|
115
113
|
*/
|
|
116
114
|
indicatorType?: 'radio' | 'checkbox';
|
|
117
|
-
children?: ReactNode;
|
|
118
115
|
}
|
|
119
116
|
|
|
120
117
|
/**
|
|
@@ -122,32 +119,3 @@ export interface ITileIndicatorProps extends ViewProps {
|
|
|
122
119
|
* is **not** the radio/checkbox selection affordance. For that, use `Tile.Indicator`.
|
|
123
120
|
*/
|
|
124
121
|
export type ITileTrailingSlotProps = ViewProps;
|
|
125
|
-
|
|
126
|
-
export type ITileComponentType<
|
|
127
|
-
RootRef,
|
|
128
|
-
LeadingSlot,
|
|
129
|
-
Content,
|
|
130
|
-
Title,
|
|
131
|
-
Description,
|
|
132
|
-
Indicator,
|
|
133
|
-
TrailingSlot,
|
|
134
|
-
Group,
|
|
135
|
-
> = ForwardRefExoticComponent<RefAttributes<RootRef> & ITileProps> & {
|
|
136
|
-
Group: ForwardRefExoticComponent<RefAttributes<Group> & PropsWithoutRef<Group> & ITileGroupProps>;
|
|
137
|
-
LeadingSlot: ForwardRefExoticComponent<
|
|
138
|
-
RefAttributes<LeadingSlot> & PropsWithoutRef<LeadingSlot> & ITileLeadingSlotProps
|
|
139
|
-
>;
|
|
140
|
-
Content: ForwardRefExoticComponent<
|
|
141
|
-
RefAttributes<Content> & PropsWithoutRef<Content> & ITileContentProps
|
|
142
|
-
>;
|
|
143
|
-
Title: ForwardRefExoticComponent<RefAttributes<Title> & PropsWithoutRef<Title> & ITileTitleProps>;
|
|
144
|
-
Description: ForwardRefExoticComponent<
|
|
145
|
-
RefAttributes<Description> & PropsWithoutRef<Description> & ITileDescriptionProps
|
|
146
|
-
>;
|
|
147
|
-
Indicator: ForwardRefExoticComponent<
|
|
148
|
-
RefAttributes<Indicator> & PropsWithoutRef<Indicator> & ITileIndicatorProps
|
|
149
|
-
>;
|
|
150
|
-
TrailingSlot: ForwardRefExoticComponent<
|
|
151
|
-
RefAttributes<TrailingSlot> & PropsWithoutRef<TrailingSlot> & ITileTrailingSlotProps
|
|
152
|
-
>;
|
|
153
|
-
};
|
|
@@ -4,4 +4,7 @@
|
|
|
4
4
|
*
|
|
5
5
|
* Delegates to `domDataAttributes` so the conversion logic has a single source of truth.
|
|
6
6
|
*/
|
|
7
|
-
export {
|
|
7
|
+
export {
|
|
8
|
+
domDataAttributes as dataAttributes,
|
|
9
|
+
mergeDomDataAttributes as mergeDataAttributes,
|
|
10
|
+
} from './domDataAttributes';
|
|
@@ -22,3 +22,27 @@ export function dataAttributes(attrs: Record<string, DataAttributeValue>): {
|
|
|
22
22
|
}
|
|
23
23
|
return { dataSet };
|
|
24
24
|
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Merges multiple sources of data attributes into a single `{ dataSet }` prop
|
|
28
|
+
* on web. Each source may be a `dataAttributes()` output (`{ dataSet: {...} }`)
|
|
29
|
+
* or any props object that contains a `dataSet` key — other keys are ignored.
|
|
30
|
+
* Later sources override earlier sources on inner-key conflicts.
|
|
31
|
+
*
|
|
32
|
+
* Required when an element receives data attributes from more than one source:
|
|
33
|
+
* a plain prop spread merges by replacing the `dataSet` key entirely, so e.g.
|
|
34
|
+
* `{...dataAttributes({ slot })} {...dataAttributes({ hover })}` keeps only the
|
|
35
|
+
* second `dataSet`. Use `mergeDataAttributes(...)` to combine them safely.
|
|
36
|
+
*/
|
|
37
|
+
export function mergeDataAttributes(
|
|
38
|
+
...sources: ({ dataSet?: Record<string, unknown> } | Record<string, unknown> | undefined)[]
|
|
39
|
+
): { dataSet: Record<string, unknown> } {
|
|
40
|
+
const dataSet: Record<string, unknown> = {};
|
|
41
|
+
for (const source of sources) {
|
|
42
|
+
if (!source) continue;
|
|
43
|
+
const sourceDataSet = (source as { dataSet?: Record<string, unknown> }).dataSet;
|
|
44
|
+
if (!sourceDataSet) continue;
|
|
45
|
+
Object.assign(dataSet, sourceDataSet);
|
|
46
|
+
}
|
|
47
|
+
return { dataSet };
|
|
48
|
+
}
|
|
@@ -30,3 +30,34 @@ export function domDataAttributes(
|
|
|
30
30
|
}
|
|
31
31
|
return result;
|
|
32
32
|
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Merges multiple sources of DOM data attributes into a single flat object of
|
|
36
|
+
* `data-*` keys. Each source can be a `domDataAttributes()` output or any props
|
|
37
|
+
* object — non-`data-*` keys are ignored. Later sources override earlier sources
|
|
38
|
+
* on key conflicts.
|
|
39
|
+
*
|
|
40
|
+
* Use this when an element receives `data-*` attributes from more than one
|
|
41
|
+
* source (e.g. a styled layer's `data-slot` and a primitive's interaction-state
|
|
42
|
+
* `data-hover`/`data-focus` etc.) and a plain prop spread would otherwise be
|
|
43
|
+
* fine on native but lose attributes on web (where `dataAttributes()` returns
|
|
44
|
+
* `{ dataSet }` — see the `.web.ts` sibling for the web merge).
|
|
45
|
+
*/
|
|
46
|
+
export function mergeDomDataAttributes(
|
|
47
|
+
...sources: (Record<string, unknown> | undefined)[]
|
|
48
|
+
): Record<string, string> {
|
|
49
|
+
const result: Record<string, string> = {};
|
|
50
|
+
for (const source of sources) {
|
|
51
|
+
if (!source) continue;
|
|
52
|
+
for (const key in source) {
|
|
53
|
+
if (!key.startsWith('data-')) continue;
|
|
54
|
+
const value = source[key];
|
|
55
|
+
if (typeof value === 'boolean') {
|
|
56
|
+
result[key] = String(value);
|
|
57
|
+
} else if (typeof value === 'string') {
|
|
58
|
+
result[key] = value;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
return result;
|
|
63
|
+
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.createAvatarBadge = void 0;
|
|
7
|
-
var _react = require("react");
|
|
8
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
9
|
-
const createAvatarBadge = BaseBadge => /*#__PURE__*/(0, _react.forwardRef)(({
|
|
10
|
-
children,
|
|
11
|
-
...props
|
|
12
|
-
}, ref) => {
|
|
13
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(BaseBadge, {
|
|
14
|
-
ref: ref,
|
|
15
|
-
...props,
|
|
16
|
-
children: children
|
|
17
|
-
});
|
|
18
|
-
});
|
|
19
|
-
exports.createAvatarBadge = createAvatarBadge;
|
|
20
|
-
//# sourceMappingURL=createAvatarBadge.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_react","require","_jsxRuntime","createAvatarBadge","BaseBadge","forwardRef","children","props","ref","jsx","exports"],"sourceRoot":"../../../src","sources":["avatar/createAvatarBadge.tsx"],"mappings":";;;;;;AACA,IAAAA,MAAA,GAAAC,OAAA;AAAmC,IAAAC,WAAA,GAAAD,OAAA;AAG5B,MAAME,iBAAiB,GAAQC,SAAiC,iBACrE,IAAAC,iBAAU,EAA6B,CAAC;EAAEC,QAAQ;EAAE,GAAGC;AAAM,CAAC,EAAEC,GAAG,KAAK;EACtE,oBACE,IAAAN,WAAA,CAAAO,GAAA,EAACL,SAAS;IAACI,GAAG,EAAEA,GAAI;IAAA,GAAMD,KAAK;IAAAD,QAAA,EAC5BA;EAAQ,CACA,CAAC;AAEhB,CAAC,CAAC;AAACI,OAAA,CAAAP,iBAAA,GAAAA,iBAAA","ignoreList":[]}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.createAvatarIcon = void 0;
|
|
7
|
-
var _react = require("react");
|
|
8
|
-
var _context = require("./context");
|
|
9
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
10
|
-
const createAvatarIcon = BaseIcon => /*#__PURE__*/(0, _react.forwardRef)(({
|
|
11
|
-
children,
|
|
12
|
-
style,
|
|
13
|
-
...props
|
|
14
|
-
}, ref) => {
|
|
15
|
-
const {
|
|
16
|
-
imageLoaded,
|
|
17
|
-
imageError
|
|
18
|
-
} = (0, _context.useAvatarContext)();
|
|
19
|
-
const visible = !imageLoaded || imageError;
|
|
20
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(BaseIcon, {
|
|
21
|
-
ref: ref,
|
|
22
|
-
style: [style, !visible && {
|
|
23
|
-
opacity: 0
|
|
24
|
-
}],
|
|
25
|
-
...props,
|
|
26
|
-
children: children
|
|
27
|
-
});
|
|
28
|
-
});
|
|
29
|
-
exports.createAvatarIcon = createAvatarIcon;
|
|
30
|
-
//# sourceMappingURL=createAvatarIcon.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_react","require","_context","_jsxRuntime","createAvatarIcon","BaseIcon","forwardRef","children","style","props","ref","imageLoaded","imageError","useAvatarContext","visible","jsx","opacity","exports"],"sourceRoot":"../../../src","sources":["avatar/createAvatarIcon.tsx"],"mappings":";;;;;;AACA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AAA6C,IAAAE,WAAA,GAAAF,OAAA;AAGtC,MAAMG,gBAAgB,GAAQC,QAAgC,iBACnE,IAAAC,iBAAU,EAA4B,CAAC;EAAEC,QAAQ;EAAEC,KAAK;EAAE,GAAGC;AAAM,CAAC,EAAEC,GAAG,KAAK;EAC5E,MAAM;IAAEC,WAAW;IAAEC;EAAW,CAAC,GAAG,IAAAC,yBAAgB,EAAC,CAAC;EACtD,MAAMC,OAAO,GAAG,CAACH,WAAW,IAAIC,UAAU;EAE1C,oBACE,IAAAT,WAAA,CAAAY,GAAA,EAACV,QAAQ;IAACK,GAAG,EAAEA,GAAI;IAACF,KAAK,EAAE,CAACA,KAAK,EAAE,CAACM,OAAO,IAAI;MAAEE,OAAO,EAAE;IAAE,CAAC,CAAE;IAAA,GAAMP,KAAK;IAAAF,QAAA,EACvEA;EAAQ,CACD,CAAC;AAEf,CAAC,CAAC;AAACU,OAAA,CAAAb,gBAAA,GAAAA,gBAAA","ignoreList":[]}
|