@cdx-ui/primitives 0.0.1-beta.7 → 0.0.1-beta.70
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 +52 -26
- package/lib/commonjs/CLAUDE.md +84 -0
- package/lib/commonjs/avatar/AvatarRoot.js +38 -0
- 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/ButtonRoot.js +85 -0
- 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/CheckboxGroup.js +52 -0
- 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 +20 -0
- package/lib/commonjs/chip/index.js.map +1 -0
- package/lib/commonjs/chip/types.js.map +1 -0
- package/lib/commonjs/dialog/DialogClose.js +32 -0
- package/lib/commonjs/dialog/DialogClose.js.map +1 -0
- package/lib/commonjs/dialog/DialogPopup.js +161 -0
- package/lib/commonjs/dialog/DialogPopup.js.map +1 -0
- package/lib/commonjs/dialog/DialogRoot.js +57 -0
- 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/form/FormRoot.web.js +27 -0
- 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 +86 -5
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/input/InputField.android.js +98 -0
- 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/InputRoot.js +84 -0
- 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/LinkRoot.js +88 -0
- package/lib/commonjs/link/LinkRoot.js.map +1 -0
- package/lib/commonjs/link/context.js +11 -0
- package/lib/commonjs/link/context.js.map +1 -0
- package/lib/commonjs/link/index.js +16 -3
- package/lib/commonjs/link/index.js.map +1 -1
- package/lib/commonjs/list-item/ListItemRoot.js +149 -0
- 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/OtpInputField.js +120 -0
- 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/useOtpInput.js +120 -0
- 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-bar/ProgressBarIndicator.js +45 -0
- package/lib/commonjs/progress-bar/ProgressBarIndicator.js.map +1 -0
- package/lib/commonjs/progress-bar/ProgressBarRoot.js +100 -0
- 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-bar/types.js +6 -0
- package/lib/commonjs/progress-bar/types.js.map +1 -0
- package/lib/commonjs/radio/RadioGroup.js +74 -0
- 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/context.js +14 -0
- package/lib/commonjs/radio/context.js.map +1 -0
- package/lib/commonjs/radio/index.js +27 -0
- package/lib/commonjs/radio/index.js.map +1 -0
- package/lib/commonjs/radio/types.js +6 -0
- package/lib/commonjs/radio/types.js.map +1 -0
- package/lib/commonjs/radio/useRadioRoot.js +64 -0
- package/lib/commonjs/radio/useRadioRoot.js.map +1 -0
- package/lib/commonjs/select/SelectContent.js +105 -0
- package/lib/commonjs/select/SelectContent.js.map +1 -0
- package/lib/commonjs/select/SelectItem.js +104 -0
- package/lib/commonjs/select/SelectItem.js.map +1 -0
- package/lib/commonjs/select/SelectRoot.js +105 -0
- 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/TileGroup.js +111 -0
- 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/context.js +30 -0
- package/lib/commonjs/tile/context.js.map +1 -0
- package/lib/commonjs/tile/index.js +33 -0
- package/lib/commonjs/tile/index.js.map +1 -0
- package/lib/commonjs/tile/types.js +6 -0
- package/lib/commonjs/tile/types.js.map +1 -0
- package/lib/commonjs/utils/dataAttributes.js +12 -25
- 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 +64 -0
- package/lib/commonjs/utils/domDataAttributes.js.map +1 -0
- package/lib/module/CLAUDE.md +84 -0
- package/lib/module/avatar/AvatarRoot.js +34 -0
- 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/ButtonRoot.js +81 -0
- 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/CheckboxGroup.js +48 -0
- 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 +5 -0
- package/lib/module/chip/index.js.map +1 -0
- package/lib/module/chip/types.js.map +1 -0
- package/lib/module/dialog/DialogClose.js +28 -0
- package/lib/module/dialog/DialogClose.js.map +1 -0
- package/lib/module/dialog/DialogPopup.js +157 -0
- package/lib/module/dialog/DialogPopup.js.map +1 -0
- package/lib/module/dialog/DialogRoot.js +53 -0
- 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 +8 -2
- package/lib/module/index.js.map +1 -1
- package/lib/module/input/InputField.android.js +94 -0
- 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/InputRoot.js +80 -0
- 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/LinkRoot.js +84 -0
- package/lib/module/link/LinkRoot.js.map +1 -0
- package/lib/module/link/context.js +5 -0
- package/lib/module/link/context.js.map +1 -0
- package/lib/module/link/index.js +2 -1
- package/lib/module/link/index.js.map +1 -1
- package/lib/module/list-item/ListItemRoot.js +144 -0
- 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/OtpInputField.js +116 -0
- 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/useOtpInput.js +116 -0
- 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-bar/ProgressBarIndicator.js +41 -0
- package/lib/module/progress-bar/ProgressBarIndicator.js.map +1 -0
- package/lib/module/progress-bar/ProgressBarRoot.js +96 -0
- 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-bar/types.js +4 -0
- package/lib/module/progress-bar/types.js.map +1 -0
- package/lib/module/radio/RadioGroup.js +70 -0
- 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/context.js +7 -0
- package/lib/module/radio/context.js.map +1 -0
- package/lib/module/radio/index.js +6 -0
- package/lib/module/radio/index.js.map +1 -0
- package/lib/module/radio/types.js +4 -0
- package/lib/module/radio/types.js.map +1 -0
- package/lib/module/radio/useRadioRoot.js +60 -0
- package/lib/module/radio/useRadioRoot.js.map +1 -0
- package/lib/module/select/SelectContent.js +100 -0
- package/lib/module/select/SelectContent.js.map +1 -0
- package/lib/module/select/SelectItem.js +100 -0
- package/lib/module/select/SelectItem.js.map +1 -0
- package/lib/module/select/SelectRoot.js +101 -0
- 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/TileGroup.js +107 -0
- package/lib/module/tile/TileGroup.js.map +1 -0
- package/lib/module/tile/TileRoot.js +125 -0
- package/lib/module/tile/TileRoot.js.map +1 -0
- package/lib/module/tile/context.js +21 -0
- package/lib/module/tile/context.js.map +1 -0
- package/lib/module/tile/index.js +6 -0
- package/lib/module/tile/index.js.map +1 -0
- package/lib/module/tile/types.js +4 -0
- package/lib/module/tile/types.js.map +1 -0
- package/lib/module/utils/dataAttributes.js +4 -22
- 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 +59 -0
- package/lib/module/utils/domDataAttributes.js.map +1 -0
- 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 +3 -1
- package/lib/typescript/checkbox/useCheckboxRoot.d.ts.map +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 +4 -0
- package/lib/typescript/chip/index.d.ts.map +1 -0
- package/lib/typescript/chip/types.d.ts +16 -0
- package/lib/typescript/chip/types.d.ts.map +1 -0
- 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 +14 -25
- 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 +8 -2
- 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/context.d.ts +10 -0
- package/lib/typescript/link/context.d.ts.map +1 -0
- package/lib/typescript/link/index.d.ts +3 -1
- package/lib/typescript/link/index.d.ts.map +1 -1
- package/lib/typescript/link/types.d.ts +1 -0
- package/lib/typescript/link/types.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 +5 -59
- 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-bar/types.d.ts +22 -0
- 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/context.d.ts +21 -0
- package/lib/typescript/radio/context.d.ts.map +1 -0
- package/lib/typescript/radio/index.d.ts +5 -0
- package/lib/typescript/radio/index.d.ts.map +1 -0
- package/lib/typescript/radio/types.d.ts +43 -0
- package/lib/typescript/radio/types.d.ts.map +1 -0
- package/lib/typescript/radio/useRadioRoot.d.ts +151 -0
- package/lib/typescript/radio/useRadioRoot.d.ts.map +1 -0
- 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/context.d.ts +9 -0
- package/lib/typescript/tile/context.d.ts.map +1 -0
- package/lib/typescript/tile/index.d.ts +5 -0
- package/lib/typescript/tile/index.d.ts.map +1 -0
- package/lib/typescript/tile/types.d.ts +108 -0
- package/lib/typescript/tile/types.d.ts.map +1 -0
- package/lib/typescript/utils/dataAttributes.d.ts +4 -10
- 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 +28 -0
- package/lib/typescript/utils/domDataAttributes.d.ts.map +1 -0
- package/package.json +6 -2
- package/src/CLAUDE.md +84 -0
- 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 -0
- package/src/chip/types.ts +20 -0
- 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 +6 -87
- package/src/dialog/types.ts +14 -57
- 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 +12 -2
- 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/context.tsx +10 -0
- package/src/link/index.tsx +3 -1
- package/src/link/types.ts +1 -0
- package/src/list-item/ListItemRoot.tsx +183 -0
- package/src/list-item/context.tsx +2 -2
- package/src/list-item/index.ts +2 -80
- package/src/list-item/types.ts +5 -89
- 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-bar/ProgressBarRoot.tsx +117 -0
- package/src/progress-bar/index.ts +5 -0
- package/src/progress-bar/types.ts +24 -0
- package/src/radio/RadioGroup.tsx +85 -0
- package/src/radio/RadioRoot.tsx +98 -0
- package/src/radio/RadioRoot.web.tsx +90 -0
- package/src/radio/context.tsx +21 -0
- package/src/radio/index.ts +5 -0
- package/src/radio/types.ts +45 -0
- package/src/radio/useRadioRoot.ts +69 -0
- 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/TileRoot.tsx +137 -0
- package/src/tile/context.tsx +23 -0
- package/src/tile/index.ts +18 -0
- package/src/tile/types.ts +121 -0
- package/src/utils/dataAttributes.ts +7 -25
- package/src/utils/dataAttributes.web.ts +24 -0
- package/src/utils/domDataAttributes.ts +63 -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 +0 -34
- package/lib/commonjs/avatar/createAvatarRoot.js.map +0 -1
- package/lib/commonjs/avatar/createAvatarText.js +0 -42
- 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 +0 -81
- 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 -38
- package/lib/commonjs/button/createButtonText.js.map +0 -1
- package/lib/commonjs/checkbox/createCheckboxGroup.js +0 -44
- 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 -90
- package/lib/commonjs/checkbox/createCheckboxRoot.web.js.map +0 -1
- package/lib/commonjs/dialog/createDialogBody.js +0 -21
- package/lib/commonjs/dialog/createDialogBody.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 -141
- 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 +0 -21
- 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/createDialogRoot.js +0 -54
- 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 +0 -95
- package/lib/commonjs/input/createInputField.js.map +0 -1
- package/lib/commonjs/input/createInputRoot.js +0 -82
- 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 +0 -74
- 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 +0 -142
- 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 +0 -104
- package/lib/commonjs/otp-input/createOtpInputField.js.map +0 -1
- package/lib/commonjs/otp-input/createOtpInputRoot.js +0 -136
- 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 +0 -42
- package/lib/commonjs/progress/createProgressIndicator.js.map +0 -1
- package/lib/commonjs/progress/createProgressRoot.js +0 -96
- 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/progress/types.js.map +0 -1
- package/lib/commonjs/select/createSelectContent.js +0 -102
- package/lib/commonjs/select/createSelectContent.js.map +0 -1
- package/lib/commonjs/select/createSelectIcon.js +0 -41
- package/lib/commonjs/select/createSelectIcon.js.map +0 -1
- package/lib/commonjs/select/createSelectItem.js +0 -101
- 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 +0 -102
- package/lib/commonjs/select/createSelectRoot.js.map +0 -1
- package/lib/commonjs/select/createSelectTrigger.js +0 -179
- 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/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 +0 -29
- package/lib/module/avatar/createAvatarRoot.js.map +0 -1
- package/lib/module/avatar/createAvatarText.js +0 -37
- 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 +0 -76
- 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 -33
- package/lib/module/button/createButtonText.js.map +0 -1
- package/lib/module/checkbox/createCheckboxGroup.js +0 -39
- 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 -85
- package/lib/module/checkbox/createCheckboxRoot.web.js.map +0 -1
- package/lib/module/dialog/createDialogBody.js +0 -15
- package/lib/module/dialog/createDialogBody.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 -136
- 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/createDialogRoot.js +0 -49
- 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 +0 -90
- package/lib/module/input/createInputField.js.map +0 -1
- package/lib/module/input/createInputRoot.js +0 -76
- 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 +0 -68
- 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 +0 -136
- 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 +0 -99
- package/lib/module/otp-input/createOtpInputField.js.map +0 -1
- package/lib/module/otp-input/createOtpInputRoot.js +0 -131
- 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 +0 -37
- package/lib/module/progress/createProgressIndicator.js.map +0 -1
- package/lib/module/progress/createProgressRoot.js +0 -91
- 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/progress/types.js.map +0 -1
- package/lib/module/select/createSelectContent.js +0 -97
- package/lib/module/select/createSelectContent.js.map +0 -1
- package/lib/module/select/createSelectIcon.js +0 -36
- package/lib/module/select/createSelectIcon.js.map +0 -1
- package/lib/module/select/createSelectItem.js +0 -96
- 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 +0 -97
- package/lib/module/select/createSelectRoot.js.map +0 -1
- package/lib/module/select/createSelectTrigger.js +0 -174
- 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/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 -2
- package/lib/typescript/checkbox/createCheckboxRoot.web.d.ts.map +0 -1
- package/lib/typescript/dialog/createDialogBody.d.ts +0 -4
- package/lib/typescript/dialog/createDialogBody.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/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 +0 -25
- package/lib/typescript/progress/types.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/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 -30
- 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 -22
- 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 -79
- package/src/dialog/createDialogBody.tsx +0 -11
- package/src/dialog/createDialogClose.tsx +0 -27
- package/src/dialog/createDialogContent.tsx +0 -122
- package/src/dialog/createDialogDescription.tsx +0 -20
- package/src/dialog/createDialogFooter.tsx +0 -11
- package/src/dialog/createDialogHeader.tsx +0 -11
- 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 -30
- package/src/field/createFieldRoot.tsx +0 -27
- package/src/form/createFormRoot.tsx +0 -13
- package/src/input/createInputField.tsx +0 -114
- package/src/input/createInputRoot.tsx +0 -92
- package/src/input/createInputSlot.tsx +0 -39
- package/src/link/createLink.tsx +0 -71
- 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 -163
- 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/createProgressRoot.tsx +0 -109
- package/src/progress/index.ts +0 -28
- package/src/progress/types.ts +0 -37
- package/src/select/createSelectContent.tsx +0 -115
- package/src/select/createSelectIcon.tsx +0 -27
- 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 -218
- package/src/select/createSelectValue.tsx +0 -38
- package/src/select/index.tsx +0 -73
- package/src/switch/createSwitchRoot.tsx +0 -72
- /package/lib/commonjs/{progress → chip}/types.js +0 -0
- /package/lib/commonjs/{progress → progress-bar}/context.js +0 -0
- /package/lib/module/{progress → chip}/types.js +0 -0
- /package/lib/module/{progress → progress-bar}/context.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';
|
|
@@ -0,0 +1,137 @@
|
|
|
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';
|
|
5
|
+
import { useHover, usePress } from '@react-native-aria/interactions';
|
|
6
|
+
import { Slot } from '../slot';
|
|
7
|
+
import { dataAttributes, mergeDataAttributes } from '../utils/dataAttributes';
|
|
8
|
+
import { TileProvider, useOptionalTileGroupContext } from './context';
|
|
9
|
+
import type { ITileProps, ITilePressablePassthrough } from './types';
|
|
10
|
+
|
|
11
|
+
const rowStyle = {
|
|
12
|
+
flexDirection: 'row' as const,
|
|
13
|
+
alignSelf: 'stretch' as const,
|
|
14
|
+
alignItems: 'center' as const,
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export interface TileRootProps extends ITileProps {}
|
|
18
|
+
|
|
19
|
+
export const TileRoot = forwardRef<ComponentRef<typeof Pressable>, TileRootProps>(
|
|
20
|
+
(
|
|
21
|
+
{
|
|
22
|
+
asChild = false,
|
|
23
|
+
value,
|
|
24
|
+
disabled: disabledProp = false,
|
|
25
|
+
isSelected: controlledSelected,
|
|
26
|
+
defaultSelected,
|
|
27
|
+
onSelectedChange,
|
|
28
|
+
children,
|
|
29
|
+
onPress,
|
|
30
|
+
onFocus,
|
|
31
|
+
onBlur,
|
|
32
|
+
style,
|
|
33
|
+
...rest
|
|
34
|
+
},
|
|
35
|
+
ref,
|
|
36
|
+
) => {
|
|
37
|
+
const group = useOptionalTileGroupContext();
|
|
38
|
+
|
|
39
|
+
const [standaloneSelected = false, setStandaloneSelected] = useControllableState<boolean>({
|
|
40
|
+
prop: controlledSelected,
|
|
41
|
+
defaultProp: defaultSelected ?? false,
|
|
42
|
+
onChange: (next) => {
|
|
43
|
+
onSelectedChange?.(next);
|
|
44
|
+
},
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
const isSelected = group ? group.isSelected(value) : standaloneSelected;
|
|
48
|
+
const disabledByGroup = group ? group.isTileDisabledByGroup(value) : false;
|
|
49
|
+
const isDisabled = disabledByGroup || disabledProp;
|
|
50
|
+
const cannotToggle = isDisabled;
|
|
51
|
+
|
|
52
|
+
const { focusProps, isFocused } = useFocus();
|
|
53
|
+
const { isFocusVisible, focusProps: focusRingProps } = useFocusRing() as {
|
|
54
|
+
isFocusVisible: boolean;
|
|
55
|
+
focusProps: typeof focusProps;
|
|
56
|
+
};
|
|
57
|
+
const { pressProps, isPressed } = usePress({ isDisabled: cannotToggle });
|
|
58
|
+
const { hoverProps, isHovered } = useHover();
|
|
59
|
+
|
|
60
|
+
// Standalone tiles use checkbox semantics (independent on/off toggle).
|
|
61
|
+
const selectionType = group ? group.type : 'multiple';
|
|
62
|
+
|
|
63
|
+
const accessibilityState = useMemo(
|
|
64
|
+
() => ({
|
|
65
|
+
disabled: isDisabled,
|
|
66
|
+
...(selectionType === 'single' ? { selected: isSelected } : { checked: isSelected }),
|
|
67
|
+
}),
|
|
68
|
+
[isDisabled, isSelected, selectionType],
|
|
69
|
+
);
|
|
70
|
+
|
|
71
|
+
const tileContext = useMemo(
|
|
72
|
+
() => ({ value, isSelected, isDisabled, selectionType }),
|
|
73
|
+
[value, isSelected, isDisabled, selectionType],
|
|
74
|
+
);
|
|
75
|
+
|
|
76
|
+
const passthrough = rest as ITilePressablePassthrough;
|
|
77
|
+
|
|
78
|
+
const composedOnPress = composeEventHandlers(onPress, () => {
|
|
79
|
+
if (cannotToggle) {
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
if (group) {
|
|
83
|
+
group.toggleValue(value);
|
|
84
|
+
} else {
|
|
85
|
+
setStandaloneSelected(!standaloneSelected);
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
const role = selectionType === 'single' ? 'radio' : 'checkbox';
|
|
90
|
+
|
|
91
|
+
const Comp = asChild ? Slot : Pressable;
|
|
92
|
+
|
|
93
|
+
return (
|
|
94
|
+
<TileProvider value={tileContext}>
|
|
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
|
+
)}
|
|
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
|
+
)}
|
|
129
|
+
>
|
|
130
|
+
{children}
|
|
131
|
+
</Comp>
|
|
132
|
+
</TileProvider>
|
|
133
|
+
);
|
|
134
|
+
},
|
|
135
|
+
);
|
|
136
|
+
|
|
137
|
+
TileRoot.displayName = 'TileRoot';
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { createContext as createReactContext, useContext } from 'react';
|
|
2
|
+
import { createContext } from '@cdx-ui/utils';
|
|
3
|
+
import type { ITileContextValue, ITileGroupContextValue } from './types';
|
|
4
|
+
|
|
5
|
+
// Per-tile subtree (selection-aware slots, indicator, etc.)
|
|
6
|
+
export const [TileProvider, useTileContext] = createContext<ITileContextValue>('TileContext');
|
|
7
|
+
|
|
8
|
+
// Per-group subtree (optional — standalone tiles have no provider)
|
|
9
|
+
const TileGroupContext = createReactContext<ITileGroupContextValue | null>(null);
|
|
10
|
+
|
|
11
|
+
export const TileGroupContextProvider = TileGroupContext.Provider;
|
|
12
|
+
|
|
13
|
+
export function useTileGroupContext(): ITileGroupContextValue {
|
|
14
|
+
const ctx = useContext(TileGroupContext);
|
|
15
|
+
if (!ctx) {
|
|
16
|
+
throw new Error('Tile must be used within Tile.Group');
|
|
17
|
+
}
|
|
18
|
+
return ctx;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export function useOptionalTileGroupContext(): ITileGroupContextValue | null {
|
|
22
|
+
return useContext(TileGroupContext);
|
|
23
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export type {
|
|
2
|
+
ITileContextValue,
|
|
3
|
+
ITileGroupMultipleProps,
|
|
4
|
+
ITileGroupProps,
|
|
5
|
+
ITileGroupSingleProps,
|
|
6
|
+
ITileGroupContextValue,
|
|
7
|
+
ITileIndicatorProps,
|
|
8
|
+
ITileLeadingSlotProps,
|
|
9
|
+
ITilePressablePassthrough,
|
|
10
|
+
ITileProps,
|
|
11
|
+
ITileTrailingSlotProps,
|
|
12
|
+
TileGroupType,
|
|
13
|
+
TileGroupValue,
|
|
14
|
+
} from './types';
|
|
15
|
+
|
|
16
|
+
export { TileProvider, useTileContext } from './context';
|
|
17
|
+
export { TileRoot, type TileRootProps } from './TileRoot';
|
|
18
|
+
export { TileGroup, type TileGroupProps } from './TileGroup';
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import type { PressableProps, ViewProps } from 'react-native';
|
|
2
|
+
|
|
3
|
+
export type TileGroupType = 'single' | 'multiple';
|
|
4
|
+
|
|
5
|
+
export type TileGroupValue = string | string[] | undefined;
|
|
6
|
+
|
|
7
|
+
interface ITileGroupBaseProps extends ViewProps {
|
|
8
|
+
/** Merge group props onto a single child instead of rendering the default View. */
|
|
9
|
+
asChild?: boolean;
|
|
10
|
+
/** Disables the whole group. */
|
|
11
|
+
isDisabled?: boolean;
|
|
12
|
+
/** Accessible name for the group (radiogroup / group). */
|
|
13
|
+
'aria-label'?: string;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export interface ITileGroupSingleProps extends ITileGroupBaseProps {
|
|
17
|
+
/** Single-select (radio semantics). One value at a time. */
|
|
18
|
+
type: 'single';
|
|
19
|
+
/** Controlled selected value. */
|
|
20
|
+
value?: string;
|
|
21
|
+
/** Uncontrolled initial value. */
|
|
22
|
+
defaultValue?: string;
|
|
23
|
+
/** Called when selection changes. */
|
|
24
|
+
onValueChange?: (value: string) => void;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export interface ITileGroupMultipleProps extends ITileGroupBaseProps {
|
|
28
|
+
/** Multi-select (checkbox semantics). Zero to `max` values at a time. */
|
|
29
|
+
type: 'multiple';
|
|
30
|
+
/** Controlled selected values. */
|
|
31
|
+
value?: string[];
|
|
32
|
+
/** Uncontrolled initial values. */
|
|
33
|
+
defaultValue?: string[];
|
|
34
|
+
/** Called when selection changes. */
|
|
35
|
+
onValueChange?: (value: string[]) => void;
|
|
36
|
+
/** Maximum selections allowed. @default Infinity */
|
|
37
|
+
max?: number;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Discriminated union: `type` narrows `value` / `defaultValue` / `onValueChange`,
|
|
42
|
+
* and `max` is only valid on `type="multiple"`.
|
|
43
|
+
*/
|
|
44
|
+
export type ITileGroupProps = ITileGroupSingleProps | ITileGroupMultipleProps;
|
|
45
|
+
|
|
46
|
+
export interface ITileGroupContextValue {
|
|
47
|
+
type: TileGroupType;
|
|
48
|
+
/** Current selection (string for single, array for multiple). */
|
|
49
|
+
value: string | string[] | undefined;
|
|
50
|
+
toggleValue: (tileValue: string) => void;
|
|
51
|
+
isSelected: (tileValue: string) => boolean;
|
|
52
|
+
/** Group-level disabled or multi-select at max (unselected tiles). */
|
|
53
|
+
isTileDisabledByGroup: (tileValue: string) => boolean;
|
|
54
|
+
isGroupDisabled: boolean;
|
|
55
|
+
max: number;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export interface ITileContextValue {
|
|
59
|
+
/** This tile's `value`. */
|
|
60
|
+
value: string;
|
|
61
|
+
isSelected: boolean;
|
|
62
|
+
/** Effective disabled (group rules + tile `disabled`). */
|
|
63
|
+
isDisabled: boolean;
|
|
64
|
+
selectionType: TileGroupType;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export type ITilePressablePassthrough = Partial<
|
|
68
|
+
Pick<PressableProps, 'onPressIn' | 'onPressOut' | 'onHoverIn' | 'onHoverOut'>
|
|
69
|
+
>;
|
|
70
|
+
|
|
71
|
+
export interface ITileProps extends PressableProps, ITilePressablePassthrough {
|
|
72
|
+
/** Merge tile props onto a single child instead of rendering the default Pressable. */
|
|
73
|
+
asChild?: boolean;
|
|
74
|
+
/**
|
|
75
|
+
* Identifies this tile within `Tile.Group`. Must be unique within the group.
|
|
76
|
+
* Standalone tiles still require a value (useful for form submission, analytics, etc.).
|
|
77
|
+
*/
|
|
78
|
+
value: string;
|
|
79
|
+
/**
|
|
80
|
+
* Disables this tile (in addition to group rules such as multi-select max).
|
|
81
|
+
*/
|
|
82
|
+
disabled?: boolean;
|
|
83
|
+
/**
|
|
84
|
+
* Controlled selected state for **standalone** usage (no parent `Tile.Group`).
|
|
85
|
+
* Ignored when the tile is rendered inside a `Tile.Group` — selection is owned by the group.
|
|
86
|
+
*/
|
|
87
|
+
isSelected?: boolean;
|
|
88
|
+
/**
|
|
89
|
+
* Initial selected state for **standalone**, uncontrolled usage.
|
|
90
|
+
*/
|
|
91
|
+
defaultSelected?: boolean;
|
|
92
|
+
/**
|
|
93
|
+
* Called when standalone selection state changes. Group context overrides this — when inside
|
|
94
|
+
* a `Tile.Group`, use the group's `onValueChange` instead.
|
|
95
|
+
*/
|
|
96
|
+
onSelectedChange?: (isSelected: boolean) => void;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
export interface ITileLeadingSlotProps extends ViewProps {
|
|
100
|
+
/**
|
|
101
|
+
* Leading content is decorative by default for screen readers.
|
|
102
|
+
* @default true
|
|
103
|
+
*/
|
|
104
|
+
'aria-hidden'?: boolean;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
export interface ITileIndicatorProps extends ViewProps {
|
|
108
|
+
/**
|
|
109
|
+
* Explicit indicator visual. When inside a `Tile.Group`, auto-infers from `type`
|
|
110
|
+
* (`single` → radio, `multiple` → checkbox). For standalone tiles, defaults to `'checkbox'`
|
|
111
|
+
* to match the standalone `checkbox` ARIA role; override with `indicatorType="radio"` if
|
|
112
|
+
* a radio-style visual is needed.
|
|
113
|
+
*/
|
|
114
|
+
indicatorType?: 'radio' | 'checkbox';
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Generic trailing content slot. Use for chevrons, amounts, chips, status text — anything that
|
|
119
|
+
* is **not** the radio/checkbox selection affordance. For that, use `Tile.Indicator`.
|
|
120
|
+
*/
|
|
121
|
+
export type ITileTrailingSlotProps = ViewProps;
|
|
@@ -1,28 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Produces
|
|
2
|
+
* Produces `data-*` props for native platforms (consumed by Uniwind).
|
|
3
|
+
* Web (.web.ts): returns a `dataSet` object consumed by React Native Web instead.
|
|
3
4
|
*
|
|
4
|
-
*
|
|
5
|
-
* Web (.web.ts): a `dataSet` object consumed by React Native Web.
|
|
6
|
-
*
|
|
7
|
-
* Boolean values serialize to `"true"` / `"false"` strings.
|
|
8
|
-
* String values pass through as-is.
|
|
9
|
-
* Undefined values are omitted.
|
|
5
|
+
* Delegates to `domDataAttributes` so the conversion logic has a single source of truth.
|
|
10
6
|
*/
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
return str.replaceAll(/[A-Z]/g, (ch) => `-${ch.toLowerCase()}`);
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export function dataAttributes(attrs: Record<string, DataAttributeValue>): Record<string, string> {
|
|
19
|
-
const result: Record<string, string> = {};
|
|
20
|
-
for (const key in attrs) {
|
|
21
|
-
const value = attrs[key];
|
|
22
|
-
if (value === undefined) {
|
|
23
|
-
continue;
|
|
24
|
-
}
|
|
25
|
-
result[`data-${camelToKebab(key)}`] = typeof value === 'boolean' ? String(value) : value;
|
|
26
|
-
}
|
|
27
|
-
return result;
|
|
28
|
-
}
|
|
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
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Produces `data-*` DOM attribute props for use on raw HTML elements (e.g. `<button>`).
|
|
3
|
+
*
|
|
4
|
+
* Unlike `dataAttributes`, which has a platform-specific `.web.ts` sibling that returns a
|
|
5
|
+
* `dataSet` object for React Native Web components, this file has no platform variant.
|
|
6
|
+
* The bundler therefore always resolves to this single implementation, making it safe to
|
|
7
|
+
* import from `.web.tsx` host components that render native DOM elements directly.
|
|
8
|
+
*
|
|
9
|
+
* Boolean values serialize to `"true"` / `"false"` strings.
|
|
10
|
+
* String values pass through as-is.
|
|
11
|
+
* Undefined values are omitted.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
export type DomDataAttributeValue = boolean | string | undefined;
|
|
15
|
+
|
|
16
|
+
function camelToKebab(str: string): string {
|
|
17
|
+
return str.replaceAll(/[A-Z]/g, (ch) => `-${ch.toLowerCase()}`);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export function domDataAttributes(
|
|
21
|
+
attrs: Record<string, DomDataAttributeValue>,
|
|
22
|
+
): Record<string, string> {
|
|
23
|
+
const result: Record<string, string> = {};
|
|
24
|
+
for (const key in attrs) {
|
|
25
|
+
const value = attrs[key];
|
|
26
|
+
if (value === undefined) {
|
|
27
|
+
continue;
|
|
28
|
+
}
|
|
29
|
+
result[`data-${camelToKebab(key)}`] = typeof value === 'boolean' ? String(value) : value;
|
|
30
|
+
}
|
|
31
|
+
return result;
|
|
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":[]}
|