@app-studio/components 0.12.0 → 0.12.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/alert.cjs.js +1 -1
- package/dist/alert.esm.mjs +1 -1
- package/dist/avatar.cjs.js +1 -1
- package/dist/avatar.esm.mjs +1 -1
- package/dist/button.cjs.js +1 -1
- package/dist/button.esm.mjs +1 -1
- package/dist/card.cjs.js +1 -1
- package/dist/card.esm.mjs +1 -1
- package/dist/checkbox.cjs.js +1 -1
- package/dist/checkbox.esm.mjs +1 -1
- package/dist/chunks/{Alert-Q1HlVX8f.mjs → Alert-B5vkpWXy.mjs} +55 -42
- package/dist/chunks/Alert-B5vkpWXy.mjs.map +1 -0
- package/dist/chunks/Alert-BHlgJZAo.cjs +2 -0
- package/dist/chunks/Alert-BHlgJZAo.cjs.map +1 -0
- package/dist/chunks/{AttachmentPreview-8d8gZ5kk.mjs → AttachmentPreview-B2-kP0Bn.mjs} +1745 -2997
- package/dist/chunks/AttachmentPreview-B2-kP0Bn.mjs.map +1 -0
- package/dist/chunks/AttachmentPreview-BZV6xSa4.cjs +2 -0
- package/dist/chunks/AttachmentPreview-BZV6xSa4.cjs.map +1 -0
- package/dist/chunks/{Avatar-D-GkyL2c.mjs → Avatar-CC1SDq6h.mjs} +34 -32
- package/dist/chunks/Avatar-CC1SDq6h.mjs.map +1 -0
- package/dist/chunks/Avatar-DtfD7QQ6.cjs +2 -0
- package/dist/chunks/Avatar-DtfD7QQ6.cjs.map +1 -0
- package/dist/chunks/Button.core-BB25t8wB.cjs +7 -0
- package/dist/chunks/Button.core-BB25t8wB.cjs.map +1 -0
- package/dist/chunks/{Button.core-Bc5cSn_z.mjs → Button.core-oxCH_VTn.mjs} +236 -222
- package/dist/chunks/Button.core-oxCH_VTn.mjs.map +1 -0
- package/dist/chunks/Button.pilot-BJK10U1-.mjs +6 -0
- package/dist/chunks/{Button.pilot-C4BIb08S.mjs.map → Button.pilot-BJK10U1-.mjs.map} +1 -1
- package/dist/chunks/Button.pilot-eWGY9Jm5.cjs +2 -0
- package/dist/chunks/{Button.pilot-JmR2DCSE.cjs.map → Button.pilot-eWGY9Jm5.cjs.map} +1 -1
- package/dist/chunks/Card-CK_D7gzP.cjs +2 -0
- package/dist/chunks/Card-CK_D7gzP.cjs.map +1 -0
- package/dist/chunks/Card-ymI5Thma.mjs +208 -0
- package/dist/chunks/Card-ymI5Thma.mjs.map +1 -0
- package/dist/chunks/Checkbox-BXbEChdd.cjs +2 -0
- package/dist/chunks/Checkbox-BXbEChdd.cjs.map +1 -0
- package/dist/chunks/Checkbox-DnwrApdj.mjs +21 -0
- package/dist/chunks/Checkbox-DnwrApdj.mjs.map +1 -0
- package/dist/chunks/Checkbox.view-B7K8ycvs.cjs +2 -0
- package/dist/chunks/Checkbox.view-B7K8ycvs.cjs.map +1 -0
- package/dist/chunks/{Checkbox.view-dhc-rfEX.mjs → Checkbox.view-CCGfVtqr.mjs} +140 -119
- package/dist/chunks/Checkbox.view-CCGfVtqr.mjs.map +1 -0
- package/dist/chunks/{Formik.Uploader-DRIyxMI0.mjs → Formik.Uploader-CIYySBWB.mjs} +18 -18
- package/dist/chunks/{Formik.Uploader-DRIyxMI0.mjs.map → Formik.Uploader-CIYySBWB.mjs.map} +1 -1
- package/dist/chunks/{Formik.Uploader-D0nzjyau.cjs → Formik.Uploader-DePTdd7A.cjs} +4 -4
- package/dist/chunks/{Formik.Uploader-D0nzjyau.cjs.map → Formik.Uploader-DePTdd7A.cjs.map} +1 -1
- package/dist/chunks/{Icon-DrAZswNH.mjs → Icon-Cy5kEVYz.mjs} +60 -60
- package/dist/chunks/{Icon-DrAZswNH.mjs.map → Icon-Cy5kEVYz.mjs.map} +1 -1
- package/dist/chunks/Modal-BzlrQQu5.cjs +2 -0
- package/dist/chunks/Modal-BzlrQQu5.cjs.map +1 -0
- package/dist/chunks/{Modal-DkckCT8-.mjs → Modal-CqbUQXoc.mjs} +92 -75
- package/dist/chunks/Modal-CqbUQXoc.mjs.map +1 -0
- package/dist/chunks/Select-CrOxhfvQ.mjs +28 -0
- package/dist/chunks/Select-CrOxhfvQ.mjs.map +1 -0
- package/dist/chunks/Select-DRMUC3NX.cjs +2 -0
- package/dist/chunks/Select-DRMUC3NX.cjs.map +1 -0
- package/dist/chunks/{Select.view-CPMqT8pn.mjs → Select.view-BHMiRNIc.mjs} +126 -124
- package/dist/chunks/Select.view-BHMiRNIc.mjs.map +1 -0
- package/dist/chunks/Select.view-BV01zWHM.cjs +2 -0
- package/dist/chunks/Select.view-BV01zWHM.cjs.map +1 -0
- package/dist/chunks/{Switch-DWx1g3jT.mjs → Switch-04GGHGrV.mjs} +2 -2
- package/dist/chunks/{Switch-DWx1g3jT.mjs.map → Switch-04GGHGrV.mjs.map} +1 -1
- package/dist/chunks/{Switch-D80yPNFV.cjs → Switch-DqgmPp8M.cjs} +2 -2
- package/dist/chunks/{Switch-D80yPNFV.cjs.map → Switch-DqgmPp8M.cjs.map} +1 -1
- package/dist/chunks/Switch.view-6ncV6Ifz.cjs +2 -0
- package/dist/chunks/Switch.view-6ncV6Ifz.cjs.map +1 -0
- package/dist/chunks/{Switch.view-QLZ7O5Z7.mjs → Switch.view-DUvFLhyy.mjs} +34 -39
- package/dist/chunks/Switch.view-DUvFLhyy.mjs.map +1 -0
- package/dist/chunks/Tabs-BdoE88Ee.mjs +567 -0
- package/dist/chunks/Tabs-BdoE88Ee.mjs.map +1 -0
- package/dist/chunks/Tabs-DneEt-le.cjs +2 -0
- package/dist/chunks/Tabs-DneEt-le.cjs.map +1 -0
- package/dist/chunks/{TextField-DOU2CL5J.mjs → TextField-Bwc_F2Rq.mjs} +97 -86
- package/dist/chunks/TextField-Bwc_F2Rq.mjs.map +1 -0
- package/dist/chunks/TextField-CwaxvcqN.cjs +2 -0
- package/dist/chunks/TextField-CwaxvcqN.cjs.map +1 -0
- package/dist/chunks/{default-nRKhMTzF.mjs → default-1F10zins.mjs} +2 -2
- package/dist/chunks/{default-nRKhMTzF.mjs.map → default-1F10zins.mjs.map} +1 -1
- package/dist/chunks/default-W-NMTEJ3.cjs +2 -0
- package/dist/chunks/default-W-NMTEJ3.cjs.map +1 -0
- package/dist/chunks/designSystem.page-BgmjSYsz.cjs +11 -0
- package/dist/chunks/designSystem.page-BgmjSYsz.cjs.map +1 -0
- package/dist/chunks/{designSystem.page-K0ajTvy7.mjs → designSystem.page-CM_h09Ui.mjs} +18 -16
- package/dist/chunks/designSystem.page-CM_h09Ui.mjs.map +1 -0
- package/dist/chunks/{FieldWrapper-Bb0j8Iog.mjs → useFieldDesignSystemProps-BZj7d9gK.mjs} +118 -87
- package/dist/chunks/useFieldDesignSystemProps-BZj7d9gK.mjs.map +1 -0
- package/dist/chunks/useFieldDesignSystemProps-CgVU3R10.cjs +2 -0
- package/dist/chunks/useFieldDesignSystemProps-CgVU3R10.cjs.map +1 -0
- package/dist/design-system-preview.cjs.js +1 -1
- package/dist/design-system-preview.esm.mjs +14 -14
- package/dist/formik.cjs.js +1 -1
- package/dist/formik.esm.mjs +2 -2
- package/dist/link.esm.mjs +1 -1
- package/dist/modal.cjs.js +1 -1
- package/dist/modal.esm.mjs +1 -1
- package/dist/native/components/ActionSheet/ActionSheet/ActionSheet.view.native.js +13 -5
- package/dist/native/components/ActionSheet/ActionSheet/ActionSheet.view.native.js.map +1 -1
- package/dist/native/components/Alert/Alert/Alert.view.d.ts +3 -1
- package/dist/native/components/Alert/Alert/Alert.view.js +16 -6
- package/dist/native/components/Alert/Alert/Alert.view.js.map +1 -1
- package/dist/native/components/Alert/Alert/Alert.view.native.d.ts +3 -1
- package/dist/native/components/Alert/Alert/Alert.view.native.js +15 -4
- package/dist/native/components/Alert/Alert/Alert.view.native.js.map +1 -1
- package/dist/native/components/Alert/Alert.js +3 -3
- package/dist/native/components/Alert/Alert.js.map +1 -1
- package/dist/native/components/Avatar/Avatar/Avatar.props.d.ts +1 -1
- package/dist/native/components/Avatar/Avatar/Avatar.state.d.ts +2 -2
- package/dist/native/components/Avatar/Avatar/Avatar.state.js +6 -5
- package/dist/native/components/Avatar/Avatar/Avatar.state.js.map +1 -1
- package/dist/native/components/Avatar/Avatar/Avatar.view.d.ts +1 -1
- package/dist/native/components/Avatar/Avatar/Avatar.view.js +2 -2
- package/dist/native/components/Avatar/Avatar/Avatar.view.js.map +1 -1
- package/dist/native/components/Avatar/Avatar.js +2 -2
- package/dist/native/components/Avatar/Avatar.js.map +1 -1
- package/dist/native/components/Button/Button/Button.style.js +11 -6
- package/dist/native/components/Button/Button/Button.style.js.map +1 -1
- package/dist/native/components/Button/Button/Button.view.d.ts +2 -0
- package/dist/native/components/Button/Button/Button.view.js +9 -3
- package/dist/native/components/Button/Button/Button.view.js.map +1 -1
- package/dist/native/components/Button/Button/Button.view.native.d.ts +1 -0
- package/dist/native/components/Button/Button/Button.view.native.js +19 -4
- package/dist/native/components/Button/Button/Button.view.native.js.map +1 -1
- package/dist/native/components/Button/Button.core.js +3 -3
- package/dist/native/components/Button/Button.core.js.map +1 -1
- package/dist/native/components/Card/Card/Card.view.d.ts +3 -1
- package/dist/native/components/Card/Card/Card.view.js +32 -24
- package/dist/native/components/Card/Card/Card.view.js.map +1 -1
- package/dist/native/components/Card/Card.js +3 -3
- package/dist/native/components/Card/Card.js.map +1 -1
- package/dist/native/components/Form/Checkbox/Checkbox/Checkbox.props.d.ts +1 -0
- package/dist/native/components/Form/Checkbox/Checkbox/Checkbox.state.d.ts +5 -1
- package/dist/native/components/Form/Checkbox/Checkbox/Checkbox.state.js +13 -0
- package/dist/native/components/Form/Checkbox/Checkbox/Checkbox.state.js.map +1 -1
- package/dist/native/components/Form/Checkbox/Checkbox/Checkbox.style.d.ts +3 -12
- package/dist/native/components/Form/Checkbox/Checkbox/Checkbox.style.js +3 -12
- package/dist/native/components/Form/Checkbox/Checkbox/Checkbox.style.js.map +1 -1
- package/dist/native/components/Form/Checkbox/Checkbox/Checkbox.view.js +19 -16
- package/dist/native/components/Form/Checkbox/Checkbox/Checkbox.view.js.map +1 -1
- package/dist/native/components/Form/Checkbox/Checkbox/Checkbox.view.native.js +36 -30
- package/dist/native/components/Form/Checkbox/Checkbox/Checkbox.view.native.js.map +1 -1
- package/dist/native/components/Form/Checkbox/Checkbox.js +3 -3
- package/dist/native/components/Form/Checkbox/Checkbox.js.map +1 -1
- package/dist/native/components/Form/DatePicker/DatePicker/DatePicker.state.js +8 -2
- package/dist/native/components/Form/DatePicker/DatePicker/DatePicker.state.js.map +1 -1
- package/dist/native/components/Form/Select/Select/Select.props.d.ts +1 -0
- package/dist/native/components/Form/Select/Select/Select.view.js +2 -2
- package/dist/native/components/Form/Select/Select/Select.view.js.map +1 -1
- package/dist/native/components/Form/Select/Select/Select.view.native.js +17 -4
- package/dist/native/components/Form/Select/Select/Select.view.native.js.map +1 -1
- package/dist/native/components/Form/Select/Select.js +3 -3
- package/dist/native/components/Form/Select/Select.js.map +1 -1
- package/dist/native/components/Form/Switch/Switch/Switch.style.d.ts +3 -8
- package/dist/native/components/Form/Switch/Switch/Switch.style.js +3 -8
- package/dist/native/components/Form/Switch/Switch/Switch.style.js.map +1 -1
- package/dist/native/components/Form/Switch/Switch/Switch.view.js +1 -5
- package/dist/native/components/Form/Switch/Switch/Switch.view.js.map +1 -1
- package/dist/native/components/Form/Switch/Switch/Switch.view.native.js +7 -4
- package/dist/native/components/Form/Switch/Switch/Switch.view.native.js.map +1 -1
- package/dist/native/components/Form/TextField/TextField/TextField.props.d.ts +1 -0
- package/dist/native/components/Form/TextField/TextField/TextField.view.js +2 -2
- package/dist/native/components/Form/TextField/TextField/TextField.view.js.map +1 -1
- package/dist/native/components/Form/TextField/TextField/TextField.view.native.js +9 -4
- package/dist/native/components/Form/TextField/TextField/TextField.view.native.js.map +1 -1
- package/dist/native/components/Form/TextField/TextField.js +3 -3
- package/dist/native/components/Form/TextField/TextField.js.map +1 -1
- package/dist/native/components/Input/FieldContent/FieldContent/FieldContent.props.d.ts +1 -0
- package/dist/native/components/Input/FieldContent/FieldContent.js +16 -3
- package/dist/native/components/Input/FieldContent/FieldContent.js.map +1 -1
- package/dist/native/components/Input/useFieldDesignSystemProps.d.ts +9 -0
- package/dist/native/components/Input/useFieldDesignSystemProps.js +15 -0
- package/dist/native/components/Input/useFieldDesignSystemProps.js.map +1 -0
- package/dist/native/components/Modal/Modal/Modal.props.d.ts +2 -0
- package/dist/native/components/Modal/Modal/Modal.view.js +6 -4
- package/dist/native/components/Modal/Modal/Modal.view.js.map +1 -1
- package/dist/native/components/Modal/Modal/Modal.view.native.js +5 -4
- package/dist/native/components/Modal/Modal/Modal.view.native.js.map +1 -1
- package/dist/native/components/Tabs/Tabs/TabHeader.d.ts +2 -0
- package/dist/native/components/Tabs/Tabs/TabHeader.js +7 -6
- package/dist/native/components/Tabs/Tabs/TabHeader.js.map +1 -1
- package/dist/native/components/Tabs/Tabs/Tabs.props.d.ts +10 -0
- package/dist/native/components/Tabs/Tabs/Tabs.state.d.ts +1 -0
- package/dist/native/components/Tabs/Tabs/Tabs.state.js +20 -43
- package/dist/native/components/Tabs/Tabs/Tabs.state.js.map +1 -1
- package/dist/native/components/Tabs/Tabs/Tabs.styles.d.ts +11 -0
- package/dist/native/components/Tabs/Tabs/Tabs.styles.js +7 -0
- package/dist/native/components/Tabs/Tabs/Tabs.styles.js.map +1 -0
- package/dist/native/components/Tabs/Tabs/Tabs.type.d.ts +4 -0
- package/dist/native/components/Tabs/Tabs/Tabs.view.js +146 -58
- package/dist/native/components/Tabs/Tabs/Tabs.view.js.map +1 -1
- package/dist/native/components/Tabs/Tabs/Tabs.view.native.js +83 -19
- package/dist/native/components/Tabs/Tabs/Tabs.view.native.js.map +1 -1
- package/dist/native/components/Tabs/Tabs.js +8 -8
- package/dist/native/components/Tabs/Tabs.js.map +1 -1
- package/dist/native/components/index.js +1 -1
- package/dist/native/components/index.js.map +1 -1
- package/dist/native/components/pilot/blocks/SettingsPanel.js +3 -1
- package/dist/native/components/pilot/blocks/SettingsPanel.js.map +1 -1
- package/dist/native/components/pilot/blocks/SignIn.js +3 -1
- package/dist/native/components/pilot/blocks/SignIn.js.map +1 -1
- package/dist/native/design-system/DesignSystemProvider.d.ts +1 -1
- package/dist/native/design-system/DesignSystemProvider.js +2 -2
- package/dist/native/design-system/DesignSystemProvider.js.map +1 -1
- package/dist/native/design-system/configs/default.json +1 -1
- package/dist/native/design-system/theme.d.ts +10 -1
- package/dist/native/design-system/theme.js +41 -12
- package/dist/native/design-system/theme.js.map +1 -1
- package/dist/native/design-system/types.d.ts +3 -9
- package/dist/native/design-system/utils.d.ts +5 -2
- package/dist/native/design-system/utils.js +42 -10
- package/dist/native/design-system/utils.js.map +1 -1
- package/dist/presets.cjs.js +1 -1
- package/dist/presets.esm.mjs +1 -1
- package/dist/registry/alert.json +13 -12
- package/dist/registry/avatar.json +15 -15
- package/dist/registry/button.json +14 -12
- package/dist/registry/card.json +13 -13
- package/dist/registry/checkbox.json +14 -11
- package/dist/registry/modal.json +8 -4
- package/dist/registry/registry.json +178 -78
- package/dist/registry/select.json +20 -12
- package/dist/registry/settings-panel.json +6 -2
- package/dist/registry/sign-in.json +6 -2
- package/dist/registry/switch.json +15 -15
- package/dist/registry/tabs.json +23 -18
- package/dist/registry/text-field.json +19 -11
- package/dist/registry/theme.json +71 -0
- package/dist/select.cjs.js +1 -1
- package/dist/select.esm.mjs +1 -1
- package/dist/settings-panel.cjs.js +1 -1
- package/dist/settings-panel.cjs.js.map +1 -1
- package/dist/settings-panel.esm.mjs +9 -9
- package/dist/settings-panel.esm.mjs.map +1 -1
- package/dist/sign-in.cjs.js +1 -1
- package/dist/sign-in.cjs.js.map +1 -1
- package/dist/sign-in.esm.mjs +15 -15
- package/dist/sign-in.esm.mjs.map +1 -1
- package/dist/switch.cjs.js +1 -1
- package/dist/switch.esm.mjs +1 -1
- package/dist/tabs.cjs.js +1 -1
- package/dist/tabs.esm.mjs +1 -1
- package/dist/text-field.cjs.js +1 -1
- package/dist/text-field.esm.mjs +1 -1
- package/dist/theme.cjs.js +1 -1
- package/dist/theme.cjs.js.map +1 -1
- package/dist/theme.esm.mjs +125 -72
- package/dist/theme.esm.mjs.map +1 -1
- package/dist/types/components/Alert/Alert/Alert.view.d.ts +3 -1
- package/dist/types/components/Avatar/Avatar/Avatar.props.d.ts +1 -1
- package/dist/types/components/Avatar/Avatar/Avatar.state.d.ts +2 -2
- package/dist/types/components/Avatar/Avatar/Avatar.view.d.ts +1 -1
- package/dist/types/components/Button/Button/Button.view.d.ts +2 -0
- package/dist/types/components/Card/Card/Card.view.d.ts +3 -1
- package/dist/types/components/Form/Checkbox/Checkbox/Checkbox.props.d.ts +1 -0
- package/dist/types/components/Form/Checkbox/Checkbox/Checkbox.state.d.ts +5 -1
- package/dist/types/components/Form/Checkbox/Checkbox/Checkbox.style.d.ts +3 -12
- package/dist/types/components/Form/Select/Select/Select.props.d.ts +1 -0
- package/dist/types/components/Form/Switch/Switch/Switch.style.d.ts +3 -8
- package/dist/types/components/Form/TextField/TextField/TextField.props.d.ts +1 -0
- package/dist/types/components/IconPicker/IconPicker/IconPicker.state.d.ts +2 -2
- package/dist/types/components/Input/FieldContent/FieldContent/FieldContent.props.d.ts +1 -0
- package/dist/types/components/Input/useFieldDesignSystemProps.d.ts +9 -0
- package/dist/types/components/Modal/Modal/Modal.props.d.ts +2 -0
- package/dist/types/components/Tabs/Tabs/TabHeader.d.ts +2 -0
- package/dist/types/components/Tabs/Tabs/Tabs.props.d.ts +10 -0
- package/dist/types/components/Tabs/Tabs/Tabs.state.d.ts +1 -0
- package/dist/types/components/Tabs/Tabs/Tabs.styles.d.ts +11 -0
- package/dist/types/components/Tabs/Tabs/Tabs.type.d.ts +4 -0
- package/dist/types/design-system/DesignSystemProvider.d.ts +1 -1
- package/dist/types/design-system/configs/default.json.d.ts +1 -1
- package/dist/types/design-system/theme.d.ts +10 -1
- package/dist/types/design-system/types.d.ts +3 -9
- package/dist/types/design-system/utils.d.ts +5 -2
- package/dist/web.cjs.js +16 -16
- package/dist/web.esm.mjs +44 -41
- package/dist/web.umd.js +38 -38
- package/dist/web.umd.js.map +1 -1
- package/docs/getting-started/react-native.md +17 -3
- package/docs/guides/performance.mdx +5 -0
- package/docs/guides/react-native.mdx +10 -0
- package/docs/guides/registry-guide.mdx +72 -8
- package/package.json +6 -4
- package/dist/chunks/Alert-Bjl40k3x.cjs +0 -2
- package/dist/chunks/Alert-Bjl40k3x.cjs.map +0 -1
- package/dist/chunks/Alert-Q1HlVX8f.mjs.map +0 -1
- package/dist/chunks/AttachmentPreview-8d8gZ5kk.mjs.map +0 -1
- package/dist/chunks/AttachmentPreview-Bwrz5TJh.cjs +0 -2
- package/dist/chunks/AttachmentPreview-Bwrz5TJh.cjs.map +0 -1
- package/dist/chunks/Avatar-BB0DeN9j.cjs +0 -2
- package/dist/chunks/Avatar-BB0DeN9j.cjs.map +0 -1
- package/dist/chunks/Avatar-D-GkyL2c.mjs.map +0 -1
- package/dist/chunks/Button.core-Bc5cSn_z.mjs.map +0 -1
- package/dist/chunks/Button.core-BhtOm8ak.cjs +0 -7
- package/dist/chunks/Button.core-BhtOm8ak.cjs.map +0 -1
- package/dist/chunks/Button.pilot-C4BIb08S.mjs +0 -6
- package/dist/chunks/Button.pilot-JmR2DCSE.cjs +0 -2
- package/dist/chunks/Card-CNSl9fD5.cjs +0 -2
- package/dist/chunks/Card-CNSl9fD5.cjs.map +0 -1
- package/dist/chunks/Card-DMhV_NTt.mjs +0 -200
- package/dist/chunks/Card-DMhV_NTt.mjs.map +0 -1
- package/dist/chunks/Checkbox-Bo7IRVRE.mjs +0 -11
- package/dist/chunks/Checkbox-Bo7IRVRE.mjs.map +0 -1
- package/dist/chunks/Checkbox-CAI6RtuO.cjs +0 -2
- package/dist/chunks/Checkbox-CAI6RtuO.cjs.map +0 -1
- package/dist/chunks/Checkbox.view-DGdNPlF9.cjs +0 -2
- package/dist/chunks/Checkbox.view-DGdNPlF9.cjs.map +0 -1
- package/dist/chunks/Checkbox.view-dhc-rfEX.mjs.map +0 -1
- package/dist/chunks/FieldWrapper-Bb0j8Iog.mjs.map +0 -1
- package/dist/chunks/FieldWrapper-DRCn7BLi.cjs +0 -2
- package/dist/chunks/FieldWrapper-DRCn7BLi.cjs.map +0 -1
- package/dist/chunks/Modal-DkckCT8-.mjs.map +0 -1
- package/dist/chunks/Modal-zok954As.cjs +0 -2
- package/dist/chunks/Modal-zok954As.cjs.map +0 -1
- package/dist/chunks/Select-C6R0Tei-.cjs +0 -2
- package/dist/chunks/Select-C6R0Tei-.cjs.map +0 -1
- package/dist/chunks/Select-C7IBNyjR.mjs +0 -24
- package/dist/chunks/Select-C7IBNyjR.mjs.map +0 -1
- package/dist/chunks/Select.view-CPMqT8pn.mjs.map +0 -1
- package/dist/chunks/Select.view-Pq1yAcMm.cjs +0 -2
- package/dist/chunks/Select.view-Pq1yAcMm.cjs.map +0 -1
- package/dist/chunks/Switch.view-CQZO_Js7.cjs +0 -2
- package/dist/chunks/Switch.view-CQZO_Js7.cjs.map +0 -1
- package/dist/chunks/Switch.view-QLZ7O5Z7.mjs.map +0 -1
- package/dist/chunks/Tabs-D5chMrkE.mjs +0 -403
- package/dist/chunks/Tabs-D5chMrkE.mjs.map +0 -1
- package/dist/chunks/Tabs-DQeBJwkz.cjs +0 -2
- package/dist/chunks/Tabs-DQeBJwkz.cjs.map +0 -1
- package/dist/chunks/TextField-DOU2CL5J.mjs.map +0 -1
- package/dist/chunks/TextField-Da4JCcAU.cjs +0 -2
- package/dist/chunks/TextField-Da4JCcAU.cjs.map +0 -1
- package/dist/chunks/default-D7ePSMKP.cjs +0 -2
- package/dist/chunks/default-D7ePSMKP.cjs.map +0 -1
- package/dist/chunks/designSystem.page-B74Vm2Dt.cjs +0 -11
- package/dist/chunks/designSystem.page-B74Vm2Dt.cjs.map +0 -1
- package/dist/chunks/designSystem.page-K0ajTvy7.mjs.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Modal-zok954As.cjs","sources":["../../src/components/Modal/Modal/Modal.store.tsx","../../src/components/Modal/Modal/Modal.style.ts","../../src/components/Modal/Modal/Modal.view.tsx","../../src/components/Modal/Modal/Modal.layout.tsx","../../src/components/Modal/Modal.tsx"],"sourcesContent":["import { create } from 'zustand';\n// Defines the structure for a single modal instance managed by the store.\nexport interface ModalItem {\n // A unique string identifier for the modal.\n name: string;\n // An object containing properties to be passed to the modal component, including its visibility state.\n props: any & { isVisible: boolean };\n // An object containing properties for the modal's overlay component.\n overlayProps: any;\n}\n// Defines the overall state shape and available actions for the modal store.\nexport interface ModalState {\n // An array holding all currently active modal items.\n modals: ModalItem[];\n // Function to add a new modal to the state, making it visible.\n show: (name: string, modalProps?: any, overlayProps?: any) => void;\n // Function to remove a modal from the state, making it hidden.\n hide: (name?: string) => void;\n // A callback function executed when a modal is shown, allowing custom side effects.\n onShow: (name: string, props?: any) => void;\n // A callback function executed when a modal is hidden, allowing custom side effects.\n onHide: (name?: string) => void;\n // Function to set or update the 'onShow' callback in the store.\n setOnShow: (onShow: (name: string, props?: any) => void) => void;\n // Function to set or update the 'onHide' callback in the store.\n setOnHide: (onHide: (name?: string) => void) => void;\n}\n// Initializes the Zustand store for managing modal states and actions.\nexport const useModalStore = create<ModalState>((set) => ({\n // The initial state property: an empty array of modals.\n modals: [],\n // Default implementation for the 'onHide' callback.\n onHide: (name?: string) => name,\n // Default implementation for the 'onShow' callback.\n onShow: (name: string, props?: any) => ({ name, props }),\n // Action to add a new modal to the 'modals' array, setting its 'isVisible' prop to true.\n show: (name, modalProps = {}, overlayProps = {}) => {\n set((state: ModalState) => ({\n ...state,\n modals: [\n ...state.modals,\n {\n name,\n props: { ...modalProps, isVisible: true },\n overlayProps,\n },\n ],\n }));\n },\n // Action to remove a modal from the 'modals' array based on its name, or clear all modals if no name is provided.\n hide: (name) => {\n set((state: ModalState) => {\n if (!name) {\n return { modals: [] };\n }\n return {\n ...state,\n modals: state.modals.filter((modal) => modal.name !== name),\n };\n });\n },\n // Action to update the 'onHide' callback function within the store.\n setOnHide: (onHide: (name?: string) => void) => {\n set((state: ModalState) => ({ ...state, onHide }));\n },\n // Action to update the 'onShow' callback function within the store.\n setOnShow: (onShow: (name: string, props?: any) => void) => {\n set((state: ModalState) => ({ ...state, onShow }));\n },\n}));\n// A convenience function to programmatically display a modal and trigger its 'onShow' callback.\nexport const showModal = (\n name: string,\n modalProps: any = {},\n overlayProps: any = {}\n) => {\n // Calls the 'show' action from the modal store to add the modal to the state.\n useModalStore.getState().show(name, modalProps, overlayProps);\n // Triggers the registered 'onShow' callback for the newly shown modal, allowing external effects.\n useModalStore.getState().onShow(name, modalProps);\n};\n// A convenience function to programmatically hide a modal and trigger its 'onHide' callback.\nexport const hideModal = (name?: string) => {\n // Triggers the registered 'onHide' callback for the hidden modal, allowing external effects.\n useModalStore.getState().onHide(name);\n // Calls the 'hide' action from the modal store to remove the modal from the state.\n useModalStore.getState().hide(typeof name === 'string' ? name : undefined);\n};\n","import { ViewProps } from 'app-studio';\nimport { Shape, Size } from './Modal.type';\n// Defines a mapping of modal container shapes to their corresponding border-radius styles.\nexport const ContainerShapes: Record<Shape, ViewProps> = {\n square: { borderRadius: 0 },\n rounded: { borderRadius: 8 },\n};\n// Specifies various alignment configurations for the modal's overlay content.\nexport const OverlayAlignments: Record<string, ViewProps> = {\n center: { justifyContent: 'center', alignItems: 'center' },\n top: {\n justifyContent: 'center',\n alignItems: 'flex-start',\n },\n right: {\n justifyContent: 'flex-end',\n alignItems: 'center',\n },\n bottom: {\n justifyContent: 'center',\n alignItems: 'flex-end',\n },\n left: {\n justifyContent: 'flex-start',\n alignItems: 'center',\n },\n};\n// Maps predefined size categories to specific pixel values for modal header icons.\nexport const HeaderIconSizes: Record<Size, number> = {\n xs: 12,\n sm: 16,\n md: 20,\n lg: 24,\n xl: 28,\n};\n// Contains keyframe definitions for the modal's entry and exit animations, including opacity and transform.\nexport const ModalAnimations = {\n enter: {\n opacity: [0, 1],\n transform: ['scale(0.95)', 'scale(1)'],\n transition: 'opacity 0.2s ease-out, transform 0.2s ease-out',\n },\n exit: {\n opacity: [1, 0],\n transform: ['scale(1)', 'scale(0.95)'],\n transition: 'opacity 0.15s ease-in, transform 0.15s ease-in',\n },\n};\n// Provides the default background and transition styles for the modal overlay.\nexport const OverlayStyles: ViewProps = {\n backgroundColor: 'color-dark-50-240',\n transition: 'background-color 0.2s ease',\n};\n// Sets the foundational background, shadow, and focus styles for the modal's content container.\nexport const ContainerBaseStyles: ViewProps = {\n backgroundColor: 'color-white',\n boxShadow: '0 10px 30px rgba(0, 0, 0, 0.12)',\n transition: 'box-shadow 0.2s ease',\n _focusVisible: {\n outline: 'none',\n boxShadow: '0 0 0 2px color-white, 0 0 0 4px theme-primary',\n },\n};\n// Groups typography settings for the modal's title and body text, including font size, weight, and color.\nexport const ModalTypography = {\n title: {\n fontSize: '20px',\n fontWeight: '600',\n lineHeight: '28px',\n color: 'color-gray-900',\n },\n body: {\n fontSize: '16px',\n fontWeight: '400',\n lineHeight: '24px',\n color: 'color-gray-700',\n },\n};\n","import React, { useCallback, useEffect, useMemo, useRef } from 'react';\nimport {\n Element,\n View,\n Horizontal,\n ViewProps,\n Vertical,\n Center,\n} from 'app-studio';\nimport { CloseIcon } from '../../Icon/FixedIcons';\nimport { hideModal } from './Modal.store';\nimport {\n BodyProps,\n ContainerProps,\n FooterProps,\n HeaderProps,\n} from '../Modal/Modal.props';\nimport {\n ContainerShapes,\n OverlayAlignments,\n HeaderIconSizes,\n ModalTypography,\n} from '../Modal/Modal.style';\nimport { Position } from './Modal.type';\n// Defines the properties available for configuring the ModalOverlay component, enabling customization of its appearance and behavior.\nexport interface OverlayProps {\n // Specifies custom style properties for the modal's internal container and view elements, allowing for granular visual adjustments.\n views?: {\n container?: ViewProps;\n view?: ViewProps;\n };\n // Sets the blur radius for the backdrop effect behind the modal, enhancing visual distinction and focus on the modal content.\n blur?: number;\n // Determines the visibility state of the modal overlay. When true, the modal is shown; when false, it is hidden.\n isOpen?: boolean;\n // A flag indicating whether clicking the overlay outside the modal content should trigger the onClose event, preventing accidental closures.\n isClosePrevented?: boolean;\n // A callback function that executes when the modal is requested to close, typically due to user interaction or internal logic.\n onClose?: () => void;\n // Dictates the alignment of the modal content within the overlay, such as 'center', 'top-left', etc.\n position?: Position;\n // The React nodes that will be rendered as the main content inside the modal overlay.\n children?: React.ReactNode;\n}\n// The ModalOverlay component serves as the backdrop and container for any modal content, managing its visibility and global positioning. It applies a customizable blur effect and handles close interactions.\nexport const ModalOverlay: React.FC<OverlayProps & any> = React.memo(\n ({\n children,\n blur,\n isOpen = false,\n isClosePrevented = false,\n onClose = () => {},\n position = 'center',\n views,\n ...props\n }) => {\n const dialog = useRef<HTMLDivElement>(null);\n const handleClick = useCallback(() => {\n if (!isClosePrevented) onClose();\n }, [isClosePrevented, onClose]);\n\n function focusable(node: HTMLElement) {\n return Array.from(\n node.querySelectorAll<HTMLElement>(\n 'a[href], button, input, select, textarea, [tabindex], [contenteditable=true]'\n )\n ).filter(\n (element) =>\n element.tabIndex >= 0 &&\n !element.matches(':disabled, input[type=hidden]') &&\n !element.closest('[hidden], [inert], [aria-hidden=true]') &&\n element.ownerDocument.defaultView?.getComputedStyle(element)\n .visibility !== 'hidden'\n );\n }\n\n useEffect(() => {\n const node = dialog.current;\n if (!isOpen || !node) return;\n const trigger = node.ownerDocument.activeElement as HTMLElement | null;\n (focusable(node)[0] ?? node).focus();\n return () => {\n if (trigger?.isConnected) trigger.focus();\n };\n }, [isOpen]);\n\n function handleKeyDown(event: React.KeyboardEvent<HTMLDivElement>) {\n if (event.defaultPrevented) return;\n if (event.key === 'Escape' && !isClosePrevented) {\n event.preventDefault();\n event.stopPropagation();\n handleClick();\n }\n if (event.key !== 'Tab') return;\n const node = event.currentTarget;\n const elements = focusable(node);\n const active = node.ownerDocument.activeElement;\n const atEdge =\n active === node ||\n active === (event.shiftKey ? elements[0] : elements.at(-1));\n if (!elements.length || atEdge) {\n event.preventDefault();\n (elements.at(event.shiftKey ? -1 : 0) ?? node).focus();\n }\n }\n\n return (\n <Center\n position=\"fixed\"\n top={0}\n left={0}\n width=\"100%\"\n height=\"100%\"\n zIndex={1000}\n onClick={handleClick}\n visibility={isOpen ? 'visible' : 'hidden'}\n opacity={isOpen ? 1 : 0}\n transition=\"opacity 0.2s ease, visibility 0.2s ease\"\n {...views?.container}\n >\n <Element\n as=\"div\"\n ref={dialog}\n tabIndex={-1}\n role=\"dialog\"\n aria-modal={isOpen || undefined}\n aria-hidden={!isOpen || undefined}\n aria-label=\"Dialog\"\n onKeyDown={handleKeyDown}\n position=\"absolute\"\n top={0}\n left={0}\n zIndex={1000}\n width=\"100vw\"\n height=\"100vh\"\n display=\"flex\"\n backgroundColor=\"color-dark-50-360\"\n backdropFilter={blur ? `blur(${blur}px)` : undefined}\n transition=\"background-color 0.2s ease, backdrop-filter 0.2s ease\"\n {...OverlayAlignments[position]}\n {...props}\n {...views?.view}\n >\n {children}\n </Element>\n </Center>\n );\n }\n);\nconst webShadow = {\n boxShadow: '0px 4px 16px rgba(0, 0, 0, 0.15)',\n};\nexport const ModalContainer: React.FC<ContainerProps> = React.memo(\n ({\n children,\n shadow,\n isFullScreen = false,\n shape = 'rounded',\n views,\n isOpen = true,\n // Strip ContainerProps's domain `position` (Modal-specific enum) so it\n // doesn't reach the underlying Vertical which expects CSS Property.Position.\n position: _position,\n ...props\n }) => {\n const defaultShadow = webShadow;\n const handleClick = useCallback((event: any) => {\n if (event && event.stopPropagation) event.stopPropagation();\n }, []);\n return (\n <Vertical\n cursor=\"default\"\n backgroundColor=\"color-white\"\n width={isFullScreen ? '100%' : 600}\n height={isFullScreen ? '100%' : 'fit-content'}\n onClick={handleClick}\n transition=\"opacity 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease\"\n opacity={isOpen ? 1 : 0}\n transform={isOpen ? 'translateY(0)' : 'translateY(8px)'}\n {...(shadow ? shadow : defaultShadow)}\n {...ContainerShapes[shape]}\n media={{\n mobile: {\n width: '90%',\n maxWidth: '100%',\n margin: '16px',\n },\n }}\n {...props}\n {...views?.container}\n >\n {children}\n </Vertical>\n );\n }\n);\nexport const ModalHeader: React.FC<HeaderProps> = React.memo(\n ({\n children,\n buttonColor = 'theme-primary',\n iconSize = 'md',\n buttonSize,\n buttonPosition = 'right',\n views,\n onClose: onCloseProp,\n ...props\n }) => {\n const onClose = onCloseProp ? onCloseProp : hideModal;\n const buttonIcon = (\n <View onClick={() => onClose()}>\n <CloseIcon\n widthHeight={HeaderIconSizes[buttonSize ?? iconSize]}\n color={buttonColor}\n />\n </View>\n );\n return (\n <Horizontal\n justifyContent={buttonPosition === 'none' ? 'center' : 'space-between'}\n alignItems=\"center\"\n paddingVertical={16}\n paddingHorizontal={24}\n borderBottomWidth=\"1px\"\n borderBottomStyle=\"solid\"\n borderBottomColor=\"color-gray-200\"\n media={{\n mobile: {\n paddingVertical: 12,\n paddingHorizontal: 16,\n },\n }}\n {...props}\n {...views?.header}\n >\n {buttonPosition === 'left' && buttonIcon}\n {children}\n {buttonPosition === 'right' && buttonIcon}\n </Horizontal>\n );\n }\n);\nexport const ModalBody: React.FC<BodyProps> = React.memo(\n ({ children, views, ...props }) => {\n return (\n <View\n paddingVertical={16}\n paddingHorizontal={24}\n fontSize={ModalTypography.body.fontSize}\n fontWeight={ModalTypography.body.fontWeight}\n color={ModalTypography.body.color}\n media={{\n mobile: {\n paddingVertical: 12,\n paddingHorizontal: 16,\n fontSize: '14px',\n },\n }}\n {...props}\n {...views?.view}\n >\n {children}\n </View>\n );\n }\n);\nexport const ModalFooter: React.FC<FooterProps> = React.memo(\n ({ children, views, ...props }) => {\n return (\n <Horizontal\n marginTop=\"auto\"\n alignItems=\"center\"\n justifyContent=\"flex-end\"\n paddingVertical={16}\n paddingHorizontal={24}\n borderTopWidth=\"1px\"\n borderTopStyle=\"solid\"\n borderTopColor=\"color-gray-200\"\n gap={12}\n media={{\n mobile: {\n paddingVertical: 12,\n paddingHorizontal: 16,\n gap: 8,\n },\n }}\n {...props}\n {...views?.container}\n >\n {children}\n </Horizontal>\n );\n }\n);\n","import React, { Fragment, useEffect } from 'react';\nimport { ModalState, hideModal, useModalStore } from './Modal.store';\nimport { ModalOverlay } from './Modal.view';\nimport { ModalLayoutProps } from './Modal.props';\n// Defines the `ModalLayout` functional component, which is responsible for orchestrating and rendering multiple active modals based on their state.\nexport const ModalLayout = ({\n // Prop: `availableModals` is an object containing all possible modal components, keyed by their unique names, allowing for dynamic selection and rendering.\n modals: availableModals,\n // Prop: `onShow` is an optional callback function to be executed whenever a modal is displayed.\n onShow,\n // Prop: `onHide` is an optional callback function to be executed whenever a modal is hidden.\n onHide,\n}: ModalLayoutProps) => {\n // Retrieves the list of currently active modals from the global modal store, determining which modals need to be rendered.\n const activeModals = useModalStore((state: ModalState) => state.modals);\n // Synchronizes the `onShow` callback prop with the modal store's internal `setOnShow` action, ensuring the store can trigger this callback.\n useEffect(() => {\n if (onShow) {\n useModalStore.getState().setOnShow(onShow);\n }\n }, [onShow]);\n // Synchronizes the `onHide` callback prop with the modal store's internal `setOnHide` action, ensuring the store can trigger this callback.\n useEffect(() => {\n if (onHide) {\n useModalStore.getState().setOnHide(onHide);\n }\n }, [onHide]);\n // Conditionally renders nothing if there are no active modals, optimizing performance by avoiding unnecessary component trees.\n if (activeModals.length === 0) {\n return null;\n }\n return (\n <Fragment>\n {activeModals.map((modal: any, index: number) => {\n const ModalComponent = availableModals[modal.name];\n if (!ModalComponent) {\n console.error(`${modal.name} modal doesn't exist`);\n return null;\n }\n return (\n <ModalOverlay\n key={index}\n isOpen={modal.props.isVisible}\n onClose={() => hideModal(modal.name)}\n blur={5}\n {...modal.overlayProps}\n style={{ zIndex: 1000 + index }}\n >\n <ModalComponent {...modal.props} />\n </ModalOverlay>\n );\n })}\n </Fragment>\n );\n};\n","import React from 'react';\nimport { ModalType } from './Modal/Modal.props';\nimport {\n ModalBody,\n ModalContainer,\n ModalFooter,\n ModalHeader,\n ModalOverlay,\n} from './Modal/Modal.view';\nimport { ModalLayout } from './Modal/Modal.layout';\n// This file defines the main Modal component, which acts as a compound component. It groups and exports various sub-components (Overlay, Container, Header, Body, Footer, and Layout) as static properties, providing a flexible and structured way to compose modal dialogs.\nexport const Modal: ModalType = ({ children }) => <>{children}</>;\nModal.Overlay = ModalOverlay;\nModal.Container = ModalContainer;\nModal.Header = ModalHeader;\nModal.Body = ModalBody;\nModal.Footer = ModalFooter;\nModal.Layout = ModalLayout;\nexport * from './Modal/Modal.store';\n\n// Surface the registry renderer as standalone named exports. `ModalRouter` is\n// the documented name for the app-demo \"modal router\" pattern: mount it once\n// (e.g. via `AppRoot modals={...}`), then call `showModal('Name', props)` /\n// `hideModal('Name')` from anywhere to drive named modals from the store.\nexport { ModalLayout } from './Modal/Modal.layout';\nexport { ModalLayout as ModalRouter } from './Modal/Modal.layout';\n"],"names":["useModalStore","create","set","name","props","modalProps","overlayProps","state","modal","onHide","onShow","showModal","hideModal","ContainerShapes","OverlayAlignments","HeaderIconSizes","ModalTypography","ModalOverlay","React","children","blur","isOpen","isClosePrevented","onClose","position","views","dialog","useRef","handleClick","useCallback","focusable","node","element","_a","useEffect","trigger","handleKeyDown","event","elements","active","atEdge","jsx","Center","Element","webShadow","ModalContainer","shadow","isFullScreen","shape","_position","defaultShadow","Vertical","ModalHeader","buttonColor","iconSize","buttonSize","buttonPosition","onCloseProp","buttonIcon","View","CloseIcon","jsxs","Horizontal","ModalBody","ModalFooter","ModalLayout","availableModals","activeModals","Fragment","index","ModalComponent","Modal"],"mappings":"yJA4BaA,EAAgBC,EAAAA,OAAoBC,IAAS,CAExD,OAAQ,CAAA,EAER,OAASC,GAAkBA,EAE3B,OAAQ,CAACA,EAAcC,KAAiB,CAAE,KAAAD,EAAM,MAAAC,CAAA,GAEhD,KAAM,CAACD,EAAME,EAAa,CAAA,EAAIC,EAAe,CAAA,IAAO,CAClDJ,EAAKK,IAAuB,CAC1B,GAAGA,EACH,OAAQ,CACN,GAAGA,EAAM,OACT,CACE,KAAAJ,EACA,MAAO,CAAE,GAAGE,EAAY,U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AAA,CAAA,CAAS,EAC9DoD,EAAM,QAAUtD,EAChBsD,EAAM,UAAY1B,EAClB0B,EAAM,OAASnB,EACfmB,EAAM,KAAOR,EACbQ,EAAM,OAASP,EACfO,EAAM,OAASN"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";const i=require("react/jsx-runtime"),n=require("./Select.view-Pq1yAcMm.cjs"),r=require("../theme.cjs.js"),l=c=>{const e=r.useMergedDesignSystemComponentProps("select",c),t={...e,options:e.options||[]},s=n.useSelectState(t);return i.jsx(n.SelectView,{...s,...t,value:s.value,onClick:o=>{o.stopPropagation(),e.onClick&&e.onClick(o)}})},u=l;exports.Select=u;
|
|
2
|
-
//# sourceMappingURL=Select-C6R0Tei-.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Select-C6R0Tei-.cjs","sources":["../../src/components/Form/Select/Select.tsx"],"sourcesContent":["import React from 'react';\nimport { SelectProps } from './Select/Select.props';\nimport { useSelectState } from './Select/Select.state';\nimport SelectView from './Select/Select.view';\nimport { useMergedDesignSystemComponentProps } from 'src/design-system/theme';\n\n// Defines a functional component named 'SelectComponent', which is expected to receive 'SelectProps' as properties.\nconst SelectComponent: React.FC<SelectProps> = (props) => {\n const mergedProps = useMergedDesignSystemComponentProps('select', props);\n // Ensure options is always an array\n const safeProps = {\n ...mergedProps,\n options: mergedProps.options || [],\n };\n\n // Invokes the 'useSelectState' hook with props to obtain stateful logic for the Select component.\n const selectStates = useSelectState(safeProps);\n\n // Renders the 'SelectView' component, passing along any states controlled by 'useSelectState' and all properties passed to 'SelectComponent'.\n return (\n <SelectView\n {...selectStates}\n {...safeProps}\n // Restated after the props spread: `safeProps` now carries `value`, and\n // in uncontrolled mode that is `undefined` — letting it through would\n // blank out the selection the state hook just resolved.\n value={selectStates.value}\n onClick={(e: React.MouseEvent<HTMLDivElement>) => {\n // Stop propagation to prevent the global click handler from closing other dropdowns\n e.stopPropagation();\n if (mergedProps.onClick) mergedProps.onClick(e);\n }}\n />\n );\n};\n\n// Exports 'SelectComponent' as 'Select', making it available for import in other parts of the application.\nexport const Select = SelectComponent;\n"],"names":["SelectComponent","props","mergedProps","useMergedDesignSystemComponentProps","safeProps","selectStates","useSelectState","jsx","SelectView","e","Select"],"mappings":"uHAOMA,EAA0CC,GAAU,CACxD,MAAMC,EAAcC,EAAAA,oCAAoC,SAAUF,CAAK,EAEjEG,EAAY,CAChB,GAAGF,EACH,QAASA,EAAY,SAAW,CAAA,CAAC,EAI7BG,EAAeC,EAAAA,eAAeF,CAAS,EAG7C,OACEG,EAAAA,IAACC,EAAAA,WAAA,CACE,GAAGH,EACH,GAAGD,EAIJ,MAAOC,EAAa,MACpB,QAAUI,GAAwC,CAEhDA,EAAE,gBAAA,EACEP,EAAY,SAASA,EAAY,QAAQO,CAAC,CAChD,CAAA,CAAA,CAGN,EAGaC,EAASV"}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { jsx as r } from "react/jsx-runtime";
|
|
2
|
-
import { u as c, S as p } from "./Select.view-CPMqT8pn.mjs";
|
|
3
|
-
import { useMergedDesignSystemComponentProps as i } from "../theme.esm.mjs";
|
|
4
|
-
const l = (n) => {
|
|
5
|
-
const e = i("select", n), o = {
|
|
6
|
-
...e,
|
|
7
|
-
options: e.options || []
|
|
8
|
-
}, t = c(o);
|
|
9
|
-
return /* @__PURE__ */ r(
|
|
10
|
-
p,
|
|
11
|
-
{
|
|
12
|
-
...t,
|
|
13
|
-
...o,
|
|
14
|
-
value: t.value,
|
|
15
|
-
onClick: (s) => {
|
|
16
|
-
s.stopPropagation(), e.onClick && e.onClick(s);
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
);
|
|
20
|
-
}, u = l;
|
|
21
|
-
export {
|
|
22
|
-
u as S
|
|
23
|
-
};
|
|
24
|
-
//# sourceMappingURL=Select-C7IBNyjR.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Select-C7IBNyjR.mjs","sources":["../../src/components/Form/Select/Select.tsx"],"sourcesContent":["import React from 'react';\nimport { SelectProps } from './Select/Select.props';\nimport { useSelectState } from './Select/Select.state';\nimport SelectView from './Select/Select.view';\nimport { useMergedDesignSystemComponentProps } from 'src/design-system/theme';\n\n// Defines a functional component named 'SelectComponent', which is expected to receive 'SelectProps' as properties.\nconst SelectComponent: React.FC<SelectProps> = (props) => {\n const mergedProps = useMergedDesignSystemComponentProps('select', props);\n // Ensure options is always an array\n const safeProps = {\n ...mergedProps,\n options: mergedProps.options || [],\n };\n\n // Invokes the 'useSelectState' hook with props to obtain stateful logic for the Select component.\n const selectStates = useSelectState(safeProps);\n\n // Renders the 'SelectView' component, passing along any states controlled by 'useSelectState' and all properties passed to 'SelectComponent'.\n return (\n <SelectView\n {...selectStates}\n {...safeProps}\n // Restated after the props spread: `safeProps` now carries `value`, and\n // in uncontrolled mode that is `undefined` — letting it through would\n // blank out the selection the state hook just resolved.\n value={selectStates.value}\n onClick={(e: React.MouseEvent<HTMLDivElement>) => {\n // Stop propagation to prevent the global click handler from closing other dropdowns\n e.stopPropagation();\n if (mergedProps.onClick) mergedProps.onClick(e);\n }}\n />\n );\n};\n\n// Exports 'SelectComponent' as 'Select', making it available for import in other parts of the application.\nexport const Select = SelectComponent;\n"],"names":["SelectComponent","props","mergedProps","useMergedDesignSystemComponentProps","safeProps","selectStates","useSelectState","jsx","SelectView","e","Select"],"mappings":";;;AAOA,MAAMA,IAAyC,CAACC,MAAU;AACxD,QAAMC,IAAcC,EAAoC,UAAUF,CAAK,GAEjEG,IAAY;AAAA,IAChB,GAAGF;AAAA,IACH,SAASA,EAAY,WAAW,CAAA;AAAA,EAAC,GAI7BG,IAAeC,EAAeF,CAAS;AAG7C,SACE,gBAAAG;AAAA,IAACC;AAAA,IAAA;AAAA,MACE,GAAGH;AAAA,MACH,GAAGD;AAAA,MAIJ,OAAOC,EAAa;AAAA,MACpB,SAAS,CAACI,MAAwC;AAEhD,QAAAA,EAAE,gBAAA,GACEP,EAAY,WAASA,EAAY,QAAQO,CAAC;AAAA,MAChD;AAAA,IAAA;AAAA,EAAA;AAGN,GAGaC,IAASV;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Select.view-CPMqT8pn.mjs","sources":["../../src/components/Portal/Portal.tsx","../../src/components/Form/Select/Select/Select.state.ts","../../src/components/Form/Select/Select/Select.style.ts","../../src/components/Form/Select/Select/Select.view.tsx"],"sourcesContent":["import React, { useEffect, useState } from 'react';\nimport ReactDOM from 'react-dom';\n\ninterface PortalProps {\n children: React.ReactNode;\n containerId?: string;\n}\n\nexport const Portal: React.FC<PortalProps> = ({\n children,\n containerId = 'portal-root',\n}) => {\n const [container, setContainer] = useState<HTMLElement | null>(null);\n\n useEffect(() => {\n let element = document.getElementById(containerId);\n let created = false;\n\n if (!element) {\n created = true;\n element = document.createElement('div');\n element.setAttribute('id', containerId);\n document.body.appendChild(element);\n }\n\n setContainer(element);\n\n return () => {\n // Clean up only if we created it and it's empty?\n // safer not to remove it if other components use it,\n // but if we created it, we might want to remove it if empty.\n // For simplicity, let's keep it.\n if (\n created &&\n element &&\n element.parentNode &&\n element.childNodes.length === 0\n ) {\n element.parentNode.removeChild(element);\n }\n };\n }, [containerId]);\n\n if (!container) return null;\n\n return ReactDOM.createPortal(children, container);\n};\n","import React from 'react';\nimport { SelectProps } from './Select.props';\n\n// The view branches on the shape of the value: an array renders as removable\n// chips, a string as a single label. A caller passing the shape that does not\n// match the current mode (a string with `isMulti`, an array without) has to be\n// brought back in line before anything reads it, or the branch taken silently\n// disagrees with the mode the component is in.\nconst normalizeValue = (\n value: string | Array<string>,\n isMulti?: boolean\n): string | Array<string> => {\n if (isMulti) {\n if (Array.isArray(value)) return value;\n return value === '' ? [] : [value];\n }\n return Array.isArray(value) ? value[0] ?? '' : value;\n};\n\n// Initializes the custom hook 'useSelectState' for managing the state of the Select component\nexport const useSelectState = ({\n placeholder,\n isMulti,\n options,\n // No default value here: `undefined` is exactly what separates controlled\n // from uncontrolled, so defaulting it would pin the select to that default\n // and make `setValue` a permanent no-op.\n value: controlledValue,\n defaultValue,\n id: idProp,\n}: SelectProps) => {\n // `useId` is stable across renders where `Math.random` was not. The\n // delimiter characters are stripped because the view looks itself up with a\n // `#id` selector, where `:`/`«` would make the selector invalid.\n const reactId = React.useId().replace(/[^a-zA-Z0-9_-]/g, '');\n const id = idProp ?? `select-${reactId}`;\n const isControlled = controlledValue !== undefined;\n\n // State hook for tracking mouse hover status over the Select component\n const [isHovered, setIsHovered] = React.useState(false);\n // State hook for tracking focus status of the Select input field\n const [isFocused, setIsFocused] = React.useState(false);\n // Backing store for uncontrolled use. It is still initialized when the\n // select is controlled — harmlessly — so that a component that starts\n // controlled and later drops `value` has somewhere to land.\n const [internalValue, setInternalValue] = React.useState<\n string | Array<string>\n >(() => {\n if (defaultValue !== undefined)\n return normalizeValue(defaultValue, isMulti);\n // A multi-select starts empty: preselecting an option nobody asked for is\n // a selection the user then has to undo.\n if (isMulti) return [];\n // A placeholder means \"start empty\". Without one, the first option stands\n // in for a native <select>'s implicit first-option selection.\n if (placeholder) return '';\n return Array.isArray(options) && options.length > 0 ? options[0].value : '';\n });\n\n // The value everything downstream reads. In controlled mode it is the prop,\n // read fresh on every render, so the selection tracks the parent's state\n // instead of freezing at whatever it was on mount.\n const value = isControlled\n ? normalizeValue(controlledValue as string | Array<string>, isMulti)\n : internalValue;\n\n // In controlled mode the parent owns the value: the component records the\n // intent through `onChange` and waits for the new value to come back down.\n // Writing to internal state here would let the two copies disagree.\n const setValue = React.useCallback(\n (next: string | Array<string>) => {\n if (!isControlled) setInternalValue(next);\n },\n [isControlled]\n );\n\n // State hook for keeping track of the currently highlighted index in the options list\n const [highlightedIndex, setHighlightedIndex] = React.useState<number>(0);\n // State hook for managing visibility of the Select dropdown, initially set to hidden\n const [hide, setHide] = React.useState(true);\n\n // Returns an object containing all stateful values and their associated setters to manage the Select component's state\n return {\n id,\n value,\n setValue,\n hide,\n setHide,\n isHovered,\n setIsHovered,\n isFocused,\n setIsFocused,\n highlightedIndex,\n setHighlightedIndex,\n };\n};\n// Initializes another custom hook 'useItemState' for managing the hover state of each Select item\nexport const useItemState = () => {\n // State hook for tracking mouse hover status over individual Select item options\n const [isHovered, setIsHovered] = React.useState(false);\n // Returns an object with 'isHovered' state and its associated setter from the 'useItemState' hook, for controlling individual Select item hover state\n return { isHovered, setIsHovered };\n};\n","/**\n * Select Styles\n *\n * Design system tokens for the Select component following guidelines:\n * - Typography: Inter/Geist font, specific sizes/weights\n * - Spacing: 4px grid system\n * - Colors: Neutral palette with semantic colors\n * - Rounded corners: Consistent border radius\n * - Transitions: Subtle, physics-based animations\n */\n\nimport { ViewProps } from 'app-studio';\nimport { Size } from './Select.type';\n\n/**\n * Size configurations following 4px grid system\n */\nexport const Sizes: Record<Size, ViewProps> = {\n xs: { height: '28px', width: '28px' },\n sm: { height: '32px', width: '32px' },\n md: { height: '40px', width: '40px' },\n lg: { height: '48px', width: '48px' },\n xl: { height: '56px', width: '56px' },\n};\n\n/**\n * Icon sizes proportional to component size\n */\nexport const IconSizes: Record<Size, number> = {\n xs: 12,\n sm: 14,\n md: 16,\n lg: 18,\n xl: 20,\n};\n\n/**\n * Dropdown container styles\n * - Subtle shadow for elevation\n * - Smooth border and radius\n */\nexport const dropdownStyles: ViewProps = {\n // width handled by JS for Portal positioning\n maxHeight: '280px',\n overflowY: 'auto',\n zIndex: 1000,\n backgroundColor: 'color-white',\n borderRadius: 12,\n borderWidth: '1px',\n borderStyle: 'solid',\n borderColor: 'color-gray-200',\n // Subtle, layered shadow for depth\n boxShadow: '0 4px 12px rgba(0, 0, 0, 0.1)',\n};\n\n/**\n * Dropdown animation keyframes\n */\nexport const dropdownAnimation = {\n enter: {\n opacity: 1,\n transform: 'translateY(0) scale(1)',\n transition: 'all 0.2s ease-in-out',\n },\n exit: {\n opacity: 0,\n transform: 'translateY(-4px) scale(0.98)',\n },\n initial: {\n opacity: 0,\n transform: 'translateY(-8px) scale(0.96)',\n },\n};\n\n/**\n * Option item styles with improved touch targets\n */\nexport const optionStyles: ViewProps = {\n padding: '10px 12px',\n cursor: 'pointer',\n borderRadius: 8, // radius-md\n margin: '2px 4px',\n transition: 'all 0.15s ease-in-out',\n};\n\n/**\n * Option item state variants\n */\nexport const optionStateStyles = {\n default: {},\n hover: {\n backgroundColor: 'color-gray-50',\n },\n highlighted: {\n backgroundColor: 'color-gray-100',\n },\n selected: {\n backgroundColor: 'color-gray-100',\n },\n selectedHighlighted: {\n backgroundColor: 'color-gray-200',\n },\n};\n\n/**\n * Chevron icon animation\n */\nexport const chevronAnimation = {\n open: {\n transform: 'rotate(180deg)',\n transition: 'all 0.2s ease-in-out',\n },\n closed: {\n transform: 'rotate(0deg)',\n transition: 'all 0.2s ease-in-out',\n },\n};\n\n/**\n * Multi-select chip/tag styles\n */\nexport const chipStyles: ViewProps = {\n padding: '4px 8px',\n borderRadius: 8, // radius-md\n backgroundColor: 'color-gray-100',\n fontSize: '12px',\n fontWeight: '500',\n color: 'color-gray-700',\n transition: 'all 0.15s ease-in-out',\n};\n\n/**\n * Scrollbar styles for dropdown\n */\nexport const scrollbarStyles = {\n scrollbarWidth: 'thin' as const,\n scrollbarColor: 'rgba(0, 0, 0, 0.15) transparent',\n};\n","import React, { useCallback, useRef } from 'react';\nimport { Portal } from '../../../Portal/Portal';\nimport { Element, useElementPosition } from 'app-studio';\nimport { Typography } from 'app-studio';\nimport { Horizontal } from 'app-studio';\nimport { Text } from 'app-studio';\nimport { FieldContainer } from '../../../Input/FieldContainer/FieldContainer';\nimport { FieldContent } from '../../../Input/FieldContent/FieldContent';\nimport { FieldIcons } from '../../../Input/FieldIcons/FieldIcons';\nimport { FieldLabel } from '../../../Input/FieldLabel/FieldLabel';\nimport { FieldWrapper } from '../../../Input/FieldWrapper/FieldWrapper';\nimport { ChevronIcon, CloseIcon } from '../../../Icon/FixedIcons';\nimport {\n DropDownProps,\n HiddenSelectProps,\n ItemProps,\n MultiSelectProps,\n SelectBoxProps,\n SelectViewProps,\n} from './Select.props';\nimport {\n IconSizes,\n dropdownStyles,\n dropdownAnimation,\n optionStyles,\n optionStateStyles,\n chevronAnimation,\n chipStyles,\n scrollbarStyles,\n} from './Select.style';\n\nconst withoutFieldShellView = <T extends Record<string, any>>(views?: T): T => {\n if (!views) return {} as T;\n const { container, content, ...layoutViews } = views;\n return layoutViews as T;\n};\n\n// Field sizing now lives in `Input/fieldSizes` and is applied by FieldContent,\n// so this component no longer carries its own copy of the scale.\n\n/**\n * Item Component\n *\n * Renders an individual option item in the select dropdown\n */\nconst Item: React.FC<ItemProps & { isSelected?: boolean }> = ({\n isHovered,\n setIsHovered = () => {},\n option,\n size = 'md',\n callback = () => {},\n style,\n isSelected = false,\n ...props\n}) => {\n // Handles the click event on an option\n const handleOptionClick = (e: React.MouseEvent, option: string) => {\n e.stopPropagation();\n e.preventDefault();\n if (typeof callback === 'function') {\n callback(option);\n }\n };\n\n // Toggles the hover state on the item\n const handleHover = () => setIsHovered(!isHovered);\n\n // Get background color based on state priority\n const getStateStyle = () => {\n if (isSelected && isHovered) return optionStateStyles.selectedHighlighted;\n if (isSelected) return optionStateStyles.selected;\n if (isHovered) return optionStateStyles.highlighted;\n return optionStateStyles.default;\n };\n\n return (\n <Element\n as=\"li\"\n // An option has to say it is one. Without the role the listbox announces\n // a list of nothing, and anything that resolves controls by role — a\n // screen reader, voice control, a test driver — cannot reach these at all.\n role=\"option\"\n aria-selected={isSelected}\n // Layout - improved touch targets\n display=\"flex\"\n alignItems=\"center\"\n justifyContent=\"space-between\"\n listStyleType=\"none\"\n // Apply option styles from design tokens\n {...optionStyles}\n {...getStateStyle()}\n // Event handlers\n onMouseEnter={handleHover}\n onMouseLeave={handleHover}\n onClick={(e: React.MouseEvent) => handleOptionClick(e, option.value)}\n // Apply custom props\n {...props}\n >\n <Text\n fontSize={Typography.fontSizes[size]}\n fontWeight={isSelected ? '500' : '400'}\n lineHeight=\"14px\"\n color={isSelected ? 'color-gray-900' : 'color-gray-700'}\n {...style}\n >\n {option.label}\n </Text>\n {/* Selected indicator */}\n {isSelected && (\n <Element\n as=\"span\"\n // Decoration, and hidden as such. `aria-selected` above already\n // carries this meaning in the way assistive technology reads it,\n // whereas a visible ✓ joins the option's accessible name and turns\n // \"Alpha\" into \"Alpha ✓\" — so a screen reader announces the wrong\n // name, voice control loses \"click Alpha\", and anything resolving\n // the option by its exact label stops finding it at all.\n aria-hidden=\"true\"\n color=\"theme-primary\"\n fontSize=\"14px\"\n marginLeft={8}\n display=\"flex\"\n alignItems=\"center\"\n >\n ✓\n </Element>\n )}\n </Element>\n );\n};\n/**\n * SelectBox Component\n *\n * Renders the main select box with selected value(s)\n */\nconst SelectBox: React.FC<SelectBoxProps> = ({\n size = 'md',\n views = { field: {}, text: {} },\n value,\n isDisabled,\n placeholder,\n removeOption = () => {},\n options,\n}) => {\n const fieldView = views?.field || {};\n const textView = views?.text || {};\n const isMultiValue = Array.isArray(value) && value.length > 0;\n /**\n * Styles for the select field\n */\n const fieldStyles = {\n // Layout properties\n margin: 0,\n width: '95%',\n height: '100%',\n border: 'none',\n // No vertical padding here: the field shell above already applies\n // `shellPaddingY` for the current size. Adding 4px on each side on top of\n // it pushed the content box past the shell's `minHeight`, so a `md` Select\n // rendered at 50px while a `md` TextField rendered at the intended 40px —\n // visibly misaligning the two whenever they sit in the same row.\n paddingVertical: 0,\n paddingHorizontal: 0,\n\n // Typography properties\n fontSize: Typography.fontSizes[size],\n\n fontWeight: '400', // Regular weight\n // Left to the natural line box, as TextField does. A fixed 20px line-height\n // does not fit the shell it lives in: at `md` the shell is 40px tall with\n // 10px of padding and a 1px border on each side, leaving 18px for content.\n // Hard-coding 20px pushed every Select 2px past its own declared height.\n letterSpacing: '-0.01em', // Slight negative tracking for modern look\n\n // Visual properties\n color: isDisabled ? 'color-gray-400' : 'color-gray-900',\n\n // State properties\n cursor: isDisabled ? 'not-allowed' : 'pointer',\n\n // Animation\n transition: 'all 0.2s ease-in-out',\n\n // A single-value trigger stays on one line and ellipsises, via `Text`'s own\n // `maxLines`. Without it a long option label wraps, which silently breaks\n // the control's declared height — a `md` Select showing \"Uma User's\n // workspace\" in a narrow sidebar became two lines tall.\n //\n // `minWidth: 0` is what actually lets it truncate: the trigger is a flex\n // child, and `min-width: auto` would otherwise stop it shrinking below its\n // content, so the clamp would never engage.\n //\n // Multi-select is excluded: its value renders as chips that are meant to\n // wrap, and clamping would hide selections rather than reflow them.\n ...(isMultiValue ? {} : { maxLines: 1, minWidth: 0 }),\n\n // Apply custom styles\n ...fieldView,\n ...textView,\n style: {\n backgroundColor: 'transparent',\n ...(fieldView as any).style,\n ...(textView as any).style,\n },\n };\n const option: any =\n options.length > 0 && options.find((option) => option.value === value);\n return (\n <Text {...fieldStyles}>\n {/* Check if value is an empty string or if value is an array but with no items, then show placeholder */}\n {(value === '' || (Array.isArray(value) && value.length === 0)) &&\n !!placeholder ? (\n placeholder\n ) : (\n <>\n {/* If value is a string, use the option label or value */}\n {typeof value === 'string' ? (\n (option && option.label) ?? value\n ) : // If value is an array and not empty, render MultiSelect options\n Array.isArray(value) && value.length > 0 ? (\n <Horizontal gap={6}>\n {value.map((option) => (\n <MultiSelect\n key={option}\n option={option}\n removeOption={removeOption}\n />\n ))}\n </Horizontal>\n ) : (\n // Handle any other types of value (including objects or unexpected values)\n <span>{value}</span>\n )}\n </>\n )}\n </Text>\n );\n};\nconst HiddenSelect: React.FC<HiddenSelectProps> = ({\n id,\n name,\n value,\n onChange,\n isMulti = false,\n isDisabled = false,\n isReadOnly = false,\n options = [],\n // Swallowed on purpose. `defaultValue` is the Select's own prop — the state\n // hook has already turned it into the `value` below — but it also rides\n // along in `...props`, and React errors on any <select> carrying both\n // (\"Select elements must be either controlled or uncontrolled\"). That error\n // fires on every render and fails test runs that treat console.error as\n // fatal, so the element has to be given one or the other, never both.\n defaultValue: _defaultValue,\n ...props\n}) => {\n // The hidden <select> is the only path that produced a DOM event where every\n // other path produced a value, so the same `onChange` prop had two different\n // argument shapes depending on which one fired. Normalise here.\n const handleChange = (event: React.ChangeEvent<HTMLSelectElement>) => {\n if (!onChange) return;\n onChange(\n isMulti\n ? Array.from(event.target.selectedOptions, (option) => option.value)\n : event.target.value\n );\n };\n return (\n <Element\n id={id}\n name={name}\n as=\"select\"\n opacity={0}\n width={1}\n height={1}\n overflow=\"hidden\"\n position=\"absolute\"\n pointerEvents=\"none\"\n tabIndex={-1}\n aria-hidden=\"true\"\n value={value}\n disabled={isDisabled}\n readOnly={isReadOnly}\n onChange={handleChange}\n multiple={isMulti}\n {...props}\n >\n {options.length > 0 &&\n options.map((option) => {\n return (\n <option key={option.value} value={option.value}>\n {option.label}\n </option>\n );\n })}\n </Element>\n );\n};\n/**\n * DropDown Component\n *\n * Renders the dropdown list of options for the select component\n */\nconst DropDown: React.FC<\n DropDownProps & {\n selectedValue?: string | string[];\n listboxId?: string;\n getOptionId?: (index: number) => string;\n }\n> = ({\n size,\n views = {},\n options,\n callback = () => {},\n highlightedIndex,\n setHighlightedIndex = () => {},\n selectedValue,\n listboxId,\n getOptionId,\n}) => {\n const handleCallback = (option: string) => callback(option);\n\n // Check if an option is selected\n const isOptionSelected = (optionValue: string) => {\n if (Array.isArray(selectedValue)) {\n return selectedValue.includes(optionValue);\n }\n return selectedValue === optionValue;\n };\n\n return (\n <Element\n as=\"ul\"\n role=\"listbox\"\n id={listboxId}\n display=\"flex\"\n flexDirection=\"column\"\n margin={0}\n padding=\"4px\"\n {...dropdownStyles}\n style={scrollbarStyles}\n {...views?.dropDown}\n >\n {options &&\n options.length > 0 &&\n options.map((option, index) => (\n <Item\n key={option.value}\n id={getOptionId ? getOptionId(index) : undefined}\n size={size}\n style={views['text']}\n option={option}\n callback={handleCallback}\n isSelected={isOptionSelected(option.value)}\n isHovered={index === highlightedIndex}\n setIsHovered={() => {}}\n onMouseEnter={() => setHighlightedIndex(index)}\n />\n ))}\n </Element>\n );\n};\n/**\n * MultiSelect Component\n *\n * Renders a selected option in a multi-select component\n */\nexport const MultiSelect: React.FC<MultiSelectProps> = ({\n option,\n size = 'md',\n removeOption = () => {},\n ...props\n}) => {\n const handleClick = () => removeOption(option);\n\n return (\n <Horizontal\n gap={6}\n alignItems=\"center\"\n onClick={(event: any) => event.stopPropagation()}\n {...chipStyles}\n _hover={{\n backgroundColor: 'color-gray-200',\n }}\n {...props}\n >\n <Text\n fontSize={Typography.fontSizes[size]}\n fontWeight=\"500\"\n color=\"color-gray-700\"\n >\n {option}\n </Text>\n\n {/* A real button: `close-button` is not an ARIA role, so the remover was\n invisible to assistive tech and unreachable by keyboard. */}\n <Element\n as=\"button\"\n type=\"button\"\n aria-label={`Remove ${option}`}\n onClick={handleClick}\n display=\"flex\"\n alignItems=\"center\"\n justifyContent=\"center\"\n padding={0}\n border=\"none\"\n backgroundColor=\"transparent\"\n color=\"color-gray-500\"\n cursor=\"pointer\"\n transition=\"all 0.2s ease-in-out\"\n _hover={{\n color: 'color-gray-700',\n }}\n >\n <CloseIcon color=\"inherit\" widthHeight={IconSizes[size]} />\n </Element>\n </Horizontal>\n );\n};\nconst SelectView: React.FC<SelectViewProps> = ({\n id,\n name,\n label,\n value,\n placeholder,\n helperText,\n hide = false,\n error = false,\n isMulti = false,\n isFocused = false,\n isHovered = false,\n isDisabled = false,\n isReadOnly = false,\n isRequired = false,\n isAutoFocus = false,\n options = [],\n shadow = {},\n size = 'md',\n shape = 'default',\n variant = 'default',\n views = {\n text: {},\n icon: {},\n dropDown: {},\n selectBox: {},\n label: {},\n helperText: {},\n },\n onChange = () => {},\n setHide = () => {},\n setValue = () => {},\n setIsHovered = () => {},\n setIsFocused = () => {},\n setHighlightedIndex,\n highlightedIndex,\n isScrollable,\n // Pulled out so it can name the trigger. It used to fall into `...props`,\n // which never reaches the element a screen reader reads.\n 'aria-label': ariaLabel,\n ...props\n}) => {\n const generatedId = React.useId();\n // One id per element: the focusable combobox keeps the public `id`; the\n // aria-hidden native <select>, the label, the listbox and its options get\n // derived ids — the combobox and the native <select> used to share the same\n // `id`, which is invalid HTML and made `htmlFor` ambiguous. The `useId`\n // fallback is stripped of its delimiters because the id is used in `#id`\n // selector lookups below.\n const selectId = id ?? `select-${generatedId.replace(/[^a-zA-Z0-9_-]/g, '')}`;\n const nativeSelectId = `${selectId}-native`;\n const labelId = `${selectId}-label`;\n const listboxId = `${selectId}-listbox`;\n const getOptionId = (index: number) => `${selectId}-option-${index}`;\n\n const {\n ref: triggerRef,\n relation,\n updateRelation,\n } = useElementPosition({\n trackChanges: true,\n trackOnScroll: true,\n trackOnResize: true,\n throttleMs: 10,\n });\n\n const dropdownRef = useRef<HTMLDivElement>(null);\n\n // Get optimal positioning style based on available space\n // Get optimal positioning style based on available space\n const getDropdownStyle = () => {\n if (!triggerRef.current) return {};\n\n const rect = triggerRef.current.getBoundingClientRect();\n const baseStyle: React.CSSProperties = {\n position: 'fixed',\n left: rect.left,\n width: rect.width,\n zIndex: 10000,\n };\n\n // Use relation to determine vertical placement if available, otherwise default to bottom\n const isTop = relation?.space?.vertical === 'top';\n\n if (isTop) {\n return {\n ...baseStyle,\n bottom: window.innerHeight - rect.top + 8, // 8px gap\n };\n } else {\n return {\n ...baseStyle,\n top: rect.bottom + 8, // 8px gap\n };\n }\n };\n // close when *any* other select opens\n React.useEffect(() => {\n const handleCloseAll = () => setHide(true);\n document.addEventListener('closeAllSelects', handleCloseAll);\n return () =>\n document.removeEventListener('closeAllSelects', handleCloseAll);\n }, [setHide]);\n\n // Mount-only autofocus, mirroring the native `autofocus` attribute: the\n // focusable element is the combobox trigger, not the aria-hidden <select>.\n React.useEffect(() => {\n if (isAutoFocus && !isDisabled && !isReadOnly) {\n triggerRef.current?.focus();\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n // Add a global click handler to close the dropdown when clicking outside\n React.useEffect(() => {\n const handleGlobalClick = (e: MouseEvent) => {\n const target = e.target as HTMLElement;\n // Only close if clicking outside of this specific select component\n if (!target.closest(`#${selectId}`) && !hide) {\n setHide(true);\n }\n };\n\n document.addEventListener('click', handleGlobalClick);\n return () => {\n document.removeEventListener('click', handleGlobalClick);\n };\n }, [selectId, hide, setHide]);\n const handleHover = () => setIsHovered(!isHovered);\n const handleFocus = () => setIsFocused(true);\n const handleClick = (event: React.MouseEvent<HTMLButtonElement>) => {\n // tell all other selects to close\n document.dispatchEvent(new Event('closeAllSelects'));\n\n if (event && event.stopPropagation) event.stopPropagation();\n\n // Toggle dropdown visibility\n const newHideState = !hide;\n setHide(newHideState);\n setIsFocused(!newHideState); // Set focus state based on dropdown visibility\n };\n const handleCallback = useCallback(\n (option: string) => {\n // Close dropdown after selection\n setHide(true);\n\n // Tell all other selects to close\n document.dispatchEvent(new Event('closeAllSelects'));\n\n // Update value based on multi-select or single-select mode.\n // `onChange` reports the *next* selection, not the option that was\n // clicked: a controlled parent has to be able to store what it gets\n // back, and for a multi-select that is the whole array.\n if (isMulti && Array.isArray(value)) {\n if (!value.includes(option)) {\n const newValue = [...value, option];\n setValue(newValue);\n if (onChange) onChange(newValue);\n }\n } else {\n setValue(option);\n if (onChange) onChange(option);\n }\n\n // Set focus to indicate selection\n setIsFocused(true);\n },\n [isMulti, value, setHide, setValue, onChange, setIsFocused]\n );\n const handleRemoveOption = (valueOption: string) => {\n if (Array.isArray(value) && value.includes(valueOption)) {\n const newValue = value.filter((option) => option !== valueOption);\n setValue(newValue);\n // Removing a chip is a change like any other. Without this the parent of\n // a controlled multi-select never hears about it, so the chip comes\n // straight back on the next render.\n if (onChange) onChange(newValue);\n }\n };\n const showLabel = !!label;\n const layoutViews = withoutFieldShellView(views);\n\n return (\n <FieldContainer\n ref={triggerRef as React.RefObject<HTMLDivElement>}\n position=\"relative\"\n width=\"100%\"\n display=\"inline-block\"\n id={selectId}\n // `SelectBox` is not an ARIA role, so the trigger was exposed as a plain\n // container: not focusable, not announced, and operable only by mouse.\n // The native `<select>` behind it is `aria-hidden` and `tabIndex={-1}`, so\n // there was no keyboard path to this control at all.\n role=\"combobox\"\n aria-haspopup=\"listbox\"\n aria-expanded={!hide}\n // The visible label names the combobox via `aria-labelledby`; an explicit\n // `aria-label` prop wins when the caller provides one.\n aria-labelledby={!ariaLabel && showLabel ? labelId : undefined}\n aria-label={ariaLabel}\n aria-controls={listboxId}\n aria-activedescendant={\n !hide && options.length > 0\n ? getOptionId(highlightedIndex ?? 0)\n : undefined\n }\n aria-disabled={isDisabled || undefined}\n aria-required={isRequired || undefined}\n tabIndex={isDisabled || isReadOnly ? -1 : 0}\n helperText={helperText}\n error={error}\n views={layoutViews}\n onKeyDown={(e: React.KeyboardEvent<HTMLDivElement>) => {\n if (isDisabled || isReadOnly) return;\n // Keys pressed on descendants (the chip-remove buttons) must keep\n // their native activation instead of being hijacked by the trigger.\n if (e.target !== e.currentTarget) return;\n\n // Closed: Enter, Space and Down open the list — the same keys a\n // native select answers to, so nobody has to learn this one separately.\n if (hide) {\n if (e.key === 'Enter' || e.key === ' ' || e.key === 'ArrowDown') {\n e.preventDefault();\n document.dispatchEvent(new Event('closeAllSelects'));\n setHide(false);\n setIsFocused(true);\n }\n return;\n }\n\n // Open: arrows move the highlight, Enter commits it, Escape closes.\n const currentIndex = highlightedIndex ?? 0;\n if (e.key === 'ArrowDown') {\n e.preventDefault();\n setHighlightedIndex?.(Math.min(currentIndex + 1, options.length - 1));\n } else if (e.key === 'ArrowUp') {\n e.preventDefault();\n setHighlightedIndex?.(Math.max(currentIndex - 1, 0));\n } else if (e.key === 'Enter') {\n e.preventDefault();\n const option = options[currentIndex];\n if (option) handleCallback(option.value);\n } else if (e.key === 'Escape') {\n e.preventDefault();\n setHide(true);\n }\n }}\n onClick={(e: React.MouseEvent<HTMLDivElement>) => {\n // Stop propagation to prevent clicks from bubbling up\n e.stopPropagation();\n\n // Only handle click if not disabled or readonly\n if (!(isDisabled || isReadOnly)) {\n handleClick(e as unknown as React.MouseEvent<HTMLButtonElement>);\n }\n }}\n >\n <FieldContent\n label={label}\n size={size}\n error={error}\n shape={shape}\n views={views}\n shadow={shadow}\n variant={variant}\n value={value}\n color={'theme-primary'}\n isHovered={isHovered}\n isDisabled={isDisabled}\n isReadOnly={isReadOnly}\n isFocused={isFocused}\n showLabel={showLabel}\n // Sizing comes from FieldContent's shared scale (`Input/fieldSizes`).\n onMouseEnter={handleHover}\n onMouseLeave={handleHover}\n position=\"relative\"\n {...views?.content}\n >\n <FieldWrapper>\n {showLabel && (\n <FieldLabel\n id={labelId}\n htmlFor={nativeSelectId}\n color={'theme-primary'}\n error={error}\n {...views?.label}\n >\n {label}\n </FieldLabel>\n )}\n <HiddenSelect\n id={nativeSelectId}\n name={name}\n options={options}\n onChange={onChange}\n value={value}\n isDisabled={isDisabled}\n isReadOnly={isReadOnly}\n isMulti={isMulti}\n // Real form semantics live on the native element: `required`\n // makes submission enforcement work even though the visible\n // combobox is a div.\n required={isRequired || undefined}\n onFocus={handleFocus}\n {...props}\n />\n <SelectBox\n options={options}\n size={size}\n views={views}\n value={value}\n isDisabled={isDisabled}\n placeholder={placeholder}\n removeOption={handleRemoveOption}\n />\n </FieldWrapper>\n <FieldIcons>\n {!isReadOnly && !isDisabled && (\n <Element\n display=\"flex\"\n alignItems=\"center\"\n justifyContent=\"center\"\n style={hide ? chevronAnimation.closed : chevronAnimation.open}\n >\n <ChevronIcon\n color=\"inherit\"\n widthHeight={IconSizes[size]}\n style={views.icon}\n orientation=\"down\"\n />\n </Element>\n )}\n </FieldIcons>\n {!hide && options.length > 0 && (\n <Portal>\n <Element\n ref={dropdownRef}\n onClick={(e: React.MouseEvent) => e.stopPropagation()}\n style={{\n ...getDropdownStyle(),\n ...dropdownAnimation.enter,\n }}\n >\n <DropDown\n size={size}\n views={views}\n options={options}\n callback={handleCallback}\n highlightedIndex={highlightedIndex}\n setHighlightedIndex={setHighlightedIndex}\n selectedValue={value}\n listboxId={listboxId}\n getOptionId={getOptionId}\n />\n </Element>\n </Portal>\n )}\n </FieldContent>\n </FieldContainer>\n );\n};\nexport default SelectView;\n"],"names":["Portal","children","containerId","container","setContainer","useState","useEffect","element","created","ReactDOM","normalizeValue","value","isMulti","useSelectState","placeholder","options","controlledValue","defaultValue","idProp","reactId","React","id","isControlled","isHovered","setIsHovered","isFocused","setIsFocused","internalValue","setInternalValue","setValue","next","highlightedIndex","setHighlightedIndex","hide","setHide","IconSizes","dropdownStyles","dropdownAnimation","optionStyles","optionStateStyles","chevronAnimation","chipStyles","scrollbarStyles","withoutFieldShellView","views","content","layoutViews","Item","option","size","callback","style","isSelected","props","handleOptionClick","e","handleHover","jsxs","Element","jsx","Text","Typography","SelectBox","isDisabled","removeOption","fieldView","textView","isMultiValue","fieldStyles","Fragment","Horizontal","MultiSelect","HiddenSelect","name","onChange","isReadOnly","_defaultValue","event","DropDown","selectedValue","listboxId","getOptionId","handleCallback","isOptionSelected","optionValue","index","handleClick","CloseIcon","SelectView","label","helperText","error","isRequired","isAutoFocus","shadow","shape","variant","isScrollable","ariaLabel","generatedId","selectId","nativeSelectId","labelId","triggerRef","relation","updateRelation","useElementPosition","dropdownRef","useRef","getDropdownStyle","rect","baseStyle","_a","handleCloseAll","handleGlobalClick","handleFocus","newHideState","useCallback","newValue","handleRemoveOption","valueOption","showLabel","FieldContainer","currentIndex","FieldContent","FieldWrapper","FieldLabel","FieldIcons","ChevronIcon"],"mappings":";;;;;;AAQO,MAAMA,KAAgC,CAAC;AAAA,EAC5C,UAAAC;AAAA,EACA,aAAAC,IAAc;AAChB,MAAM;AACJ,QAAM,CAACC,GAAWC,CAAY,IAAIC,GAA6B,IAAI;AA+BnE,SA7BAC,GAAU,MAAM;AACd,QAAIC,IAAU,SAAS,eAAeL,CAAW,GAC7CM,IAAU;AAEd,WAAKD,MACHC,IAAU,IACVD,IAAU,SAAS,cAAc,KAAK,GACtCA,EAAQ,aAAa,MAAML,CAAW,GACtC,SAAS,KAAK,YAAYK,CAAO,IAGnCH,EAAaG,CAAO,GAEb,MAAM;AAKX,MACEC,KACAD,KACAA,EAAQ,cACRA,EAAQ,WAAW,WAAW,KAE9BA,EAAQ,WAAW,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B;AAAA,oBACf,WAAAqE;AAAA,oBACA,aAAAC;AAAA,kBAAA;AAAA,gBAAA;AAAA,cACF;AAAA,YAAA,EACF,CACF;AAAA,UAAA;AAAA,QAAA;AAAA,MAAA;AAAA,IAEJ;AAAA,EAAA;AAGN;"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";const g=require("react"),a=require("react/jsx-runtime"),ce=require("react-dom"),p=require("app-studio"),z=require("./FieldWrapper-DRCn7BLi.cjs"),U=require("./FixedIcons-Dz_f-yDL.cjs"),J=({children:o,containerId:n="portal-root"})=>{const[t,l]=g.useState(null);return g.useEffect(()=>{let c=document.getElementById(n),u=!1;return c||(u=!0,c=document.createElement("div"),c.setAttribute("id",n),document.body.appendChild(c)),l(c),()=>{u&&c&&c.parentNode&&c.childNodes.length===0&&c.parentNode.removeChild(c)}},[n]),t?ce.createPortal(o,t):null},G=(o,n)=>n?Array.isArray(o)?o:o===""?[]:[o]:Array.isArray(o)?o[0]??"":o,se=({placeholder:o,isMulti:n,options:t,value:l,defaultValue:c,id:u})=>{const s=g.useId().replace(/[^a-zA-Z0-9_-]/g,""),y=u??`select-${s}`,f=l!==void 0,[m,x]=g.useState(!1),[r,i]=g.useState(!1),[I,V]=g.useState(()=>c!==void 0?G(c,n):n?[]:o?"":Array.isArray(t)&&t.length>0?t[0].value:""),S=f?G(l,n):I,L=g.useCallback(b=>{f||V(b)},[f]),[C,W]=g.useState(0),[$,h]=g.useState(!0);return{id:y,value:S,setValue:L,hide:$,setHide:h,isHovered:m,setIsHovered:x,isFocused:r,setIsFocused:i,highlightedIndex:C,setHighlightedIndex:W}},Q={xs:12,sm:14,md:16,lg:18,xl:20},ie={maxHeight:"280px",overflowY:"auto",zIndex:1e3,backgroundColor:"color-white",borderRadius:12,borderWidth:"1px",borderStyle:"solid",borderColor:"color-gray-200",boxShadow:"0 4px 12px rgba(0, 0, 0, 0.1)"},de={enter:{opacity:1,transform:"translateY(0) scale(1)",transition:"all 0.2s ease-in-out"}},ue={padding:"10px 12px",cursor:"pointer",borderRadius:8,margin:"2px 4px",transition:"all 0.15s ease-in-out"},P={default:{},highlighted:{backgroundColor:"color-gray-100"},selected:{backgroundColor:"color-gray-100"},selectedHighlighted:{backgroundColor:"color-gray-200"}},K={open:{transform:"rotate(180deg)",transition:"all 0.2s ease-in-out"},closed:{transform:"rotate(0deg)",transition:"all 0.2s ease-in-out"}},fe={padding:"4px 8px",borderRadius:8,backgroundColor:"color-gray-100",fontSize:"12px",fontWeight:"500",color:"color-gray-700",transition:"all 0.15s ease-in-out"},pe={scrollbarWidth:"thin",scrollbarColor:"rgba(0, 0, 0, 0.15) transparent"},ye=o=>{if(!o)return{};const{container:n,content:t,...l}=o;return l},ge=({isHovered:o,setIsHovered:n=()=>{},option:t,size:l="md",callback:c=()=>{},style:u,isSelected:s=!1,...y})=>{const f=(r,i)=>{r.stopPropagation(),r.preventDefault(),typeof c=="function"&&c(i)},m=()=>n(!o),x=()=>s&&o?P.selectedHighlighted:s?P.selected:o?P.highlighted:P.default;return a.jsxs(p.Element,{as:"li",role:"option","aria-selected":s,display:"flex",alignItems:"center",justifyContent:"space-between",listStyleType:"none",...ue,...x(),onMouseEnter:m,onMouseLeave:m,onClick:r=>f(r,t.value),...y,children:[a.jsx(p.Text,{fontSize:p.Typography.fontSizes[l],fontWeight:s?"500":"400",lineHeight:"14px",color:s?"color-gray-900":"color-gray-700",...u,children:t.label}),s&&a.jsx(p.Element,{as:"span","aria-hidden":"true",color:"theme-primary",fontSize:"14px",marginLeft:8,display:"flex",alignItems:"center",children:"✓"})]})},he=({size:o="md",views:n={field:{},text:{}},value:t,isDisabled:l,placeholder:c,removeOption:u=()=>{},options:s})=>{const y=(n==null?void 0:n.field)||{},f=(n==null?void 0:n.text)||{},m=Array.isArray(t)&&t.length>0,x={margin:0,width:"95%",height:"100%",border:"none",paddingVertical:0,paddingHorizontal:0,fontSize:p.Typography.fontSizes[o],fontWeight:"400",letterSpacing:"-0.01em",color:l?"color-gray-400":"color-gray-900",cursor:l?"not-allowed":"pointer",transition:"all 0.2s ease-in-out",...m?{}:{maxLines:1,minWidth:0},...y,...f,style:{backgroundColor:"transparent",...y.style,...f.style}},r=s.length>0&&s.find(i=>i.value===t);return a.jsx(p.Text,{...x,children:(t===""||Array.isArray(t)&&t.length===0)&&c?c:a.jsx(a.Fragment,{children:typeof t=="string"?(r&&r.label)??t:Array.isArray(t)&&t.length>0?a.jsx(p.Horizontal,{gap:6,children:t.map(i=>a.jsx(be,{option:i,removeOption:u},i))}):a.jsx("span",{children:t})})})},me=({id:o,name:n,value:t,onChange:l,isMulti:c=!1,isDisabled:u=!1,isReadOnly:s=!1,options:y=[],defaultValue:f,...m})=>{const x=r=>{l&&l(c?Array.from(r.target.selectedOptions,i=>i.value):r.target.value)};return a.jsx(p.Element,{id:o,name:n,as:"select",opacity:0,width:1,height:1,overflow:"hidden",position:"absolute",pointerEvents:"none",tabIndex:-1,"aria-hidden":"true",value:t,disabled:u,readOnly:s,onChange:x,multiple:c,...m,children:y.length>0&&y.map(r=>a.jsx("option",{value:r.value,children:r.label},r.value))})},xe=({size:o,views:n={},options:t,callback:l=()=>{},highlightedIndex:c,setHighlightedIndex:u=()=>{},selectedValue:s,listboxId:y,getOptionId:f})=>{const m=r=>l(r),x=r=>Array.isArray(s)?s.includes(r):s===r;return a.jsx(p.Element,{as:"ul",role:"listbox",id:y,display:"flex",flexDirection:"column",margin:0,padding:"4px",...ie,style:pe,...n==null?void 0:n.dropDown,children:t&&t.length>0&&t.map((r,i)=>a.jsx(ge,{id:f?f(i):void 0,size:o,style:n.text,option:r,callback:m,isSelected:x(r.value),isHovered:i===c,setIsHovered:()=>{},onMouseEnter:()=>u(i)},r.value))})},be=({option:o,size:n="md",removeOption:t=()=>{},...l})=>{const c=()=>t(o);return a.jsxs(p.Horizontal,{gap:6,alignItems:"center",onClick:u=>u.stopPropagation(),...fe,_hover:{backgroundColor:"color-gray-200"},...l,children:[a.jsx(p.Text,{fontSize:p.Typography.fontSizes[n],fontWeight:"500",color:"color-gray-700",children:o}),a.jsx(p.Element,{as:"button",type:"button","aria-label":`Remove ${o}`,onClick:c,display:"flex",alignItems:"center",justifyContent:"center",padding:0,border:"none",backgroundColor:"transparent",color:"color-gray-500",cursor:"pointer",transition:"all 0.2s ease-in-out",_hover:{color:"color-gray-700"},children:a.jsx(U.CloseIcon,{color:"inherit",widthHeight:Q[n]})})]})},Se=({id:o,name:n,label:t,value:l,placeholder:c,helperText:u,hide:s=!1,error:y=!1,isMulti:f=!1,isFocused:m=!1,isHovered:x=!1,isDisabled:r=!1,isReadOnly:i=!1,isRequired:I=!1,isAutoFocus:V=!1,options:S=[],shadow:L={},size:C="md",shape:W="default",variant:$="default",views:h={text:{},icon:{},dropDown:{},selectBox:{},label:{},helperText:{}},onChange:b=()=>{},setHide:k=()=>{},setValue:T=()=>{},setIsHovered:X=()=>{},setIsFocused:w=()=>{},setHighlightedIndex:A,highlightedIndex:q,isScrollable:ke,"aria-label":M,...H})=>{const ee=g.useId(),j=o??`select-${ee.replace(/[^a-zA-Z0-9_-]/g,"")}`,_=`${j}-native`,B=`${j}-label`,v=`${j}-listbox`,N=e=>`${j}-option-${e}`,{ref:F,relation:D,updateRelation:Ae}=p.useElementPosition({trackChanges:!0,trackOnScroll:!0,trackOnResize:!0,throttleMs:10}),te=g.useRef(null),re=()=>{var Z;if(!F.current)return{};const e=F.current.getBoundingClientRect(),d={position:"fixed",left:e.left,width:e.width,zIndex:1e4};return((Z=D==null?void 0:D.space)==null?void 0:Z.vertical)==="top"?{...d,bottom:window.innerHeight-e.top+8}:{...d,top:e.bottom+8}};g.useEffect(()=>{const e=()=>k(!0);return document.addEventListener("closeAllSelects",e),()=>document.removeEventListener("closeAllSelects",e)},[k]),g.useEffect(()=>{var e;V&&!r&&!i&&((e=F.current)==null||e.focus())},[]),g.useEffect(()=>{const e=d=>{!d.target.closest(`#${j}`)&&!s&&k(!0)};return document.addEventListener("click",e),()=>{document.removeEventListener("click",e)}},[j,s,k]);const O=()=>X(!x),ne=()=>w(!0),oe=e=>{document.dispatchEvent(new Event("closeAllSelects")),e&&e.stopPropagation&&e.stopPropagation();const d=!s;k(d),w(!d)},Y=g.useCallback(e=>{if(k(!0),document.dispatchEvent(new Event("closeAllSelects")),f&&Array.isArray(l)){if(!l.includes(e)){const d=[...l,e];T(d),b&&b(d)}}else T(e),b&&b(e);w(!0)},[f,l,k,T,b,w]),le=e=>{if(Array.isArray(l)&&l.includes(e)){const d=l.filter(E=>E!==e);T(d),b&&b(d)}},R=!!t,ae=ye(h);return a.jsx(z.FieldContainer,{ref:F,position:"relative",width:"100%",display:"inline-block",id:j,role:"combobox","aria-haspopup":"listbox","aria-expanded":!s,"aria-labelledby":!M&&R?B:void 0,"aria-label":M,"aria-controls":v,"aria-activedescendant":!s&&S.length>0?N(q??0):void 0,"aria-disabled":r||void 0,"aria-required":I||void 0,tabIndex:r||i?-1:0,helperText:u,error:y,views:ae,onKeyDown:e=>{if(r||i||e.target!==e.currentTarget)return;if(s){(e.key==="Enter"||e.key===" "||e.key==="ArrowDown")&&(e.preventDefault(),document.dispatchEvent(new Event("closeAllSelects")),k(!1),w(!0));return}const d=q??0;if(e.key==="ArrowDown")e.preventDefault(),A==null||A(Math.min(d+1,S.length-1));else if(e.key==="ArrowUp")e.preventDefault(),A==null||A(Math.max(d-1,0));else if(e.key==="Enter"){e.preventDefault();const E=S[d];E&&Y(E.value)}else e.key==="Escape"&&(e.preventDefault(),k(!0))},onClick:e=>{e.stopPropagation(),r||i||oe(e)},children:a.jsxs(z.FieldContent,{label:t,size:C,error:y,shape:W,views:h,shadow:L,variant:$,value:l,color:"theme-primary",isHovered:x,isDisabled:r,isReadOnly:i,isFocused:m,showLabel:R,onMouseEnter:O,onMouseLeave:O,position:"relative",...h==null?void 0:h.content,children:[a.jsxs(z.FieldWrapper,{children:[R&&a.jsx(z.FieldLabel,{id:B,htmlFor:_,color:"theme-primary",error:y,...h==null?void 0:h.label,children:t}),a.jsx(me,{id:_,name:n,options:S,onChange:b,value:l,isDisabled:r,isReadOnly:i,isMulti:f,required:I||void 0,onFocus:ne,...H}),a.jsx(he,{options:S,size:C,views:h,value:l,isDisabled:r,placeholder:c,removeOption:le})]}),a.jsx(z.FieldIcons,{children:!i&&!r&&a.jsx(p.Element,{display:"flex",alignItems:"center",justifyContent:"center",style:s?K.closed:K.open,children:a.jsx(U.ChevronIcon,{color:"inherit",widthHeight:Q[C],style:h.icon,orientation:"down"})})}),!s&&S.length>0&&a.jsx(J,{children:a.jsx(p.Element,{ref:te,onClick:e=>e.stopPropagation(),style:{...re(),...de.enter},children:a.jsx(xe,{size:C,views:h,options:S,callback:Y,highlightedIndex:q,setHighlightedIndex:A,selectedValue:l,listboxId:v,getOptionId:N})})})]})})};exports.Portal=J;exports.SelectView=Se;exports.useSelectState=se;
|
|
2
|
-
//# sourceMappingURL=Select.view-Pq1yAcMm.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Select.view-Pq1yAcMm.cjs","sources":["../../src/components/Portal/Portal.tsx","../../src/components/Form/Select/Select/Select.state.ts","../../src/components/Form/Select/Select/Select.style.ts","../../src/components/Form/Select/Select/Select.view.tsx"],"sourcesContent":["import React, { useEffect, useState } from 'react';\nimport ReactDOM from 'react-dom';\n\ninterface PortalProps {\n children: React.ReactNode;\n containerId?: string;\n}\n\nexport const Portal: React.FC<PortalProps> = ({\n children,\n containerId = 'portal-root',\n}) => {\n const [container, setContainer] = useState<HTMLElement | null>(null);\n\n useEffect(() => {\n let element = document.getElementById(containerId);\n let created = false;\n\n if (!element) {\n created = true;\n element = document.createElement('div');\n element.setAttribute('id', containerId);\n document.body.appendChild(element);\n }\n\n setContainer(element);\n\n return () => {\n // Clean up only if we created it and it's empty?\n // safer not to remove it if other components use it,\n // but if we created it, we might want to remove it if empty.\n // For simplicity, let's keep it.\n if (\n created &&\n element &&\n element.parentNode &&\n element.childNodes.length === 0\n ) {\n element.parentNode.removeChild(element);\n }\n };\n }, [containerId]);\n\n if (!container) return null;\n\n return ReactDOM.createPortal(children, container);\n};\n","import React from 'react';\nimport { SelectProps } from './Select.props';\n\n// The view branches on the shape of the value: an array renders as removable\n// chips, a string as a single label. A caller passing the shape that does not\n// match the current mode (a string with `isMulti`, an array without) has to be\n// brought back in line before anything reads it, or the branch taken silently\n// disagrees with the mode the component is in.\nconst normalizeValue = (\n value: string | Array<string>,\n isMulti?: boolean\n): string | Array<string> => {\n if (isMulti) {\n if (Array.isArray(value)) return value;\n return value === '' ? [] : [value];\n }\n return Array.isArray(value) ? value[0] ?? '' : value;\n};\n\n// Initializes the custom hook 'useSelectState' for managing the state of the Select component\nexport const useSelectState = ({\n placeholder,\n isMulti,\n options,\n // No default value here: `undefined` is exactly what separates controlled\n // from uncontrolled, so defaulting it would pin the select to that default\n // and make `setValue` a permanent no-op.\n value: controlledValue,\n defaultValue,\n id: idProp,\n}: SelectProps) => {\n // `useId` is stable across renders where `Math.random` was not. The\n // delimiter characters are stripped because the view looks itself up with a\n // `#id` selector, where `:`/`«` would make the selector invalid.\n const reactId = React.useId().replace(/[^a-zA-Z0-9_-]/g, '');\n const id = idProp ?? `select-${reactId}`;\n const isControlled = controlledValue !== undefined;\n\n // State hook for tracking mouse hover status over the Select component\n const [isHovered, setIsHovered] = React.useState(false);\n // State hook for tracking focus status of the Select input field\n const [isFocused, setIsFocused] = React.useState(false);\n // Backing store for uncontrolled use. It is still initialized when the\n // select is controlled — harmlessly — so that a component that starts\n // controlled and later drops `value` has somewhere to land.\n const [internalValue, setInternalValue] = React.useState<\n string | Array<string>\n >(() => {\n if (defaultValue !== undefined)\n return normalizeValue(defaultValue, isMulti);\n // A multi-select starts empty: preselecting an option nobody asked for is\n // a selection the user then has to undo.\n if (isMulti) return [];\n // A placeholder means \"start empty\". Without one, the first option stands\n // in for a native <select>'s implicit first-option selection.\n if (placeholder) return '';\n return Array.isArray(options) && options.length > 0 ? options[0].value : '';\n });\n\n // The value everything downstream reads. In controlled mode it is the prop,\n // read fresh on every render, so the selection tracks the parent's state\n // instead of freezing at whatever it was on mount.\n const value = isControlled\n ? normalizeValue(controlledValue as string | Array<string>, isMulti)\n : internalValue;\n\n // In controlled mode the parent owns the value: the component records the\n // intent through `onChange` and waits for the new value to come back down.\n // Writing to internal state here would let the two copies disagree.\n const setValue = React.useCallback(\n (next: string | Array<string>) => {\n if (!isControlled) setInternalValue(next);\n },\n [isControlled]\n );\n\n // State hook for keeping track of the currently highlighted index in the options list\n const [highlightedIndex, setHighlightedIndex] = React.useState<number>(0);\n // State hook for managing visibility of the Select dropdown, initially set to hidden\n const [hide, setHide] = React.useState(true);\n\n // Returns an object containing all stateful values and their associated setters to manage the Select component's state\n return {\n id,\n value,\n setValue,\n hide,\n setHide,\n isHovered,\n setIsHovered,\n isFocused,\n setIsFocused,\n highlightedIndex,\n setHighlightedIndex,\n };\n};\n// Initializes another custom hook 'useItemState' for managing the hover state of each Select item\nexport const useItemState = () => {\n // State hook for tracking mouse hover status over individual Select item options\n const [isHovered, setIsHovered] = React.useState(false);\n // Returns an object with 'isHovered' state and its associated setter from the 'useItemState' hook, for controlling individual Select item hover state\n return { isHovered, setIsHovered };\n};\n","/**\n * Select Styles\n *\n * Design system tokens for the Select component following guidelines:\n * - Typography: Inter/Geist font, specific sizes/weights\n * - Spacing: 4px grid system\n * - Colors: Neutral palette with semantic colors\n * - Rounded corners: Consistent border radius\n * - Transitions: Subtle, physics-based animations\n */\n\nimport { ViewProps } from 'app-studio';\nimport { Size } from './Select.type';\n\n/**\n * Size configurations following 4px grid system\n */\nexport const Sizes: Record<Size, ViewProps> = {\n xs: { height: '28px', width: '28px' },\n sm: { height: '32px', width: '32px' },\n md: { height: '40px', width: '40px' },\n lg: { height: '48px', width: '48px' },\n xl: { height: '56px', width: '56px' },\n};\n\n/**\n * Icon sizes proportional to component size\n */\nexport const IconSizes: Record<Size, number> = {\n xs: 12,\n sm: 14,\n md: 16,\n lg: 18,\n xl: 20,\n};\n\n/**\n * Dropdown container styles\n * - Subtle shadow for elevation\n * - Smooth border and radius\n */\nexport const dropdownStyles: ViewProps = {\n // width handled by JS for Portal positioning\n maxHeight: '280px',\n overflowY: 'auto',\n zIndex: 1000,\n backgroundColor: 'color-white',\n borderRadius: 12,\n borderWidth: '1px',\n borderStyle: 'solid',\n borderColor: 'color-gray-200',\n // Subtle, layered shadow for depth\n boxShadow: '0 4px 12px rgba(0, 0, 0, 0.1)',\n};\n\n/**\n * Dropdown animation keyframes\n */\nexport const dropdownAnimation = {\n enter: {\n opacity: 1,\n transform: 'translateY(0) scale(1)',\n transition: 'all 0.2s ease-in-out',\n },\n exit: {\n opacity: 0,\n transform: 'translateY(-4px) scale(0.98)',\n },\n initial: {\n opacity: 0,\n transform: 'translateY(-8px) scale(0.96)',\n },\n};\n\n/**\n * Option item styles with improved touch targets\n */\nexport const optionStyles: ViewProps = {\n padding: '10px 12px',\n cursor: 'pointer',\n borderRadius: 8, // radius-md\n margin: '2px 4px',\n transition: 'all 0.15s ease-in-out',\n};\n\n/**\n * Option item state variants\n */\nexport const optionStateStyles = {\n default: {},\n hover: {\n backgroundColor: 'color-gray-50',\n },\n highlighted: {\n backgroundColor: 'color-gray-100',\n },\n selected: {\n backgroundColor: 'color-gray-100',\n },\n selectedHighlighted: {\n backgroundColor: 'color-gray-200',\n },\n};\n\n/**\n * Chevron icon animation\n */\nexport const chevronAnimation = {\n open: {\n transform: 'rotate(180deg)',\n transition: 'all 0.2s ease-in-out',\n },\n closed: {\n transform: 'rotate(0deg)',\n transition: 'all 0.2s ease-in-out',\n },\n};\n\n/**\n * Multi-select chip/tag styles\n */\nexport const chipStyles: ViewProps = {\n padding: '4px 8px',\n borderRadius: 8, // radius-md\n backgroundColor: 'color-gray-100',\n fontSize: '12px',\n fontWeight: '500',\n color: 'color-gray-700',\n transition: 'all 0.15s ease-in-out',\n};\n\n/**\n * Scrollbar styles for dropdown\n */\nexport const scrollbarStyles = {\n scrollbarWidth: 'thin' as const,\n scrollbarColor: 'rgba(0, 0, 0, 0.15) transparent',\n};\n","import React, { useCallback, useRef } from 'react';\nimport { Portal } from '../../../Portal/Portal';\nimport { Element, useElementPosition } from 'app-studio';\nimport { Typography } from 'app-studio';\nimport { Horizontal } from 'app-studio';\nimport { Text } from 'app-studio';\nimport { FieldContainer } from '../../../Input/FieldContainer/FieldContainer';\nimport { FieldContent } from '../../../Input/FieldContent/FieldContent';\nimport { FieldIcons } from '../../../Input/FieldIcons/FieldIcons';\nimport { FieldLabel } from '../../../Input/FieldLabel/FieldLabel';\nimport { FieldWrapper } from '../../../Input/FieldWrapper/FieldWrapper';\nimport { ChevronIcon, CloseIcon } from '../../../Icon/FixedIcons';\nimport {\n DropDownProps,\n HiddenSelectProps,\n ItemProps,\n MultiSelectProps,\n SelectBoxProps,\n SelectViewProps,\n} from './Select.props';\nimport {\n IconSizes,\n dropdownStyles,\n dropdownAnimation,\n optionStyles,\n optionStateStyles,\n chevronAnimation,\n chipStyles,\n scrollbarStyles,\n} from './Select.style';\n\nconst withoutFieldShellView = <T extends Record<string, any>>(views?: T): T => {\n if (!views) return {} as T;\n const { container, content, ...layoutViews } = views;\n return layoutViews as T;\n};\n\n// Field sizing now lives in `Input/fieldSizes` and is applied by FieldContent,\n// so this component no longer carries its own copy of the scale.\n\n/**\n * Item Component\n *\n * Renders an individual option item in the select dropdown\n */\nconst Item: React.FC<ItemProps & { isSelected?: boolean }> = ({\n isHovered,\n setIsHovered = () => {},\n option,\n size = 'md',\n callback = () => {},\n style,\n isSelected = false,\n ...props\n}) => {\n // Handles the click event on an option\n const handleOptionClick = (e: React.MouseEvent, option: string) => {\n e.stopPropagation();\n e.preventDefault();\n if (typeof callback === 'function') {\n callback(option);\n }\n };\n\n // Toggles the hover state on the item\n const handleHover = () => setIsHovered(!isHovered);\n\n // Get background color based on state priority\n const getStateStyle = () => {\n if (isSelected && isHovered) return optionStateStyles.selectedHighlighted;\n if (isSelected) return optionStateStyles.selected;\n if (isHovered) return optionStateStyles.highlighted;\n return optionStateStyles.default;\n };\n\n return (\n <Element\n as=\"li\"\n // An option has to say it is one. Without the role the listbox announces\n // a list of nothing, and anything that resolves controls by role — a\n // screen reader, voice control, a test driver — cannot reach these at all.\n role=\"option\"\n aria-selected={isSelected}\n // Layout - improved touch targets\n display=\"flex\"\n alignItems=\"center\"\n justifyContent=\"space-between\"\n listStyleType=\"none\"\n // Apply option styles from design tokens\n {...optionStyles}\n {...getStateStyle()}\n // Event handlers\n onMouseEnter={handleHover}\n onMouseLeave={handleHover}\n onClick={(e: React.MouseEvent) => handleOptionClick(e, option.value)}\n // Apply custom props\n {...props}\n >\n <Text\n fontSize={Typography.fontSizes[size]}\n fontWeight={isSelected ? '500' : '400'}\n lineHeight=\"14px\"\n color={isSelected ? 'color-gray-900' : 'color-gray-700'}\n {...style}\n >\n {option.label}\n </Text>\n {/* Selected indicator */}\n {isSelected && (\n <Element\n as=\"span\"\n // Decoration, and hidden as such. `aria-selected` above already\n // carries this meaning in the way assistive technology reads it,\n // whereas a visible ✓ joins the option's accessible name and turns\n // \"Alpha\" into \"Alpha ✓\" — so a screen reader announces the wrong\n // name, voice control loses \"click Alpha\", and anything resolving\n // the option by its exact label stops finding it at all.\n aria-hidden=\"true\"\n color=\"theme-primary\"\n fontSize=\"14px\"\n marginLeft={8}\n display=\"flex\"\n alignItems=\"center\"\n >\n ✓\n </Element>\n )}\n </Element>\n );\n};\n/**\n * SelectBox Component\n *\n * Renders the main select box with selected value(s)\n */\nconst SelectBox: React.FC<SelectBoxProps> = ({\n size = 'md',\n views = { field: {}, text: {} },\n value,\n isDisabled,\n placeholder,\n removeOption = () => {},\n options,\n}) => {\n const fieldView = views?.field || {};\n const textView = views?.text || {};\n const isMultiValue = Array.isArray(value) && value.length > 0;\n /**\n * Styles for the select field\n */\n const fieldStyles = {\n // Layout properties\n margin: 0,\n width: '95%',\n height: '100%',\n border: 'none',\n // No vertical padding here: the field shell above already applies\n // `shellPaddingY` for the current size. Adding 4px on each side on top of\n // it pushed the content box past the shell's `minHeight`, so a `md` Select\n // rendered at 50px while a `md` TextField rendered at the intended 40px —\n // visibly misaligning the two whenever they sit in the same row.\n paddingVertical: 0,\n paddingHorizontal: 0,\n\n // Typography properties\n fontSize: Typography.fontSizes[size],\n\n fontWeight: '400', // Regular weight\n // Left to the natural line box, as TextField does. A fixed 20px line-height\n // does not fit the shell it lives in: at `md` the shell is 40px tall with\n // 10px of padding and a 1px border on each side, leaving 18px for content.\n // Hard-coding 20px pushed every Select 2px past its own declared height.\n letterSpacing: '-0.01em', // Slight negative tracking for modern look\n\n // Visual properties\n color: isDisabled ? 'color-gray-400' : 'color-gray-900',\n\n // State properties\n cursor: isDisabled ? 'not-allowed' : 'pointer',\n\n // Animation\n transition: 'all 0.2s ease-in-out',\n\n // A single-value trigger stays on one line and ellipsises, via `Text`'s own\n // `maxLines`. Without it a long option label wraps, which silently breaks\n // the control's declared height — a `md` Select showing \"Uma User's\n // workspace\" in a narrow sidebar became two lines tall.\n //\n // `minWidth: 0` is what actually lets it truncate: the trigger is a flex\n // child, and `min-width: auto` would otherwise stop it shrinking below its\n // content, so the clamp would never engage.\n //\n // Multi-select is excluded: its value renders as chips that are meant to\n // wrap, and clamping would hide selections rather than reflow them.\n ...(isMultiValue ? {} : { maxLines: 1, minWidth: 0 }),\n\n // Apply custom styles\n ...fieldView,\n ...textView,\n style: {\n backgroundColor: 'transparent',\n ...(fieldView as any).style,\n ...(textView as any).style,\n },\n };\n const option: any =\n options.length > 0 && options.find((option) => option.value === value);\n return (\n <Text {...fieldStyles}>\n {/* Check if value is an empty string or if value is an array but with no items, then show placeholder */}\n {(value === '' || (Array.isArray(value) && value.length === 0)) &&\n !!placeholder ? (\n placeholder\n ) : (\n <>\n {/* If value is a string, use the option label or value */}\n {typeof value === 'string' ? (\n (option && option.label) ?? value\n ) : // If value is an array and not empty, render MultiSelect options\n Array.isArray(value) && value.length > 0 ? (\n <Horizontal gap={6}>\n {value.map((option) => (\n <MultiSelect\n key={option}\n option={option}\n removeOption={removeOption}\n />\n ))}\n </Horizontal>\n ) : (\n // Handle any other types of value (including objects or unexpected values)\n <span>{value}</span>\n )}\n </>\n )}\n </Text>\n );\n};\nconst HiddenSelect: React.FC<HiddenSelectProps> = ({\n id,\n name,\n value,\n onChange,\n isMulti = false,\n isDisabled = false,\n isReadOnly = false,\n options = [],\n // Swallowed on purpose. `defaultValue` is the Select's own prop — the state\n // hook has already turned it into the `value` below — but it also rides\n // along in `...props`, and React errors on any <select> carrying both\n // (\"Select elements must be either controlled or uncontrolled\"). That error\n // fires on every render and fails test runs that treat console.error as\n // fatal, so the element has to be given one or the other, never both.\n defaultValue: _defaultValue,\n ...props\n}) => {\n // The hidden <select> is the only path that produced a DOM event where every\n // other path produced a value, so the same `onChange` prop had two different\n // argument shapes depending on which one fired. Normalise here.\n const handleChange = (event: React.ChangeEvent<HTMLSelectElement>) => {\n if (!onChange) return;\n onChange(\n isMulti\n ? Array.from(event.target.selectedOptions, (option) => option.value)\n : event.target.value\n );\n };\n return (\n <Element\n id={id}\n name={name}\n as=\"select\"\n opacity={0}\n width={1}\n height={1}\n overflow=\"hidden\"\n position=\"absolute\"\n pointerEvents=\"none\"\n tabIndex={-1}\n aria-hidden=\"true\"\n value={value}\n disabled={isDisabled}\n readOnly={isReadOnly}\n onChange={handleChange}\n multiple={isMulti}\n {...props}\n >\n {options.length > 0 &&\n options.map((option) => {\n return (\n <option key={option.value} value={option.value}>\n {option.label}\n </option>\n );\n })}\n </Element>\n );\n};\n/**\n * DropDown Component\n *\n * Renders the dropdown list of options for the select component\n */\nconst DropDown: React.FC<\n DropDownProps & {\n selectedValue?: string | string[];\n listboxId?: string;\n getOptionId?: (index: number) => string;\n }\n> = ({\n size,\n views = {},\n options,\n callback = () => {},\n highlightedIndex,\n setHighlightedIndex = () => {},\n selectedValue,\n listboxId,\n getOptionId,\n}) => {\n const handleCallback = (option: string) => callback(option);\n\n // Check if an option is selected\n const isOptionSelected = (optionValue: string) => {\n if (Array.isArray(selectedValue)) {\n return selectedValue.includes(optionValue);\n }\n return selectedValue === optionValue;\n };\n\n return (\n <Element\n as=\"ul\"\n role=\"listbox\"\n id={listboxId}\n display=\"flex\"\n flexDirection=\"column\"\n margin={0}\n padding=\"4px\"\n {...dropdownStyles}\n style={scrollbarStyles}\n {...views?.dropDown}\n >\n {options &&\n options.length > 0 &&\n options.map((option, index) => (\n <Item\n key={option.value}\n id={getOptionId ? getOptionId(index) : undefined}\n size={size}\n style={views['text']}\n option={option}\n callback={handleCallback}\n isSelected={isOptionSelected(option.value)}\n isHovered={index === highlightedIndex}\n setIsHovered={() => {}}\n onMouseEnter={() => setHighlightedIndex(index)}\n />\n ))}\n </Element>\n );\n};\n/**\n * MultiSelect Component\n *\n * Renders a selected option in a multi-select component\n */\nexport const MultiSelect: React.FC<MultiSelectProps> = ({\n option,\n size = 'md',\n removeOption = () => {},\n ...props\n}) => {\n const handleClick = () => removeOption(option);\n\n return (\n <Horizontal\n gap={6}\n alignItems=\"center\"\n onClick={(event: any) => event.stopPropagation()}\n {...chipStyles}\n _hover={{\n backgroundColor: 'color-gray-200',\n }}\n {...props}\n >\n <Text\n fontSize={Typography.fontSizes[size]}\n fontWeight=\"500\"\n color=\"color-gray-700\"\n >\n {option}\n </Text>\n\n {/* A real button: `close-button` is not an ARIA role, so the remover was\n invisible to assistive tech and unreachable by keyboard. */}\n <Element\n as=\"button\"\n type=\"button\"\n aria-label={`Remove ${option}`}\n onClick={handleClick}\n display=\"flex\"\n alignItems=\"center\"\n justifyContent=\"center\"\n padding={0}\n border=\"none\"\n backgroundColor=\"transparent\"\n color=\"color-gray-500\"\n cursor=\"pointer\"\n transition=\"all 0.2s ease-in-out\"\n _hover={{\n color: 'color-gray-700',\n }}\n >\n <CloseIcon color=\"inherit\" widthHeight={IconSizes[size]} />\n </Element>\n </Horizontal>\n );\n};\nconst SelectView: React.FC<SelectViewProps> = ({\n id,\n name,\n label,\n value,\n placeholder,\n helperText,\n hide = false,\n error = false,\n isMulti = false,\n isFocused = false,\n isHovered = false,\n isDisabled = false,\n isReadOnly = false,\n isRequired = false,\n isAutoFocus = false,\n options = [],\n shadow = {},\n size = 'md',\n shape = 'default',\n variant = 'default',\n views = {\n text: {},\n icon: {},\n dropDown: {},\n selectBox: {},\n label: {},\n helperText: {},\n },\n onChange = () => {},\n setHide = () => {},\n setValue = () => {},\n setIsHovered = () => {},\n setIsFocused = () => {},\n setHighlightedIndex,\n highlightedIndex,\n isScrollable,\n // Pulled out so it can name the trigger. It used to fall into `...props`,\n // which never reaches the element a screen reader reads.\n 'aria-label': ariaLabel,\n ...props\n}) => {\n const generatedId = React.useId();\n // One id per element: the focusable combobox keeps the public `id`; the\n // aria-hidden native <select>, the label, the listbox and its options get\n // derived ids — the combobox and the native <select> used to share the same\n // `id`, which is invalid HTML and made `htmlFor` ambiguous. The `useId`\n // fallback is stripped of its delimiters because the id is used in `#id`\n // selector lookups below.\n const selectId = id ?? `select-${generatedId.replace(/[^a-zA-Z0-9_-]/g, '')}`;\n const nativeSelectId = `${selectId}-native`;\n const labelId = `${selectId}-label`;\n const listboxId = `${selectId}-listbox`;\n const getOptionId = (index: number) => `${selectId}-option-${index}`;\n\n const {\n ref: triggerRef,\n relation,\n updateRelation,\n } = useElementPosition({\n trackChanges: true,\n trackOnScroll: true,\n trackOnResize: true,\n throttleMs: 10,\n });\n\n const dropdownRef = useRef<HTMLDivElement>(null);\n\n // Get optimal positioning style based on available space\n // Get optimal positioning style based on available space\n const getDropdownStyle = () => {\n if (!triggerRef.current) return {};\n\n const rect = triggerRef.current.getBoundingClientRect();\n const baseStyle: React.CSSProperties = {\n position: 'fixed',\n left: rect.left,\n width: rect.width,\n zIndex: 10000,\n };\n\n // Use relation to determine vertical placement if available, otherwise default to bottom\n const isTop = relation?.space?.vertical === 'top';\n\n if (isTop) {\n return {\n ...baseStyle,\n bottom: window.innerHeight - rect.top + 8, // 8px gap\n };\n } else {\n return {\n ...baseStyle,\n top: rect.bottom + 8, // 8px gap\n };\n }\n };\n // close when *any* other select opens\n React.useEffect(() => {\n const handleCloseAll = () => setHide(true);\n document.addEventListener('closeAllSelects', handleCloseAll);\n return () =>\n document.removeEventListener('closeAllSelects', handleCloseAll);\n }, [setHide]);\n\n // Mount-only autofocus, mirroring the native `autofocus` attribute: the\n // focusable element is the combobox trigger, not the aria-hidden <select>.\n React.useEffect(() => {\n if (isAutoFocus && !isDisabled && !isReadOnly) {\n triggerRef.current?.focus();\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n // Add a global click handler to close the dropdown when clicking outside\n React.useEffect(() => {\n const handleGlobalClick = (e: MouseEvent) => {\n const target = e.target as HTMLElement;\n // Only close if clicking outside of this specific select component\n if (!target.closest(`#${selectId}`) && !hide) {\n setHide(true);\n }\n };\n\n document.addEventListener('click', handleGlobalClick);\n return () => {\n document.removeEventListener('click', handleGlobalClick);\n };\n }, [selectId, hide, setHide]);\n const handleHover = () => setIsHovered(!isHovered);\n const handleFocus = () => setIsFocused(true);\n const handleClick = (event: React.MouseEvent<HTMLButtonElement>) => {\n // tell all other selects to close\n document.dispatchEvent(new Event('closeAllSelects'));\n\n if (event && event.stopPropagation) event.stopPropagation();\n\n // Toggle dropdown visibility\n const newHideState = !hide;\n setHide(newHideState);\n setIsFocused(!newHideState); // Set focus state based on dropdown visibility\n };\n const handleCallback = useCallback(\n (option: string) => {\n // Close dropdown after selection\n setHide(true);\n\n // Tell all other selects to close\n document.dispatchEvent(new Event('closeAllSelects'));\n\n // Update value based on multi-select or single-select mode.\n // `onChange` reports the *next* selection, not the option that was\n // clicked: a controlled parent has to be able to store what it gets\n // back, and for a multi-select that is the whole array.\n if (isMulti && Array.isArray(value)) {\n if (!value.includes(option)) {\n const newValue = [...value, option];\n setValue(newValue);\n if (onChange) onChange(newValue);\n }\n } else {\n setValue(option);\n if (onChange) onChange(option);\n }\n\n // Set focus to indicate selection\n setIsFocused(true);\n },\n [isMulti, value, setHide, setValue, onChange, setIsFocused]\n );\n const handleRemoveOption = (valueOption: string) => {\n if (Array.isArray(value) && value.includes(valueOption)) {\n const newValue = value.filter((option) => option !== valueOption);\n setValue(newValue);\n // Removing a chip is a change like any other. Without this the parent of\n // a controlled multi-select never hears about it, so the chip comes\n // straight back on the next render.\n if (onChange) onChange(newValue);\n }\n };\n const showLabel = !!label;\n const layoutViews = withoutFieldShellView(views);\n\n return (\n <FieldContainer\n ref={triggerRef as React.RefObject<HTMLDivElement>}\n position=\"relative\"\n width=\"100%\"\n display=\"inline-block\"\n id={selectId}\n // `SelectBox` is not an ARIA role, so the trigger was exposed as a plain\n // container: not focusable, not announced, and operable only by mouse.\n // The native `<select>` behind it is `aria-hidden` and `tabIndex={-1}`, so\n // there was no keyboard path to this control at all.\n role=\"combobox\"\n aria-haspopup=\"listbox\"\n aria-expanded={!hide}\n // The visible label names the combobox via `aria-labelledby`; an explicit\n // `aria-label` prop wins when the caller provides one.\n aria-labelledby={!ariaLabel && showLabel ? labelId : undefined}\n aria-label={ariaLabel}\n aria-controls={listboxId}\n aria-activedescendant={\n !hide && options.length > 0\n ? getOptionId(highlightedIndex ?? 0)\n : undefined\n }\n aria-disabled={isDisabled || undefined}\n aria-required={isRequired || undefined}\n tabIndex={isDisabled || isReadOnly ? -1 : 0}\n helperText={helperText}\n error={error}\n views={layoutViews}\n onKeyDown={(e: React.KeyboardEvent<HTMLDivElement>) => {\n if (isDisabled || isReadOnly) return;\n // Keys pressed on descendants (the chip-remove buttons) must keep\n // their native activation instead of being hijacked by the trigger.\n if (e.target !== e.currentTarget) return;\n\n // Closed: Enter, Space and Down open the list — the same keys a\n // native select answers to, so nobody has to learn this one separately.\n if (hide) {\n if (e.key === 'Enter' || e.key === ' ' || e.key === 'ArrowDown') {\n e.preventDefault();\n document.dispatchEvent(new Event('closeAllSelects'));\n setHide(false);\n setIsFocused(true);\n }\n return;\n }\n\n // Open: arrows move the highlight, Enter commits it, Escape closes.\n const currentIndex = highlightedIndex ?? 0;\n if (e.key === 'ArrowDown') {\n e.preventDefault();\n setHighlightedIndex?.(Math.min(currentIndex + 1, options.length - 1));\n } else if (e.key === 'ArrowUp') {\n e.preventDefault();\n setHighlightedIndex?.(Math.max(currentIndex - 1, 0));\n } else if (e.key === 'Enter') {\n e.preventDefault();\n const option = options[currentIndex];\n if (option) handleCallback(option.value);\n } else if (e.key === 'Escape') {\n e.preventDefault();\n setHide(true);\n }\n }}\n onClick={(e: React.MouseEvent<HTMLDivElement>) => {\n // Stop propagation to prevent clicks from bubbling up\n e.stopPropagation();\n\n // Only handle click if not disabled or readonly\n if (!(isDisabled || isReadOnly)) {\n handleClick(e as unknown as React.MouseEvent<HTMLButtonElement>);\n }\n }}\n >\n <FieldContent\n label={label}\n size={size}\n error={error}\n shape={shape}\n views={views}\n shadow={shadow}\n variant={variant}\n value={value}\n color={'theme-primary'}\n isHovered={isHovered}\n isDisabled={isDisabled}\n isReadOnly={isReadOnly}\n isFocused={isFocused}\n showLabel={showLabel}\n // Sizing comes from FieldContent's shared scale (`Input/fieldSizes`).\n onMouseEnter={handleHover}\n onMouseLeave={handleHover}\n position=\"relative\"\n {...views?.content}\n >\n <FieldWrapper>\n {showLabel && (\n <FieldLabel\n id={labelId}\n htmlFor={nativeSelectId}\n color={'theme-primary'}\n error={error}\n {...views?.label}\n >\n {label}\n </FieldLabel>\n )}\n <HiddenSelect\n id={nativeSelectId}\n name={name}\n options={options}\n onChange={onChange}\n value={value}\n isDisabled={isDisabled}\n isReadOnly={isReadOnly}\n isMulti={isMulti}\n // Real form semantics live on the native element: `required`\n // makes submission enforcement work even though the visible\n // combobox is a div.\n required={isRequired || undefined}\n onFocus={handleFocus}\n {...props}\n />\n <SelectBox\n options={options}\n size={size}\n views={views}\n value={value}\n isDisabled={isDisabled}\n placeholder={placeholder}\n removeOption={handleRemoveOption}\n />\n </FieldWrapper>\n <FieldIcons>\n {!isReadOnly && !isDisabled && (\n <Element\n display=\"flex\"\n alignItems=\"center\"\n justifyContent=\"center\"\n style={hide ? chevronAnimation.closed : chevronAnimation.open}\n >\n <ChevronIcon\n color=\"inherit\"\n widthHeight={IconSizes[size]}\n style={views.icon}\n orientation=\"down\"\n />\n </Element>\n )}\n </FieldIcons>\n {!hide && options.length > 0 && (\n <Portal>\n <Element\n ref={dropdownRef}\n onClick={(e: React.MouseEvent) => e.stopPropagation()}\n style={{\n ...getDropdownStyle(),\n ...dropdownAnimation.enter,\n }}\n >\n <DropDown\n size={size}\n views={views}\n options={options}\n callback={handleCallback}\n highlightedIndex={highlightedIndex}\n setHighlightedIndex={setHighlightedIndex}\n selectedValue={value}\n listboxId={listboxId}\n getOptionId={getOptionId}\n />\n </Element>\n </Portal>\n )}\n </FieldContent>\n </FieldContainer>\n );\n};\nexport default SelectView;\n"],"names":["Portal","children","containerId","container","setContainer","useState","useEffect","element","created","ReactDOM","normalizeValue","value","isMulti","useSelectState","placeholder","options","controlledValue","defaultValue","idProp","reactId","React","id","isControlled","isHovered","setIsHovered","isFocused","setIsFocused","internalValue","setInternalValue","setValue","next","highlightedIndex","setHighlightedIndex","hide","setHide","IconSizes","dropdownStyles","dropdownAnimation","optionStyles","optionStateStyles","chevronAnimation","chipStyles","scrollbarStyles","withoutFieldShellView","views","content","layoutViews","Item","option","size","callback","style","isSelected","props","handleOptionClick","e","handleHover","getStateStyle","jsxs","Element","jsx","Text","Typography","SelectBox","isDisabled","removeOption","fieldView","textView","isMultiValue","fieldStyles","Fragment","Horizontal","MultiSelect","HiddenSelect","name","onChange","isReadOnly","_defaultValue","handleChange","event","DropDown","selectedValue","listboxId","getOptionId","handleCallback","isOptionSelected","optionValue","index","handleClick","CloseIcon","SelectView","label","helperText","error","isRequired","isAutoFocus","shadow","shape","variant","isScrollable","ariaLabel","generatedId","selectId","nativeSelectId","labelId","triggerRef","relation","updateRelation","useElementPosition","dropdownRef","useRef","getDropdownStyle","rect","baseStyle","_a","handleCloseAll","handleGlobalClick","handleFocus","newHideState","useCallback","newValue","handleRemoveOption","valueOption","showLabel","FieldContainer","currentIndex","FieldContent","FieldWrapper","FieldLab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,QAASuB,GACR,GAAGhE,CAAA,CAAA,EAENO,EAAAA,IAACG,GAAA,CACC,QAAAhD,EACA,KAAAkC,EACA,MAAAL,EACA,MAAAjC,EACA,WAAAqD,EACA,YAAAlD,EACA,aAAc2G,EAAA,CAAA,CAChB,EACF,EACA7D,EAAAA,IAACqE,EAAAA,WAAA,CACE,SAAA,CAACrD,GAAc,CAACZ,GACfJ,EAAAA,IAACD,EAAAA,QAAA,CACC,QAAQ,OACR,WAAW,SACX,eAAe,SACf,MAAO1B,EAAOO,EAAiB,OAASA,EAAiB,KAEzD,SAAAoB,EAAAA,IAACsE,EAAAA,YAAA,CACC,MAAM,UACN,YAAa/F,EAAUc,CAAI,EAC3B,MAAOL,EAAM,KACb,YAAY,MAAA,CAAA,CACd,CAAA,EAGN,EACC,CAACX,GAAQlB,EAAQ,OAAS,SACxBf,EAAA,CACC,SAAA4D,EAAAA,IAACD,EAAAA,QAAA,CACC,IAAKkD,GACL,QAAU,GAAwB,EAAE,gBAAA,EACpC,MAAO,CACL,GAAGE,GAAA,EACH,GAAG1E,GAAkB,KAAA,EAGvB,SAAAuB,EAAAA,IAACoB,GAAA,CACC,KAAA/B,EACA,MAAAL,EACA,QAAA7B,EACA,SAAUqE,EACV,iBAAArD,EACA,oBAAAC,EACA,cAAerB,EACf,UAAAuE,EACA,YAAAC,CAAA,CAAA,CACF,CAAA,CACF,CACF,CAAA,CAAA,CAAA,CAEJ,CAAA,CAGN"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";const h=require("react"),t=require("react/jsx-runtime"),a=require("app-studio"),Q=require("./Label-Bd0TpfkG.cjs"),U=({isDisabled:x,isChecked:s})=>{const[r,d]=h.useState(!1),[g,c]=h.useState(s||!1),[u,f]=h.useState(s||!1);return h.useEffect(()=>{s!==void 0&&(c(s),f(s))},[s]),{isHovered:r,setIsHovered:d,on:g,setOn:c,value:u,setValue:f}},k={xs:{height:"10px",width:"10px"},sm:{height:"14px",width:"14px"},md:{height:"18px",width:"18px"},lg:{height:"22px",width:"22px"},xl:{height:"26px",width:"26px"}},X={xs:{height:"20px",width:"40px"},sm:{height:"24px",width:"48px"},md:{height:"28px",width:"56px"},lg:{height:"32px",width:"64px"},xl:{height:"36px",width:"72px"}},Z={xs:{height:"22px",width:"52px"},sm:{height:"26px",width:"62px"},md:{height:"30px",width:"72px"},lg:{height:"34px",width:"84px"},xl:{height:"38px",width:"96px"}},_={xs:"9px",sm:"10px",md:"11px",lg:"12px",xl:"13px"},m={xs:{paddingVertical:5,paddingHorizontal:3},sm:{paddingVertical:5,paddingHorizontal:3},md:{paddingVertical:5,paddingHorizontal:5},lg:{paddingVertical:5,paddingHorizontal:5},xl:{paddingVertical:5,paddingHorizontal:5}},i={default:{active:"theme-primary",inactive:"color-gray-300",knob:"color-white",disabled:"color-gray-200"},states:{hover:{active:"theme-primary",inactive:"color-gray-400",activeOpacity:.9},focus:{active:{outline:"none",boxShadow:"0 0 0 2px white, 0 0 0 4px theme-primary"},inactive:{outline:"none",boxShadow:"0 0 0 2px white, 0 0 0 4px color-gray-200"}}}},q={slider:{transition:"all 0.2s ease-in-out"},knob:{transition:"all 0.2s ease-in-out"}},A=x=>t.jsx(a.Input,{type:"checkbox",...x}),D=({id:x,name:s,label:r,inActiveChild:d,isChecked:g,activeChild:c,labelPosition:u="right",shadow:f={},size:e="sm",value:B=!1,isHovered:p=!1,isDisabled:o=!1,isReadOnly:w=!1,on:tt,setOn:M=()=>{},onChange:j,setValue:W=()=>{},setIsHovered:V=()=>{},helperText:et,description:S,views:y={slider:{},circle:{},label:{}},...E})=>{const R=h.useId(),v=x??R,[O,I]=h.useState(!1),n=typeof g=="boolean"?g:B,C=!!(c||d)?Z[e]:X[e],z=`${m[e].paddingHorizontal}px`,F=`${m[e].paddingHorizontal+2}px`,H=`calc(${k[e].width} + ${m[e].paddingHorizontal}px + 4px)`,L=_[e],K=b=>{if(!w&&!o){const l=b.target.checked;W(l),M(l),j&&j(l)}},Y=()=>V(!0),G=()=>V(!1),J=b=>{let l=!0;try{l=b.target.matches(":focus-visible")}catch{}I(l)},N=()=>I(!1),T=`${v}-description`,P={container:{gap:12,display:"flex",height:"fit-content",width:"fit-content",alignItems:"center",cursor:o?"not-allowed":w?"default":"pointer",opacity:o?.6:1,transition:"all 0.2s ease-in-out",...y.label}},$=t.jsxs(Q.Label,{htmlFor:v,onMouseEnter:Y,onMouseLeave:G,...P.container,children:[u==="left"&&r&&t.jsx(a.Text,{fontWeight:"500",color:o?"color-gray-400":"inherit",transition:"color 0.2s ease, opacity 0.2s ease",children:r}),t.jsxs(a.View,{display:"flex",alignItems:"center",justifyContent:"center",position:"relative",marginBottom:4,borderRadius:"9999px",backgroundColor:o?i.default.disabled:n?p?i.states.hover.active:i.default.active:p?i.states.hover.inactive:i.default.inactive,opacity:!o&&n&&p?i.states.hover.activeOpacity:1,cursor:"pointer",...q.slider,...f,...m[e],...C,...y.slider,...O?n?i.states.focus.active:i.states.focus.inactive:{},children:[t.jsx(A,{id:v,name:s,role:"switch","aria-checked":n,position:"absolute",top:0,left:0,width:"100%",height:"100%",margin:0,opacity:0,zIndex:2,cursor:o?"not-allowed":w?"default":"pointer",checked:n,onChange:K,onFocus:J,onBlur:N,disabled:o,readOnly:w,"aria-describedby":S?T:void 0,...E}),c&&n&&t.jsx(a.View,{marginLeft:F,marginRight:H,transition:"all 0.2s ease-in-out",display:"flex",alignItems:"center",justifyContent:"center",height:"100%",width:"100%",overflow:"hidden",fontSize:L,color:"color-white",fontWeight:600,children:c}),t.jsx(a.View,{position:"absolute",top:"50%",left:n?void 0:z,right:n?z:void 0,borderRadius:"50%",backgroundColor:i.default.knob,boxShadow:p?"0 4px 10px rgba(15, 23, 42, 0.18)":"0 1px 3px rgba(15, 23, 42, 0.18)",transform:`translateY(-50%) ${p?"scale(1.05)":"scale(1)"}`,...q.knob,zIndex:1,...k[e],...y.circle}),d&&!n&&t.jsx(a.View,{marginLeft:H,marginRight:F,transition:"all 0.2s ease-in-out",display:"flex",alignItems:"center",justifyContent:"center",height:"100%",width:"100%",overflow:"hidden",fontSize:L,color:"color-white",fontWeight:600,children:d})]}),u==="right"&&r&&t.jsx(a.Text,{fontWeight:"500",color:o?"color-gray-400":"inherit",transition:"all 0.2s ease-in-out",children:r})]});return S?t.jsxs(a.Vertical,{gap:4,width:"fit-content",children:[$,t.jsx(a.Text,{id:T,color:"color-gray-500",fontSize:"14px",lineHeight:"20px",children:S})]}):$};exports.SwitchView=D;exports.useSwitchState=U;
|
|
2
|
-
//# sourceMappingURL=Switch.view-CQZO_Js7.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Switch.view-CQZO_Js7.cjs","sources":["../../src/components/Form/Switch/Switch/Switch.state.ts","../../src/components/Form/Switch/Switch/Switch.style.ts","../../src/components/Form/Switch/Switch/Switch.view.tsx"],"sourcesContent":["import React, { useEffect } from 'react';\nimport { SwitchProps } from './Switch.props';\n\n// This file defines a custom hook for managing the state of a Switch component.\n// It allows tracking whether the switch is hovered, and its on/off state based on 'isDisabled' and 'isChecked' properties.\nexport const useSwitchState = ({ isDisabled, isChecked }: SwitchProps) => {\n const [isHovered, setIsHovered] = React.useState(false);\n const [on, setOn] = React.useState(isChecked || false);\n const [value, setValue] = React.useState(isChecked || false);\n\n // Update the value when isChecked changes\n useEffect(() => {\n if (isChecked !== undefined) {\n setOn(isChecked);\n setValue(isChecked);\n }\n }, [isChecked]);\n\n return {\n isHovered,\n setIsHovered,\n on,\n setOn,\n value,\n setValue,\n };\n};\n","/**\n * Switch Styles\n *\n * Defines the styles for the Switch component following the design guidelines:\n * - Typography: Inter/Geist font, specific sizes/weights\n * - Spacing: 4px grid system\n * - Colors: Neutral palette with semantic colors\n * - Rounded corners: Consistent border radius\n * - Transitions: Subtle animations\n */\n\nimport { ViewProps } from 'app-studio';\nimport { Size } from './Switch.type';\n/**\n * Knob (circle) sizes for the Switch component\n * Following the 4px grid system - dimensions réduites\n */\nexport const KnobSizes: Record<Size, ViewProps> = {\n xs: { height: '10px', width: '10px' },\n sm: { height: '14px', width: '14px' },\n md: { height: '18px', width: '18px' },\n lg: { height: '22px', width: '22px' },\n xl: { height: '26px', width: '26px' },\n};\n\n/**\n * Slider (track) sizes for the Switch component\n * Following the 4px grid system - dimensions réduites\n */\nexport const SliderSizes: Record<Size, ViewProps> = {\n xs: {\n height: '20px',\n width: '40px',\n },\n sm: {\n height: '24px',\n width: '48px',\n },\n md: {\n height: '28px',\n width: '56px',\n },\n lg: {\n height: '32px',\n width: '64px',\n },\n xl: {\n height: '36px',\n width: '72px',\n },\n};\n\n/**\n * Slider (track) sizes when the Switch has activeChild/inActiveChild content.\n * Wider tracks ensure the text rendered alongside the knob is readable.\n */\nexport const ContentSliderSizes: Record<Size, ViewProps> = {\n xs: {\n height: '22px',\n width: '52px',\n },\n sm: {\n height: '26px',\n width: '62px',\n },\n md: {\n height: '30px',\n width: '72px',\n },\n lg: {\n height: '34px',\n width: '84px',\n },\n xl: {\n height: '38px',\n width: '96px',\n },\n};\n\n/**\n * Default font sizes for activeChild/inActiveChild text — matched to the\n * Switch size so the embedded label remains legible.\n */\nexport const ContentFontSizes: Record<Size, string> = {\n xs: '9px',\n sm: '10px',\n md: '11px',\n lg: '12px',\n xl: '13px',\n};\n\n/**\n * Padding for the Switch slider - ajusté pour les nouvelles dimensions\n * Following the 4px grid system\n */\nexport const SliderPadding: Record<Size, Record<string, number>> = {\n xs: { paddingVertical: 5, paddingHorizontal: 3 },\n sm: { paddingVertical: 5, paddingHorizontal: 3 },\n md: { paddingVertical: 5, paddingHorizontal: 5 },\n lg: { paddingVertical: 5, paddingHorizontal: 5 },\n xl: { paddingVertical: 5, paddingHorizontal: 5 },\n};\n\n/**\n * Color schemes for the Switch component\n */\nexport const ColorSchemes = {\n // Default colors\n default: {\n active: 'theme-primary',\n inactive: 'color-gray-300',\n knob: 'color-white',\n disabled: 'color-gray-200',\n },\n // State-specific colors\n states: {\n hover: {\n active: 'theme-primary',\n inactive: 'color-gray-400',\n activeOpacity: 0.9,\n },\n focus: {\n active: {\n outline: 'none',\n boxShadow: '0 0 0 2px white, 0 0 0 4px theme-primary',\n },\n inactive: {\n outline: 'none',\n boxShadow: '0 0 0 2px white, 0 0 0 4px color-gray-200',\n },\n },\n },\n};\n\n/**\n * Transition styles for the Switch component\n */\nexport const TransitionStyles = {\n slider: {\n transition: 'all 0.2s ease-in-out',\n },\n knob: {\n transition: 'all 0.2s ease-in-out',\n },\n};\n","/**\n * Switch View Component\n *\n * Renders a switch toggle with various styles and states\n * according to the design guidelines.\n */\n\nimport React from 'react';\nimport { Input } from 'app-studio';\nimport { Label } from '../../../Form/Label/Label';\nimport { View } from 'app-studio';\nimport { Text } from 'app-studio';\nimport { Vertical } from 'app-studio';\nimport { SwitchViewProps } from './Switch.props';\nimport {\n KnobSizes,\n SliderPadding,\n SliderSizes,\n ContentSliderSizes,\n ContentFontSizes,\n ColorSchemes,\n TransitionStyles,\n} from './Switch.style';\nconst SwitchContent = (props: any) => <Input type=\"checkbox\" {...props} />;\nconst SwitchView: React.FC<SwitchViewProps> = ({\n id,\n name,\n label,\n inActiveChild,\n isChecked,\n activeChild,\n labelPosition = 'right',\n shadow = {},\n size = 'sm',\n value = false,\n isHovered = false,\n isDisabled = false,\n isReadOnly = false,\n on,\n setOn = () => {},\n onChange,\n setValue = () => {},\n setIsHovered = () => {},\n helperText,\n description,\n views = { slider: {}, circle: {}, label: {} },\n ...props\n}) => {\n const generatedId = React.useId();\n const switchId = id ?? generatedId;\n const [isFocused, setIsFocused] = React.useState(false);\n const checked = typeof isChecked === 'boolean' ? isChecked : value;\n const hasContent = Boolean(activeChild || inActiveChild);\n const sliderDimensions = hasContent\n ? ContentSliderSizes[size]\n : SliderSizes[size];\n const knobOffset = `${SliderPadding[size].paddingHorizontal}px`;\n const contentSpace = `${SliderPadding[size].paddingHorizontal + 2}px`;\n const contentInset = `calc(${KnobSizes[size].width} + ${SliderPadding[size].paddingHorizontal}px + 4px)`;\n const contentFontSize = ContentFontSizes[size];\n\n const handleToggle = (event: React.ChangeEvent<HTMLInputElement>) => {\n if (!isReadOnly && !isDisabled) {\n const newValue = event.target.checked;\n setValue(newValue);\n setOn(newValue);\n if (onChange) onChange(newValue);\n }\n };\n const handleMouseEnter = () => setIsHovered(true);\n const handleMouseLeave = () => setIsHovered(false);\n const handleFocus = (event: React.FocusEvent<HTMLInputElement>) => {\n let visible = true;\n try {\n visible = event.target.matches(':focus-visible');\n } catch {\n // engines without :focus-visible support: always show the ring\n }\n setIsFocused(visible);\n };\n const handleBlur = () => setIsFocused(false);\n const descriptionId = `${switchId}-description`;\n /**\n * Styles for the switch component\n */\n const switchStyle = {\n container: {\n // Layout properties\n gap: 12, // 3 × 4px grid\n display: 'flex',\n height: 'fit-content',\n width: 'fit-content',\n alignItems: 'center',\n\n // Typography properties\n\n // State properties\n cursor: isDisabled ? 'not-allowed' : isReadOnly ? 'default' : 'pointer',\n opacity: isDisabled ? 0.6 : 1,\n\n // Animation\n transition: 'all 0.2s ease-in-out',\n\n // Apply custom styles\n ...views.label,\n },\n };\n // Rest props are routed to the input only: spreading them here as well\n // landed consumer `aria-*`/`id` attributes on two elements at once.\n const control = (\n <Label\n htmlFor={switchId}\n onMouseEnter={handleMouseEnter}\n onMouseLeave={handleMouseLeave}\n {...switchStyle.container}\n >\n {/* Label on the left side */}\n {labelPosition === 'left' && label && (\n <Text\n fontWeight=\"500\" // Medium weight for better readability\n color={isDisabled ? 'color-gray-400' : 'inherit'}\n transition=\"color 0.2s ease, opacity 0.2s ease\"\n >\n {label}\n </Text>\n )}\n\n {/* Switch slider */}\n <View\n // Layout properties\n display=\"flex\"\n alignItems=\"center\"\n justifyContent=\"center\"\n position=\"relative\"\n marginBottom={4} // 1 × 4px grid\n // Visual properties\n borderRadius=\"9999px\" // Full rounded for pill shape\n backgroundColor={\n isDisabled\n ? ColorSchemes.default.disabled\n : checked\n ? isHovered\n ? ColorSchemes.states.hover.active\n : ColorSchemes.default.active\n : isHovered\n ? ColorSchemes.states.hover.inactive\n : ColorSchemes.default.inactive\n }\n opacity={\n !isDisabled && checked && isHovered\n ? ColorSchemes.states.hover.activeOpacity\n : 1\n }\n // State properties\n cursor=\"pointer\"\n // Animation\n {...TransitionStyles.slider}\n // Apply styles\n {...shadow}\n {...SliderPadding[size]}\n {...sliderDimensions}\n {...views['slider']}\n {...(isFocused\n ? checked\n ? ColorSchemes.states.focus.active\n : ColorSchemes.states.focus.inactive\n : {})}\n >\n {/* Real control: a transparent input covering the whole track, so the\n element found by role/name is the one that receives clicks */}\n <SwitchContent\n id={switchId}\n name={name}\n role=\"switch\"\n aria-checked={checked}\n position=\"absolute\"\n top={0}\n left={0}\n width=\"100%\"\n height=\"100%\"\n margin={0}\n opacity={0}\n zIndex={2}\n cursor={\n isDisabled ? 'not-allowed' : isReadOnly ? 'default' : 'pointer'\n }\n checked={checked}\n onChange={handleToggle}\n onFocus={handleFocus}\n onBlur={handleBlur}\n disabled={isDisabled}\n readOnly={isReadOnly}\n aria-describedby={description ? descriptionId : undefined}\n {...props}\n />\n {/* Active content */}\n {activeChild && checked && (\n <View\n marginLeft={contentSpace}\n marginRight={contentInset}\n transition=\"all 0.2s ease-in-out\"\n display=\"flex\"\n alignItems=\"center\"\n justifyContent=\"center\"\n height=\"100%\"\n width=\"100%\"\n overflow=\"hidden\"\n fontSize={contentFontSize}\n color=\"color-white\"\n fontWeight={600}\n >\n {activeChild}\n </View>\n )}\n\n {/* Knob */}\n <View\n position=\"absolute\"\n top=\"50%\"\n left={checked ? undefined : knobOffset}\n right={checked ? knobOffset : undefined}\n borderRadius=\"50%\"\n backgroundColor={ColorSchemes.default.knob}\n boxShadow={\n isHovered\n ? '0 4px 10px rgba(15, 23, 42, 0.18)'\n : '0 1px 3px rgba(15, 23, 42, 0.18)'\n }\n transform={`translateY(-50%) ${\n isHovered ? 'scale(1.05)' : 'scale(1)'\n }`}\n {...TransitionStyles.knob}\n zIndex={1} // Ensure knob is above content\n {...KnobSizes[size]}\n {...views['circle']}\n />\n\n {/* Inactive content */}\n {inActiveChild && !checked && (\n <View\n marginLeft={contentInset}\n marginRight={contentSpace}\n transition=\"all 0.2s ease-in-out\"\n display=\"flex\"\n alignItems=\"center\"\n justifyContent=\"center\"\n height=\"100%\"\n width=\"100%\"\n overflow=\"hidden\"\n fontSize={contentFontSize}\n color=\"color-white\"\n fontWeight={600}\n >\n {inActiveChild}\n </View>\n )}\n </View>\n\n {/* Label on the right side */}\n {labelPosition === 'right' && label && (\n <Text\n fontWeight=\"500\" // Medium weight for better readability\n color={isDisabled ? 'color-gray-400' : 'inherit'}\n transition=\"all 0.2s ease-in-out\"\n >\n {label}\n </Text>\n )}\n </Label>\n );\n\n if (!description) return control;\n\n // The description sits outside the <label> so it describes the input via\n // `aria-describedby` instead of polluting its accessible name.\n return (\n <Vertical gap={4} width=\"fit-content\">\n {control}\n <Text\n id={descriptionId}\n color=\"color-gray-500\"\n fontSize=\"14px\"\n lineHeight=\"20px\"\n >\n {description}\n </Text>\n </Vertical>\n );\n};\nexport default SwitchView;\n"],"names":["useSwitchState","isDisabled","isChecked","isHovered","setIsHovered","React","on","setOn","value","setValue","useEffect","KnobSizes","SliderSizes","ContentSliderSizes","ContentFontSizes","SliderPadding","ColorSchemes","TransitionStyles","SwitchContent","props","jsx","Input","SwitchView","id","name","label","inActiveChild","activeChild","labelPosition","shadow","size","isReadOnly","onChange","helperText","description","views","generatedId","switchId","isFocused","setIsFocused","checked","sliderDimensions","knobOffset","contentSpace","contentInset","contentFontSize","handleToggle","event","newValue","handleMouseEnter","handleMouseLeave","handleFocus","visible","handleBlur","descriptionId","switchStyle","control","jsxs","Label","Text","View","Vertical"],"mappings":"+HAKaA,EAAiB,CAAC,CAAE,WAAAC,EAAY,UAAAC,KAA6B,CACxE,KAAM,CAACC,EAAWC,CAAY,EAAIC,EAAM,SAAS,EAAK,EAChD,CAACC,EAAIC,CAAK,EAAIF,EAAM,SAASH,GAAa,EAAK,EAC/C,CAACM,EAAOC,CAAQ,E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ACwC,EAAAA,KAAA,CACC,WAAYhB,EACZ,YAAaD,EACb,WAAW,uBACX,QAAQ,OACR,WAAW,SACX,eAAe,SACf,OAAO,OACP,MAAM,OACN,SAAS,SACT,SAAUE,EACV,MAAM,cACN,WAAY,IAEX,SAAAnB,CAAA,CAAA,CACH,CAAA,CAAA,EAKHE,IAAkB,SAAWH,GAC5BL,EAAAA,IAACuC,EAAAA,KAAA,CACC,WAAW,MACX,MAAO1D,EAAa,iBAAmB,UACvC,WAAW,uBAEV,SAAAwB,CAAA,CAAA,CACH,CAAA,CAAA,EAKN,OAAKS,EAKHuB,EAAAA,KAACI,EAAAA,SAAA,CAAS,IAAK,EAAG,MAAM,cACrB,SAAA,CAAAL,EACDpC,EAAAA,IAACuC,EAAAA,KAAA,CACC,GAAIL,EACJ,MAAM,iBACN,SAAS,OACT,WAAW,OAEV,SAAApB,CAAA,CAAA,CACH,EACF,EAfuBsB,CAiB3B"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Switch.view-QLZ7O5Z7.mjs","sources":["../../src/components/Form/Switch/Switch/Switch.state.ts","../../src/components/Form/Switch/Switch/Switch.style.ts","../../src/components/Form/Switch/Switch/Switch.view.tsx"],"sourcesContent":["import React, { useEffect } from 'react';\nimport { SwitchProps } from './Switch.props';\n\n// This file defines a custom hook for managing the state of a Switch component.\n// It allows tracking whether the switch is hovered, and its on/off state based on 'isDisabled' and 'isChecked' properties.\nexport const useSwitchState = ({ isDisabled, isChecked }: SwitchProps) => {\n const [isHovered, setIsHovered] = React.useState(false);\n const [on, setOn] = React.useState(isChecked || false);\n const [value, setValue] = React.useState(isChecked || false);\n\n // Update the value when isChecked changes\n useEffect(() => {\n if (isChecked !== undefined) {\n setOn(isChecked);\n setValue(isChecked);\n }\n }, [isChecked]);\n\n return {\n isHovered,\n setIsHovered,\n on,\n setOn,\n value,\n setValue,\n };\n};\n","/**\n * Switch Styles\n *\n * Defines the styles for the Switch component following the design guidelines:\n * - Typography: Inter/Geist font, specific sizes/weights\n * - Spacing: 4px grid system\n * - Colors: Neutral palette with semantic colors\n * - Rounded corners: Consistent border radius\n * - Transitions: Subtle animations\n */\n\nimport { ViewProps } from 'app-studio';\nimport { Size } from './Switch.type';\n/**\n * Knob (circle) sizes for the Switch component\n * Following the 4px grid system - dimensions réduites\n */\nexport const KnobSizes: Record<Size, ViewProps> = {\n xs: { height: '10px', width: '10px' },\n sm: { height: '14px', width: '14px' },\n md: { height: '18px', width: '18px' },\n lg: { height: '22px', width: '22px' },\n xl: { height: '26px', width: '26px' },\n};\n\n/**\n * Slider (track) sizes for the Switch component\n * Following the 4px grid system - dimensions réduites\n */\nexport const SliderSizes: Record<Size, ViewProps> = {\n xs: {\n height: '20px',\n width: '40px',\n },\n sm: {\n height: '24px',\n width: '48px',\n },\n md: {\n height: '28px',\n width: '56px',\n },\n lg: {\n height: '32px',\n width: '64px',\n },\n xl: {\n height: '36px',\n width: '72px',\n },\n};\n\n/**\n * Slider (track) sizes when the Switch has activeChild/inActiveChild content.\n * Wider tracks ensure the text rendered alongside the knob is readable.\n */\nexport const ContentSliderSizes: Record<Size, ViewProps> = {\n xs: {\n height: '22px',\n width: '52px',\n },\n sm: {\n height: '26px',\n width: '62px',\n },\n md: {\n height: '30px',\n width: '72px',\n },\n lg: {\n height: '34px',\n width: '84px',\n },\n xl: {\n height: '38px',\n width: '96px',\n },\n};\n\n/**\n * Default font sizes for activeChild/inActiveChild text — matched to the\n * Switch size so the embedded label remains legible.\n */\nexport const ContentFontSizes: Record<Size, string> = {\n xs: '9px',\n sm: '10px',\n md: '11px',\n lg: '12px',\n xl: '13px',\n};\n\n/**\n * Padding for the Switch slider - ajusté pour les nouvelles dimensions\n * Following the 4px grid system\n */\nexport const SliderPadding: Record<Size, Record<string, number>> = {\n xs: { paddingVertical: 5, paddingHorizontal: 3 },\n sm: { paddingVertical: 5, paddingHorizontal: 3 },\n md: { paddingVertical: 5, paddingHorizontal: 5 },\n lg: { paddingVertical: 5, paddingHorizontal: 5 },\n xl: { paddingVertical: 5, paddingHorizontal: 5 },\n};\n\n/**\n * Color schemes for the Switch component\n */\nexport const ColorSchemes = {\n // Default colors\n default: {\n active: 'theme-primary',\n inactive: 'color-gray-300',\n knob: 'color-white',\n disabled: 'color-gray-200',\n },\n // State-specific colors\n states: {\n hover: {\n active: 'theme-primary',\n inactive: 'color-gray-400',\n activeOpacity: 0.9,\n },\n focus: {\n active: {\n outline: 'none',\n boxShadow: '0 0 0 2px white, 0 0 0 4px theme-primary',\n },\n inactive: {\n outline: 'none',\n boxShadow: '0 0 0 2px white, 0 0 0 4px color-gray-200',\n },\n },\n },\n};\n\n/**\n * Transition styles for the Switch component\n */\nexport const TransitionStyles = {\n slider: {\n transition: 'all 0.2s ease-in-out',\n },\n knob: {\n transition: 'all 0.2s ease-in-out',\n },\n};\n","/**\n * Switch View Component\n *\n * Renders a switch toggle with various styles and states\n * according to the design guidelines.\n */\n\nimport React from 'react';\nimport { Input } from 'app-studio';\nimport { Label } from '../../../Form/Label/Label';\nimport { View } from 'app-studio';\nimport { Text } from 'app-studio';\nimport { Vertical } from 'app-studio';\nimport { SwitchViewProps } from './Switch.props';\nimport {\n KnobSizes,\n SliderPadding,\n SliderSizes,\n ContentSliderSizes,\n ContentFontSizes,\n ColorSchemes,\n TransitionStyles,\n} from './Switch.style';\nconst SwitchContent = (props: any) => <Input type=\"checkbox\" {...props} />;\nconst SwitchView: React.FC<SwitchViewProps> = ({\n id,\n name,\n label,\n inActiveChild,\n isChecked,\n activeChild,\n labelPosition = 'right',\n shadow = {},\n size = 'sm',\n value = false,\n isHovered = false,\n isDisabled = false,\n isReadOnly = false,\n on,\n setOn = () => {},\n onChange,\n setValue = () => {},\n setIsHovered = () => {},\n helperText,\n description,\n views = { slider: {}, circle: {}, label: {} },\n ...props\n}) => {\n const generatedId = React.useId();\n const switchId = id ?? generatedId;\n const [isFocused, setIsFocused] = React.useState(false);\n const checked = typeof isChecked === 'boolean' ? isChecked : value;\n const hasContent = Boolean(activeChild || inActiveChild);\n const sliderDimensions = hasContent\n ? ContentSliderSizes[size]\n : SliderSizes[size];\n const knobOffset = `${SliderPadding[size].paddingHorizontal}px`;\n const contentSpace = `${SliderPadding[size].paddingHorizontal + 2}px`;\n const contentInset = `calc(${KnobSizes[size].width} + ${SliderPadding[size].paddingHorizontal}px + 4px)`;\n const contentFontSize = ContentFontSizes[size];\n\n const handleToggle = (event: React.ChangeEvent<HTMLInputElement>) => {\n if (!isReadOnly && !isDisabled) {\n const newValue = event.target.checked;\n setValue(newValue);\n setOn(newValue);\n if (onChange) onChange(newValue);\n }\n };\n const handleMouseEnter = () => setIsHovered(true);\n const handleMouseLeave = () => setIsHovered(false);\n const handleFocus = (event: React.FocusEvent<HTMLInputElement>) => {\n let visible = true;\n try {\n visible = event.target.matches(':focus-visible');\n } catch {\n // engines without :focus-visible support: always show the ring\n }\n setIsFocused(visible);\n };\n const handleBlur = () => setIsFocused(false);\n const descriptionId = `${switchId}-description`;\n /**\n * Styles for the switch component\n */\n const switchStyle = {\n container: {\n // Layout properties\n gap: 12, // 3 × 4px grid\n display: 'flex',\n height: 'fit-content',\n width: 'fit-content',\n alignItems: 'center',\n\n // Typography properties\n\n // State properties\n cursor: isDisabled ? 'not-allowed' : isReadOnly ? 'default' : 'pointer',\n opacity: isDisabled ? 0.6 : 1,\n\n // Animation\n transition: 'all 0.2s ease-in-out',\n\n // Apply custom styles\n ...views.label,\n },\n };\n // Rest props are routed to the input only: spreading them here as well\n // landed consumer `aria-*`/`id` attributes on two elements at once.\n const control = (\n <Label\n htmlFor={switchId}\n onMouseEnter={handleMouseEnter}\n onMouseLeave={handleMouseLeave}\n {...switchStyle.container}\n >\n {/* Label on the left side */}\n {labelPosition === 'left' && label && (\n <Text\n fontWeight=\"500\" // Medium weight for better readability\n color={isDisabled ? 'color-gray-400' : 'inherit'}\n transition=\"color 0.2s ease, opacity 0.2s ease\"\n >\n {label}\n </Text>\n )}\n\n {/* Switch slider */}\n <View\n // Layout properties\n display=\"flex\"\n alignItems=\"center\"\n justifyContent=\"center\"\n position=\"relative\"\n marginBottom={4} // 1 × 4px grid\n // Visual properties\n borderRadius=\"9999px\" // Full rounded for pill shape\n backgroundColor={\n isDisabled\n ? ColorSchemes.default.disabled\n : checked\n ? isHovered\n ? ColorSchemes.states.hover.active\n : ColorSchemes.default.active\n : isHovered\n ? ColorSchemes.states.hover.inactive\n : ColorSchemes.default.inactive\n }\n opacity={\n !isDisabled && checked && isHovered\n ? ColorSchemes.states.hover.activeOpacity\n : 1\n }\n // State properties\n cursor=\"pointer\"\n // Animation\n {...TransitionStyles.slider}\n // Apply styles\n {...shadow}\n {...SliderPadding[size]}\n {...sliderDimensions}\n {...views['slider']}\n {...(isFocused\n ? checked\n ? ColorSchemes.states.focus.active\n : ColorSchemes.states.focus.inactive\n : {})}\n >\n {/* Real control: a transparent input covering the whole track, so the\n element found by role/name is the one that receives clicks */}\n <SwitchContent\n id={switchId}\n name={name}\n role=\"switch\"\n aria-checked={checked}\n position=\"absolute\"\n top={0}\n left={0}\n width=\"100%\"\n height=\"100%\"\n margin={0}\n opacity={0}\n zIndex={2}\n cursor={\n isDisabled ? 'not-allowed' : isReadOnly ? 'default' : 'pointer'\n }\n checked={checked}\n onChange={handleToggle}\n onFocus={handleFocus}\n onBlur={handleBlur}\n disabled={isDisabled}\n readOnly={isReadOnly}\n aria-describedby={description ? descriptionId : undefined}\n {...props}\n />\n {/* Active content */}\n {activeChild && checked && (\n <View\n marginLeft={contentSpace}\n marginRight={contentInset}\n transition=\"all 0.2s ease-in-out\"\n display=\"flex\"\n alignItems=\"center\"\n justifyContent=\"center\"\n height=\"100%\"\n width=\"100%\"\n overflow=\"hidden\"\n fontSize={contentFontSize}\n color=\"color-white\"\n fontWeight={600}\n >\n {activeChild}\n </View>\n )}\n\n {/* Knob */}\n <View\n position=\"absolute\"\n top=\"50%\"\n left={checked ? undefined : knobOffset}\n right={checked ? knobOffset : undefined}\n borderRadius=\"50%\"\n backgroundColor={ColorSchemes.default.knob}\n boxShadow={\n isHovered\n ? '0 4px 10px rgba(15, 23, 42, 0.18)'\n : '0 1px 3px rgba(15, 23, 42, 0.18)'\n }\n transform={`translateY(-50%) ${\n isHovered ? 'scale(1.05)' : 'scale(1)'\n }`}\n {...TransitionStyles.knob}\n zIndex={1} // Ensure knob is above content\n {...KnobSizes[size]}\n {...views['circle']}\n />\n\n {/* Inactive content */}\n {inActiveChild && !checked && (\n <View\n marginLeft={contentInset}\n marginRight={contentSpace}\n transition=\"all 0.2s ease-in-out\"\n display=\"flex\"\n alignItems=\"center\"\n justifyContent=\"center\"\n height=\"100%\"\n width=\"100%\"\n overflow=\"hidden\"\n fontSize={contentFontSize}\n color=\"color-white\"\n fontWeight={600}\n >\n {inActiveChild}\n </View>\n )}\n </View>\n\n {/* Label on the right side */}\n {labelPosition === 'right' && label && (\n <Text\n fontWeight=\"500\" // Medium weight for better readability\n color={isDisabled ? 'color-gray-400' : 'inherit'}\n transition=\"all 0.2s ease-in-out\"\n >\n {label}\n </Text>\n )}\n </Label>\n );\n\n if (!description) return control;\n\n // The description sits outside the <label> so it describes the input via\n // `aria-describedby` instead of polluting its accessible name.\n return (\n <Vertical gap={4} width=\"fit-content\">\n {control}\n <Text\n id={descriptionId}\n color=\"color-gray-500\"\n fontSize=\"14px\"\n lineHeight=\"20px\"\n >\n {description}\n </Text>\n </Vertical>\n );\n};\nexport default SwitchView;\n"],"names":["useSwitchState","isDisabled","isChecked","isHovered","setIsHovered","React","on","setOn","value","setValue","useEffect","KnobSizes","SliderSizes","ContentSliderSizes","ContentFontSizes","SliderPadding","ColorSchemes","TransitionStyles","SwitchContent","props","jsx","Input","SwitchView","id","name","label","inActiveChild","activeChild","labelPosition","shadow","size","isReadOnly","onChange","helperText","description","views","generatedId","switchId","isFocused","setIsFocused","checked","sliderDimensions","knobOffset","contentSpace","contentInset","contentFontSize","handleToggle","event","newValue","handleMouseEnter","handleMouseLeave","handleFocus","visible","handleBlur","descriptionId","switchStyle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