@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,25 +0,0 @@
|
|
|
1
|
-
import type { SwitchClassNames } from './types';
|
|
2
|
-
export declare const switchContainer: string;
|
|
3
|
-
export declare const switchColorVars: {
|
|
4
|
-
border: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
5
|
-
background: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
6
|
-
color: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
7
|
-
indicator: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
8
|
-
};
|
|
9
|
-
export declare const switchSpaceVars: {
|
|
10
|
-
diameter: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
11
|
-
gutter: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
12
|
-
gap: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
13
|
-
travel: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
14
|
-
};
|
|
15
|
-
export declare const switchStateVars: {
|
|
16
|
-
alignInput: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
17
|
-
isDisabled: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
18
|
-
isFocused: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
19
|
-
isFocusVisible: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
20
|
-
isHovered: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
21
|
-
isPressed: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
22
|
-
isReadOnly: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
23
|
-
isSelected: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
24
|
-
};
|
|
25
|
-
export declare const switchClassNames: SwitchClassNames;
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { type ContextValue } from 'react-aria-components';
|
|
2
|
-
import type { SwitchProps } from './types';
|
|
3
|
-
export declare const SwitchContext: import("react").Context<ContextValue<SwitchProps, HTMLLabelElement>>;
|
|
4
|
-
export declare const Switch: (props: Omit<import("react-aria-components").SwitchProps, "children" | "className" | "style"> & import("./types").BaseSwitchProps & import("react").RefAttributes<HTMLLabelElement>) => import("react").ReactElement | null;
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
-
import { createContext, forwardRef, useMemo, useCallback } from 'react';
|
|
3
|
-
import { Switch as Switch$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 { switchClassNames, switchStateVars } from './switch.vanilla.js';
|
|
10
|
-
|
|
11
|
-
const SwitchContext = createContext(null);
|
|
12
|
-
const Switch = forwardRef(function Switch2(props, ref) {
|
|
13
|
-
[props, ref] = useContextProps(props, ref, SwitchContext);
|
|
14
|
-
props = useDefaultProps(props, "Switch");
|
|
15
|
-
const { children: childrenProp, classNames: classNamesProp, alignInput, ...rest } = props;
|
|
16
|
-
const theme = useTheme();
|
|
17
|
-
const classNames = useMemo(() => mergeClassNames(switchClassNames, theme.Switch, classNamesProp), [theme.Switch, classNamesProp]);
|
|
18
|
-
const style = useCallback(({ state, ...renderProps }) => inlineVars(switchStateVars, {
|
|
19
|
-
...renderProps,
|
|
20
|
-
alignInput
|
|
21
|
-
}), [alignInput]);
|
|
22
|
-
const children = useCallback((renderProps) => {
|
|
23
|
-
const child = callRenderProps(childrenProp, renderProps);
|
|
24
|
-
return jsxs("span", { className: classNames?.switch, children: [child && jsx("span", { className: classNames?.label, children: child }), jsx("span", { className: classNames?.indicator })] });
|
|
25
|
-
}, [
|
|
26
|
-
childrenProp,
|
|
27
|
-
classNames?.switch,
|
|
28
|
-
classNames?.label,
|
|
29
|
-
classNames?.indicator
|
|
30
|
-
]);
|
|
31
|
-
return jsx(Switch$1, { ...rest, ref, className: classNames?.container, style, children });
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
export { Switch, SwitchContext };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"switch.js","sources":["../../../src/components/switch/switch.tsx"],"sourcesContent":["import {\n type ForwardedRef,\n createContext,\n forwardRef,\n useCallback,\n useMemo,\n} from 'react';\nimport { type ContextValue, Switch as RACSwitch } from 'react-aria-components';\nimport { useContextProps, useDefaultProps, useTheme } from '../../hooks';\nimport { callRenderProps, inlineVars, mergeClassNames } from '../../utils';\nimport { switchClassNames, switchStateVars } from './switch.css';\nimport type { SwitchProps, SwitchRenderProps } from './types';\n\nexport const SwitchContext =\n createContext<ContextValue<SwitchProps, HTMLLabelElement>>(null);\n\nexport const Switch = forwardRef(function Switch(\n props: SwitchProps,\n ref: ForwardedRef<HTMLLabelElement>,\n) {\n [props, ref] = useContextProps(props, ref, SwitchContext);\n\n props = useDefaultProps(props, 'Switch');\n\n const {\n children: childrenProp,\n classNames: classNamesProp,\n alignInput,\n ...rest\n } = props;\n\n const theme = useTheme();\n\n const classNames = useMemo(\n () => mergeClassNames(switchClassNames, theme.Switch, classNamesProp),\n [theme.Switch, classNamesProp],\n );\n\n const style = useCallback(\n ({ state, ...renderProps }: SwitchRenderProps) =>\n inlineVars(switchStateVars, {\n ...renderProps,\n alignInput,\n }),\n [alignInput],\n );\n\n const children = useCallback(\n (renderProps: SwitchRenderProps) => {\n const child = callRenderProps(childrenProp, renderProps);\n\n return (\n <span className={classNames?.switch}>\n {child && <span className={classNames?.label}>{child}</span>}\n <span className={classNames?.indicator} />\n </span>\n );\n },\n [\n childrenProp,\n classNames?.switch,\n classNames?.label,\n classNames?.indicator,\n ],\n );\n\n return (\n <RACSwitch\n {...rest}\n ref={ref}\n className={classNames?.container}\n style={style}\n >\n {children}\n </RACSwitch>\n );\n});\n"],"names":["Switch","RACSwitch"],"mappings":";;;;;;;;;;;;;;;;AAaa,MAAA,aAAA,GACX,cAA2D,IAAI,EAAA;AAE1D,MAAM,MAAS,GAAA,UAAA,CAAW,SAASA,OAAAA,CACxC,OACA,GACA,EAAA;AACA,EAAA,CAAC,OAAO,GAAG,CAAA,GAAI,eAAgB,CAAA,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,EAAA,MAAA;AAAA,MACZ,UAAY,EAAA,KAAA;AAAA,MACZ,UAAY,EAAA,SAAA;AAAA,KACd;AAAA,GACF,CAAA;AAEA,EACE,uBAAA,GAAA;AAAA,IAACC,QAAA;AAAA,IAAA;AAAA,MACE,GAAG,IAAA;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 switchClassNames = { container: "switch_switchClassNames_container__1j8i4wgh", "switch": "switch_switchClassNames_switch__1j8i4wgi", label: "typography_label__j8fgabg", indicator: "switch_switchClassNames_indicator__1j8i4wgk" };
|
|
3
|
-
var switchColorVars = { border: "var(--border__1j8i4wg1)", background: "var(--background__1j8i4wg2)", color: "var(--color__1j8i4wg3)", indicator: "var(--indicator__1j8i4wg4)" };
|
|
4
|
-
var switchContainer = "switch_switchContainer__1j8i4wg0";
|
|
5
|
-
var switchSpaceVars = { diameter: "var(--diameter__1j8i4wg5)", gutter: "var(--gutter__1j8i4wg6)", gap: "var(--gap__1j8i4wg7)", travel: "var(--travel__1j8i4wg8)" };
|
|
6
|
-
var switchStateVars = { alignInput: "var(--alignInput__1j8i4wg9)", isDisabled: "var(--isDisabled__1j8i4wga)", isFocused: "var(--isFocused__1j8i4wgb)", isFocusVisible: "var(--isFocusVisible__1j8i4wgc)", isHovered: "var(--isHovered__1j8i4wgd)", isPressed: "var(--isPressed__1j8i4wge)", isReadOnly: "var(--isReadOnly__1j8i4wgf)", isSelected: "var(--isSelected__1j8i4wgg)" };
|
|
7
|
-
|
|
8
|
-
export { switchClassNames, switchColorVars, switchContainer, switchSpaceVars, switchStateVars };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"switch.vanilla.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;"}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import type { SwitchProps as RACSwitchProps, SwitchRenderProps as RACSwitchRenderProps } from 'react-aria-components';
|
|
2
|
-
import type { RenderPropsChildren } from '../../types';
|
|
3
|
-
export type SwitchClassNames = Partial<{
|
|
4
|
-
container: string;
|
|
5
|
-
switch: string;
|
|
6
|
-
label: string;
|
|
7
|
-
indicator: string;
|
|
8
|
-
}>;
|
|
9
|
-
export type SwitchAlignment = 'start' | 'end';
|
|
10
|
-
export type SwitchRenderProps = RACSwitchRenderProps;
|
|
11
|
-
export type BaseSwitchProps = {
|
|
12
|
-
children?: RenderPropsChildren<SwitchRenderProps>;
|
|
13
|
-
classNames?: SwitchClassNames;
|
|
14
|
-
alignInput?: SwitchAlignment;
|
|
15
|
-
};
|
|
16
|
-
export type SwitchState = Omit<SwitchRenderProps, 'state'> & Required<Pick<BaseSwitchProps, 'alignInput'>>;
|
|
17
|
-
export type SwitchProps = Omit<RACSwitchProps, 'children' | 'className' | 'style'> & BaseSwitchProps;
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
export { Tab, TabContext, TabList, TabListContext, TabPanel, TabPanelContext, TabPanels, TabPanelsContext, Tabs, TabsContext, } from './tabs';
|
|
2
|
-
export { tabColorVars, tabListStateVars, tabPanelStateVars, tabPanelsStateVars, tabSpaceVars, tabStateVars, tabsClassNames, tabsContainers, } from './tabs.css';
|
|
3
|
-
export { type TabListAnchor, type TabListAlignment, type TabListProps, type TabListState, type TabListVariants, type TabPanelProps, type TabPanelRenderProps, type TabPanelState, type TabPanelsProps, type TabPanelsState, type TabProps, type TabRenderProps, type TabState, type TabsClassNames, type TabsProps, } from './types';
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import type { TabsClassNames } from './types';
|
|
2
|
-
export declare const tabsContainers: {
|
|
3
|
-
list: string;
|
|
4
|
-
tab: string;
|
|
5
|
-
panels: string;
|
|
6
|
-
panel: string;
|
|
7
|
-
};
|
|
8
|
-
export declare const tabColorVars: {
|
|
9
|
-
background: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
10
|
-
border: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
11
|
-
color: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
12
|
-
};
|
|
13
|
-
export declare const tabSpaceVars: {
|
|
14
|
-
list: {
|
|
15
|
-
gap: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
16
|
-
x: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
17
|
-
y: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
18
|
-
};
|
|
19
|
-
tab: {
|
|
20
|
-
x: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
21
|
-
y: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
22
|
-
};
|
|
23
|
-
};
|
|
24
|
-
export declare const tabListStateVars: {
|
|
25
|
-
align: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
26
|
-
anchor: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
27
|
-
count: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
28
|
-
orientation: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
29
|
-
size: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
30
|
-
variant: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
31
|
-
};
|
|
32
|
-
export declare const tabStateVars: {
|
|
33
|
-
isHovered: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
34
|
-
isPressed: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
35
|
-
isSelected: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
36
|
-
isFocused: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
37
|
-
isFocusVisible: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
38
|
-
isDisabled: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
39
|
-
};
|
|
40
|
-
export declare const tabPanelsStateVars: {
|
|
41
|
-
shouldForceMount: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
42
|
-
};
|
|
43
|
-
export declare const tabPanelStateVars: {
|
|
44
|
-
shouldForceMount: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
45
|
-
isFocused: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
46
|
-
isFocusVisible: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
47
|
-
isInert: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
48
|
-
};
|
|
49
|
-
export declare const tabsClassNames: TabsClassNames;
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import { type ContextValue, type SlotProps } from 'react-aria-components';
|
|
2
|
-
import type { RequiredDeep } from 'type-fest';
|
|
3
|
-
import type { TabsClassNames, TabListProps, TabPanelProps, TabPanelsProps, TabsProps } from './types';
|
|
4
|
-
export declare const TEST_IDS: RequiredDeep<TabsClassNames>;
|
|
5
|
-
export declare const TabsContext: import("react").Context<ContextValue<TabsProps, HTMLDivElement>>;
|
|
6
|
-
/**
|
|
7
|
-
* A required wrapper for other Tabs components, which manages
|
|
8
|
-
* and provides the state context. Other Tabs components will
|
|
9
|
-
* throw an error if not wrapped with this component
|
|
10
|
-
*
|
|
11
|
-
* NOTE: TabList & TabPanels do not have to be direct children
|
|
12
|
-
* of this component. Additional layout can be introduced around
|
|
13
|
-
* this components children
|
|
14
|
-
*/
|
|
15
|
-
export declare const Tabs: (props: Omit<import("react-aria-components").TabsProps, "children" | "className" | "style"> & {
|
|
16
|
-
classNames?: TabsClassNames;
|
|
17
|
-
} & {
|
|
18
|
-
children?: import("react").ReactNode | undefined;
|
|
19
|
-
} & import("react").RefAttributes<HTMLDivElement>) => import("react").ReactElement | null;
|
|
20
|
-
export declare const TabListContext: import("react").Context<ContextValue<TabListProps<unknown>, HTMLDivElement>>;
|
|
21
|
-
/**
|
|
22
|
-
* Parent of Tab
|
|
23
|
-
*/
|
|
24
|
-
export declare const TabList: <T extends object>(props: Omit<import("react-aria-components").TabListProps<T>, "className" | "style"> & {
|
|
25
|
-
align?: import("./types").TabListAlignment;
|
|
26
|
-
anchor?: import("./types").TabListAnchor;
|
|
27
|
-
orientation?: import("react-aria").Orientation;
|
|
28
|
-
size?: import("./types").TabListSizes;
|
|
29
|
-
variant?: import("./types").TabListVariants;
|
|
30
|
-
} & {
|
|
31
|
-
classNames?: TabsClassNames;
|
|
32
|
-
} & import("react").RefAttributes<HTMLDivElement>) => import("react").ReactElement | null;
|
|
33
|
-
export declare const TabContext: import("react").Context<ContextValue<Omit<Omit<import("react-aria-components").TabProps, "className" | "style"> & {
|
|
34
|
-
id: string;
|
|
35
|
-
} & import("react-aria").PressEvents & {
|
|
36
|
-
classNames?: TabsClassNames;
|
|
37
|
-
} & SlotProps, "id">, HTMLDivElement>>;
|
|
38
|
-
/**
|
|
39
|
-
* Must be a direct child of TabList
|
|
40
|
-
*/
|
|
41
|
-
export declare const Tab: (props: Omit<import("react-aria-components").TabProps, "className" | "style"> & {
|
|
42
|
-
id: string;
|
|
43
|
-
} & import("react-aria").PressEvents & {
|
|
44
|
-
classNames?: TabsClassNames;
|
|
45
|
-
} & import("react").RefAttributes<HTMLDivElement>) => import("react").ReactElement | null;
|
|
46
|
-
export declare const TabPanelsContext: import("react").Context<ContextValue<TabPanelsProps, HTMLDivElement>>;
|
|
47
|
-
/**
|
|
48
|
-
* Parent of TabPanel, but only required if using shouldForceMount=true
|
|
49
|
-
*/
|
|
50
|
-
export declare const TabPanels: (props: {
|
|
51
|
-
shouldForceMount?: boolean;
|
|
52
|
-
} & {
|
|
53
|
-
children?: import("react").ReactNode | undefined;
|
|
54
|
-
} & {
|
|
55
|
-
classNames?: TabsClassNames;
|
|
56
|
-
} & import("react").RefAttributes<HTMLDivElement>) => import("react").ReactElement | null;
|
|
57
|
-
export declare const TabPanelContext: import("react").Context<ContextValue<Omit<TabPanelProps, "id">, HTMLDivElement>>;
|
|
58
|
-
/**
|
|
59
|
-
* Must be direct child of TabPanels if TabPanel implements shouldForceMount=true
|
|
60
|
-
*
|
|
61
|
-
* Othewise can be used anywhere inside of Tabs. TabPanels may be desirable to use
|
|
62
|
-
* if theme implements any styles that adjust layout
|
|
63
|
-
*/
|
|
64
|
-
export declare const TabPanel: (props: Omit<import("react-aria-components").TabPanelProps, "className" | "style"> & {
|
|
65
|
-
id: string;
|
|
66
|
-
} & {
|
|
67
|
-
classNames?: TabsClassNames;
|
|
68
|
-
} & import("react").RefAttributes<HTMLDivElement>) => import("react").ReactElement | null;
|
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
import { jsx } from 'react/jsx-runtime';
|
|
2
|
-
import { createContext, forwardRef, useMemo, Children, useCallback } from 'react';
|
|
3
|
-
import { useContextProps, Provider, Tabs as Tabs$1, TabList as TabList$1, Tab as Tab$1, TabPanel as TabPanel$1 } from 'react-aria-components';
|
|
4
|
-
import { inlineVars } from '../../utils/css.js';
|
|
5
|
-
import { mergeClassNames, callRenderProps } from '../../utils/props.js';
|
|
6
|
-
import { useDefaultProps } from '../../hooks/use-defaults/use-defaults.js';
|
|
7
|
-
import { usePropagatingPress } from '../../hooks/use-propagating-press/use-propagating-press.js';
|
|
8
|
-
import { useTheme } from '../../hooks/use-theme/use-theme.js';
|
|
9
|
-
import { tabsClassNames, tabListStateVars, tabPanelStateVars, tabStateVars, tabPanelsStateVars } from './tabs.vanilla.js';
|
|
10
|
-
|
|
11
|
-
const TEST_IDS = {
|
|
12
|
-
tabs: "tabs",
|
|
13
|
-
list: {
|
|
14
|
-
container: "tabs.list.container",
|
|
15
|
-
list: "tabs.list"
|
|
16
|
-
},
|
|
17
|
-
tab: {
|
|
18
|
-
container: "tabs.tab.container",
|
|
19
|
-
tab: "tabs.tab"
|
|
20
|
-
},
|
|
21
|
-
panels: {
|
|
22
|
-
container: "tabs.panels.container",
|
|
23
|
-
panels: "tabs.panels"
|
|
24
|
-
},
|
|
25
|
-
panel: {
|
|
26
|
-
container: "tabs.panel.container",
|
|
27
|
-
panel: "tabs.panel"
|
|
28
|
-
}
|
|
29
|
-
};
|
|
30
|
-
const TabsContext = createContext(null);
|
|
31
|
-
const Tabs = forwardRef(function Tabs2(props, ref) {
|
|
32
|
-
[props, ref] = useContextProps(props, ref, TabsContext);
|
|
33
|
-
props = useDefaultProps(props, "Tabs");
|
|
34
|
-
const { classNames: classNamesProp, ...rest } = props;
|
|
35
|
-
const theme = useTheme();
|
|
36
|
-
const classNames = useMemo(() => mergeClassNames(tabsClassNames, theme.Tabs, classNamesProp), [theme.Tabs, classNamesProp]);
|
|
37
|
-
const values = useMemo(() => [
|
|
38
|
-
[TabListContext, { classNames }],
|
|
39
|
-
[TabPanelsContext, { classNames }]
|
|
40
|
-
], [classNames]);
|
|
41
|
-
return jsx(Provider, { values, children: jsx(Tabs$1, { ...rest, ref, className: classNames?.tabs, "data-testid": TEST_IDS.tabs }) });
|
|
42
|
-
});
|
|
43
|
-
const TabListContext = createContext(null);
|
|
44
|
-
const TabList = forwardRef(function TabList2(props, ref) {
|
|
45
|
-
[props, ref] = useContextProps(props, ref, TabListContext);
|
|
46
|
-
props = useDefaultProps(props, "TabList");
|
|
47
|
-
const { children, classNames: classNamesProp, anchor = "end", items, orientation = "horizontal", size = "lg", variant = "border", align = orientation === "horizontal" ? "center" : "start", ...rest } = props;
|
|
48
|
-
const theme = useTheme();
|
|
49
|
-
const classNames = useMemo(() => mergeClassNames(tabsClassNames, theme.Tabs, classNamesProp), [theme.Tabs, classNamesProp]);
|
|
50
|
-
const values = useMemo(() => [[TabContext, { classNames }]], [classNames]);
|
|
51
|
-
const style = useMemo(() => inlineVars(tabListStateVars, {
|
|
52
|
-
align,
|
|
53
|
-
anchor,
|
|
54
|
-
count: items ? Array.from(items).length : Children.count(children),
|
|
55
|
-
orientation,
|
|
56
|
-
size,
|
|
57
|
-
variant
|
|
58
|
-
}), [align, anchor, items, children, orientation, size, variant]);
|
|
59
|
-
return jsx(Provider, { values, children: jsx("div", { className: classNames?.list?.container, style, "data-testid": TEST_IDS.list.container, children: jsx(TabList$1, { ...rest, ref, className: classNames?.list?.list, items, "data-testid": TEST_IDS.list.list, children }) }) });
|
|
60
|
-
});
|
|
61
|
-
const TabContext = createContext(null);
|
|
62
|
-
const Tab = forwardRef(function Tab2(props, ref) {
|
|
63
|
-
[props, ref] = useContextProps(props, ref, TabContext);
|
|
64
|
-
props = useDefaultProps(props, "Tab");
|
|
65
|
-
const { children: childrenProp, classNames: classNamesProp, onPress, onPressChange, onPressEnd, onPressStart, onPressUp, ...rest } = props;
|
|
66
|
-
const { pressProps } = usePropagatingPress({
|
|
67
|
-
onPress,
|
|
68
|
-
onPressChange,
|
|
69
|
-
onPressEnd,
|
|
70
|
-
onPressStart,
|
|
71
|
-
onPressUp
|
|
72
|
-
});
|
|
73
|
-
const theme = useTheme();
|
|
74
|
-
const classNames = useMemo(() => mergeClassNames(tabsClassNames, theme.Tabs, classNamesProp), [theme.Tabs, classNamesProp]);
|
|
75
|
-
const style = useCallback((renderProps) => inlineVars(tabStateVars, renderProps), []);
|
|
76
|
-
const children = useCallback((renderProps) => jsx("div", { ...pressProps, className: classNames?.tab?.tab, "data-testid": TEST_IDS.tab.tab, children: callRenderProps(childrenProp, {
|
|
77
|
-
...renderProps,
|
|
78
|
-
defaultChildren: null
|
|
79
|
-
}) }), [pressProps, classNames?.tab?.tab, childrenProp]);
|
|
80
|
-
return jsx(Tab$1, { ...rest, ref, className: classNames?.tab?.container, style, "data-testid": TEST_IDS.tab.container, children });
|
|
81
|
-
});
|
|
82
|
-
const TabPanelsContext = createContext(null);
|
|
83
|
-
const TabPanels = forwardRef(function TabPanels2(props, ref) {
|
|
84
|
-
[props, ref] = useContextProps(props, ref, TabPanelsContext);
|
|
85
|
-
props = useDefaultProps(props, "TabPanels");
|
|
86
|
-
const { children, classNames: classNamesProp, shouldForceMount = false } = props;
|
|
87
|
-
const theme = useTheme();
|
|
88
|
-
const classNames = useMemo(() => mergeClassNames(tabsClassNames, theme.Tabs, classNamesProp), [theme.Tabs, classNamesProp]);
|
|
89
|
-
const style = useMemo(() => inlineVars(tabPanelsStateVars, { shouldForceMount }), [shouldForceMount]);
|
|
90
|
-
const values = useMemo(() => [[TabPanelContext, { classNames, shouldForceMount }]], [classNames, shouldForceMount]);
|
|
91
|
-
return jsx(Provider, { values, children: jsx("div", { ref, className: classNames?.panels?.container, style, "data-testid": TEST_IDS.panels.container, children: jsx("div", { className: classNames?.panels?.panels, "data-testid": TEST_IDS.panels.panels, children }) }) });
|
|
92
|
-
});
|
|
93
|
-
const TabPanelContext = createContext(null);
|
|
94
|
-
const TabPanel = forwardRef(function TabPanel2(props, ref) {
|
|
95
|
-
[props, ref] = useContextProps(props, ref, TabPanelContext);
|
|
96
|
-
props = useDefaultProps(props, "TabPanel");
|
|
97
|
-
const { children: childrenProp, classNames: classNamesProp, shouldForceMount = false, ...rest } = props;
|
|
98
|
-
const theme = useTheme();
|
|
99
|
-
const classNames = useMemo(() => mergeClassNames(tabsClassNames, theme.Tabs, classNamesProp), [theme.Tabs, classNamesProp]);
|
|
100
|
-
const style = useCallback((renderProps) => inlineVars(tabPanelStateVars, { ...renderProps, shouldForceMount }), [shouldForceMount]);
|
|
101
|
-
const children = useCallback((renderProps) => jsx("div", { className: classNames?.panel?.panel, "data-testid": TEST_IDS.panel.panel, children: callRenderProps(childrenProp, {
|
|
102
|
-
...renderProps,
|
|
103
|
-
defaultChildren: null
|
|
104
|
-
}) }), [childrenProp, classNames?.panel?.panel]);
|
|
105
|
-
return jsx(TabPanel$1, { ...rest, ref, className: classNames?.panel?.container, shouldForceMount, style, "data-testid": TEST_IDS.panel.container, children });
|
|
106
|
-
});
|
|
107
|
-
|
|
108
|
-
export { TEST_IDS, Tab, TabContext, TabList, TabListContext, TabPanel, TabPanelContext, TabPanels, TabPanelsContext, Tabs, TabsContext };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tabs.js","sources":["../../../src/components/tabs/tabs.tsx"],"sourcesContent":["import {\n Children,\n createContext,\n type ForwardedRef,\n forwardRef,\n useCallback,\n useMemo,\n} from 'react';\nimport {\n type ContextValue,\n Provider,\n Tab as RACTab,\n TabList as RACTabList,\n TabPanel as RACTabPanel,\n Tabs as RACTabs,\n type SlotProps,\n useContextProps,\n} from 'react-aria-components';\nimport type { RequiredDeep } from 'type-fest';\nimport { useDefaultProps, usePropagatingPress, useTheme } from '../../hooks';\nimport { callRenderProps, inlineVars, mergeClassNames } from '../../utils';\nimport {\n tabListStateVars,\n tabPanelsStateVars,\n tabPanelStateVars,\n tabsClassNames,\n tabStateVars,\n} from './tabs.css';\nimport type {\n TabsClassNames,\n TabListProps,\n TabPanelProps,\n TabPanelRenderProps,\n TabPanelsProps,\n TabProps,\n TabRenderProps,\n TabsProps,\n} from './types';\n\nexport const TEST_IDS: RequiredDeep<TabsClassNames> = {\n tabs: 'tabs',\n list: {\n container: 'tabs.list.container',\n list: 'tabs.list',\n },\n tab: {\n container: 'tabs.tab.container',\n tab: 'tabs.tab',\n },\n panels: {\n container: 'tabs.panels.container',\n panels: 'tabs.panels',\n },\n panel: {\n container: 'tabs.panel.container',\n panel: 'tabs.panel',\n },\n};\n\nexport const TabsContext =\n createContext<ContextValue<TabsProps, HTMLDivElement>>(null);\n\n/**\n * A required wrapper for other Tabs components, which manages\n * and provides the state context. Other Tabs components will\n * throw an error if not wrapped with this component\n *\n * NOTE: TabList & TabPanels do not have to be direct children\n * of this component. Additional layout can be introduced around\n * this components children\n */\nexport const Tabs = forwardRef(function Tabs(\n props: TabsProps,\n ref: ForwardedRef<HTMLDivElement>,\n) {\n [props, ref] = useContextProps(props, ref, TabsContext);\n props = useDefaultProps(props, 'Tabs');\n\n const { classNames: classNamesProp, ...rest } = props;\n const theme = useTheme();\n\n const classNames = useMemo(\n () => mergeClassNames(tabsClassNames, theme.Tabs, classNamesProp),\n [theme.Tabs, classNamesProp],\n );\n\n const values = useMemo<\n [\n [\n typeof TabListContext,\n ContextValue<TabListProps<unknown>, HTMLDivElement>,\n ],\n [typeof TabPanelsContext, ContextValue<TabPanelsProps, HTMLDivElement>],\n ]\n >(\n () => [\n [TabListContext, { classNames }],\n [TabPanelsContext, { classNames }],\n ],\n [classNames],\n );\n\n return (\n <Provider values={values}>\n <RACTabs\n {...rest}\n ref={ref}\n className={classNames?.tabs}\n data-testid={TEST_IDS.tabs}\n />\n </Provider>\n );\n});\n\nexport const TabListContext =\n createContext<ContextValue<TabListProps<unknown>, HTMLDivElement>>(null);\n\n/**\n * Parent of Tab\n */\nexport const TabList = forwardRef(function TabList<T extends object>(\n props: TabListProps<T>,\n ref: ForwardedRef<HTMLDivElement>,\n) {\n [props, ref] = useContextProps(props, ref, TabListContext);\n props = useDefaultProps(props, 'TabList');\n\n const {\n children,\n classNames: classNamesProp,\n anchor = 'end',\n items,\n orientation = 'horizontal',\n size = 'lg',\n variant = 'border',\n align = orientation === 'horizontal' ? 'center' : 'start',\n ...rest\n } = props;\n\n const theme = useTheme();\n\n const classNames = useMemo(\n () => mergeClassNames(tabsClassNames, theme.Tabs, classNamesProp),\n [theme.Tabs, classNamesProp],\n );\n\n const values = useMemo<[[typeof TabContext, Omit<TabProps, 'id'>]]>(\n () => [[TabContext, { classNames }]],\n [classNames],\n );\n\n const style = useMemo(\n () =>\n inlineVars(tabListStateVars, {\n align,\n anchor,\n count: items ? Array.from(items).length : Children.count(children),\n orientation,\n size,\n variant,\n }),\n [align, anchor, items, children, orientation, size, variant],\n );\n\n return (\n <Provider values={values}>\n <div\n className={classNames?.list?.container}\n style={style}\n data-testid={TEST_IDS.list.container}\n >\n <RACTabList<T>\n {...rest}\n ref={ref}\n className={classNames?.list?.list}\n items={items}\n data-testid={TEST_IDS.list.list}\n >\n {children}\n </RACTabList>\n </div>\n </Provider>\n );\n});\n\nexport const TabContext =\n createContext<ContextValue<Omit<TabProps & SlotProps, 'id'>, HTMLDivElement>>(\n null,\n );\n\n/**\n * Must be a direct child of TabList\n */\nexport const Tab = forwardRef(function Tab(\n props: TabProps,\n ref: ForwardedRef<HTMLDivElement>,\n) {\n [props, ref] = useContextProps(props, ref, TabContext);\n props = useDefaultProps(props, 'Tab');\n\n const {\n children: childrenProp,\n classNames: classNamesProp,\n onPress,\n onPressChange,\n onPressEnd,\n onPressStart,\n onPressUp,\n ...rest\n } = props;\n\n const { pressProps } = usePropagatingPress({\n onPress,\n onPressChange,\n onPressEnd,\n onPressStart,\n onPressUp,\n });\n\n const theme = useTheme();\n\n const classNames = useMemo(\n () => mergeClassNames(tabsClassNames, theme.Tabs, classNamesProp),\n [theme.Tabs, classNamesProp],\n );\n\n const style = useCallback(\n (renderProps: TabRenderProps) => inlineVars(tabStateVars, renderProps),\n [],\n );\n\n const children = useCallback(\n (renderProps: TabRenderProps) => (\n <div\n {...pressProps}\n className={classNames?.tab?.tab}\n data-testid={TEST_IDS.tab.tab}\n >\n {callRenderProps(childrenProp, {\n ...renderProps,\n defaultChildren: null,\n })}\n </div>\n ),\n [pressProps, classNames?.tab?.tab, childrenProp],\n );\n\n return (\n <RACTab\n {...rest}\n ref={ref}\n className={classNames?.tab?.container}\n style={style}\n data-testid={TEST_IDS.tab.container}\n >\n {children}\n </RACTab>\n );\n});\n\nexport const TabPanelsContext =\n createContext<ContextValue<TabPanelsProps, HTMLDivElement>>(null);\n\n/**\n * Parent of TabPanel, but only required if using shouldForceMount=true\n */\nexport const TabPanels = forwardRef(function TabPanels(\n props: TabPanelsProps,\n ref: ForwardedRef<HTMLDivElement>,\n) {\n [props, ref] = useContextProps(props, ref, TabPanelsContext);\n props = useDefaultProps(props, 'TabPanels');\n\n const {\n children,\n classNames: classNamesProp,\n shouldForceMount = false,\n } = props;\n\n const theme = useTheme();\n\n const classNames = useMemo(\n () => mergeClassNames(tabsClassNames, theme.Tabs, classNamesProp),\n [theme.Tabs, classNamesProp],\n );\n\n const style = useMemo(\n () => inlineVars(tabPanelsStateVars, { shouldForceMount }),\n [shouldForceMount],\n );\n\n const values = useMemo<\n [\n [\n typeof TabPanelContext,\n ContextValue<Omit<TabPanelProps, 'id'>, HTMLDivElement>,\n ],\n ]\n >(\n () => [[TabPanelContext, { classNames, shouldForceMount }]],\n [classNames, shouldForceMount],\n );\n\n return (\n <Provider values={values}>\n <div\n ref={ref}\n className={classNames?.panels?.container}\n style={style}\n data-testid={TEST_IDS.panels.container}\n >\n <div\n className={classNames?.panels?.panels}\n data-testid={TEST_IDS.panels.panels}\n >\n {children}\n </div>\n </div>\n </Provider>\n );\n});\n\nexport const TabPanelContext =\n createContext<ContextValue<Omit<TabPanelProps, 'id'>, HTMLDivElement>>(null);\n\n/**\n * Must be direct child of TabPanels if TabPanel implements shouldForceMount=true\n *\n * Othewise can be used anywhere inside of Tabs. TabPanels may be desirable to use\n * if theme implements any styles that adjust layout\n */\nexport const TabPanel = forwardRef(function TabPanel(\n props: TabPanelProps,\n ref: ForwardedRef<HTMLDivElement>,\n) {\n [props, ref] = useContextProps(props, ref, TabPanelContext);\n props = useDefaultProps(props, 'TabPanel');\n\n const {\n children: childrenProp,\n classNames: classNamesProp,\n shouldForceMount = false,\n ...rest\n } = props;\n\n const theme = useTheme();\n\n const classNames = useMemo(\n () => mergeClassNames(tabsClassNames, theme.Tabs, classNamesProp),\n [theme.Tabs, classNamesProp],\n );\n\n const style = useCallback(\n (renderProps: TabPanelRenderProps) =>\n inlineVars(tabPanelStateVars, { ...renderProps, shouldForceMount }),\n [shouldForceMount],\n );\n\n const children = useCallback(\n (renderProps: TabPanelRenderProps) => (\n <div\n className={classNames?.panel?.panel}\n data-testid={TEST_IDS.panel.panel}\n >\n {callRenderProps(childrenProp, {\n ...renderProps,\n defaultChildren: null,\n })}\n </div>\n ),\n [childrenProp, classNames?.panel?.panel],\n );\n\n return (\n <RACTabPanel\n {...rest}\n ref={ref}\n className={classNames?.panel?.container}\n shouldForceMount={shouldForceMount}\n style={style}\n data-testid={TEST_IDS.panel.container}\n >\n {children}\n </RACTabPanel>\n );\n});\n"],"names":["Tabs","RACTabs","TabList","RACTabList","Tab","RACTab","TabPanels","TabPanel","RACTabPanel"],"mappings":";;;;;;;;;;;;;;;;AAuCO,MAAM,QAAyC,GAAA;AAAA,EACpD,IAAM,EAAA,MAAA;AAAA,EACN,IAAM,EAAA;AAAA,IACJ,SAAW,EAAA,qBAAA;AAAA,IACX,IAAM,EAAA,WAAA;AAAA,GACR;AAAA,EACA,GAAK,EAAA;AAAA,IACH,SAAW,EAAA,oBAAA;AAAA,IACX,GAAK,EAAA,UAAA;AAAA,GACP;AAAA,EACA,MAAQ,EAAA;AAAA,IACN,SAAW,EAAA,uBAAA;AAAA,IACX,MAAQ,EAAA,aAAA;AAAA,GACV;AAAA,EACA,KAAO,EAAA;AAAA,IACL,SAAW,EAAA,sBAAA;AAAA,IACX,KAAO,EAAA,YAAA;AAAA,GACT;AACF,EAAA;AAEa,MAAA,WAAA,GACX,cAAuD,IAAI,EAAA;AAWtD,MAAM,IAAO,GAAA,UAAA,CAAW,SAASA,KAAAA,CACtC,OACA,GACA,EAAA;AACA,EAAA,CAAC,OAAO,GAAG,CAAA,GAAI,eAAgB,CAAA,KAAA,EAAO,KAAK,WAAW,CAAA,CAAA;AACtD,EAAQ,KAAA,GAAA,eAAA,CAAgB,OAAO,MAAM,CAAA,CAAA;AAErC,EAAA,MAAM,EAAE,UAAA,EAAY,cAAgB,EAAA,GAAG,MAAS,GAAA,KAAA,CAAA;AAChD,EAAA,MAAM,QAAQ,QAAS,EAAA,CAAA;AAEvB,EAAA,MAAM,UAAa,GAAA,OAAA;AAAA,IAC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(--color__plnfe26)" };
|
|
3
|
-
var tabListStateVars = { align: "var(--align__plnfe2c)", anchor: "var(--anchor__plnfe2d)", count: "var(--count__plnfe2e)", orientation: "var(--orientation__plnfe2f)", size: "var(--size__plnfe2g)", variant: "var(--variant__plnfe2h)" };
|
|
4
|
-
var tabPanelStateVars = { shouldForceMount: "var(--shouldForceMount__plnfe2p)", isFocused: "var(--isFocused__plnfe2q)", isFocusVisible: "var(--isFocusVisible__plnfe2r)", isInert: "var(--isInert__plnfe2s)" };
|
|
5
|
-
var tabPanelsStateVars = { shouldForceMount: "var(--shouldForceMount__plnfe2o)" };
|
|
6
|
-
var tabSpaceVars = { list: { gap: "var(--list-gap__plnfe27)", x: "var(--list-x__plnfe28)", y: "var(--list-y__plnfe29)" }, tab: { x: "var(--tab-x__plnfe2a)", y: "var(--tab-y__plnfe2b)" } };
|
|
7
|
-
var tabStateVars = { isHovered: "var(--isHovered__plnfe2i)", isPressed: "var(--isPressed__plnfe2j)", isSelected: "var(--isSelected__plnfe2k)", isFocused: "var(--isFocused__plnfe2l)", isFocusVisible: "var(--isFocusVisible__plnfe2m)", isDisabled: "var(--isDisabled__plnfe2n)" };
|
|
8
|
-
var tabsClassNames = { tabs: "tabs_tabsClassNames_tabs__plnfe2t", list: { container: "tabs_tabsClassNames_list_container__plnfe2u", list: "tabs_tabsClassNames_list_list__plnfe2v" }, tab: { container: "tabs_tabsClassNames_tab_container__plnfe2w", tab: "tabs_tabsClassNames_tab_tab__plnfe2x typography_label__j8fgabg" }, panels: { container: "tabs_tabsClassNames_panels_container__plnfe2y", panels: "tabs_tabsClassNames_panels_panels__plnfe2z" }, panel: { container: "tabs_tabsClassNames_panel_container__plnfe210", panel: "tabs_tabsClassNames_panel_panel__plnfe211" } };
|
|
9
|
-
var tabsContainers = { list: "tabs_tabsContainers_list__plnfe20", tab: "tabs_tabsContainers_tab__plnfe21", panels: "tabs_tabsContainers_panels__plnfe22", panel: "tabs_tabsContainers_panel__plnfe23" };
|
|
10
|
-
|
|
11
|
-
export { tabColorVars, tabListStateVars, tabPanelStateVars, tabPanelsStateVars, tabSpaceVars, tabStateVars, tabsClassNames, tabsContainers };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tabs.vanilla.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;"}
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
import type { AsType } from '../../types';
|
|
2
|
-
import type { PropsWithChildren } from 'react';
|
|
3
|
-
import type { Orientation, PressEvents } from 'react-aria';
|
|
4
|
-
import type { TabListProps as RACTabListProps, TabPanelProps as RACTabPanelProps, TabPanelRenderProps as RACTabPanelRenderProps, TabProps as RACTabProps, TabRenderProps as RACTabRenderProps, TabsProps as RACTabsProps } from 'react-aria-components';
|
|
5
|
-
import type { PartialDeep } from 'type-fest';
|
|
6
|
-
export type TabsClassNames = PartialDeep<{
|
|
7
|
-
tabs: string;
|
|
8
|
-
list: {
|
|
9
|
-
container: string;
|
|
10
|
-
list: string;
|
|
11
|
-
};
|
|
12
|
-
tab: {
|
|
13
|
-
container: string;
|
|
14
|
-
tab: string;
|
|
15
|
-
};
|
|
16
|
-
panels: {
|
|
17
|
-
container: string;
|
|
18
|
-
panels: string;
|
|
19
|
-
};
|
|
20
|
-
panel: {
|
|
21
|
-
container: string;
|
|
22
|
-
panel: string;
|
|
23
|
-
};
|
|
24
|
-
}>;
|
|
25
|
-
export type TabListVariants = 'border' | 'fill';
|
|
26
|
-
export type TabListAnchor = 'start' | 'end';
|
|
27
|
-
export type TabListAlignment = 'start' | 'center' | 'end';
|
|
28
|
-
export type TabListSizes = 'sm' | 'lg';
|
|
29
|
-
export type TabRenderProps = AsType<RACTabRenderProps>;
|
|
30
|
-
export type TabPanelRenderProps = AsType<RACTabPanelRenderProps>;
|
|
31
|
-
type BaseProps = {
|
|
32
|
-
classNames?: TabsClassNames;
|
|
33
|
-
};
|
|
34
|
-
type BaseTabListProps = {
|
|
35
|
-
align?: TabListAlignment;
|
|
36
|
-
/**
|
|
37
|
-
* To be combined with orientation, where:
|
|
38
|
-
* orientation=horizontal + anchor=end = bottom
|
|
39
|
-
* orientation=horizontal + anchor=start = top
|
|
40
|
-
* orientation=vertical + anchor=end = right
|
|
41
|
-
* orientation=vertical + anchor=start = left
|
|
42
|
-
*/
|
|
43
|
-
anchor?: TabListAnchor;
|
|
44
|
-
orientation?: Orientation;
|
|
45
|
-
size?: TabListSizes;
|
|
46
|
-
variant?: TabListVariants;
|
|
47
|
-
};
|
|
48
|
-
type BaseTabProps = {
|
|
49
|
-
/**
|
|
50
|
-
* Must match cooresponding TabPanel id, should be
|
|
51
|
-
* unique to all other ids
|
|
52
|
-
*/
|
|
53
|
-
id: string;
|
|
54
|
-
} & PressEvents;
|
|
55
|
-
type BaseTabPanelsProps = PropsWithChildren<{
|
|
56
|
-
/**
|
|
57
|
-
* Setting this to true will apply to all panels and
|
|
58
|
-
* change the layout to a stacked approach that grows
|
|
59
|
-
* to the size of the largest panel content, no matter
|
|
60
|
-
* which panel is active
|
|
61
|
-
*/
|
|
62
|
-
shouldForceMount?: boolean;
|
|
63
|
-
}>;
|
|
64
|
-
type BaseTabPanelProps = {
|
|
65
|
-
/**
|
|
66
|
-
* Must match cooresponding Tab id, should be unique
|
|
67
|
-
* to all other ids
|
|
68
|
-
*/
|
|
69
|
-
id: string;
|
|
70
|
-
};
|
|
71
|
-
export type TabListState = Required<BaseTabListProps> & {
|
|
72
|
-
count: number;
|
|
73
|
-
};
|
|
74
|
-
export type TabState = AsType<RACTabRenderProps>;
|
|
75
|
-
export type TabPanelsState = Required<Pick<BaseTabPanelsProps, 'shouldForceMount'>>;
|
|
76
|
-
export type TabPanelState = Omit<TabPanelRenderProps, 'state'> & Required<Pick<RACTabPanelProps, 'shouldForceMount'>>;
|
|
77
|
-
export type TabsProps = Omit<RACTabsProps, 'children' | 'className' | 'style'> & PropsWithChildren<BaseProps>;
|
|
78
|
-
export type TabListProps<T> = Omit<RACTabListProps<T>, 'className' | 'style'> & BaseTabListProps & BaseProps;
|
|
79
|
-
export type TabProps = Omit<RACTabProps, 'className' | 'style'> & BaseTabProps & BaseProps;
|
|
80
|
-
export type TabPanelsProps = BaseTabPanelsProps & BaseProps;
|
|
81
|
-
export type TabPanelProps = Omit<RACTabPanelProps, 'className' | 'style'> & BaseTabPanelProps & BaseProps;
|
|
82
|
-
export {};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
export { TextArea, TextAreaContext } from './textarea';
|
|
2
|
-
export { textAreaClassNames, textAreaContainer, textAreaColorVars, textAreaSpaceVars, textAreaStateVars, } from './textarea.css';
|
|
3
|
-
export { type TextAreaClassNames, type TextAreaProps, type TextAreaRenderProps, type TextAreaState, } from './types';
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import type { TextAreaClassNames } from './types';
|
|
2
|
-
export declare const textAreaContainer: string;
|
|
3
|
-
export declare const textAreaColorVars: {
|
|
4
|
-
background: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
5
|
-
border: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
6
|
-
color: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
7
|
-
};
|
|
8
|
-
export declare const textAreaSpaceVars: {
|
|
9
|
-
minWidth: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
10
|
-
width: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
11
|
-
maxWidth: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
12
|
-
minHeight: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
13
|
-
height: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
14
|
-
maxHeight: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
15
|
-
x: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
16
|
-
y: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
17
|
-
};
|
|
18
|
-
export declare const textAreaStateVars: {
|
|
19
|
-
resize: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
20
|
-
size: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
21
|
-
isDisabled: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
22
|
-
isEmpty: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
23
|
-
isFocused: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
24
|
-
isFocusVisible: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
25
|
-
isHovered: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
26
|
-
isInvalid: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
27
|
-
isPlaceholder: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
28
|
-
isReadOnly: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
29
|
-
isRequired: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
30
|
-
};
|
|
31
|
-
export declare const textAreaClassNames: TextAreaClassNames;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { type ContextValue, type TextAreaProps as RACTextAreaProps } from 'react-aria-components';
|
|
2
|
-
import type { TextAreaProps } from './types';
|
|
3
|
-
export declare const TextAreaContext: import("react").Context<ContextValue<TextAreaProps, HTMLTextAreaElement>>;
|
|
4
|
-
/**
|
|
5
|
-
* We implement a textarea as a content editable span to provide
|
|
6
|
-
* improved UX, where the input area automatically grows with input
|
|
7
|
-
* content length. This can be overriden by applying max-height
|
|
8
|
-
* and overflow CSS, if desired.
|
|
9
|
-
*
|
|
10
|
-
* This also has the side effect of changing the target element in
|
|
11
|
-
* the ref and event handlers. The normal `event.target.value` is not
|
|
12
|
-
* available, and must be substituted with `event.currentTarget.textContent`
|
|
13
|
-
*/
|
|
14
|
-
export declare const TextArea: (props: Omit<RACTextAreaProps, "children" | "className" | "style" | "onChange" | "cols" | "rows"> & import("./types").BaseTextAreaProps & import("react").RefAttributes<HTMLTextAreaElement>) => import("react").ReactElement | null;
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
import { jsx } from 'react/jsx-runtime';
|
|
2
|
-
import { useControlledState } from '@react-stately/utils';
|
|
3
|
-
import { createContext, forwardRef, useMemo, useCallback, useEffect } from 'react';
|
|
4
|
-
import { useFocusRing, useHover } from 'react-aria';
|
|
5
|
-
import { useContextProps, TextAreaContext as TextAreaContext$1 } from 'react-aria-components';
|
|
6
|
-
import { inlineVars } from '../../utils/css.js';
|
|
7
|
-
import { mergeClassNames, mergeProps } from '../../utils/props.js';
|
|
8
|
-
import { useDefaultProps } from '../../hooks/use-defaults/use-defaults.js';
|
|
9
|
-
import { useTheme } from '../../hooks/use-theme/use-theme.js';
|
|
10
|
-
import { inputs } from '../../styles/typography.vanilla.js';
|
|
11
|
-
import { textAreaClassNames, textAreaStateVars } from './textarea.vanilla.js';
|
|
12
|
-
|
|
13
|
-
const defaultMapping = {
|
|
14
|
-
font: inputs
|
|
15
|
-
};
|
|
16
|
-
const TextAreaContext = createContext(null);
|
|
17
|
-
const TextArea = forwardRef(function TextArea2(props, ref) {
|
|
18
|
-
[props, ref] = useContextProps(props, ref, TextAreaContext$1);
|
|
19
|
-
delete props.className;
|
|
20
|
-
delete props.style;
|
|
21
|
-
[props, ref] = useContextProps(props, ref, TextAreaContext);
|
|
22
|
-
props = useDefaultProps(props, "TextArea");
|
|
23
|
-
const { classNames: classNamesProp, defaultValue = "", disabled: isDisabled = false, mapping: mappingProp, placeholder, readOnly: isReadOnly = false, required: isRequired = false, resize = "none", size = "lg", value: valueProp, onChange, onHoverStart, onHoverChange, onHoverEnd, "aria-invalid": ariaInvalid, ...rest } = props;
|
|
24
|
-
const [value, setValue] = useControlledState(valueProp, defaultValue);
|
|
25
|
-
const isInvalid = !!ariaInvalid && ariaInvalid !== "false";
|
|
26
|
-
const isPlaceholder = !!placeholder && !value;
|
|
27
|
-
const isEmpty = !value;
|
|
28
|
-
const { isFocused, isFocusVisible, focusProps } = useFocusRing({
|
|
29
|
-
autoFocus: props.autoFocus,
|
|
30
|
-
isTextInput: true
|
|
31
|
-
});
|
|
32
|
-
const { hoverProps, isHovered } = useHover({
|
|
33
|
-
isDisabled,
|
|
34
|
-
onHoverStart,
|
|
35
|
-
onHoverChange,
|
|
36
|
-
onHoverEnd
|
|
37
|
-
});
|
|
38
|
-
const theme = useTheme();
|
|
39
|
-
const mapping = useMemo(() => ({
|
|
40
|
-
...defaultMapping,
|
|
41
|
-
...mappingProp
|
|
42
|
-
}), [mappingProp]);
|
|
43
|
-
const classNames = useMemo(() => mergeClassNames(textAreaClassNames, theme.TextArea, classNamesProp, {
|
|
44
|
-
textarea: mapping.font[size]
|
|
45
|
-
}), [theme.TextArea, classNamesProp, mapping.font, size]);
|
|
46
|
-
const mergedProps = useMemo(() => mergeProps(rest, focusProps, hoverProps), [focusProps, hoverProps, rest]);
|
|
47
|
-
const style = useMemo(() => inlineVars(textAreaStateVars, {
|
|
48
|
-
resize,
|
|
49
|
-
size,
|
|
50
|
-
isDisabled,
|
|
51
|
-
isEmpty,
|
|
52
|
-
isFocused,
|
|
53
|
-
isFocusVisible,
|
|
54
|
-
isHovered,
|
|
55
|
-
isInvalid,
|
|
56
|
-
isPlaceholder,
|
|
57
|
-
isReadOnly,
|
|
58
|
-
isRequired
|
|
59
|
-
}), [
|
|
60
|
-
resize,
|
|
61
|
-
size,
|
|
62
|
-
isDisabled,
|
|
63
|
-
isEmpty,
|
|
64
|
-
isFocused,
|
|
65
|
-
isFocusVisible,
|
|
66
|
-
isHovered,
|
|
67
|
-
isInvalid,
|
|
68
|
-
isPlaceholder,
|
|
69
|
-
isReadOnly,
|
|
70
|
-
isRequired
|
|
71
|
-
]);
|
|
72
|
-
const handleChange = useCallback((event) => {
|
|
73
|
-
onChange?.(event);
|
|
74
|
-
if (!event.defaultPrevented) {
|
|
75
|
-
setValue(event.currentTarget.textContent ?? "");
|
|
76
|
-
}
|
|
77
|
-
}, [onChange, setValue]);
|
|
78
|
-
useEffect(() => {
|
|
79
|
-
if (typeof ref !== "function" && ref?.current) {
|
|
80
|
-
ref.current.textContent = `${value ?? ""}`;
|
|
81
|
-
}
|
|
82
|
-
}, [ref, value]);
|
|
83
|
-
return jsx("div", { className: classNames?.container, style, children: jsx("span", { ...mergedProps, ...hoverProps, ref, className: classNames?.textarea, contentEditable: !isDisabled && !isReadOnly, role: "textbox", suppressContentEditableWarning: true, onInput: handleChange, "aria-invalid": ariaInvalid, "data-placeholder": placeholder }) });
|
|
84
|
-
});
|
|
85
|
-
|
|
86
|
-
export { TextArea, TextAreaContext };
|