@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
|
@@ -7,12 +7,18 @@
|
|
|
7
7
|
"categories": [
|
|
8
8
|
"Forms"
|
|
9
9
|
],
|
|
10
|
-
"registryDependencies": [
|
|
10
|
+
"registryDependencies": [
|
|
11
|
+
"theme"
|
|
12
|
+
],
|
|
11
13
|
"meta": {
|
|
12
14
|
"appStudio": {
|
|
13
15
|
"entry": "src/components/pilot/checkbox.ts",
|
|
14
16
|
"engine": ">=0.9.5",
|
|
15
|
-
"
|
|
17
|
+
"engineByPlatform": {
|
|
18
|
+
"ios": ">=0.10.0",
|
|
19
|
+
"android": ">=0.10.0"
|
|
20
|
+
},
|
|
21
|
+
"version": "0.12.1",
|
|
16
22
|
"license": "MIT",
|
|
17
23
|
"platforms": [
|
|
18
24
|
"web",
|
|
@@ -21,15 +27,12 @@
|
|
|
21
27
|
],
|
|
22
28
|
"dependencies": {
|
|
23
29
|
"web": [
|
|
24
|
-
"@app-studio/components@0.11.13",
|
|
25
30
|
"lucide-react@^0.562.0"
|
|
26
31
|
],
|
|
27
32
|
"ios": [
|
|
28
|
-
"@app-studio/components@0.11.13",
|
|
29
33
|
"react-native-svg@>= 13"
|
|
30
34
|
],
|
|
31
35
|
"android": [
|
|
32
|
-
"@app-studio/components@0.11.13",
|
|
33
36
|
"react-native-svg@>= 13"
|
|
34
37
|
]
|
|
35
38
|
},
|
|
@@ -44,22 +47,22 @@
|
|
|
44
47
|
},
|
|
45
48
|
{
|
|
46
49
|
"path": "src/components/Form/Checkbox/Checkbox.tsx",
|
|
47
|
-
"content": "import React from 'react';\n\nimport { CheckboxProps } from './Checkbox/Checkbox.props';\nimport { useCheckboxState } from './Checkbox/Checkbox.state';\nimport CheckboxView from './Checkbox/Checkbox.view';\nimport {
|
|
50
|
+
"content": "import React from 'react';\n\nimport { CheckboxProps } from './Checkbox/Checkbox.props';\nimport { useCheckboxState } from './Checkbox/Checkbox.state';\nimport CheckboxView from './Checkbox/Checkbox.view';\nimport { useDesignSystemComponentLayers } from '../../../design-system/theme';\n\nconst CheckboxComponent: React.FC<CheckboxProps> = (props) => {\n const { props: mergedProps, themeViews } = useDesignSystemComponentLayers(\n 'checkbox',\n props\n );\n const checkboxStates = useCheckboxState(mergedProps);\n\n return (\n <CheckboxView\n {...checkboxStates}\n {...mergedProps}\n themeViews={themeViews}\n />\n );\n};\n\n/**\n * Checkbox allows users to select one or more options from a list of choices.\n */\nexport const Checkbox = CheckboxComponent;\n",
|
|
48
51
|
"type": "registry:ui"
|
|
49
52
|
},
|
|
50
53
|
{
|
|
51
54
|
"path": "src/components/Form/Checkbox/Checkbox/Checkbox.props.ts",
|
|
52
|
-
"content": "import React from 'react';\nimport { Elevation } from '../../../../utils/elevation';\nimport { InputProps, Shadow } from 'app-studio';\nimport { CheckboxStyles, Size } from './Checkbox.type';\nimport { ViewProps } from 'app-studio';\n\nexport interface CheckboxProps\n extends Omit<InputProps, 'size' | 'onChange' | 'shadow'> {\n id?: string;\n icon?: React.ReactNode;\n error?: any;\n name?: string;\n label?: string;\n isChecked?: boolean;\n defaultIsSelected?: boolean;\n isReadOnly?: boolean;\n isDisabled?: boolean;\n isIndeterminate?: boolean;\n labelPosition?: 'left' | 'right';\n // Called with the checkbox's next checked state — not a DOM event. Typed\n // rather than `Function` so a DOM-shaped handler is a compile error and the\n // argument is actually visible to callers.\n onChange?: (checked: boolean) => void;\n // Same argument as `onChange`; both fire on toggle.\n onValueChange?: (checked: boolean) => void;\n views?: CheckboxStyles;\n size?: Size;\n shadow?: Shadow | Elevation | ViewProps;\n infoText?: string;\n}\nexport interface CheckboxViewProps extends CheckboxProps {\n isHovered?: boolean;\n setIsHovered?: (hovered: boolean) => void;\n isChecked?: boolean;\n isSelected?: boolean;\n setIsSelected?: (selected: boolean) => void;\n}\n",
|
|
55
|
+
"content": "import React from 'react';\nimport { Elevation } from '../../../../utils/elevation';\nimport { InputProps, Shadow } from 'app-studio';\nimport { CheckboxStyles, Size } from './Checkbox.type';\nimport { ViewProps } from 'app-studio';\n\nexport interface CheckboxProps\n extends Omit<InputProps, 'size' | 'onChange' | 'shadow'> {\n id?: string;\n icon?: React.ReactNode;\n error?: any;\n name?: string;\n label?: string;\n isChecked?: boolean;\n defaultIsSelected?: boolean;\n isReadOnly?: boolean;\n isDisabled?: boolean;\n isIndeterminate?: boolean;\n labelPosition?: 'left' | 'right';\n // Called with the checkbox's next checked state — not a DOM event. Typed\n // rather than `Function` so a DOM-shaped handler is a compile error and the\n // argument is actually visible to callers.\n onChange?: (checked: boolean) => void;\n // Same argument as `onChange`; both fire on toggle.\n onValueChange?: (checked: boolean) => void;\n views?: CheckboxStyles;\n size?: Size;\n shadow?: Shadow | Elevation | ViewProps;\n infoText?: string;\n}\nexport interface CheckboxViewProps extends CheckboxProps {\n themeViews?: CheckboxStyles;\n isHovered?: boolean;\n setIsHovered?: (hovered: boolean) => void;\n isChecked?: boolean;\n isSelected?: boolean;\n setIsSelected?: (selected: boolean) => void;\n}\n",
|
|
53
56
|
"type": "registry:ui"
|
|
54
57
|
},
|
|
55
58
|
{
|
|
56
59
|
"path": "src/components/Form/Checkbox/Checkbox/Checkbox.state.ts",
|
|
57
|
-
"content": "import React from 'react';\n\nimport { CheckboxProps } from './Checkbox.props';\n\nexport const useCheckboxState = ({\n defaultIsSelected = false,\n}: CheckboxProps) => {\n const [isHovered, setIsHovered] = React.useState(false);\n const [isSelected, setIsSelected] =\n React.useState<boolean>(defaultIsSelected);\n\n return {\n isHovered,\n setIsHovered,\n isSelected,\n setIsSelected,\n };\n};\n",
|
|
60
|
+
"content": "import React from 'react';\n\nimport { CheckboxProps, CheckboxViewProps } from './Checkbox.props';\n\nexport const useCheckboxState = ({\n defaultIsSelected = false,\n}: CheckboxProps) => {\n const [isHovered, setIsHovered] = React.useState(false);\n const [isSelected, setIsSelected] =\n React.useState<boolean>(defaultIsSelected);\n\n return {\n isHovered,\n setIsHovered,\n isSelected,\n setIsSelected,\n };\n};\n\nexport function getCheckboxSelection({\n isChecked,\n isSelected,\n isReadOnly,\n isDisabled,\n onChange,\n onValueChange,\n setIsSelected,\n}: Pick<\n CheckboxViewProps,\n | 'isChecked'\n | 'isSelected'\n | 'isReadOnly'\n | 'isDisabled'\n | 'onChange'\n | 'onValueChange'\n | 'setIsSelected'\n>) {\n const checked = Boolean(isChecked ?? isSelected);\n\n function toggle() {\n if (isReadOnly || isDisabled) return;\n const next = !checked;\n if (isChecked == null) setIsSelected?.(next);\n onChange?.(next);\n onValueChange?.(next);\n }\n\n return { checked, toggle };\n}\n",
|
|
58
61
|
"type": "registry:ui"
|
|
59
62
|
},
|
|
60
63
|
{
|
|
61
64
|
"path": "src/components/Form/Checkbox/Checkbox/Checkbox.style.ts",
|
|
62
|
-
"content": "/**\n * Checkbox Styles\n *\n * Defines the styles for the Checkbox 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, Variant } from './Checkbox.type';\n\n/**\n * Size configurations for the Checkbox component\n * Following the 4px grid system\n */\nexport const Sizes: Record<Size, ViewProps> = {\n xs: { height: '12px', width: '12px' }, // 3 × 4px grid\n sm: { height: '16px', width: '16px' }, // 4 × 4px grid\n md: { height: '20px', width: '20px' }, // 5 × 4px grid\n lg: { height: '24px', width: '24px' }, // 6 × 4px grid\n xl: { height: '28px', width: '28px' }, // 7 × 4px grid\n};\n\n/**\n * Icon sizes for the Checkbox component\n * Proportional to the component size\n */\nexport const IconSizes: Record<Size, number> = {\n xs: 10, // 2.5 × 4px grid\n sm: 14, // 3.5 × 4px grid\n md: 16, // 4 × 4px grid\n lg: 20, // 5 × 4px grid\n xl: 24, // 6 × 4px grid\n};\n\n/**\n * Variant styles for the Checkbox component\n */\nexport const VariantStyles: Record<Variant, ViewProps> = {\n selected: {\n backgroundColor: 'theme-primary',\n borderColor: 'theme-primary',\n borderWidth: '2px',\n borderStyle: 'solid',\n color: 'color-white',\n transition:\n 'background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease',\n },\n unselected: {\n backgroundColor: 'transparent',\n borderWidth: '2px',\n borderStyle: 'solid',\n borderColor: 'color-gray-300',\n color: 'inherit',\n transition: 'all 0.2s ease-in-out',\n },\n indeterminate: {\n backgroundColor: 'theme-primary',\n borderColor: 'theme-primary',\n borderWidth: '2px',\n borderStyle: 'solid',\n color: 'color-white',\n transition:\n 'background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease',\n },\n};\n\n/**\n * State styles for the Checkbox component\n */\nexport const StateStyles = {\n hover: {\n selected: {\n opacity: 0.9,\n },\n unselected: {\n borderColor: 'color-gray-400',\n backgroundColor: 'color-gray-50',\n },\n indeterminate: {\n opacity: 0.9,\n },\n },\n focus: {\n
|
|
65
|
+
"content": "/**\n * Checkbox Styles\n *\n * Defines the styles for the Checkbox 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, Variant } from './Checkbox.type';\n\n/**\n * Size configurations for the Checkbox component\n * Following the 4px grid system\n */\nexport const Sizes: Record<Size, ViewProps> = {\n xs: { height: '12px', width: '12px' }, // 3 × 4px grid\n sm: { height: '16px', width: '16px' }, // 4 × 4px grid\n md: { height: '20px', width: '20px' }, // 5 × 4px grid\n lg: { height: '24px', width: '24px' }, // 6 × 4px grid\n xl: { height: '28px', width: '28px' }, // 7 × 4px grid\n};\n\n/**\n * Icon sizes for the Checkbox component\n * Proportional to the component size\n */\nexport const IconSizes: Record<Size, number> = {\n xs: 10, // 2.5 × 4px grid\n sm: 14, // 3.5 × 4px grid\n md: 16, // 4 × 4px grid\n lg: 20, // 5 × 4px grid\n xl: 24, // 6 × 4px grid\n};\n\n/**\n * Variant styles for the Checkbox component\n */\nexport const VariantStyles: Record<Variant, ViewProps> = {\n selected: {\n backgroundColor: 'theme-primary',\n borderColor: 'theme-primary',\n borderWidth: '2px',\n borderStyle: 'solid',\n color: 'color-white',\n transition:\n 'background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease',\n },\n unselected: {\n backgroundColor: 'transparent',\n borderWidth: '2px',\n borderStyle: 'solid',\n borderColor: 'color-gray-300',\n color: 'inherit',\n transition: 'all 0.2s ease-in-out',\n },\n indeterminate: {\n backgroundColor: 'theme-primary',\n borderColor: 'theme-primary',\n borderWidth: '2px',\n borderStyle: 'solid',\n color: 'color-white',\n transition:\n 'background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease',\n },\n};\n\n/**\n * State styles for the Checkbox component\n */\nexport const StateStyles = {\n hover: {\n selected: {\n opacity: 0.9,\n },\n unselected: {\n borderColor: 'color-gray-400',\n backgroundColor: 'color-gray-50',\n },\n indeterminate: {\n opacity: 0.9,\n },\n },\n focus: {\n outline: '2px solid theme-primary',\n outlineOffset: 2,\n boxShadow: '0 0 0 2px color-white',\n },\n disabled: {\n selected: {\n backgroundColor: 'color-gray-300',\n borderColor: 'color-gray-300',\n opacity: 0.5,\n cursor: 'not-allowed',\n },\n unselected: {\n borderColor: 'color-gray-300',\n opacity: 0.5,\n cursor: 'not-allowed',\n },\n indeterminate: {\n backgroundColor: 'color-gray-300',\n borderColor: 'color-gray-300',\n opacity: 0.5,\n cursor: 'not-allowed',\n },\n },\n error: {\n selected: {\n backgroundColor: 'color-red-500',\n borderColor: 'color-red-500',\n },\n unselected: {\n borderColor: 'color-red-500',\n },\n indeterminate: {\n backgroundColor: 'color-red-500',\n borderColor: 'color-red-500',\n },\n },\n};\n",
|
|
63
66
|
"type": "registry:ui"
|
|
64
67
|
},
|
|
65
68
|
{
|
|
@@ -69,12 +72,12 @@
|
|
|
69
72
|
},
|
|
70
73
|
{
|
|
71
74
|
"path": "src/components/Form/Checkbox/Checkbox/Checkbox.view.native.tsx",
|
|
72
|
-
"content": "/**\n * Checkbox View Component (React Native)\n *\n * RN counterpart of Checkbox.view.tsx. React Native has no native checkbox,\n * so we simulate one with a pressable <View/> that displays a TickIcon when\n * checked (or MinusIcon when indeterminate). Drops web-only concepts: cursor,\n * transitions, _hover (we use isHovered state only via onPress feedback).\n */\n\nimport React from 'react';\nimport { Typography } from 'app-studio';\nimport { Center
|
|
75
|
+
"content": "/**\n * Checkbox View Component (React Native)\n *\n * RN counterpart of Checkbox.view.tsx. React Native has no native checkbox,\n * so we simulate one with a pressable <View/> that displays a TickIcon when\n * checked (or MinusIcon when indeterminate). Drops web-only concepts: cursor,\n * transitions, _hover (we use isHovered state only via onPress feedback).\n */\n\nimport React from 'react';\nimport { Typography } from 'app-studio';\nimport { Center } from 'app-studio';\nimport { TickIcon, MinusIcon } from '../../../Icon/FixedIcons';\n\nimport { CheckboxViewProps } from './Checkbox.props';\nimport { IconSizes, Sizes, VariantStyles, StateStyles } from './Checkbox.style';\nimport { Text } from 'app-studio';\nimport { Horizontal } from 'app-studio';\nimport { Vertical } from 'app-studio';\nimport { getCheckboxSelection } from './Checkbox.state';\nimport { mergeDesignSystemViews } from '../../../../design-system/theme';\n\nconst CheckboxView: React.FC<CheckboxViewProps> = ({\n id,\n icon,\n name,\n label,\n isChecked,\n onChange,\n onValueChange,\n shadow = {},\n labelPosition = 'right',\n size = 'md',\n error = false,\n isSelected = false,\n isHovered = false,\n isDisabled = false,\n isReadOnly = false,\n isIndeterminate = false,\n defaultIsSelected = false,\n setIsSelected = () => {},\n setIsHovered = () => {},\n views: instanceViews = {},\n themeViews,\n infoText,\n helperText,\n ...props\n}) => {\n const { checked, toggle } = getCheckboxSelection({\n isChecked,\n isSelected,\n isReadOnly,\n isDisabled,\n onChange,\n onValueChange,\n setIsSelected,\n });\n\n const variant = isIndeterminate\n ? 'indeterminate'\n : checked\n ? 'selected'\n : 'unselected';\n\n const stateStyle = error\n ? StateStyles.error[variant]\n : isDisabled\n ? StateStyles.disabled[variant]\n : {};\n const views = themeViews\n ? mergeDesignSystemViews<NonNullable<CheckboxViewProps['views']>>(\n themeViews,\n { checkbox: { ...VariantStyles[variant], ...stateStyle } },\n instanceViews\n )\n : instanceViews;\n\n const containerStyle = {\n gap: 8,\n color: error ? 'theme-error' : isDisabled ? 'color-gray-400' : 'inherit',\n opacity: isDisabled ? 0.6 : 1,\n ...views['label'],\n };\n\n const checkboxStyle = {\n ...VariantStyles[variant],\n ...stateStyle,\n borderRadius: 6,\n ...Sizes[size],\n ...shadow,\n ...views['checkbox'],\n };\n\n return (\n <Vertical {...containerStyle}>\n <Horizontal\n gap={12}\n fontSize={Typography.fontSizes[size]}\n alignItems=\"center\"\n {...props}\n nativeID={id ?? props.nativeID}\n onPress={isDisabled || isReadOnly ? undefined : toggle}\n accessible\n accessibilityRole=\"checkbox\"\n accessibilityLabel={\n props.accessibilityLabel ?? props['aria-label'] ?? label\n }\n accessibilityState={{\n ...props.accessibilityState,\n checked: isIndeterminate ? 'mixed' : checked,\n disabled: isDisabled || isReadOnly,\n }}\n >\n {labelPosition === 'left' && label && (\n <Text size={size} fontWeight=\"500\" {...views?.label}>\n {label}\n </Text>\n )}\n <Center {...checkboxStyle}>\n {isIndeterminate ? (\n <MinusIcon widthHeight={IconSizes[size]} color=\"color-white\" />\n ) : (\n checked &&\n (icon ?? (\n <TickIcon widthHeight={IconSizes[size]} color=\"color-white\" />\n ))\n )}\n </Center>\n {labelPosition === 'right' && label && (\n <Text size={size} fontWeight=\"500\" {...views?.label}>\n {label}\n </Text>\n )}\n </Horizontal>\n {infoText && (\n <Text\n marginLeft={labelPosition === 'left' ? 0 : 36}\n color=\"color-gray-500\"\n size=\"sm\"\n fontWeight=\"400\"\n lineHeight={20}\n {...views?.infoText}\n >\n {infoText}\n </Text>\n )}\n {error && (\n <Text\n size=\"xs\"\n marginTop={4}\n marginHorizontal={0}\n color=\"theme-error\"\n fontWeight=\"500\"\n >\n {error}\n </Text>\n )}\n </Vertical>\n );\n};\n\nexport default CheckboxView;\n",
|
|
73
76
|
"type": "registry:ui"
|
|
74
77
|
},
|
|
75
78
|
{
|
|
76
79
|
"path": "src/components/Form/Checkbox/Checkbox/Checkbox.view.tsx",
|
|
77
|
-
"content": "/**\n * Checkbox View Component\n *\n * Renders a checkbox with various styles and states\n * according to the design guidelines.\n */\n\nimport React from 'react';\nimport { Typography } from 'app-studio';\n\nimport { Center, Input } from 'app-studio';\nimport { Label } from '../../../Form/Label/Label';\nimport { TickIcon, MinusIcon } from '../../../Icon/FixedIcons';\n\nimport { CheckboxViewProps } from './Checkbox.props';\nimport { IconSizes, Sizes, VariantStyles, StateStyles } from './Checkbox.style';\nimport { Text } from 'app-studio';\nimport { Horizontal } from 'app-studio';\nimport { Vertical } from 'app-studio';\n\nconst CheckboxView: React.FC<CheckboxViewProps> = ({\n id,\n icon,\n name,\n label,\n isChecked,\n onChange,\n onValueChange,\n shadow = {},\n labelPosition = 'right',\n size = 'md',\n error = false,\n isSelected = false,\n isHovered = false,\n isDisabled = false,\n isReadOnly = false,\n isIndeterminate = false,\n defaultIsSelected = false,\n setIsSelected = () => {},\n setIsHovered = () => {},\n views
|
|
80
|
+
"content": "/**\n * Checkbox View Component\n *\n * Renders a checkbox with various styles and states\n * according to the design guidelines.\n */\n\nimport React from 'react';\nimport { Typography } from 'app-studio';\n\nimport { Center, Input } from 'app-studio';\nimport { Label } from '../../../Form/Label/Label';\nimport { TickIcon, MinusIcon } from '../../../Icon/FixedIcons';\n\nimport { CheckboxViewProps } from './Checkbox.props';\nimport { IconSizes, Sizes, VariantStyles, StateStyles } from './Checkbox.style';\nimport { Text } from 'app-studio';\nimport { Horizontal } from 'app-studio';\nimport { Vertical } from 'app-studio';\nimport { getCheckboxSelection } from './Checkbox.state';\nimport { mergeDesignSystemViews } from '../../../../design-system/theme';\n\nconst CheckboxView: React.FC<CheckboxViewProps> = ({\n id,\n icon,\n name,\n label,\n isChecked,\n onChange,\n onValueChange,\n shadow = {},\n labelPosition = 'right',\n size = 'md',\n error = false,\n isSelected = false,\n isHovered = false,\n isDisabled = false,\n isReadOnly = false,\n isIndeterminate = false,\n defaultIsSelected = false,\n setIsSelected = () => {},\n setIsHovered = () => {},\n views: instanceViews = {},\n themeViews,\n infoText,\n helperText,\n ...props\n}) => {\n const generatedId = React.useId();\n const checkboxId = id ?? generatedId;\n const inputRef = React.useRef<HTMLInputElement>(null);\n const [isFocused, setIsFocused] = React.useState(false);\n const { checked, toggle } = getCheckboxSelection({\n isChecked,\n isSelected,\n isReadOnly,\n isDisabled,\n onChange,\n onValueChange,\n setIsSelected,\n });\n\n // `indeterminate` only exists as a DOM property, never as an attribute.\n React.useEffect(() => {\n if (inputRef.current) inputRef.current.indeterminate = isIndeterminate;\n }, [isIndeterminate]);\n\n const handleHover = () => setIsHovered(!isHovered);\n\n /**\n * Determine the variant based on component state\n */\n const variant = isIndeterminate\n ? 'indeterminate'\n : checked\n ? 'selected'\n : 'unselected';\n\n /**\n * Apply state-specific styles\n */\n const stateStyle = error\n ? StateStyles.error[variant]\n : isDisabled\n ? StateStyles.disabled[variant]\n : isHovered\n ? StateStyles.hover[variant]\n : {};\n const views = themeViews\n ? mergeDesignSystemViews<NonNullable<CheckboxViewProps['views']>>(\n themeViews,\n { checkbox: { ...VariantStyles[variant], ...stateStyle } },\n instanceViews\n )\n : instanceViews;\n\n /**\n * Styles for the checkbox component\n */\n const checkboxStyle = {\n container: {\n // Layout properties\n gap: 8, // 2 × 4px grid\n display: 'flex' as const,\n height: 'fit-content',\n flexDirection: 'column' as const,\n width: 'fit-content',\n\n // Typography properties\n\n // Visual properties — inherit so the brand/page ink shows on every surface\n color: error ? 'theme-error' : isDisabled ? 'color-gray-400' : 'inherit',\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 checkbox: {\n // Base variant styles\n ...VariantStyles[variant],\n\n // State-specific styles\n ...stateStyle,\n\n // Visual properties\n borderRadius: 6, // radius-sm\n\n // Size properties\n ...Sizes[size],\n\n // Animation\n transition: 'all 0.2s ease-in-out',\n\n // Apply shadow and custom styles\n ...shadow,\n ...views['checkbox'],\n },\n };\n\n const infoTextId = `${checkboxId}-info`;\n const errorId = `${checkboxId}-error`;\n const describedBy =\n [infoText ? infoTextId : '', error ? errorId : '']\n .filter(Boolean)\n .join(' ') || undefined;\n\n return (\n <Vertical {...checkboxStyle.container}>\n <Label\n htmlFor={checkboxId}\n onMouseEnter={handleHover}\n onMouseLeave={handleHover}\n size={Typography.fontSizes[size]}\n cursor=\"inherit\"\n >\n <Horizontal gap={12} alignItems=\"center\">\n {' '}\n {/* 3 × 4px grid */}\n {/* Label on the left side */}\n {labelPosition === 'left' && label && (\n <Text\n size={size}\n fontWeight=\"500\" // Medium weight for better readability\n {...views?.label}\n >\n {label}\n </Text>\n )}\n {/* Checkbox */}\n <Center\n position=\"relative\"\n {...checkboxStyle.checkbox}\n {...(isFocused ? StateStyles.focus : {})}\n >\n {/* Real control: a transparent input covering the visible box, so\n the element found by role/name is the one that receives clicks */}\n <Input\n ref={inputRef}\n type=\"checkbox\"\n id={checkboxId}\n name={name}\n checked={checked}\n aria-checked={isIndeterminate ? 'mixed' : undefined}\n onChange={toggle}\n onFocus={() => setIsFocused(true)}\n onBlur={() => setIsFocused(false)}\n disabled={isDisabled}\n readOnly={isReadOnly}\n position=\"absolute\"\n top={0}\n left={0}\n width=\"100%\"\n height=\"100%\"\n margin={0}\n opacity={0}\n zIndex={1}\n cursor={\n isDisabled ? 'not-allowed' : isReadOnly ? 'default' : 'pointer'\n }\n aria-describedby={describedBy}\n // Consumer rest props (aria-*, role, data-*) belong on the real\n // control, not the wrapping label.\n {...props}\n />\n {isIndeterminate ? (\n <MinusIcon\n widthHeight={IconSizes[size]}\n color=\"color-white\"\n transition=\"opacity 0.2s ease\"\n />\n ) : (\n checked &&\n (icon ?? (\n <TickIcon\n widthHeight={IconSizes[size]}\n color=\"color-white\"\n transition=\"opacity 0.2s ease\"\n />\n ))\n )}\n </Center>\n {/* Label on the right side */}\n {labelPosition === 'right' && label && (\n <Text\n size={size}\n fontWeight=\"500\" // Medium weight for better readability\n {...views?.label}\n >\n {label}\n </Text>\n )}\n </Horizontal>\n </Label>\n {/* Info text — outside the <label> so it describes the input through\n `aria-describedby` instead of polluting its accessible name */}\n {infoText && (\n <Text\n id={infoTextId}\n marginLeft={labelPosition === 'left' ? 0 : 36} // 9 × 4px grid\n color=\"color-gray-500\"\n size=\"sm\"\n fontWeight=\"400\" // Regular weight\n lineHeight=\"20px\"\n {...views?.infoText}\n >\n {infoText}\n </Text>\n )}\n\n {/* Error message — outside the <label> for the same reason */}\n {error && (\n <Text\n id={errorId}\n size=\"xs\"\n marginTop={4} // 1 × 4px grid\n marginHorizontal={0}\n color=\"theme-error\"\n fontWeight=\"500\" // Medium weight for better readability\n transition=\"all 0.2s ease-in-out\"\n >\n {error}\n </Text>\n )}\n </Vertical>\n );\n};\n\nexport default CheckboxView;\n",
|
|
78
81
|
"type": "registry:ui"
|
|
79
82
|
},
|
|
80
83
|
{
|
package/dist/registry/modal.json
CHANGED
|
@@ -12,7 +12,11 @@
|
|
|
12
12
|
"appStudio": {
|
|
13
13
|
"entry": "src/components/pilot/modal.ts",
|
|
14
14
|
"engine": ">=0.9.5",
|
|
15
|
-
"
|
|
15
|
+
"engineByPlatform": {
|
|
16
|
+
"ios": ">=0.10.0",
|
|
17
|
+
"android": ">=0.10.0"
|
|
18
|
+
},
|
|
19
|
+
"version": "0.12.1",
|
|
16
20
|
"license": "MIT",
|
|
17
21
|
"platforms": [
|
|
18
22
|
"web",
|
|
@@ -69,7 +73,7 @@
|
|
|
69
73
|
},
|
|
70
74
|
{
|
|
71
75
|
"path": "src/components/Modal/Modal/Modal.props.ts",
|
|
72
|
-
"content": "import React from 'react';\nimport { Elevation } from '../../../utils/elevation';\nimport { Shadow, ViewProps } from 'app-studio';\nimport { CloseButtonPosition, Position, Shape, Size } from './Modal.type';\n// Defines the properties available for the Modal component, extending `ViewProps` but omitting its `size` property.\nexport interface ModalProps\n extends Omit<ViewProps, 'size' | 'shadow' | 'position'> {\n // Specifies the color of the close button.\n buttonColor?: string;\n // Determines the size of the close button icon.\n iconSize?: Size;\n // Defines the overall shape style of the modal container.\n shape?: Shape;\n // Indicates whether the modal should occupy the full screen.\n isFullScreen?: boolean;\n // Sets the position of the close button within the modal.\n buttonPosition?: CloseButtonPosition;\n // Callback function triggered when the modal is requested to close.\n onClose?: () => void;\n // Applies a blur effect to the modal's background overlay.\n blur?: number;\n // Controls the visibility state of the modal.\n isOpen?: boolean;\n // If true, prevents the modal from closing when clicking outside or pressing escape.\n isClosePrevented?: boolean;\n // Specifies the position of the modal on the screen.\n position?: Position;\n // Defines the shadow style or elevation applied to the modal container.\n shadow?: Shadow | Elevation | ViewProps;\n // Optional identifier used by modal registries / dynamic-modal renderers.\n id?: string;\n // Optional title rendered by modal registries / dynamic-modal renderers.\n title?: string;\n}\n// Describes the structure of the Modal component, including its sub-components.\nexport interface ModalType extends React.FunctionComponent<ModalProps> {\n // Represents the modal overlay component.\n Overlay: React.FC<OverlayProps>;\n // Represents the modal content container component.\n Container: React.FC<ContainerProps>;\n // Represents the modal header component.\n Header: React.FC<HeaderProps>;\n // Represents the modal body component.\n Body: React.FC<BodyProps>;\n // Represents the modal footer component.\n Footer: React.FC<FooterProps>;\n // Represents the modal layout management component.\n Layout: React.FC<ModalLayoutProps>;\n}\n// Defines the properties for the modal's overlay component.\nexport interface OverlayProps extends Omit<ViewProps, 'position' | 'isOpen'> {\n // Content to be rendered inside the overlay.\n children?: React.ReactNode;\n // Applies a blur effect to the overlay background.\n blur?: number;\n // Determines if the overlay is visible.\n isOpen: boolean;\n /** Accessible name for the dialog on web. */\n 'aria-label'?: string;\n 'aria-labelledby'?: string;\n // If true, prevents the overlay from closing the modal on click.\n isClosePrevented?: boolean;\n // Specifies the positioning strategy for the overlay.\n position?: Position;\n // Indicates whether the overlay should cover the full screen.\n isFullScreen?: boolean;\n // Callback function to be executed when the overlay should trigger a close action.\n onClose: () => void;\n}\n// Defines the properties for the modal's header component.\nexport interface HeaderProps extends Omit<ViewProps, 'size'> {\n // Optional styling properties for nested view components within the header.\n views?: {\n // Styling properties for the header's container view.\n container?: ViewProps;\n // Styling properties for the header's main view.\n header?: ViewProps;\n };\n // Specifies the color of the close button in the header.\n buttonColor?: string;\n // Determines the size of the close button icon in the header.\n iconSize?: Size;\n // Content to be rendered inside the header.\n children?: React.ReactNode;\n // Sets the position of the close button within the header.\n buttonPosition?: CloseButtonPosition;\n // Size of the close button icon; alias of `iconSize` (wins when both are\n // provided).\n buttonSize?: Size;\n // Optional variant override forwarded by callers (tests/examples).\n variant?: string;\n // Callback function triggered when the header's close button is activated.\n onClose?: () => void;\n}\n// Defines properties for managing modal layouts and their visibility.\nexport interface ModalLayoutProps {\n // A map of modal names to their corresponding React functional components.\n modals: { [x: string]: React.FC<any> };\n // Callback function invoked when a modal is requested to be shown.\n onShow?: (name: string, props?: any) => void;\n // Callback function invoked when a modal is requested to be hidden.\n onHide?: (name?: string, props?: any) => void;\n}\n// Defines the properties for the modal's main content container.\nexport interface ContainerProps\n extends Omit<ViewProps, 'size' | 'position' | 'shadow'> {\n // Optional styling properties for nested view components within the container.\n views?: {\n // Styling properties for the container's main view.\n container?: ViewProps;\n };\n // Content to be rendered inside the container.\n children: React.ReactNode;\n // Defines the shape style of the container.\n shape?: Shape;\n // Indicates whether the container should expand to full screen.\n isFullScreen?: boolean;\n // Controls the open/closed state of the modal container.\n isOpen?: boolean;\n // Callback to close the modal container.\n onClose?: () => void;\n // If true, prevents the container from closing the modal on outside click.\n isClosePrevented?: boolean;\n // Blur effect applied to the modal backdrop.\n blur?: number;\n // Optional variant override forwarded by callers (tests/examples).\n variant?: string;\n // Optional close-button color override forwarded by callers.\n buttonColor?: any;\n // Optional close-button position override forwarded by callers.\n buttonPosition?: CloseButtonPosition;\n // Specifies the directional position of the modal on screen.\n position?: Position;\n // Defines the shadow style or elevation applied to the container.\n shadow?: Shadow | Elevation | ViewProps;\n}\n// Defines the properties for the modal's body content area.\nexport interface BodyProps extends ViewProps {\n children?: React.ReactNode;\n // Optional styling properties for nested view components within the body.\n views?: {\n // Styling properties for the body's main view.\n view?: ViewProps;\n };\n // Optional close-button color override forwarded by callers (tests/examples).\n buttonColor?: any;\n // Optional variant override forwarded by callers.\n variant?: string;\n}\n// Defines the properties for the modal's footer component.\nexport interface FooterProps extends ViewProps {\n children?: React.ReactNode;\n // Optional styling properties for nested view components within the footer.\n views?: {\n // Styling properties for the footer's container view.\n container?: ViewProps;\n };\n}\n",
|
|
76
|
+
"content": "import React from 'react';\nimport { Elevation } from '../../../utils/elevation';\nimport { Shadow, ViewProps } from 'app-studio';\nimport { CloseButtonPosition, Position, Shape, Size } from './Modal.type';\n// Defines the properties available for the Modal component, extending `ViewProps` but omitting its `size` property.\nexport interface ModalProps\n extends Omit<ViewProps, 'size' | 'shadow' | 'position'> {\n // Specifies the color of the close button.\n buttonColor?: string;\n // Determines the size of the close button icon.\n iconSize?: Size;\n // Defines the overall shape style of the modal container.\n shape?: Shape;\n // Indicates whether the modal should occupy the full screen.\n isFullScreen?: boolean;\n // Sets the position of the close button within the modal.\n buttonPosition?: CloseButtonPosition;\n // Callback function triggered when the modal is requested to close.\n onClose?: () => void;\n // Applies a blur effect to the modal's background overlay.\n blur?: number;\n // Controls the visibility state of the modal.\n isOpen?: boolean;\n // If true, prevents the modal from closing when clicking outside or pressing escape.\n isClosePrevented?: boolean;\n // Specifies the position of the modal on the screen.\n position?: Position;\n // Defines the shadow style or elevation applied to the modal container.\n shadow?: Shadow | Elevation | ViewProps;\n // Optional identifier used by modal registries / dynamic-modal renderers.\n id?: string;\n // Optional title rendered by modal registries / dynamic-modal renderers.\n title?: string;\n}\n// Describes the structure of the Modal component, including its sub-components.\nexport interface ModalType extends React.FunctionComponent<ModalProps> {\n // Represents the modal overlay component.\n Overlay: React.FC<OverlayProps>;\n // Represents the modal content container component.\n Container: React.FC<ContainerProps>;\n // Represents the modal header component.\n Header: React.FC<HeaderProps>;\n // Represents the modal body component.\n Body: React.FC<BodyProps>;\n // Represents the modal footer component.\n Footer: React.FC<FooterProps>;\n // Represents the modal layout management component.\n Layout: React.FC<ModalLayoutProps>;\n}\n// Defines the properties for the modal's overlay component.\nexport interface OverlayProps extends Omit<ViewProps, 'position' | 'isOpen'> {\n // Content to be rendered inside the overlay.\n children?: React.ReactNode;\n // Applies a blur effect to the overlay background.\n blur?: number;\n // Determines if the overlay is visible.\n isOpen: boolean;\n /** Accessible name for the dialog on web. */\n 'aria-label'?: string;\n 'aria-labelledby'?: string;\n // If true, prevents the overlay from closing the modal on click.\n isClosePrevented?: boolean;\n // Specifies the positioning strategy for the overlay.\n position?: Position;\n // Indicates whether the overlay should cover the full screen.\n isFullScreen?: boolean;\n // Callback function to be executed when the overlay should trigger a close action.\n onClose: () => void;\n}\n// Defines the properties for the modal's header component.\nexport interface HeaderProps extends Omit<ViewProps, 'size'> {\n // Optional styling properties for nested view components within the header.\n views?: {\n // Styling properties for the header's container view.\n container?: ViewProps;\n // Styling properties for the header's main view.\n header?: ViewProps;\n };\n // Specifies the color of the close button in the header.\n buttonColor?: string;\n // Determines the size of the close button icon in the header.\n iconSize?: Size;\n // Content to be rendered inside the header.\n children?: React.ReactNode;\n // Sets the position of the close button within the header.\n buttonPosition?: CloseButtonPosition;\n // Size of the close button icon; alias of `iconSize` (wins when both are\n // provided).\n buttonSize?: Size;\n /** Accessible name for the header close button. */\n closeButtonLabel?: string;\n // Optional variant override forwarded by callers (tests/examples).\n variant?: string;\n // Callback function triggered when the header's close button is activated.\n onClose?: () => void;\n}\n// Defines properties for managing modal layouts and their visibility.\nexport interface ModalLayoutProps {\n // A map of modal names to their corresponding React functional components.\n modals: { [x: string]: React.FC<any> };\n // Callback function invoked when a modal is requested to be shown.\n onShow?: (name: string, props?: any) => void;\n // Callback function invoked when a modal is requested to be hidden.\n onHide?: (name?: string, props?: any) => void;\n}\n// Defines the properties for the modal's main content container.\nexport interface ContainerProps\n extends Omit<ViewProps, 'size' | 'position' | 'shadow'> {\n // Optional styling properties for nested view components within the container.\n views?: {\n // Styling properties for the container's main view.\n container?: ViewProps;\n };\n // Content to be rendered inside the container.\n children: React.ReactNode;\n // Defines the shape style of the container.\n shape?: Shape;\n // Indicates whether the container should expand to full screen.\n isFullScreen?: boolean;\n // Controls the open/closed state of the modal container.\n isOpen?: boolean;\n // Callback to close the modal container.\n onClose?: () => void;\n // If true, prevents the container from closing the modal on outside click.\n isClosePrevented?: boolean;\n // Blur effect applied to the modal backdrop.\n blur?: number;\n // Optional variant override forwarded by callers (tests/examples).\n variant?: string;\n // Optional close-button color override forwarded by callers.\n buttonColor?: any;\n // Optional close-button position override forwarded by callers.\n buttonPosition?: CloseButtonPosition;\n // Specifies the directional position of the modal on screen.\n position?: Position;\n // Defines the shadow style or elevation applied to the container.\n shadow?: Shadow | Elevation | ViewProps;\n}\n// Defines the properties for the modal's body content area.\nexport interface BodyProps extends ViewProps {\n children?: React.ReactNode;\n // Optional styling properties for nested view components within the body.\n views?: {\n // Styling properties for the body's main view.\n view?: ViewProps;\n };\n // Optional close-button color override forwarded by callers (tests/examples).\n buttonColor?: any;\n // Optional variant override forwarded by callers.\n variant?: string;\n}\n// Defines the properties for the modal's footer component.\nexport interface FooterProps extends ViewProps {\n children?: React.ReactNode;\n // Optional styling properties for nested view components within the footer.\n views?: {\n // Styling properties for the footer's container view.\n container?: ViewProps;\n };\n}\n",
|
|
73
77
|
"type": "registry:ui"
|
|
74
78
|
},
|
|
75
79
|
{
|
|
@@ -89,12 +93,12 @@
|
|
|
89
93
|
},
|
|
90
94
|
{
|
|
91
95
|
"path": "src/components/Modal/Modal/Modal.view.native.tsx",
|
|
92
|
-
"content": "/**\n * ModalView (React Native) – uses RN's built-in <Modal/> for proper portal\n * + dismissal behaviour. Drops web-only concepts: position:fixed, viewport\n * units (vw/vh), backdropFilter, cursor.\n *\n * Same public API as the web variant: ModalOverlay / ModalContainer /\n * ModalHeader / ModalBody / ModalFooter.\n */\n\nimport React, { useCallback } from 'react';\nimport { Modal as RNModal } from 'react-native';\nimport { View, Horizontal, ViewProps, Vertical, Center } 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\nexport interface OverlayProps {\n views?: {\n container?: ViewProps;\n view?: ViewProps;\n };\n blur?: number;\n isOpen?: boolean;\n isClosePrevented?: boolean;\n onClose?: () => void;\n position?: Position;\n children?: React.ReactNode;\n}\n\nexport const ModalOverlay: React.FC<OverlayProps & any> = React.memo(\n ({\n children,\n isOpen = false,\n isClosePrevented = false,\n onClose = () => {},\n position = 'center',\n views,\n ...props\n }) => {\n const handlePress = useCallback(() => {\n if (!isClosePrevented) onClose();\n }, [isClosePrevented, onClose]);\n\n return (\n <RNModal\n visible={isOpen}\n transparent\n animationType=\"fade\"\n onRequestClose={handlePress}\n >\n <Center\n flex={1}\n backgroundColor=\"color-dark-50-360\"\n
|
|
96
|
+
"content": "/**\n * ModalView (React Native) – uses RN's built-in <Modal/> for proper portal\n * + dismissal behaviour. Drops web-only concepts: position:fixed, viewport\n * units (vw/vh), backdropFilter, cursor.\n *\n * Same public API as the web variant: ModalOverlay / ModalContainer /\n * ModalHeader / ModalBody / ModalFooter.\n */\n\nimport React, { useCallback } from 'react';\nimport { Modal as RNModal } from 'react-native';\nimport { View, Horizontal, ViewProps, Vertical, Center } 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\nexport interface OverlayProps {\n views?: {\n container?: ViewProps;\n view?: ViewProps;\n };\n blur?: number;\n isOpen?: boolean;\n isClosePrevented?: boolean;\n onClose?: () => void;\n position?: Position;\n children?: React.ReactNode;\n}\n\nexport const ModalOverlay: React.FC<OverlayProps & any> = React.memo(\n ({\n children,\n isOpen = false,\n isClosePrevented = false,\n onClose = () => {},\n position = 'center',\n views,\n ...props\n }) => {\n const handlePress = useCallback(() => {\n if (!isClosePrevented) onClose();\n }, [isClosePrevented, onClose]);\n\n return (\n <RNModal\n visible={isOpen}\n transparent\n animationType=\"fade\"\n onRequestClose={handlePress}\n >\n <Center\n flex={1}\n backgroundColor=\"color-dark-50-360\"\n {...OverlayAlignments[position]}\n {...views?.container}\n >\n <View\n position=\"absolute\"\n top={0}\n bottom={0}\n left={0}\n right={0}\n onPress={isClosePrevented ? undefined : handlePress}\n accessible={false}\n importantForAccessibility=\"no\"\n />\n <View\n accessibilityViewIsModal={isOpen}\n onAccessibilityEscape={handlePress}\n pointerEvents=\"box-none\"\n flex={1}\n width=\"100%\"\n justifyContent=\"center\"\n alignItems=\"center\"\n {...props}\n {...views?.view}\n >\n {children}\n </View>\n </Center>\n </RNModal>\n );\n }\n);\n\nconst nativeShadow = {\n elevation: 5,\n shadowColor: 'rgba(0, 0, 0, 0.15)',\n shadowOffset: { width: 0, height: 4 },\n shadowOpacity: 1,\n shadowRadius: 16,\n};\n\nexport const ModalContainer: React.FC<ContainerProps> = React.memo(\n ({\n children,\n shadow,\n isFullScreen = false,\n shape = 'rounded',\n views,\n position: _position,\n ...props\n }) => {\n // stopPropagation isn't needed on RN — touch events don't bubble up like web\n return (\n <Vertical\n backgroundColor=\"color-white\"\n width={isFullScreen ? '100%' : '90%'}\n maxWidth={600}\n {...(shadow ? shadow : nativeShadow)}\n {...ContainerShapes[shape]}\n {...props}\n {...views?.container}\n >\n {children}\n </Vertical>\n );\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 closeButtonLabel = 'Close dialog',\n views,\n onClose: onCloseProp,\n ...props\n }) => {\n const onClose = onCloseProp ? onCloseProp : hideModal;\n const buttonIcon = (\n <View\n accessible\n accessibilityRole=\"button\"\n accessibilityLabel={closeButtonLabel}\n onPress={onClose}\n >\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={1}\n borderBottomColor=\"color-gray-200\"\n {...props}\n {...views?.header}\n >\n {buttonPosition === 'left' && buttonIcon}\n {children}\n {buttonPosition === 'right' && buttonIcon}\n </Horizontal>\n );\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 {...props}\n {...views?.view}\n >\n {children}\n </View>\n );\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={1}\n borderTopColor=\"color-gray-200\"\n gap={12}\n {...props}\n {...views?.container}\n >\n {children}\n </Horizontal>\n );\n }\n);\n",
|
|
93
97
|
"type": "registry:ui"
|
|
94
98
|
},
|
|
95
99
|
{
|
|
96
100
|
"path": "src/components/Modal/Modal/Modal.view.tsx",
|
|
97
|
-
"content": "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
|
|
101
|
+
"content": "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 pointerEvents={isOpen ? 'auto' : 'none'}\n transition={\n isOpen\n ? 'opacity 0.2s ease'\n : 'opacity 0.2s ease, visibility 0s linear 0.2s'\n }\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 closeButtonLabel = 'Close dialog',\n views,\n onClose: onCloseProp,\n ...props\n }) => {\n const onClose = onCloseProp ? onCloseProp : hideModal;\n const buttonIcon = (\n <Element\n as=\"button\"\n type=\"button\"\n aria-label={closeButtonLabel}\n display=\"inline-flex\"\n alignItems=\"center\"\n justifyContent=\"center\"\n padding={4}\n border={0}\n backgroundColor=\"transparent\"\n onClick={() => onClose()}\n >\n <CloseIcon\n widthHeight={HeaderIconSizes[buttonSize ?? iconSize]}\n color={buttonColor}\n />\n </Element>\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",
|
|
98
102
|
"type": "registry:ui"
|
|
99
103
|
},
|
|
100
104
|
{
|