@cdx-ui/primitives 0.0.1-beta.9 → 0.0.1-beta.90
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 +67 -32
- 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/full-window-overlay/index.js +47 -0
- package/lib/commonjs/full-window-overlay/index.js.map +1 -0
- package/lib/commonjs/full-window-overlay/index.web.js +19 -0
- package/lib/commonjs/full-window-overlay/index.web.js.map +1 -0
- package/lib/commonjs/index.js +122 -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/portal/index.js +17 -0
- package/lib/commonjs/portal/index.js.map +1 -0
- package/lib/commonjs/portal/portal.js +110 -0
- package/lib/commonjs/portal/portal.js.map +1 -0
- 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 +141 -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/toast/ToastRoot.js +41 -0
- package/lib/commonjs/toast/ToastRoot.js.map +1 -0
- package/lib/commonjs/toast/context.js +11 -0
- package/lib/commonjs/toast/context.js.map +1 -0
- package/lib/commonjs/toast/index.js +26 -0
- package/lib/commonjs/toast/index.js.map +1 -0
- package/lib/commonjs/toast/types.js +6 -0
- package/lib/commonjs/toast/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/full-window-overlay/index.js +43 -0
- package/lib/module/full-window-overlay/index.js.map +1 -0
- package/lib/module/full-window-overlay/index.web.js +15 -0
- package/lib/module/full-window-overlay/index.web.js.map +1 -0
- package/lib/module/index.js +11 -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/portal/index.js +4 -0
- package/lib/module/portal/index.js.map +1 -0
- package/lib/module/portal/portal.js +103 -0
- package/lib/module/portal/portal.js.map +1 -0
- 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 +135 -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/toast/ToastRoot.js +37 -0
- package/lib/module/toast/ToastRoot.js.map +1 -0
- package/lib/module/toast/context.js +5 -0
- package/lib/module/toast/context.js.map +1 -0
- package/lib/module/toast/index.js +5 -0
- package/lib/module/toast/index.js.map +1 -0
- package/lib/module/toast/types.js +4 -0
- package/lib/module/toast/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 +1 -9
- 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/full-window-overlay/index.d.ts +46 -0
- package/lib/typescript/full-window-overlay/index.d.ts.map +1 -0
- package/lib/typescript/full-window-overlay/index.web.d.ts +29 -0
- package/lib/typescript/full-window-overlay/index.web.d.ts.map +1 -0
- package/lib/typescript/index.d.ts +11 -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/portal/index.d.ts +2 -0
- package/lib/typescript/portal/index.d.ts.map +1 -0
- package/lib/typescript/portal/portal.d.ts +25 -0
- package/lib/typescript/portal/portal.d.ts.map +1 -0
- 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 +8 -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/toast/ToastRoot.d.ts +7 -0
- package/lib/typescript/toast/ToastRoot.d.ts.map +1 -0
- package/lib/typescript/toast/context.d.ts +6 -0
- package/lib/typescript/toast/context.d.ts.map +1 -0
- package/lib/typescript/toast/index.d.ts +3 -0
- package/lib/typescript/toast/index.d.ts.map +1 -0
- package/lib/typescript/toast/types.d.ts +16 -0
- package/lib/typescript/toast/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 +5 -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/full-window-overlay/index.tsx +65 -0
- package/src/full-window-overlay/index.web.tsx +32 -0
- package/src/index.ts +15 -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 +1 -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/portal/index.ts +1 -0
- package/src/portal/portal.tsx +116 -0
- 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.tsx +162 -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/toast/ToastRoot.tsx +39 -0
- package/src/toast/context.tsx +4 -0
- package/src/toast/index.ts +2 -0
- package/src/toast/types.ts +17 -0
- package/src/uniwind.d.ts +1 -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,170 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import React, { forwardRef } from 'react';
|
|
4
|
+
import { StyleSheet } from 'react-native';
|
|
5
|
+
import { Slot } from '../slot';
|
|
6
|
+
import { dataAttributes, mergeDataAttributes } from '../utils/dataAttributes';
|
|
7
|
+
import { domDataAttributes } from '../utils/domDataAttributes';
|
|
8
|
+
import { useSelectTrigger } from './useSelectTrigger';
|
|
9
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
10
|
+
/** Props that must not be forwarded to a DOM `<button>`. */
|
|
11
|
+
const OMIT = new Set(['hitSlop', 'pressRetentionOffset', 'android_ripple', 'android_disableSound', 'unstable_pressDelay', 'onLongPress', 'delayLongPress', 'onPress', 'onPressIn', 'onPressOut', 'onHoverIn', 'onHoverOut', 'onKeyDown', 'onFocus', 'onBlur', 'disabled', 'style', 'className', 'testID', 'children', 'accessible', 'accessibilityActions', 'accessibilityElementsHidden', 'accessibilityHint', 'accessibilityIgnoresInvertColors', 'accessibilityLabel', 'accessibilityLabelledBy', 'accessibilityLiveRegion', 'accessibilityRole', 'accessibilityState', 'accessibilityValue', 'accessibilityViewIsModal', 'importantForAccessibility', 'needsOffscreenAlphaCompositing', 'collapsable', 'shouldRasterizeIOS', 'removeClippedSubviews', 'onAccessibilityAction', 'onAccessibilityEscape', 'onAccessibilityTap', 'dataSet']);
|
|
12
|
+
function filterDomProps(rest) {
|
|
13
|
+
const entries = Object.entries(rest).filter(([key]) => !OMIT.has(key));
|
|
14
|
+
return Object.fromEntries(entries);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/** UA `<button>` defaults (centered text, inline sizing) fight our flex + `justify-between` layout. */
|
|
18
|
+
const webButtonLayoutStyle = {
|
|
19
|
+
display: 'flex',
|
|
20
|
+
flexDirection: 'row',
|
|
21
|
+
alignItems: 'center',
|
|
22
|
+
justifyContent: 'space-between',
|
|
23
|
+
width: '100%',
|
|
24
|
+
minWidth: 0,
|
|
25
|
+
textAlign: 'start',
|
|
26
|
+
boxSizing: 'border-box',
|
|
27
|
+
margin: 0,
|
|
28
|
+
font: 'inherit',
|
|
29
|
+
lineHeight: 'normal',
|
|
30
|
+
WebkitAppearance: 'none',
|
|
31
|
+
appearance: 'none'
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Native `<button type="button">` so the trigger is HTML-labelable (`<label htmlFor>` focuses it).
|
|
36
|
+
* `Pressable` on web is a non-labelable div; the native `<button>` makes label-association work.
|
|
37
|
+
*/
|
|
38
|
+
export const SelectTrigger = /*#__PURE__*/forwardRef(({
|
|
39
|
+
asChild,
|
|
40
|
+
children,
|
|
41
|
+
isHovered,
|
|
42
|
+
isActive,
|
|
43
|
+
isFocused,
|
|
44
|
+
isFocusVisible,
|
|
45
|
+
isDisabled,
|
|
46
|
+
'aria-describedby': ariaDescribedBy,
|
|
47
|
+
onPress,
|
|
48
|
+
onPressIn,
|
|
49
|
+
onPressOut,
|
|
50
|
+
onHoverIn,
|
|
51
|
+
onHoverOut,
|
|
52
|
+
onFocus,
|
|
53
|
+
onBlur,
|
|
54
|
+
...rest
|
|
55
|
+
}, ref) => {
|
|
56
|
+
const consumerOnKeyDown = rest.onKeyDown;
|
|
57
|
+
const {
|
|
58
|
+
ariaProps,
|
|
59
|
+
dataAttrValues,
|
|
60
|
+
mergedRef,
|
|
61
|
+
handlers,
|
|
62
|
+
interactionState
|
|
63
|
+
} = useSelectTrigger(ref, {
|
|
64
|
+
asChild,
|
|
65
|
+
isHovered,
|
|
66
|
+
isActive,
|
|
67
|
+
isFocused,
|
|
68
|
+
isFocusVisible,
|
|
69
|
+
isDisabled,
|
|
70
|
+
ariaDescribedBy,
|
|
71
|
+
onPress,
|
|
72
|
+
onPressIn,
|
|
73
|
+
onPressOut,
|
|
74
|
+
onHoverIn,
|
|
75
|
+
onHoverOut,
|
|
76
|
+
onFocus: onFocus,
|
|
77
|
+
onBlur: onBlur,
|
|
78
|
+
onKeyDown: consumerOnKeyDown
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* `asChild` path: forward Pressable-style props through `Slot` so consumers can substitute
|
|
83
|
+
* another Forge primitive (IconButton, Chip, Button) — all of which forward Pressable-shaped
|
|
84
|
+
* handlers to an underlying RNW `Pressable`. We pass data attributes in the RN/RNW `dataSet`
|
|
85
|
+
* form (not the flat DOM `data-*` form used by the `<button>` host below) because the
|
|
86
|
+
* substituted component is RN/RNW-shaped — RNW translates `dataSet` to DOM `data-*` keys.
|
|
87
|
+
*
|
|
88
|
+
* The label-focus bridge mount is owned by the hook: on web with `asChild=true` the
|
|
89
|
+
* substituted element renders `<div role="button">` instead of `<button>`, which breaks
|
|
90
|
+
* native `<label htmlFor>` association — the hook registers the bridge on `field.inputRef`
|
|
91
|
+
* so `Form.Label` still focuses the trigger.
|
|
92
|
+
*
|
|
93
|
+
* NOTE — `data-slot` overlap: the substituted component carries its own `data-slot`
|
|
94
|
+
* (e.g. `button`, `icon-button`, `chip`) which will end up on the merged element. The
|
|
95
|
+
* `select-trigger` `data-slot` arriving via `props` may be overridden depending on merge
|
|
96
|
+
* order. Styled-layer selectors that need guaranteed `select-trigger` access should
|
|
97
|
+
* attach a wrapper around the trigger rather than relying on `data-slot`.
|
|
98
|
+
*/
|
|
99
|
+
if (asChild) {
|
|
100
|
+
return /*#__PURE__*/_jsx(Slot, {
|
|
101
|
+
ref: mergedRef,
|
|
102
|
+
...ariaProps,
|
|
103
|
+
...rest,
|
|
104
|
+
...mergeDataAttributes(rest, dataAttributes(dataAttrValues)),
|
|
105
|
+
onPress: handlers.onPress,
|
|
106
|
+
onPressIn: handlers.onPressIn,
|
|
107
|
+
onPressOut: handlers.onPressOut,
|
|
108
|
+
onHoverIn: handlers.onHoverIn,
|
|
109
|
+
onHoverOut: handlers.onHoverOut,
|
|
110
|
+
onFocus: handlers.onFocus,
|
|
111
|
+
onBlur: handlers.onBlur,
|
|
112
|
+
onKeyDown: handlers.onKeyDown,
|
|
113
|
+
children: typeof children === 'function' ? children(interactionState) : children
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
const dataAttrs = domDataAttributes(dataAttrValues);
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* Native `<button>` host so the trigger is HTML-labelable. We map Pressable-style handlers
|
|
120
|
+
* to DOM events at the boundary, filter out RN-only props, and apply the layout shim that
|
|
121
|
+
* neutralizes UA `<button>` defaults that fight our flex + `justify-between` layout.
|
|
122
|
+
*/
|
|
123
|
+
const {
|
|
124
|
+
style,
|
|
125
|
+
className,
|
|
126
|
+
testID,
|
|
127
|
+
...buttonRest
|
|
128
|
+
} = rest;
|
|
129
|
+
const domProps = filterDomProps(buttonRest);
|
|
130
|
+
const flattened = StyleSheet.flatten(style);
|
|
131
|
+
return /*#__PURE__*/_jsx("button", {
|
|
132
|
+
ref: mergedRef,
|
|
133
|
+
...domProps,
|
|
134
|
+
...dataAttrs,
|
|
135
|
+
type: "button",
|
|
136
|
+
...ariaProps,
|
|
137
|
+
className: typeof className === 'string' ? className : undefined,
|
|
138
|
+
style: {
|
|
139
|
+
...webButtonLayoutStyle,
|
|
140
|
+
...(flattened ?? {})
|
|
141
|
+
},
|
|
142
|
+
"data-testid": testID,
|
|
143
|
+
onClick: e => {
|
|
144
|
+
if (!ariaProps.disabled) {
|
|
145
|
+
handlers.onPress(e);
|
|
146
|
+
}
|
|
147
|
+
},
|
|
148
|
+
onPointerDown: e => {
|
|
149
|
+
handlers.onPressIn(e);
|
|
150
|
+
},
|
|
151
|
+
onPointerUp: e => {
|
|
152
|
+
handlers.onPressOut(e);
|
|
153
|
+
},
|
|
154
|
+
onPointerCancel: e => {
|
|
155
|
+
handlers.onPressOut(e);
|
|
156
|
+
},
|
|
157
|
+
onFocus: e => {
|
|
158
|
+
handlers.onFocus(e);
|
|
159
|
+
},
|
|
160
|
+
onBlur: e => {
|
|
161
|
+
handlers.onBlur(e);
|
|
162
|
+
},
|
|
163
|
+
onKeyDown: e => {
|
|
164
|
+
handlers.onKeyDown(e);
|
|
165
|
+
},
|
|
166
|
+
children: typeof children === 'function' ? children(interactionState) : children
|
|
167
|
+
});
|
|
168
|
+
});
|
|
169
|
+
SelectTrigger.displayName = 'SelectTrigger';
|
|
170
|
+
//# sourceMappingURL=SelectTrigger.web.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","forwardRef","StyleSheet","Slot","dataAttributes","mergeDataAttributes","domDataAttributes","useSelectTrigger","jsx","_jsx","OMIT","Set","filterDomProps","rest","entries","Object","filter","key","has","fromEntries","webButtonLayoutStyle","display","flexDirection","alignItems","justifyContent","width","minWidth","textAlign","boxSizing","margin","font","lineHeight","WebkitAppearance","appearance","SelectTrigger","asChild","children","isHovered","isActive","isFocused","isFocusVisible","isDisabled","ariaDescribedBy","onPress","onPressIn","onPressOut","onHoverIn","onHoverOut","onFocus","onBlur","ref","consumerOnKeyDown","onKeyDown","ariaProps","dataAttrValues","mergedRef","handlers","interactionState","dataAttrs","style","className","testID","buttonRest","domProps","flattened","flatten","type","undefined","onClick","e","disabled","onPointerDown","onPointerUp","onPointerCancel","displayName"],"sourceRoot":"../../../src","sources":["select/SelectTrigger.web.tsx"],"mappings":";;AAAA,OAAOA,KAAK,IAAIC,UAAU,QAAwB,OAAO;AACzD,SAA8BC,UAAU,QAAQ,cAAc;AAC9D,SAASC,IAAI,QAAQ,SAAS;AAE9B,SAASC,cAAc,EAAEC,mBAAmB,QAAQ,yBAAyB;AAC7E,SAASC,iBAAiB,QAAQ,4BAA4B;AAE9D,SAASC,gBAAgB,QAAQ,oBAAoB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAOtD;AACA,MAAMC,IAAI,GAAG,IAAIC,GAAG,CAAS,CAC3B,SAAS,EACT,sBAAsB,EACtB,gBAAgB,EAChB,sBAAsB,EACtB,qBAAqB,EACrB,aAAa,EACb,gBAAgB,EAChB,SAAS,EACT,WAAW,EACX,YAAY,EACZ,WAAW,EACX,YAAY,EACZ,WAAW,EACX,SAAS,EACT,QAAQ,EACR,UAAU,EACV,OAAO,EACP,WAAW,EACX,QAAQ,EACR,UAAU,EACV,YAAY,EACZ,sBAAs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A,QAAQ,CAACqB,gBAAgB,CAAC,GAAGrB;EAAQ,CACjE,CAAC;AAEb,CACF,CAAC;AAEDF,aAAa,CAACwC,WAAW,GAAG,eAAe","ignoreList":[]}
|
|
@@ -3,16 +3,9 @@
|
|
|
3
3
|
import { createContext } from '@cdx-ui/utils';
|
|
4
4
|
export const [SelectProvider, useSelectContext] = createContext('SelectContext');
|
|
5
5
|
|
|
6
|
-
/**
|
|
7
|
-
* Propagates the trigger's interaction state (hover, focus, active, etc.) to
|
|
8
|
-
* child components like SelectValue and SelectIcon so they can apply matching
|
|
9
|
-
* data-attribute styles.
|
|
10
|
-
*/
|
|
11
|
-
export const [SelectTriggerProvider, useSelectTriggerContext] = createContext('SelectTriggerContext');
|
|
12
|
-
|
|
13
6
|
/**
|
|
14
7
|
* Propagates the item's interaction and selection state (hover, focus, active,
|
|
15
|
-
* highlighted, checked, etc.) to child
|
|
8
|
+
* highlighted, checked, etc.) to child slots like `Select.ItemLabel`.
|
|
16
9
|
*/
|
|
17
10
|
export const [SelectItemProvider, useSelectItemContext] = createContext('SelectItemContext');
|
|
18
11
|
//# sourceMappingURL=context.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["createContext","SelectProvider","useSelectContext","
|
|
1
|
+
{"version":3,"names":["createContext","SelectProvider","useSelectContext","SelectItemProvider","useSelectItemContext"],"sourceRoot":"../../../src","sources":["select/context.tsx"],"mappings":";;AAAA,SAASA,aAAa,QAAQ,eAAe;AAG7C,OAAO,MAAM,CAACC,cAAc,EAAEC,gBAAgB,CAAC,GAC7CF,aAAa,CAAqB,eAAe,CAAC;;AAEpD;AACA;AACA;AACA;AACA,OAAO,MAAM,CAACG,kBAAkB,EAAEC,oBAAoB,CAAC,GACrDJ,aAAa,CAA6B,mBAAmB,CAAC","ignoreList":[]}
|
|
@@ -1,34 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
import { createSelectTrigger } from './createSelectTrigger';
|
|
9
|
-
import { createSelectValue } from './createSelectValue';
|
|
10
|
-
export function createSelect(BaseComponents) {
|
|
11
|
-
const Select = createSelectRoot(BaseComponents.Root);
|
|
12
|
-
const Trigger = createSelectTrigger(BaseComponents.Trigger);
|
|
13
|
-
const Value = createSelectValue(BaseComponents.Value);
|
|
14
|
-
const Icon = createSelectIcon(BaseComponents.Icon);
|
|
15
|
-
const Content = createSelectContent(BaseComponents.Content);
|
|
16
|
-
const Item = createSelectItem(BaseComponents.Item);
|
|
17
|
-
const ItemLabel = createSelectItemLabel(BaseComponents.ItemLabel);
|
|
18
|
-
Select.displayName = 'SelectPrimitive';
|
|
19
|
-
Trigger.displayName = 'SelectPrimitive.Trigger';
|
|
20
|
-
Value.displayName = 'SelectPrimitive.Value';
|
|
21
|
-
Icon.displayName = 'SelectPrimitive.Icon';
|
|
22
|
-
Content.displayName = 'SelectPrimitive.Content';
|
|
23
|
-
Item.displayName = 'SelectPrimitive.Item';
|
|
24
|
-
ItemLabel.displayName = 'SelectPrimitive.ItemLabel';
|
|
25
|
-
return Object.assign(Select, {
|
|
26
|
-
Trigger,
|
|
27
|
-
Value,
|
|
28
|
-
Icon,
|
|
29
|
-
Content,
|
|
30
|
-
Item,
|
|
31
|
-
ItemLabel
|
|
32
|
-
});
|
|
33
|
-
}
|
|
3
|
+
export { useSelectContext, useSelectItemContext } from './context';
|
|
4
|
+
export { SelectRoot } from './SelectRoot';
|
|
5
|
+
export { SelectTrigger } from './SelectTrigger';
|
|
6
|
+
export { SelectContent } from './SelectContent';
|
|
7
|
+
export { SelectItem } from './SelectItem';
|
|
34
8
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["useSelectContext","useSelectItemContext","SelectRoot","SelectTrigger","SelectContent","SelectItem"],"sourceRoot":"../../../src","sources":["select/index.ts"],"mappings":";;AAYA,SAASA,gBAAgB,EAAEC,oBAAoB,QAAQ,WAAW;AAClE,SAASC,UAAU,QAA8B,cAAc;AAC/D,SAASC,aAAa,QAAiC,iBAAiB;AACxE,SAASC,aAAa,QAAiC,iBAAiB;AACxE,SAASC,UAAU,QAA8B,cAAc","ignoreList":[]}
|
|
@@ -10,7 +10,7 @@ import { Platform } from 'react-native';
|
|
|
10
10
|
* - Restores focus to the trigger when the overlay closes (web)
|
|
11
11
|
* - Initializes `activeValue` to the current value or first enabled item
|
|
12
12
|
*
|
|
13
|
-
* Initial focus on open is handled via a ref callback in
|
|
13
|
+
* Initial focus on open is handled via a ref callback in SelectContent
|
|
14
14
|
* to avoid timing issues with deferred portal rendering.
|
|
15
15
|
*/
|
|
16
16
|
export function useContentFocus({
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { useCallback, useLayoutEffect, useMemo, useRef, useState } from 'react';
|
|
4
|
+
import { composeEventHandlers, mergeRefs, useFormControlContext, useReportFormControlLabelFocus } from '@cdx-ui/utils';
|
|
5
|
+
import { useFocus, useFocusRing } from '@react-native-aria/focus';
|
|
6
|
+
import { useHover, usePress } from '@react-native-aria/interactions';
|
|
7
|
+
import { useSelectContext } from './context';
|
|
8
|
+
/**
|
|
9
|
+
* Shared logic for `Select.Trigger` across native and web. Each platform file is
|
|
10
|
+
* a thin host-element wrapper that spreads this hook's output. The hook composes
|
|
11
|
+
* interaction-state hooks, ARIA props, keyboard intent, press-to-toggle, the
|
|
12
|
+
* merged ref, and (where appropriate) the label-focus bridge.
|
|
13
|
+
*
|
|
14
|
+
* Native variant — Pressable is not natively labelable, so the label-focus
|
|
15
|
+
* bridge is always registered on `field.inputRef`.
|
|
16
|
+
*/
|
|
17
|
+
export function useSelectTrigger(forwardedRef, options) {
|
|
18
|
+
/**
|
|
19
|
+
* `asChild` is part of the symmetric options shape for parity with the web variant,
|
|
20
|
+
* but the native hook always mounts the label-focus bridge (Pressable is never
|
|
21
|
+
* natively labelable) and Slot/Pressable share the same Pressable-shaped surface,
|
|
22
|
+
* so the option is intentionally unused here.
|
|
23
|
+
*/
|
|
24
|
+
const {
|
|
25
|
+
isHovered: isHoveredProp,
|
|
26
|
+
isActive: isActiveProp,
|
|
27
|
+
isFocused: isFocusedProp,
|
|
28
|
+
isFocusVisible: isFocusVisibleProp,
|
|
29
|
+
isDisabled: isDisabledProp,
|
|
30
|
+
ariaDescribedBy: ariaDescribedByProp,
|
|
31
|
+
onPress: consumerOnPress,
|
|
32
|
+
onPressIn: consumerOnPressIn,
|
|
33
|
+
onPressOut: consumerOnPressOut,
|
|
34
|
+
onHoverIn: consumerOnHoverIn,
|
|
35
|
+
onHoverOut: consumerOnHoverOut,
|
|
36
|
+
onFocus: consumerOnFocus,
|
|
37
|
+
onBlur: consumerOnBlur,
|
|
38
|
+
onKeyDown: consumerOnKeyDown
|
|
39
|
+
} = options;
|
|
40
|
+
const {
|
|
41
|
+
open,
|
|
42
|
+
setOpen,
|
|
43
|
+
disabled: contextDisabled,
|
|
44
|
+
required: contextRequired,
|
|
45
|
+
invalid: contextInvalid,
|
|
46
|
+
readOnly: contextReadOnly,
|
|
47
|
+
triggerId,
|
|
48
|
+
contentId,
|
|
49
|
+
triggerRef,
|
|
50
|
+
activeValue,
|
|
51
|
+
accessibilityLabel,
|
|
52
|
+
ariaDescribedBy: ariaDescribedByFromField
|
|
53
|
+
} = useSelectContext();
|
|
54
|
+
const field = useFormControlContext();
|
|
55
|
+
const disabled = contextDisabled || !!isDisabledProp;
|
|
56
|
+
const {
|
|
57
|
+
isFocusVisible,
|
|
58
|
+
focusProps: focusRingProps
|
|
59
|
+
} = useFocusRing();
|
|
60
|
+
const {
|
|
61
|
+
pressProps,
|
|
62
|
+
isPressed: isActive
|
|
63
|
+
} = usePress({
|
|
64
|
+
isDisabled: disabled
|
|
65
|
+
});
|
|
66
|
+
const {
|
|
67
|
+
isFocused,
|
|
68
|
+
focusProps
|
|
69
|
+
} = useFocus();
|
|
70
|
+
const {
|
|
71
|
+
isHovered,
|
|
72
|
+
hoverProps
|
|
73
|
+
} = useHover();
|
|
74
|
+
const [triggerFocused, setTriggerFocused] = useState(false);
|
|
75
|
+
const handlePress = useCallback(_e => {
|
|
76
|
+
if (!disabled) {
|
|
77
|
+
setOpen(!open);
|
|
78
|
+
}
|
|
79
|
+
}, [disabled, open, setOpen]);
|
|
80
|
+
const handleKeyDown = useCallback(e => {
|
|
81
|
+
if (disabled) {
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
switch (e.key) {
|
|
85
|
+
case 'Enter':
|
|
86
|
+
case ' ':
|
|
87
|
+
case 'ArrowDown':
|
|
88
|
+
case 'ArrowUp':
|
|
89
|
+
{
|
|
90
|
+
e.preventDefault();
|
|
91
|
+
setOpen(true);
|
|
92
|
+
break;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}, [disabled, setOpen]);
|
|
96
|
+
|
|
97
|
+
/** `useFocus()` on Pressable can stay true on native after blur; use explicit focus/blur handlers. */
|
|
98
|
+
const isLabelActive = Boolean((open || triggerFocused) && !disabled);
|
|
99
|
+
useReportFormControlLabelFocus(isLabelActive);
|
|
100
|
+
useLayoutEffect(() => {
|
|
101
|
+
if (!open) {
|
|
102
|
+
setTriggerFocused(false);
|
|
103
|
+
}
|
|
104
|
+
}, [open]);
|
|
105
|
+
const interactionState = useMemo(() => ({
|
|
106
|
+
hover: !!(isHoveredProp || isHovered),
|
|
107
|
+
focus: !!(isFocusedProp || isFocused || open),
|
|
108
|
+
active: !!(isActiveProp || isActive),
|
|
109
|
+
disabled: !!disabled,
|
|
110
|
+
focusVisible: !!(isFocusVisibleProp || isFocusVisible)
|
|
111
|
+
}), [isHoveredProp, isHovered, isFocusedProp, isFocused, isActiveProp, isActive, disabled, isFocusVisibleProp, isFocusVisible, open]);
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Native: `Pressable` has no usable programmatic `.focus()` (unlike `TextInput`).
|
|
115
|
+
* `Form.Label` calls `focusInput()` → we register a bridge on `field.inputRef` that tries
|
|
116
|
+
* native focus, then opens the list (expected "tap label" behavior for a select).
|
|
117
|
+
*/
|
|
118
|
+
const labelFocusGateRef = useRef({
|
|
119
|
+
disabled: false,
|
|
120
|
+
readOnly: false
|
|
121
|
+
});
|
|
122
|
+
labelFocusGateRef.current = {
|
|
123
|
+
disabled: !!disabled,
|
|
124
|
+
readOnly: !!contextReadOnly
|
|
125
|
+
};
|
|
126
|
+
const labelFocusBridge = useMemo(() => ({
|
|
127
|
+
focus() {
|
|
128
|
+
const {
|
|
129
|
+
disabled: isOff,
|
|
130
|
+
readOnly: isRO
|
|
131
|
+
} = labelFocusGateRef.current;
|
|
132
|
+
if (isOff || isRO) {
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
const node = triggerRef.current;
|
|
136
|
+
if (node != null && typeof node.focus === 'function') {
|
|
137
|
+
node.focus();
|
|
138
|
+
}
|
|
139
|
+
setOpen(true);
|
|
140
|
+
}
|
|
141
|
+
}), [setOpen, triggerRef]);
|
|
142
|
+
useLayoutEffect(() => {
|
|
143
|
+
if (!field.inputRef) {
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
146
|
+
const r = field.inputRef;
|
|
147
|
+
r.current = labelFocusBridge;
|
|
148
|
+
return () => {
|
|
149
|
+
if (r.current === labelFocusBridge) {
|
|
150
|
+
r.current = null;
|
|
151
|
+
}
|
|
152
|
+
};
|
|
153
|
+
}, [field.inputRef, labelFocusBridge]);
|
|
154
|
+
const mergedRef = mergeRefs(forwardedRef, triggerRef);
|
|
155
|
+
const ariaDescribedBy = [ariaDescribedByFromField, ariaDescribedByProp].filter(Boolean).join(' ');
|
|
156
|
+
const ariaProps = {
|
|
157
|
+
role: 'combobox',
|
|
158
|
+
'aria-label': accessibilityLabel,
|
|
159
|
+
'aria-haspopup': 'listbox',
|
|
160
|
+
'aria-expanded': open,
|
|
161
|
+
'aria-controls': contentId,
|
|
162
|
+
'aria-activedescendant': open && activeValue ? `${contentId}-option-${activeValue}` : undefined,
|
|
163
|
+
'aria-required': contextRequired || undefined,
|
|
164
|
+
'aria-invalid': contextInvalid || undefined,
|
|
165
|
+
'aria-readonly': contextReadOnly || undefined,
|
|
166
|
+
'aria-describedby': ariaDescribedBy || undefined,
|
|
167
|
+
id: triggerId,
|
|
168
|
+
disabled
|
|
169
|
+
};
|
|
170
|
+
const dataAttrValues = {
|
|
171
|
+
hover: interactionState.hover,
|
|
172
|
+
focus: interactionState.focus,
|
|
173
|
+
active: interactionState.active,
|
|
174
|
+
disabled: interactionState.disabled,
|
|
175
|
+
focusVisible: interactionState.focusVisible,
|
|
176
|
+
required: !!contextRequired,
|
|
177
|
+
invalid: !!contextInvalid,
|
|
178
|
+
readonly: !!contextReadOnly,
|
|
179
|
+
state: open ? 'open' : 'closed'
|
|
180
|
+
};
|
|
181
|
+
const handlers = {
|
|
182
|
+
onPress: composeEventHandlers(consumerOnPress, handlePress),
|
|
183
|
+
onPressIn: composeEventHandlers(consumerOnPressIn, pressProps.onPressIn),
|
|
184
|
+
onPressOut: composeEventHandlers(consumerOnPressOut, pressProps.onPressOut),
|
|
185
|
+
onHoverIn: composeEventHandlers(consumerOnHoverIn, hoverProps.onHoverIn),
|
|
186
|
+
onHoverOut: composeEventHandlers(consumerOnHoverOut, hoverProps.onHoverOut),
|
|
187
|
+
onFocus: composeEventHandlers(composeEventHandlers(composeEventHandlers(consumerOnFocus, focusProps.onFocus), focusRingProps.onFocus), () => setTriggerFocused(true)),
|
|
188
|
+
onBlur: composeEventHandlers(composeEventHandlers(composeEventHandlers(consumerOnBlur, focusProps.onBlur), focusRingProps.onBlur), () => setTriggerFocused(false)),
|
|
189
|
+
onKeyDown: composeEventHandlers(consumerOnKeyDown, handleKeyDown)
|
|
190
|
+
};
|
|
191
|
+
return {
|
|
192
|
+
ariaProps,
|
|
193
|
+
dataAttrValues,
|
|
194
|
+
interactionState,
|
|
195
|
+
mergedRef,
|
|
196
|
+
handlers,
|
|
197
|
+
isLabelActive,
|
|
198
|
+
open,
|
|
199
|
+
labelFocusBridge
|
|
200
|
+
};
|
|
201
|
+
}
|
|
202
|
+
//# sourceMappingURL=useSelectTrigger.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useCallback","useLayoutEffect","useMemo","useRef","useState","composeEventHandlers","mergeRefs","useFormControlContext","useReportFormControlLabelFocus","useFocus","useFocusRing","useHover","usePress","useSelectContext","useSelectTrigger","forwardedRef","options","isHovered","isHoveredProp","isActive","isActiveProp","isFocused","isFocusedProp","isFocusVisible","isFocusVisibleProp","isDisabled","isDisabledProp","ariaDescribedBy","ariaDescribedByProp","onPress","consumerOnPress","onPressIn","consumerOnPressIn","onPressOut","consumerOnPressOut","onHoverIn","consumerOnHoverIn","onHoverOut","consumerOnHoverOut","onFocus","consumerOnFocus","onBlur","consumerOnBlur","onKeyDown","consumerOnKeyDown","open","setOpen","disabled","contextDisabled","required","contextRequired","invalid","contextInvalid","readOnly","contextReadOnly","triggerId","contentId","triggerRef","activeValue","accessibilityLabel","ariaDescribedByFromField","field","focusProps","focusRingProps","pressProps","isPressed","hoverProps","triggerFocused","setTriggerFocused","handlePress","_e","handleKeyDown","e","key","preventDefault","isLabelActive","Boolean","interactionState","hover","focus","active","focusVisible","labelFocusGateRef","current","labelFocusBridge","isOff","isRO","node","inputRef","r","mergedRef","filter","join","ariaProps","role","undefined","id","dataAttrValues","readonly","state","handlers"],"sourceRoot":"../../../src","sources":["select/useSelectTrigger.ts"],"mappings":";;AAAA,SACEA,WAAW,EACXC,eAAe,EACfC,OAAO,EACPC,MAAM,EACNC,QAAQ,QAGH,OAAO;AAEd,SACEC,oBAAoB,EACpBC,SAAS,EACTC,qBAAqB,EACrBC,8BAA8B,QAEzB,eAAe;AACtB,SAASC,QAAQ,EAAEC,YAAY,QAAQ,0BAA0B;AACjE,SAASC,QAAQ,EAAEC,QAAQ,QAAQ,iCAAiC;AAEpE,SAASC,gBAAgB,Q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ACzB,CAAC;EAED,MAAMuD,QAA+B,GAAG;IACtCvE,OAAO,EAAExB,oBAAoB,CAACyB,eAAe,EAAEuC,WAAW,CAAqC;IAC/FtC,SAAS,EAAE1B,oBAAoB,CAC7B2B,iBAAiB,EACjBgC,UAAU,CAACjC,SACb,CAAuC;IACvCE,UAAU,EAAE5B,oBAAoB,CAC9B6B,kBAAkB,EAClB8B,UAAU,CAAC/B,UACb,CAAwC;IACxCE,SAAS,EAAE9B,oBAAoB,CAC7B+B,iBAAiB,EACjB8B,UAAU,CAAC/B,SACb,CAAuC;IACvCE,UAAU,EAAEhC,oBAAoB,CAC9BiC,kBAAkB,EAClB4B,UAAU,CAAC7B,UACb,CAAwC;IACxCE,OAAO,EAAElC,oBAAoB,CAC3BA,oBAAoB,CAClBA,oBAAoB,CAACmC,eAAe,EAAEsB,UAAU,CAACvB,OAAO,CAAC,EACzDwB,cAAc,CAACxB,OACjB,CAAC,EACD,MAAM6B,iBAAiB,CAAC,IAAI,CAC9B,CAAC;IACD3B,MAAM,EAAEpC,oBAAoB,CAC1BA,oBAAoB,CAClBA,oBAAoB,CAACqC,cAAc,EAAEoB,UAAU,CAACrB,MAAM,CAAC,EACvDsB,cAAc,CAACtB,MACjB,CAAC,EACD,MAAM2B,iBAAiB,CAAC,KAAK,CAC/B,CAAC;IACDzB,SAAS,EAAEtC,oBAAoB,CAC7BuC,iBAAiB,EACjB2B,aACF;EACF,CAAC;EAED,OAAO;IACLsB,SAAS;IACTI,cAAc;IACdpB,gBAAgB;IAChBa,SAAS;IACTU,QAAQ;IACRzB,aAAa;IACb9B,IAAI;IACJuC;EACF,CAAC;AACH","ignoreList":[]}
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { useCallback, useLayoutEffect, useMemo, useRef, useState } from 'react';
|
|
4
|
+
import { composeEventHandlers, mergeRefs, useFormControlContext, useReportFormControlLabelFocus } from '@cdx-ui/utils';
|
|
5
|
+
import { useFocus } from '@react-native-aria/focus';
|
|
6
|
+
import { usePress } from '@react-native-aria/interactions';
|
|
7
|
+
import { useSelectContext } from './context';
|
|
8
|
+
/**
|
|
9
|
+
* Web variant — drops `useHover` and `useFocusRing` per the trigger-prune todo:
|
|
10
|
+
* neither emitted attribute has a consumer in `selectTriggerVariants`, and the
|
|
11
|
+
* web `useHover` re-renders on every pointer enter/leave. Hover is expressed via
|
|
12
|
+
* CSS `:hover` chains in CVA, not a JS tracker.
|
|
13
|
+
*
|
|
14
|
+
* The label-focus bridge is only registered when the host loses native
|
|
15
|
+
* label association — i.e. when `asChild` substitutes the rendered `<button>`
|
|
16
|
+
* with a non-labelable element. Otherwise `<label htmlFor>` handles the focus
|
|
17
|
+
* relationship natively.
|
|
18
|
+
*/
|
|
19
|
+
export function useSelectTrigger(forwardedRef, options) {
|
|
20
|
+
const {
|
|
21
|
+
asChild,
|
|
22
|
+
isHovered: isHoveredProp,
|
|
23
|
+
isActive: isActiveProp,
|
|
24
|
+
isFocused: isFocusedProp,
|
|
25
|
+
isFocusVisible: isFocusVisibleProp,
|
|
26
|
+
isDisabled: isDisabledProp,
|
|
27
|
+
ariaDescribedBy: ariaDescribedByProp,
|
|
28
|
+
onPress: consumerOnPress,
|
|
29
|
+
onPressIn: consumerOnPressIn,
|
|
30
|
+
onPressOut: consumerOnPressOut,
|
|
31
|
+
onHoverIn: consumerOnHoverIn,
|
|
32
|
+
onHoverOut: consumerOnHoverOut,
|
|
33
|
+
onFocus: consumerOnFocus,
|
|
34
|
+
onBlur: consumerOnBlur,
|
|
35
|
+
onKeyDown: consumerOnKeyDown
|
|
36
|
+
} = options;
|
|
37
|
+
const {
|
|
38
|
+
open,
|
|
39
|
+
setOpen,
|
|
40
|
+
disabled: contextDisabled,
|
|
41
|
+
required: contextRequired,
|
|
42
|
+
invalid: contextInvalid,
|
|
43
|
+
readOnly: contextReadOnly,
|
|
44
|
+
triggerId,
|
|
45
|
+
contentId,
|
|
46
|
+
triggerRef,
|
|
47
|
+
activeValue,
|
|
48
|
+
accessibilityLabel,
|
|
49
|
+
ariaDescribedBy: ariaDescribedByFromField
|
|
50
|
+
} = useSelectContext();
|
|
51
|
+
const field = useFormControlContext();
|
|
52
|
+
const disabled = contextDisabled || !!isDisabledProp;
|
|
53
|
+
const {
|
|
54
|
+
pressProps,
|
|
55
|
+
isPressed: isActive
|
|
56
|
+
} = usePress({
|
|
57
|
+
isDisabled: disabled
|
|
58
|
+
});
|
|
59
|
+
const {
|
|
60
|
+
isFocused,
|
|
61
|
+
focusProps
|
|
62
|
+
} = useFocus();
|
|
63
|
+
const [triggerFocused, setTriggerFocused] = useState(false);
|
|
64
|
+
const handlePress = useCallback(_e => {
|
|
65
|
+
if (!disabled) {
|
|
66
|
+
setOpen(!open);
|
|
67
|
+
}
|
|
68
|
+
}, [disabled, open, setOpen]);
|
|
69
|
+
const handleKeyDown = useCallback(e => {
|
|
70
|
+
if (disabled) {
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
switch (e.key) {
|
|
74
|
+
case 'Enter':
|
|
75
|
+
case ' ':
|
|
76
|
+
case 'ArrowDown':
|
|
77
|
+
case 'ArrowUp':
|
|
78
|
+
{
|
|
79
|
+
e.preventDefault();
|
|
80
|
+
setOpen(true);
|
|
81
|
+
break;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}, [disabled, setOpen]);
|
|
85
|
+
const isLabelActive = Boolean((isFocusedProp || isFocused || triggerFocused || open) && !disabled);
|
|
86
|
+
useReportFormControlLabelFocus(isLabelActive);
|
|
87
|
+
useLayoutEffect(() => {
|
|
88
|
+
if (!open) {
|
|
89
|
+
setTriggerFocused(false);
|
|
90
|
+
}
|
|
91
|
+
}, [open]);
|
|
92
|
+
const interactionState = useMemo(() => ({
|
|
93
|
+
hover: !!isHoveredProp,
|
|
94
|
+
focus: !!(isFocusedProp || isFocused || open),
|
|
95
|
+
active: !!(isActiveProp || isActive),
|
|
96
|
+
disabled: !!disabled,
|
|
97
|
+
focusVisible: !!isFocusVisibleProp
|
|
98
|
+
}), [isHoveredProp, isFocusedProp, isFocused, isActiveProp, isActive, disabled, isFocusVisibleProp, open]);
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* `<button>` is HTML-labelable so `<label htmlFor>` works natively — no JS bridge needed.
|
|
102
|
+
* When `asChild` substitutes the host with a non-labelable element (e.g. `<div role="button">`),
|
|
103
|
+
* the bridge fills the gap so `Form.Label` can still focus the trigger via `field.inputRef`.
|
|
104
|
+
*/
|
|
105
|
+
const labelFocusGateRef = useRef({
|
|
106
|
+
disabled: false,
|
|
107
|
+
readOnly: false
|
|
108
|
+
});
|
|
109
|
+
labelFocusGateRef.current = {
|
|
110
|
+
disabled: !!disabled,
|
|
111
|
+
readOnly: !!contextReadOnly
|
|
112
|
+
};
|
|
113
|
+
const labelFocusBridge = useMemo(() => ({
|
|
114
|
+
focus() {
|
|
115
|
+
const {
|
|
116
|
+
disabled: isOff,
|
|
117
|
+
readOnly: isRO
|
|
118
|
+
} = labelFocusGateRef.current;
|
|
119
|
+
if (isOff || isRO) {
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
const node = triggerRef.current;
|
|
123
|
+
if (node != null && typeof node.focus === 'function') {
|
|
124
|
+
node.focus();
|
|
125
|
+
}
|
|
126
|
+
setOpen(true);
|
|
127
|
+
}
|
|
128
|
+
}), [setOpen, triggerRef]);
|
|
129
|
+
const shouldMountLabelFocusBridge = !!asChild;
|
|
130
|
+
useLayoutEffect(() => {
|
|
131
|
+
if (!shouldMountLabelFocusBridge || !field.inputRef) {
|
|
132
|
+
return;
|
|
133
|
+
}
|
|
134
|
+
const r = field.inputRef;
|
|
135
|
+
r.current = labelFocusBridge;
|
|
136
|
+
return () => {
|
|
137
|
+
if (r.current === labelFocusBridge) {
|
|
138
|
+
r.current = null;
|
|
139
|
+
}
|
|
140
|
+
};
|
|
141
|
+
}, [shouldMountLabelFocusBridge, field.inputRef, labelFocusBridge]);
|
|
142
|
+
const mergedRef = mergeRefs(forwardedRef, triggerRef);
|
|
143
|
+
const ariaDescribedBy = [ariaDescribedByFromField, ariaDescribedByProp].filter(Boolean).join(' ');
|
|
144
|
+
const ariaProps = {
|
|
145
|
+
role: 'combobox',
|
|
146
|
+
'aria-label': accessibilityLabel,
|
|
147
|
+
'aria-haspopup': 'listbox',
|
|
148
|
+
'aria-expanded': open,
|
|
149
|
+
'aria-controls': contentId,
|
|
150
|
+
'aria-activedescendant': open && activeValue ? `${contentId}-option-${activeValue}` : undefined,
|
|
151
|
+
'aria-required': contextRequired || undefined,
|
|
152
|
+
'aria-invalid': contextInvalid || undefined,
|
|
153
|
+
'aria-readonly': contextReadOnly || undefined,
|
|
154
|
+
'aria-describedby': ariaDescribedBy || undefined,
|
|
155
|
+
id: triggerId,
|
|
156
|
+
disabled
|
|
157
|
+
};
|
|
158
|
+
const dataAttrValues = {
|
|
159
|
+
focus: interactionState.focus,
|
|
160
|
+
active: interactionState.active,
|
|
161
|
+
disabled: interactionState.disabled,
|
|
162
|
+
required: !!contextRequired,
|
|
163
|
+
invalid: !!contextInvalid,
|
|
164
|
+
readonly: !!contextReadOnly,
|
|
165
|
+
state: open ? 'open' : 'closed'
|
|
166
|
+
};
|
|
167
|
+
const handlers = {
|
|
168
|
+
onPress: composeEventHandlers(consumerOnPress, handlePress),
|
|
169
|
+
onPressIn: composeEventHandlers(consumerOnPressIn, pressProps.onPressIn),
|
|
170
|
+
onPressOut: composeEventHandlers(consumerOnPressOut, pressProps.onPressOut),
|
|
171
|
+
onHoverIn: consumerOnHoverIn ?? (() => undefined),
|
|
172
|
+
onHoverOut: consumerOnHoverOut ?? (() => undefined),
|
|
173
|
+
onFocus: composeEventHandlers(composeEventHandlers(consumerOnFocus, focusProps.onFocus), () => setTriggerFocused(true)),
|
|
174
|
+
onBlur: composeEventHandlers(composeEventHandlers(consumerOnBlur, focusProps.onBlur), () => setTriggerFocused(false)),
|
|
175
|
+
onKeyDown: composeEventHandlers(consumerOnKeyDown, handleKeyDown)
|
|
176
|
+
};
|
|
177
|
+
return {
|
|
178
|
+
ariaProps,
|
|
179
|
+
dataAttrValues,
|
|
180
|
+
interactionState,
|
|
181
|
+
mergedRef,
|
|
182
|
+
handlers,
|
|
183
|
+
isLabelActive,
|
|
184
|
+
open,
|
|
185
|
+
labelFocusBridge
|
|
186
|
+
};
|
|
187
|
+
}
|
|
188
|
+
//# sourceMappingURL=useSelectTrigger.web.js.map
|