@accelint/design-system 0.2.0 → 0.3.0
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/dist/chunk-4CPMP3H7.js +418 -0
- package/dist/chunk-4CPMP3H7.js.map +1 -0
- package/dist/{styles.css → index.css} +885 -779
- package/dist/index.css.map +1 -0
- package/dist/index.d.ts +871 -8
- package/dist/index.js +5278 -66
- package/dist/index.js.map +1 -1
- package/dist/vanilla-DUNpoS8t.d.ts +2514 -0
- package/dist/vanilla.d.ts +9 -30
- package/dist/vanilla.js +3 -27
- package/dist/vanilla.js.map +1 -0
- package/package.json +13 -19
- package/dist/assets/components/button/button.css +0 -55
- package/dist/assets/components/checkbox/checkbox.css +0 -73
- package/dist/assets/components/chip/chip.css +0 -62
- package/dist/assets/components/combo-box/combo-box.css +0 -66
- package/dist/assets/components/dialog/dialog.css +0 -51
- package/dist/assets/components/drawer/drawer.css +0 -135
- package/dist/assets/components/group/group.css +0 -33
- package/dist/assets/components/icon/icon.css +0 -19
- package/dist/assets/components/input/input.css +0 -29
- package/dist/assets/components/menu/menu.css +0 -85
- package/dist/assets/components/options/options.css +0 -82
- package/dist/assets/components/picker/picker.css +0 -47
- package/dist/assets/components/popover/popover.css +0 -26
- package/dist/assets/components/query-builder/query-builder.css +0 -129
- package/dist/assets/components/radio/radio.css +0 -67
- package/dist/assets/components/search-field/search-field.css +0 -62
- package/dist/assets/components/select/select.css +0 -33
- package/dist/assets/components/switch/switch.css +0 -62
- package/dist/assets/components/tabs/tabs.css +0 -144
- package/dist/assets/components/textarea/textarea.css +0 -32
- package/dist/assets/components/tooltip/tooltip.css +0 -54
- package/dist/assets/components/tree/tree.css +0 -157
- package/dist/assets/hooks/use-theme/use-theme.css +0 -6
- package/dist/assets/src/components/button/button.css.ts.vanilla-9uttMYGm.css +0 -55
- package/dist/assets/src/components/checkbox/checkbox.css.ts.vanilla-Bewmypyn.css +0 -73
- package/dist/assets/src/components/chip/chip.css.ts.vanilla-CsGhxrlu.css +0 -62
- package/dist/assets/src/components/combo-box/combo-box.css.ts.vanilla-BNEPKjPm.css +0 -66
- package/dist/assets/src/components/dialog/dialog.css.ts.vanilla-CG0m-NJD.css +0 -51
- package/dist/assets/src/components/drawer/drawer.css.ts.vanilla-DEfHnoNS.css +0 -135
- package/dist/assets/src/components/group/group.css.ts.vanilla-DR69xgQy.css +0 -33
- package/dist/assets/src/components/icon/icon.css.ts.vanilla-CoUAfp2F.css +0 -19
- package/dist/assets/src/components/input/input.css.ts.vanilla-DoK5h9SX.css +0 -29
- package/dist/assets/src/components/menu/menu.css.ts.vanilla-LoWLg-jE.css +0 -85
- package/dist/assets/src/components/options/options.css.ts.vanilla-CWWFBTou.css +0 -82
- package/dist/assets/src/components/picker/picker.css.ts.vanilla-Fe0YXv-c.css +0 -47
- package/dist/assets/src/components/popover/popover.css.ts.vanilla-C5YGwwVD.css +0 -26
- package/dist/assets/src/components/query-builder/query-builder.css.ts.vanilla-B3P9cbCv.css +0 -129
- package/dist/assets/src/components/radio/radio.css.ts.vanilla-gi-KedQc.css +0 -67
- package/dist/assets/src/components/search-field/search-field.css.ts.vanilla-B_JL53f8.css +0 -62
- package/dist/assets/src/components/select/select.css.ts.vanilla-C94A60jf.css +0 -33
- package/dist/assets/src/components/switch/switch.css.ts.vanilla-DkQwtRa6.css +0 -62
- package/dist/assets/src/components/tabs/tabs.css.ts.vanilla-BygIflpl.css +0 -144
- package/dist/assets/src/components/textarea/textarea.css.ts.vanilla-Ba6E5HFc.css +0 -32
- package/dist/assets/src/components/tooltip/tooltip.css.ts.vanilla-BntxAlwN.css +0 -54
- package/dist/assets/src/components/tree/tree.css.ts.vanilla-SLmhk0zZ.css +0 -157
- package/dist/assets/src/hooks/use-theme/use-theme.css.ts.vanilla-zkVHnGkP.css +0 -6
- package/dist/assets/src/styles/layers.css.ts.vanilla-B2GUgnOF.css +0 -21
- package/dist/assets/src/styles/reset.css.ts.vanilla-C8PShXm0.css +0 -31
- package/dist/assets/src/styles/space.css.ts.vanilla-Md6Whc4G.css +0 -18
- package/dist/assets/src/styles/surfaces.css.ts.vanilla-Ckztx7VT.css +0 -24
- package/dist/assets/src/styles/theme.css.ts.vanilla-aDPSIzBK.css +0 -208
- package/dist/assets/src/styles/typography.css.ts.vanilla-DRT9H7rd.css +0 -150
- package/dist/assets/styles/layers.css +0 -21
- package/dist/assets/styles/reset.css +0 -31
- package/dist/assets/styles/space.css +0 -18
- package/dist/assets/styles/surfaces.css +0 -24
- package/dist/assets/styles/theme.css +0 -208
- package/dist/assets/styles/typography.css +0 -150
- package/dist/components/aria/aria.d.ts +0 -19
- package/dist/components/aria/aria.js +0 -36
- package/dist/components/aria/aria.js.map +0 -1
- package/dist/components/aria/index.d.ts +0 -1
- package/dist/components/button/button.css.d.ts +0 -33
- package/dist/components/button/button.d.ts +0 -39
- package/dist/components/button/button.js +0 -71
- package/dist/components/button/button.js.map +0 -1
- package/dist/components/button/button.vanilla.js +0 -8
- package/dist/components/button/button.vanilla.js.map +0 -1
- package/dist/components/button/index.d.ts +0 -3
- package/dist/components/button/types.d.ts +0 -28
- package/dist/components/checkbox/checkbox.css.d.ts +0 -35
- package/dist/components/checkbox/checkbox.d.ts +0 -21
- package/dist/components/checkbox/checkbox.js +0 -68
- package/dist/components/checkbox/checkbox.js.map +0 -1
- package/dist/components/checkbox/checkbox.vanilla.js +0 -9
- package/dist/components/checkbox/checkbox.vanilla.js.map +0 -1
- package/dist/components/checkbox/index.d.ts +0 -3
- package/dist/components/checkbox/types.d.ts +0 -38
- package/dist/components/chip/chip.css.d.ts +0 -31
- package/dist/components/chip/chip.d.ts +0 -30
- package/dist/components/chip/chip.js +0 -106
- package/dist/components/chip/chip.js.map +0 -1
- package/dist/components/chip/chip.vanilla.js +0 -8
- package/dist/components/chip/chip.vanilla.js.map +0 -1
- package/dist/components/chip/index.d.ts +0 -3
- package/dist/components/chip/types.d.ts +0 -31
- package/dist/components/collection/collection.d.ts +0 -13
- package/dist/components/collection/collection.js +0 -15
- package/dist/components/collection/collection.js.map +0 -1
- package/dist/components/collection/index.d.ts +0 -1
- package/dist/components/combo-box/combo-box.css.d.ts +0 -22
- package/dist/components/combo-box/combo-box.d.ts +0 -8
- package/dist/components/combo-box/combo-box.js +0 -87
- package/dist/components/combo-box/combo-box.js.map +0 -1
- package/dist/components/combo-box/combo-box.vanilla.js +0 -8
- package/dist/components/combo-box/combo-box.vanilla.js.map +0 -1
- package/dist/components/combo-box/index.d.ts +0 -3
- package/dist/components/combo-box/types.d.ts +0 -32
- package/dist/components/dialog/dialog.css.d.ts +0 -34
- package/dist/components/dialog/dialog.d.ts +0 -18
- package/dist/components/dialog/dialog.js +0 -146
- package/dist/components/dialog/dialog.js.map +0 -1
- package/dist/components/dialog/dialog.vanilla.js +0 -8
- package/dist/components/dialog/dialog.vanilla.js.map +0 -1
- package/dist/components/dialog/index.d.ts +0 -3
- package/dist/components/dialog/types.d.ts +0 -48
- package/dist/components/drawer/drawer.css.d.ts +0 -33
- package/dist/components/drawer/drawer.d.ts +0 -13
- package/dist/components/drawer/drawer.js +0 -199
- package/dist/components/drawer/drawer.js.map +0 -1
- package/dist/components/drawer/drawer.vanilla.js +0 -10
- package/dist/components/drawer/drawer.vanilla.js.map +0 -1
- package/dist/components/drawer/index.d.ts +0 -3
- package/dist/components/drawer/types.d.ts +0 -71
- package/dist/components/element/element.d.ts +0 -11
- package/dist/components/element/element.js +0 -21
- package/dist/components/element/element.js.map +0 -1
- package/dist/components/element/index.d.ts +0 -2
- package/dist/components/element/types.d.ts +0 -21
- package/dist/components/group/group.css.d.ts +0 -14
- package/dist/components/group/group.d.ts +0 -10
- package/dist/components/group/group.js +0 -44
- package/dist/components/group/group.js.map +0 -1
- package/dist/components/group/group.vanilla.js +0 -7
- package/dist/components/group/group.vanilla.js.map +0 -1
- package/dist/components/group/index.d.ts +0 -3
- package/dist/components/group/types.d.ts +0 -35
- package/dist/components/icon/icon.css.d.ts +0 -18
- package/dist/components/icon/icon.d.ts +0 -12
- package/dist/components/icon/icon.js +0 -26
- package/dist/components/icon/icon.js.map +0 -1
- package/dist/components/icon/icon.vanilla.js +0 -8
- package/dist/components/icon/icon.vanilla.js.map +0 -1
- package/dist/components/icon/index.d.ts +0 -3
- package/dist/components/icon/types.d.ts +0 -13
- package/dist/components/index.d.ts +0 -26
- package/dist/components/input/index.d.ts +0 -3
- package/dist/components/input/input.css.d.ts +0 -29
- package/dist/components/input/input.d.ts +0 -8
- package/dist/components/input/input.js +0 -93
- package/dist/components/input/input.js.map +0 -1
- package/dist/components/input/input.vanilla.js +0 -8
- package/dist/components/input/input.vanilla.js.map +0 -1
- package/dist/components/input/types.d.ts +0 -44
- package/dist/components/menu/index.d.ts +0 -3
- package/dist/components/menu/menu.css.d.ts +0 -75
- package/dist/components/menu/menu.d.ts +0 -24
- package/dist/components/menu/menu.js +0 -155
- package/dist/components/menu/menu.js.map +0 -1
- package/dist/components/menu/menu.vanilla.js +0 -8
- package/dist/components/menu/menu.vanilla.js.map +0 -1
- package/dist/components/menu/types.d.ts +0 -48
- package/dist/components/merge-provider/index.d.ts +0 -2
- package/dist/components/merge-provider/merge-provider.d.ts +0 -14
- package/dist/components/merge-provider/merge-provider.js +0 -40
- package/dist/components/merge-provider/merge-provider.js.map +0 -1
- package/dist/components/merge-provider/types.d.ts +0 -5
- package/dist/components/options/index.d.ts +0 -3
- package/dist/components/options/options.css.d.ts +0 -79
- package/dist/components/options/options.d.ts +0 -20
- package/dist/components/options/options.js +0 -152
- package/dist/components/options/options.js.map +0 -1
- package/dist/components/options/options.vanilla.js +0 -10
- package/dist/components/options/options.vanilla.js.map +0 -1
- package/dist/components/options/types.d.ts +0 -49
- package/dist/components/picker/index.d.ts +0 -3
- package/dist/components/picker/picker.css.d.ts +0 -32
- package/dist/components/picker/picker.d.ts +0 -18
- package/dist/components/picker/picker.js +0 -46
- package/dist/components/picker/picker.js.map +0 -1
- package/dist/components/picker/picker.stories.css.d.ts +0 -3
- package/dist/components/picker/picker.vanilla.js +0 -9
- package/dist/components/picker/picker.vanilla.js.map +0 -1
- package/dist/components/picker/types.d.ts +0 -28
- package/dist/components/popover/index.d.ts +0 -3
- package/dist/components/popover/popover.css.d.ts +0 -31
- package/dist/components/popover/popover.d.ts +0 -8
- package/dist/components/popover/popover.js +0 -110
- package/dist/components/popover/popover.js.map +0 -1
- package/dist/components/popover/popover.vanilla.js +0 -7
- package/dist/components/popover/popover.vanilla.js.map +0 -1
- package/dist/components/popover/types.d.ts +0 -32
- package/dist/components/query-builder/action-element.d.ts +0 -2
- package/dist/components/query-builder/action-element.js +0 -12
- package/dist/components/query-builder/action-element.js.map +0 -1
- package/dist/components/query-builder/constants.d.ts +0 -4
- package/dist/components/query-builder/constants.js +0 -20
- package/dist/components/query-builder/constants.js.map +0 -1
- package/dist/components/query-builder/dataset-sample.d.ts +0 -91
- package/dist/components/query-builder/group.d.ts +0 -5
- package/dist/components/query-builder/group.js +0 -87
- package/dist/components/query-builder/group.js.map +0 -1
- package/dist/components/query-builder/index.d.ts +0 -5
- package/dist/components/query-builder/query-builder.css.d.ts +0 -91
- package/dist/components/query-builder/query-builder.d.ts +0 -2
- package/dist/components/query-builder/query-builder.js +0 -129
- package/dist/components/query-builder/query-builder.js.map +0 -1
- package/dist/components/query-builder/query-builder.vanilla.js +0 -10
- package/dist/components/query-builder/query-builder.vanilla.js.map +0 -1
- package/dist/components/query-builder/rule.d.ts +0 -3
- package/dist/components/query-builder/rule.js +0 -112
- package/dist/components/query-builder/rule.js.map +0 -1
- package/dist/components/query-builder/types.d.ts +0 -128
- package/dist/components/query-builder/utils.d.ts +0 -29
- package/dist/components/query-builder/utils.js +0 -22
- package/dist/components/query-builder/utils.js.map +0 -1
- package/dist/components/query-builder/value-editor.d.ts +0 -4
- package/dist/components/query-builder/value-editor.js +0 -74
- package/dist/components/query-builder/value-editor.js.map +0 -1
- package/dist/components/query-builder/value-selector.d.ts +0 -2
- package/dist/components/query-builder/value-selector.js +0 -28
- package/dist/components/query-builder/value-selector.js.map +0 -1
- package/dist/components/radio/index.d.ts +0 -3
- package/dist/components/radio/radio.css.d.ts +0 -34
- package/dist/components/radio/radio.d.ts +0 -16
- package/dist/components/radio/radio.js +0 -63
- package/dist/components/radio/radio.js.map +0 -1
- package/dist/components/radio/radio.vanilla.js +0 -8
- package/dist/components/radio/radio.vanilla.js.map +0 -1
- package/dist/components/radio/types.d.ts +0 -29
- package/dist/components/search-field/index.d.ts +0 -3
- package/dist/components/search-field/search-field.css.d.ts +0 -16
- package/dist/components/search-field/search-field.d.ts +0 -9
- package/dist/components/search-field/search-field.js +0 -60
- package/dist/components/search-field/search-field.js.map +0 -1
- package/dist/components/search-field/search-field.vanilla.js +0 -7
- package/dist/components/search-field/search-field.vanilla.js.map +0 -1
- package/dist/components/search-field/types.d.ts +0 -29
- package/dist/components/select/index.d.ts +0 -3
- package/dist/components/select/select.css.d.ts +0 -25
- package/dist/components/select/select.d.ts +0 -8
- package/dist/components/select/select.js +0 -80
- package/dist/components/select/select.js.map +0 -1
- package/dist/components/select/select.vanilla.js +0 -8
- package/dist/components/select/select.vanilla.js.map +0 -1
- package/dist/components/select/types.d.ts +0 -30
- package/dist/components/switch/index.d.ts +0 -3
- package/dist/components/switch/switch.css.d.ts +0 -25
- package/dist/components/switch/switch.d.ts +0 -4
- package/dist/components/switch/switch.js +0 -34
- package/dist/components/switch/switch.js.map +0 -1
- package/dist/components/switch/switch.vanilla.js +0 -8
- package/dist/components/switch/switch.vanilla.js.map +0 -1
- package/dist/components/switch/types.d.ts +0 -17
- package/dist/components/tabs/index.d.ts +0 -3
- package/dist/components/tabs/tabs.css.d.ts +0 -49
- package/dist/components/tabs/tabs.d.ts +0 -68
- package/dist/components/tabs/tabs.js +0 -108
- package/dist/components/tabs/tabs.js.map +0 -1
- package/dist/components/tabs/tabs.vanilla.js +0 -11
- package/dist/components/tabs/tabs.vanilla.js.map +0 -1
- package/dist/components/tabs/types.d.ts +0 -82
- package/dist/components/textarea/index.d.ts +0 -3
- package/dist/components/textarea/textarea.css.d.ts +0 -31
- package/dist/components/textarea/textarea.d.ts +0 -14
- package/dist/components/textarea/textarea.js +0 -86
- package/dist/components/textarea/textarea.js.map +0 -1
- package/dist/components/textarea/textarea.vanilla.js +0 -8
- package/dist/components/textarea/textarea.vanilla.js.map +0 -1
- package/dist/components/textarea/types.d.ts +0 -39
- package/dist/components/tooltip/index.d.ts +0 -3
- package/dist/components/tooltip/tooltip.css.d.ts +0 -23
- package/dist/components/tooltip/tooltip.d.ts +0 -23
- package/dist/components/tooltip/tooltip.js +0 -69
- package/dist/components/tooltip/tooltip.js.map +0 -1
- package/dist/components/tooltip/tooltip.vanilla.js +0 -8
- package/dist/components/tooltip/tooltip.vanilla.js.map +0 -1
- package/dist/components/tooltip/types.d.ts +0 -39
- package/dist/components/tree/index.d.ts +0 -3
- package/dist/components/tree/tree.css.d.ts +0 -73
- package/dist/components/tree/tree.d.ts +0 -5
- package/dist/components/tree/tree.js +0 -337
- package/dist/components/tree/tree.js.map +0 -1
- package/dist/components/tree/tree.vanilla.js +0 -11
- package/dist/components/tree/tree.vanilla.js.map +0 -1
- package/dist/components/tree/types.d.ts +0 -114
- package/dist/components/tree/utils.d.ts +0 -8
- package/dist/components/tree/utils.js +0 -75
- package/dist/components/tree/utils.js.map +0 -1
- package/dist/hooks/index.d.ts +0 -8
- package/dist/hooks/use-collection-render/index.d.ts +0 -1
- package/dist/hooks/use-collection-render/use-collection-render.d.ts +0 -9
- package/dist/hooks/use-collection-render/use-collection-render.js +0 -20
- package/dist/hooks/use-collection-render/use-collection-render.js.map +0 -1
- package/dist/hooks/use-context-props/index.d.ts +0 -1
- package/dist/hooks/use-context-props/use-context-props.d.ts +0 -7
- package/dist/hooks/use-context-props/use-context-props.js +0 -15
- package/dist/hooks/use-context-props/use-context-props.js.map +0 -1
- package/dist/hooks/use-defaults/index.d.ts +0 -2
- package/dist/hooks/use-defaults/types.d.ts +0 -67
- package/dist/hooks/use-defaults/use-defaults.d.ts +0 -56
- package/dist/hooks/use-defaults/use-defaults.js +0 -21
- package/dist/hooks/use-defaults/use-defaults.js.map +0 -1
- package/dist/hooks/use-propagating-press/index.d.ts +0 -1
- package/dist/hooks/use-propagating-press/use-propagating-press.d.ts +0 -9
- package/dist/hooks/use-propagating-press/use-propagating-press.js +0 -14
- package/dist/hooks/use-propagating-press/use-propagating-press.js.map +0 -1
- package/dist/hooks/use-slot/index.d.ts +0 -1
- package/dist/hooks/use-slot/use-slot.d.ts +0 -13
- package/dist/hooks/use-slot/use-slot.js +0 -18
- package/dist/hooks/use-slot/use-slot.js.map +0 -1
- package/dist/hooks/use-theme/index.d.ts +0 -2
- package/dist/hooks/use-theme/types.d.ts +0 -86
- package/dist/hooks/use-theme/use-theme.css.d.ts +0 -1
- package/dist/hooks/use-theme/use-theme.d.ts +0 -13
- package/dist/hooks/use-theme/use-theme.js +0 -64
- package/dist/hooks/use-theme/use-theme.js.map +0 -1
- package/dist/hooks/use-theme/use-theme.vanilla.js +0 -4
- package/dist/hooks/use-theme/use-theme.vanilla.js.map +0 -1
- package/dist/hooks/use-tree/index.d.ts +0 -1
- package/dist/hooks/use-tree/use-tree.d.ts +0 -2
- package/dist/hooks/use-tree/use-tree.js +0 -217
- package/dist/hooks/use-tree/use-tree.js.map +0 -1
- package/dist/hooks/use-tree/utils.d.ts +0 -6
- package/dist/hooks/use-tree/utils.js +0 -77
- package/dist/hooks/use-tree/utils.js.map +0 -1
- package/dist/hooks/use-update-effect/index.d.ts +0 -1
- package/dist/hooks/use-update-effect/use-update-effect.d.ts +0 -1
- package/dist/hooks/use-update-effect/use-update-effect.js +0 -20
- package/dist/hooks/use-update-effect/use-update-effect.js.map +0 -1
- package/dist/ladle/actions.d.ts +0 -1
- package/dist/ladle/index.d.ts +0 -1
- package/dist/styles/index.d.ts +0 -6
- package/dist/styles/layers.css.d.ts +0 -16
- package/dist/styles/layers.vanilla.js +0 -4
- package/dist/styles/layers.vanilla.js.map +0 -1
- package/dist/styles/reset.css.d.ts +0 -1
- package/dist/styles/space.css.d.ts +0 -1
- package/dist/styles/surfaces.css.d.ts +0 -4
- package/dist/styles/surfaces.vanilla.js +0 -4
- package/dist/styles/surfaces.vanilla.js.map +0 -1
- package/dist/styles/theme.css.d.ts +0 -334
- package/dist/styles/theme.vanilla.js +0 -31
- package/dist/styles/theme.vanilla.js.map +0 -1
- package/dist/styles/typography.css.d.ts +0 -17
- package/dist/styles/typography.vanilla.js +0 -8
- package/dist/styles/typography.vanilla.js.map +0 -1
- package/dist/test/setup.d.ts +0 -1
- package/dist/types/deckgl.d.ts +0 -1
- package/dist/types/generic.d.ts +0 -3
- package/dist/types/index.d.ts +0 -6
- package/dist/types/props.d.ts +0 -4
- package/dist/types/react-aria.d.ts +0 -91
- package/dist/types/use-tree.d.ts +0 -52
- package/dist/types/vanilla-extract.d.ts +0 -15
- package/dist/utils/css.d.ts +0 -139
- package/dist/utils/css.js +0 -145
- package/dist/utils/css.js.map +0 -1
- package/dist/utils/events.d.ts +0 -10
- package/dist/utils/events.js +0 -5
- package/dist/utils/events.js.map +0 -1
- package/dist/utils/index.d.ts +0 -4
- package/dist/utils/props.d.ts +0 -29
- package/dist/utils/props.js +0 -108
- package/dist/utils/props.js.map +0 -1
- package/dist/utils/validators.d.ts +0 -49
- package/dist/utils/validators.js +0 -37
- package/dist/utils/validators.js.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"value-editor.js","sources":["../../../src/components/query-builder/value-editor.tsx"],"sourcesContent":["import {\n type ChangeEvent,\n type FormEvent,\n useCallback,\n useContext,\n} from 'react';\nimport { useValueEditor, type ValueEditorProps } from 'react-querybuilder';\nimport { Checkbox } from '../checkbox';\nimport { Input, type InputType } from '../input';\nimport { Radio, RadioGroup } from '../radio';\nimport { Switch } from '../switch';\nimport { TextArea } from '../textarea';\nimport { multiValueOperators, QueryBuilderContext } from './constants';\nimport type { QueryBuilderValueEditors } from './types';\nimport { getValidationResult } from './utils';\nimport { ValueSelector } from './value-selector';\n\nfunction CheckboxValueEditor({\n disabled,\n fieldData: { name, validator },\n handleOnChange,\n rule,\n value,\n}: ValueEditorProps) {\n const { icons } = useContext(QueryBuilderContext);\n const { valid } = getValidationResult(rule, validator);\n\n return (\n <Checkbox\n isDisabled={disabled}\n isSelected={value}\n onChange={handleOnChange}\n aria-invalid={!valid}\n aria-label={name}\n >\n {icons?.checkbox}\n </Checkbox>\n );\n}\n\nfunction RadioGroupValueEditor({\n disabled,\n fieldData: { name, validator },\n handleOnChange,\n rule,\n value,\n values,\n}: ValueEditorProps) {\n const { valid } = getValidationResult(rule, validator);\n\n return (\n <RadioGroup\n value={value}\n isDisabled={disabled}\n onChange={handleOnChange}\n aria-invalid={!valid}\n aria-label={name}\n >\n {values?.map((option) => (\n <Radio key={option.name} value={option.value}>\n {option.label}\n </Radio>\n ))}\n </RadioGroup>\n );\n}\n\nconst defaultOptions: unknown[] = [];\n\nfunction SelectValueEditor({\n disabled,\n fieldData: { name, validator },\n handleOnChange,\n rule,\n type,\n value,\n values = defaultOptions,\n ...rest\n}: ValueEditorProps) {\n const { valid } = getValidationResult(rule, validator);\n\n return (\n <ValueSelector\n {...rest}\n disabled={disabled}\n multiple={type === 'multiselect'}\n options={values}\n title={name}\n validation={!valid}\n value={value}\n handleOnChange={handleOnChange}\n />\n );\n}\n\nfunction SwitchValueEditor({\n disabled,\n fieldData: { name, validator },\n handleOnChange,\n rule,\n value,\n}: ValueEditorProps) {\n const { valid } = getValidationResult(rule, validator);\n\n return (\n <Switch\n isDisabled={disabled}\n isSelected={Boolean(value)}\n onChange={handleOnChange}\n aria-invalid={!valid}\n aria-label={name}\n />\n );\n}\n\nfunction TextValueEditor({\n disabled,\n fieldData: { name, placeholder, validator },\n handleOnChange,\n inputType,\n rule,\n value,\n}: ValueEditorProps) {\n const { valid } = getValidationResult(rule, validator);\n\n const handleChange = useCallback(\n (event: ChangeEvent<HTMLInputElement>) =>\n handleOnChange(event.target.value),\n [handleOnChange],\n );\n\n return (\n <Input\n disabled={disabled}\n placeholder={placeholder}\n type={(inputType as InputType) ?? 'text'}\n value={value}\n onChange={handleChange}\n aria-invalid={!valid}\n aria-label={name}\n />\n );\n}\n\nfunction TextareaValueEditor({\n disabled,\n fieldData: { name, placeholder, validator },\n handleOnChange,\n rule,\n value,\n}: ValueEditorProps) {\n const { valid } = getValidationResult(rule, validator);\n\n const handleChange = useCallback(\n (event: FormEvent<HTMLSpanElement>) =>\n handleOnChange(event.currentTarget.textContent),\n [handleOnChange],\n );\n\n return (\n <TextArea\n disabled={disabled}\n placeholder={placeholder}\n value={value}\n onChange={handleChange}\n aria-label={name}\n aria-invalid={!valid}\n />\n );\n}\n\nexport const defaultValueEditors: QueryBuilderValueEditors = {\n checkbox: CheckboxValueEditor,\n multiselect: SelectValueEditor,\n radio: RadioGroupValueEditor,\n select: SelectValueEditor,\n switch: SwitchValueEditor,\n text: TextValueEditor,\n textarea: TextareaValueEditor,\n};\n\nexport function ValueEditor(props: ValueEditorProps) {\n const {\n fieldData: { id, valueEditorType },\n operator,\n rule: ruleProp,\n } = props;\n\n const { classNames, valueEditors } = useContext(QueryBuilderContext);\n\n const { valueAsArray, multiValueHandler } = useValueEditor({\n ...props,\n skipHook: true,\n });\n\n const rule = useCallback(\n (index: number) => ({\n ...ruleProp,\n value: valueAsArray[index],\n }),\n [ruleProp, valueAsArray],\n );\n\n const handleRangeStartChange = useCallback(\n (value: string) => multiValueHandler(value, 0),\n [multiValueHandler],\n );\n\n const handleRangeEndChange = useCallback(\n (value: string) => multiValueHandler(value, 1),\n [multiValueHandler],\n );\n\n const type =\n (typeof valueEditorType === 'function'\n ? valueEditorType(operator)\n : valueEditorType) ?? 'text';\n\n const Editor = valueEditors?.[type];\n\n if (operator === 'null' || operator === 'notNull' || !Editor) {\n return null;\n }\n\n if (multiValueOperators.includes(operator)) {\n return (\n <>\n {['start', 'end'].map((term, index) => (\n <div key={`${id}-${term}`} className={classNames?.rule?.value}>\n <Editor\n {...props}\n rule={rule(index)}\n value={valueAsArray[index]}\n handleOnChange={\n !index ? handleRangeStartChange : handleRangeEndChange\n }\n />\n </div>\n ))}\n </>\n );\n }\n\n return (\n <div className={classNames?.rule?.value}>\n <Editor {...props} />\n </div>\n );\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAiBA,SAAS,mBAAoB,CAAA;AAAA,EAC3B,QAAA;AAAA,EACA,SAAA,EAAW,EAAE,IAAA,EAAM,SAAU,EAAA;AAAA,EAC7B,cAAA;AAAA,EACA,IAAA;AAAA,EACA,KAAA;AACF,CAAqB,EAAA;AACnB,EAAA,MAAM,EAAE,KAAA,EAAU,GAAA,UAAA,CAAW,mBAAmB,CAAA,CAAA;AAChD,EAAA,MAAM,EAAE,KAAA,EAAU,GAAA,mBAAA,CAAoB,MAAM,SAAS,CAAA,CAAA;AAErD,EACE,uBAAA,GAAA;AAAA,IAAC,QAAA;AAAA,IAAA;AAAA,MACC,UAAY,EAAA,QAAA;AAAA,MACZ,UAAY,EAAA,KAAA;AAAA,MACZ,QAAU,EAAA,cAAA;AAAA,MACV,gBAAc,CAAC,KAAA;AAAA,MACf,YAAY,EAAA,IAAA;AAAA,MAEX,QAAO,EAAA,KAAA,EAAA,QAAA;AAAA,KAAA;AAAA,GACV,CAAA;AAEJ,CAAA;AAEA,SAAS,qBAAsB,CAAA;AAAA,EAC7B,QAAA;AAAA,EACA,SAAA,EAAW,EAAE,IAAA,EAAM,SAAU,EAAA;AAAA,EAC7B,cAAA;AAAA,EACA,IAAA;AAAA,EACA,KAAA;AAAA,EACA,MAAA;AACF,CAAqB,EAAA;AACnB,EAAA,MAAM,EAAE,KAAA,EAAU,GAAA,mBAAA,CAAoB,MAAM,SAAS,CAAA,CAAA;AAErD,EACE,uBAAA,GAAA;AAAA,IAAC,UAAA;AAAA,IAAA;AAAA,MACC,KAAA;AAAA,MACA,UAAY,EAAA,QAAA;AAAA,MACZ,QAAU,EAAA,cAAA;AAAA,MACV,gBAAc,CAAC,KAAA;AAAA,M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,EAAM,OAChC,QAAC,kBAAA,GAAA,CAAA,MAAA,EAAA,EAAQ,GAAG,KAAA,EAAO,CACrB,EAAA,CAAA,CAAA;AAEJ;;;;"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import { type FullOption, type ValueSelectorProps } from 'react-querybuilder';
|
|
2
|
-
export declare function ValueSelector<T extends FullOption = FullOption>({ handleOnChange, listsAsArrays, options: optionsProp, multiple, title, validation, value, ...rest }: ValueSelectorProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
2
|
-
import { useContext, useCallback, useMemo } from 'react';
|
|
3
|
-
import { useValueSelector, isOptionGroupArray } from 'react-querybuilder';
|
|
4
|
-
import { callRenderProps } from '../../utils/props.js';
|
|
5
|
-
import { AriaSection, AriaHeader, AriaSelectValue } from '../aria/aria.js';
|
|
6
|
-
import { Button } from '../button/button.js';
|
|
7
|
-
import { OptionsItem, OptionsList, Options } from '../options/options.js';
|
|
8
|
-
import { Select } from '../select/select.js';
|
|
9
|
-
import { QueryBuilderContext } from './constants.js';
|
|
10
|
-
|
|
11
|
-
function ValueSelector({ handleOnChange, listsAsArrays, options: optionsProp, multiple, title, validation, value, ...rest }) {
|
|
12
|
-
const { icons, size } = useContext(QueryBuilderContext);
|
|
13
|
-
const { onChange, val } = useValueSelector({
|
|
14
|
-
handleOnChange,
|
|
15
|
-
listsAsArrays,
|
|
16
|
-
multiple,
|
|
17
|
-
value
|
|
18
|
-
});
|
|
19
|
-
const handleSelectionChange = useCallback((selection) => onChange(`${selection}`), [onChange]);
|
|
20
|
-
const handleMultiSelectChange = useCallback((keys) => onChange([...keys].join(", ")), [onChange]);
|
|
21
|
-
const options = useMemo(() => isOptionGroupArray(optionsProp) ? optionsProp.map((section) => jsxs(AriaSection, { children: [jsx(AriaHeader, { children: section.label }), section.options.map((option) => jsx(OptionsItem, { id: option.name, children: option.label }, option.name))] }, section.label)) : optionsProp.map((option) => jsx(OptionsItem, { id: option.name, children: option.label }, option.name)), [optionsProp]);
|
|
22
|
-
return multiple ? jsx(
|
|
23
|
-
OptionsList,
|
|
24
|
-
{ ...rest, selectedKeys: val, selectionMode: "multiple", size, onSelectionChange: handleMultiSelectChange, "aria-label": title, children: options }
|
|
25
|
-
) : jsx(Select, { ...rest, selectedKey: Array.isArray(val) ? val[0] : val, size, isInvalid: title === "Value" && !validation, onSelectionChange: handleSelectionChange, "aria-label": title, children: (renderProps) => jsxs(Fragment, { children: [jsxs(Button, { children: [jsx(AriaSelectValue, { children: ({ selectedText }) => selectedText }), callRenderProps(icons?.select, renderProps)] }), jsx(Options, { children: jsx(OptionsList, { children: options }) })] }) });
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export { ValueSelector };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"value-selector.js","sources":["../../../src/components/query-builder/value-selector.tsx"],"sourcesContent":["import { useCallback, useContext, useMemo } from 'react';\nimport type { Key } from 'react-aria';\nimport type { Selection } from 'react-aria-components';\nimport {\n type FullOption,\n isOptionGroupArray,\n useValueSelector,\n type ValueSelectorProps,\n} from 'react-querybuilder';\nimport { callRenderProps } from '../../utils';\nimport { AriaHeader, AriaSection, AriaSelectValue } from '../aria';\nimport { Button } from '../button';\nimport { Options, OptionsItem, OptionsList } from '../options';\nimport { Select } from '../select';\nimport { QueryBuilderContext } from './constants';\n\nexport function ValueSelector<T extends FullOption = FullOption>({\n handleOnChange,\n listsAsArrays,\n options: optionsProp,\n multiple,\n title,\n validation,\n value,\n ...rest\n}: ValueSelectorProps<T>) {\n const { icons, size } = useContext(QueryBuilderContext);\n\n const { onChange, val } = useValueSelector({\n handleOnChange,\n listsAsArrays,\n multiple,\n value,\n });\n\n const handleSelectionChange = useCallback(\n (selection: Key) => onChange(`${selection}`),\n [onChange],\n );\n\n const handleMultiSelectChange = useCallback(\n (keys: Selection) => onChange([...keys].join(', ')),\n [onChange],\n );\n\n const options = useMemo(\n () =>\n isOptionGroupArray(optionsProp)\n ? optionsProp.map((section) => (\n <AriaSection key={section.label}>\n <AriaHeader>{section.label}</AriaHeader>\n {section.options.map((option) => (\n <OptionsItem id={option.name} key={option.name}>\n {option.label}\n </OptionsItem>\n ))}\n </AriaSection>\n ))\n : optionsProp.map((option) => (\n <OptionsItem id={option.name} key={option.name}>\n {option.label}\n </OptionsItem>\n )),\n [optionsProp],\n );\n\n return multiple ? (\n <OptionsList // TODO: Replace with ChipField when it exists\n {...rest}\n selectedKeys={val}\n selectionMode='multiple'\n size={size}\n onSelectionChange={handleMultiSelectChange}\n aria-label={title}\n >\n {options}\n </OptionsList>\n ) : (\n <Select\n {...rest}\n selectedKey={Array.isArray(val) ? val[0] : val}\n size={size}\n isInvalid={title === 'Value' && !validation}\n onSelectionChange={handleSelectionChange}\n aria-label={title}\n >\n {(renderProps) => (\n <>\n <Button>\n <AriaSelectValue>\n {({ selectedText }) => selectedText}\n </AriaSelectValue>\n {callRenderProps(icons?.select, renderProps)}\n </Button>\n <Options>\n <OptionsList>{options}</OptionsList>\n </Options>\n </>\n )}\n </Select>\n );\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAgBO,SAAS,aAAiD,CAAA;AAAA,EAC/D,cAAA;AAAA,EACA,aAAA;AAAA,EACA,OAAS,EAAA,WAAA;AAAA,EACT,QAAA;AAAA,EACA,KAAA;AAAA,EACA,UAAA;AAAA,EACA,KAAA;AAAA,EACA,GAAG,IAAA;AACL,CAA0B,EAAA;AACxB,EAAA,MAAM,EAAE,KAAA,EAAO,IAAK,EAAA,GAAI,WAAW,mBAAmB,CAAA,CAAA;AAEtD,EAAA,MAAM,EAAE,QAAA,EAAU,GAAI,EAAA,GAAI,gBAAiB,CAAA;AAAA,IACzC,cAAA;AAAA,IACA,aAAA;AAAA,IACA,QAAA;AAAA,IACA,KAAA;AAAA,GACD,CAAA,CAAA;AAED,EAAA,MAAM,qBAAwB,GA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AAAA,MAEX,QAAA,EAAA,OAAA;AAAA,KAAA;AAAA,GAGH,mBAAA,GAAA;AAAA,IAAC,MAAA;AAAA,IAAA;AAAA,MACE,GAAG,IAAA;AAAA,MACJ,aAAa,KAAM,CAAA,OAAA,CAAQ,GAAG,CAAI,GAAA,GAAA,CAAI,CAAC,CAAI,GAAA,GAAA;AAAA,MAC3C,IAAA;AAAA,MACA,SAAA,EAAW,KAAU,KAAA,OAAA,IAAW,CAAC,UAAA;AAAA,MACjC,iBAAmB,EAAA,qBAAA;AAAA,MACnB,YAAY,EAAA,KAAA;AAAA,MAEX,QAAA,EAAA,CAAC,gCAEE,IAAA,CAAA,QAAA,EAAA,EAAA,QAAA,EAAA;AAAA,wBAAA,IAAA,CAAC,MACC,EAAA,EAAA,QAAA,EAAA;AAAA,0BAAA,GAAA,CAAC,eACE,EAAA,EAAA,QAAA,EAAA,CAAC,EAAE,YAAA,OAAmB,YACzB,EAAA,CAAA;AAAA,UACC,eAAA,CAAgB,KAAO,EAAA,MAAA,EAAQ,WAAW,CAAA;AAAA,SAC7C,EAAA,CAAA;AAAA,wBACC,GAAA,CAAA,OAAA,EAAA,EACC,QAAC,kBAAA,GAAA,CAAA,WAAA,EAAA,EAAa,mBAAQ,CACxB,EAAA,CAAA;AAAA,OACF,EAAA,CAAA;AAAA,KAAA;AAAA,GAEJ,CAAA;AAEJ;;;;"}
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
export { Radio, RadioContext, RadioGroup, RadioGroupContext } from './radio';
|
|
2
|
-
export { radioClassNames, radioColorVars, radioSpaceVars, radioGroupStateVars, radioStateVars, } from './radio.css';
|
|
3
|
-
export { type RadioAlignment, type RadioClassNames, type RadioContextProps, type RadioGroupProps, type RadioGroupState, type RadioProps, type RadioState, } from './types';
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import type { RadioClassNames } from './types';
|
|
2
|
-
export declare const radioContainer: string;
|
|
3
|
-
export declare const radioGroupContainer: string;
|
|
4
|
-
export declare const radioColorVars: {
|
|
5
|
-
border: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
6
|
-
background: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
7
|
-
color: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
8
|
-
};
|
|
9
|
-
export declare const radioSpaceVars: {
|
|
10
|
-
diameter: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
11
|
-
gap: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
12
|
-
elementGap: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
13
|
-
};
|
|
14
|
-
export declare const radioStateVars: {
|
|
15
|
-
alignInput: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
16
|
-
isDisabled: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
17
|
-
isFocused: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
18
|
-
isFocusVisible: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
19
|
-
isHovered: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
20
|
-
isPressed: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
21
|
-
isReadOnly: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
22
|
-
isSelected: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
23
|
-
isInvalid: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
24
|
-
isRequired: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
25
|
-
};
|
|
26
|
-
export declare const radioGroupStateVars: {
|
|
27
|
-
alignInput: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
28
|
-
orientation: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
29
|
-
isDisabled: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
30
|
-
isReadOnly: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
31
|
-
isInvalid: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
32
|
-
isRequired: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
33
|
-
};
|
|
34
|
-
export declare const radioClassNames: RadioClassNames;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { type ContextValue } from 'react-aria-components';
|
|
2
|
-
import type { RadioGroupProps, RadioRenderProps, RadioContextProps } from './types';
|
|
3
|
-
export declare const RadioContext: import("react").Context<ContextValue<RadioContextProps, HTMLLabelElement>>;
|
|
4
|
-
export declare const Radio: (props: Omit<import("react-aria-components").RadioProps, "children" | "className" | "style"> & {
|
|
5
|
-
children?: import("../..").RenderPropsChildren<RadioRenderProps>;
|
|
6
|
-
label?: string;
|
|
7
|
-
classNames?: import("./types").RadioClassNames;
|
|
8
|
-
alignInput?: import("./types").RadioAlignment;
|
|
9
|
-
} & import("react").RefAttributes<HTMLLabelElement>) => import("react").ReactElement | null;
|
|
10
|
-
export declare const RadioGroupContext: import("react").Context<ContextValue<RadioGroupProps, HTMLDivElement>>;
|
|
11
|
-
export declare const RadioGroup: (props: Omit<import("react-aria-components").RadioGroupProps, "className" | "style"> & Pick<{
|
|
12
|
-
children?: import("../..").RenderPropsChildren<RadioRenderProps>;
|
|
13
|
-
label?: string;
|
|
14
|
-
classNames?: import("./types").RadioClassNames;
|
|
15
|
-
alignInput?: import("./types").RadioAlignment;
|
|
16
|
-
}, "classNames" | "label" | "alignInput"> & import("react").RefAttributes<HTMLDivElement>) => import("react").ReactElement | null;
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import { jsx } from 'react/jsx-runtime';
|
|
2
|
-
import { createContext, forwardRef, useMemo, useCallback } from 'react';
|
|
3
|
-
import { Radio as Radio$1, Provider, RadioGroup as RadioGroup$1 } from 'react-aria-components';
|
|
4
|
-
import { useContextProps } from '../../hooks/use-context-props/use-context-props.js';
|
|
5
|
-
import { useDefaultProps } from '../../hooks/use-defaults/use-defaults.js';
|
|
6
|
-
import { inlineVars } from '../../utils/css.js';
|
|
7
|
-
import { mergeClassNames, callRenderProps } from '../../utils/props.js';
|
|
8
|
-
import { useTheme } from '../../hooks/use-theme/use-theme.js';
|
|
9
|
-
import { AriaLabelContext } from '../aria/aria.js';
|
|
10
|
-
import { radioClassNames, radioStateVars, radioGroupStateVars } from './radio.vanilla.js';
|
|
11
|
-
|
|
12
|
-
const RadioContext = createContext(null);
|
|
13
|
-
const Radio = forwardRef(function Radio2(props, ref) {
|
|
14
|
-
[props, ref] = useContextProps(props, ref, RadioContext);
|
|
15
|
-
props = useDefaultProps(props, "Radio");
|
|
16
|
-
const { children: childrenProp, classNames: classNamesProp, alignInput = "end", ...rest } = props;
|
|
17
|
-
const theme = useTheme();
|
|
18
|
-
const classNames = useMemo(() => mergeClassNames(radioClassNames, theme.Radio, classNamesProp), [classNamesProp, theme.Radio]);
|
|
19
|
-
const style = useCallback((renderProps) => inlineVars(radioStateVars, {
|
|
20
|
-
...renderProps,
|
|
21
|
-
alignInput
|
|
22
|
-
}), [alignInput]);
|
|
23
|
-
const children = useCallback((renderProps) => jsx("span", { className: classNames?.radio?.radio, children: callRenderProps(childrenProp, {
|
|
24
|
-
...renderProps,
|
|
25
|
-
defaultChildren: null
|
|
26
|
-
}) }), [childrenProp, classNames?.radio]);
|
|
27
|
-
return jsx(Radio$1, { ...rest, ref, style, className: classNames?.radio?.container, children });
|
|
28
|
-
});
|
|
29
|
-
const RadioGroupContext = createContext(null);
|
|
30
|
-
const RadioGroup = forwardRef(function RadioGroup2(props, ref) {
|
|
31
|
-
[props, ref] = useContextProps(props, ref, RadioGroupContext);
|
|
32
|
-
props = useDefaultProps(props, "RadioGroup");
|
|
33
|
-
const theme = useTheme();
|
|
34
|
-
const { children: childrenProp, classNames: classNamesProp, alignInput = "end", orientation = "vertical", ...rest } = props;
|
|
35
|
-
const classNames = useMemo(() => mergeClassNames(radioClassNames, theme.Radio, classNamesProp), [classNamesProp, theme.Radio]);
|
|
36
|
-
const style = useCallback((renderProps) => inlineVars(radioGroupStateVars, {
|
|
37
|
-
...renderProps,
|
|
38
|
-
alignInput,
|
|
39
|
-
orientation
|
|
40
|
-
}), [alignInput, orientation]);
|
|
41
|
-
const values = useMemo(() => [
|
|
42
|
-
[
|
|
43
|
-
RadioContext,
|
|
44
|
-
{
|
|
45
|
-
classNames,
|
|
46
|
-
alignInput
|
|
47
|
-
}
|
|
48
|
-
],
|
|
49
|
-
[
|
|
50
|
-
AriaLabelContext,
|
|
51
|
-
{
|
|
52
|
-
className: classNames?.label
|
|
53
|
-
}
|
|
54
|
-
]
|
|
55
|
-
], [alignInput, classNames]);
|
|
56
|
-
const children = useCallback((renderProps) => jsx(Provider, { values, children: jsx("div", { className: classNames?.group?.group, children: callRenderProps(childrenProp, {
|
|
57
|
-
...renderProps,
|
|
58
|
-
defaultChildren: null
|
|
59
|
-
}) }) }), [childrenProp, classNames?.group, values]);
|
|
60
|
-
return jsx(RadioGroup$1, { ...rest, ref, className: classNames?.group?.container, style, orientation, children });
|
|
61
|
-
});
|
|
62
|
-
|
|
63
|
-
export { Radio, RadioContext, RadioGroup, RadioGroupContext };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"radio.js","sources":["../../../src/components/radio/radio.tsx"],"sourcesContent":["import {\n createContext,\n type ForwardedRef,\n forwardRef,\n useMemo,\n useCallback,\n} from 'react';\nimport {\n RadioGroup as RACRadioGroup,\n Radio as RACRadio,\n type ContextValue,\n Provider,\n type LabelProps,\n} from 'react-aria-components';\nimport { useContextProps, useDefaultProps, useTheme } from '../../hooks';\nimport { callRenderProps, inlineVars, mergeClassNames } from '../../utils';\nimport { AriaLabelContext } from '../aria';\nimport {\n radioClassNames,\n radioGroupStateVars,\n radioStateVars,\n} from './radio.css';\nimport type {\n RadioGroupRenderProps,\n RadioGroupProps,\n RadioProps,\n RadioRenderProps,\n RadioContextProps,\n} from './types';\n\nexport const RadioContext =\n createContext<ContextValue<RadioContextProps, HTMLLabelElement>>(null);\n\nexport const Radio = forwardRef(function Radio(\n props: RadioProps,\n ref: ForwardedRef<HTMLLabelElement>,\n) {\n [props, ref] = useContextProps(props, ref, RadioContext);\n props = useDefaultProps(props, 'Radio');\n\n const {\n children: childrenProp,\n classNames: classNamesProp,\n alignInput = 'end',\n ...rest\n } = props;\n\n const theme = useTheme();\n\n const classNames = useMemo(\n () => mergeClassNames(radioClassNames, theme.Radio, classNamesProp),\n [classNamesProp, theme.Radio],\n );\n\n const style = useCallback(\n (renderProps: RadioRenderProps) =>\n inlineVars(radioStateVars, {\n ...renderProps,\n alignInput,\n }),\n [alignInput],\n );\n\n const children = useCallback(\n (renderProps: RadioRenderProps) => (\n <span className={classNames?.radio?.radio}>\n {callRenderProps(childrenProp, {\n ...renderProps,\n defaultChildren: null,\n })}\n </span>\n ),\n [childrenProp, classNames?.radio],\n );\n\n return (\n <RACRadio\n {...rest}\n ref={ref}\n style={style}\n className={classNames?.radio?.container}\n >\n {children}\n </RACRadio>\n );\n});\n\nexport const RadioGroupContext =\n createContext<ContextValue<RadioGroupProps, HTMLDivElement>>(null);\n\nexport const RadioGroup = forwardRef(function RadioGroup(\n props: RadioGroupProps,\n ref: ForwardedRef<HTMLDivElement>,\n) {\n [props, ref] = useContextProps(props, ref, RadioGroupContext);\n\n props = useDefaultProps(props, 'RadioGroup');\n\n const theme = useTheme();\n\n const {\n children: childrenProp,\n classNames: classNamesProp,\n alignInput = 'end',\n orientation = 'vertical',\n ...rest\n } = props;\n\n const classNames = useMemo(\n () => mergeClassNames(radioClassNames, theme.Radio, classNamesProp),\n [classNamesProp, theme.Radio],\n );\n\n const style = useCallback(\n (renderProps: RadioGroupRenderProps) =>\n inlineVars(radioGroupStateVars, {\n ...renderProps,\n alignInput,\n orientation,\n }),\n [alignInput, orientation],\n );\n\n const values = useMemo<\n [\n [typeof RadioContext, ContextValue<RadioContextProps, HTMLLabelElement>],\n [typeof AriaLabelContext, ContextValue<LabelProps, HTMLLabelElement>],\n ]\n >(\n () => [\n [\n RadioContext,\n {\n classNames,\n alignInput,\n },\n ],\n [\n AriaLabelContext,\n {\n className: classNames?.label,\n },\n ],\n ],\n [alignInput, classNames],\n );\n\n const children = useCallback(\n (renderProps: RadioGroupRenderProps) => (\n <Provider values={values}>\n <div className={classNames?.group?.group}>\n {callRenderProps(childrenProp, {\n ...renderProps,\n defaultChildren: null,\n })}\n </div>\n </Provider>\n ),\n [childrenProp, classNames?.group, values],\n );\n\n return (\n <RACRadioGroup\n {...rest}\n ref={ref}\n className={classNames?.group?.container}\n style={style}\n orientation={orientation}\n >\n {children}\n </RACRadioGroup>\n );\n});\n"],"names":["Radio","RACRadio","RadioGroup","RACRadioGroup"],"mappings":";;;;;;;;;;;;;;;;;AA8Ba,MAAA,YAAA,GACX,cAAiE,IAAI,EAAA;AAEhE,MAAM,KAAQ,GAAA,UAAA,CAAW,SAASA,MAAAA,CACvC,OACA,GACA,EAAA;AACA,EAAA,CAAC,OAAO,GAAG,CAAA,GAAI,eAAgB,CAAA,KAAA,EAAO,KAAK,YAAY,CAAA,CAAA;AACvD,EAAQ,KAAA,GAAA,eAAA,CAAgB,OAAO,OAAO,CAAA,CAAA;AAEtC,EAAM,MAAA;AAAA,IACJ,QAAU,EAAA,YAAA;AAAA,IACV,UAAY,EAAA,cAAA;AAAA,IACZ,UAAa,GAAA,KAAA;AAAA,IACb,GAAG,IAAA;AAAA,GACD,GAAA,KAAA,CAAA;AAEJ,EAAA,MAAM,QAAQ,QAAS,EAAA,CAAA;AAEvB,EAAA,MAAM,UAAa,GAAA,OAAA;AAAA,IACjB,MAAM,eAAA,CAAgB,eAAiB,EAAA,KAAA,CAAM,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1C,CAAA;AAEA,EACE,uBAAA,GAAA;AAAA,IAACC,YAAA;AAAA,IAAA;AAAA,MACE,GAAG,IAAA;AAAA,MACJ,GAAA;AAAA,MACA,SAAA,EAAW,YAAY,KAAO,EAAA,SAAA;AAAA,MAC9B,KAAA;AAAA,MACA,WAAA;AAAA,MAEC,QAAA;AAAA,KAAA;AAAA,GACH,CAAA;AAEJ,CAAC;;;;"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
var radioClassNames = { radio: { container: "radio_radioClassNames_radio_container__hweo8bo", radio: "radio_radioClassNames_radio_radio__hweo8bp" }, group: { container: "radio_radioClassNames_group_container__hweo8bq", group: "radio_radioClassNames_group_group__hweo8br" }, label: "typography_label__j8fgabg" };
|
|
3
|
-
var radioColorVars = { border: "var(--border__hweo8b2)", background: "var(--background__hweo8b3)", color: "var(--color__hweo8b4)" };
|
|
4
|
-
var radioGroupStateVars = { alignInput: "var(--alignInput__hweo8bi)", orientation: "var(--orientation__hweo8bj)", isDisabled: "var(--isDisabled__hweo8bk)", isReadOnly: "var(--isReadOnly__hweo8bl)", isInvalid: "var(--isInvalid__hweo8bm)", isRequired: "var(--isRequired__hweo8bn)" };
|
|
5
|
-
var radioSpaceVars = { diameter: "var(--diameter__hweo8b5)", gap: "var(--gap__hweo8b6)", elementGap: "var(--elementGap__hweo8b7)" };
|
|
6
|
-
var radioStateVars = { alignInput: "var(--alignInput__hweo8b8)", isDisabled: "var(--isDisabled__hweo8b9)", isFocused: "var(--isFocused__hweo8ba)", isFocusVisible: "var(--isFocusVisible__hweo8bb)", isHovered: "var(--isHovered__hweo8bc)", isPressed: "var(--isPressed__hweo8bd)", isReadOnly: "var(--isReadOnly__hweo8be)", isSelected: "var(--isSelected__hweo8bf)", isInvalid: "var(--isInvalid__hweo8bg)", isRequired: "var(--isRequired__hweo8bh)" };
|
|
7
|
-
|
|
8
|
-
export { radioClassNames, radioColorVars, radioGroupStateVars, radioSpaceVars, radioStateVars };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"radio.vanilla.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;"}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import type { RadioGroupProps as RACRadioGroupProps, RadioGroupRenderProps as RACRadioGroupRenderProps, RadioProps as RACRadioProps, RadioRenderProps as RACRadioRenderProps } from 'react-aria-components';
|
|
2
|
-
import type { PartialDeep } from 'type-fest';
|
|
3
|
-
import type { RenderPropsChildren } from '../../types';
|
|
4
|
-
export type RadioAlignment = 'start' | 'end';
|
|
5
|
-
export type RadioClassNames = PartialDeep<{
|
|
6
|
-
group: {
|
|
7
|
-
container: string;
|
|
8
|
-
group: string;
|
|
9
|
-
};
|
|
10
|
-
radio: {
|
|
11
|
-
container: string;
|
|
12
|
-
radio: string;
|
|
13
|
-
};
|
|
14
|
-
label: string;
|
|
15
|
-
}>;
|
|
16
|
-
export type RadioGroupRenderProps = RACRadioGroupRenderProps;
|
|
17
|
-
export type RadioGroupProps = Omit<RACRadioGroupProps, 'className' | 'style'> & Pick<BaseRadioProps, 'alignInput' | 'classNames' | 'label'>;
|
|
18
|
-
export type RadioGroupState = Omit<RadioGroupRenderProps, 'state'>;
|
|
19
|
-
export type RadioRenderProps = Omit<RACRadioRenderProps, 'state'>;
|
|
20
|
-
type BaseRadioProps = {
|
|
21
|
-
children?: RenderPropsChildren<RadioRenderProps>;
|
|
22
|
-
label?: string;
|
|
23
|
-
classNames?: RadioClassNames;
|
|
24
|
-
alignInput?: RadioAlignment;
|
|
25
|
-
};
|
|
26
|
-
export type RadioProps = Omit<RACRadioProps, 'children' | 'className' | 'style'> & BaseRadioProps;
|
|
27
|
-
export type RadioContextProps = Omit<RadioProps, 'value'>;
|
|
28
|
-
export type RadioState = RadioRenderProps & Pick<BaseRadioProps, 'alignInput'>;
|
|
29
|
-
export {};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
export { SearchField, SearchFieldContext } from './search-field';
|
|
2
|
-
export { searchFieldClassNames, searchFieldContainer, searchFieldSpaceVars, searchFieldStateVars, } from './search-field.css';
|
|
3
|
-
export { type SearchFieldClassNames, type SearchFieldMapping, type SearchFieldProps, type SearchFieldRenderProps, type SearchFieldState, } from './types';
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { SearchFieldClassNames } from './types';
|
|
2
|
-
export declare const searchFieldContainer: string;
|
|
3
|
-
export declare const searchFieldSpaceVars: {
|
|
4
|
-
x: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
5
|
-
y: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
6
|
-
};
|
|
7
|
-
export declare const searchFieldStateVars: {
|
|
8
|
-
size: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
9
|
-
variant: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
10
|
-
isEmpty: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
11
|
-
isDisabled: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
12
|
-
isInvalid: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
13
|
-
isReadOnly: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
14
|
-
isRequired: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
15
|
-
};
|
|
16
|
-
export declare const searchFieldClassNames: SearchFieldClassNames;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { type ContextValue } from 'react-aria-components';
|
|
2
|
-
import type { SearchFieldMapping, SearchFieldProps } from './types';
|
|
3
|
-
export declare const SearchFieldContext: import("react").Context<ContextValue<SearchFieldProps, HTMLDivElement>>;
|
|
4
|
-
export declare const SearchField: (props: Omit<import("react-aria-components").SearchFieldProps, "className" | "style" | "type"> & {
|
|
5
|
-
classNames?: import("./types").SearchFieldClassNames;
|
|
6
|
-
mapping?: Partial<SearchFieldMapping>;
|
|
7
|
-
size?: import("../input").InputSize;
|
|
8
|
-
variant?: import("./types").SearchFieldVariants;
|
|
9
|
-
} & import("react").RefAttributes<HTMLDivElement>) => import("react").ReactElement | null;
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import { jsx } from 'react/jsx-runtime';
|
|
2
|
-
import { createContext, forwardRef, useMemo, useCallback } from 'react';
|
|
3
|
-
import { Provider, SearchField as SearchField$1 } from 'react-aria-components';
|
|
4
|
-
import { useContextProps } from '../../hooks/use-context-props/use-context-props.js';
|
|
5
|
-
import { useDefaultProps } from '../../hooks/use-defaults/use-defaults.js';
|
|
6
|
-
import { inlineVars } from '../../utils/css.js';
|
|
7
|
-
import { mergeClassNames, callRenderProps } from '../../utils/props.js';
|
|
8
|
-
import { useTheme } from '../../hooks/use-theme/use-theme.js';
|
|
9
|
-
import { AriaGroupContext } from '../aria/aria.js';
|
|
10
|
-
import { ButtonContext } from '../button/button.js';
|
|
11
|
-
import { IconContext } from '../icon/icon.js';
|
|
12
|
-
import { InputContext } from '../input/input.js';
|
|
13
|
-
import { searchFieldClassNames, searchFieldStateVars } from './search-field.vanilla.js';
|
|
14
|
-
|
|
15
|
-
const defaultMapping = {
|
|
16
|
-
icon: {
|
|
17
|
-
sm: { size: "xs" },
|
|
18
|
-
lg: { size: "sm" }
|
|
19
|
-
},
|
|
20
|
-
clear: {
|
|
21
|
-
sm: { size: "xs", variant: "icon" },
|
|
22
|
-
lg: { size: "sm", variant: "icon" }
|
|
23
|
-
}
|
|
24
|
-
};
|
|
25
|
-
const SearchFieldContext = createContext(null);
|
|
26
|
-
const SearchField = forwardRef(function SearchField2(props, ref) {
|
|
27
|
-
[props, ref] = useContextProps(props, ref, SearchFieldContext);
|
|
28
|
-
props = useDefaultProps(props, "SearchField");
|
|
29
|
-
const { children: childrenProp, classNames: classNamesProp, mapping: mappingProp, size = "lg", variant = "solid", isDisabled, isReadOnly } = props;
|
|
30
|
-
const theme = useTheme();
|
|
31
|
-
const mapping = useMemo(() => ({
|
|
32
|
-
...defaultMapping,
|
|
33
|
-
...mappingProp
|
|
34
|
-
}), [mappingProp]);
|
|
35
|
-
const classNames = useMemo(() => mergeClassNames(searchFieldClassNames, theme.SearchField, classNamesProp), [theme.SearchField, classNamesProp]);
|
|
36
|
-
const values = useMemo(() => [
|
|
37
|
-
[AriaGroupContext, { className: classNames?.group }],
|
|
38
|
-
[IconContext, { ...mapping.icon[size], classNames: classNames?.icon }],
|
|
39
|
-
[InputContext, { classNames: classNames?.input, size }],
|
|
40
|
-
[
|
|
41
|
-
ButtonContext,
|
|
42
|
-
{
|
|
43
|
-
...mapping.clear[size],
|
|
44
|
-
classNames: classNames?.clear,
|
|
45
|
-
isDisabled: isDisabled ?? isReadOnly
|
|
46
|
-
}
|
|
47
|
-
]
|
|
48
|
-
], [classNames, mapping, isDisabled, isReadOnly, size]);
|
|
49
|
-
const style = useCallback(({ state, ...renderProps }) => inlineVars(searchFieldStateVars, {
|
|
50
|
-
...renderProps,
|
|
51
|
-
variant
|
|
52
|
-
}), [variant]);
|
|
53
|
-
const children = useCallback((renderProps) => jsx(Provider, { values, children: callRenderProps(childrenProp, {
|
|
54
|
-
...renderProps,
|
|
55
|
-
defaultChildren: null
|
|
56
|
-
}) }), [childrenProp, values]);
|
|
57
|
-
return jsx(SearchField$1, { ...props, ref, className: classNames?.container, style, children });
|
|
58
|
-
});
|
|
59
|
-
|
|
60
|
-
export { SearchField, SearchFieldContext };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"search-field.js","sources":["../../../src/components/search-field/search-field.tsx"],"sourcesContent":["import {\n type ForwardedRef,\n createContext,\n forwardRef,\n useCallback,\n useMemo,\n} from 'react';\nimport {\n type ContextValue,\n Provider,\n type GroupProps as RACGroupProps,\n SearchField as RACSearchField,\n type SearchFieldRenderProps,\n} from 'react-aria-components';\nimport { useContextProps, useDefaultProps, useTheme } from '../../hooks';\nimport { callRenderProps, inlineVars, mergeClassNames } from '../../utils';\nimport { AriaGroupContext } from '../aria';\nimport { ButtonContext, type ButtonProps } from '../button';\nimport { IconContext, type IconProps } from '../icon';\nimport { InputContext, type InputProps } from '../input';\nimport {\n searchFieldClassNames,\n searchFieldStateVars,\n} from './search-field.css';\nimport type { SearchFieldMapping, SearchFieldProps } from './types';\n\nconst defaultMapping: SearchFieldMapping = {\n icon: {\n sm: { size: 'xs' },\n lg: { size: 'sm' },\n },\n clear: {\n sm: { size: 'xs', variant: 'icon' },\n lg: { size: 'sm', variant: 'icon' },\n },\n};\n\nexport const SearchFieldContext =\n createContext<ContextValue<SearchFieldProps, HTMLDivElement>>(null);\n\nexport const SearchField = forwardRef(function SearchField(\n props: SearchFieldProps,\n ref: ForwardedRef<HTMLDivElement>,\n) {\n [props, ref] = useContextProps(props, ref, SearchFieldContext);\n props = useDefaultProps(props, 'SearchField');\n\n const {\n children: childrenProp,\n classNames: classNamesProp,\n mapping: mappingProp,\n size = 'lg',\n variant = 'solid',\n isDisabled,\n isReadOnly,\n } = props;\n\n const theme = useTheme();\n\n const mapping = useMemo(\n () => ({\n ...defaultMapping,\n ...mappingProp,\n }),\n [mappingProp],\n );\n\n const classNames = useMemo(\n () =>\n mergeClassNames(searchFieldClassNames, theme.SearchField, classNamesProp),\n [theme.SearchField, classNamesProp],\n );\n\n const values = useMemo<\n [\n [typeof AriaGroupContext, ContextValue<RACGroupProps, HTMLDivElement>],\n [typeof IconContext, ContextValue<IconProps, HTMLDivElement>],\n [typeof InputContext, ContextValue<InputProps, HTMLInputElement>],\n [typeof ButtonContext, ContextValue<ButtonProps, HTMLButtonElement>],\n ]\n >(\n () => [\n [AriaGroupContext, { className: classNames?.group }],\n [IconContext, { ...mapping.icon[size], classNames: classNames?.icon }],\n [InputContext, { classNames: classNames?.input, size }],\n [\n ButtonContext,\n {\n ...mapping.clear[size],\n classNames: classNames?.clear,\n isDisabled: isDisabled ?? isReadOnly,\n },\n ],\n ],\n [classNames, mapping, isDisabled, isReadOnly, size],\n );\n\n const style = useCallback(\n ({ state, ...renderProps }: SearchFieldRenderProps) =>\n inlineVars(searchFieldStateVars, {\n ...renderProps,\n variant,\n }),\n [variant],\n );\n\n const children = useCallback(\n (renderProps: SearchFieldRenderProps) => (\n <Provider values={values}>\n {callRenderProps(childrenProp, {\n ...renderProps,\n defaultChildren: null,\n })}\n </Provider>\n ),\n [childrenProp, values],\n );\n\n return (\n <RACSearchField\n {...props}\n ref={ref}\n className={classNames?.container}\n style={style}\n >\n {children}\n </RACSearchField>\n );\n});\n"],"names":["SearchField","RACSearchField"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AA0BA,MAAM,cAAqC,GAAA;AAAA,EACzC,IAAM,EAAA;AAAA,IACJ,EAAA,EAAI,EAAE,IAAA,EAAM,IAAK,EAAA;AAAA,IACjB,EAAA,EAAI,EAAE,IAAA,EAAM,IAAK,EAAA;AAAA,GACnB;AAAA,EACA,KAAO,EAAA;AAAA,IACL,EAAI,EAAA,EAAE,IAAM,EAAA,IAAA,EAAM,SAAS,MAAO,EAAA;AAAA,IAClC,EAAI,EAAA,EAAE,IAAM,EAAA,IAAA,EAAM,SAAS,MAAO,EAAA;AAAA,GACpC;AACF,CAAA,CAAA;AAEa,MAAA,kBAAA,GACX,cAA8D,IAAI,EAAA;AAE7D,MAAM,WAAc,GAAA,UAAA,CAAW,SAASA,YAAAA,CAC7C,OACA,GACA,EAAA;AACA,EAAA,CAAC,OAAO,GAAG,CAAA,GAAI,eAAgB,CAAA,KAAA,EAAO,KAAK,kBAAkB,CAAA,CAAA;AAC7D,EAAQ,KAAA,GAAA,eAAA,CAAgB,OAAO,aAAa,CAAA,CAAA;AAE5C,EAAM,MAAA;AAAA,IACJ,QAAU,EAAA,YAAA;AAAA,IACV,UAAY,EAAA,cAAA;AAAA,IACZ,OAAS,EAAA,WAAA;AAAA,IACT,IAAO,GAAA,IAAA;AAAA,IACP,OAAU,GAAA,OAAA;AAAA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;AAAA,KACD,CAAA;AAAA,IACH,CAAC,OAAO,CAAA;AAAA,GACV,CAAA;AAEA,EAAA,MAAM,QAAW,GAAA,WAAA;AAAA,IACf,CAAC,WACC,qBAAA,GAAA,CAAC,QAAS,EAAA,EAAA,MAAA,EACP,0BAAgB,YAAc,EAAA;AAAA,MAC7B,GAAG,WAAA;AAAA,MACH,eAAiB,EAAA,IAAA;AAAA,KAClB,CACH,EAAA,CAAA;AAAA,IAEF,CAAC,cAAc,MAAM,CAAA;AAAA,GACvB,CAAA;AAEA,EACE,uBAAA,GAAA;AAAA,IAACC,aAAA;AAAA,IAAA;AAAA,MACE,GAAG,KAAA;AAAA,MACJ,GAAA;AAAA,MACA,WAAW,UAAY,EAAA,SAAA;AAAA,MACvB,KAAA;AAAA,MAEC,QAAA;AAAA,KAAA;AAAA,GACH,CAAA;AAEJ,CAAC;;;;"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
var searchFieldClassNames = { container: "search-field_searchFieldClassNames_container__1exq9w6a", group: "search-field_searchFieldClassNames_group__1exq9w6b", icon: { icon: "search-field_searchFieldClassNames_icon_icon__1exq9w6c" }, input: { sizer: "search-field_searchFieldClassNames_input_sizer__1exq9w6d", input: "search-field_searchFieldClassNames_input_input__1exq9w6e" }, clear: { button: "search-field_searchFieldClassNames_clear_button__1exq9w6f" } };
|
|
3
|
-
var searchFieldContainer = "search-field_searchFieldContainer__1exq9w60";
|
|
4
|
-
var searchFieldSpaceVars = { x: "var(--x__1exq9w61)", y: "var(--y__1exq9w62)" };
|
|
5
|
-
var searchFieldStateVars = { size: "var(--size__1exq9w63)", variant: "var(--variant__1exq9w64)", isEmpty: "var(--isEmpty__1exq9w65)", isDisabled: "var(--isDisabled__1exq9w66)", isInvalid: "var(--isInvalid__1exq9w67)", isReadOnly: "var(--isReadOnly__1exq9w68)", isRequired: "var(--isRequired__1exq9w69)" };
|
|
6
|
-
|
|
7
|
-
export { searchFieldClassNames, searchFieldContainer, searchFieldSpaceVars, searchFieldStateVars };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"search-field.vanilla.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;"}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import type { SearchFieldProps as RACSearchFieldProps, SearchFieldRenderProps as RACSearchFieldRenderProps } from 'react-aria-components';
|
|
2
|
-
import type { PartialDeep } from 'type-fest';
|
|
3
|
-
import type { AsType, OmitProtectedProps } from '../../types';
|
|
4
|
-
import type { ButtonClassNames, ButtonProps } from '../button/types';
|
|
5
|
-
import type { IconClassNames, IconProps } from '../icon/types';
|
|
6
|
-
import type { InputClassNames, InputSize } from '../input/types';
|
|
7
|
-
export type SearchFieldClassNames = PartialDeep<{
|
|
8
|
-
container: string;
|
|
9
|
-
group: string;
|
|
10
|
-
icon: IconClassNames;
|
|
11
|
-
input: InputClassNames;
|
|
12
|
-
clear: ButtonClassNames;
|
|
13
|
-
}>;
|
|
14
|
-
export type SearchFieldSizes = 'sm' | 'lg';
|
|
15
|
-
export type SearchFieldVariants = 'solid' | 'hollow';
|
|
16
|
-
export type SearchFieldMapping = {
|
|
17
|
-
icon: Partial<Record<SearchFieldSizes, OmitProtectedProps<IconProps>>>;
|
|
18
|
-
clear: Partial<Record<SearchFieldSizes, OmitProtectedProps<ButtonProps>>>;
|
|
19
|
-
};
|
|
20
|
-
type BaseSearchFieldProps = {
|
|
21
|
-
classNames?: SearchFieldClassNames;
|
|
22
|
-
mapping?: Partial<SearchFieldMapping>;
|
|
23
|
-
size?: InputSize;
|
|
24
|
-
variant?: SearchFieldVariants;
|
|
25
|
-
};
|
|
26
|
-
export type SearchFieldRenderProps = AsType<RACSearchFieldRenderProps>;
|
|
27
|
-
export type SearchFieldState = Omit<SearchFieldRenderProps, 'state'> & Required<Pick<BaseSearchFieldProps, 'variant' | 'size'>>;
|
|
28
|
-
export type SearchFieldProps = Omit<RACSearchFieldProps, 'className' | 'style' | 'type'> & BaseSearchFieldProps;
|
|
29
|
-
export {};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
export { Select, SelectContext } from './select';
|
|
2
|
-
export { selectClassNames, selectColorVars, selectContainer, selectSpaceVars, selectStateVars, } from './select.css';
|
|
3
|
-
export { type SelectClassNames, type SelectMapping, type SelectProps, type SelectRenderProps, type SelectSizes, type SelectState, } from './types';
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import type { SelectClassNames } from './types';
|
|
2
|
-
export declare const selectContainer: string;
|
|
3
|
-
export declare const selectColorVars: {
|
|
4
|
-
description: {
|
|
5
|
-
color: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
6
|
-
};
|
|
7
|
-
error: {
|
|
8
|
-
color: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
9
|
-
};
|
|
10
|
-
};
|
|
11
|
-
export declare const selectSpaceVars: {
|
|
12
|
-
width: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
13
|
-
x: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
14
|
-
y: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
15
|
-
};
|
|
16
|
-
export declare const selectStateVars: {
|
|
17
|
-
size: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
18
|
-
isDisabled: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
19
|
-
isInvalid: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
20
|
-
isOpen: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
21
|
-
isRequired: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
22
|
-
isFocused: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
23
|
-
isFocusVisible: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
24
|
-
};
|
|
25
|
-
export declare const selectClassNames: SelectClassNames;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { type ContextValue } from 'react-aria-components';
|
|
2
|
-
import type { SelectMapping, SelectProps } from './types';
|
|
3
|
-
export declare const SelectContext: import("react").Context<ContextValue<SelectProps<object>, HTMLDivElement>>;
|
|
4
|
-
export declare const Select: <T extends object>(props: Omit<import("react-aria-components").SelectProps<T>, "className" | "style"> & {
|
|
5
|
-
classNames?: import("./types").SelectClassNames;
|
|
6
|
-
mapping?: Partial<SelectMapping>;
|
|
7
|
-
size?: import("./types").SelectSizes;
|
|
8
|
-
} & import("react").RefAttributes<HTMLDivElement>) => import("react").ReactElement | null;
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
import { jsx } from 'react/jsx-runtime';
|
|
2
|
-
import { createContext, forwardRef, useMemo, useCallback } from 'react';
|
|
3
|
-
import { Provider, Select as Select$1 } from 'react-aria-components';
|
|
4
|
-
import { useContextProps } from '../../hooks/use-context-props/use-context-props.js';
|
|
5
|
-
import { useDefaultProps } from '../../hooks/use-defaults/use-defaults.js';
|
|
6
|
-
import { inlineVars } from '../../utils/css.js';
|
|
7
|
-
import { mergeClassNames, callRenderProps } from '../../utils/props.js';
|
|
8
|
-
import { useTheme } from '../../hooks/use-theme/use-theme.js';
|
|
9
|
-
import { bodies } from '../../styles/typography.vanilla.js';
|
|
10
|
-
import { AriaLabelContext, AriaSelectValueContext, AriaTextContext, AriaFieldErrorContext } from '../aria/aria.js';
|
|
11
|
-
import { ButtonContext } from '../button/button.js';
|
|
12
|
-
import { OptionsContext } from '../options/options.js';
|
|
13
|
-
import { selectClassNames, selectStateVars } from './select.vanilla.js';
|
|
14
|
-
|
|
15
|
-
const defaultMapping = {
|
|
16
|
-
description: {
|
|
17
|
-
sm: bodies.xs,
|
|
18
|
-
lg: bodies.xs
|
|
19
|
-
},
|
|
20
|
-
error: {
|
|
21
|
-
sm: bodies.xs,
|
|
22
|
-
lg: bodies.xs
|
|
23
|
-
},
|
|
24
|
-
toggle: {
|
|
25
|
-
sm: { size: "sm", variant: "hollow" },
|
|
26
|
-
lg: { size: "md", variant: "hollow" }
|
|
27
|
-
}
|
|
28
|
-
};
|
|
29
|
-
const SelectContext = createContext(null);
|
|
30
|
-
const Select = forwardRef(function Select2(props, ref) {
|
|
31
|
-
[props, ref] = useContextProps(props, ref, SelectContext);
|
|
32
|
-
props = useDefaultProps(props, "Select");
|
|
33
|
-
const { children: childrenProp, classNames: classNamesProp, mapping: mappingProp, size = "lg" } = props;
|
|
34
|
-
const theme = useTheme();
|
|
35
|
-
const mapping = useMemo(() => ({
|
|
36
|
-
...defaultMapping,
|
|
37
|
-
...mappingProp
|
|
38
|
-
}), [mappingProp]);
|
|
39
|
-
const classNames = useMemo(() => mergeClassNames(selectClassNames, theme.Select, classNamesProp, {
|
|
40
|
-
description: mapping.description[size],
|
|
41
|
-
error: mapping.error[size]
|
|
42
|
-
}), [classNamesProp, theme.Select, mapping, size]);
|
|
43
|
-
const values = useMemo(() => [
|
|
44
|
-
[AriaLabelContext, { className: classNames?.label }],
|
|
45
|
-
[
|
|
46
|
-
ButtonContext,
|
|
47
|
-
{
|
|
48
|
-
...mapping.toggle[size],
|
|
49
|
-
classNames: classNames?.toggle
|
|
50
|
-
}
|
|
51
|
-
],
|
|
52
|
-
[
|
|
53
|
-
AriaSelectValueContext,
|
|
54
|
-
{
|
|
55
|
-
className: classNames?.value
|
|
56
|
-
}
|
|
57
|
-
],
|
|
58
|
-
[
|
|
59
|
-
AriaTextContext,
|
|
60
|
-
{
|
|
61
|
-
slots: {
|
|
62
|
-
description: { className: classNames?.description }
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
],
|
|
66
|
-
[AriaFieldErrorContext, { className: classNames?.error }],
|
|
67
|
-
[OptionsContext, { classNames: classNames?.options, size }]
|
|
68
|
-
], [classNames, mapping, size]);
|
|
69
|
-
const style = useCallback((renderProps) => inlineVars(selectStateVars, {
|
|
70
|
-
...renderProps,
|
|
71
|
-
size
|
|
72
|
-
}), [size]);
|
|
73
|
-
const children = useCallback((renderProps) => jsx("div", { className: classNames?.select, children: jsx(Provider, { values, children: callRenderProps(childrenProp, {
|
|
74
|
-
...renderProps,
|
|
75
|
-
defaultChildren: null
|
|
76
|
-
}) }) }), [childrenProp, values, classNames?.select]);
|
|
77
|
-
return jsx(Select$1, { ...props, ref, className: classNames?.container, style, children });
|
|
78
|
-
});
|
|
79
|
-
|
|
80
|
-
export { Select, SelectContext };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"select.js","sources":["../../../src/components/select/select.tsx"],"sourcesContent":["import {\n createContext,\n forwardRef,\n useCallback,\n useMemo,\n type ForwardedRef,\n} from 'react';\nimport {\n Select as AriaSelect,\n Provider,\n type ContextValue,\n type FieldErrorProps,\n type LabelProps,\n type SelectRenderProps as RACSelectRenderProps,\n type SelectValueProps,\n type TextProps,\n} from 'react-aria-components';\nimport { useContextProps, useDefaultProps, useTheme } from '../../hooks';\nimport { bodies } from '../../styles';\nimport { callRenderProps, inlineVars, mergeClassNames } from '../../utils';\nimport {\n AriaFieldErrorContext,\n AriaLabelContext,\n AriaSelectValueContext,\n AriaTextContext,\n} from '../aria';\nimport { ButtonContext, type ButtonProps } from '../button';\nimport { OptionsContext, type OptionsProps } from '../options';\nimport { selectClassNames, selectStateVars } from './select.css';\nimport type { SelectMapping, SelectProps } from './types';\n\nconst defaultMapping: SelectMapping = {\n description: {\n sm: bodies.xs,\n lg: bodies.xs,\n },\n error: {\n sm: bodies.xs,\n lg: bodies.xs,\n },\n toggle: {\n sm: { size: 'sm', variant: 'hollow' },\n lg: { size: 'md', variant: 'hollow' },\n },\n};\n\nexport const SelectContext =\n createContext<ContextValue<SelectProps<object>, HTMLDivElement>>(null);\n\nexport const Select = forwardRef(function Select<T extends object>(\n props: SelectProps<T>,\n ref: ForwardedRef<HTMLDivElement>,\n) {\n [props, ref] = useContextProps(props, ref, SelectContext);\n props = useDefaultProps(props, 'Select');\n\n const {\n children: childrenProp,\n classNames: classNamesProp,\n mapping: mappingProp,\n size = 'lg',\n } = props;\n\n const theme = useTheme();\n\n const mapping = useMemo(\n () => ({\n ...defaultMapping,\n ...mappingProp,\n }),\n [mappingProp],\n );\n\n const classNames = useMemo(\n () =>\n mergeClassNames(selectClassNames, theme.Select, classNamesProp, {\n description: mapping.description[size],\n error: mapping.error[size],\n }),\n [classNamesProp, theme.Select, mapping, size],\n );\n\n const values = useMemo<\n [\n [typeof AriaLabelContext, ContextValue<LabelProps, HTMLLabelElement>],\n [typeof ButtonContext, ContextValue<ButtonProps, HTMLButtonElement>],\n [\n typeof AriaSelectValueContext,\n ContextValue<SelectValueProps<object>, HTMLSpanElement>,\n ],\n [typeof AriaTextContext, ContextValue<TextProps, HTMLElement>],\n [\n typeof AriaFieldErrorContext,\n ContextValue<FieldErrorProps, HTMLElement>,\n ],\n [typeof OptionsContext, ContextValue<OptionsProps, HTMLElement>],\n ]\n >(\n () => [\n [AriaLabelContext, { className: classNames?.label }],\n [\n ButtonContext,\n {\n ...mapping.toggle[size],\n classNames: classNames?.toggle,\n },\n ],\n [\n AriaSelectValueContext,\n {\n className: classNames?.value,\n },\n ],\n [\n AriaTextContext,\n {\n slots: {\n description: { className: classNames?.description },\n },\n },\n ],\n [AriaFieldErrorContext, { className: classNames?.error }],\n [OptionsContext, { classNames: classNames?.options, size }],\n ],\n [classNames, mapping, size],\n );\n\n const style = useCallback(\n (renderProps: RACSelectRenderProps) =>\n inlineVars(selectStateVars, {\n ...renderProps,\n size,\n }),\n [size],\n );\n\n const children = useCallback(\n (renderProps: RACSelectRenderProps) => (\n <div className={classNames?.select}>\n <Provider values={values}>\n {callRenderProps(childrenProp, {\n ...renderProps,\n defaultChildren: null,\n })}\n </Provider>\n </div>\n ),\n [childrenProp, values, classNames?.select],\n );\n\n return (\n <AriaSelect\n {...props}\n ref={ref}\n className={classNames?.container}\n style={style}\n >\n {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AAA,GACP,CAAA;AAEA,EAAA,MAAM,QAAW,GAAA,WAAA;AAAA,IACf,CAAC,WACC,qBAAA,GAAA,CAAC,KAAI,EAAA,EAAA,SAAA,EAAW,UAAY,EAAA,MAAA,EAC1B,QAAC,kBAAA,GAAA,CAAA,QAAA,EAAA,EAAS,MACP,EAAA,QAAA,EAAA,eAAA,CAAgB,YAAc,EAAA;AAAA,MAC7B,GAAG,WAAA;AAAA,MACH,eAAiB,EAAA,IAAA;AAAA,KAClB,GACH,CACF,EAAA,CAAA;AAAA,IAEF,CAAC,YAAA,EAAc,MAAQ,EAAA,UAAA,EAAY,MAAM,CAAA;AAAA,GAC3C,CAAA;AAEA,EACE,uBAAA,GAAA;AAAA,IAACC,QAAA;AAAA,IAAA;AAAA,MACE,GAAG,KAAA;AAAA,MACJ,GAAA;AAAA,MACA,WAAW,UAAY,EAAA,SAAA;AAAA,MACvB,KAAA;AAAA,MAEC,QAAA;AAAA,KAAA;AAAA,GACH,CAAA;AAEJ,CAAC;;;;"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
var selectClassNames = { container: "select_selectClassNames_container__1j26mgud", select: "select_selectClassNames_select__1j26mgue", label: "select_selectClassNames_label__1j26mguf typography_label__j8fgabg", toggle: { button: "select_selectClassNames_toggle_button__1j26mgug" }, description: "select_selectClassNames_description__1j26mguh", error: "select_selectClassNames_error__1j26mgui", value: "select_selectClassNames_value__1j26mguj" };
|
|
3
|
-
var selectColorVars = { description: { color: "var(--description-color__1j26mgu1)" }, error: { color: "var(--error-color__1j26mgu2)" } };
|
|
4
|
-
var selectContainer = "select_selectContainer__1j26mgu0";
|
|
5
|
-
var selectSpaceVars = { width: "var(--width__1j26mgu3)", x: "var(--x__1j26mgu4)", y: "var(--y__1j26mgu5)" };
|
|
6
|
-
var selectStateVars = { size: "var(--size__1j26mgu6)", isDisabled: "var(--isDisabled__1j26mgu7)", isInvalid: "var(--isInvalid__1j26mgu8)", isOpen: "var(--isOpen__1j26mgu9)", isRequired: "var(--isRequired__1j26mgua)", isFocused: "var(--isFocused__1j26mgub)", isFocusVisible: "var(--isFocusVisible__1j26mguc)" };
|
|
7
|
-
|
|
8
|
-
export { selectClassNames, selectColorVars, selectContainer, selectSpaceVars, selectStateVars };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"select.vanilla.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;"}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import type { SelectProps as RACSelectProps, SelectRenderProps as RACSelectRenderProps } from 'react-aria-components';
|
|
2
|
-
import type { PartialDeep } from 'type-fest';
|
|
3
|
-
import type { AsType, OmitProtectedProps } from '../../types';
|
|
4
|
-
import type { ButtonClassNames, ButtonProps } from '../button/types';
|
|
5
|
-
import type { OptionsClassNames } from '../options/types';
|
|
6
|
-
export type SelectClassNames = PartialDeep<{
|
|
7
|
-
container: string;
|
|
8
|
-
select: string;
|
|
9
|
-
label: string;
|
|
10
|
-
toggle: ButtonClassNames;
|
|
11
|
-
value: string;
|
|
12
|
-
description: string;
|
|
13
|
-
error: string;
|
|
14
|
-
options: OptionsClassNames;
|
|
15
|
-
}>;
|
|
16
|
-
export type SelectSizes = 'sm' | 'lg';
|
|
17
|
-
export type SelectMapping = {
|
|
18
|
-
description: Partial<Record<SelectSizes, string>>;
|
|
19
|
-
error: Partial<Record<SelectSizes, string>>;
|
|
20
|
-
toggle: Partial<Record<SelectSizes, OmitProtectedProps<ButtonProps>>>;
|
|
21
|
-
};
|
|
22
|
-
type BaseSelectProps = {
|
|
23
|
-
classNames?: SelectClassNames;
|
|
24
|
-
mapping?: Partial<SelectMapping>;
|
|
25
|
-
size?: SelectSizes;
|
|
26
|
-
};
|
|
27
|
-
export type SelectRenderProps = AsType<RACSelectRenderProps>;
|
|
28
|
-
export type SelectState = SelectRenderProps & Required<Pick<BaseSelectProps, 'size'>>;
|
|
29
|
-
export type SelectProps<T extends object> = Omit<RACSelectProps<T>, 'className' | 'style'> & BaseSelectProps;
|
|
30
|
-
export {};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
export { Switch, SwitchContext } from './switch';
|
|
2
|
-
export { switchClassNames, switchColorVars, switchContainer, switchSpaceVars, switchStateVars, } from './switch.css';
|
|
3
|
-
export { type SwitchClassNames, type SwitchAlignment, type SwitchProps, type SwitchRenderProps, type SwitchState, } from './types';
|