@persona/design-system 0.7.1 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +49 -0
- package/README.md +9 -9
- package/dist/Accordion.d.mts +38 -0
- package/dist/AccordionItem.d.mts +31 -0
- package/dist/{Action-C7INft7X.d.mts → Action-B-AiHknZ.d.mts} +3 -3
- package/dist/Action.d.mts +1 -1
- package/dist/AdvancedFilterRuleRow.d.mts +2 -2
- package/dist/AdvancedFilterRulesPopover.d.mts +2 -2
- package/dist/ArrayValueControl.d.mts +1 -1
- package/dist/Attribute.d.mts +3 -3
- package/dist/{Badge-BD0Ut46g.mjs → Badge-COqUjFQu.mjs} +2 -2
- package/dist/{Badge-BD0Ut46g.mjs.map → Badge-COqUjFQu.mjs.map} +1 -1
- package/dist/BooleanValueControl.d.mts +1 -1
- package/dist/{Breadcrumb-DtW1R9xW.d.mts → Breadcrumb-DRFY46ZW.d.mts} +1 -1
- package/dist/Breadcrumb.d.mts +1 -1
- package/dist/{Breadcrumbs-B6JyoS8n.d.mts → Breadcrumbs-DUSbT1I7.d.mts} +2 -2
- package/dist/{Breadcrumbs-CrXfUK1V.mjs → Breadcrumbs-DXS7rU7_.mjs} +5 -5
- package/dist/{Breadcrumbs-CrXfUK1V.mjs.map → Breadcrumbs-DXS7rU7_.mjs.map} +1 -1
- package/dist/Breadcrumbs.d.mts +1 -1
- package/dist/{Button-HodDf_bB.d.mts → Button-xZ6DC5XC.d.mts} +4 -4
- package/dist/Button.d.mts +1 -1
- package/dist/{Calendar-DrdTvzAa.d.mts → Calendar-dPmo2dkj.d.mts} +1 -1
- package/dist/Calendar.d.mts +1 -1
- package/dist/CalendarBase.d.mts +1 -1
- package/dist/{Card-CpDwATnX.d.mts → Card-CUeM8Lh8.d.mts} +3 -3
- package/dist/Card.d.mts +1 -1
- package/dist/{CardV2-M3o4BELp.mjs → CardV2-D9p7D7jX.mjs} +9 -7
- package/dist/{CardV2-M3o4BELp.mjs.map → CardV2-D9p7D7jX.mjs.map} +1 -1
- package/dist/{Checkbox-CyWXhuby.mjs → Checkbox-DQynkc_I.mjs} +3 -3
- package/dist/{Checkbox-CyWXhuby.mjs.map → Checkbox-DQynkc_I.mjs.map} +1 -1
- package/dist/{Checkbox-C-hMfItK.d.mts → Checkbox-DoJpxPEz.d.mts} +1 -1
- package/dist/Checkbox.d.mts +1 -1
- package/dist/CheckboxGroupField.d.mts +1 -1
- package/dist/ChoicesValueControl.d.mts +1 -1
- package/dist/{Combobox-1M6EwVmq.mjs → Combobox-C_kCY3P3.mjs} +28 -12
- package/dist/Combobox-C_kCY3P3.mjs.map +1 -0
- package/dist/{Combobox-DyNllwt8.d.mts → Combobox-D7hyf-jA.d.mts} +3 -3
- package/dist/Combobox.d.mts +2 -2
- package/dist/{ComboboxBase-B3YqkjQp.d.mts → ComboboxBase-BMCY6O7Y.d.mts} +10 -5
- package/dist/ComboboxBase.d.mts +1 -1
- package/dist/{ComboboxMultiSelect-BuwVssvZ.d.mts → ComboboxMultiSelect-L0KYMkmm.d.mts} +2 -2
- package/dist/ComboboxMultiSelect.d.mts +1 -1
- package/dist/{ComboboxSingleSelect-gJC4v7ER.d.mts → ComboboxSingleSelect-v5oNrJ7M.d.mts} +4 -4
- package/dist/ComboboxSingleSelect.d.mts +1 -1
- package/dist/{CompactBar-DhHh7Roq.d.mts → CompactBar-DjFaUAsN.d.mts} +4 -4
- package/dist/CompactBar.d.mts +1 -1
- package/dist/{ConfigFormGroup-Cz7GeTYd.mjs → ConfigFormGroup-DLOZOuLf.mjs} +2 -2
- package/dist/{ConfigFormGroup-Cz7GeTYd.mjs.map → ConfigFormGroup-DLOZOuLf.mjs.map} +1 -1
- package/dist/{ControlBar-C8kagIck.d.mts → ControlBar-Cegjxa6-.d.mts} +7 -2
- package/dist/ControlBar.d.mts +1 -1
- package/dist/DataTable.d.mts +4 -3
- package/dist/{DateField-2aigfD4u.d.mts → DateField-Dk5ykLdr.d.mts} +2 -2
- package/dist/DateField.d.mts +1 -1
- package/dist/{DatePicker-D9JurBBj.mjs → DatePicker-C7z1yodK.mjs} +77 -42
- package/dist/DatePicker-C7z1yodK.mjs.map +1 -0
- package/dist/{DatePicker-DC_RKjdM.d.mts → DatePicker-Dtvv0V45.d.mts} +2 -2
- package/dist/DatePicker.d.mts +1 -1
- package/dist/{DateRangePicker-ByD6IsLB.d.mts → DateRangePicker-HPYsa4wC.d.mts} +3 -3
- package/dist/DateRangePicker.d.mts +1 -1
- package/dist/DateRangeValueControl.d.mts +5 -3
- package/dist/DateValueControl.d.mts +8 -5
- package/dist/{DropdownButton-BWiXLMfD.mjs → DropdownButton-CQrFHOIW.mjs} +3 -3
- package/dist/{DropdownButton-BWiXLMfD.mjs.map → DropdownButton-CQrFHOIW.mjs.map} +1 -1
- package/dist/DropdownButton.d.mts +2 -2
- package/dist/{DropdownMenu-Xl1BYXsY.d.mts → DropdownMenu-D1qvgGTZ.d.mts} +2 -2
- package/dist/{DropdownMenu-CuKSNxc9.mjs → DropdownMenu-rm9Nnxn7.mjs} +7 -2
- package/dist/DropdownMenu-rm9Nnxn7.mjs.map +1 -0
- package/dist/DropdownMenu.d.mts +1 -1
- package/dist/{ErrorProps-Dgu98PkH.d.mts → ErrorProps-B8-Mqf1W.d.mts} +1 -1
- package/dist/ErrorProps.d.mts +1 -1
- package/dist/{FieldRegistry-BdtxI1N2.d.mts → FieldRegistry-0LmSQ-jc.d.mts} +2 -2
- package/dist/FieldRegistry.d.mts +1 -1
- package/dist/{FilterBar-jYjPeD7F.d.mts → FilterBar-BMM4Swbt.d.mts} +11 -4
- package/dist/FilterBar.d.mts +1 -1
- package/dist/FilterPickerMenu.d.mts +2 -2
- package/dist/FilterPill.d.mts +1 -1
- package/dist/FilterPopover.d.mts +1 -1
- package/dist/FloatValueControl.d.mts +1 -1
- package/dist/{FormControl-BEk4F1EV.mjs → FormControl-DXrxoJLl.mjs} +26 -11
- package/dist/FormControl-DXrxoJLl.mjs.map +1 -0
- package/dist/{FormControl-CJfYdgZF.d.mts → FormControl-Dg8doZq2.d.mts} +6 -2
- package/dist/FormControl.d.mts +1 -1
- package/dist/FormControlLabel.d.mts +1 -1
- package/dist/{FormField-CK8o1sMB.d.mts → FormField-BeLigf9j.d.mts} +4 -2
- package/dist/{FormField-ByT0avVx.mjs → FormField-Crp3F-hv.mjs} +31 -21
- package/dist/FormField-Crp3F-hv.mjs.map +1 -0
- package/dist/FormField.d.mts +1 -1
- package/dist/Grid-eMLuyRzV.mjs +92 -0
- package/dist/Grid-eMLuyRzV.mjs.map +1 -0
- package/dist/Grid.d.mts +4 -1
- package/dist/{Header-ZnHGm8fs.d.mts → Header-DxJ6TfPw.d.mts} +1 -1
- package/dist/Header.d.mts +1 -1
- package/dist/{HelperTooltip-CQpPO16Q.d.mts → HelperTooltip-DcyrpEZI.d.mts} +2 -2
- package/dist/HelperTooltip.d.mts +1 -1
- package/dist/{HoverCopyableField-CN3gl0ny.mjs → HoverCopyableField-12bBuG-d.mjs} +3 -3
- package/dist/{HoverCopyableField-CN3gl0ny.mjs.map → HoverCopyableField-12bBuG-d.mjs.map} +1 -1
- package/dist/{IconButton-zu-VNp1h.d.mts → IconButton-BUMMN-gH.d.mts} +2 -2
- package/dist/{IconButton-CqTPMhjV.mjs → IconButton-CCLMYWVN.mjs} +1 -1
- package/dist/{IconButton-CqTPMhjV.mjs.map → IconButton-CCLMYWVN.mjs.map} +1 -1
- package/dist/IconButton.d.mts +1 -1
- package/dist/ImageTile.d.mts +1 -1
- package/dist/InlineCombobox.d.mts +1 -1
- package/dist/InlineInput.d.mts +1 -1
- package/dist/{Input-Ce8FvSYf.d.mts → Input-2N2e5JCf.d.mts} +3 -3
- package/dist/{Input-Bc2yWH3j.mjs → Input-Cl4o41k4.mjs} +7 -3
- package/dist/Input-Cl4o41k4.mjs.map +1 -0
- package/dist/Input.d.mts +1 -1
- package/dist/{InputProps-B1Xod4wm.d.mts → InputProps-TWzig3QO.d.mts} +2 -2
- package/dist/InputProps.d.mts +1 -1
- package/dist/IntegerValueControl.d.mts +1 -1
- package/dist/Link-I9Bklen-.mjs +79 -0
- package/dist/Link-I9Bklen-.mjs.map +1 -0
- package/dist/Link.d.mts +1 -1
- package/dist/{ListBox-D-8iwYVj.d.mts → ListBox-BcoXOt73.d.mts} +3 -3
- package/dist/{ListBox-CFBhILRy.mjs → ListBox-sqeLBiKS.mjs} +33 -16
- package/dist/ListBox-sqeLBiKS.mjs.map +1 -0
- package/dist/ListBox.d.mts +1 -1
- package/dist/ListBoxField.d.mts +3 -2
- package/dist/{LoadingShimmer-Dizk2sZu.mjs → LoadingShimmer-dRSkdlqD.mjs} +13 -8
- package/dist/LoadingShimmer-dRSkdlqD.mjs.map +1 -0
- package/dist/LoadingShimmer.d.mts +1 -1
- package/dist/{LogicRow-CgPds2tq.d.mts → LogicRow-DXywXdYt.d.mts} +3 -3
- package/dist/LogicRow.d.mts +1 -1
- package/dist/MaskedInput.d.mts +2 -2
- package/dist/{Menu-CSwzFqdv.d.mts → Menu-BekLwm8w.d.mts} +3 -3
- package/dist/{Menu-Cd6oxjAe.mjs → Menu-CwlI7BMN.mjs} +1 -1
- package/dist/{Menu-Cd6oxjAe.mjs.map → Menu-CwlI7BMN.mjs.map} +1 -1
- package/dist/Menu.d.mts +1 -1
- package/dist/Modal-CMiFcXC9.mjs +260 -0
- package/dist/Modal-CMiFcXC9.mjs.map +1 -0
- package/dist/Modal-ymxlGYKt.d.mts +145 -0
- package/dist/Modal.d.mts +2 -145
- package/dist/{PageHeader-DJOlcAiW.mjs → PageHeader-D_0p7UK_.mjs} +2 -2
- package/dist/{PageHeader-DJOlcAiW.mjs.map → PageHeader-D_0p7UK_.mjs.map} +1 -1
- package/dist/PageHeader.d.mts +1 -1
- package/dist/PageLayoutFrame.d.mts +28 -0
- package/dist/{PageSelector-BMz2Q4P6.d.mts → PageSelector-Bxulu6vU.d.mts} +3 -3
- package/dist/PageSelector.d.mts +1 -1
- package/dist/{Pagination-B1u203DE.mjs → Pagination-Co9CfyFQ.mjs} +5 -5
- package/dist/{Pagination-B1u203DE.mjs.map → Pagination-Co9CfyFQ.mjs.map} +1 -1
- package/dist/{Pagination-ne9hnVoe.d.mts → Pagination-Dg-4O7F7.d.mts} +2 -2
- package/dist/Pagination.d.mts +1 -1
- package/dist/{Pii-Dz4woKd8.mjs → Pii-JGV9gP95.mjs} +2 -2
- package/dist/{Pii-Dz4woKd8.mjs.map → Pii-JGV9gP95.mjs.map} +1 -1
- package/dist/{PillShell-ChTB_koa.d.mts → PillShell-BA7KK1zS.d.mts} +2 -2
- package/dist/PillShell.d.mts +1 -1
- package/dist/{Popover-opVa9Xhc.mjs → Popover-ZAj03lws.mjs} +15 -2
- package/dist/Popover-ZAj03lws.mjs.map +1 -0
- package/dist/ProgressIndicator-CQg08vuA.mjs +188 -0
- package/dist/ProgressIndicator-CQg08vuA.mjs.map +1 -0
- package/dist/ProgressIndicator-D85HQGSx.d.mts +66 -0
- package/dist/ProgressIndicator.d.mts +2 -66
- package/dist/{PseudoClassProps-CdRF3QNn.d.mts → PseudoClassProps-BHs8TX_3.d.mts} +1 -1
- package/dist/PseudoClassProps.d.mts +1 -1
- package/dist/{Radio-Ds1pODKw.mjs → Radio-CYV290JI.mjs} +2 -2
- package/dist/{Radio-Ds1pODKw.mjs.map → Radio-CYV290JI.mjs.map} +1 -1
- package/dist/{RadioGroup-CxL6LW4q.d.mts → RadioGroup-Cq3KV1TN.d.mts} +1 -1
- package/dist/{RadioGroup-HIC9V2hO.mjs → RadioGroup-lWMMtu9V.mjs} +2 -2
- package/dist/{RadioGroup-HIC9V2hO.mjs.map → RadioGroup-lWMMtu9V.mjs.map} +1 -1
- package/dist/RadioGroup.d.mts +1 -1
- package/dist/{RangeCalendar-B7TwRJbg.d.mts → RangeCalendar-Mh7h74Tp.d.mts} +2 -2
- package/dist/RangeCalendar.d.mts +1 -1
- package/dist/RangeCalendarPresets.d.mts +1 -1
- package/dist/{RouterContext-B7N12wkK.d.mts → RouterContext-B3IU1jb0.d.mts} +2 -2
- package/dist/RouterContext.d.mts +1 -1
- package/dist/{RouterLink-Bq36EGjc.d.mts → RouterLink-CwAqTLC2.d.mts} +2 -2
- package/dist/RouterLink.d.mts +1 -1
- package/dist/RuleEditorFields.d.mts +2 -2
- package/dist/RulesPill.d.mts +1 -1
- package/dist/{SearchInput-D69WxMNq.d.mts → SearchInput-BGyUUcoz.d.mts} +2 -2
- package/dist/SearchInput.d.mts +1 -1
- package/dist/SectionHeading.d.mts +1 -1
- package/dist/{SegmentedControl-OHrfJiw0.mjs → SegmentedControl-BEbIcV3g.mjs} +13 -6
- package/dist/SegmentedControl-BEbIcV3g.mjs.map +1 -0
- package/dist/{SegmentedControl-vCnGsdXo.d.mts → SegmentedControl-DgDabSgr.d.mts} +2 -1
- package/dist/SegmentedControl.d.mts +1 -1
- package/dist/{Select-sQb4dQwT.d.mts → Select-wqTtGyga.d.mts} +3 -3
- package/dist/{Select-DE7uv9C8.mjs → Select-yC2t_gZb.mjs} +10 -8
- package/dist/Select-yC2t_gZb.mjs.map +1 -0
- package/dist/Select.d.mts +1 -1
- package/dist/SingleColumnLayout.d.mts +16 -0
- package/dist/{Spinner-DplDSBqf.mjs → Spinner-BlAg8_OX.mjs} +1 -1
- package/dist/{Spinner-DplDSBqf.mjs.map → Spinner-BlAg8_OX.mjs.map} +1 -1
- package/dist/SplitColumnLayout.d.mts +19 -0
- package/dist/{Stack-ChsImaEY.mjs → Stack-Bkn0TUDe.mjs} +1 -1
- package/dist/{Stack-ChsImaEY.mjs.map → Stack-Bkn0TUDe.mjs.map} +1 -1
- package/dist/{Stack-8KGPQp0u.d.mts → Stack-CYqjBXe8.d.mts} +1 -1
- package/dist/Stack.d.mts +1 -1
- package/dist/StatusIndicator-DT2zNbkp.mjs +315 -0
- package/dist/StatusIndicator-DT2zNbkp.mjs.map +1 -0
- package/dist/{Sticker-C3Eb13OQ.mjs → Sticker-BLbgJxcH.mjs} +5 -8
- package/dist/Sticker-BLbgJxcH.mjs.map +1 -0
- package/dist/{Sticker-Bf9rhSkv.d.mts → Sticker-BmyKaxwx.d.mts} +4 -4
- package/dist/Sticker.d.mts +1 -1
- package/dist/StringValueControl.d.mts +1 -1
- package/dist/Tab.d.mts +1 -1
- package/dist/{TabBar-BepWbJHz.mjs → TabBar-Bj84q1Mr.mjs} +4 -7
- package/dist/{TabBar-BepWbJHz.mjs.map → TabBar-Bj84q1Mr.mjs.map} +1 -1
- package/dist/{Table-BefytM6w.d.mts → Table-DhdHUQ8V.d.mts} +1 -1
- package/dist/{Table-B1gRr2XT.mjs → Table-WqNfjasd.mjs} +22 -3
- package/dist/Table-WqNfjasd.mjs.map +1 -0
- package/dist/Table.d.mts +1 -1
- package/dist/{TableBody-BZ34-_wV.d.mts → TableBody-qoSvQDds.d.mts} +1 -1
- package/dist/TableBody.d.mts +1 -1
- package/dist/{TableBox-NP6bhtKb.mjs → TableBox-obl64W5Y.mjs} +22 -17
- package/dist/TableBox-obl64W5Y.mjs.map +1 -0
- package/dist/TableBox.d.mts +2 -2
- package/dist/{TableBoxCell-CHGw9HVj.d.mts → TableBoxCell-DzYMx4Ju.d.mts} +6 -6
- package/dist/TableBoxCell.d.mts +1 -1
- package/dist/TableBoxField.d.mts +4 -3
- package/dist/{TableBoxRow-BljsXKrL.d.mts → TableBoxRow-B4rFCvWK.d.mts} +3 -3
- package/dist/TableBoxRow.d.mts +1 -1
- package/dist/{TableBoxRowActions-h6HNEv9F.d.mts → TableBoxRowActions-qMKcVuTL.d.mts} +2 -2
- package/dist/TableBoxRowActions.d.mts +1 -1
- package/dist/{TableCell-DorRxyke.d.mts → TableCell-CGPQRc5g.d.mts} +2 -2
- package/dist/TableCell.d.mts +1 -1
- package/dist/{TableControls-CYTpBlQN.mjs → TableControls-RS_ozBsI.mjs} +219 -70
- package/dist/TableControls-RS_ozBsI.mjs.map +1 -0
- package/dist/{TableControls-BtGFiZeD.d.mts → TableControls-WP78qtET.d.mts} +4 -3
- package/dist/TableControls.d.mts +1 -1
- package/dist/{TableControlsContext-C3DYeUmB.d.mts → TableControlsContext-DZIZSyfX.d.mts} +2 -2
- package/dist/TableControlsContext.d.mts +1 -1
- package/dist/{TableHead-B0Fdldgw.d.mts → TableHead-36j-_oyn.d.mts} +1 -1
- package/dist/TableHead.d.mts +1 -1
- package/dist/{TableHeaderCell-C_7X8QAT.d.mts → TableHeaderCell-C7gp9j1X.d.mts} +1 -1
- package/dist/TableHeaderCell.d.mts +1 -1
- package/dist/{TableLayout-CXVVzq0e.d.mts → TableLayout-CQqIV0vj.d.mts} +1 -1
- package/dist/TableLayout.d.mts +1 -1
- package/dist/{TableRow-Dr61XJNw.d.mts → TableRow-BJZM8I8i.d.mts} +2 -2
- package/dist/TableRow.d.mts +1 -1
- package/dist/TableTH.d.mts +1 -1
- package/dist/{TableViewConfigurationDropdown-CCtwcB3I.d.mts → TableViewConfigurationDropdown-Dwy_9FBz.d.mts} +2 -2
- package/dist/TableViewConfigurationDropdown.d.mts +1 -1
- package/dist/{TechnicalSticker-_LtE-PRY.mjs → TechnicalSticker-CL0zkOAj.mjs} +1 -1
- package/dist/{TechnicalSticker-_LtE-PRY.mjs.map → TechnicalSticker-CL0zkOAj.mjs.map} +1 -1
- package/dist/{Text-DD_W_ixb.d.mts → Text-DbtTa83E.d.mts} +3 -3
- package/dist/Text.d.mts +1 -1
- package/dist/{TextArea-DOofaXJi.d.mts → TextArea-CbxF6u7z.d.mts} +2 -2
- package/dist/{TextArea-8TuVvmvj.mjs → TextArea-CfZr5Sk4.mjs} +2 -2
- package/dist/{TextArea-8TuVvmvj.mjs.map → TextArea-CfZr5Sk4.mjs.map} +1 -1
- package/dist/TextArea.d.mts +1 -1
- package/dist/{TextUnderlineTooltip-BPLKU9wu.d.mts → TextUnderlineTooltip-BgLQuK38.d.mts} +2 -2
- package/dist/TextUnderlineTooltip.d.mts +1 -1
- package/dist/Tile.d.mts +1 -1
- package/dist/Toast.d.mts +1 -1
- package/dist/{Toggle-2nrUX591.d.mts → Toggle-BYMLrPXk.d.mts} +3 -1
- package/dist/{Toggle-Dcn2Rqgm.mjs → Toggle-D4ZaUcVt.mjs} +11 -5
- package/dist/Toggle-D4ZaUcVt.mjs.map +1 -0
- package/dist/Toggle.d.mts +1 -1
- package/dist/{Tooltip-Cnqf1-tx.d.mts → Tooltip-4pshzB_i.d.mts} +2 -2
- package/dist/Tooltip.d.mts +1 -1
- package/dist/{TruncatedText-g2T5HlqX.d.mts → TruncatedText-O7hE3w0O.d.mts} +1 -1
- package/dist/VersionHistory.d.mts +23 -0
- package/dist/VersionHistoryItem-CIcEgl0K.d.mts +54 -0
- package/dist/VersionHistoryItem.d.mts +2 -0
- package/dist/WizardModal.d.mts +41 -0
- package/dist/accordionTitleTypography-CNB1w3kn.d.mts +17 -0
- package/dist/accordionTitleTypography.d.mts +2 -0
- package/dist/assertNever.d.mts +5 -0
- package/dist/{codec-CoX6LfOY.d.mts → codec-BXVBsB8Y.d.mts} +2 -2
- package/dist/codec.d.mts +1 -1
- package/dist/{color-Bt0Lv1e3.d.mts → color-3UO63ocQ.d.mts} +9 -4
- package/dist/components/Accordion/index.d.mts +4 -0
- package/dist/components/Accordion/index.mjs +330 -0
- package/dist/components/Accordion/index.mjs.map +1 -0
- package/dist/components/Attribute/index.mjs +2 -2
- package/dist/components/Badge/index.mjs +1 -1
- package/dist/components/Banner/index.mjs +1 -1
- package/dist/components/BottomPanel/index.mjs +5 -3
- package/dist/components/BottomPanel/index.mjs.map +1 -1
- package/dist/components/Breadcrumbs/index.d.mts +1 -1
- package/dist/components/Breadcrumbs/index.mjs +1 -1
- package/dist/components/Button/index.d.mts +2 -2
- package/dist/components/Button/index.mjs +1 -1
- package/dist/components/ButtonGroup/index.mjs +2 -2
- package/dist/components/Card/index.d.mts +2 -2
- package/dist/components/CardV2/index.d.mts +1 -1
- package/dist/components/CardV2/index.mjs +1 -1
- package/dist/components/Checkbox/index.d.mts +1 -1
- package/dist/components/Checkbox/index.mjs +1 -1
- package/dist/components/CodeHighlight/index.mjs +3 -1
- package/dist/components/CodeHighlight/index.mjs.map +1 -1
- package/dist/components/Combobox/index.d.mts +2 -2
- package/dist/components/Combobox/index.mjs +1 -1
- package/dist/components/ConfigFormGroup/index.mjs +2 -2
- package/dist/components/DataTable/TableControls/index.d.mts +19 -19
- package/dist/components/DataTable/TableControls/index.mjs +1 -1
- package/dist/components/DataTable/index.mjs +27 -16
- package/dist/components/DataTable/index.mjs.map +1 -1
- package/dist/components/DataTable/types.d.mts +2 -2
- package/dist/components/DatePicker/index.d.mts +5 -5
- package/dist/components/DatePicker/index.mjs +1 -1
- package/dist/components/DropdownButton/index.mjs +1 -1
- package/dist/components/DropdownMenu/index.d.mts +1 -1
- package/dist/components/DropdownMenu/index.mjs +1 -1
- package/dist/components/FloatingPanel/index.mjs +10 -7
- package/dist/components/FloatingPanel/index.mjs.map +1 -1
- package/dist/components/FormControl/index.d.mts +2 -2
- package/dist/components/FormControl/index.mjs +2 -2
- package/dist/components/FormField/index.d.mts +1 -1
- package/dist/components/FormField/index.mjs +1 -1
- package/dist/components/Grid/index.d.mts +2 -2
- package/dist/components/Grid/index.mjs +2 -85
- package/dist/components/HoverCopyableField/index.mjs +1 -1
- package/dist/components/ImageTile/index.mjs +13 -9
- package/dist/components/ImageTile/index.mjs.map +1 -1
- package/dist/components/Input/index.d.mts +1 -1
- package/dist/components/Input/index.mjs +1 -1
- package/dist/components/Link/index.mjs +1 -78
- package/dist/components/ListBox/index.d.mts +3 -3
- package/dist/components/ListBox/index.mjs +1 -1
- package/dist/components/LoadingShimmer/index.mjs +1 -1
- package/dist/components/MaskedInput/index.mjs +1 -1
- package/dist/components/Menu/index.d.mts +1 -1
- package/dist/components/Menu/index.mjs +1 -1
- package/dist/components/Modal/index.d.mts +1 -1
- package/dist/components/Modal/index.mjs +1 -257
- package/dist/components/PageHeader/index.mjs +1 -1
- package/dist/components/Pagination/index.d.mts +3 -3
- package/dist/components/Pagination/index.mjs +1 -1
- package/dist/components/Pii/index.mjs +1 -1
- package/dist/components/Popover/index.mjs +1 -1
- package/dist/components/ProgressBar/index.mjs +1 -2
- package/dist/components/ProgressBar/index.mjs.map +1 -1
- package/dist/components/ProgressIndicator/index.d.mts +2 -2
- package/dist/components/ProgressIndicator/index.mjs +1 -187
- package/dist/components/Radio/index.mjs +1 -1
- package/dist/components/RadioGroup/index.d.mts +1 -1
- package/dist/components/RadioGroup/index.mjs +1 -1
- package/dist/components/RightPanel/index.mjs +10 -7
- package/dist/components/RightPanel/index.mjs.map +1 -1
- package/dist/components/SegmentedControl/index.d.mts +1 -1
- package/dist/components/SegmentedControl/index.mjs +1 -1
- package/dist/components/Select/index.d.mts +1 -1
- package/dist/components/Select/index.mjs +1 -1
- package/dist/components/Slider/index.mjs +1 -1
- package/dist/components/Slider/index.mjs.map +1 -1
- package/dist/components/SmartTextInput/parser/method-chain/types.d.mts +2 -105
- package/dist/components/SmartTextInput/parser/smart-text/types.d.mts +1 -1
- package/dist/components/Spinner/index.mjs +1 -1
- package/dist/components/Stack/index.d.mts +1 -1
- package/dist/components/Stack/index.mjs +1 -1
- package/dist/components/StatusIndicator/index.mjs +1 -314
- package/dist/components/Sticker/index.d.mts +1 -1
- package/dist/components/Sticker/index.mjs +1 -1
- package/dist/components/TabBar/index.mjs +1 -1
- package/dist/components/Table/index.d.mts +8 -8
- package/dist/components/Table/index.mjs +1 -1
- package/dist/components/TableBox/index.d.mts +2 -2
- package/dist/components/TableBox/index.mjs +1 -1
- package/dist/components/TechnicalSticker/index.mjs +1 -1
- package/dist/components/Text/index.d.mts +1 -1
- package/dist/components/TextArea/index.d.mts +1 -1
- package/dist/components/TextArea/index.mjs +1 -1
- package/dist/components/Tile/index.mjs +2 -2
- package/dist/components/Toast/index.mjs +2 -2
- package/dist/components/Toast/index.mjs.map +1 -1
- package/dist/components/Toggle/index.d.mts +1 -1
- package/dist/components/Toggle/index.mjs +1 -1
- package/dist/components/Tooltip/index.d.mts +3 -3
- package/dist/components/VersionHistory/index.d.mts +3 -0
- package/dist/components/VersionHistory/index.mjs +389 -0
- package/dist/components/VersionHistory/index.mjs.map +1 -0
- package/dist/components/WizardModal/index.d.mts +2 -0
- package/dist/components/WizardModal/index.mjs +106 -0
- package/dist/components/WizardModal/index.mjs.map +1 -0
- package/dist/compound-expression.d.mts +1 -1
- package/dist/{constants-D8bzZ-7B.d.mts → constants-BOxzLX-O.d.mts} +1 -1
- package/dist/constants.d.mts +1 -1
- package/dist/{createPath-BDYRvl57.d.mts → createPath-OeTC9kvS.d.mts} +2 -2
- package/dist/createPath.d.mts +1 -1
- package/dist/{date-filter-CZeChs9T.mjs → date-filter-BnzR6NxT.mjs} +1 -1
- package/dist/{date-filter-CZeChs9T.mjs.map → date-filter-BnzR6NxT.mjs.map} +1 -1
- package/dist/{date-range-rule-value-jZAHuxZJ.d.mts → date-range-rule-value-BRp5Bi7R.d.mts} +2 -2
- package/dist/date-range-rule-value.d.mts +1 -1
- package/dist/{date-rule-intent-CC1LdkE7.d.mts → date-rule-intent-CDBtV0ET.d.mts} +3 -3
- package/dist/date-rule-intent.d.mts +1 -1
- package/dist/display.d.mts +2 -2
- package/dist/fieldPickerOptions.d.mts +2 -2
- package/dist/{filter-size-context-BGczB5R9.d.mts → filter-size-context-CqvQ190x.d.mts} +2 -2
- package/dist/filter-size-context.d.mts +1 -1
- package/dist/format-date-value.d.mts +5 -0
- package/dist/helpers.d.mts +1 -1
- package/dist/{index-DalP_w0c.d.mts → index-BXSe73Xn.d.mts} +2 -2
- package/dist/{index-BRKXhLGa.d.mts → index-CyAok7As.d.mts} +2 -2
- package/dist/index-gVcIuWLd.d.mts +1 -0
- package/dist/{index-BZmGEbsA.d.mts → index-wKK9f9La.d.mts} +3 -3
- package/dist/index-zeAhjge4.d.mts +1 -0
- package/dist/index.d.mts +1 -1
- package/dist/index2.d.mts +1 -1
- package/dist/index3.d.mts +3 -3
- package/dist/index4.d.mts +1 -1
- package/dist/index5.d.mts +14 -14
- package/dist/{input-DCJivcWf.d.mts → input-C6cyiqm2.d.mts} +3 -3
- package/dist/inputFields.d.mts +14 -12
- package/dist/{intersperse-Bxcrxj2Q.mjs → intersperse-Df9zw7Bk.mjs} +1 -1
- package/dist/{intersperse-Bxcrxj2Q.mjs.map → intersperse-Df9zw7Bk.mjs.map} +1 -1
- package/dist/{jsonSchema-c_EfAj8y.d.mts → jsonSchema-CfGi1bzI.d.mts} +67 -11
- package/dist/lib/PDSProvider.d.mts +2 -2
- package/dist/lib/TruncatedText.d.mts +1 -1
- package/dist/lib/TruncatedTextWithTooltip.d.mts +1 -1
- package/dist/lib/chainTypes.d.mts +17 -0
- package/dist/lib/chainTypes.mjs +0 -0
- package/dist/lib/color.d.mts +2 -2
- package/dist/lib/color.mjs +18 -11
- package/dist/lib/color.mjs.map +1 -1
- package/dist/lib/customFunctionSchema.d.mts +49 -0
- package/dist/lib/customFunctionSchema.mjs +299 -0
- package/dist/lib/customFunctionSchema.mjs.map +1 -0
- package/dist/lib/date-filter/index.d.mts +2 -2
- package/dist/lib/date-filter/index.mjs +1 -1
- package/dist/lib/jsonSchema.d.mts +2 -2
- package/dist/lib/jsonSchema.mjs +36 -11
- package/dist/lib/jsonSchema.mjs.map +1 -1
- package/dist/lib/jsonSchemaType.d.mts +7 -0
- package/dist/lib/jsonSchemaType.mjs +31 -0
- package/dist/lib/jsonSchemaType.mjs.map +1 -0
- package/dist/lib/letPointerDownReachDocument.d.mts +22 -0
- package/dist/lib/letPointerDownReachDocument.mjs +25 -0
- package/dist/lib/letPointerDownReachDocument.mjs.map +1 -0
- package/dist/lib/message.d.mts +1 -1
- package/dist/lib/methodChain.d.mts +3 -66
- package/dist/lib/methodChain.mjs +1 -237
- package/dist/lib/methodChainNormalize.d.mts +2 -2
- package/dist/lib/methodChainTypes.d.mts +2 -23
- package/dist/lib/objectSchemaTypes.d.mts +1 -1
- package/dist/lib/platformObject.d.mts +38 -0
- package/dist/lib/platformObject.mjs +79 -0
- package/dist/lib/platformObject.mjs.map +1 -0
- package/dist/lib/pseudoClass.d.mts +1 -1
- package/dist/lib/router/adapters/reactRouter.d.mts +1 -1
- package/dist/lib/router/adapters/tanstack.d.mts +1 -1
- package/dist/lib/router/index.d.mts +5 -5
- package/dist/lib/schemaOptions.d.mts +173 -0
- package/dist/lib/schemaOptions.mjs +481 -0
- package/dist/lib/schemaOptions.mjs.map +1 -0
- package/dist/lib/semanticColor.d.mts +1 -1
- package/dist/lib/snakifyPath.d.mts +5 -0
- package/dist/lib/snakifyPath.mjs +11 -0
- package/dist/lib/snakifyPath.mjs.map +1 -0
- package/dist/{message-CjIHdhX1.d.mts → message-CblP0EjG.d.mts} +1 -1
- package/dist/methodChain-DAQxLgxt.mjs +241 -0
- package/dist/methodChain-DAQxLgxt.mjs.map +1 -0
- package/dist/methodChain-Pk1C3i_E.d.mts +66 -0
- package/dist/methodChainTypes-CqWzfx0M.d.mts +23 -0
- package/dist/mixins/focus.d.mts +1 -1
- package/dist/mixins/hoverable.d.mts +2 -2
- package/dist/mixins/input.d.mts +1 -1
- package/dist/mixins/input.mjs +6 -14
- package/dist/mixins/input.mjs.map +1 -1
- package/dist/mixins/menuItem.d.mts +2 -2
- package/dist/mixins/scrollbar.d.mts +10 -0
- package/dist/mixins/scrollbar.mjs +31 -0
- package/dist/mixins/scrollbar.mjs.map +1 -0
- package/dist/mixins/text.d.mts +1 -1
- package/dist/{operators-x_ZENhrT.d.mts → operators-CoXL5Hv6.d.mts} +2 -2
- package/dist/operators.d.mts +1 -1
- package/dist/{palette-qgPRWgUN.d.mts → palette-CxXUs1Fu.d.mts} +3 -3
- package/dist/palette.d.mts +1 -1
- package/dist/patterns/LayoutLoadingShimmer/index.mjs +5 -5
- package/dist/patterns/PageLayout/index.d.mts +4 -1
- package/dist/patterns/PageLayout/index.mjs +99 -2
- package/dist/patterns/PageLayout/index.mjs.map +1 -1
- package/dist/reactRouterFallback.d.mts +1 -1
- package/dist/relative-date-label.d.mts +1 -1
- package/dist/scrollExpandedItemIntoView.d.mts +12 -0
- package/dist/{semantic-DUctmpu_.d.mts → semantic-CFMBsuiJ.d.mts} +2 -2
- package/dist/{semanticColor-IAhXS17y.d.mts → semanticColor-DuJCmDrH.d.mts} +3 -3
- package/dist/{text-DjTGRUM1.d.mts → text-D8HPjiEX.d.mts} +1 -1
- package/dist/{theme-DKiszVRN.d.mts → theme-BcaR-Au5.d.mts} +3 -3
- package/dist/theme.d.mts +1 -1
- package/dist/time-range.d.mts +7 -0
- package/dist/tone.d.mts +3 -3
- package/dist/{types-CcZbBH0e.d.mts → types-BCiq4hGv.d.mts} +1 -1
- package/dist/types-BGMmkUpy.d.mts +105 -0
- package/dist/{types-N8PYonjD.d.mts → types-C4WUSW3e.d.mts} +7 -2
- package/dist/{types-CuQSgl1F.d.mts → types-CkpixGWr.d.mts} +1 -1
- package/dist/{types-D8rWSj3z.d.mts → types-Cl-w8tYc.d.mts} +1 -1
- package/dist/{types-gnF3MPfk2.d.mts → types-CoVZwrMW.d.mts} +2 -2
- package/dist/{types-RWjW1d9I.d.mts → types-DgyGecdM.d.mts} +1 -1
- package/dist/types.d.mts +1 -1
- package/dist/types2.d.mts +1 -1
- package/dist/types3.d.mts +1 -1
- package/dist/types4.d.mts +1 -1
- package/dist/types5.d.mts +1 -1
- package/dist/types6.d.mts +1 -1
- package/dist/{url-state-C2gl07_y.d.mts → url-state-8j_ef8Uf.d.mts} +2 -2
- package/dist/url-state.d.mts +1 -1
- package/dist/useComboboxFooterAction.d.mts +1 -1
- package/dist/{useFilterStateV2-BQYcAdKR.d.mts → useFilterStateV2-CW6eght1.d.mts} +3 -3
- package/dist/useFilterStateV2.d.mts +1 -1
- package/dist/{useFormField-DDbo-ExT.d.mts → useFormField-CLRZkUZt.d.mts} +4 -2
- package/dist/{useFormField-DsvC5dOb.mjs → useFormField-XezSxho_.mjs} +3 -2
- package/dist/useFormField-XezSxho_.mjs.map +1 -0
- package/dist/useFormField.d.mts +1 -1
- package/dist/{useFormGroup-CH3kiXoa.mjs → useFormGroup-C7Cax8zO.mjs} +1 -1
- package/dist/{useFormGroup-CH3kiXoa.mjs.map → useFormGroup-C7Cax8zO.mjs.map} +1 -1
- package/dist/{useLocationPathname-K2N4fw8j.d.mts → useLocationPathname-DH5Tdq5X.d.mts} +1 -1
- package/dist/useLocationPathname.d.mts +1 -1
- package/dist/{useTableBoxDragAndDrop-CbbH3pMK.d.mts → useTableBoxDragAndDrop-Da4TiYBT.d.mts} +1 -1
- package/dist/useTableBoxDragAndDrop.d.mts +1 -1
- package/dist/useTruncation.d.mts +1 -1
- package/dist/{utilities-D0EhDri-.d.mts → utilities-DcsbI71T.d.mts} +1 -1
- package/dist/utilities.d.mts +1 -1
- package/dist/utils/storybook.mjs +1 -1
- package/dist/utils/testing.d.mts +1 -1
- package/dist/utils/testing.mjs.map +1 -1
- package/dist/utils.d.mts +1 -1
- package/dist/{validation-CMtfUd-R.d.mts → validation-BgwNghi2.d.mts} +3 -3
- package/dist/validation.d.mts +1 -1
- package/dist/{value-control-resolver-Au9JNS5z.d.mts → value-control-resolver-B0HDRxRN.d.mts} +3 -2
- package/dist/value-control-resolver.d.mts +1 -1
- package/dist/variables/effect.d.mts +1 -1
- package/dist/variables/semantic.d.mts +1 -1
- package/dist/variables/semantic.mjs +15 -18
- package/dist/variables/semantic.mjs.map +1 -1
- package/llms.txt +10 -1
- package/package.json +27 -6
- package/skills/ui-authoring/COMPONENTS.md +6 -1
- package/skills/ui-authoring/PATTERNS.md +74 -115
- package/dist/Combobox-1M6EwVmq.mjs.map +0 -1
- package/dist/DatePicker-D9JurBBj.mjs.map +0 -1
- package/dist/DropdownMenu-CuKSNxc9.mjs.map +0 -1
- package/dist/FormControl-BEk4F1EV.mjs.map +0 -1
- package/dist/FormField-ByT0avVx.mjs.map +0 -1
- package/dist/Input-Bc2yWH3j.mjs.map +0 -1
- package/dist/ListBox-CFBhILRy.mjs.map +0 -1
- package/dist/LoadingShimmer-Dizk2sZu.mjs.map +0 -1
- package/dist/Popover-opVa9Xhc.mjs.map +0 -1
- package/dist/SegmentedControl-OHrfJiw0.mjs.map +0 -1
- package/dist/Select-DE7uv9C8.mjs.map +0 -1
- package/dist/Sticker-C3Eb13OQ.mjs.map +0 -1
- package/dist/Table-B1gRr2XT.mjs.map +0 -1
- package/dist/TableBox-NP6bhtKb.mjs.map +0 -1
- package/dist/TableControls-CYTpBlQN.mjs.map +0 -1
- package/dist/Toggle-Dcn2Rqgm.mjs.map +0 -1
- package/dist/components/Grid/index.mjs.map +0 -1
- package/dist/components/Link/index.mjs.map +0 -1
- package/dist/components/Modal/index.mjs.map +0 -1
- package/dist/components/ProgressIndicator/index.mjs.map +0 -1
- package/dist/components/StatusIndicator/index.mjs.map +0 -1
- package/dist/fieldSchemaTypes-BVYSm74B.d.mts +0 -39
- package/dist/lib/fieldSchemaTypes.d.mts +0 -2
- package/dist/lib/fieldSchemaTypes.mjs +0 -41
- package/dist/lib/fieldSchemaTypes.mjs.map +0 -1
- package/dist/lib/methodChain.mjs.map +0 -1
- package/dist/useFormField-DsvC5dOb.mjs.map +0 -1
- /package/dist/{index--p6oQT9I.d.mts → index-B24gUwOx.d.mts} +0 -0
- /package/dist/{index-B33elXxm.d.mts → index-BFnNtGdX.d.mts} +0 -0
- /package/dist/{index-BO_854F2.d.mts → index-BNRXMhlr.d.mts} +0 -0
- /package/dist/{index-BrGZHEgX.d.mts → index-BPiqSRRl.d.mts} +0 -0
- /package/dist/{index-BwAfCVZH2.d.mts → index-BYd3Btr1.d.mts} +0 -0
- /package/dist/{index-CRo77wc3.d.mts → index-Bt4QNofW.d.mts} +0 -0
- /package/dist/{index-CX869wwk.d.mts → index-CEqOS-7M.d.mts} +0 -0
- /package/dist/{index-CsuikFeJ.d.mts → index-CIABef8t.d.mts} +0 -0
- /package/dist/{index-CuYZJcK3.d.mts → index-CTHojwxd.d.mts} +0 -0
- /package/dist/{index-CzItj62a.d.mts → index-Cm-1i165.d.mts} +0 -0
- /package/dist/{index-D13oYj4_.d.mts → index-DB7t8whN.d.mts} +0 -0
- /package/dist/{index-D4DUvwPf.d.mts → index-DBGd4WeR.d.mts} +0 -0
- /package/dist/{index-DMRtRo7y.d.mts → index-DGsJdI5l.d.mts} +0 -0
- /package/dist/{index-DXJd7-2Z.d.mts → index-DWfPppPU.d.mts} +0 -0
- /package/dist/{index-DZlqSwCF.d.mts → index-DedbSZMv.d.mts} +0 -0
- /package/dist/{index-Dflz2i1X.d.mts → index-Jh0C5PIG.d.mts} +0 -0
- /package/dist/{index-DkrC-i1D.d.mts → index-NKYLt_R9.d.mts} +0 -0
- /package/dist/{index-DztUdPP_.d.mts → index-Qwqzz3XM.d.mts} +0 -0
- /package/dist/{index-Rvd9MEUQ.d.mts → index-VWno75SQ.d.mts} +0 -0
- /package/dist/{index-bHnO4ZKt.d.mts → index-fxXoW-qc.d.mts} +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Toggle-Dcn2Rqgm.mjs","names":[],"sources":["../components/Toggle/Toggle.tsx"],"sourcesContent":["import { forwardRef, type ReactNode, useCallback, useRef } from 'react';\nimport { useId } from 'react-aria';\nimport styled, { css } from 'styled-components';\n\nimport { Color, Spacing } from '@persona/design-tokens';\nimport useFormField from 'design-system/components/FormControl/useFormField';\nimport { Label } from 'design-system/components/Text';\nimport { isDisabled, isHovered, isNotDisabled } from 'design-system/lib/pseudoClass';\nimport { semanticColor, semanticTokens } from 'design-system/lib/semanticColor';\nimport useToggle from 'design-system/lib/useToggle';\nimport { focusOutlineControlled } from 'design-system/mixins/focus';\nimport { TransitionDuration } from 'design-system/variables/transitions';\n\ntype ToggleSize = 'md' | 'sm';\n\ninterface SwitchSizes {\n width: number;\n height: number;\n}\n\nconst SWITCH_SIZES: Record<ToggleSize, SwitchSizes> = {\n md: { width: 32, height: 18 },\n sm: { width: 28, height: parseInt(Spacing[4], 10) }, // 16px height from tokens\n};\n\ninterface SliderSizes {\n diameter: number;\n offset: number;\n}\n\nconst SLIDER_SIZES: Record<ToggleSize, SliderSizes> = {\n md: { diameter: 14, offset: 2 },\n sm: { diameter: parseInt(Spacing[3], 10), offset: 2 }, // 12px diameter from tokens\n};\n\nconst Container = styled.div`\n display: inline-flex;\n align-items: center;\n position: relative;\n`;\n\ntype SwitchProps = Pick<ToggleProps, 'disabled'> & {\n checked: boolean;\n focused: boolean;\n size: ToggleSize;\n};\nconst Switch = styled.div<SwitchProps>`\n transition: box-shadow ${TransitionDuration.Fast};\n position: relative;\n display: inline-flex;\n height: ${({ size }) => SWITCH_SIZES[size].height}px;\n width: ${({ size }) => SWITCH_SIZES[size].width}px;\n border-radius: 1000px;\n cursor: pointer;\n &${isDisabled} {\n cursor: not-allowed;\n }\n\n ${focusOutlineControlled}\n\n /* Background */\n &:before {\n position: absolute;\n content: '';\n height: ${({ size }) => SWITCH_SIZES[size].height}px;\n width: ${({ size }) => SWITCH_SIZES[size].width}px;\n top: 0;\n right: 0;\n bottom: 0;\n background-color: ${({ theme, checked, disabled }) => {\n const tokens = semanticTokens(theme);\n if (tokens) {\n if (disabled) {\n return checked ? tokens.InputSurfaceAccentDisabled : tokens.InputSurfaceDisabled;\n }\n return checked ? tokens.InputSurfaceAccent : tokens.InputBorderStrong;\n }\n if (disabled) {\n return checked ? Color.BackgroundInputActiveDisabled : Color.BackgroundInputDisabled;\n }\n return checked ? Color.BackgroundInputActive : Color.BackgroundInputToggle;\n }};\n\n transition: ${TransitionDuration.Medium};\n border-radius: 1000px;\n }\n\n &${isHovered}${isNotDisabled}:before {\n background-color: ${({ theme, checked }) =>\n checked\n ? semanticColor(theme, 'InputSurfaceAccentHover', Color.BackgroundInputActiveHover)\n : semanticColor(theme, 'InputBorderHoverStrong', Color.BackgroundInputToggleHover)};\n }\n\n /* Slider thumb */\n &:after {\n position: absolute;\n content: '';\n height: ${({ size }) => SLIDER_SIZES[size].diameter}px;\n width: ${({ size }) => SLIDER_SIZES[size].diameter}px;\n bottom: ${({ size }) => SLIDER_SIZES[size].offset}px;\n background-color: ${({ theme }) => semanticColor(theme, 'InputSurfaceInverseStatic', Color.BackgroundInputDefault)};\n transition: ${TransitionDuration.Medium};\n border-radius: 1000px;\n\n right: ${({ size }) => SLIDER_SIZES[size].offset}px;\n\n ${({ checked, size }) =>\n !checked &&\n css`\n transform: translateX(-${getSlideDistance(size)}px);\n `}\n }\n`;\n\nconst ToggleLabel = styled(Label)<Pick<ToggleProps, 'disabled' | 'size'>>`\n cursor: ${({ disabled }) => (disabled ? 'initial' : 'pointer')};\n color: ${({ theme }) => semanticColor(theme, 'FgSecondary', Color.TextSecondary)};\n\n padding: 0 ${Spacing[2]};\n white-space: nowrap;\n line-height: ${({ size = 'md' }) => `${SWITCH_SIZES[size].height}px`};\n\n ${({ theme, disabled }) =>\n disabled &&\n css`\n color: ${semanticColor(theme, 'FgDisabled', theme.color.text.disabled)};\n `}\n`;\n\nfunction getSlideDistance(size: ToggleSize) {\n const switchSize = SWITCH_SIZES[size];\n const sliderSize = SLIDER_SIZES[size];\n return switchSize.width - sliderSize.diameter - sliderSize.offset * 2;\n}\n\nconst HiddenInput = styled.input`\n height: 0;\n width: 0;\n margin: -1px;\n border: 0;\n overflow: hidden;\n clip: rect(0, 0, 0, 0);\n position: absolute;\n`;\n\nexport interface ToggleProps {\n className?: string;\n /** Disables interaction and renders the toggle in a muted style. */\n disabled?: boolean;\n /**\n * Tooltip / title shown on the root element when the toggle is off.\n * @defaultValue 'Off'\n */\n titleOff?: string;\n /**\n * Tooltip / title shown on the root element when the toggle is on.\n * @defaultValue 'On'\n */\n titleOn?: string;\n /**\n * Called with the new boolean value when the user clicks the toggle.\n * The component is fully controlled — you must update `value` in response.\n */\n onChange?: (value: boolean) => void;\n /**\n * Current on/off state. Falsy values (`false`, `null`, `undefined`, `''`)\n * are treated as off; `true` is treated as on.\n */\n value: boolean | null | undefined | '';\n /** `id` forwarded to the visible switch element. */\n id?: string;\n /** Label node rendered to the left of the switch when the toggle is on. */\n labelOn?: ReactNode;\n /**\n * Label node rendered to the left of the switch when the toggle is off.\n * Falls back to `labelOn` when not provided.\n */\n labelOff?: ReactNode;\n 'data-test'?: string;\n /**\n * Accessible label for the hidden `<input role=\"switch\">`.\n * Required when no visible label is provided via `labelOn` / `labelOff`.\n */\n 'aria-label'?: string;\n /**\n * Size of the toggle switch.\n * @defaultValue 'md'\n */\n size?: ToggleSize;\n}\n\nexport const Toggle = forwardRef<HTMLDivElement, ToggleProps>(function Toggle(\n {\n className,\n disabled,\n titleOff = 'Off',\n titleOn = 'On',\n onChange = () => undefined,\n value,\n id,\n labelOn,\n labelOff,\n 'data-test': dataTest,\n 'aria-label': ariaLabel,\n size = 'md',\n },\n ref,\n) {\n const field = useFormField({ disabled });\n const generatedId = useId();\n const label = value ? labelOn : labelOff || labelOn;\n\n const [focused, { enable: setFocus, disable: clearFocus }] = useToggle();\n\n const handleChange = useCallback(() => {\n onChange(!value);\n inputRef.current?.focus();\n }, [onChange, value]);\n\n const inputRef = useRef<HTMLInputElement>();\n\n return (\n <Container\n className={className}\n data-test={dataTest}\n title={value ? titleOn : titleOff}\n ref={ref}\n >\n {label != null && (\n <ToggleLabel htmlFor={generatedId} disabled={field.disabled} size={size}>\n {label}\n </ToggleLabel>\n )}\n <Switch\n id={id}\n checked={!!value}\n disabled={field.disabled}\n focused={focused}\n onClick={field.disabled ? undefined : handleChange}\n size={size}\n />\n <HiddenInput\n id={generatedId}\n /* @ts-expect-error [strict-migration] The following line is not strict; please fix! */\n ref={inputRef}\n data-test-toggle-status={value ? 'on' : 'off'}\n disabled={field.disabled}\n type='checkbox'\n checked={!!value}\n readOnly={true}\n onChange={disabled ? undefined : handleChange}\n onFocus={setFocus}\n onBlur={clearFocus}\n aria-checked={!!value}\n role='switch'\n aria-readonly={field.disabled}\n {...(label\n ? { 'aria-labelledby': generatedId }\n : { 'aria-label': ariaLabel ?? (value ? 'Toggle on' : 'Toggle off') })}\n />\n </Container>\n );\n});\n\nexport default Toggle;\n"],"mappings":";;;;;;;;;;;;;AAoBA,MAAM,eAAgD;CACpD,IAAI;EAAE,OAAO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L,2BAAyB,QAAQ,OAAO;IACxC,UAAU,MAAM;IAChB,MAAK;IACL,SAAS,CAAC,CAAC;IACX,UAAU;IACV,UAAU,WAAW,KAAA,IAAY;IACjC,SAAS;IACT,QAAQ;IACR,gBAAc,CAAC,CAAC;IAChB,MAAK;IACL,iBAAe,MAAM;IACrB,GAAK,QACD,EAAE,mBAAmB,aAAa,GAClC,EAAE,cAAc,cAAc,QAAQ,cAAc,eAAe;IACvE,CAAA;GACQ;;EAEd"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":[],"sources":["../../../components/Grid/Grid.tsx","../../../components/Grid/GridItem.tsx"],"sourcesContent":["import {\n type ComponentPropsWithoutRef,\n type ReactNode,\n type RefObject,\n useLayoutEffect,\n useRef,\n useState,\n} from 'react';\nimport styled, { css } from 'styled-components';\n\nimport { Spacing } from '@persona/design-tokens';\n\nexport const GRID_BREAKPOINTS = { sm: 768, md: 1024, lg: 1408 } as const;\n\ntype Breakpoint = 'xs' | 'sm' | 'md' | 'lg';\n\nconst getBreakpoint = (width: number): Breakpoint => {\n if (width >= GRID_BREAKPOINTS.lg) {\n return 'lg';\n }\n if (width >= GRID_BREAKPOINTS.md) {\n return 'md';\n }\n if (width >= GRID_BREAKPOINTS.sm) {\n return 'sm';\n }\n return 'xs';\n};\n\nconst useGridBreakpoint = (ref: RefObject<HTMLDivElement>) => {\n const [breakpoint, setBreakpoint] = useState<Breakpoint>('md');\n useLayoutEffect(() => {\n const node = ref.current;\n if (!node) {\n return;\n }\n const update = () => setBreakpoint(getBreakpoint(node.offsetWidth));\n update();\n const observer = new ResizeObserver(update);\n observer.observe(node);\n return () => observer.disconnect();\n }, [ref]);\n return breakpoint;\n};\n\nconst Root = styled.div<{ $mode: GridProps['mode']; $breakpoint: Breakpoint }>`\n display: grid;\n width: 100%;\n grid-template-columns: repeat(12, minmax(0, 1fr));\n box-sizing: border-box;\n\n ${({ $breakpoint }) =>\n $breakpoint === 'xs' &&\n css`\n min-width: ${GRID_BREAKPOINTS.sm - 1}px;\n `}\n\n ${({ $breakpoint }) =>\n $breakpoint === 'xs' || $breakpoint === 'sm'\n ? css`\n gap: ${Spacing[3]};\n padding-inline: ${Spacing[5]};\n `\n : css`\n gap: ${Spacing[4]};\n padding-inline: ${Spacing[6]};\n `}\n\n // max-width equals the lg threshold; offsetWidth reads the clamped border-box width and getBreakpoint uses >=, so the clamp stays 'lg'\n ${({ $mode, $breakpoint }) =>\n $mode === 'fixed' &&\n $breakpoint === 'lg' &&\n css`\n max-width: ${GRID_BREAKPOINTS.lg}px;\n margin-inline: auto;\n `}\n`;\n\nexport interface GridProps extends ComponentPropsWithoutRef<'div'> {\n /**\n * Selects the grid width behavior at the large breakpoint. `fixed` centers the grid at a\n * maximum width of 1408px, while `fluid` fills the available width.\n *\n * Breakpoints:\n * - ≤767px: 12 columns, 24px margins, 12px gutters, and a 767px minimum width.\n * - 768–1023px: 12 columns, 24px margins, 12px gutters, and 100% width.\n * - 1024–1407px: 12 columns, 32px margins, 16px gutters, and 100% width.\n * - ≥1408px: 12 columns, 32px margins, 16px gutters, and either fixed or fluid width.\n */\n mode: 'fixed' | 'fluid';\n children: ReactNode;\n}\n\n/**\n * Provides a 12-column CSS grid that measures its own width with a ResizeObserver for responsive\n * horizontal margins and gutters. Vertical spacing is left to the consumer.\n *\n * The grid measures breakpoints against its own width rather than the viewport. Use `fixed` to\n * center the grid at its large-screen maximum width, or `fluid` to keep it at 100% width.\n */\nexport const Grid = ({ mode, children, ...rest }: GridProps) => {\n const ref = useRef<HTMLDivElement>(null);\n const breakpoint = useGridBreakpoint(ref);\n return (\n <Root ref={ref} $mode={mode} $breakpoint={breakpoint} {...rest}>\n {children}\n </Root>\n );\n};\n\nexport default Grid;\n","import type { ComponentPropsWithoutRef, ReactNode } from 'react';\nimport styled from 'styled-components';\n\nexport type GridSpan = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12;\n\nexport interface GridItemProps extends ComponentPropsWithoutRef<'div'> {\n span: GridSpan;\n children: ReactNode;\n}\n\nconst Item = styled.div<{ $span: GridSpan }>`\n grid-column: span ${({ $span }) => $span};\n min-width: 0;\n`;\n\nexport const GridItem = ({ span, children, ...rest }: GridItemProps) => (\n <Item $span={span} {...rest}>\n {children}\n </Item>\n);\n\nexport default GridItem;\n"],"mappings":";;;;;AAYA,MAAa,mBAAmB;CAAE,IAAI;CAAK,IAAI;CAAM,IAAI;CAAM;AAI/D,MAAM,iBAAiB,UAA8B;AACnD,KAAI,SAAS,iBAAiB,GAC5B,QAAO;AAET,KAAI,SAAS,iBAAiB,GAC5B,QAAO;AAET,KAAI,SAAS,iBAAiB,GAC5B,QAAO;AAET,QAAO;;AAGT,MAAM,qBAAqB,QAAmC;CAC5D,MAAM,CAAC,YAAY,iBAAiB,SAAqB,KAAK;AAC9D,uBAAsB;EACpB,MAAM,OAAO,IAAI;AACjB,MAAI,CAAC,KACH;EAEF,MAAM,eAAe,cAAc,cAAc,KAAK,YAAY,CAAC;AACnE,UAAQ;EACR,MAAM,WAAW,IAAI,eAAe,OAAO;AAC3C,WAAS,QAAQ,KAAK;AACtB,eAAa,SAAS,YAAY;IACjC,CAAC,IAAI,CAAC;AACT,QAAO;;AAGT,MAAM,OAAO,OAAO,GAA0D;;;;;;KAMzE,EAAE,kBACH,gBAAgB,QAChB,GAAG;mBACY,iBAAiB,KAAK,EAAE;MACrC;;KAED,EAAE,kBACH,gBAAgB,QAAQ,gBAAgB,OACpC,GAAG;iBACM,QAAQ,GAAG;4BACA,QAAQ,GAAG;YAE/B,GAAG;iBACM,QAAQ,GAAG;4BACA,QAAQ,GAAG;UAC7B;;;KAGL,EAAE,OAAO,kBACV,UAAU,WACV,gBAAgB,QAChB,GAAG;mBACY,iBAAiB,GAAG;;MAEjC;;;;;;;;;AAyBN,MAAa,QAAQ,EAAE,MAAM,UAAU,GAAG,WAAsB;CAC9D,MAAM,MAAM,OAAuB,KAAK;AAExC,QACE,oBAAC,MAAD;EAAW;EAAK,OAAO;EAAM,aAFZ,kBAAkB,IAEiB;EAAE,GAAI;EACvD;EACI,CAAA;;;;AChGX,MAAM,OAAO,OAAO,GAAwB;uBACrB,EAAE,YAAY,MAAM;;;AAI3C,MAAa,YAAY,EAAE,MAAM,UAAU,GAAG,WAC5C,oBAAC,MAAD;CAAM,OAAO;CAAM,GAAI;CACpB;CACI,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":[],"sources":["../../../components/Link/Link.tsx"],"sourcesContent":["import type { AnchorHTMLAttributes, ReactNode } from 'react';\nimport styled, { css } from 'styled-components';\n\nimport { Color, Spacing } from '@persona/design-tokens';\nimport { LinkExternalIcon } from '@persona/icons';\nimport { RouterLink, type RouterLinkComponentProps } from 'design-system/lib/router';\nimport { semanticColor } from 'design-system/lib/semanticColor';\nimport { focusOutline } from 'design-system/mixins/focus';\nimport { paragraphMixins } from 'design-system/mixins/text';\nimport { TransitionDuration } from 'design-system/variables/transitions';\n\ntype Target = '_blank' | '_self' | '_parent' | '_top';\n\ninterface BaseLinkProps {\n /**\n * The content to display inside the link.\n *\n */\n children?: ReactNode;\n /**\n * Provides an accessible name for the link when the visible text alone\n * isn't descriptive enough for screen reader users\n */\n 'aria-label'?: string;\n}\n\ninterface ExternalLinkProps extends BaseLinkProps, AnchorHTMLAttributes<HTMLAnchorElement> {\n /**\n * The URL to navigate to. Can be internal (e.g., \"/settings\") or external (e.g., \"https://example.com\").\n */\n url: string;\n\n /**\n * Where to open the link. Use \"_blank\" for external links to open in a new tab.\n */\n target?: Target;\n}\n\ninterface InternalLinkProps extends BaseLinkProps, Omit<RouterLinkComponentProps, 'to' | 'children'> {\n /**\n * The URL to navigate to. Should be an internal route (e.g., \"/settings\").\n */\n url: string;\n}\n\nexport type LinkProps = ExternalLinkProps | InternalLinkProps;\n\nconst IconContainer = styled.span`\n display: inline-block;\n vertical-align: middle;\n /* Uses padding here since we can't define flex on the element for multiline support */\n padding-left: 2px;\n /* Needed to reset the height of the container for SVG */\n line-height: 0;\n position: relative;\n /* Optical alignment adjustments */\n bottom: 1px;\n`;\n\nconst baseLinkStyles = css`\n ${paragraphMixins.md};\n color: ${({ theme }) => semanticColor(theme, 'FgAccent', Color.CorePurple600)};\n width: fit-content;\n position: relative;\n overflow: hidden;\n text-decoration: underline;\n\n transition:\n color ${TransitionDuration.ExtraFast} ease-out,\n text-underline-offset ${TransitionDuration.ExtraFast} ease-out;\n text-underline-offset: 2px;\n\n &:hover {\n color: ${({ theme }) => semanticColor(theme, 'FgAccentHover', Color.CorePurple800)};\n text-underline-offset: ${Spacing[1]};\n }\n\n border-radius: ${({ theme }) => theme.button.borderRadius};\n ${focusOutline}\n\n &:active {\n color: ${({ theme }) => semanticColor(theme, 'FgAccentActive', Color.CorePurple900)};\n }\n`;\n\nconst StyledAnchor = styled.a`\n ${baseLinkStyles}\n`;\n\nconst StyledRouterLink = styled(RouterLink)`\n ${baseLinkStyles}\n`;\n\nexport const Link = ({ children, url, ...props }: LinkProps) => {\n // Check if the URL is external by looking at the protocol or if target is _blank\n const isAbsoluteUrl = /^https?:\\/\\//.test(url);\n const hasBlankTarget = props.target === '_blank';\n const isExternal = isAbsoluteUrl || hasBlankTarget;\n\n if (isExternal) {\n const { 'aria-label': ariaLabel, ...anchorProps } = props;\n const externalProps = {\n href: url,\n target: '_blank',\n rel: 'noopener noreferrer',\n 'aria-label': ariaLabel,\n // Automatically inform screen readers that link opens in new window\n title: ariaLabel ? undefined : 'Opens in new window',\n ...anchorProps,\n };\n\n return (\n <StyledAnchor {...externalProps}>\n {children}\n <IconContainer>\n <LinkExternalIcon size={12} />\n </IconContainer>\n </StyledAnchor>\n );\n }\n\n const { 'aria-label': ariaLabel, ...routerProps } = props;\n const internalProps = {\n to: url,\n 'aria-label': ariaLabel,\n\n ...routerProps,\n };\n\n return <StyledRouterLink {...internalProps}>{children}</StyledRouterLink>;\n};\n\nexport default Link;\n"],"mappings":";;;;;;;;;;AA+CA,MAAM,gBAAgB,OAAO,IAAI;;;;;;;;;;;AAYjC,MAAM,iBAAiB,GAAG;IACtB,gBAAgB,GAAG;YACX,EAAE,YAAY,cAAc,OAAO,YAAY,MAAM,cAAc,CAAC;;;;;;;oBAOvC;oCACgB;;;;cAI3C,EAAE,YAAY,cAAc,OAAO,iBAAiB,MAAM,cAAc,CAAC;6BAC1D,QAAQ,GAAG;;;oBAGpB,EAAE,YAAY,MAAM,OAAO,aAAa;IACxD,aAAa;;;cAGH,EAAE,YAAY,cAAc,OAAO,kBAAkB,MAAM,cAAc,CAAC;;;AAIxF,MAAM,eAAe,OAAO,CAAC;IACzB,eAAe;;AAGnB,MAAM,mBAAmB,OAAO,WAAW;IACvC,eAAe;;AAGnB,MAAa,QAAQ,EAAE,UAAU,KAAK,GAAG,YAAuB;CAE9D,MAAM,gBAAgB,eAAe,KAAK,IAAI;CAC9C,MAAM,iBAAiB,MAAM,WAAW;AAGxC,KAFmB,iBAAiB,gBAEpB;EACd,MAAM,EAAE,cAAc,WAAW,GAAG,gBAAgB;AAWpD,SACE,qBAAC,cAAD;GAVA,MAAM;GACN,QAAQ;GACR,KAAK;GACL,cAAc;GAEd,OAAO,YAAY,KAAA,IAAY;GAC/B,GAAG;aAIH,CACG,UACD,oBAAC,eAAD,EAAA,UACE,oBAAC,kBAAD,EAAkB,MAAM,IAAM,CAAA,EAChB,CAAA,CACH;;;CAInB,MAAM,EAAE,cAAc,WAAW,GAAG,gBAAgB;AAQpD,QAAO,oBAAC,kBAAD;EANL,IAAI;EACJ,cAAc;EAEd,GAAG;EAGwC;EAA4B,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":["AriaModal","Button","AriaButton","Heading","AriaHeading","Card","Modal"],"sources":["../../../components/Modal/Modal.tsx"],"sourcesContent":["import {\n forwardRef,\n type ComponentProps,\n type ComponentPropsWithoutRef,\n type ReactNode,\n useContext,\n useEffect,\n useState,\n} from 'react';\nimport {\n Button as AriaButton,\n Dialog,\n DialogTrigger,\n Heading as AriaHeading,\n Modal as AriaModal,\n ModalOverlay,\n type ModalOverlayProps,\n OverlayTriggerStateContext,\n Pressable,\n} from 'react-aria-components';\nimport styled from 'styled-components';\n\nimport Button, { type ButtonProps } from '@persona/design-system/components/Button';\nimport Card from '@persona/design-system/components/Card';\nimport Stack, { HStack } from '@persona/design-system/components/Stack';\nimport TabBar, { Tab } from '@persona/design-system/components/TabBar';\nimport { Heading } from '@persona/design-system/components/Text';\nimport { Color, Spacing } from '@persona/design-tokens';\nimport { XIcon } from '@persona/icons';\nimport { semanticColor, semanticOnly } from 'design-system/lib/semanticColor';\nimport useEmbeddedSurface, {\n useEmbeddedSurfaceGate,\n useEmbeddedSurfaceId,\n} from 'design-system/lib/useEmbeddedSurface';\nimport useModalInsetRight, {\n SIDEBAR_CLOSE_TRANSITION_MS,\n SIDEBAR_OPEN_TRANSITION_MS,\n} from 'design-system/lib/useModalInsetRight';\n\nconst StyledModalOverlay = styled(ModalOverlay)<{\n $hostPending: boolean;\n $animationDelayMs: number;\n $insetRight: string;\n $transitionMs: number;\n}>`\n @keyframes overlayShow {\n from {\n opacity: 0;\n }\n to {\n opacity: 1;\n }\n }\n background-color: rgba(0, 0, 0, 0.5);\n position: fixed;\n top: 0;\n bottom: 0;\n left: 0;\n right: ${({ $insetRight }) => $insetRight};\n transition: right ${({ $transitionMs }) => $transitionMs}ms ease-out;\n animation: overlayShow 150ms cubic-bezier(0.16, 1, 0.3, 1);\n animation-delay: ${({ $animationDelayMs }) => $animationDelayMs}ms;\n animation-fill-mode: both;\n ${({ $hostPending }) =>\n $hostPending &&\n `\n animation-play-state: paused;\n `}\n @media (prefers-reduced-motion: reduce) {\n animation-duration: 0ms;\n animation-delay: 0ms;\n animation-play-state: running;\n }\n z-index: 10000;\n display: flex;\n align-items: center;\n justify-content: center;\n`;\n\nconst StyledModal = styled(AriaModal)`\n z-index: 10001;\n outline: none;\n width: fit-content;\n max-width: 100%;\n ${semanticOnly((tokens) => `color: ${tokens.FgPrimary};`)}\n`;\n\n/**\n * React Aria keeps the overlay mounted through the exit animation, so announcing the surface from\n * here — rather than from the persistent gate below — releases the host's backdrop exactly when the\n * modal stops being painted.\n */\nconst EmbeddedSurfaceModal = forwardRef<HTMLDivElement, { children: ReactNode; surfaceId: string }>(\n function EmbeddedSurfaceModal({ children, surfaceId }, ref) {\n useEmbeddedSurface(surfaceId);\n return <StyledModal ref={ref}>{children}</StyledModal>;\n },\n);\n\ntype EmbeddedSurfaceOverlayProps = ModalOverlayProps & {\n $insetRight: string;\n $transitionMs: number;\n surfaceId: string;\n};\n\nconst EmbeddedSurfaceOverlay = ({ surfaceId, ...props }: EmbeddedSurfaceOverlayProps) => {\n const state = useContext(OverlayTriggerStateContext);\n const isOpen = state?.isOpen ?? false;\n const { ready, animationDelayMs } = useEmbeddedSurfaceGate(surfaceId, isOpen);\n\n const { $insetRight, $transitionMs, ...overlayProps } = props;\n return (\n <StyledModalOverlay\n {...overlayProps}\n $insetRight={$insetRight}\n $transitionMs={$transitionMs}\n $animationDelayMs={animationDelayMs}\n $hostPending={isOpen && !ready}\n />\n );\n};\n\nconst ModalCloseButton = styled(Button)`\n display: inline-flex;\n padding: ${Spacing[2]};\n border-radius: ${Spacing[1]};\n width: fit-content;\n min-width: unset;\n`;\n\nconst ModalFooter = styled(HStack).attrs({\n justify: 'flex-end',\n align: 'center',\n spacing: Spacing[2],\n})`\n padding: ${Spacing[3]} ${Spacing[4]};\n border-top: 1px solid ${({ theme }) => semanticColor(theme, 'BorderSubtle', Color.BorderDivider)};\n`;\n\nconst ModalHeaderTitle = styled.div`\n flex: 1;\n`;\n\nexport const ModalTrigger = DialogTrigger;\nexport const ModalContent = StyledModal;\n\nexport const ModalClose = (props: ButtonProps) => {\n return (\n <AriaButton slot='close' style={{ all: 'unset', display: 'contents' }}>\n <ModalCloseButton variant='text' width='icon' size='md' {...props}>\n <XIcon />\n </ModalCloseButton>\n </AriaButton>\n );\n};\n\nexport interface ModalTitleProps {\n children: ReactNode;\n className?: string;\n}\n\n/** Props passed to modal content render functions. */\nexport interface ModalRenderProps {\n /** Element that floating content should use as its portal container. */\n portalContainer: HTMLDivElement | null;\n}\n\ntype ModalRenderable = ReactNode | ((props: ModalRenderProps) => ReactNode);\n\nconst ModalTitle = ({ children, ...props }: ModalTitleProps) => {\n return (\n <Heading size='sm' color='primary' as={AriaHeading} slot='title' {...props}>\n {children}\n </Heading>\n );\n};\n\nconst ModalHeader = styled(HStack)<{ $hasTabs: boolean }>`\n border-bottom: ${({ $hasTabs, theme }) =>\n $hasTabs ? 'none' : `1px solid ${semanticColor(theme, 'BorderSubtle', Color.BorderDivider)}`};\n padding: ${({ $hasTabs }) =>\n $hasTabs\n ? `${Spacing[3]} ${Spacing[2]} ${Spacing[1]} ${Spacing[4]}`\n : `${Spacing[3]} ${Spacing[2]} ${Spacing[3]} ${Spacing[4]}`};\n`;\n\nconst ModalTabBar = styled(TabBar)`\n padding-left: ${Spacing[4]};\n`;\n\nconst StyledDialog = styled(Dialog)`\n outline: none;\n`;\n\nconst StyledCard = styled(Card)<{ $size?: 'auto' | 'md' | 'lg' | 'xl' | 'full' }>`\n position: relative;\n width: ${({ $size }) => {\n switch ($size) {\n case 'auto':\n return 'auto';\n case 'full':\n return 'calc(100vw - 160px)';\n default:\n return '90vw';\n }\n }};\n max-width: ${({ theme, $size }) => {\n switch ($size) {\n case 'auto':\n return 'auto';\n case 'full':\n return 'calc(100vw - 160px)';\n default:\n return theme.modal.width[$size];\n }\n }};\n /* TODO: Use breakpoints to make this responsive */\n max-height: ${({ $size }) => ($size === 'full' ? 'calc(100vh - 160px)' : '85vh')};\n display: flex;\n flex-direction: column;\n overflow: hidden;\n ${({ $size }) =>\n $size === 'full' &&\n `\n height: calc(100vh - 160px);\n `}\n margin-bottom: 0;\n`;\n\ninterface ModalCardProps extends ComponentPropsWithoutRef<typeof Dialog> {\n /**\n * Display X button to close popover\n */\n showCloseButton?: boolean;\n\n /**\n * Max width of the modal\n */\n size?: 'auto' | 'md' | 'lg' | 'xl' | 'full';\n\n /**\n * Footer content\n */\n footer?: ReactNode;\n\n /**\n * Renders tabs within the modal.\n * Adds a tab bar and will render the contents of the selected tab in a tabpanel.\n * Overrides `children`.\n * Tab contents can be render functions that receive the modal portal container.\n */\n tabs?: TabView[];\n\n /**\n * Title of the modal\n */\n title?: ReactNode;\n\n /**\n * Children content\n */\n children?: ReactNode;\n\n /**\n * When true, removes horizontal and vertical padding from the body. Defaults to false.\n */\n noBodyPadding?: boolean;\n\n /**\n * Additional props for the Dialog element\n */\n className?: string;\n}\n\ninterface ModalCardInternalProps extends ModalCardProps {\n portalContainer: HTMLDivElement | null;\n}\n\nconst StyledModalCardBody = styled(Card.Body)<{\n $noPadding?: boolean;\n $hidden?: boolean;\n}>`\n overflow-y: auto;\n flex: 1;\n min-height: 0;\n ${({ $noPadding }) =>\n $noPadding\n ? 'padding: 0;'\n : `\n padding-left: ${Spacing[4]};\n padding-right: ${Spacing[4]};\n `}\n ${({ $hidden }) => $hidden && 'display: none;'}\n`;\n\n/**\n * Card to be used in Modal contexts. Inherits props from react-aria-components Dialog.\n */\nconst ModalCard = forwardRef<HTMLDivElement, ModalCardInternalProps>(function ModalCard(\n {\n title,\n children,\n showCloseButton = true,\n size,\n footer,\n tabs,\n noBodyPadding = false,\n portalContainer,\n ...props\n },\n ref,\n) {\n const [selectedTabIdx, setSelectedTabIdx] = useState(0);\n const tabCount = tabs?.length ?? 0;\n\n useEffect(() => {\n setSelectedTabIdx(0);\n }, [tabCount]);\n\n const titleAndClose = (\n <ModalHeader justify='flex-start' align='center' spacing={Spacing[2]} $hasTabs={Boolean(tabs)}>\n <ModalHeaderTitle>{title ? <ModalTitle>{title}</ModalTitle> : null}</ModalHeaderTitle>\n {showCloseButton && <ModalClose aria-label='Close' />}\n </ModalHeader>\n );\n\n const modalHeader = tabs ? (\n <Stack>\n {titleAndClose}\n <ModalTabBar>\n {tabs.map((tab, idx) => (\n <Tab\n key={tab.name}\n selected={selectedTabIdx === idx}\n id={`pds-modal_tab-${idx}`}\n onClick={() => setSelectedTabIdx(idx)}\n aria-controls={`pds-modal_tab-panel-${idx}`}\n >\n {tab.name}\n </Tab>\n ))}\n </ModalTabBar>\n </Stack>\n ) : (\n titleAndClose\n );\n\n return (\n <StyledDialog {...props} ref={ref}>\n <StyledCard elevated $size={size}>\n {(showCloseButton || title) && modalHeader}\n {tabs ? (\n tabs.map((tab, idx) => (\n <StyledModalCardBody\n key={tab.name}\n $noPadding={noBodyPadding}\n $hidden={selectedTabIdx !== idx}\n role={tabs ? 'tabpanel' : undefined}\n id={`pds-modal_tab-panel-${tab.name}`}\n aria-labelledby={`pds-modal_tab-${tab.name}`}\n >\n {typeof tab.contents === 'function'\n ? tab.contents({ portalContainer })\n : tab.contents}\n </StyledModalCardBody>\n ))\n ) : (\n <StyledModalCardBody\n $noPadding={noBodyPadding}\n role={tabs ? 'tabpanel' : undefined}\n id={`pds-modal_tab-panel-${selectedTabIdx}`}\n aria-labelledby={`pds-modal_tab-${selectedTabIdx}`}\n >\n {children}\n </StyledModalCardBody>\n )}\n\n {footer && <ModalFooter>{footer}</ModalFooter>}\n </StyledCard>\n </StyledDialog>\n );\n});\n\ninterface TabView {\n name: string;\n contents: ModalRenderable;\n badge?: React.ReactElement;\n disabled?: boolean;\n 'data-tour-target'?: string;\n}\n\nexport interface ModalProps {\n /**\n * Title of the Card\n */\n title?: string;\n\n /**\n * Component to use as trigger. React Aria trigger props will be merged with this element.\n */\n trigger?: ComponentProps<typeof Pressable>['children'];\n\n /**\n * Props to apply to Modal.Card within\n */\n contentProps?: ModalCardProps;\n\n /**\n * Max width of the modal\n */\n size?: 'auto' | 'md' | 'lg' | 'xl' | 'full';\n\n /**\n * Footer section intended for actions.\n * You can pass in Buttons directly and they will render in a HStack.\n */\n footer?: ReactNode;\n\n /**\n * Renders tabs within the modal.\n * Adds a tab bar and will render the contents of the selected tab in a tabpanel.\n * Overrides `children`.\n */\n tabs?: TabView[];\n\n /**\n * Children content\n */\n children?: ModalRenderable;\n\n /**\n * When true, removes horizontal and vertical padding from the body. Defaults to false.\n * Can also be set via contentProps.noBodyPadding.\n */\n noBodyPadding?: boolean;\n\n /**\n * Controls whether the modal is open (controlled)\n */\n open?: boolean;\n\n /**\n * Default open state (uncontrolled)\n */\n defaultOpen?: boolean;\n\n /**\n * Handler called when open state changes\n */\n onOpenChange?: (isOpen: boolean) => void;\n\n /**\n * Whether the modal can be dismissed by clicking outside or pressing escape\n */\n isDismissable?: boolean;\n\n /**\n * Whether pressing the escape key closes the modal\n */\n isKeyboardDismissDisabled?: boolean;\n}\n\nconst Modal = ({\n children,\n trigger,\n contentProps,\n noBodyPadding = false,\n size = 'md',\n title,\n footer,\n tabs,\n defaultOpen,\n onOpenChange,\n isDismissable = false,\n isKeyboardDismissDisabled = false,\n open,\n}: ModalProps) => {\n const [portalContainer, setPortalContainer] = useState<HTMLDivElement | null>(null);\n const surfaceId = useEmbeddedSurfaceId();\n const { insetRight: modalInsetRight, panelState } = useModalInsetRight();\n const transitionMs =\n panelState === 'opening'\n ? SIDEBAR_OPEN_TRANSITION_MS\n : panelState === 'closing'\n ? SIDEBAR_CLOSE_TRANSITION_MS\n : 0;\n\n const content = (\n <ModalCard\n size={size}\n title={title}\n footer={footer}\n tabs={tabs}\n noBodyPadding={noBodyPadding}\n {...contentProps}\n portalContainer={portalContainer}\n >\n {typeof children === 'function' ? children({ portalContainer }) : children}\n </ModalCard>\n );\n\n // Wrap trigger element to ensure it works with react-aria-components\n const wrappedTrigger = trigger ? <Pressable>{trigger}</Pressable> : null;\n\n return (\n <DialogTrigger isOpen={open} defaultOpen={defaultOpen} onOpenChange={onOpenChange}>\n {wrappedTrigger}\n <EmbeddedSurfaceOverlay\n surfaceId={surfaceId}\n $insetRight={modalInsetRight}\n $transitionMs={transitionMs}\n isDismissable={isDismissable}\n isKeyboardDismissDisabled={isKeyboardDismissDisabled}\n shouldCloseOnInteractOutside={(element) => !element.closest('[data-react-aria-top-layer]')}\n >\n <EmbeddedSurfaceModal ref={setPortalContainer} surfaceId={surfaceId}>\n {content}\n </EmbeddedSurfaceModal>\n </EmbeddedSurfaceOverlay>\n </DialogTrigger>\n );\n};\n\nexport default Object.assign(Modal, {\n Title: ModalTitle,\n});\n"],"mappings":";;;;;;;;;;;;;;;AAuCA,MAAM,qBAAqB,OAAO,aAAa;;;;;;;;;;;;;;YAmBnC,EAAE,kBAAkB,YAAY;uBACrB,EAAE,oBAAoB,cAAc;;sBAErC,EAAE,wBAAwB,kBAAkB;;KAE7D,EAAE,mBACH,gBACA;;IAEA;;;;;;;;;;;AAYJ,MAAM,cAAc,OAAOA,MAAU;;;;;IAKjC,cAAc,WAAW,UAAU,OAAO,UAAU,GAAG,CAAC;;;;;;;AAQ5D,MAAM,uBAAuB,WAC3B,SAAS,qBAAqB,EAAE,UAAU,aAAa,KAAK;AAC1D,oBAAmB,UAAU;AAC7B,QAAO,oBAAC,aAAD;EAAkB;EAAM;EAAuB,CAAA;EAEzD;AAQD,MAAM,0BAA0B,EAAE,WAAW,GAAG,YAAyC;CAEvF,MAAM,SADQ,WAAW,2BACL,EAAE,UAAU;CAChC,MAAM,EAAE,OAAO,qBAAqB,uBAAuB,WAAW,OAAO;CAE7E,MAAM,EAAE,aAAa,eAAe,GAAG,iBAAiB;AACxD,QACE,oBAAC,oBAAD;EACE,GAAI;EACS;EACE;EACf,mBAAmB;EACnB,cAAc,UAAU,CAAC;EACzB,CAAA;;AAIN,MAAM,mBAAmB,OAAOC,SAAO;;aAE1B,QAAQ,GAAG;mBACL,QAAQ,GAAG;;;;AAK9B,MAAM,cAAc,OAAO,OAAO,CAAC,MAAM;CACvC,SAAS;CACT,OAAO;CACP,SAAS,QAAQ;CAClB,CAAC;aACW,QAAQ,GAAG,GAAG,QAAQ,GAAG;2BACX,EAAE,YAAY,cAAc,OAAO,gBAAgB,MAAM,cAAc,CAAC;;AAGnG,MAAM,mBAAmB,OAAO,GAAG;;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AVf,IAAI,KAUW,CACtB,GAEF,oBAAC,qBAAD;KACE,YAAY;KACZ,MAAM,OAAO,aAAa,KAAA;KAC1B,IAAI,uBAAuB;KAC3B,mBAAiB,iBAAiB;KAEjC;KACmB,CAAA;IAGvB,UAAU,oBAAC,aAAD,EAAA,UAAc,QAAqB,CAAA;IACnC;;EACA,CAAA;EAEjB;AAiFF,MAAMC,WAAS,EACb,UACA,SACA,cACA,gBAAgB,OAChB,OAAO,MACP,OACA,QACA,MACA,aACA,cACA,gBAAgB,OAChB,4BAA4B,OAC5B,WACgB;CAChB,MAAM,CAAC,iBAAiB,sBAAsB,SAAgC,KAAK;CACnF,MAAM,YAAY,sBAAsB;CACxC,MAAM,EAAE,YAAY,iBAAiB,eAAe,oBAAoB;CACxE,MAAM,eACJ,eAAe,YAAA,MAEX,eAAe,YAAA,MAEb;CAER,MAAM,UACJ,oBAAC,WAAD;EACQ;EACC;EACC;EACF;EACS;EACf,GAAI;EACa;YAEhB,OAAO,aAAa,aAAa,SAAS,EAAE,iBAAiB,CAAC,GAAG;EACxD,CAAA;AAMd,QACE,qBAAC,eAAD;EAAe,QAAQ;EAAmB;EAA2B;YAArE,CAHqB,UAAU,oBAAC,WAAD,EAAA,UAAY,SAAoB,CAAA,GAAG,MAKhE,oBAAC,wBAAD;GACa;GACX,aAAa;GACb,eAAe;GACA;GACY;GAC3B,+BAA+B,YAAY,CAAC,QAAQ,QAAQ,8BAA8B;aAE1F,oBAAC,sBAAD;IAAsB,KAAK;IAA+B;cACvD;IACoB,CAAA;GACA,CAAA,CACX;;;AAIpB,IAAA,gBAAe,OAAO,OAAOA,SAAO,EAClC,OAAO,YACR,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":[],"sources":["../../../components/ProgressIndicator/ProgressIndicator.tsx"],"sourcesContent":["import type { ComponentPropsWithoutRef } from 'react';\nimport styled, { css, useTheme } from 'styled-components';\n\nimport { focusOutline } from '@persona/design-system/mixins/focus';\nimport { paragraphMixins } from '@persona/design-system/mixins/text';\nimport { BorderRadius, Color, Spacing } from '@persona/design-tokens';\nimport {\n CircleCheckFillIcon,\n CircleFillIcon,\n CircleNullIcon,\n CircleWarningFillIcon,\n WarningFillIcon,\n} from '@persona/icons';\nimport type { PDSIconComponent } from '@persona/icons/types';\nimport { withAlpha } from 'design-system/lib/color';\nimport {\n type MaybeSemanticTheme,\n semanticColor,\n semanticTokens,\n} from 'design-system/lib/semanticColor';\n\nexport type StepStatus = 'uncompleted' | 'completed' | 'warning' | 'error';\n\nexport interface ProgressIndicatorStep {\n id: string;\n label: string;\n /** @default 'uncompleted' */\n status?: StepStatus;\n disabled?: boolean;\n}\n\nexport interface ProgressIndicatorProps extends ComponentPropsWithoutRef<'ol'> {\n steps: ProgressIndicatorStep[];\n /** id of the step that should receive the active visual state */\n activeStepId?: string;\n /** @default 'vertical' */\n layout?: 'vertical' | 'horizontal';\n /**\n * Called when a clickable step is activated via click or keyboard.\n *\n * Clickability rules:\n * - `completed`, `warning`, and `error` steps are clickable (navigate back to review/edit)\n * - The active step is not clickable (user is already there)\n * - Upcoming `uncompleted` steps are not clickable (sequential progression required)\n */\n onStepClick?: (stepId: string) => void;\n}\n\n// ─── Helpers ─────────────────────────────────────────────────────────────────\n\n/**\n * Completed, warning, and error steps can be navigated back to.\n * The current step (first uncompleted or error) is also clickable so the user can\n * return to it after navigating back to an earlier step.\n * Active and upcoming steps (beyond the current) are not clickable.\n */\nfunction resolveClickable(\n status: StepStatus,\n isActive: boolean,\n isDisabled: boolean,\n isCurrent: boolean,\n): boolean {\n if (isDisabled || isActive) {\n return false;\n }\n return status === 'completed' || status === 'warning' || status === 'error' || isCurrent;\n}\n\nfunction resolveIcon(status: StepStatus, isCurrent: boolean): PDSIconComponent {\n if (status === 'completed') {\n return CircleCheckFillIcon;\n }\n if (status === 'warning') {\n return WarningFillIcon;\n }\n if (status === 'error') {\n return CircleWarningFillIcon;\n }\n if (isCurrent) {\n return CircleFillIcon;\n }\n return CircleNullIcon;\n}\n\nfunction resolveIconColor(\n theme: MaybeSemanticTheme,\n status: StepStatus,\n isActive: boolean,\n isDisabled: boolean,\n) {\n if (isDisabled) {\n return semanticColor(theme, 'FgDisabled', Color.BorderIconDisabled);\n }\n if (status === 'completed') {\n return semanticColor(theme, 'FgSuccess', Color.BorderIconSuccess);\n }\n if (status === 'warning') {\n return semanticColor(theme, 'FgWarning1', Color.BorderIconWarning);\n }\n if (status === 'error') {\n return semanticColor(theme, 'FgDanger1', Color.BorderIconDanger);\n }\n return isActive\n ? semanticColor(theme, 'FgAccent', Color.BorderIconActive)\n : semanticColor(theme, 'FgSecondary', Color.BorderIconSecondary);\n}\n\nfunction resolveTextColor(\n theme: MaybeSemanticTheme,\n status: StepStatus,\n isActive: boolean,\n isDisabled: boolean,\n) {\n if (isDisabled) {\n return semanticColor(theme, 'FgDisabled', Color.TextDisabled);\n }\n if (isActive) {\n return semanticColor(theme, 'FgAccent', Color.TextActive);\n }\n if (status === 'uncompleted') {\n return semanticColor(theme, 'FgSecondary', Color.TextSecondary);\n }\n return semanticColor(theme, 'FgPrimary', Color.TextPrimary);\n}\n\n// ─── Styled components ────────────────────────────────────────────────────────\n\nconst StepList = styled.ol<{ $layout: 'vertical' | 'horizontal' }>`\n display: flex;\n flex-direction: ${({ $layout }) => ($layout === 'horizontal' ? 'row' : 'column')};\n gap: ${({ $layout }) => ($layout === 'horizontal' ? Spacing[2] : '0px')};\n list-style: none;\n margin: 0;\n padding: 0;\n`;\n\nconst StepItem = styled.li<{ $layout: 'vertical' | 'horizontal' }>`\n display: flex;\n align-items: center;\n\n ${({ $layout }) =>\n $layout === 'horizontal' &&\n css`\n width: fit-content;\n white-space: nowrap;\n `}\n`;\n\nconst StepContent = styled.button<{\n $isActive: boolean;\n $isClickable: boolean;\n $interactive: boolean;\n}>`\n display: flex;\n align-items: center;\n gap: ${Spacing[2]};\n width: 100%;\n padding: ${Spacing[2]};\n border-radius: ${BorderRadius.Md};\n border: none;\n margin: 0;\n font: inherit;\n color: inherit;\n text-align: left;\n outline: none;\n cursor: ${({ $isClickable, $interactive }) => ($interactive && $isClickable ? 'pointer' : 'default')};\n\n ${({ theme, $isActive, $isClickable, $interactive }) => {\n const tokens = semanticTokens(theme);\n if ($isActive) {\n return css`\n background-color: ${\n tokens\n ? withAlpha(tokens.SurfaceAccent, tokens.Opacity25)\n : Color.BackgroundInteractiveActive\n };\n `;\n }\n if ($interactive && $isClickable) {\n return css`\n background-color: ${tokens ? 'transparent' : Color.BackgroundInteractiveDefault};\n &:hover {\n background-color: ${semanticColor(theme, 'SurfaceSecondary', Color.BackgroundInteractiveHover)};\n }\n `;\n }\n return css`\n background-color: transparent;\n `;\n }}\n\n ${focusOutline}\n\n &:focus-visible {\n position: relative;\n z-index: 1;\n }\n`;\n\nconst IconWrapper = styled.span<{ $color: string }>`\n display: inline-flex;\n flex-shrink: 0;\n width: 16px;\n height: 16px;\n color: ${({ $color }) => $color};\n line-height: 0;\n`;\n\nconst StepLabel = styled.span<{ $isActive: boolean; $color: string }>`\n ${({ $isActive }) => ($isActive ? paragraphMixins.mdBold : paragraphMixins.md)};\n color: ${({ $color }) => $color};\n`;\n\n// ─── Step ─────────────────────────────────────────────────────────────────────\n\ninterface StepProps {\n step: ProgressIndicatorStep;\n isActive: boolean;\n isCurrent: boolean;\n layout: 'vertical' | 'horizontal';\n onStepClick?: (stepId: string) => void;\n}\n\nconst Step = ({ step, isActive, isCurrent, layout, onStepClick }: StepProps) => {\n const { id, label, status = 'uncompleted', disabled = false } = step;\n\n const interactive = Boolean(onStepClick);\n const isClickable = resolveClickable(status, isActive, disabled, isCurrent);\n const isInteractionDisabled = disabled || (!isActive && !isCurrent && status === 'uncompleted');\n const theme = useTheme();\n const iconColor = resolveIconColor(theme, status, isActive, disabled);\n const textColor = resolveTextColor(theme, status, isActive, disabled);\n\n const Icon = resolveIcon(status, isCurrent);\n\n return (\n <StepItem\n $layout={layout}\n aria-current={!interactive && isActive ? 'step' : undefined}\n aria-disabled={!interactive && isInteractionDisabled ? true : undefined}\n >\n <StepContent\n {...(interactive && isClickable\n ? { type: 'button' as const, onClick: () => onStepClick?.(id) }\n : { as: 'div' as const })}\n aria-current={interactive && isActive ? 'step' : undefined}\n aria-disabled={interactive && isInteractionDisabled ? true : undefined}\n $isActive={isActive}\n $isClickable={isClickable}\n $interactive={interactive}\n >\n <IconWrapper $color={iconColor} aria-hidden='true'>\n <Icon />\n </IconWrapper>\n <StepLabel $isActive={isActive} $color={textColor}>\n {label}\n </StepLabel>\n </StepContent>\n </StepItem>\n );\n};\n\n// ─── Component ────────────────────────────────────────────────────────────────\n\n/**\n * ProgressIndicator guides users through a sequence of steps.\n *\n * Interaction rules:\n * - **Completed / warning / error** steps are clickable — navigate back to review or fix.\n * - **Warning** does not block forward progression; later uncompleted steps remain reachable.\n * - **Error** blocks forward progression — treat it as the terminal step in the sequence.\n * - **Active** step is not clickable — the user is already there.\n * - **Upcoming (uncompleted)** steps are not clickable — sequential progression required.\n *\n * Navigation does not clear later steps. If a change on an earlier step\n * invalidates later data, the affected steps should be flagged and require\n * re-confirmation before submission — this logic lives in the consuming component.\n *\n * @example\n * ```tsx\n * <ProgressIndicator\n * steps={[\n * { id: 'identity', label: 'Identity', status: 'completed' },\n * { id: 'address', label: 'Address', status: 'uncompleted' },\n * { id: 'review', label: 'Review', status: 'uncompleted' },\n * ]}\n * activeStepId=\"address\"\n * onStepClick={(id) => navigate(id)}\n * />\n * ```\n */\nexport const ProgressIndicator = ({\n steps,\n activeStepId,\n layout = 'vertical',\n onStepClick,\n 'aria-label': ariaLabel = 'Progress',\n ...rest\n}: ProgressIndicatorProps) => {\n // The \"current\" step is the first uncompleted or error step — where the user should work next.\n // Warning steps are skipped so forward progression is not blocked.\n // This is independent of activeStepId, which only controls the visual highlight.\n const currentStepId = steps.find(\n ({ status = 'uncompleted' }) => status === 'uncompleted' || status === 'error',\n )?.id;\n\n return (\n <StepList $layout={layout} role='list' aria-label={ariaLabel} {...rest}>\n {steps.map((step) => (\n <Step\n key={step.id}\n step={step}\n isActive={step.id === activeStepId}\n isCurrent={step.id === currentStepId}\n layout={layout}\n onStepClick={onStepClick}\n />\n ))}\n </StepList>\n );\n};\n\nexport default ProgressIndicator;\n"],"mappings":";;;;;;;;;;;;;;;AAwDA,SAAS,iBACP,QACA,UACA,YACA,WACS;AACT,KAAI,cAAc,SAChB,QAAO;AAET,QAAO,WAAW,eAAe,WAAW,aAAa,WAAW,WAAW;;AAGjF,SAAS,YAAY,QAAoB,WAAsC;AAC7E,KAAI,WAAW,YACb,QAAO;AAET,KAAI,WAAW,UACb,QAAO;AAET,KAAI,WAAW,QACb,QAAO;AAET,KAAI,UACF,QAAO;AAET,QAAO;;AAGT,SAAS,iBACP,OACA,QACA,UACA,YACA;AACA,KAAI,WACF,QAAO,cAAc,OAAO,cAAc,MAAM,mBAAmB;AAErE,KAAI,WAAW,YACb,QAAO,cAAc,OAAO,aAAa,MAAM,kBAAkB;AAEnE,KAAI,WAAW,UACb,QAAO,cAAc,OAAO,cAAc,MAAM,kBAAkB;AAEpE,KAAI,WAAW,QACb,QAAO,cAAc,OAAO,aAAa,MAAM,iBAAiB;AAElE,QAAO,WACH,cAAc,OAAO,YAAY,MAAM,iBAAiB,GACxD,cAAc,OAAO,eAAe,MAAM,oBAAoB;;AAGpE,SAAS,iBACP,OACA,QACA,UACA,YACA;AACA,KAAI,WACF,QAAO,cAAc,OAAO,cAAc,MAAM,aAAa;AAE/D,KAAI,SACF,QAAO,cAAc,OAAO,YAAY,MAAM,WAAW;AAE3D,KAAI,WAAW,cACb,QAAO,cAAc,OAAO,eAAe,MAAM,cAAc;AAEjE,QAAO,cAAc,OAAO,aAAa,MAAM,YAAY;;AAK7D,MAAM,WAAW,OAAO,EAA0C;;qBAE7C,EAAE,cAAe,YAAY,eAAe,QAAQ,SAAU;UACzE,EAAE,cAAe,YAAY,eAAe,QAAQ,KAAK,MAAO;;;;;AAM1E,MAAM,WAAW,OAAO,EAA0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CAAC,eAAe,wBAAwB,OAAO,KAAA;YAE9D,qBAAC,aAAD;GACE,GAAK,eAAe,cAChB;IAAE,MAAM;IAAmB,eAAe,cAAc,GAAG;IAAE,GAC7D,EAAE,IAAI,OAAgB;GAC1B,gBAAc,eAAe,WAAW,SAAS,KAAA;GACjD,iBAAe,eAAe,wBAAwB,OAAO,KAAA;GAC7D,WAAW;GACX,cAAc;GACd,cAAc;aARhB,CAUE,oBAAC,aAAD;IAAa,QAAQ;IAAW,eAAY;cAC1C,oBAAC,MAAD,EAAQ,CAAA;IACI,CAAA,EACd,oBAAC,WAAD;IAAW,WAAW;IAAU,QAAQ;cACrC;IACS,CAAA,CACA;;EACL,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiCf,MAAa,qBAAqB,EAChC,OACA,cACA,SAAS,YACT,aACA,cAAc,YAAY,YAC1B,GAAG,WACyB;CAI5B,MAAM,gBAAgB,MAAM,MACzB,EAAE,SAAS,oBAAoB,WAAW,iBAAiB,WAAW,QACxE,EAAE;AAEH,QACE,oBAAC,UAAD;EAAU,SAAS;EAAQ,MAAK;EAAO,cAAY;EAAW,GAAI;YAC/D,MAAM,KAAK,SACV,oBAAC,MAAD;GAEQ;GACN,UAAU,KAAK,OAAO;GACtB,WAAW,KAAK,OAAO;GACf;GACK;GACb,EANK,KAAK,GAMV,CACF;EACO,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":[],"sources":["../../../components/StatusIndicator/StatusIndicator.tsx"],"sourcesContent":["import type { ComponentPropsWithoutRef, ReactNode } from 'react';\nimport styled, { css } from 'styled-components';\n\nimport { BorderRadius, Color, Spacing } from '@persona/design-tokens';\nimport {\n CircleCheckFillIcon,\n CircleFillIcon,\n CircleHalfIcon,\n CircleNullIcon,\n CircleSlashIcon,\n WarningFillIcon,\n} from '@persona/icons/12px';\nimport { withAlpha } from 'design-system/lib/color';\nimport { type MaybeSemanticTheme, semanticTokens } from 'design-system/lib/semanticColor';\nimport { TruncatedText } from 'design-system/lib/TruncatedText';\nimport { paragraphMixins } from 'design-system/mixins/text';\nimport type { SemanticTokens } from 'design-system/variables/semantic';\n\nexport type StatusType =\n | 'neutral'\n | 'attention'\n | 'warning'\n | 'critical'\n | 'success'\n | 'feature'\n | 'informational'\n | 'miscellaneous';\nexport type BackgroundType = 'filled' | 'none';\n\n/**\n * Narrow set of status presets — one value per type+icon combination.\n * Override color with `type` or icon with `leadingIcon` when needed.\n */\nexport type Status =\n | 'open'\n | 'pending'\n | 'completed'\n | 'active'\n | 'failed'\n | 'needs_review'\n | 'canceled'\n | 'archived';\n\nconst STATUS_CONFIG: Record<Status, { type: StatusType; icon: ReactNode }> = {\n open: { type: 'neutral', icon: <CircleNullIcon /> },\n pending: { type: 'neutral', icon: <CircleHalfIcon /> },\n completed: { type: 'success', icon: <CircleFillIcon /> },\n active: { type: 'success', icon: <CircleCheckFillIcon /> },\n failed: { type: 'critical', icon: <CircleSlashIcon /> },\n needs_review: { type: 'warning', icon: <WarningFillIcon /> },\n canceled: { type: 'attention', icon: <CircleSlashIcon /> },\n archived: { type: 'informational', icon: <CircleSlashIcon /> },\n};\n\n/** All supported `status` preset keys, derived from the config map. */\nexport const STATUSES = Object.keys(STATUS_CONFIG) as Status[];\n\nexport interface StatusIndicatorProps extends ComponentPropsWithoutRef<'div'> {\n /**\n * Preset that sets a default semantic type and icon.\n * Explicit `type` and `leadingIcon` override the preset.\n */\n status?: Status;\n\n /**\n * The semantic status type to display. Overrides `status` when both are set.\n */\n type?: StatusType;\n\n /**\n * Whether to show filled background or transparent\n */\n background?: BackgroundType;\n\n /**\n * Whether to show the icon. When false, displays label-only variant\n * @default true\n */\n showIcon?: boolean;\n\n /**\n * Optional custom icon to replace the default icon indicator (12px recommended)\n * - undefined (default): Uses `status` icon when set, otherwise CircleNullIcon\n * - null: Hides the icon completely\n * - ReactNode: Shows the provided custom icon\n * Note: showIcon must be true for this to take effect\n */\n leadingIcon?: ReactNode | null;\n\n /**\n * Truncate the label with an ellipsis instead of letting it overflow its container. Adds a\n * title tooltip with the full text when it doesn't fit.\n * @default false\n */\n truncate?: boolean;\n\n /**\n * Render the label exactly as given instead of capitalizing each word. Use for labels that are\n * authored outside the product, where the casing is not ours to change.\n * @default false\n */\n preserveCase?: boolean;\n\n /**\n * The text label to display\n */\n children?: ReactNode;\n}\n\ninterface StatusColors {\n background: string;\n text: string;\n icon: string;\n}\n\nconst FILLED_STATUS_COLORS: Record<StatusType, StatusColors> = {\n neutral: {\n background: Color.BackgroundStatusIndicatorDefault,\n text: Color.TextStatusIndicatorDefault,\n icon: Color.BorderIconLabelGrey,\n },\n attention: {\n background: Color.BackgroundStatusIndicatorAttention,\n text: Color.TextStatusIndicatorAttention,\n icon: Color.BorderIconLabelYellow,\n },\n warning: {\n background: Color.BackgroundStatusIndicatorWarning,\n text: Color.TextStatusIndicatorWarning,\n icon: Color.BorderIconLabelOrange,\n },\n critical: {\n background: Color.BackgroundStatusIndicatorCritical,\n text: Color.TextStatusIndicatorCritical,\n icon: Color.BorderIconLabelRed,\n },\n success: {\n background: Color.BackgroundStatusIndicatorSuccess,\n text: Color.TextStatusIndicatorSuccess,\n icon: Color.BorderIconLabelGreen,\n },\n feature: {\n background: Color.BackgroundStatusIndicatorFeature,\n text: Color.TextStatusIndicatorFeature,\n icon: Color.BorderIconLabelPurple,\n },\n informational: {\n background: Color.BackgroundStatusIndicatorInformational,\n text: Color.TextStatusIndicatorInformational,\n icon: Color.BorderIconLabelBlue,\n },\n miscellaneous: {\n background: Color.BackgroundStatusIndicatorMiscellaneous,\n text: Color.TextStatusIndicatorMiscellaneous,\n icon: Color.BorderIconLabelTeal,\n },\n};\n\nconst TRANSPARENT_STATUS_COLORS: Record<StatusType, StatusColors> = {\n neutral: {\n background: 'transparent',\n text: Color.TextPrimary,\n icon: Color.BorderIconSecondary,\n },\n attention: {\n background: 'transparent',\n text: Color.TextPrimary,\n icon: Color.BorderIconWarning,\n },\n warning: {\n background: 'transparent',\n text: Color.TextPrimary,\n icon: Color.BorderIconWarning,\n },\n critical: {\n background: 'transparent',\n text: Color.TextPrimary,\n icon: Color.BorderIconDanger,\n },\n success: {\n background: 'transparent',\n text: Color.TextPrimary,\n icon: Color.BorderIconSuccess,\n },\n feature: {\n background: 'transparent',\n text: Color.TextPrimary,\n icon: Color.BorderIconActive,\n },\n informational: {\n background: 'transparent',\n text: Color.TextPrimary,\n icon: Color.BorderIconLabelBlue,\n },\n miscellaneous: {\n background: 'transparent',\n text: Color.TextPrimary,\n icon: Color.BorderIconLabelTeal,\n },\n};\n\nconst semanticFilledStatusColors = (t: SemanticTokens): Record<StatusType, StatusColors> => ({\n neutral: { background: t.StatusNeutral, text: t.FgPrimary, icon: t.FgPrimary },\n attention: {\n background: withAlpha(t.StatusHighlight, t.Opacity15),\n text: t.FgHighlight,\n icon: t.FgHighlight,\n },\n warning: {\n background: withAlpha(t.StatusWarning, t.Opacity15),\n text: t.FgWarning2,\n icon: t.FgWarning2,\n },\n critical: {\n background: withAlpha(t.StatusDanger3, t.Opacity15),\n text: t.FgDanger2,\n icon: t.FgDanger2,\n },\n success: {\n background: withAlpha(t.StatusSuccess2, t.Opacity15),\n text: t.FgSuccess,\n icon: t.FgSuccess,\n },\n feature: {\n background: withAlpha(t.StatusFeature, t.Opacity25),\n text: t.FgFeature,\n icon: t.FgFeature,\n },\n informational: {\n background: withAlpha(t.StatusInfo2, t.Opacity25),\n text: t.FgInfo,\n icon: t.FgInfo,\n },\n miscellaneous: {\n background: withAlpha(t.StatusMisc, t.Opacity15),\n text: t.FgMisc,\n icon: t.FgMisc,\n },\n});\n\nconst semanticTransparentStatusColors = (t: SemanticTokens): Record<StatusType, StatusColors> => ({\n neutral: { background: 'transparent', text: t.FgPrimary, icon: t.FgSecondary },\n // Transparent attention intentionally shares warning orange; yellow is reserved for filled attention.\n attention: { background: 'transparent', text: t.FgPrimary, icon: t.FgWarning1 },\n warning: { background: 'transparent', text: t.FgPrimary, icon: t.FgWarning1 },\n critical: { background: 'transparent', text: t.FgPrimary, icon: t.FgDanger1 },\n success: { background: 'transparent', text: t.FgPrimary, icon: t.FgSuccess },\n feature: { background: 'transparent', text: t.FgPrimary, icon: t.FgAccent },\n informational: { background: 'transparent', text: t.FgPrimary, icon: t.FgInfo },\n miscellaneous: { background: 'transparent', text: t.FgPrimary, icon: t.FgMisc },\n});\n\nconst semanticStatusColorCache = new WeakMap<\n SemanticTokens,\n Record<BackgroundType, Record<StatusType, StatusColors>>\n>();\n\nconst semanticStatusColors = (tokens: SemanticTokens) => {\n let colors = semanticStatusColorCache.get(tokens);\n if (!colors) {\n colors = {\n filled: semanticFilledStatusColors(tokens),\n none: semanticTransparentStatusColors(tokens),\n };\n semanticStatusColorCache.set(tokens, colors);\n }\n return colors;\n};\n\nconst statusColors = (theme: MaybeSemanticTheme, background: BackgroundType) => {\n const tokens = semanticTokens(theme);\n if (tokens) {\n return semanticStatusColors(tokens)[background];\n }\n return background === 'filled' ? FILLED_STATUS_COLORS : TRANSPARENT_STATUS_COLORS;\n};\n\nconst Label = styled.div<{\n $type: StatusType;\n $background: BackgroundType;\n $truncate: boolean;\n $preserveCase: boolean;\n}>`\n ${paragraphMixins.sm}\n display: flex;\n flex-direction: column;\n justify-content: center;\n flex-shrink: ${({ $truncate }) => ($truncate ? 1 : 0)};\n min-width: ${({ $truncate }) => ($truncate ? '0' : 'auto')};\n /* Line box hugs the font so pill height is driven by padding alone, and clipping an overflowing\n label can't cut into descenders. Matches Sticker. */\n line-height: 1;\n white-space: nowrap;\n text-transform: ${({ $preserveCase }) => ($preserveCase ? 'none' : 'capitalize')};\n /* Slight optical centering adjustment */\n transform: translateY(0.5px);\n color: ${({ theme, $type, $background }) => statusColors(theme, $background)[$type].text};\n`;\n\nconst IconContainer = styled.span<{ $type: StatusType; $background: BackgroundType }>`\n line-height: 0;\n color: ${({ theme, $type, $background }) => statusColors(theme, $background)[$type].icon};\n`;\n\nconst LabelContainer = styled.div<{ $hasIcon: boolean; $truncate: boolean }>`\n display: flex;\n align-items: center;\n gap: ${Spacing[1]};\n padding: ${({ $hasIcon }) =>\n `${Spacing[1]} ${Spacing[2]} ${Spacing[1]} ${$hasIcon ? Spacing[1] : Spacing[2]}`};\n position: relative;\n flex-shrink: ${({ $truncate }) => ($truncate ? 1 : 0)};\n min-width: ${({ $truncate }) => ($truncate ? '0' : 'auto')};\n`;\n\nconst StyledStatusIndicator = styled.div<{\n $type: StatusType;\n $background: BackgroundType;\n $truncate: boolean;\n}>`\n display: inline-flex;\n align-items: center;\n border-radius: ${BorderRadius.Xl};\n width: fit-content;\n max-width: ${({ $truncate }) => ($truncate ? '100%' : 'none')};\n\n ${({ theme, $type, $background }) => css`\n background-color: ${statusColors(theme, $background)[$type].background};\n `}\n`;\n\n/**\n * StatusIndicator displays semantic status information with a colored icon and label.\n * Supports both filled backgrounds and transparent styles.\n *\n * @example\n * ```tsx\n * <StatusIndicator status=\"active\">Active</StatusIndicator>\n * <StatusIndicator type=\"success\" background=\"filled\">Approved</StatusIndicator>\n * <StatusIndicator type=\"critical\" background=\"none\">Failed</StatusIndicator>\n * ```\n */\nexport const StatusIndicator = ({\n status,\n type,\n background = 'filled',\n showIcon = true,\n leadingIcon,\n truncate = false,\n preserveCase = false,\n children,\n ...props\n}: StatusIndicatorProps) => {\n const resolvedType = type ?? (status != null ? STATUS_CONFIG[status].type : 'neutral');\n\n // Determine which icon to show:\n // - showIcon=false with background='filled': label-only variant (no icon)\n // - leadingIcon set (including null): explicit override\n // - status set: use preset icon\n // - otherwise: default CircleNullIcon\n // - background='none' always shows icon (showIcon is ignored for none background)\n let iconToRender;\n if (!showIcon && background === 'filled') {\n iconToRender = null;\n } else if (typeof leadingIcon !== 'undefined') {\n iconToRender = leadingIcon;\n } else if (status != null) {\n iconToRender = STATUS_CONFIG[status].icon;\n } else {\n iconToRender = <CircleNullIcon />;\n }\n const hasIcon = iconToRender != null;\n\n return (\n <StyledStatusIndicator\n $type={resolvedType}\n $background={background}\n $truncate={truncate}\n {...props}\n >\n <LabelContainer $hasIcon={hasIcon} $truncate={truncate}>\n {hasIcon && (\n <IconContainer $type={resolvedType} $background={background}>\n {iconToRender}\n </IconContainer>\n )}\n <Label\n $type={resolvedType}\n $background={background}\n $truncate={truncate}\n $preserveCase={preserveCase}\n >\n {truncate ? <TruncatedText>{children}</TruncatedText> : children}\n </Label>\n </LabelContainer>\n </StyledStatusIndicator>\n );\n};\n\nexport default StatusIndicator;\n"],"mappings":";;;;;;;;;AA2CA,MAAM,gBAAuE;CAC3E,MAAM;EAAE,MAAM;EAAW,MAAM,oBAAC,gBAAD,EAAkB,CAAA;EAAE;CACnD,SAAS;EAAE,MAAM;EAAW,MAAM,oBAAC,gBAAD,EAAkB,CAAA;EAAE;CACtD,WAAW;EAAE,MAAM;EAAW,MAAM,oBAAC,gBAAD,EAAkB,CAAA;EAAE;CACxD,QAAQ;EAAE,MAAM;EAAW,MAAM,oBAAC,qBAAD,EAAuB,CAAA;EAAE;CAC1D,QAAQ;EAAE,MAAM;EAAY,MAAM,oBAAC,iBAAD,EAAmB,CAAA;EAAE;CACvD,cAAc;EAAE,MAAM;EAAW,MAAM,oBAAC,iBAAD,EAAmB,CAAA;EAAE;CAC5D,UAAU;EAAE,MAAM;EAAa,MAAM,oBAAC,iBAAD,EAAmB,CAAA;EAAE;CAC1D,UAAU;EAAE,MAAM;EAAiB,MAAM,oBAAC,iBAAD,EAAmB,CAAA;EAAE;CAC/D;;AAGD,MAAa,WAAW,OAAO,KAAK,cAAc;AA4DlD,MAAM,uBAAyD;CAC7D,SAAS;EACP,YAAY,MAAM;EAClB,MAAM,MAAM;EACZ,MAAM,MAAM;EACb;CACD,WAAW;EACT,YAAY,MAAM;EAClB,MAAM,MAAM;EACZ,MAAM,MAAM;EACb;CACD,SAAS;EACP,YAAY,MAAM;EAClB,MAAM,MAAM;EACZ,MAAM,MAAM;EACb;CACD,UAAU;EACR,YAAY,MAAM;EAClB,MAAM,MAAM;EACZ,MAAM,MAAM;E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gBAAgB;AAEhC,QACE,oBAAC,uBAAD;EACE,OAAO;EACP,aAAa;EACb,WAAW;EACX,GAAI;YAEJ,qBAAC,gBAAD;GAAgB,UAAU;GAAS,WAAW;aAA9C,CACG,WACC,oBAAC,eAAD;IAAe,OAAO;IAAc,aAAa;cAC9C;IACa,CAAA,EAElB,oBAAC,OAAD;IACE,OAAO;IACP,aAAa;IACb,WAAW;IACX,eAAe;cAEd,WAAW,oBAAC,eAAD,EAAgB,UAAyB,CAAA,GAAG;IAClD,CAAA,CACO;;EACK,CAAA"}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
//#region lib/fieldSchemaTypes.d.ts
|
|
2
|
-
/**
|
|
3
|
-
* Enum describing the schema-level field types shared across form and JSON schema utilities.
|
|
4
|
-
* Keep this module free of runtime dependencies so it can be safely imported in both directions.
|
|
5
|
-
*/
|
|
6
|
-
declare enum FieldSchemaType {
|
|
7
|
-
Alias = "alias",
|
|
8
|
-
Array = "array",
|
|
9
|
-
Boolean = "boolean",
|
|
10
|
-
Calculated = "calculated",
|
|
11
|
-
Choices = "choices",
|
|
12
|
-
Date = "date",
|
|
13
|
-
Datetime = "datetime",
|
|
14
|
-
EmailAddress = "email-address",
|
|
15
|
-
File = "file",
|
|
16
|
-
Hash = "hash",
|
|
17
|
-
Integer = "integer",
|
|
18
|
-
Json = "json",
|
|
19
|
-
MultiChoices = "multi-choices",
|
|
20
|
-
Number = "number",
|
|
21
|
-
String = "string",
|
|
22
|
-
/**
|
|
23
|
-
* NOTE: please also add all relation fields to the RELATION_FIELDS constant.
|
|
24
|
-
*/
|
|
25
|
-
Relation = "Field::Relation",
|
|
26
|
-
/**
|
|
27
|
-
* Not ideal because 'generic' is not very descriptive. Should migrate
|
|
28
|
-
* fields serialization to not demodulize. But that's a breaking change.
|
|
29
|
-
*/
|
|
30
|
-
DocumentGeneric = "Field::Relation::Document::Generic",
|
|
31
|
-
GovernmentId = "Field::Relation::Document::GovernmentId",
|
|
32
|
-
GovernmentIdNfc = "Field::Relation::Document::GovernmentIdNfc",
|
|
33
|
-
Mdoc = "Field::Relation::Document::Mdoc",
|
|
34
|
-
QrCode = "Field::Relation::Document::QrCode",
|
|
35
|
-
Selfie = "Field::Relation::Selfie"
|
|
36
|
-
}
|
|
37
|
-
//#endregion
|
|
38
|
-
export { FieldSchemaType as t };
|
|
39
|
-
//# sourceMappingURL=fieldSchemaTypes-BVYSm74B.d.mts.map
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
//#region lib/fieldSchemaTypes.ts
|
|
2
|
-
/**
|
|
3
|
-
* Enum describing the schema-level field types shared across form and JSON schema utilities.
|
|
4
|
-
* Keep this module free of runtime dependencies so it can be safely imported in both directions.
|
|
5
|
-
*/
|
|
6
|
-
let FieldSchemaType = /* @__PURE__ */ function(FieldSchemaType) {
|
|
7
|
-
FieldSchemaType["Alias"] = "alias";
|
|
8
|
-
FieldSchemaType["Array"] = "array";
|
|
9
|
-
FieldSchemaType["Boolean"] = "boolean";
|
|
10
|
-
FieldSchemaType["Calculated"] = "calculated";
|
|
11
|
-
FieldSchemaType["Choices"] = "choices";
|
|
12
|
-
FieldSchemaType["Date"] = "date";
|
|
13
|
-
FieldSchemaType["Datetime"] = "datetime";
|
|
14
|
-
FieldSchemaType["EmailAddress"] = "email-address";
|
|
15
|
-
FieldSchemaType["File"] = "file";
|
|
16
|
-
FieldSchemaType["Hash"] = "hash";
|
|
17
|
-
FieldSchemaType["Integer"] = "integer";
|
|
18
|
-
FieldSchemaType["Json"] = "json";
|
|
19
|
-
FieldSchemaType["MultiChoices"] = "multi-choices";
|
|
20
|
-
FieldSchemaType["Number"] = "number";
|
|
21
|
-
FieldSchemaType["String"] = "string";
|
|
22
|
-
/**
|
|
23
|
-
* NOTE: please also add all relation fields to the RELATION_FIELDS constant.
|
|
24
|
-
*/
|
|
25
|
-
FieldSchemaType["Relation"] = "Field::Relation";
|
|
26
|
-
/**
|
|
27
|
-
* Not ideal because 'generic' is not very descriptive. Should migrate
|
|
28
|
-
* fields serialization to not demodulize. But that's a breaking change.
|
|
29
|
-
*/
|
|
30
|
-
FieldSchemaType["DocumentGeneric"] = "Field::Relation::Document::Generic";
|
|
31
|
-
FieldSchemaType["GovernmentId"] = "Field::Relation::Document::GovernmentId";
|
|
32
|
-
FieldSchemaType["GovernmentIdNfc"] = "Field::Relation::Document::GovernmentIdNfc";
|
|
33
|
-
FieldSchemaType["Mdoc"] = "Field::Relation::Document::Mdoc";
|
|
34
|
-
FieldSchemaType["QrCode"] = "Field::Relation::Document::QrCode";
|
|
35
|
-
FieldSchemaType["Selfie"] = "Field::Relation::Selfie";
|
|
36
|
-
return FieldSchemaType;
|
|
37
|
-
}({});
|
|
38
|
-
//#endregion
|
|
39
|
-
export { FieldSchemaType };
|
|
40
|
-
|
|
41
|
-
//# sourceMappingURL=fieldSchemaTypes.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"fieldSchemaTypes.mjs","names":[],"sources":["../../lib/fieldSchemaTypes.ts"],"sourcesContent":["/**\n * Enum describing the schema-level field types shared across form and JSON schema utilities.\n * Keep this module free of runtime dependencies so it can be safely imported in both directions.\n */\nexport enum FieldSchemaType {\n Alias = 'alias',\n Array = 'array',\n Boolean = 'boolean',\n Calculated = 'calculated',\n Choices = 'choices',\n Date = 'date',\n Datetime = 'datetime',\n EmailAddress = 'email-address',\n File = 'file',\n Hash = 'hash',\n Integer = 'integer',\n Json = 'json',\n MultiChoices = 'multi-choices',\n Number = 'number',\n String = 'string',\n /**\n * NOTE: please also add all relation fields to the RELATION_FIELDS constant.\n */\n Relation = 'Field::Relation',\n /**\n * Not ideal because 'generic' is not very descriptive. Should migrate\n * fields serialization to not demodulize. But that's a breaking change.\n */\n DocumentGeneric = 'Field::Relation::Document::Generic',\n GovernmentId = 'Field::Relation::Document::GovernmentId',\n GovernmentIdNfc = 'Field::Relation::Document::GovernmentIdNfc',\n Mdoc = 'Field::Relation::Document::Mdoc',\n QrCode = 'Field::Relation::Document::QrCode',\n Selfie = 'Field::Relation::Selfie',\n}\n"],"mappings":";;;;;AAIA,IAAY,kBAAL,yBAAA,iBAAA;AACL,iBAAA,WAAA;AACA,iBAAA,WAAA;AACA,iBAAA,aAAA;AACA,iBAAA,gBAAA;AACA,iBAAA,aAAA;AACA,iBAAA,UAAA;AACA,iBAAA,cAAA;AACA,iBAAA,kBAAA;AACA,iBAAA,UAAA;AACA,iBAAA,UAAA;AACA,iBAAA,aAAA;AACA,iBAAA,UAAA;AACA,iBAAA,kBAAA;AACA,iBAAA,YAAA;AACA,iBAAA,YAAA;;;;AAIA,iBAAA,cAAA;;;;;AAKA,iBAAA,qBAAA;AACA,iBAAA,kBAAA;AACA,iBAAA,qBAAA;AACA,iBAAA,UAAA;AACA,iBAAA,YAAA;AACA,iBAAA,YAAA;;KACD"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"methodChain.mjs","names":["updatedParse","UpdatedSyntaxError"],"sources":["../../lib/methodChain.ts"],"sourcesContent":["import { last } from 'lodash-es';\n\nimport {\n parse as updatedParse,\n SyntaxError as UpdatedSyntaxError,\n} from '@persona/design-system/components/SmartTextInput/parser/method-chain/parser';\nimport { ASTNodeType } from '@persona/design-system/components/SmartTextInput/parser/method-chain/types';\n\nimport { reportError } from './errorReporter';\nimport { type JsonSchema, JsonSchemaTypes } from './jsonSchema';\nimport { normalizeChain } from './methodChainNormalize';\nimport type {\n Chain,\n FunctionNode,\n CustomFunctionNode,\n IdentifierNode,\n StringNode,\n NumberNode,\n ArrayNode,\n FunctionParamType,\n MethodChainNode,\n} from './methodChainTypes';\n\n// @ts-expect-error Returns never so the compiler checks exhaustiveness, but doesn't throw so a malformed\n// chain degrades instead of breaking render.\nfunction assertNever(value: never): never {\n const dump = typeof value === 'object' ? JSON.stringify(value) : value;\n reportError(new TypeError(`assertNever non-exhaustive match: ${dump}`));\n}\n\n// Re-export types for backward compatibility\nexport {\n Chain,\n FunctionNode,\n CustomFunctionNode,\n IdentifierNode,\n StringNode,\n NumberNode,\n ArrayNode,\n FunctionParamType,\n MethodChainNode,\n};\n\nexport const methodChainCache: { [key: string]: Chain } = {};\n\nexport const MethodChainNodeTypes = {\n Chain: ASTNodeType.Chain,\n String: ASTNodeType.String,\n Number: ASTNodeType.Number,\n Identifier: ASTNodeType.Identifier,\n Function: ASTNodeType.Function,\n CustomFunction: ASTNodeType.CustomFunction,\n Array: ASTNodeType.Array,\n} as const;\n\nexport const EMPTY_METHOD_CHAIN: Chain = {\n type: MethodChainNodeTypes.Chain,\n links: [],\n};\n\ntype MethodChainLiteral = string | number | (string | number)[];\n\nexport const isFunctionNode = (node: MethodChainNode): node is FunctionNode =>\n node.type === MethodChainNodeTypes.Function;\n\nexport const isCustomFunctionNode = (node: MethodChainNode): node is CustomFunctionNode =>\n node.type === MethodChainNodeTypes.CustomFunction;\n\nexport const isIdentifierNode = (node: MethodChainNode): node is IdentifierNode =>\n node.type === MethodChainNodeTypes.Identifier;\n\nexport const isStringNode = (node: FunctionParamType): node is StringNode =>\n node.type === MethodChainNodeTypes.String;\n\nexport const isArrayNode = (node: FunctionParamType): node is ArrayNode =>\n node.type === MethodChainNodeTypes.Array;\n\nexport const containsFunctionNode = (methodChain: Chain, ...functionNames: string[]): boolean =>\n methodChain.links.some((link) => isFunctionNode(link) && functionNames.includes(link.name));\n\n/**\n * Returns true if the string contains any function node (e.g. `.at(...)`) when parsed\n * as a method chain. Use this to detect whether a field path must be treated as an\n * opaque key rather than split on `.` for Lodash set/get operations.\n */\nexport const pathContainsFunctionNode = (path: string): boolean => {\n try {\n const chain = parseMethodChain(path);\n return chain.links.some(\n (link) =>\n link.type === MethodChainNodeTypes.Function ||\n link.type === MethodChainNodeTypes.CustomFunction,\n );\n } catch {\n return false;\n }\n};\n\nexport const isEmpty = (methodChain: Chain): boolean => methodChain.links.length === 0;\n\nexport const getFunctionParams = (\n methodChain: Chain,\n ...functionNames: string[]\n): Record<string, MethodChainLiteral[]> => {\n return Object.fromEntries(\n methodChain.links\n .filter((link) => isFunctionNode(link))\n .filter((link) => functionNames.includes(link.name))\n .map((link) => [link.name, flattenParamsToString(link.params)]),\n );\n};\n\nexport const removeFunctionNode = (methodChain: Chain, functionName: string): Chain => {\n return {\n type: MethodChainNodeTypes.Chain,\n links: methodChain.links.filter(\n (link) => link.type !== MethodChainNodeTypes.Function || link.name !== functionName,\n ),\n };\n};\n\nconst flattenParamsToString = (params: FunctionParamType[]): MethodChainLiteral[] => {\n const result: MethodChainLiteral[] = [];\n\n for (const param of params) {\n switch (param.type) {\n case MethodChainNodeTypes.Chain:\n result.push(...flattenChainToString(param));\n break;\n case MethodChainNodeTypes.String:\n case MethodChainNodeTypes.Number:\n result.push(param.value);\n break;\n case MethodChainNodeTypes.Array:\n result.push(param.items.map((item) => item.value));\n break;\n }\n }\n\n return result;\n};\n\nconst flattenChainToString = (methodChain: Chain): MethodChainLiteral[] =>\n methodChain.links\n .map((link) => {\n switch (link.type) {\n case MethodChainNodeTypes.Function:\n case MethodChainNodeTypes.CustomFunction:\n return flattenParamsToString(link.params);\n case MethodChainNodeTypes.Identifier:\n return link.name;\n }\n })\n .flat();\n\nexport const isValid = (methodChain: string): boolean => {\n try {\n parseMethodChain(methodChain);\n return true;\n } catch {\n return false;\n }\n};\n\n/**\n * The parsed chain, or undefined when it will not parse. Callers that read a chain while it is being\n * authored hold half-typed input, where a throw is noise rather than an error.\n */\nexport const tryParseMethodChain = (methodChain: string): Chain | undefined => {\n try {\n return parseMethodChain(methodChain);\n } catch {\n return undefined;\n }\n};\n\n/** The object a chain is rooted at: `current_case.inquiries` -> `current_case`. */\nexport const methodChainRootName = (methodChain: string): string | undefined => {\n const [root] = tryParseMethodChain(methodChain)?.links ?? [];\n return root && isIdentifierNode(root) ? root.name : undefined;\n};\n\nexport const parseMethodChain = (methodChain: string): Chain => {\n if (!methodChain || methodChain === '') {\n return EMPTY_METHOD_CHAIN;\n }\n\n if (!methodChainCache[methodChain]) {\n methodChainCache[methodChain] = normalizeChain(updatedParse(methodChain, { strict: true }));\n }\n return methodChainCache[methodChain];\n};\n\nconst memberToString = (value: string): string => {\n return `'${value.replace(/'/g, \"\\\\'\")}'`;\n};\n\n// Number#toString gives the shortest decimal string that round-trips back to the same\n// float64, but for magnitudes below 1e-6 (or above 1e21) it switches to exponential\n// notation (e.g. `0.0000001` -> \"1e-7\"), which the method chain grammar's plain-decimal\n// literal can't parse. Expand that exponential form back into plain decimal by shifting\n// its digits, rather than capping fraction digits (e.g. via toLocaleString), which silently\n// rounds magnitudes below the cap to \"0\" instead of reproducing them.\nconst expandExponentialNotation = (str: string): string => {\n const match = /^(-?)(\\d)(?:\\.(\\d+))?e([+-]\\d+)$/.exec(str);\n if (!match) {\n return str;\n }\n const [, sign, leadingDigit, fractionDigits = '', exponentStr] = match;\n const digits = leadingDigit + fractionDigits;\n const exponent = Number(exponentStr);\n\n if (exponent < 0) {\n return `${sign}0.${'0'.repeat(-exponent - 1)}${digits}`;\n }\n // Positive exponential notation only appears at exponent >= 21 (Number#toString's own\n // threshold), while a double's mantissa never carries more than 17 significant digits,\n // so the exponent always reaches past the end of `digits` — there's no case where the\n // decimal point lands inside them.\n return `${sign}${digits}${'0'.repeat(exponent - fractionDigits.length)}`;\n};\n\nconst numberLiteralToString = (value: number): string => {\n // The grammar has no literal for Infinity/NaN; render/label call sites have no way to\n // recover from a throw, so fall back to JS's own string form instead of crashing them.\n if (!Number.isFinite(value)) {\n return `${value}`;\n }\n\n const str = value.toString();\n return /e/i.test(str) ? expandExponentialNotation(str) : str;\n};\n\nexport const methodChainToString = (\n methodChain: Chain | StringNode | NumberNode | ArrayNode,\n): string => {\n switch (methodChain.type) {\n case MethodChainNodeTypes.String:\n return methodChain.value;\n case MethodChainNodeTypes.Number:\n return numberLiteralToString(methodChain.value);\n case MethodChainNodeTypes.Array:\n return `[${methodChain.items\n .map((item) =>\n item.type === MethodChainNodeTypes.String\n ? memberToString(item.value)\n : `#${numberLiteralToString(item.value)}`,\n )\n .join(', ')}]`;\n default: {\n const regex = new RegExp('^@?[a-zA-Z0-9_-]+$');\n return methodChain.links\n .map((link, index) => {\n switch (link.type) {\n case MethodChainNodeTypes.Identifier: {\n const fullName = `${link.prefix ?? ''}${link.name}`;\n return index === 0\n ? fullName\n : regex.test(fullName)\n ? `.${fullName}`\n : `['${fullName.replace(/'/g, \"\\\\'\")}']`;\n }\n case MethodChainNodeTypes.Function: {\n return `.${link.name}(${link.params\n .map((param) => {\n switch (param.type) {\n case MethodChainNodeTypes.String:\n return memberToString(param.value);\n case MethodChainNodeTypes.Number:\n return `#${numberLiteralToString(param.value)}`;\n case MethodChainNodeTypes.Chain:\n case MethodChainNodeTypes.Array:\n return methodChainToString(param);\n }\n })\n .join(', ')})`;\n }\n case MethodChainNodeTypes.CustomFunction: {\n const paramStr = link.params\n .map((param) => {\n switch (param.type) {\n case MethodChainNodeTypes.String:\n return memberToString(param.value);\n case MethodChainNodeTypes.Number:\n return `#${numberLiteralToString(param.value)}`;\n case MethodChainNodeTypes.Chain:\n case MethodChainNodeTypes.Array:\n return methodChainToString(param);\n }\n })\n .join(', ');\n return [\n index === 0 ? '' : '.',\n `@${link.name}`,\n link.params.length === 0 ? '' : `(${paramStr})`,\n ].join('');\n }\n default:\n assertNever(link);\n }\n })\n .join('');\n }\n }\n};\n\nexport const appendedMethodChain = (\n parentChain: Chain,\n appended: string | MethodChainNode,\n): Chain => {\n const buildNode = (name: string): MethodChainNode => {\n if (name.startsWith('@')) {\n return { type: MethodChainNodeTypes.CustomFunction, name: name.slice(1), params: [] };\n }\n return { type: MethodChainNodeTypes.Identifier, name };\n };\n\n return {\n type: MethodChainNodeTypes.Chain,\n links: [...parentChain.links, typeof appended === 'string' ? buildNode(appended) : appended],\n };\n};\n\nexport const parseWithPartialOption = (\n path: string,\n): { methodChain: Chain; partial: string; valid: boolean } => {\n if (isValid(path)) {\n const methodChain = parseMethodChain(path);\n\n return {\n methodChain: {\n type: MethodChainNodeTypes.Chain,\n links: methodChain.links.slice(0, methodChain.links.length - 1),\n },\n partial: last(methodChain.links)?.name || '',\n valid: true,\n };\n }\n\n const rawParse = (input: string): Chain => {\n return normalizeChain(updatedParse(input, { strict: true }));\n };\n\n try {\n if (path.endsWith('.')) {\n return {\n methodChain: rawParse(path.slice(0, -1)),\n partial: '',\n valid: true,\n };\n }\n\n if (path.lastIndexOf('[') > path.lastIndexOf(']')) {\n const partialString = path.slice(path.lastIndexOf('[') + 2);\n const partialValue = partialString.endsWith(\"'\") ? partialString.slice(0, -1) : partialString;\n return {\n methodChain: rawParse(path.slice(0, path.lastIndexOf('['))),\n partial: partialValue,\n valid: true,\n };\n }\n } catch {\n /* empty */\n }\n\n return {\n methodChain: EMPTY_METHOD_CHAIN,\n partial: path,\n valid: false,\n };\n};\n\n// Check if the path can be parsed as legacy method chain format.\n// Normative means all the name parts are\n// 1. delimited by only dots and\n// 2. only contain alphanumeric characters, underscores, and hyphens.\nexport const pathIsNormative = (path: string): boolean => {\n return path.split('.').every((part) => /^[a-zA-Z0-9_-]+$/.test(part));\n};\nexport const getSyntaxError = (): typeof UpdatedSyntaxError => UpdatedSyntaxError;\n\nexport const methodChainNodeToJsonSchema = (\n node: StringNode | NumberNode | ArrayNode,\n): JsonSchema | null => {\n if (node.type === MethodChainNodeTypes.String) {\n return {\n type: JsonSchemaTypes.String,\n };\n } else if (node.type === MethodChainNodeTypes.Number) {\n return {\n type: JsonSchemaTypes.Number,\n };\n } else if (node.type === MethodChainNodeTypes.Array) {\n // Determine the items schema based on the first item type\n // For simplicity, assume all items are the same type\n if (node.items.length > 0) {\n const firstItem = node.items[0];\n const itemSchema: JsonSchema =\n firstItem.type === MethodChainNodeTypes.String\n ? { type: JsonSchemaTypes.String }\n : { type: JsonSchemaTypes.Number };\n\n return {\n type: JsonSchemaTypes.Array,\n items: itemSchema,\n };\n } else {\n return {\n type: JsonSchemaTypes.Array,\n items: { type: JsonSchemaTypes.String },\n };\n }\n }\n\n return null;\n};\n"],"mappings":";;;;;;;AAyBA,S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ent":["import { createContext, useContext } from 'react';\n\nimport useFormGroup from 'design-system/components/ConfigFormGroup/useFormGroup';\nimport type ErrorProps from 'design-system/types/ErrorProps';\n\nexport interface FormControlContextProps extends ErrorProps {\n inputId?: string;\n helperTextId?: string;\n errorTextId?: string;\n warningTextId?: string;\n labelId?: string;\n disabled?: boolean;\n maxLength?: number;\n configField?: boolean;\n}\n\nexport const FormControlContext = createContext<FormControlContextProps>({});\n\nconst useFormField = (props: Partial<FormControlContextProps>) => {\n const group = useFormGroup();\n const field = useContext(FormControlContext);\n\n const inputId = props.inputId ?? field.inputId;\n\n return {\n configField: props.configField ?? group.configField,\n hasError: props.hasError ?? field.hasError,\n hasWarning: props.hasWarning ?? field.hasWarning,\n inputId,\n helperTextId: props.helperTextId ?? field.helperTextId,\n errorTextId: props.errorTextId ?? field.errorTextId,\n warningTextId: props.warningTextId ?? field.warningTextId,\n labelId: props.labelId ?? field.labelId,\n disabled: props.disabled ?? field.disabled,\n maxLength: props.maxLength ?? field.maxLength,\n };\n};\n\nexport default useFormField;\n"],"mappings":";;;AAgBA,MAAa,qBAAqB,cAAuC,EAAE,CAAC;AAE5E,MAAM,gBAAgB,UAA4C;CAChE,MAAM,QAAQ,cAAc;CAC5B,MAAM,QAAQ,WAAW,mBAAmB;CAE5C,MAAM,UAAU,MAAM,WAAW,MAAM;AAEvC,QAAO;EACL,aAAa,MAAM,eAAe,MAAM;EACxC,UAAU,MAAM,YAAY,MAAM;EAClC,YAAY,MAAM,cAAc,MAAM;EACtC;EACA,cAAc,MAAM,gBAAgB,MAAM;EAC1C,aAAa,MAAM,eAAe,MAAM;EACxC,eAAe,MAAM,iBAAiB,MAAM;EAC5C,SAAS,MAAM,WAAW,MAAM;EAChC,UAAU,MAAM,YAAY,MAAM;EAClC,WAAW,MAAM,aAAa,MAAM;EACrC"}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|