themelia-react-ui 2.0.2 → 2.0.4
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 +67 -7
- package/README.md +70 -37
- package/THIRD_PARTY_NOTICES.md +6 -12
- package/dist/{accordion-Cjb6sx0G.js → accordion-96o0pN62.js} +5 -5
- package/dist/{accordion-Cjb6sx0G.js.map → accordion-96o0pN62.js.map} +1 -1
- package/dist/action-menu-CHgs8vmj.js +281 -0
- package/dist/action-menu-CHgs8vmj.js.map +1 -0
- package/dist/{affordance-geometry.generated-tF36bREk.js → affordance-geometry.generated-B8yGOr8-.js} +7 -1
- package/dist/affordance-geometry.generated-B8yGOr8-.js.map +1 -0
- package/dist/{ai-artifact-DvTwDVyL.js → ai-artifact-BZUGwBq6.js} +277 -276
- package/dist/ai-artifact-BZUGwBq6.js.map +1 -0
- package/dist/{app-shell-C4FhvCqF.js → app-shell-D63ATkIK.js} +84 -83
- package/dist/app-shell-D63ATkIK.js.map +1 -0
- package/dist/{attachment-BxDfL2mw.js → attachment-DkoqHPPl.js} +7 -7
- package/dist/{attachment-BxDfL2mw.js.map → attachment-DkoqHPPl.js.map} +1 -1
- package/dist/{auth-ax2BqjrI.js → auth-D2FVZ1MH.js} +10 -10
- package/dist/{auth-ax2BqjrI.js.map → auth-D2FVZ1MH.js.map} +1 -1
- package/dist/{avatar-DAPlDvhJ.js → avatar-DWO_HHhB.js} +5 -5
- package/dist/{avatar-DAPlDvhJ.js.map → avatar-DWO_HHhB.js.map} +1 -1
- package/dist/{badge-HpFqoqSY.js → badge-DErMA7ul.js} +4 -4
- package/dist/{badge-HpFqoqSY.js.map → badge-DErMA7ul.js.map} +1 -1
- package/dist/base/accordion.js +1 -1
- package/dist/base/action-menu.js +1 -1
- package/dist/base/attachment.js +1 -1
- package/dist/base/avatar.js +1 -1
- package/dist/base/badge.js +1 -1
- package/dist/base/batch-action-bar.js +1 -1
- package/dist/base/buttons.js +1 -1
- package/dist/base/cards.js +2 -2
- package/dist/base/carousel.js +3 -3
- package/dist/base/cascader.js +13 -13
- package/dist/base/chart.js +1 -1
- package/dist/base/choice-inputs.js +2 -2
- package/dist/base/code-block.js +1 -1
- package/dist/base/combobox.js +2 -2
- package/dist/base/command.js +1 -1
- package/dist/base/copyable.js +1 -1
- package/dist/base/date-pickers.js +2 -2
- package/dist/base/display.js +6 -6
- package/dist/base/feedback.js +3 -3
- package/dist/base/forms-numeric.js +1 -1
- package/dist/base/forms.js +3 -3
- package/dist/base/inline-edit.js +10 -10
- package/dist/base/item.js +1 -1
- package/dist/base/media-gallery.js +1 -1
- package/dist/base/metadata-list.js +1 -1
- package/dist/base/navigation.js +6 -6
- package/dist/base/popover-menu.js +1 -1
- package/dist/base/popover.js +1 -1
- package/dist/base/qr-code.js +1 -1
- package/dist/base/repeaters.js +9 -9
- package/dist/base/sheet.js +1 -1
- package/dist/base/sidebar.js +1 -1
- package/dist/base/signature-pad.js +6 -6
- package/dist/base/skeleton.js +1 -1
- package/dist/base/spinner.js +4 -4
- package/dist/base/structure.js +1 -1
- package/dist/base/table.js +1 -1
- package/dist/base/text-inputs.js +2 -2
- package/dist/base/toaster.js +3 -3
- package/dist/base/tree.js +1 -1
- package/dist/base/upload-queue.js +1 -1
- package/dist/base/upload.js +3 -3
- package/dist/base/value-inputs.js +1 -1
- package/dist/{batch-action-bar-DnUJ21NQ.js → batch-action-bar-CdfIkCsV.js} +4 -4
- package/dist/{batch-action-bar-DnUJ21NQ.js.map → batch-action-bar-CdfIkCsV.js.map} +1 -1
- package/dist/blocks/admin.js +20 -20
- package/dist/blocks/admin.js.map +1 -1
- package/dist/blocks/ai.js +15 -15
- package/dist/blocks/analytics/usage-card.js +1 -1
- package/dist/blocks/analytics.js +17 -17
- package/dist/blocks/analytics.js.map +1 -1
- package/dist/blocks/collaboration.js +1 -1
- package/dist/blocks/commerce/receipt.js +1 -1
- package/dist/blocks/commerce.js +570 -567
- package/dist/blocks/commerce.js.map +1 -1
- package/dist/blocks/data-display.js +2 -2
- package/dist/blocks/onboarding.js +5 -5
- package/dist/blocks/planning.js +11 -11
- package/dist/blocks/timelines.js +1 -1
- package/dist/{breadcrumbs-C-oqs1sQ.js → breadcrumbs-B-WFKecD.js} +4 -4
- package/dist/{breadcrumbs-C-oqs1sQ.js.map → breadcrumbs-B-WFKecD.js.map} +1 -1
- package/dist/{button-DVzspB_G.js → button-DkmK-z8E.js} +2 -2
- package/dist/{button-DVzspB_G.js.map → button-DkmK-z8E.js.map} +1 -1
- package/dist/{buttons-DPZekJFu.js → buttons-BbfzgczK.js} +8 -8
- package/dist/{buttons-DPZekJFu.js.map → buttons-BbfzgczK.js.map} +1 -1
- package/dist/{cards-BaBZR-AU.js → cards-4JTWqvVe.js} +10 -10
- package/dist/cards-4JTWqvVe.js.map +1 -0
- package/dist/{chart-ZOYyK2xG.js → chart-C19flDQb.js} +4 -4
- package/dist/{chart-ZOYyK2xG.js.map → chart-C19flDQb.js.map} +1 -1
- package/dist/{checkbox-AWIhNhmo.js → checkbox-CzYUTPeJ.js} +9 -5
- package/dist/checkbox-CzYUTPeJ.js.map +1 -0
- package/dist/{choice-inputs-CNHvARCJ.js → choice-inputs-JLtij2y4.js} +182 -176
- package/dist/choice-inputs-JLtij2y4.js.map +1 -0
- package/dist/{code-block-DeneBJR_.js → code-block-CGNaUtAE.js} +7 -7
- package/dist/{code-block-DeneBJR_.js.map → code-block-CGNaUtAE.js.map} +1 -1
- package/dist/{collapsible-C-_l4hpy.js → collapsible-Do4G0zcC.js} +3 -3
- package/dist/{collapsible-C-_l4hpy.js.map → collapsible-Do4G0zcC.js.map} +1 -1
- package/dist/{collection-content-By56pLog.js → collection-content-C0e8SsTm.js} +3 -3
- package/dist/{collection-content-By56pLog.js.map → collection-content-C0e8SsTm.js.map} +1 -1
- package/dist/{combobox-C0EQW6dr.js → combobox-CBJDs6w_.js} +349 -347
- package/dist/combobox-CBJDs6w_.js.map +1 -0
- package/dist/{combobox-xCQ2RMNE.js → combobox-hbhSS18O.js} +158 -112
- package/dist/combobox-hbhSS18O.js.map +1 -0
- package/dist/{command-C25VMRII.js → command-D8NrBj-b.js} +7 -7
- package/dist/{command-C25VMRII.js.map → command-D8NrBj-b.js.map} +1 -1
- package/dist/{comments-BYYlTA8E.js → comments-Di4w0H_S.js} +383 -382
- package/dist/comments-Di4w0H_S.js.map +1 -0
- package/dist/components/base/action-menu/action-menu.d.ts +2 -0
- package/dist/components/base/cards/card.recipes.d.ts +12 -5
- package/dist/components/base/cards/smart-card.types.d.ts +12 -7
- package/dist/components/base/choice-inputs/checkbox.d.ts +7 -2
- package/dist/components/base/choice-inputs/switch-card.d.ts +7 -0
- package/dist/components/base/choice-inputs/toggle-field.d.ts +7 -0
- package/dist/components/base/combobox/combobox-field.d.ts +16 -0
- package/dist/components/base/date-pickers/datepicker.types.d.ts +7 -0
- package/dist/components/base/forms/controlled-form-field.d.ts +6 -6
- package/dist/components/base/forms/form-field.d.ts +5 -3
- package/dist/components/base/forms/index.d.ts +1 -0
- package/dist/components/base/forms/server-errors.d.ts +16 -0
- package/dist/components/base/forms/workflow.d.ts +5 -2
- package/dist/components/base/metadata-list/metadata-list.d.ts +3 -1
- package/dist/components/base/navigation/page-header/page-header.d.ts +4 -2
- package/dist/components/base/structure/composition.recipes.d.ts +17 -0
- package/dist/components/base/text-inputs/hooks/use-form-field-state.d.ts +7 -2
- package/dist/components/base/text-inputs/input.d.ts +4 -2
- package/dist/components/base/text-inputs/textarea.d.ts +4 -2
- package/dist/components/base/value-inputs/date-time-input.d.ts +2 -1
- package/dist/components/base/value-inputs/slider.d.ts +5 -1
- package/dist/components/base/value-inputs/tags-input.d.ts +5 -1
- package/dist/components/typography/text.styles.d.ts +26 -1
- package/dist/components/ui/combobox-dismiss.d.ts +16 -0
- package/dist/components/ui/combobox.d.ts +11 -6
- package/dist/components/ui/dialog.d.ts +1 -1
- package/dist/components/ui/popover.d.ts +1 -1
- package/dist/components/ui/sheet.d.ts +1 -1
- package/dist/composition.recipes-COdiFhxB.js +19 -0
- package/dist/composition.recipes-COdiFhxB.js.map +1 -0
- package/dist/containers-CRmHf7GP.js +104 -0
- package/dist/containers-CRmHf7GP.js.map +1 -0
- package/dist/{copyable-ClBuk_UK.js → copyable-CnGCZdX4.js} +4 -4
- package/dist/{copyable-ClBuk_UK.js.map → copyable-CnGCZdX4.js.map} +1 -1
- package/dist/{data-display-DT_khPl_.js → data-display-D4oujtx0.js} +239 -238
- package/dist/data-display-D4oujtx0.js.map +1 -0
- package/dist/{date-DCrsDTZc.js → date-Q7jnXxpk.js} +5 -5
- package/dist/{date-DCrsDTZc.js.map → date-Q7jnXxpk.js.map} +1 -1
- package/dist/{date-picker-ay0Pha_a.js → date-picker-zOt1oNss.js} +102 -90
- package/dist/date-picker-zOt1oNss.js.map +1 -0
- package/dist/date-pickers-cj8IXbDC.js +179 -0
- package/dist/date-pickers-cj8IXbDC.js.map +1 -0
- package/dist/{display-hAc1HjpI.js → display-BB4BL_-K.js} +8 -8
- package/dist/{display-hAc1HjpI.js.map → display-BB4BL_-K.js.map} +1 -1
- package/dist/{dropdown-menu-Cl4X7L5S.js → dropdown-menu-CjY8Vt7W.js} +8 -8
- package/dist/{dropdown-menu-Cl4X7L5S.js.map → dropdown-menu-CjY8Vt7W.js.map} +1 -1
- package/dist/features/activities.js +11 -11
- package/dist/features/ai-chat.js +9 -9
- package/dist/features/appointment-calendar.js +222 -220
- package/dist/features/appointment-calendar.js.map +1 -1
- package/dist/features/async-preview.js +8 -8
- package/dist/features/combobox.js +1 -1
- package/dist/features/comments.js +1 -1
- package/dist/features/data-view.js +10 -10
- package/dist/features/email-composer.js +275 -274
- package/dist/features/email-composer.js.map +1 -1
- package/dist/features/event-calendar.js +199 -198
- package/dist/features/event-calendar.js.map +1 -1
- package/dist/features/filters.js +1 -1
- package/dist/features/global-search.js +12 -12
- package/dist/features/kanban.js +4 -4
- package/dist/features/map.js +7 -7
- package/dist/features/media-library.js +623 -622
- package/dist/features/media-library.js.map +1 -1
- package/dist/features/mentions.js +1 -1
- package/dist/features/overlays.js +1 -1
- package/dist/features/products.js +973 -969
- package/dist/features/products.js.map +1 -1
- package/dist/features/questionnaire.js +12 -12
- package/dist/features/resource-assignment.js +8 -8
- package/dist/features/resource.js +113 -112
- package/dist/features/resource.js.map +1 -1
- package/dist/features/rich-text-editor.js +2 -2
- package/dist/features/schema-form.js +254 -253
- package/dist/features/schema-form.js.map +1 -1
- package/dist/features/suggestions.js +3 -3
- package/dist/features/sync.js +3 -3
- package/dist/features/table.js +1 -1
- package/dist/features/theme-tweaker.js +19 -19
- package/dist/features/theme-tweaker.js.map +1 -1
- package/dist/{feedback-BYIhtitP.js → feedback-DZNL5Lg1.js} +9 -9
- package/dist/{feedback-BYIhtitP.js.map → feedback-DZNL5Lg1.js.map} +1 -1
- package/dist/{field-affordance-recipes-DZhnIL_Y.js → field-affordance-recipes-DjwGx8eM.js} +2 -2
- package/dist/{field-affordance-recipes-DZhnIL_Y.js.map → field-affordance-recipes-DjwGx8eM.js.map} +1 -1
- package/dist/{filters-BGfvjP4d.js → filters-BcT-uoFy.js} +19 -19
- package/dist/{filters-BGfvjP4d.js.map → filters-BcT-uoFy.js.map} +1 -1
- package/dist/{form-field-CwH9y77i.js → form-field-CsgRmdit.js} +14 -8
- package/dist/form-field-CsgRmdit.js.map +1 -0
- package/dist/{form-sizing-BdP_Mf5p.js → form-sizing-NXgjkmBG.js} +3 -3
- package/dist/{form-sizing-BdP_Mf5p.js.map → form-sizing-NXgjkmBG.js.map} +1 -1
- package/dist/{forms-B9G_xwzi.js → forms-BV5m5aQF.js} +83 -65
- package/dist/forms-BV5m5aQF.js.map +1 -0
- package/dist/{forms-numeric-B_jraJaQ.js → forms-numeric-Cd33AKbD.js} +288 -288
- package/dist/forms-numeric-Cd33AKbD.js.map +1 -0
- package/dist/{header-CGXuhcRm.js → header-BA697l4a.js} +14 -14
- package/dist/{header-CGXuhcRm.js.map → header-BA697l4a.js.map} +1 -1
- package/dist/hooks/useFormErrors.d.ts +1 -1
- package/dist/{hooks-Dkz0K2WT.js → hooks-BQ-L7Uu2.js} +2 -2
- package/dist/{hooks-Dkz0K2WT.js.map → hooks-BQ-L7Uu2.js.map} +1 -1
- package/dist/{icon-badge-DYKIwvOV.js → icon-badge-COWbCCWu.js} +3 -3
- package/dist/{icon-badge-DYKIwvOV.js.map → icon-badge-COWbCCWu.js.map} +1 -1
- package/dist/index.js +2 -2
- package/dist/input-Cdw4k0fb.js +289 -0
- package/dist/input-Cdw4k0fb.js.map +1 -0
- package/dist/{input-CZw8iU99.js → input-DOPL5_QE.js} +3 -3
- package/dist/{input-CZw8iU99.js.map → input-DOPL5_QE.js.map} +1 -1
- package/dist/item-BvZ2DR_x.js +277 -0
- package/dist/item-BvZ2DR_x.js.map +1 -0
- package/dist/layout/app-shell.js +1 -1
- package/dist/layout/auth.js +1 -1
- package/dist/layout/containers.js +1 -1
- package/dist/layout/header.js +1 -1
- package/dist/layout/hooks.js +1 -1
- package/dist/layout/navigation.js +1 -1
- package/dist/layout/page.js +1 -1
- package/dist/layout/settings.js +1 -1
- package/dist/layout/sidebar.js +2 -2
- package/dist/layout/workspace.js +1 -1
- package/dist/layout.js +10 -10
- package/dist/lib/affordance-geometry.generated.d.ts +6 -0
- package/dist/lib/ui-provider/types.d.ts +1 -1
- package/dist/lib/use-popup-focus-recovery.d.ts +8 -0
- package/dist/lib/utils.js +1 -1
- package/dist/{media-gallery-3zIVLMWH.js → media-gallery-CSl5W1Fy.js} +6 -6
- package/dist/{media-gallery-3zIVLMWH.js.map → media-gallery-CSl5W1Fy.js.map} +1 -1
- package/dist/{mentions-utuUvH1K.js → mentions-RKOQaaIB.js} +8 -8
- package/dist/{mentions-utuUvH1K.js.map → mentions-RKOQaaIB.js.map} +1 -1
- package/dist/{message-DZ_ruyUV.js → message-INU2xsxu.js} +4 -4
- package/dist/{message-DZ_ruyUV.js.map → message-INU2xsxu.js.map} +1 -1
- package/dist/metadata-list-qVV7AVxa.js +443 -0
- package/dist/metadata-list-qVV7AVxa.js.map +1 -0
- package/dist/{navigation-BzhHI3lo.js → navigation-BQNcg1jT.js} +8 -8
- package/dist/{navigation-BzhHI3lo.js.map → navigation-BQNcg1jT.js.map} +1 -1
- package/dist/{navigation-Bnotn4AQ.js → navigation-DLF3E1IC.js} +7 -7
- package/dist/{navigation-Bnotn4AQ.js.map → navigation-DLF3E1IC.js.map} +1 -1
- package/dist/{navigation-row-recipes-BFLCk_Aq.js → navigation-row-recipes-WZEs-hYo.js} +2 -2
- package/dist/{navigation-row-recipes-BFLCk_Aq.js.map → navigation-row-recipes-WZEs-hYo.js.map} +1 -1
- package/dist/{number-DbV1Dija.js → number-E_OiIfJz.js} +5 -5
- package/dist/{number-DbV1Dija.js.map → number-E_OiIfJz.js.map} +1 -1
- package/dist/{overflow-tab-bar-CWY7Nogn.js → overflow-tab-bar-CrbqMteP.js} +107 -105
- package/dist/overflow-tab-bar-CrbqMteP.js.map +1 -0
- package/dist/{overlays-DNWmZrJ4.js → overlays-BlKynmde.js} +322 -319
- package/dist/overlays-BlKynmde.js.map +1 -0
- package/dist/page-CIwNUtGr.js +227 -0
- package/dist/page-CIwNUtGr.js.map +1 -0
- package/dist/page-header-commands-DFMlNYzN.js +128 -0
- package/dist/page-header-commands-DFMlNYzN.js.map +1 -0
- package/dist/{pagination-BL25hu2s.js → pagination-Ch8X_47u.js} +5 -5
- package/dist/{pagination-BL25hu2s.js.map → pagination-Ch8X_47u.js.map} +1 -1
- package/dist/{popover-menu-B9WWygpa.js → popover-menu-BYaCdFhf.js} +6 -6
- package/dist/{popover-menu-B9WWygpa.js.map → popover-menu-BYaCdFhf.js.map} +1 -1
- package/dist/{popover-7_m66eYW.js → popover-uwzX2vo7.js} +65 -63
- package/dist/popover-uwzX2vo7.js.map +1 -0
- package/dist/{primitives-BFK08r9M.js → primitives-Du64iDbb.js} +6 -6
- package/dist/{primitives-BFK08r9M.js.map → primitives-Du64iDbb.js.map} +1 -1
- package/dist/primitives.js +4 -4
- package/dist/{progress-B1VnCT0K.js → progress-BvF2oCdV.js} +5 -5
- package/dist/{progress-B1VnCT0K.js.map → progress-BvF2oCdV.js.map} +1 -1
- package/dist/{receipt-BVSOH3Xo.js → receipt-D789Jwyy.js} +6 -6
- package/dist/{receipt-BVSOH3Xo.js.map → receipt-D789Jwyy.js.map} +1 -1
- package/dist/{rich-text-GOUyKQ-s.js → rich-text-CLJEf76s.js} +4 -4
- package/dist/{rich-text-GOUyKQ-s.js.map → rich-text-CLJEf76s.js.map} +1 -1
- package/dist/{rich-text-editor-cRLC-eBK.js → rich-text-editor-Cm1dpUpQ.js} +10 -10
- package/dist/{rich-text-editor-cRLC-eBK.js.map → rich-text-editor-Cm1dpUpQ.js.map} +1 -1
- package/dist/{rich-text-editor-toolbar-DfXg0-VC.js → rich-text-editor-toolbar-L__e4x47.js} +4 -4
- package/dist/{rich-text-editor-toolbar-DfXg0-VC.js.map → rich-text-editor-toolbar-L__e4x47.js.map} +1 -1
- package/dist/{scroll-area-DcI-M1UT.js → scroll-area-La5RXsEk.js} +2 -2
- package/dist/{scroll-area-DcI-M1UT.js.map → scroll-area-La5RXsEk.js.map} +1 -1
- package/dist/{separator-Bom7NsGO.js → separator-DAEV0w65.js} +2 -2
- package/dist/{separator-Bom7NsGO.js.map → separator-DAEV0w65.js.map} +1 -1
- package/dist/{separator-BDV-Y648.js → separator-GNfPG-90.js} +3 -3
- package/dist/{separator-BDV-Y648.js.map → separator-GNfPG-90.js.map} +1 -1
- package/dist/services/actions.js +1 -1
- package/dist/settings-BA2iboic.js +174 -0
- package/dist/settings-BA2iboic.js.map +1 -0
- package/dist/{sheet-CGpB3omz.js → sheet-DoAxTb2J.js} +75 -73
- package/dist/sheet-DoAxTb2J.js.map +1 -0
- package/dist/{sidebar-A0ElHINE.js → sidebar-ByqKR_W5.js} +13 -13
- package/dist/{sidebar-A0ElHINE.js.map → sidebar-ByqKR_W5.js.map} +1 -1
- package/dist/{sidebar-CPx_7YBa.js → sidebar-D2iSnGJ7.js} +11 -11
- package/dist/{sidebar-CPx_7YBa.js.map → sidebar-D2iSnGJ7.js.map} +1 -1
- package/dist/{skeleton-Byjnt7qr.js → skeleton-CUj8O5Bd.js} +3 -3
- package/dist/{skeleton-Byjnt7qr.js.map → skeleton-CUj8O5Bd.js.map} +1 -1
- package/dist/smart-card-CqkzQsK-.js +614 -0
- package/dist/smart-card-CqkzQsK-.js.map +1 -0
- package/dist/{structure-BmisBK-3.js → structure-C0V0_Fyf.js} +3 -3
- package/dist/{structure-BmisBK-3.js.map → structure-C0V0_Fyf.js.map} +1 -1
- package/dist/{structure.recipes-EPz60cU8.js → structure.recipes-BB4-n58V.js} +2 -2
- package/dist/{structure.recipes-EPz60cU8.js.map → structure.recipes-BB4-n58V.js.map} +1 -1
- package/dist/style.css +1 -1
- package/dist/{table-DsfzoUia.js → table-CpvnzJn9.js} +3 -3
- package/dist/{table-DsfzoUia.js.map → table-CpvnzJn9.js.map} +1 -1
- package/dist/{table-BweFy_P9.js → table-DH7rozUv.js} +19 -19
- package/dist/{table-BweFy_P9.js.map → table-DH7rozUv.js.map} +1 -1
- package/dist/{tabs-CDocW5D1.js → tabs-eqVsJZWO.js} +7 -7
- package/dist/{tabs-CDocW5D1.js.map → tabs-eqVsJZWO.js.map} +1 -1
- package/dist/{text-inputs-f9Ia-aCi.js → text-inputs-DXItiR0O.js} +101 -98
- package/dist/text-inputs-DXItiR0O.js.map +1 -0
- package/dist/{text.styles-g4He6UIW.js → text.styles-B64My8RZ.js} +25 -10
- package/dist/text.styles-B64My8RZ.js.map +1 -0
- package/dist/theme.css +152 -112
- package/dist/{timelines-CwM_9IhD.js → timelines-DmtztAY_.js} +10 -10
- package/dist/{timelines-CwM_9IhD.js.map → timelines-DmtztAY_.js.map} +1 -1
- package/dist/{tooltip-yiRJUFjp.js → tooltip-B4hjKtoV.js} +3 -3
- package/dist/{tooltip-yiRJUFjp.js.map → tooltip-B4hjKtoV.js.map} +1 -1
- package/dist/{tree-WnKQzwbq.js → tree-CV11PURP.js} +8 -8
- package/dist/{tree-WnKQzwbq.js.map → tree-CV11PURP.js.map} +1 -1
- package/dist/typography/rich-text.js +1 -1
- package/dist/typography-CSyJrh28.js +117 -0
- package/dist/typography-CSyJrh28.js.map +1 -0
- package/dist/typography.js +1 -1
- package/dist/{ui-provider-C_U0Xma4.js → ui-provider-CQCuCBcy.js} +3 -3
- package/dist/ui-provider-CQCuCBcy.js.map +1 -0
- package/dist/ui-provider.js +1 -1
- package/dist/{upload-CXyxmQBP.js → upload-C9SA0X-8.js} +11 -11
- package/dist/{upload-CXyxmQBP.js.map → upload-C9SA0X-8.js.map} +1 -1
- package/dist/{upload-queue-Boscubn9.js → upload-queue-DhQJiSRc.js} +9 -9
- package/dist/{upload-queue-Boscubn9.js.map → upload-queue-DhQJiSRc.js.map} +1 -1
- package/dist/{usage-card-BhO5eqkX.js → usage-card-DVTRDmGz.js} +134 -133
- package/dist/usage-card-DVTRDmGz.js.map +1 -0
- package/dist/use-popup-focus-recovery-C0QPvgOR.js +36 -0
- package/dist/use-popup-focus-recovery-C0QPvgOR.js.map +1 -0
- package/dist/{utils-BRhFDwuU.js → utils-CF3c95Io.js} +68 -5
- package/dist/utils-CF3c95Io.js.map +1 -0
- package/dist/value-inputs-C0o70p-U.js +980 -0
- package/dist/value-inputs-C0o70p-U.js.map +1 -0
- package/dist/{value-typography-BP8OG6h5.js → value-typography-ClupF0Gz.js} +2 -2
- package/dist/{value-typography-BP8OG6h5.js.map → value-typography-ClupF0Gz.js.map} +1 -1
- package/dist/workspace-9EFVXUyk.js +410 -0
- package/dist/workspace-9EFVXUyk.js.map +1 -0
- package/docs/consumer-skill/SKILL.md +14 -129
- package/docs/consumer-skill/examples/app-layout.tsx +22 -12
- package/docs/consumer-skill/examples/authentication.tsx +77 -0
- package/docs/consumer-skill/examples/edit.tsx +30 -38
- package/docs/consumer-skill/examples/manifest.json +51 -1
- package/docs/consumer-skill/examples/rhf-bindings.tsx +86 -0
- package/docs/consumer-skill/examples/rhf-edit-page.tsx +141 -0
- package/docs/consumer-skill/examples/rhf-overlay-form.tsx +92 -0
- package/docs/consumer-skill/examples/rhf-transport.tsx +28 -0
- package/docs/consumer-skill/references/agents-md.md +17 -7
- package/docs/consumer-skill/references/authentication.md +42 -0
- package/docs/consumer-skill/references/component-contracts.json +319824 -0
- package/docs/consumer-skill/references/composition-mapping.md +92 -0
- package/docs/consumer-skill/references/composition.md +43 -19
- package/docs/consumer-skill/references/design-contract.md +32 -0
- package/docs/consumer-skill/references/discovery.md +84 -7
- package/docs/consumer-skill/references/installation.md +45 -35
- package/docs/consumer-skill/references/integration.md +6 -2
- package/docs/consumer-skill/references/public-api.json +1520 -66
- package/docs/consumer-skill/references/review.md +9 -4
- package/docs/consumer-skill/references/rhf-workflows.md +86 -0
- package/docs/consumer-skill/references/screen-archetypes.md +22 -0
- package/docs/consumer-skill/references/theming.md +8 -9
- package/docs/consumer-skill/references/tokens.json +12 -3
- package/docs/consumer-skill/references/workflows.md +7 -5
- package/docs/consumer-skill/scripts/composition-schema.d.mts +2 -0
- package/docs/consumer-skill/scripts/composition-schema.mjs +32 -0
- package/docs/consumer-skill/scripts/composition.mjs +198 -0
- package/docs/consumer-skill/scripts/discovery.mjs +42 -10
- package/docs/consumer-skill/scripts/inspect-component.mjs +11 -0
- package/docs/consumer-skill/scripts/inspect-tokens.mjs +11 -0
- package/docs/consumer-skill/scripts/inspection.mjs +138 -0
- package/docs/consumer-skill/scripts/map-composition.mjs +12 -0
- package/docs/consumer-skill/scripts/setup-skills.mjs +76 -0
- package/docs/consumer-skills/themelia-components/SKILL.md +30 -0
- package/docs/consumer-skills/themelia-composition/SKILL.md +35 -0
- package/docs/consumer-skills/themelia-forms/SKILL.md +12 -0
- package/docs/consumer-skills/themelia-foundation/SKILL.md +14 -0
- package/docs/consumer-skills/themelia-tokenization/SKILL.md +35 -0
- package/package.json +6 -4
- package/templates/README.md +39 -0
- package/templates/admin-shell-template.tsx +382 -0
- package/templates/analytics-operations-template.tsx +376 -0
- package/templates/customers-template.tsx +509 -0
- package/templates/index.ts +29 -0
- package/templates/orders-template.tsx +1102 -0
- package/templates/products-template.tsx +834 -0
- package/templates/user-permissions-template.tsx +450 -0
- package/dist/action-menu-CllU52Mm.js +0 -280
- package/dist/action-menu-CllU52Mm.js.map +0 -1
- package/dist/affordance-geometry.generated-tF36bREk.js.map +0 -1
- package/dist/ai-artifact-DvTwDVyL.js.map +0 -1
- package/dist/app-shell-C4FhvCqF.js.map +0 -1
- package/dist/cards-BaBZR-AU.js.map +0 -1
- package/dist/checkbox-AWIhNhmo.js.map +0 -1
- package/dist/choice-inputs-CNHvARCJ.js.map +0 -1
- package/dist/combobox-C0EQW6dr.js.map +0 -1
- package/dist/combobox-xCQ2RMNE.js.map +0 -1
- package/dist/comments-BYYlTA8E.js.map +0 -1
- package/dist/containers-Mu1LMGV1.js +0 -103
- package/dist/containers-Mu1LMGV1.js.map +0 -1
- package/dist/data-display-DT_khPl_.js.map +0 -1
- package/dist/date-picker-ay0Pha_a.js.map +0 -1
- package/dist/date-pickers-Ccw8DL2b.js +0 -175
- package/dist/date-pickers-Ccw8DL2b.js.map +0 -1
- package/dist/form-field-CwH9y77i.js.map +0 -1
- package/dist/forms-B9G_xwzi.js.map +0 -1
- package/dist/forms-numeric-B_jraJaQ.js.map +0 -1
- package/dist/input-DQdEd0YD.js +0 -263
- package/dist/input-DQdEd0YD.js.map +0 -1
- package/dist/item-K5_ghvze.js +0 -275
- package/dist/item-K5_ghvze.js.map +0 -1
- package/dist/metadata-list-8N16ZMW_.js +0 -405
- package/dist/metadata-list-8N16ZMW_.js.map +0 -1
- package/dist/overflow-tab-bar-CWY7Nogn.js.map +0 -1
- package/dist/overlays-DNWmZrJ4.js.map +0 -1
- package/dist/page-Bgl1F560.js +0 -224
- package/dist/page-Bgl1F560.js.map +0 -1
- package/dist/page-header-commands-DOb6WsfD.js +0 -126
- package/dist/page-header-commands-DOb6WsfD.js.map +0 -1
- package/dist/popover-7_m66eYW.js.map +0 -1
- package/dist/settings-ybnjVwbd.js +0 -171
- package/dist/settings-ybnjVwbd.js.map +0 -1
- package/dist/sheet-CGpB3omz.js.map +0 -1
- package/dist/smart-card-DiC5aac3.js +0 -604
- package/dist/smart-card-DiC5aac3.js.map +0 -1
- package/dist/text-inputs-f9Ia-aCi.js.map +0 -1
- package/dist/text.styles-g4He6UIW.js.map +0 -1
- package/dist/typography-UTnveOEy.js +0 -117
- package/dist/typography-UTnveOEy.js.map +0 -1
- package/dist/ui-provider-C_U0Xma4.js.map +0 -1
- package/dist/usage-card-BhO5eqkX.js.map +0 -1
- package/dist/utils-BRhFDwuU.js.map +0 -1
- package/dist/value-inputs-DXPDjvBU.js +0 -963
- package/dist/value-inputs-DXPDjvBU.js.map +0 -1
- package/dist/workspace-Cdrg7k9f.js +0 -408
- package/dist/workspace-Cdrg7k9f.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"popover-uwzX2vo7.js","names":["Popover","PopoverPrimitive","React","PopoverContent","PopoverHeader","PopoverTitle","PopoverDescription","React","PopoverContentPrimitive","PopoverHeaderPrimitive","PopoverTitlePrimitive","PopoverDescriptionPrimitive","useThemePortalContainer","Text","anchoredPositionMethod","motionRecipes","Slot","Stack","surfaceDividerRecipes","surfaceInsetClasses","popoverRecipes","usePopupFocusRecovery","React$1","Popover$1","props","Popover","PopoverTrigger","slotRender","asChild","safeRender","render","_nativeButton","rest","renderProps","state","inferredNativeButton","children","resolvedNativeButton","nativeButton","PopoverAnchor","PopoverContent$1","disablePortal","resolvedContainer","container","recoverFocus","onFocusCapture","inlineHost","setInlineHost","content","cn","className","PopoverHeader$1","PopoverTitle$1","PopoverDescription$1","isSimpleText","value","PopoverSurfaceContext","PopoverContent","resolvedType","type","inset","PopoverHeader","surface","copyGap","textGap","band","menu","hasStart","start","PopoverTitle","compact","PopoverDescription","PopoverFooter","childrenAsCaption","caption"],"sources":["../src/components/ui/popover.tsx","../src/components/base/popover/popover.tsx"],"sourcesContent":["import { anchoredPositionMethod } from '../../lib/anchored-positioning';\nimport { usePopupFocusRecovery } from '../../lib/use-popup-focus-recovery';\nimport { motionRecipes } from '../../lib/motion-recipes';\nimport { useThemePortalContainer, type ThemePortalContainer } from '../../lib/theme-scope';\nimport { Popover as PopoverPrimitive } from \"@base-ui/react/popover\"\nimport * as React from \"react\"\n\nimport { Slot } from \"./slot\"\nimport { cn } from \"../../lib/utils\"\n\nfunction Popover({ ...props }: PopoverPrimitive.Root.Props) {\n return <PopoverPrimitive.Root data-slot=\"popover\" {...props} />\n}\n\nfunction PopoverTrigger({\n asChild = false,\n nativeButton,\n render,\n children,\n ...props\n}: PopoverPrimitive.Trigger.Props & { asChild?: boolean; nativeButton?: boolean }) {\n const slotRender = asChild ? <Slot /> : undefined\n const safeRender: PopoverPrimitive.Trigger.Props[\"render\"] = typeof render === \"function\"\n ? ((renderProps, state) => {\n const { nativeButton: _nativeButton, ...rest } = renderProps as Record<string, unknown>\n void _nativeButton\n return render(rest as typeof renderProps, state)\n })\n : render\n let inferredNativeButton = true\n if (asChild && React.isValidElement(children)) {\n if (typeof children.type === \"string\") {\n inferredNativeButton = children.type === \"button\"\n } else {\n const childProps = (children.props ?? {}) as Record<string, unknown>\n inferredNativeButton = !(\"href\" in childProps)\n }\n }\n const resolvedNativeButton = nativeButton ?? (asChild ? inferredNativeButton : true)\n return (\n <PopoverPrimitive.Trigger\n data-slot=\"popover-trigger\"\n render={slotRender ?? safeRender}\n nativeButton={resolvedNativeButton}\n {...props}\n >\n {children}\n </PopoverPrimitive.Trigger>\n )\n}\n\nfunction PopoverAnchor({\n asChild = false,\n ...props\n}: React.ComponentPropsWithoutRef<\"span\"> & { asChild?: boolean }) {\n if (asChild) {\n return <Slot {...props} />\n }\n\n return <span data-slot=\"popover-anchor\" {...props} />\n}\n\nfunction PopoverContent({\n className,\n container,\n anchor,\n align = \"center\",\n alignOffset = 0,\n side = \"bottom\",\n sideOffset = 4,\n disablePortal = false,\n positionMethod = disablePortal ? \"absolute\" : anchoredPositionMethod,\n onOpenAutoFocus,\n onInteractOutside,\n onFocusCapture,\n ...props\n}: PopoverPrimitive.Popup.Props &\n Pick<\n PopoverPrimitive.Positioner.Props,\n \"anchor\" | \"align\" | \"alignOffset\" | \"side\" | \"sideOffset\" | \"positionMethod\"\n > & {\n disablePortal?: boolean\n onOpenAutoFocus?: (event: Event) => void\n onInteractOutside?: (event: Event) => void\n } & { container?: ThemePortalContainer }) {\n const resolvedContainer = useThemePortalContainer(container)\n const recoverFocus = usePopupFocusRecovery(onFocusCapture)\n const [inlineHost, setInlineHost] = React.useState<HTMLDivElement | null>(null)\n void onOpenAutoFocus\n void onInteractOutside\n\n const content = (\n <PopoverPrimitive.Positioner\n anchor={anchor}\n positionMethod={positionMethod}\n align={align}\n alignOffset={alignOffset}\n side={side}\n sideOffset={sideOffset}\n className=\"isolate z-50\"\n >\n <PopoverPrimitive.Popup\n data-slot=\"popover-content\"\n className={cn(\n motionRecipes.popup,\n \"bg-popover text-popover-foreground ring-foreground/10 flex flex-col gap-space-xl rounded-radius p-surface text-sm shadow-md ring-1 z-50 w-72 origin-(--transform-origin) outline-hidden\",\n className\n )}\n {...props}\n onFocusCapture={recoverFocus}\n />\n </PopoverPrimitive.Positioner>\n )\n\n if (disablePortal) {\n // Base UI requires Portal context; a local host preserves inline DOM locality.\n return <div data-popover-inline-host=\"\" className=\"contents\" ref={setInlineHost}>\n <PopoverPrimitive.Portal container={inlineHost}>{content}</PopoverPrimitive.Portal>\n </div>\n }\n\n return <PopoverPrimitive.Portal container={resolvedContainer}>{content}</PopoverPrimitive.Portal>\n}\n\nfunction PopoverHeader({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"popover-header\"\n className={cn(\"flex flex-col text-sm\", className)}\n {...props}\n />\n )\n}\n\nfunction PopoverTitle({ className, ...props }: PopoverPrimitive.Title.Props) {\n return (\n <PopoverPrimitive.Title\n data-slot=\"popover-title\"\n className={cn(\"font-medium\", className)}\n {...props}\n />\n )\n}\n\nfunction PopoverDescription({\n className,\n ...props\n}: PopoverPrimitive.Description.Props) {\n return (\n <PopoverPrimitive.Description\n data-slot=\"popover-description\"\n className={cn(\"text-muted-foreground\", className)}\n {...props}\n />\n )\n}\n\nexport {\n Popover,\n PopoverAnchor,\n PopoverContent,\n PopoverDescription,\n PopoverHeader,\n PopoverTitle,\n PopoverTrigger,\n}\n","import { surfaceDividerRecipes } from '../../../lib/surface-recipes';\n/**\n * Popover — public wrapper around the internal Base UI popover implementation.\n *\n * What this layer adds on top of the primitive:\n * - Library-default `sideOffset` (6px) and an explicit inset contract:\n * card/multi-content popovers use `default`, item collections use\n * `compact`, and mixed region-owned compositions use `flush`.\n * - A consistent shadow + border treatment matching the rest of the\n * library (one semantic border, no extra primitive ring).\n * - Wraps the primitive parts with stable DOM hooks and adds a separated\n * footer region while preserving the compound-component pattern:\n * `<Popover>`, `<PopoverTrigger>`, `<PopoverContent>` exactly as\n * they would with the primitive.\n *\n * Use the shared inset role for padding; className owns placement. Override\n * `--surface-x` / `--surface-y` / `--space-scale` on a wrapper for surface-wide\n * density tweaks.\n */\nimport * as React from 'react';\n\nimport {\n\tPopover as PopoverPrimitive,\n\tPopoverAnchor,\n\tPopoverContent as PopoverContentPrimitive,\n\tPopoverDescription as PopoverDescriptionPrimitive,\n\tPopoverHeader as PopoverHeaderPrimitive,\n\tPopoverTitle as PopoverTitlePrimitive,\n\tPopoverTrigger,\n} from '../../ui/popover';\nimport { Text } from '../../typography';\nimport { Stack, type TextGap } from '../structure';\nimport { cn } from '../../../lib/utils';\nimport { popoverRecipes, surfaceInsetClasses, type PopoverContentType } from './popover.recipes';\nexport type { PopoverContentType } from './popover.recipes';\n\nfunction isSimpleText(value: React.ReactNode): value is string | number | bigint {\n\treturn typeof value === 'string' || typeof value === 'number' || typeof value === 'bigint';\n}\n\ntype PopoverContentBaseProps = React.ComponentProps<typeof PopoverContentPrimitive>;\n\nexport type PopoverContentInset = 'default' | 'compact' | 'flush';\n\nexport type PopoverContentProps = PopoverContentBaseProps & {\n\t/**\n\t * Surface inset role. `default` is for card-like or multi-content popovers,\n\t * `compact` for pure item/option collections, and `flush` when child regions\n\t * own their padding.\n\t */\n\tinset?: PopoverContentInset;\n\t/** Anatomy role; supplies the inferred inset only when inset is omitted. */\n\ttype?: PopoverContentType;\n};\n\nconst PopoverSurfaceContext = React.createContext({ type: 'display' as PopoverContentType, flush: false, regionOwned: false });\n\n/** Anchored content surface with a semantic inset role and package popover chrome. */\nfunction PopoverContent({\n\tclassName,\n\tsideOffset = 6,\n\tinset,\n\ttype,\n\tstyle,\n\t...props\n}: PopoverContentProps) {\n const resolvedType = type ?? (inset === 'compact' ? 'menu' : 'display');\n return (\n <PopoverSurfaceContext.Provider value={{ type: resolvedType, flush: inset === 'flush', regionOwned: false }}>\n\t\t<PopoverContentPrimitive\n\t\t\tdata-surface-type={resolvedType}\n\t\t\tsideOffset={sideOffset}\n\t\t\tclassName={cn('popover--component',\n\t\t\t\t// A popover is a small surface, not a compressed tooltip. The\n\t\t\t\t// unsuffixed surface token is the package-wide default and remains\n\t\t\t\t// responsive to scoped spacing changes.\n\t\t\t\t'gap-space-md max-h-[min(var(--available-height),calc(100dvh-2rem))] overflow-y-auto overscroll-contain',\n\t\t\t\tpopoverRecipes.surface,\n\t\t\t\tsurfaceInsetClasses[inset ?? (resolvedType === 'menu' ? 'compact' : 'default')],\n\t\t\t\t// Raw shadcn/Base UI buttons still carry a generic 1px press\n\t\t\t\t// translation. Popovers are stable anchored surfaces; moving a\n\t\t\t\t// calendar day or menu action makes the interaction feel soft.\n\t\t\t\t'[&_button]:active:translate-y-0!',\n\t\t\t\t// The shared recipe owns the semantic hairline border and shadow.\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\tstyle={style}\n\t\t\t{...props}\n\t\t/>\n </PopoverSurfaceContext.Provider>\n\t);\n}\n\ntype PopoverHeaderBaseProps = React.ComponentProps<typeof PopoverHeaderPrimitive> & {\n /** Leading control, aligned with collection highlight edges rather than label text. */\n start?: React.ReactNode;\n /** Copy rhythm. Defaults to dense for menus and normal for display surfaces. */\n textGap?: TextGap;\n};\n\nfunction PopoverHeader({ className, children, start, textGap, ...props }: PopoverHeaderBaseProps) {\n const surface = React.useContext(PopoverSurfaceContext);\n const copyGap = textGap ?? (surface.type === 'menu' ? 'dense' : 'normal');\n const band = surface.flush && !surface.regionOwned;\n const menu = surface.type === 'menu' && !surface.regionOwned;\n const hasStart = start != null && start !== false;\n return (\n\t\t<PopoverHeaderPrimitive\n\t\t\tclassName={cn(\n 'popover-header--component',\n copyGap === 'dense' ? 'gap-dense' : 'gap-normal',\n band && (surface.type === 'menu' ? popoverRecipes.menuRegion : popoverRecipes.display),\n !band && menu && 'py-row-y',\n hasStart && 'flex-row items-center gap-space-md',\n band && surfaceDividerRecipes.anchored.header,\n className,\n )}\n\t\t\t{...props}\n\t\t>\n <PopoverSurfaceContext.Provider value={{ ...surface, regionOwned: true }}>\n {start}\n <Stack gap={copyGap} className={cn('popover-header--body min-w-0 flex-1', menu && !hasStart && 'px-row-x')}>\n {children}\n </Stack>\n </PopoverSurfaceContext.Provider>\n </PopoverHeaderPrimitive>\n\t);\n}\n\ntype PopoverTitleBaseProps = React.ComponentProps<typeof PopoverTitlePrimitive>;\n\nfunction PopoverTitle({ children, className, ...props }: PopoverTitleBaseProps) {\n const compact = React.useContext(PopoverSurfaceContext).type === 'menu';\n return (\n\t\t<PopoverTitlePrimitive\n\t\t\tclassName={cn('popover-title--component', className)}\n\t\t\t{...props}\n\t\t>\n\t\t\t{isSimpleText(children) ? (\n\t\t\t\t<Text\n\t\t\t\t\ttag=\"span\"\n\t\t\t\t\ttype=\"inherit\"\n\t\t\t\t\tsize={compact ? undefined : 'base'}\n\t\t\t\t\tweight=\"semibold\"\n\t\t\t\t\tlineHeight=\"snug\"\n\t\t\t\t\tclassName=\"popover-title--text\"\n\t\t\t\t>\n\t\t\t\t\t{children}\n\t\t\t\t</Text>\n\t\t\t) : children}\n\t\t</PopoverTitlePrimitive>\n\t);\n}\n\ntype PopoverDescriptionBaseProps = React.ComponentProps<typeof PopoverDescriptionPrimitive>;\n\nfunction PopoverDescription({ children, className, ...props }: PopoverDescriptionBaseProps) {\n const compact = React.useContext(PopoverSurfaceContext).type === 'menu';\n return (\n\t\t<PopoverDescriptionPrimitive\n\t\t\tclassName={cn('popover-description--component', className)}\n\t\t\t{...props}\n\t\t>\n\t\t\t{isSimpleText(children) ? (\n\t\t\t\t<Text\n\t\t\t\t\ttag=\"span\"\n\t\t\t\t\ttype=\"secondary\"\n size={compact ? 'xs' : undefined}\n\t\t\t\t\tlineHeight={compact ? 'normal' : 'relaxed'}\n\t\t\t\t\tclassName=\"popover-description--text\"\n\t\t\t\t>\n\t\t\t\t\t{children}\n\t\t\t\t</Text>\n\t\t\t) : children}\n\t\t</PopoverDescriptionPrimitive>\n\t);\n}\n\ntype PopoverFooterProps = React.ComponentProps<'div'> & {\n /** Leading supporting content, aligned with collection labels; children are trailing actions. */\n caption?: React.ReactNode;\n};\n\nfunction PopoverFooter({ className, children, caption, ...props }: PopoverFooterProps) {\n const surface = React.useContext(PopoverSurfaceContext);\n const childrenAsCaption = caption == null && isSimpleText(children);\n const content = caption ?? (childrenAsCaption ? children : undefined);\n return (\n\t\t<Stack\n\t\t\tdirection=\"horizontal\"\n\t\t\tgap=\"sm\"\n\t\t\tjustify=\"end\"\n\t\t\twrap\n\t\t\tclassName={cn(\n\t\t\t\t'popover-footer--component pt-space-sm', surfaceDividerRecipes.anchored.footer,\n surface.flush && !surface.regionOwned && (surface.type === 'menu' ? popoverRecipes.menuRegion : popoverRecipes.display),\n\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t>\n <PopoverSurfaceContext.Provider value={{ ...surface, regionOwned: true }}>\n {content != null && <div className={cn('popover-footer--caption me-auto min-w-0 max-w-full', surface.type === 'menu' && !surface.regionOwned && 'px-row-x')}>\n {isSimpleText(content) ? <Text tag=\"span\" size=\"xs\" type=\"secondary\">{content}</Text> : content}\n </div>}\n {!childrenAsCaption && children}\n </PopoverSurfaceContext.Provider>\n </Stack>\n\t);\n}\n\nexport {\n\tPopoverPrimitive as Popover,\n\tPopoverAnchor,\n\tPopoverContent,\n\tPopoverDescription,\n\tPopoverFooter,\n\tPopoverHeader,\n\tPopoverTitle,\n\tPopoverTrigger,\n};\n"],"mappings":";;;;;;;;;;;;;;;AAUA,SAASA,EAAQ,EAAE,GAAGwB,KAAsC;CAC1D,OAAO,kBAACvB,EAAiB,MAAlB;EAAuB,aAAU;EAAU,GAAIuB;CAAQ,CAAA;AAChE;AAEA,SAASE,EAAe,EACtB,aAAU,IACV,iBACA,WACA,aACA,GAAGF,KAC8E;CACjF,IAAMG,IAAaC,IAAU,kBAACZ,GAAD,CAAO,CAAA,IAAI,KAAA,GAClCa,IAAuD,OAAOC,KAAW,eACzE,GAAa,MAAU;EACzB,IAAM,EAAE,cAAcC,GAAe,GAAGC,MAASC;EAEjD,OAAOH,EAAOE,GAA4BE,CAAK;CACjD,KACEJ,GACAK,IAAuB;CAC3B,AAAIP,KAAW1B,EAAM,eAAekC,CAAQ,MAC1C,AAIED,IAJE,OAAOC,EAAS,QAAS,WACJA,EAAS,SAAS,WAGlB,EAAE,WADLA,EAAS,SAAS,CAAC;CAI3C,IAAMC,IAAuBC,MAAiB,MAAUH;CACxD,OACE,kBAAClC,EAAiB,SAAlB;EACE,aAAU;EACV,QAAQ0B,KAAcE;EACtB,cAAcQ;EACd,GAAIb;EAEH;CACuB,CAAA;AAE9B;AAEA,SAASe,EAAc,EACrB,aAAU,IACV,GAAGf,KAC8D;CAKjE,OAJII,IACK,kBAACZ,GAAD,EAAM,GAAIQ,EAAQ,CAAA,IAGpB,kBAAC,QAAD;EAAM,aAAU;EAAiB,GAAIA;CAAQ,CAAA;AACtD;AAEA,SAASrB,EAAe,EACtB,cACA,cACA,WACA,WAAQ,UACR,iBAAc,GACd,UAAO,UACP,gBAAa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;IAAE,GAAGM;IAAS,aAAa;GAAK;GAAvE,UAAA,CACEd,KAAW,QAAQ,kBAAC,OAAD;IAAK,WAAWC,EAAG,sDAAsDa,EAAQ,SAAS,UAAU,CAACA,EAAQ,eAAe,UAAU;IACxJ,UAAAR,EAAaN,CAAO,IAAI,kBAACnC,GAAD;KAAM,KAAI;KAAO,MAAK;KAAK,MAAK;KAAa,UAAAmC;IAAc,CAAA,IAAIA;GACpF,CAAA,GACJ,CAACyB,KAAqBrC,CACQ;;CAC1B,CAAA;AAET"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { c as e, m as t } from "./ui-provider-
|
|
3
|
-
import { t as n } from "./utils-
|
|
4
|
-
import { c as r, i, l as a, r as o, u as s } from "./typography-
|
|
5
|
-
import {
|
|
6
|
-
import { n as l, o as u, r as d, t as f } from "./value-typography-
|
|
2
|
+
import { c as e, m as t } from "./ui-provider-CQCuCBcy.js";
|
|
3
|
+
import { t as n } from "./utils-CF3c95Io.js";
|
|
4
|
+
import { c as r, i, l as a, r as o, u as s } from "./typography-CSyJrh28.js";
|
|
5
|
+
import { i as c } from "./text.styles-B64My8RZ.js";
|
|
6
|
+
import { n as l, o as u, r as d, t as f } from "./value-typography-ClupF0Gz.js";
|
|
7
7
|
import { t as p } from "./initials-format-CDoQEOd_.js";
|
|
8
8
|
import "react";
|
|
9
9
|
import { Fragment as m, jsx as h, jsxs as g } from "react/jsx-runtime";
|
|
@@ -377,4 +377,4 @@ function ae({ width: t, height: i, depth: a, unit: o, separator: s = " × ", loc
|
|
|
377
377
|
//#endregion
|
|
378
378
|
export { S as _, Z as a, W as c, R as d, L as f, C as g, w as h, te as i, K as l, T as m, $ as n, H as o, E as p, re as r, B as s, ae as t, z as u };
|
|
379
379
|
|
|
380
|
-
//# sourceMappingURL=primitives-
|
|
380
|
+
//# sourceMappingURL=primitives-Du64iDbb.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"primitives-BFK08r9M.js","names":["_Fragment","useFormattingConfig","useTypographyConfig","cn","Text","RunningTextContext","inlineLinkClassName","useInRunningText","resolveTextClassNames","useValueTypography","formatWithMinusSign","formatDuration","emptyValueTypography","formatInitials","Fragment$1","VALUE_ROLE","SECONDARY_ROLE","MONO_ROLE","isEmptyValue","children","ValueText","props","resolved","valueRole","empty","typography","weight","numeric","hookClassName","className","emptyLabel","Value","SecondaryValue","MutedValue","MonoValue","EmptyValue","WORD_SEPARATOR","NAME_CONNECTOR","LETTER_MATCHER","LETTERS_MATCHER","normalizeNameWhitespace","value","getLetters","getFirstLetter","match","isFormattedSegment","first","segment","letters","isAllUpper","isAllLower","isFormattedName","word","formatNameSegment","before","after","formatNameWord","formatName","normalized","options","Name","rawValue","content","Initials","Link","inText","defaultTextSize","linkUnderlineClassName","EmptyContact","_href","_target","_rel","_download","_hrefLang","_ping","_referrerPolicy","_media","_type","spanProps","contactProps","Email","query","subject","body","href","display","normalizeTel","Phone","normalizeUrl","Url","isExternal","external","resolvedTarget","target","resolvedRel","rel","FILE_SIZE_ROLE","FILE_SIZE_UNITS","FILE_SIZE_UNIT_MULTIPLIER","normalizeFileSizeValue","from","formatFileSize","locale","bytes","displayValue","unitIndex","FileSize","formatting","label","DURATION_ROLE","Duration","maximumFractionDigits","DIMENSIONS_ROLE","parseDimensionPart","parsed","formatDimensions","parsedWidth","width","parsedHeight","height","parsedDepth","depth","formatter","values","separator","unit","Dimensions","index","part"],"sources":["../src/components/primitives/value.tsx","../src/components/primitives/name.tsx","../src/components/primitives/initials.tsx","../src/components/primitives/link.tsx","../src/components/primitives/file-size.tsx","../src/components/primitives/duration.tsx","../src/components/primitives/dimensions.tsx"],"sourcesContent":["import { type ComponentPropsWithoutRef, type ReactNode, type Ref } from 'react';\n\nimport { Text, type TextProps } from '../typography';\nimport type { TextSize } from '../../lib/ui-provider';\nimport { EMPTY } from '../../lib/format';\nimport { cn } from '../../lib/utils';\n\nimport { emptyValueTypography, useValueTypography, type ValueTypographyRole } from './value-typography';\n\ntype SpanProps = Omit<ComponentPropsWithoutRef<'span'>, 'children' | 'color'>;\n/** Value colour roles: foreground, secondary, or the surrounding text colour. */\nexport type ValueType = Extract<TextProps['type'], 'main' | 'secondary' | 'inherit'>;\n\nexport interface ValueProps extends SpanProps {\n\tchildren?: ReactNode;\n\t/** Rendered with the shared empty treatment when children are absent. Defaults to an em dash. */\n\temptyLabel?: ReactNode;\n\t/**\n\t * Text size. A standalone value uses the provider text size; inside running\n\t * text (`Text`, `Heading`, labels, links, other values) it inherits the size.\n\t */\n\tsize?: TextSize;\n\talign?: TextProps['align'];\n\t/** Font weight. Defaults to the component's role weight; inside running text, the surrounding weight. */\n\tweight?: TextProps['weight'];\n\t/** Colour role. Defaults to the component's role; inside running text `Value` and `MonoValue` take the surrounding colour. */\n\ttype?: ValueType;\n\t/** Line height. Defaults to the role leading; inside running text, the surrounding leading. */\n\tlineHeight?: TextProps['lineHeight'];\n\tref?: Ref<HTMLSpanElement>;\n}\n\nconst VALUE_ROLE: ValueTypographyRole = { type: 'main', weight: 'regular' };\nconst SECONDARY_ROLE: ValueTypographyRole = { type: 'secondary', weight: 'regular', keepType: true };\nconst MONO_ROLE: ValueTypographyRole = { type: 'main', weight: 'medium', inTextLineHeight: 'none' };\n\nfunction isEmptyValue(children: ReactNode) {\n\treturn children === null || children === undefined || children === '';\n}\n\ninterface ValueTextProps extends ValueProps {\n\tvalueRole: ValueTypographyRole;\n\thookClassName: string;\n\tnumeric?: boolean;\n}\n\n/** Shared span for the value family: role resolution plus the empty treatment. */\nfunction ValueText({ valueRole, hookClassName, numeric = false, children, emptyLabel = EMPTY, size, align, weight, type, lineHeight, className, ref, ...props }: ValueTextProps) {\n\tconst resolved = useValueTypography({ size, type, weight, lineHeight }, valueRole);\n\tconst empty = isEmptyValue(children);\n\tconst typography = empty ? emptyValueTypography(resolved, weight) : resolved;\n\treturn (\n\t\t<Text\n\t\t\tref={ref}\n\t\t\ttag=\"span\"\n\t\t\tsize={typography.size}\n\t\t\talign={align}\n\t\t\tweight={typography.weight}\n\t\t\ttype={typography.type}\n\t\t\tlineHeight={typography.lineHeight}\n\t\t\tnumeric={numeric && !empty}\n\t\t\tclassName={cn(hookClassName, className)}\n\t\t\t{...props}\n\t\t>\n\t\t\t{empty ? emptyLabel : children}\n\t\t</Text>\n\t);\n}\n\n/**\n * An ordinary displayed fact: foreground, regular weight. Inside running text it\n * takes the sentence's size, colour and weight.\n */\nexport function Value(props: ValueProps) {\n\treturn <ValueText {...props} valueRole={VALUE_ROLE} hookClassName=\"value--component inline min-w-0\" />;\n}\n\n/** Supporting detail in the secondary colour. Inside running text it keeps the colour and takes the size and weight. */\nexport function SecondaryValue(props: ValueProps) {\n\treturn <ValueText {...props} valueRole={SECONDARY_ROLE} hookClassName=\"secondary-value--component inline min-w-0\" />;\n}\n\n/** A quiet note using the shared secondary foreground. */\nexport function MutedValue(props: ValueProps) {\n\treturn <ValueText {...props} valueRole={SECONDARY_ROLE} hookClassName=\"muted-value--component inline min-w-0\" />;\n}\n\n/**\n * An identifier or code (SKU, reference, tracking number, key) in the monospace\n * family. Standalone it is foreground medium at the provider size; inside running\n * text only the family changes, so an SKU in a description matches the words\n * around it. Amounts and dates belong to the number primitives, which keep the\n * sans font with tabular figures.\n */\nexport function MonoValue(props: ValueProps) {\n\treturn <ValueText {...props} valueRole={MONO_ROLE} numeric hookClassName=\"mono-value--component inline min-w-0 break-words\" />;\n}\n\nexport interface EmptyValueProps extends Omit<ValueProps, 'emptyLabel'> {\n\tref?: Ref<HTMLSpanElement>;\n}\n\n/**\n * An intentionally absent value: secondary colour, regular weight. Every value\n * primitive renders its missing state with this treatment.\n */\nexport function EmptyValue({ children = EMPTY, ...props }: EmptyValueProps) {\n\treturn <ValueText {...props} valueRole={SECONDARY_ROLE} emptyLabel={EMPTY} hookClassName=\"empty-value--component inline min-w-0\">{children}</ValueText>;\n}\n","import { type ReactNode } from 'react';\n\nimport { cn } from '../../lib/utils';\n\nimport { Value, type ValueProps } from './value';\n\nconst WORD_SEPARATOR = /(\\s+)/u;\nconst NAME_CONNECTOR = /([-'])/u;\nconst LETTER_MATCHER = /\\p{L}/u;\nconst LETTERS_MATCHER = /\\p{L}/gu;\n\nexport interface NameFormatOptions {\n\t/** Force title-casing even when the name already looks intentionally cased. */\n\tforce?: boolean;\n}\n\nexport interface NameProps extends Omit<ValueProps, 'children'> {\n\t/** Raw name value to normalize for display. */\n\tvalue?: string | null;\n\t/** String children are normalized when value is not provided. */\n\tchildren?: ReactNode;\n\t/** Force title-casing even when the name already looks intentionally cased. */\n\tforce?: boolean;\n}\n\nfunction normalizeNameWhitespace(value: string) {\n\treturn value.trim().replace(/\\s+/g, ' ');\n}\n\nfunction getLetters(value: string) {\n\treturn value.match(LETTERS_MATCHER)?.join('') ?? '';\n}\n\nfunction getFirstLetter(value: string) {\n\tconst match = LETTER_MATCHER.exec(value);\n\tif (!match) return null;\n\treturn {\n\t\tindex: match.index,\n\t\tvalue: match[0],\n\t};\n}\n\nfunction isFormattedSegment(segment: string) {\n\tconst first = getFirstLetter(segment);\n\tif (!first) return true;\n\n\tconst letters = getLetters(segment);\n\tif (letters.length <= 1) return first.value === first.value.toLocaleUpperCase();\n\n\tconst isAllUpper = letters === letters.toLocaleUpperCase();\n\tconst isAllLower = letters === letters.toLocaleLowerCase();\n\n\treturn first.value === first.value.toLocaleUpperCase() && !isAllUpper && !isAllLower;\n}\n\nfunction isFormattedName(value: string) {\n\treturn normalizeNameWhitespace(value)\n\t\t.split(WORD_SEPARATOR)\n\t\t.filter((word) => word.trim() !== '')\n\t\t.every((word) =>\n\t\t\tword\n\t\t\t\t.split(NAME_CONNECTOR)\n\t\t\t\t.filter((segment) => segment !== '-' && segment !== \"'\")\n\t\t\t\t.every(isFormattedSegment),\n\t\t);\n}\n\nfunction formatNameSegment(segment: string) {\n\tconst first = getFirstLetter(segment);\n\tif (!first) return segment;\n\n\tconst before = segment.slice(0, first.index);\n\tconst after = segment.slice(first.index + first.value.length);\n\n\treturn `${before}${first.value.toLocaleUpperCase()}${after.toLocaleLowerCase()}`;\n}\n\nfunction formatNameWord(word: string) {\n\treturn word\n\t\t.split(NAME_CONNECTOR)\n\t\t.map((segment) => (segment === '-' || segment === \"'\" ? segment : formatNameSegment(segment)))\n\t\t.join('');\n}\n\nexport function formatName(value: string | null | undefined, options: NameFormatOptions = {}) {\n\tif (value === null || value === undefined) return '';\n\n\tconst normalized = normalizeNameWhitespace(value);\n\tif (!normalized) return '';\n\tif (!options.force && isFormattedName(normalized)) return normalized;\n\n\treturn normalized\n\t\t.split(WORD_SEPARATOR)\n\t\t.map((word) => (word.trim() === '' ? word : formatNameWord(word)))\n\t\t.join('');\n}\n\nexport function Name({\n\tvalue,\n\tchildren,\n\tforce,\n\tclassName,\n\tref,\n\t...props\n}: NameProps) {\n\tconst rawValue = value ?? (typeof children === 'string' ? children : undefined);\n\tconst content = rawValue === undefined ? children : formatName(rawValue, { force });\n\n\treturn (\n\t\t<Value ref={ref} className={cn('name--component', className)} {...props}>\n\t\t\t{content}\n\t\t</Value>\n\t);\n}\n","import { cn } from '../../lib/utils';\n\nimport { Value, type ValueProps } from './value';\nimport {\n\tformatInitials,\n\ttype InitialsMaxCharacters,\n\ttype InitialsStrategy,\n} from './initials-format';\n\nexport interface InitialsProps extends Omit<ValueProps, 'children'> {\n\t/** Person, organization, or resource name used to derive initials. */\n\tvalue?: string | null;\n\t/** First + last word by default; use first-words to preserve the first N words. */\n\tstrategy?: InitialsStrategy;\n\t/** Maximum visible characters. Defaults to 2. */\n\tmaxCharacters?: InitialsMaxCharacters;\n\t/** Optional BCP-47 locale used for locale-sensitive uppercasing. */\n\tlocale?: string;\n\t/** Returned when no usable letter or number exists. Defaults to an empty string. */\n\tfallback?: string;\n\t/** Defaults to `inherit`: the avatar or chip that hosts the initials owns their size. */\n\tsize?: ValueProps['size'];\n\t/** Defaults to `inherit`: the host owns the colour, such as an avatar fallback tone. */\n\ttype?: ValueProps['type'];\n\t/** Defaults to `inherit`: the host owns the weight. */\n\tweight?: ValueProps['weight'];\n}\n\n/**\n * Semantic displayed initials for identities and avatar fallbacks. They take the\n * size, colour and weight of the avatar or chip that hosts them.\n */\nexport function Initials({\n\tvalue,\n\tstrategy,\n\tmaxCharacters,\n\tlocale,\n\tfallback,\n\tsize = 'inherit',\n\ttype = 'inherit',\n\tweight = 'inherit',\n\tclassName,\n\tref,\n\t...props\n}: InitialsProps) {\n\treturn (\n\t\t<Value\n\t\t\tref={ref}\n\t\t\t{...props}\n\t\t\tsize={size}\n\t\t\ttype={type}\n\t\t\tweight={weight}\n\t\t\tclassName={cn('initials--component', className)}\n\t\t>\n\t\t\t{formatInitials(value, {\n\t\t\t\tstrategy,\n\t\t\t\tmaxCharacters,\n\t\t\t\tlocale,\n\t\t\t\tfallback,\n\t\t\t})}\n\t\t</Value>\n\t);\n}\n","import { type AnchorHTMLAttributes, type ReactNode, type Ref } from 'react';\n\nimport { useTypographyConfig } from '../../lib/ui-provider';\nimport { EMPTY } from '../../lib/format';\nimport { cn } from '../../lib/utils';\nimport { RunningTextContext, useInRunningText } from '../typography/running-text';\nimport { inlineLinkClassName, linkUnderlineClassName } from '../typography/text-link';\nimport { resolveTextClassNames } from '../typography/text.styles';\n\nimport { EmptyValue } from './value';\n\nexport interface LinkProps extends AnchorHTMLAttributes<HTMLAnchorElement> {\n\tchildren?: ReactNode;\n\t/** Rendered instead of a dead link when there is nothing to show. Defaults to an em dash. */\n\temptyLabel?: ReactNode;\n\tref?: Ref<HTMLAnchorElement>;\n}\n\n/**\n * Link-coloured inline value. Standalone it uses the provider text size with an\n * underline on hover. Inside running text it takes the sentence's size, weight\n * and leading and stays underlined, because colour alone does not set a link\n * apart from the words around it.\n */\nexport function Link({\n\tchildren,\n\temptyLabel = EMPTY,\n\tclassName,\n\tref,\n\t...props\n}: LinkProps) {\n\tconst inText = useInRunningText();\n\tconst { defaultTextSize } = useTypographyConfig();\n\tconst content =\n\t\tchildren === null || children === undefined || children === '' ? emptyLabel : children;\n\n\treturn (\n\t\t<a\n\t\t\tref={ref}\n\t\t\tdata-typography=\"link\"\n\t\t\tclassName={cn(\n\t\t\t\tresolveTextClassNames({\n\t\t\t\t\ttype: null,\n\t\t\t\t\tsize: inText ? 'inherit' : defaultTextSize,\n\t\t\t\t\tweight: null,\n\t\t\t\t\talign: null,\n\t\t\t\t\tlineHeight: inText ? null : 'normal',\n\t\t\t\t}),\n\t\t\t\t'link--component text-link-color wrap-anywhere',\n\t\t\t\tinlineLinkClassName,\n\t\t\t\tinText ? `${linkUnderlineClassName} hover:decoration-transparent` : 'no-underline underline-offset-[0.2em] hover:underline',\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t>\n\t\t\t<RunningTextContext.Provider value>{content}</RunningTextContext.Provider>\n\t\t</a>\n\t);\n}\n\ntype ContactSpanProps = Omit<LinkProps, 'children' | 'emptyLabel' | 'ref' | 'href' | 'target' | 'rel' | 'download' | 'hrefLang' | 'ping' | 'referrerPolicy' | 'media' | 'type'>;\n\n/**\n * The missing contact value: the shared empty treatment, never a dead link.\n * Global attributes (ARIA, data, id, title) still reach the rendered span.\n */\nfunction EmptyContact({ className, emptyLabel, ref, contactProps }: { className: string; emptyLabel: ReactNode; ref?: Ref<HTMLElement>; contactProps: LinkProps }) {\n\tconst { href: _href, target: _target, rel: _rel, download: _download, hrefLang: _hrefLang, ping: _ping, referrerPolicy: _referrerPolicy, media: _media, type: _type, ...spanProps } = contactProps;\n\treturn <EmptyValue {...(spanProps as ContactSpanProps)} ref={ref as Ref<HTMLSpanElement>} className={className}>{emptyLabel}</EmptyValue>;\n}\n\nexport interface EmailProps extends Omit<LinkProps, 'href' | 'children' | 'ref'> {\n\tvalue?: string | null;\n\tdisplay?: ReactNode;\n\tsubject?: string;\n\tbody?: string;\n\tref?: Ref<HTMLElement>;\n}\n\nexport function Email({\n\tvalue,\n\tdisplay,\n\tsubject,\n\tbody,\n\tclassName,\n\temptyLabel = EMPTY,\n\tref,\n\t...props\n}: EmailProps) {\n\tif (!value) return <EmptyContact ref={ref} className={cn('email--component', className)} emptyLabel={emptyLabel} contactProps={props} />;\n\n\tconst query = new URLSearchParams();\n\tif (subject) query.set('subject', subject);\n\tif (body) query.set('body', body);\n\tconst href = `mailto:${value}${query.size ? `?${query.toString()}` : ''}`;\n\n\treturn (\n\t\t<Link ref={ref as Ref<HTMLAnchorElement>} className={cn('email--component', className)} href={href} emptyLabel={emptyLabel} {...props}>\n\t\t\t{display ?? value}\n\t\t</Link>\n\t);\n}\n\nexport interface PhoneProps extends Omit<LinkProps, 'href' | 'children' | 'ref'> {\n\tvalue?: string | null;\n\tdisplay?: ReactNode;\n\tref?: Ref<HTMLElement>;\n}\n\nfunction normalizeTel(value: string) {\n\treturn value.replace(/[^\\d+*#;,.]/g, '');\n}\n\nexport function Phone({\n\tvalue,\n\tdisplay,\n\tclassName,\n\temptyLabel = EMPTY,\n\tref,\n\t...props\n}: PhoneProps) {\n\tif (!value) return <EmptyContact ref={ref} className={cn('phone--component', className)} emptyLabel={emptyLabel} contactProps={props} />;\n\n\treturn (\n\t\t<Link ref={ref as Ref<HTMLAnchorElement>} className={cn('phone--component', className)} href={`tel:${normalizeTel(value)}`} emptyLabel={emptyLabel} {...props}>\n\t\t\t{display ?? value}\n\t\t</Link>\n\t);\n}\n\nexport interface UrlProps extends Omit<LinkProps, 'href' | 'children' | 'ref'> {\n\tvalue?: string | null;\n\tdisplay?: ReactNode;\n\texternal?: boolean;\n\tref?: Ref<HTMLElement>;\n}\n\nfunction normalizeUrl(value: string) {\n\tif (/^[a-z][a-z\\d+\\-.]*:/i.test(value) || value.startsWith('/') || value.startsWith('#')) return value;\n\treturn `https://${value}`;\n}\n\nexport function Url({\n\tvalue,\n\tdisplay,\n\texternal,\n\ttarget,\n\trel,\n\tclassName,\n\temptyLabel = EMPTY,\n\tref,\n\t...props\n}: UrlProps) {\n\tif (!value) return <EmptyContact ref={ref} className={cn('url--component', className)} emptyLabel={emptyLabel} contactProps={{ ...props, target, rel }} />;\n\n\tconst href = normalizeUrl(value);\n\tconst isExternal = external ?? /^https?:\\/\\//i.test(href);\n\tconst resolvedTarget = target ?? (isExternal ? '_blank' : undefined);\n\tconst resolvedRel = rel ?? (isExternal ? 'noreferrer' : undefined);\n\n\treturn (\n\t\t<Link\n\t\t\tref={ref as Ref<HTMLAnchorElement>}\n\t\t\tclassName={cn('url--component', className)}\n\t\t\thref={href}\n\t\t\ttarget={resolvedTarget}\n\t\t\trel={resolvedRel}\n\t\t\temptyLabel={emptyLabel}\n\t\t\t{...props}\n\t\t>\n\t\t\t{display ?? value}\n\t\t</Link>\n\t);\n}\n","import { type ComponentPropsWithoutRef, type ReactNode, type Ref } from 'react';\n\nimport { Text, type TextProps } from '../typography';\nimport type { TextSize } from '../../lib/ui-provider';\nimport { EMPTY } from '../../lib/format';\nimport { useFormattingConfig } from '../../lib/ui-provider';\nimport { cn } from '../../lib/utils';\n\nimport { emptyValueTypography, useValueTypography, type ValueTypographyRole } from './value-typography';\n\ntype SpanProps = Omit<ComponentPropsWithoutRef<'span'>, 'children' | 'color'>;\n\nexport type FileSizeUnit = 'bytes' | 'kb' | 'mb' | 'gb' | 'tb';\n\nexport interface FileSizeProps extends SpanProps {\n\tvalue?: number | null;\n\tfrom?: FileSizeUnit;\n\tlocale?: string;\n\t/** Rendered with the shared empty treatment when the value is absent or not positive. Defaults to an em dash. */\n\temptyLabel?: ReactNode;\n\t/** Text size. Defaults to the provider text size; inside running text, the surrounding size. */\n\tsize?: TextSize;\n\t/** Text alignment. Defaults to `right` so columns of sizes line up. */\n\talign?: TextProps['align'];\n\t/** Font weight. Defaults to `regular`; inside running text, the surrounding weight. */\n\tweight?: TextProps['weight'];\n\t/** Colour role. Defaults to `main`; inside running text, the surrounding colour. */\n\ttype?: TextProps['type'];\n\tref?: Ref<HTMLSpanElement>;\n}\n\nconst FILE_SIZE_ROLE: ValueTypographyRole = { type: 'main', weight: 'regular' };\n\nconst FILE_SIZE_UNITS = ['B', 'KB', 'MB', 'GB', 'TB'] as const;\nconst FILE_SIZE_UNIT_MULTIPLIER: Record<FileSizeUnit, number> = {\n\tbytes: 1,\n\tkb: 1024,\n\tmb: 1024 ** 2,\n\tgb: 1024 ** 3,\n\ttb: 1024 ** 4,\n};\n\nexport interface FileSizeFormatOptions {\n\tfrom?: FileSizeUnit;\n\tlocale?: string;\n}\n\nfunction normalizeFileSizeValue(value?: number | null, from: FileSizeUnit = 'bytes') {\n\tif (typeof value !== 'number' || !Number.isFinite(value) || value <= 0) return null;\n\treturn value * FILE_SIZE_UNIT_MULTIPLIER[from];\n}\n\nexport function formatFileSize(\n\tvalue?: number | null,\n\toptions?: FileSizeFormatOptions | string,\n): string | null {\n\tconst locale = typeof options === 'string' ? options : options?.locale;\n\tconst from = typeof options === 'string' ? 'bytes' : options?.from ?? 'bytes';\n\tconst bytes = normalizeFileSizeValue(value, from);\n\tif (bytes === null) return null;\n\n\tlet displayValue = bytes;\n\tlet unitIndex = 0;\n\twhile (displayValue >= 1024 && unitIndex < FILE_SIZE_UNITS.length - 1) {\n\t\tdisplayValue /= 1024;\n\t\tunitIndex += 1;\n\t}\n\n\tconst formattedValue = new Intl.NumberFormat(locale, {\n\t\tmaximumFractionDigits: unitIndex === 0 ? 0 : 1,\n\t\tminimumFractionDigits: 0,\n\t}).format(displayValue);\n\n\treturn `${formattedValue} ${FILE_SIZE_UNITS[unitIndex]}`;\n}\n\n/** A byte count in the largest readable unit, sans UI font with tabular figures. */\nexport function FileSize({\n\tvalue,\n\tfrom = 'bytes',\n\tlocale,\n\temptyLabel = EMPTY,\n\tsize,\n\talign = 'right',\n\tweight,\n\ttype,\n\tclassName,\n\tref,\n\t...props\n}: FileSizeProps) {\n\tconst formatting = useFormattingConfig();\n\tconst resolved = useValueTypography({ size, type, weight }, FILE_SIZE_ROLE);\n\tconst label = formatFileSize(value, { from, locale: locale ?? formatting.locale });\n\tconst typography = label === null ? emptyValueTypography(resolved, weight) : resolved;\n\n\treturn (\n\t\t<Text\n\t\t\tref={ref}\n\t\t\ttag=\"span\"\n\t\t\tsize={typography.size}\n\t\t\talign={align}\n\t\t\tweight={typography.weight}\n\t\t\ttype={typography.type}\n\t\t\tlineHeight={typography.lineHeight}\n\t\t\tclassName={cn('file-size--component inline tabular-nums', className)}\n\t\t\t{...props}\n\t\t>\n\t\t\t{label ?? emptyLabel}\n\t\t</Text>\n\t);\n}\n","import { type ComponentPropsWithoutRef, type ReactNode, type Ref } from 'react';\n\nimport { Text, type TextProps } from '../typography';\nimport type { TextSize } from '../../lib/ui-provider';\nimport {\n\tEMPTY,\n\tformatDuration,\n\ttype DurationUnit,\n\ttype DurationUnitDisplay,\n} from '../../lib/format';\nimport { useFormattingConfig } from '../../lib/ui-provider';\nimport { cn } from '../../lib/utils';\n\nimport { emptyValueTypography, useValueTypography, type ValueTypographyRole } from './value-typography';\n\ntype SpanProps = Omit<ComponentPropsWithoutRef<'span'>, 'children' | 'color'>;\n\nexport interface DurationProps extends SpanProps {\n\tvalue?: number | null;\n\tfrom?: DurationUnit;\n\tlocale?: string;\n\tmaxParts?: number;\n\tunitDisplay?: DurationUnitDisplay;\n\tminimumFractionDigits?: number;\n\tmaximumFractionDigits?: number;\n\t/** Rendered with the shared empty treatment when the value is absent. Defaults to an em dash. */\n\temptyLabel?: ReactNode;\n\t/** Text size. Defaults to the provider text size; inside running text, the surrounding size. */\n\tsize?: TextSize;\n\t/** Text alignment. Defaults to `right` so columns of durations line up. */\n\talign?: TextProps['align'];\n\t/** Font weight. Defaults to `regular`; inside running text, the surrounding weight. */\n\tweight?: TextProps['weight'];\n\t/** Colour role. Defaults to `main`; inside running text, the surrounding colour. */\n\ttype?: TextProps['type'];\n\tref?: Ref<HTMLSpanElement>;\n}\n\nconst DURATION_ROLE: ValueTypographyRole = { type: 'main', weight: 'regular' };\n\n/** An elapsed span in localized units, sans UI font with tabular figures. */\nexport function Duration({\n\tvalue,\n\tfrom = 'seconds',\n\tlocale,\n\tmaxParts = 2,\n\tunitDisplay = 'narrow',\n\tminimumFractionDigits,\n\tmaximumFractionDigits,\n\temptyLabel = EMPTY,\n\tsize,\n\talign = 'right',\n\tweight,\n\ttype,\n\tclassName,\n\tref,\n\t...props\n}: DurationProps) {\n\tconst formatting = useFormattingConfig();\n\tconst resolved = useValueTypography({ size, type, weight }, DURATION_ROLE);\n\tconst label = value === null || value === undefined\n\t\t? null\n\t\t: formatDuration(value, {\n\t\t\t\tfrom,\n\t\t\t\tlocale: locale ?? formatting.locale,\n\t\t\t\tmaxParts,\n\t\t\t\tunitDisplay,\n\t\t\t\tminimumFractionDigits,\n\t\t\t\tmaximumFractionDigits: maximumFractionDigits ?? (\n\t\t\t\t\tfrom === 'milliseconds' ? 1 : undefined\n\t\t\t\t),\n\t\t\t});\n\n\tconst empty = label === null || label === EMPTY;\n\tconst typography = empty ? emptyValueTypography(resolved, weight) : resolved;\n\n\treturn (\n\t\t<Text\n\t\t\tref={ref}\n\t\t\ttag=\"span\"\n\t\t\tsize={typography.size}\n\t\t\talign={align}\n\t\t\tweight={typography.weight}\n\t\t\ttype={typography.type}\n\t\t\tlineHeight={typography.lineHeight}\n\t\t\tclassName={cn('duration--component inline tabular-nums', className)}\n\t\t\t{...props}\n\t\t>\n\t\t\t{empty ? emptyLabel : label}\n\t\t</Text>\n\t);\n}\n\nexport { formatDuration } from '../../lib/format';\nexport type { DurationUnit, DurationUnitDisplay, FormatDurationOptions } from '../../lib/format';\n","import { type ComponentPropsWithoutRef, type ReactNode, type Ref } from 'react';\n\nimport { Text, type TextProps } from '../typography';\nimport type { TextSize } from '../../lib/ui-provider';\nimport { EMPTY, formatWithMinusSign } from '../../lib/format';\nimport { useFormattingConfig } from '../../lib/ui-provider';\nimport { cn } from '../../lib/utils';\n\nimport { emptyValueTypography, useValueTypography, type ValueTypographyRole } from './value-typography';\n\ntype SpanProps = Omit<ComponentPropsWithoutRef<'span'>, 'children' | 'color'>;\ntype DimensionPart = number | string | null | undefined;\n\nexport interface FormatDimensionsOptions {\n\tdepth?: DimensionPart;\n\tunit?: string;\n\tseparator?: string;\n\tlocale?: string;\n\toptions?: Intl.NumberFormatOptions;\n}\n\nexport interface DimensionsProps extends SpanProps {\n\twidth?: DimensionPart;\n\theight?: DimensionPart;\n\tdepth?: DimensionPart;\n\tunit?: ReactNode;\n\tseparator?: ReactNode;\n\tlocale?: string;\n\toptions?: Intl.NumberFormatOptions;\n\t/** Rendered with the shared empty treatment when width or height is missing. Defaults to an em dash. */\n\temptyLabel?: ReactNode;\n\t/** Text size. Defaults to the provider text size; inside running text, the surrounding size. */\n\tsize?: TextSize;\n\t/** Text alignment. Defaults to `right` so columns of readings line up. */\n\talign?: TextProps['align'];\n\t/** Font weight. Defaults to `regular`; inside running text, the surrounding weight. */\n\tweight?: TextProps['weight'];\n\t/** Colour role. Defaults to `main`; inside running text, the surrounding colour. */\n\ttype?: TextProps['type'];\n\tref?: Ref<HTMLSpanElement>;\n}\n\nconst DIMENSIONS_ROLE: ValueTypographyRole = { type: 'main', weight: 'regular' };\n\nfunction parseDimensionPart(value: DimensionPart): number | null {\n\tif (value === null || value === undefined || value === '') return null;\n\tif (typeof value === 'number') return Number.isFinite(value) ? value : null;\n\tconst normalized = value.trim().replace(',', '.');\n\tif (!normalized) return null;\n\tconst parsed = Number(normalized);\n\treturn Number.isFinite(parsed) ? parsed : null;\n}\n\nexport function formatDimensions(\n\twidth: DimensionPart,\n\theight: DimensionPart,\n\t{\n\t\tdepth,\n\t\tunit,\n\t\tseparator = ' × ',\n\t\tlocale,\n\t\toptions,\n\t}: FormatDimensionsOptions = {},\n): string | null {\n\tconst parsedWidth = parseDimensionPart(width);\n\tconst parsedHeight = parseDimensionPart(height);\n\tconst parsedDepth = parseDimensionPart(depth);\n\tif (parsedWidth === null || parsedHeight === null) return null;\n\tif (depth !== null && depth !== undefined && depth !== '' && parsedDepth === null) return null;\n\n\tconst formatter = new Intl.NumberFormat(locale, options);\n\tconst values = [parsedWidth, parsedHeight];\n\tif (parsedDepth !== null) values.push(parsedDepth);\n\tconst label = values.map((value) => formatWithMinusSign(formatter, value)).join(separator);\n\treturn unit ? `${label} ${unit}` : label;\n}\n\n/** A width × height (× depth) reading with localized numbers, sans UI font with tabular figures. */\nexport function Dimensions({\n\twidth,\n\theight,\n\tdepth,\n\tunit,\n\tseparator = ' × ',\n\tlocale,\n\toptions,\n\temptyLabel = EMPTY,\n\tsize,\n\talign = 'right',\n\tweight,\n\ttype,\n\tclassName,\n\tref,\n\t...props\n}: DimensionsProps) {\n\tconst formatting = useFormattingConfig();\n\tconst resolved = useValueTypography({ size, type, weight }, DIMENSIONS_ROLE);\n\tconst label = formatDimensions(width, height, {\n\t\tdepth,\n\t\tseparator: typeof separator === 'string' ? separator : ' × ',\n\t\tlocale: locale ?? formatting.locale,\n\t\toptions,\n\t});\n\n\tconst typography = label === null ? emptyValueTypography(resolved, weight) : resolved;\n\n\treturn (\n\t\t<Text\n\t\t\tref={ref}\n\t\t\ttag=\"span\"\n\t\t\tsize={typography.size}\n\t\t\talign={align}\n\t\t\tweight={typography.weight}\n\t\t\ttype={typography.type}\n\t\t\tlineHeight={typography.lineHeight}\n\t\t\tclassName={cn('dimensions--component inline tabular-nums', className)}\n\t\t\t{...props}\n\t\t>\n\t\t\t{label === null ? emptyLabel : (\n\t\t\t\t<>\n\t\t\t\t\t{typeof separator === 'string' ? label : label.split(' × ').map((part, index) => (\n\t\t\t\t\t\t<span key={`${part}-${index}`}>\n\t\t\t\t\t\t\t{index > 0 && separator}\n\t\t\t\t\t\t\t{part}\n\t\t\t\t\t\t</span>\n\t\t\t\t\t))}\n\t\t\t\t\t{!!unit && <> {unit}</>}\n\t\t\t\t</>\n\t\t\t)}\n\t\t</Text>\n\t);\n}\n"],"mappings":";;;;;;;;;;AAgCA,IAAMe,IAAkC;CAAE,MAAM;CAAQ,QAAQ;AAAU,GACpEC,IAAsC;CAAE,MAAM;CAAa,QAAQ;CAAW,UAAU;AAAK,GAC7FC,IAAiC;CAAE,MAAM;CAAQ,QAAQ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A,EAAM,MAAM,KAAK,CAAC,CAAC,KAAK,GAAM,MACtE,kBAAC,QAAD,EAAA,UAAA,CACEmB,IAAQ,KAAKH,GACbI,CACI,EAAA,GAHK,GAAGA,EAAK,GAAGD,GAGhB,CACN,GACA,CAAC,CAACF,KAAQ,kBAAA7H,GAAA,EAAA,UAAA,CAAE,KAAE6H,CAAO,EAAA,CAAA,CACrB,EAAA,CAAA;CAEE,CAAA;AAER"}
|
|
1
|
+
{"version":3,"file":"primitives-Du64iDbb.js","names":["_Fragment","useFormattingConfig","useTypographyConfig","cn","Text","RunningTextContext","inlineLinkClassName","useInRunningText","resolveTextClassNames","useValueTypography","formatWithMinusSign","formatDuration","emptyValueTypography","formatInitials","Fragment$1","VALUE_ROLE","SECONDARY_ROLE","MONO_ROLE","isEmptyValue","children","ValueText","props","resolved","valueRole","empty","typography","weight","numeric","hookClassName","className","emptyLabel","Value","SecondaryValue","MutedValue","MonoValue","EmptyValue","WORD_SEPARATOR","NAME_CONNECTOR","LETTER_MATCHER","LETTERS_MATCHER","normalizeNameWhitespace","value","getLetters","getFirstLetter","match","isFormattedSegment","first","segment","letters","isAllUpper","isAllLower","isFormattedName","word","formatNameSegment","before","after","formatNameWord","formatName","normalized","options","Name","rawValue","content","Initials","Link","inText","defaultTextSize","linkUnderlineClassName","EmptyContact","_href","_target","_rel","_download","_hrefLang","_ping","_referrerPolicy","_media","_type","spanProps","contactProps","Email","query","subject","body","href","display","normalizeTel","Phone","normalizeUrl","Url","isExternal","external","resolvedTarget","target","resolvedRel","rel","FILE_SIZE_ROLE","FILE_SIZE_UNITS","FILE_SIZE_UNIT_MULTIPLIER","normalizeFileSizeValue","from","formatFileSize","locale","bytes","displayValue","unitIndex","FileSize","formatting","label","DURATION_ROLE","Duration","maximumFractionDigits","DIMENSIONS_ROLE","parseDimensionPart","parsed","formatDimensions","parsedWidth","width","parsedHeight","height","parsedDepth","depth","formatter","values","separator","unit","Dimensions","index","part"],"sources":["../src/components/primitives/value.tsx","../src/components/primitives/name.tsx","../src/components/primitives/initials.tsx","../src/components/primitives/link.tsx","../src/components/primitives/file-size.tsx","../src/components/primitives/duration.tsx","../src/components/primitives/dimensions.tsx"],"sourcesContent":["import { type ComponentPropsWithoutRef, type ReactNode, type Ref } from 'react';\n\nimport { Text, type TextProps } from '../typography';\nimport type { TextSize } from '../../lib/ui-provider';\nimport { EMPTY } from '../../lib/format';\nimport { cn } from '../../lib/utils';\n\nimport { emptyValueTypography, useValueTypography, type ValueTypographyRole } from './value-typography';\n\ntype SpanProps = Omit<ComponentPropsWithoutRef<'span'>, 'children' | 'color'>;\n/** Value colour roles: foreground, secondary, or the surrounding text colour. */\nexport type ValueType = Extract<TextProps['type'], 'main' | 'secondary' | 'inherit'>;\n\nexport interface ValueProps extends SpanProps {\n\tchildren?: ReactNode;\n\t/** Rendered with the shared empty treatment when children are absent. Defaults to an em dash. */\n\temptyLabel?: ReactNode;\n\t/**\n\t * Text size. A standalone value uses the provider text size; inside running\n\t * text (`Text`, `Heading`, labels, links, other values) it inherits the size.\n\t */\n\tsize?: TextSize;\n\talign?: TextProps['align'];\n\t/** Font weight. Defaults to the component's role weight; inside running text, the surrounding weight. */\n\tweight?: TextProps['weight'];\n\t/** Colour role. Defaults to the component's role; inside running text `Value` and `MonoValue` take the surrounding colour. */\n\ttype?: ValueType;\n\t/** Line height. Defaults to the role leading; inside running text, the surrounding leading. */\n\tlineHeight?: TextProps['lineHeight'];\n\tref?: Ref<HTMLSpanElement>;\n}\n\nconst VALUE_ROLE: ValueTypographyRole = { type: 'main', weight: 'regular' };\nconst SECONDARY_ROLE: ValueTypographyRole = { type: 'secondary', weight: 'regular', keepType: true };\nconst MONO_ROLE: ValueTypographyRole = { type: 'main', weight: 'medium', inTextLineHeight: 'none' };\n\nfunction isEmptyValue(children: ReactNode) {\n\treturn children === null || children === undefined || children === '';\n}\n\ninterface ValueTextProps extends ValueProps {\n\tvalueRole: ValueTypographyRole;\n\thookClassName: string;\n\tnumeric?: boolean;\n}\n\n/** Shared span for the value family: role resolution plus the empty treatment. */\nfunction ValueText({ valueRole, hookClassName, numeric = false, children, emptyLabel = EMPTY, size, align, weight, type, lineHeight, className, ref, ...props }: ValueTextProps) {\n\tconst resolved = useValueTypography({ size, type, weight, lineHeight }, valueRole);\n\tconst empty = isEmptyValue(children);\n\tconst typography = empty ? emptyValueTypography(resolved, weight) : resolved;\n\treturn (\n\t\t<Text\n\t\t\tref={ref}\n\t\t\ttag=\"span\"\n\t\t\tsize={typography.size}\n\t\t\talign={align}\n\t\t\tweight={typography.weight}\n\t\t\ttype={typography.type}\n\t\t\tlineHeight={typography.lineHeight}\n\t\t\tnumeric={numeric && !empty}\n\t\t\tclassName={cn(hookClassName, className)}\n\t\t\t{...props}\n\t\t>\n\t\t\t{empty ? emptyLabel : children}\n\t\t</Text>\n\t);\n}\n\n/**\n * An ordinary displayed fact: foreground, regular weight. Inside running text it\n * takes the sentence's size, colour and weight.\n */\nexport function Value(props: ValueProps) {\n\treturn <ValueText {...props} valueRole={VALUE_ROLE} hookClassName=\"value--component inline min-w-0\" />;\n}\n\n/** Supporting detail in the secondary colour. Inside running text it keeps the colour and takes the size and weight. */\nexport function SecondaryValue(props: ValueProps) {\n\treturn <ValueText {...props} valueRole={SECONDARY_ROLE} hookClassName=\"secondary-value--component inline min-w-0\" />;\n}\n\n/** A quiet note using the shared secondary foreground. */\nexport function MutedValue(props: ValueProps) {\n\treturn <ValueText {...props} valueRole={SECONDARY_ROLE} hookClassName=\"muted-value--component inline min-w-0\" />;\n}\n\n/**\n * An identifier or code (SKU, reference, tracking number, key) in the monospace\n * family. Standalone it is foreground medium at the provider size; inside running\n * text only the family changes, so an SKU in a description matches the words\n * around it. Amounts and dates belong to the number primitives, which keep the\n * sans font with tabular figures.\n */\nexport function MonoValue(props: ValueProps) {\n\treturn <ValueText {...props} valueRole={MONO_ROLE} numeric hookClassName=\"mono-value--component inline min-w-0 break-words\" />;\n}\n\nexport interface EmptyValueProps extends Omit<ValueProps, 'emptyLabel'> {\n\tref?: Ref<HTMLSpanElement>;\n}\n\n/**\n * An intentionally absent value: secondary colour, regular weight. Every value\n * primitive renders its missing state with this treatment.\n */\nexport function EmptyValue({ children = EMPTY, ...props }: EmptyValueProps) {\n\treturn <ValueText {...props} valueRole={SECONDARY_ROLE} emptyLabel={EMPTY} hookClassName=\"empty-value--component inline min-w-0\">{children}</ValueText>;\n}\n","import { type ReactNode } from 'react';\n\nimport { cn } from '../../lib/utils';\n\nimport { Value, type ValueProps } from './value';\n\nconst WORD_SEPARATOR = /(\\s+)/u;\nconst NAME_CONNECTOR = /([-'])/u;\nconst LETTER_MATCHER = /\\p{L}/u;\nconst LETTERS_MATCHER = /\\p{L}/gu;\n\nexport interface NameFormatOptions {\n\t/** Force title-casing even when the name already looks intentionally cased. */\n\tforce?: boolean;\n}\n\nexport interface NameProps extends Omit<ValueProps, 'children'> {\n\t/** Raw name value to normalize for display. */\n\tvalue?: string | null;\n\t/** String children are normalized when value is not provided. */\n\tchildren?: ReactNode;\n\t/** Force title-casing even when the name already looks intentionally cased. */\n\tforce?: boolean;\n}\n\nfunction normalizeNameWhitespace(value: string) {\n\treturn value.trim().replace(/\\s+/g, ' ');\n}\n\nfunction getLetters(value: string) {\n\treturn value.match(LETTERS_MATCHER)?.join('') ?? '';\n}\n\nfunction getFirstLetter(value: string) {\n\tconst match = LETTER_MATCHER.exec(value);\n\tif (!match) return null;\n\treturn {\n\t\tindex: match.index,\n\t\tvalue: match[0],\n\t};\n}\n\nfunction isFormattedSegment(segment: string) {\n\tconst first = getFirstLetter(segment);\n\tif (!first) return true;\n\n\tconst letters = getLetters(segment);\n\tif (letters.length <= 1) return first.value === first.value.toLocaleUpperCase();\n\n\tconst isAllUpper = letters === letters.toLocaleUpperCase();\n\tconst isAllLower = letters === letters.toLocaleLowerCase();\n\n\treturn first.value === first.value.toLocaleUpperCase() && !isAllUpper && !isAllLower;\n}\n\nfunction isFormattedName(value: string) {\n\treturn normalizeNameWhitespace(value)\n\t\t.split(WORD_SEPARATOR)\n\t\t.filter((word) => word.trim() !== '')\n\t\t.every((word) =>\n\t\t\tword\n\t\t\t\t.split(NAME_CONNECTOR)\n\t\t\t\t.filter((segment) => segment !== '-' && segment !== \"'\")\n\t\t\t\t.every(isFormattedSegment),\n\t\t);\n}\n\nfunction formatNameSegment(segment: string) {\n\tconst first = getFirstLetter(segment);\n\tif (!first) return segment;\n\n\tconst before = segment.slice(0, first.index);\n\tconst after = segment.slice(first.index + first.value.length);\n\n\treturn `${before}${first.value.toLocaleUpperCase()}${after.toLocaleLowerCase()}`;\n}\n\nfunction formatNameWord(word: string) {\n\treturn word\n\t\t.split(NAME_CONNECTOR)\n\t\t.map((segment) => (segment === '-' || segment === \"'\" ? segment : formatNameSegment(segment)))\n\t\t.join('');\n}\n\nexport function formatName(value: string | null | undefined, options: NameFormatOptions = {}) {\n\tif (value === null || value === undefined) return '';\n\n\tconst normalized = normalizeNameWhitespace(value);\n\tif (!normalized) return '';\n\tif (!options.force && isFormattedName(normalized)) return normalized;\n\n\treturn normalized\n\t\t.split(WORD_SEPARATOR)\n\t\t.map((word) => (word.trim() === '' ? word : formatNameWord(word)))\n\t\t.join('');\n}\n\nexport function Name({\n\tvalue,\n\tchildren,\n\tforce,\n\tclassName,\n\tref,\n\t...props\n}: NameProps) {\n\tconst rawValue = value ?? (typeof children === 'string' ? children : undefined);\n\tconst content = rawValue === undefined ? children : formatName(rawValue, { force });\n\n\treturn (\n\t\t<Value ref={ref} className={cn('name--component', className)} {...props}>\n\t\t\t{content}\n\t\t</Value>\n\t);\n}\n","import { cn } from '../../lib/utils';\n\nimport { Value, type ValueProps } from './value';\nimport {\n\tformatInitials,\n\ttype InitialsMaxCharacters,\n\ttype InitialsStrategy,\n} from './initials-format';\n\nexport interface InitialsProps extends Omit<ValueProps, 'children'> {\n\t/** Person, organization, or resource name used to derive initials. */\n\tvalue?: string | null;\n\t/** First + last word by default; use first-words to preserve the first N words. */\n\tstrategy?: InitialsStrategy;\n\t/** Maximum visible characters. Defaults to 2. */\n\tmaxCharacters?: InitialsMaxCharacters;\n\t/** Optional BCP-47 locale used for locale-sensitive uppercasing. */\n\tlocale?: string;\n\t/** Returned when no usable letter or number exists. Defaults to an empty string. */\n\tfallback?: string;\n\t/** Defaults to `inherit`: the avatar or chip that hosts the initials owns their size. */\n\tsize?: ValueProps['size'];\n\t/** Defaults to `inherit`: the host owns the colour, such as an avatar fallback tone. */\n\ttype?: ValueProps['type'];\n\t/** Defaults to `inherit`: the host owns the weight. */\n\tweight?: ValueProps['weight'];\n}\n\n/**\n * Semantic displayed initials for identities and avatar fallbacks. They take the\n * size, colour and weight of the avatar or chip that hosts them.\n */\nexport function Initials({\n\tvalue,\n\tstrategy,\n\tmaxCharacters,\n\tlocale,\n\tfallback,\n\tsize = 'inherit',\n\ttype = 'inherit',\n\tweight = 'inherit',\n\tclassName,\n\tref,\n\t...props\n}: InitialsProps) {\n\treturn (\n\t\t<Value\n\t\t\tref={ref}\n\t\t\t{...props}\n\t\t\tsize={size}\n\t\t\ttype={type}\n\t\t\tweight={weight}\n\t\t\tclassName={cn('initials--component', className)}\n\t\t>\n\t\t\t{formatInitials(value, {\n\t\t\t\tstrategy,\n\t\t\t\tmaxCharacters,\n\t\t\t\tlocale,\n\t\t\t\tfallback,\n\t\t\t})}\n\t\t</Value>\n\t);\n}\n","import { type AnchorHTMLAttributes, type ReactNode, type Ref } from 'react';\n\nimport { useTypographyConfig } from '../../lib/ui-provider';\nimport { EMPTY } from '../../lib/format';\nimport { cn } from '../../lib/utils';\nimport { RunningTextContext, useInRunningText } from '../typography/running-text';\nimport { inlineLinkClassName, linkUnderlineClassName } from '../typography/text-link';\nimport { resolveTextClassNames } from '../typography/text.styles';\n\nimport { EmptyValue } from './value';\n\nexport interface LinkProps extends AnchorHTMLAttributes<HTMLAnchorElement> {\n\tchildren?: ReactNode;\n\t/** Rendered instead of a dead link when there is nothing to show. Defaults to an em dash. */\n\temptyLabel?: ReactNode;\n\tref?: Ref<HTMLAnchorElement>;\n}\n\n/**\n * Link-coloured inline value. Standalone it uses the provider text size with an\n * underline on hover. Inside running text it takes the sentence's size, weight\n * and leading and stays underlined, because colour alone does not set a link\n * apart from the words around it.\n */\nexport function Link({\n\tchildren,\n\temptyLabel = EMPTY,\n\tclassName,\n\tref,\n\t...props\n}: LinkProps) {\n\tconst inText = useInRunningText();\n\tconst { defaultTextSize } = useTypographyConfig();\n\tconst content =\n\t\tchildren === null || children === undefined || children === '' ? emptyLabel : children;\n\n\treturn (\n\t\t<a\n\t\t\tref={ref}\n\t\t\tdata-typography=\"link\"\n\t\t\tclassName={cn(\n\t\t\t\tresolveTextClassNames({\n\t\t\t\t\ttype: null,\n\t\t\t\t\tsize: inText ? 'inherit' : defaultTextSize,\n\t\t\t\t\tweight: null,\n\t\t\t\t\talign: null,\n\t\t\t\t\tlineHeight: inText ? null : 'normal',\n\t\t\t\t}),\n\t\t\t\t'link--component text-link-color wrap-anywhere',\n\t\t\t\tinlineLinkClassName,\n\t\t\t\tinText ? `${linkUnderlineClassName} hover:decoration-transparent` : 'no-underline underline-offset-[0.2em] hover:underline',\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t>\n\t\t\t<RunningTextContext.Provider value>{content}</RunningTextContext.Provider>\n\t\t</a>\n\t);\n}\n\ntype ContactSpanProps = Omit<LinkProps, 'children' | 'emptyLabel' | 'ref' | 'href' | 'target' | 'rel' | 'download' | 'hrefLang' | 'ping' | 'referrerPolicy' | 'media' | 'type'>;\n\n/**\n * The missing contact value: the shared empty treatment, never a dead link.\n * Global attributes (ARIA, data, id, title) still reach the rendered span.\n */\nfunction EmptyContact({ className, emptyLabel, ref, contactProps }: { className: string; emptyLabel: ReactNode; ref?: Ref<HTMLElement>; contactProps: LinkProps }) {\n\tconst { href: _href, target: _target, rel: _rel, download: _download, hrefLang: _hrefLang, ping: _ping, referrerPolicy: _referrerPolicy, media: _media, type: _type, ...spanProps } = contactProps;\n\treturn <EmptyValue {...(spanProps as ContactSpanProps)} ref={ref as Ref<HTMLSpanElement>} className={className}>{emptyLabel}</EmptyValue>;\n}\n\nexport interface EmailProps extends Omit<LinkProps, 'href' | 'children' | 'ref'> {\n\tvalue?: string | null;\n\tdisplay?: ReactNode;\n\tsubject?: string;\n\tbody?: string;\n\tref?: Ref<HTMLElement>;\n}\n\nexport function Email({\n\tvalue,\n\tdisplay,\n\tsubject,\n\tbody,\n\tclassName,\n\temptyLabel = EMPTY,\n\tref,\n\t...props\n}: EmailProps) {\n\tif (!value) return <EmptyContact ref={ref} className={cn('email--component', className)} emptyLabel={emptyLabel} contactProps={props} />;\n\n\tconst query = new URLSearchParams();\n\tif (subject) query.set('subject', subject);\n\tif (body) query.set('body', body);\n\tconst href = `mailto:${value}${query.size ? `?${query.toString()}` : ''}`;\n\n\treturn (\n\t\t<Link ref={ref as Ref<HTMLAnchorElement>} className={cn('email--component', className)} href={href} emptyLabel={emptyLabel} {...props}>\n\t\t\t{display ?? value}\n\t\t</Link>\n\t);\n}\n\nexport interface PhoneProps extends Omit<LinkProps, 'href' | 'children' | 'ref'> {\n\tvalue?: string | null;\n\tdisplay?: ReactNode;\n\tref?: Ref<HTMLElement>;\n}\n\nfunction normalizeTel(value: string) {\n\treturn value.replace(/[^\\d+*#;,.]/g, '');\n}\n\nexport function Phone({\n\tvalue,\n\tdisplay,\n\tclassName,\n\temptyLabel = EMPTY,\n\tref,\n\t...props\n}: PhoneProps) {\n\tif (!value) return <EmptyContact ref={ref} className={cn('phone--component', className)} emptyLabel={emptyLabel} contactProps={props} />;\n\n\treturn (\n\t\t<Link ref={ref as Ref<HTMLAnchorElement>} className={cn('phone--component', className)} href={`tel:${normalizeTel(value)}`} emptyLabel={emptyLabel} {...props}>\n\t\t\t{display ?? value}\n\t\t</Link>\n\t);\n}\n\nexport interface UrlProps extends Omit<LinkProps, 'href' | 'children' | 'ref'> {\n\tvalue?: string | null;\n\tdisplay?: ReactNode;\n\texternal?: boolean;\n\tref?: Ref<HTMLElement>;\n}\n\nfunction normalizeUrl(value: string) {\n\tif (/^[a-z][a-z\\d+\\-.]*:/i.test(value) || value.startsWith('/') || value.startsWith('#')) return value;\n\treturn `https://${value}`;\n}\n\nexport function Url({\n\tvalue,\n\tdisplay,\n\texternal,\n\ttarget,\n\trel,\n\tclassName,\n\temptyLabel = EMPTY,\n\tref,\n\t...props\n}: UrlProps) {\n\tif (!value) return <EmptyContact ref={ref} className={cn('url--component', className)} emptyLabel={emptyLabel} contactProps={{ ...props, target, rel }} />;\n\n\tconst href = normalizeUrl(value);\n\tconst isExternal = external ?? /^https?:\\/\\//i.test(href);\n\tconst resolvedTarget = target ?? (isExternal ? '_blank' : undefined);\n\tconst resolvedRel = rel ?? (isExternal ? 'noreferrer' : undefined);\n\n\treturn (\n\t\t<Link\n\t\t\tref={ref as Ref<HTMLAnchorElement>}\n\t\t\tclassName={cn('url--component', className)}\n\t\t\thref={href}\n\t\t\ttarget={resolvedTarget}\n\t\t\trel={resolvedRel}\n\t\t\temptyLabel={emptyLabel}\n\t\t\t{...props}\n\t\t>\n\t\t\t{display ?? value}\n\t\t</Link>\n\t);\n}\n","import { type ComponentPropsWithoutRef, type ReactNode, type Ref } from 'react';\n\nimport { Text, type TextProps } from '../typography';\nimport type { TextSize } from '../../lib/ui-provider';\nimport { EMPTY } from '../../lib/format';\nimport { useFormattingConfig } from '../../lib/ui-provider';\nimport { cn } from '../../lib/utils';\n\nimport { emptyValueTypography, useValueTypography, type ValueTypographyRole } from './value-typography';\n\ntype SpanProps = Omit<ComponentPropsWithoutRef<'span'>, 'children' | 'color'>;\n\nexport type FileSizeUnit = 'bytes' | 'kb' | 'mb' | 'gb' | 'tb';\n\nexport interface FileSizeProps extends SpanProps {\n\tvalue?: number | null;\n\tfrom?: FileSizeUnit;\n\tlocale?: string;\n\t/** Rendered with the shared empty treatment when the value is absent or not positive. Defaults to an em dash. */\n\temptyLabel?: ReactNode;\n\t/** Text size. Defaults to the provider text size; inside running text, the surrounding size. */\n\tsize?: TextSize;\n\t/** Text alignment. Defaults to `right` so columns of sizes line up. */\n\talign?: TextProps['align'];\n\t/** Font weight. Defaults to `regular`; inside running text, the surrounding weight. */\n\tweight?: TextProps['weight'];\n\t/** Colour role. Defaults to `main`; inside running text, the surrounding colour. */\n\ttype?: TextProps['type'];\n\tref?: Ref<HTMLSpanElement>;\n}\n\nconst FILE_SIZE_ROLE: ValueTypographyRole = { type: 'main', weight: 'regular' };\n\nconst FILE_SIZE_UNITS = ['B', 'KB', 'MB', 'GB', 'TB'] as const;\nconst FILE_SIZE_UNIT_MULTIPLIER: Record<FileSizeUnit, number> = {\n\tbytes: 1,\n\tkb: 1024,\n\tmb: 1024 ** 2,\n\tgb: 1024 ** 3,\n\ttb: 1024 ** 4,\n};\n\nexport interface FileSizeFormatOptions {\n\tfrom?: FileSizeUnit;\n\tlocale?: string;\n}\n\nfunction normalizeFileSizeValue(value?: number | null, from: FileSizeUnit = 'bytes') {\n\tif (typeof value !== 'number' || !Number.isFinite(value) || value <= 0) return null;\n\treturn value * FILE_SIZE_UNIT_MULTIPLIER[from];\n}\n\nexport function formatFileSize(\n\tvalue?: number | null,\n\toptions?: FileSizeFormatOptions | string,\n): string | null {\n\tconst locale = typeof options === 'string' ? options : options?.locale;\n\tconst from = typeof options === 'string' ? 'bytes' : options?.from ?? 'bytes';\n\tconst bytes = normalizeFileSizeValue(value, from);\n\tif (bytes === null) return null;\n\n\tlet displayValue = bytes;\n\tlet unitIndex = 0;\n\twhile (displayValue >= 1024 && unitIndex < FILE_SIZE_UNITS.length - 1) {\n\t\tdisplayValue /= 1024;\n\t\tunitIndex += 1;\n\t}\n\n\tconst formattedValue = new Intl.NumberFormat(locale, {\n\t\tmaximumFractionDigits: unitIndex === 0 ? 0 : 1,\n\t\tminimumFractionDigits: 0,\n\t}).format(displayValue);\n\n\treturn `${formattedValue} ${FILE_SIZE_UNITS[unitIndex]}`;\n}\n\n/** A byte count in the largest readable unit, sans UI font with tabular figures. */\nexport function FileSize({\n\tvalue,\n\tfrom = 'bytes',\n\tlocale,\n\temptyLabel = EMPTY,\n\tsize,\n\talign = 'right',\n\tweight,\n\ttype,\n\tclassName,\n\tref,\n\t...props\n}: FileSizeProps) {\n\tconst formatting = useFormattingConfig();\n\tconst resolved = useValueTypography({ size, type, weight }, FILE_SIZE_ROLE);\n\tconst label = formatFileSize(value, { from, locale: locale ?? formatting.locale });\n\tconst typography = label === null ? emptyValueTypography(resolved, weight) : resolved;\n\n\treturn (\n\t\t<Text\n\t\t\tref={ref}\n\t\t\ttag=\"span\"\n\t\t\tsize={typography.size}\n\t\t\talign={align}\n\t\t\tweight={typography.weight}\n\t\t\ttype={typography.type}\n\t\t\tlineHeight={typography.lineHeight}\n\t\t\tclassName={cn('file-size--component inline tabular-nums', className)}\n\t\t\t{...props}\n\t\t>\n\t\t\t{label ?? emptyLabel}\n\t\t</Text>\n\t);\n}\n","import { type ComponentPropsWithoutRef, type ReactNode, type Ref } from 'react';\n\nimport { Text, type TextProps } from '../typography';\nimport type { TextSize } from '../../lib/ui-provider';\nimport {\n\tEMPTY,\n\tformatDuration,\n\ttype DurationUnit,\n\ttype DurationUnitDisplay,\n} from '../../lib/format';\nimport { useFormattingConfig } from '../../lib/ui-provider';\nimport { cn } from '../../lib/utils';\n\nimport { emptyValueTypography, useValueTypography, type ValueTypographyRole } from './value-typography';\n\ntype SpanProps = Omit<ComponentPropsWithoutRef<'span'>, 'children' | 'color'>;\n\nexport interface DurationProps extends SpanProps {\n\tvalue?: number | null;\n\tfrom?: DurationUnit;\n\tlocale?: string;\n\tmaxParts?: number;\n\tunitDisplay?: DurationUnitDisplay;\n\tminimumFractionDigits?: number;\n\tmaximumFractionDigits?: number;\n\t/** Rendered with the shared empty treatment when the value is absent. Defaults to an em dash. */\n\temptyLabel?: ReactNode;\n\t/** Text size. Defaults to the provider text size; inside running text, the surrounding size. */\n\tsize?: TextSize;\n\t/** Text alignment. Defaults to `right` so columns of durations line up. */\n\talign?: TextProps['align'];\n\t/** Font weight. Defaults to `regular`; inside running text, the surrounding weight. */\n\tweight?: TextProps['weight'];\n\t/** Colour role. Defaults to `main`; inside running text, the surrounding colour. */\n\ttype?: TextProps['type'];\n\tref?: Ref<HTMLSpanElement>;\n}\n\nconst DURATION_ROLE: ValueTypographyRole = { type: 'main', weight: 'regular' };\n\n/** An elapsed span in localized units, sans UI font with tabular figures. */\nexport function Duration({\n\tvalue,\n\tfrom = 'seconds',\n\tlocale,\n\tmaxParts = 2,\n\tunitDisplay = 'narrow',\n\tminimumFractionDigits,\n\tmaximumFractionDigits,\n\temptyLabel = EMPTY,\n\tsize,\n\talign = 'right',\n\tweight,\n\ttype,\n\tclassName,\n\tref,\n\t...props\n}: DurationProps) {\n\tconst formatting = useFormattingConfig();\n\tconst resolved = useValueTypography({ size, type, weight }, DURATION_ROLE);\n\tconst label = value === null || value === undefined\n\t\t? null\n\t\t: formatDuration(value, {\n\t\t\t\tfrom,\n\t\t\t\tlocale: locale ?? formatting.locale,\n\t\t\t\tmaxParts,\n\t\t\t\tunitDisplay,\n\t\t\t\tminimumFractionDigits,\n\t\t\t\tmaximumFractionDigits: maximumFractionDigits ?? (\n\t\t\t\t\tfrom === 'milliseconds' ? 1 : undefined\n\t\t\t\t),\n\t\t\t});\n\n\tconst empty = label === null || label === EMPTY;\n\tconst typography = empty ? emptyValueTypography(resolved, weight) : resolved;\n\n\treturn (\n\t\t<Text\n\t\t\tref={ref}\n\t\t\ttag=\"span\"\n\t\t\tsize={typography.size}\n\t\t\talign={align}\n\t\t\tweight={typography.weight}\n\t\t\ttype={typography.type}\n\t\t\tlineHeight={typography.lineHeight}\n\t\t\tclassName={cn('duration--component inline tabular-nums', className)}\n\t\t\t{...props}\n\t\t>\n\t\t\t{empty ? emptyLabel : label}\n\t\t</Text>\n\t);\n}\n\nexport { formatDuration } from '../../lib/format';\nexport type { DurationUnit, DurationUnitDisplay, FormatDurationOptions } from '../../lib/format';\n","import { type ComponentPropsWithoutRef, type ReactNode, type Ref } from 'react';\n\nimport { Text, type TextProps } from '../typography';\nimport type { TextSize } from '../../lib/ui-provider';\nimport { EMPTY, formatWithMinusSign } from '../../lib/format';\nimport { useFormattingConfig } from '../../lib/ui-provider';\nimport { cn } from '../../lib/utils';\n\nimport { emptyValueTypography, useValueTypography, type ValueTypographyRole } from './value-typography';\n\ntype SpanProps = Omit<ComponentPropsWithoutRef<'span'>, 'children' | 'color'>;\ntype DimensionPart = number | string | null | undefined;\n\nexport interface FormatDimensionsOptions {\n\tdepth?: DimensionPart;\n\tunit?: string;\n\tseparator?: string;\n\tlocale?: string;\n\toptions?: Intl.NumberFormatOptions;\n}\n\nexport interface DimensionsProps extends SpanProps {\n\twidth?: DimensionPart;\n\theight?: DimensionPart;\n\tdepth?: DimensionPart;\n\tunit?: ReactNode;\n\tseparator?: ReactNode;\n\tlocale?: string;\n\toptions?: Intl.NumberFormatOptions;\n\t/** Rendered with the shared empty treatment when width or height is missing. Defaults to an em dash. */\n\temptyLabel?: ReactNode;\n\t/** Text size. Defaults to the provider text size; inside running text, the surrounding size. */\n\tsize?: TextSize;\n\t/** Text alignment. Defaults to `right` so columns of readings line up. */\n\talign?: TextProps['align'];\n\t/** Font weight. Defaults to `regular`; inside running text, the surrounding weight. */\n\tweight?: TextProps['weight'];\n\t/** Colour role. Defaults to `main`; inside running text, the surrounding colour. */\n\ttype?: TextProps['type'];\n\tref?: Ref<HTMLSpanElement>;\n}\n\nconst DIMENSIONS_ROLE: ValueTypographyRole = { type: 'main', weight: 'regular' };\n\nfunction parseDimensionPart(value: DimensionPart): number | null {\n\tif (value === null || value === undefined || value === '') return null;\n\tif (typeof value === 'number') return Number.isFinite(value) ? value : null;\n\tconst normalized = value.trim().replace(',', '.');\n\tif (!normalized) return null;\n\tconst parsed = Number(normalized);\n\treturn Number.isFinite(parsed) ? parsed : null;\n}\n\nexport function formatDimensions(\n\twidth: DimensionPart,\n\theight: DimensionPart,\n\t{\n\t\tdepth,\n\t\tunit,\n\t\tseparator = ' × ',\n\t\tlocale,\n\t\toptions,\n\t}: FormatDimensionsOptions = {},\n): string | null {\n\tconst parsedWidth = parseDimensionPart(width);\n\tconst parsedHeight = parseDimensionPart(height);\n\tconst parsedDepth = parseDimensionPart(depth);\n\tif (parsedWidth === null || parsedHeight === null) return null;\n\tif (depth !== null && depth !== undefined && depth !== '' && parsedDepth === null) return null;\n\n\tconst formatter = new Intl.NumberFormat(locale, options);\n\tconst values = [parsedWidth, parsedHeight];\n\tif (parsedDepth !== null) values.push(parsedDepth);\n\tconst label = values.map((value) => formatWithMinusSign(formatter, value)).join(separator);\n\treturn unit ? `${label} ${unit}` : label;\n}\n\n/** A width × height (× depth) reading with localized numbers, sans UI font with tabular figures. */\nexport function Dimensions({\n\twidth,\n\theight,\n\tdepth,\n\tunit,\n\tseparator = ' × ',\n\tlocale,\n\toptions,\n\temptyLabel = EMPTY,\n\tsize,\n\talign = 'right',\n\tweight,\n\ttype,\n\tclassName,\n\tref,\n\t...props\n}: DimensionsProps) {\n\tconst formatting = useFormattingConfig();\n\tconst resolved = useValueTypography({ size, type, weight }, DIMENSIONS_ROLE);\n\tconst label = formatDimensions(width, height, {\n\t\tdepth,\n\t\tseparator: typeof separator === 'string' ? separator : ' × ',\n\t\tlocale: locale ?? formatting.locale,\n\t\toptions,\n\t});\n\n\tconst typography = label === null ? emptyValueTypography(resolved, weight) : resolved;\n\n\treturn (\n\t\t<Text\n\t\t\tref={ref}\n\t\t\ttag=\"span\"\n\t\t\tsize={typography.size}\n\t\t\talign={align}\n\t\t\tweight={typography.weight}\n\t\t\ttype={typography.type}\n\t\t\tlineHeight={typography.lineHeight}\n\t\t\tclassName={cn('dimensions--component inline tabular-nums', className)}\n\t\t\t{...props}\n\t\t>\n\t\t\t{label === null ? emptyLabel : (\n\t\t\t\t<>\n\t\t\t\t\t{typeof separator === 'string' ? label : label.split(' × ').map((part, index) => (\n\t\t\t\t\t\t<span key={`${part}-${index}`}>\n\t\t\t\t\t\t\t{index > 0 && separator}\n\t\t\t\t\t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G,EAAqBU,GAAUI,CAAM,IAAIJ;CAE7E,OACC,kBAAClB,GAAD;EACM;EACL,KAAI;EACJ,MAAMqB,EAAW;EACV;EACP,QAAQA,EAAW;EACnB,MAAMA,EAAW;EACjB,YAAYA,EAAW;EACvB,WAAWtB,EAAG,6CAA6C0B,CAAS;EACpE,GAAIR;EAEH,UAAAuF,MAAU,OAAO9E,IACjB,kBAAA9B,GAAA,EAAA,UAAA,CACE,OAAO4H,KAAc,WAAWhB,IAAQA,EAAM,MAAM,KAAK,CAAC,CAAC,KAAK,GAAM,MACtE,kBAAC,QAAD,EAAA,UAAA,CACEmB,IAAQ,KAAKH,GACbI,CACI,EAAA,GAHK,GAAGA,EAAK,GAAGD,GAGhB,CACN,GACA,CAAC,CAACF,KAAQ,kBAAA7H,GAAA,EAAA,UAAA,CAAE,KAAE6H,CAAO,EAAA,CAAA,CACrB,EAAA,CAAA;CAEE,CAAA;AAER"}
|
package/dist/primitives.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { r as e } from "./value-typography-
|
|
3
|
-
import { _ as t, a as n, c as r, d as i, f as a, g as o, h as s, i as c, l, m as u, n as d, o as f, p, r as m, s as h, t as g, u as _ } from "./primitives-
|
|
2
|
+
import { r as e } from "./value-typography-ClupF0Gz.js";
|
|
3
|
+
import { _ as t, a as n, c as r, d as i, f as a, g as o, h as s, i as c, l, m as u, n as d, o as f, p, r as m, s as h, t as g, u as _ } from "./primitives-Du64iDbb.js";
|
|
4
4
|
import { t as v } from "./initials-format-CDoQEOd_.js";
|
|
5
|
-
import { i as y, n as b, r as x, t as S } from "./number-
|
|
6
|
-
import { a as C, i as w, n as T, o as E, r as D, s as O, t as k } from "./date-
|
|
5
|
+
import { i as y, n as b, r as x, t as S } from "./number-E_OiIfJz.js";
|
|
6
|
+
import { a as C, i as w, n as T, o as E, r as D, s as O, t as k } from "./date-Q7jnXxpk.js";
|
|
7
7
|
export { k as Date, T as DateRange, D as DateTime, g as Dimensions, m as Duration, f as Email, p as EmptyValue, c as FileSize, _ as Initials, h as Link, x as Money, u as MonoValue, s as MutedValue, i as Name, S as Number, b as Percent, r as Phone, w as RelativeTime, o as SecondaryValue, C as Time, l as Url, t as Value, E as formatDateRange, d as formatDimensions, e as formatDuration, n as formatFileSize, v as formatInitials, a as formatName, O as parseDateInput, y as useMoneyFormatter };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { c as e, s as t, v as n } from "./ui-provider-
|
|
2
|
+
import { c as e, s as t, v as n } from "./ui-provider-CQCuCBcy.js";
|
|
3
3
|
import { useStrings as r } from "./lib/strings.js";
|
|
4
|
-
import { t as i } from "./utils-
|
|
5
|
-
import { c as a } from "./typography-
|
|
6
|
-
import { t as o } from "./structure-
|
|
4
|
+
import { t as i } from "./utils-CF3c95Io.js";
|
|
5
|
+
import { c as a } from "./typography-CSyJrh28.js";
|
|
6
|
+
import { t as o } from "./structure-C0V0_Fyf.js";
|
|
7
7
|
import { n as s } from "./track-recipes-CDcKmndW.js";
|
|
8
8
|
import { createContext as c, forwardRef as l, useContext as u, useId as d, useMemo as f } from "react";
|
|
9
9
|
import { Fragment as ee, jsx as p, jsxs as m } from "react/jsx-runtime";
|
|
@@ -166,4 +166,4 @@ D.displayName = "ProgressValue";
|
|
|
166
166
|
//#endregion
|
|
167
167
|
export { D as a, w as i, T as n, g as o, E as r, C as t };
|
|
168
168
|
|
|
169
|
-
//# sourceMappingURL=progress-
|
|
169
|
+
//# sourceMappingURL=progress-BvF2oCdV.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"progress-B1VnCT0K.js","names":["Progress","_Fragment","ProgressPrimitive","useFormattingConfig","useDensityConfig","resolveComponentScale","cn","Text","Stack","trackHeightClasses","Fragment$1","defaultProgressStrings","ProgressContext","createContext","isSimpleText","value","INDICATOR_TONE_CLASSNAMES","mergeStateClassName","className","baseClassName","state","normalizeRange","min","minProp","maxCandidate","maxProp","normalizeValue","max","formatProgressValue","format","locale","normalized","Progress$1","forwardRef","valueProp","showValueProp","sizeProp","stringsProp","ariaDescribedBy","props","strings","useStrings","formatting","size","defaultScale","resolvedLocale","descriptionId","useId","formattedValue","usesGeneratedHeader","headerSlot","children","showValue","label","hasSummary","description","metadata","valueSlot","descriptionIds","resolvedGetAriaValueText","normalizedFormattedValue","currentValue","getAriaValueText","contextValue","useMemo","resolvedHeader","ProgressLabel","ProgressValue","resolvedTrack","trackSlot","ProgressTrack","trackProps","ProgressIndicator","indicatorProps","tone","Progress","context","useContext","primitiveValue","_primitiveFormattedValue","content"],"sources":["../src/components/base/feedback/progress.strings.ts","../src/components/base/feedback/progress.tsx"],"sourcesContent":["export interface ProgressStrings {\n\t/** Screen-reader value announced while progress is indeterminate. */\n\tindeterminateValue: string;\n}\n\nexport const defaultProgressStrings: ProgressStrings = {\n\tindeterminateValue: 'In progress',\n};\n","import { trackHeightClasses } from '../../../lib/track-recipes';\n/**\n * Progress — token-driven Base UI progress wrapper for completion, quota,\n * and long-running task states.\n *\n * The root keeps the Base UI accessibility contract while adding a concise\n * admin summary API (`label`, `description`, `metadata`, `showValue`),\n * semantic tones, structural sizes, stable DOM hooks, and composition slots.\n * Consumers can still assemble `ProgressLabel`, `ProgressValue`,\n * `ProgressTrack`, and `ProgressIndicator` directly.\n */\nimport { Progress as ProgressPrimitive } from '@base-ui/react/progress';\nimport { createContext, forwardRef, useContext, useId, useMemo, type ReactNode } from 'react';\n\nimport { Text } from '../../typography';\nimport { Stack } from '../structure';\nimport { useDensityConfig, useFormattingConfig, type ComponentScale } from '../../../lib/ui-provider';\nimport { resolveComponentScale } from '../../../lib/ui-provider/scale';\nimport { useStrings, type StringsProp } from '../../../lib/strings';\nimport { cn } from '../../../lib/utils';\nimport type { SemanticTone } from '../../../lib/component-vocabulary';\n\nimport { defaultProgressStrings, type ProgressStrings } from './progress.strings';\n\nexport type ProgressSize = ComponentScale;\nexport type ProgressTone = SemanticTone;\n\ntype ProgressRootState = ProgressPrimitive.Root.State;\ntype ProgressTrackState = ProgressPrimitive.Track.State;\ntype ProgressIndicatorState = ProgressPrimitive.Indicator.State;\ntype ProgressLabelState = ProgressPrimitive.Label.State;\ntype ProgressValueState = ProgressPrimitive.Value.State;\n\ntype StatefulClassName<TState> = string | ((state: TState) => string | undefined) | undefined;\n\nexport interface ProgressProps extends Omit<\n\tProgressPrimitive.Root.Props,\n\t'children' | 'format' | 'getAriaValueText' | 'locale' | 'max' | 'min' | 'value'\n> {\n\t/** Current value. `null` renders an indeterminate state. */\n\tvalue: number | null;\n\t/** Minimum value used to normalize the visual percentage. @default 0 */\n\tmin?: number;\n\t/** Maximum value used to normalize the visual percentage. @default 100 */\n\tmax?: number;\n\t/** Intl options for formatting the raw value instead of the default normalized percentage. */\n\tformat?: Intl.NumberFormatOptions;\n\t/** Locale forwarded to `Intl.NumberFormat`. */\n\tlocale?: Intl.LocalesArgument;\n\t/** Human-readable text for the current value. Receives the wrapper's normalized display value. */\n\tgetAriaValueText?: (formattedValue: string | null, value: number | null) => string;\n\t/** Low-level compound content. `headerSlot` takes precedence when both are supplied. */\n\tchildren?: ReactNode;\n\t/** Accessible visual label. Supplying it also enables `showValue` by default. */\n\tlabel?: ReactNode;\n\t/** Supporting text automatically connected with `aria-describedby`. */\n\tdescription?: ReactNode;\n\t/** Optional right-aligned task metadata, such as \"18,400 of 25,000 rows\". */\n\tmetadata?: ReactNode;\n\t/** Show the formatted value beside the label. Defaults to `true` when `label` is supplied. */\n\tshowValue?: boolean;\n\t/** Replaces the formatted value while retaining the default summary layout. */\n\tvalueSlot?: ReactNode;\n\t/** Replaces the entire content above the track. */\n\theaderSlot?: ReactNode;\n\t/** Replaces the default track and indicator composition. */\n\ttrackSlot?: ReactNode;\n\t/** Track thickness. @default \"default\" */\n\tsize?: ProgressSize;\n\t/** Semantic indicator color. @default \"primary\" */\n\ttone?: ProgressTone;\n\t/** Props forwarded to the default track. Ignored when `trackSlot` is supplied. */\n\ttrackProps?: ProgressTrackProps;\n\t/** Props forwarded to the default indicator. Ignored when `trackSlot` is supplied. */\n\tindicatorProps?: ProgressIndicatorProps;\n\t/** Override the indeterminate screen-reader copy. */\n\tstrings?: StringsProp<ProgressStrings>;\n}\n\nexport interface ProgressTrackProps extends ProgressPrimitive.Track.Props {\n\t/** Track thickness. @default \"default\" */\n\tsize?: ProgressSize;\n}\n\nexport interface ProgressIndicatorProps extends ProgressPrimitive.Indicator.Props {\n\t/** Semantic fill color. @default \"primary\" */\n\ttone?: ProgressTone;\n}\n\nexport interface ProgressLabelProps extends ProgressPrimitive.Label.Props {\n\t/** Accessible label content. */\n\tchildren?: ReactNode;\n}\n\nexport interface ProgressValueProps extends Omit<ProgressPrimitive.Value.Props, 'children'> {\n\t/** Customize the formatted display while preserving the value semantics. */\n\tchildren?: (formattedValue: string | null, value: number | null) => ReactNode;\n}\n\ninterface ProgressContextValue {\n\tformattedValue: string | null;\n\tvalue: number | null;\n}\n\nconst ProgressContext = createContext<ProgressContextValue | null>(null);\n\nfunction isSimpleText(value: ReactNode): value is string | number | bigint {\n\treturn typeof value === 'string' || typeof value === 'number' || typeof value === 'bigint';\n}\n\n\n\nconst INDICATOR_TONE_CLASSNAMES: Record<ProgressTone, string> = {\n\tneutral: 'bg-muted-foreground',\n\tprimary: 'bg-primary',\n\tsecondary: 'bg-secondary-foreground',\n\tsuccess: 'bg-success',\n\tinfo: 'bg-info',\n\twarning: 'bg-warning',\n\tdestructive: 'bg-destructive',\n};\n\nfunction mergeStateClassName<TState>(\n\tbaseClassName: string,\n\tclassName: StatefulClassName<TState>,\n): string | ((state: TState) => string) {\n\tif (typeof className === 'function') {\n\t\treturn (state) => cn(baseClassName, className(state));\n\t}\n\n\treturn cn(baseClassName, className);\n}\n\nfunction normalizeRange(minProp: number | undefined, maxProp: number | undefined) {\n\tconst min = Number.isFinite(minProp) ? (minProp as number) : 0;\n\tconst maxCandidate = Number.isFinite(maxProp) ? (maxProp as number) : 100;\n\tconst max = maxCandidate > min ? maxCandidate : min + 100;\n\n\treturn { min, max };\n}\n\nfunction normalizeValue(value: number | null, min: number, max: number): number | null {\n\tif (value === null || !Number.isFinite(value)) return null;\n\treturn Math.min(max, Math.max(min, value));\n}\n\nfunction formatProgressValue(\n\tvalue: number | null,\n\tmin: number,\n\tmax: number,\n\tlocale: Intl.LocalesArgument | undefined,\n\tformat: Intl.NumberFormatOptions | undefined,\n): string | null {\n\tif (value === null) return null;\n\n\tif (format) {\n\t\treturn new Intl.NumberFormat(locale, format).format(value);\n\t}\n\n\tconst normalized = max === min ? 0 : (value - min) / (max - min);\n\treturn new Intl.NumberFormat(locale, {\n\t\tstyle: 'percent',\n\t\tmaximumFractionDigits: 0,\n\t}).format(normalized);\n}\n\nconst Progress = forwardRef<HTMLDivElement, ProgressProps>(function Progress(\n\t{\n\t\tvalue: valueProp,\n\t\tmin: minProp,\n\t\tmax: maxProp,\n\t\tformat,\n\t\tlocale,\n\t\tgetAriaValueText,\n\t\tchildren,\n\t\tlabel,\n\t\tdescription,\n\t\tmetadata,\n\t\tshowValue: showValueProp,\n\t\tvalueSlot,\n\t\theaderSlot,\n\t\ttrackSlot,\n\t\tsize: sizeProp,\n\t\ttone = 'primary',\n\t\ttrackProps,\n\t\tindicatorProps,\n\t\tstrings: stringsProp,\n\t\tclassName,\n\t\t'aria-describedby': ariaDescribedBy,\n\t\t...props\n\t},\n\tref,\n) {\n\tconst strings = useStrings(defaultProgressStrings, stringsProp);\n\tconst formatting = useFormattingConfig();\n\tconst { defaultScale } = useDensityConfig();\n\tconst size = resolveComponentScale(sizeProp, defaultScale);\n\tconst resolvedLocale = locale ?? formatting.locale;\n\tconst descriptionId = useId();\n\tconst { min, max } = normalizeRange(minProp, maxProp);\n\tconst value = normalizeValue(valueProp, min, max);\n\tconst formattedValue = formatProgressValue(value, min, max, resolvedLocale, format);\n\tconst usesGeneratedHeader = headerSlot === undefined && children === undefined;\n\tconst showValue = showValueProp ?? label !== undefined;\n\tconst hasSummary =\n\t\tlabel !== undefined || description !== undefined || metadata !== undefined || valueSlot !== undefined || showValue;\n\tconst descriptionIds =\n\t\t[ariaDescribedBy, usesGeneratedHeader && description !== undefined ? descriptionId : undefined]\n\t\t\t.filter(Boolean)\n\t\t\t.join(' ') || undefined;\n\tconst resolvedGetAriaValueText = (_formattedValue: string | null, currentValue: number | null) => {\n\t\tconst normalizedFormattedValue = formatProgressValue(currentValue, min, max, resolvedLocale, format);\n\t\tif (getAriaValueText) {\n\t\t\treturn getAriaValueText(normalizedFormattedValue, currentValue);\n\t\t}\n\t\treturn normalizedFormattedValue ?? strings.indeterminateValue;\n\t};\n\tconst contextValue = useMemo(() => ({ formattedValue, value }), [formattedValue, value]);\n\tconst resolvedHeader =\n\t\theaderSlot ??\n\t\tchildren ??\n\t\t(hasSummary ? (\n\t\t\t<>\n\t\t\t\t<Stack gap=\"dense\" className=\"progress--summary min-w-0\">\n\t\t\t\t\t{label !== undefined && <ProgressLabel>{label}</ProgressLabel>}\n\t\t\t\t\t{description !== undefined &&\n\t\t\t\t\t\t(isSimpleText(description) ? (\n\t\t\t\t\t\t\t<Text\n\t\t\t\t\t\t\t\tid={descriptionId}\n\t\t\t\t\t\t\t\ttag=\"span\"\n\t\t\t\t\t\t\t\tsize=\"xs\"\n\t\t\t\t\t\t\t\ttype=\"secondary\"\n\t\t\t\t\t\t\t\tclassName=\"progress--description block\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{description}\n\t\t\t\t\t\t\t</Text>\n\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t<div id={descriptionId} className=\"progress--description\">\n\t\t\t\t\t\t\t\t{description}\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t))}\n\t\t\t\t</Stack>\n\t\t\t\t{(showValue || valueSlot !== undefined || metadata !== undefined) && (\n\t\t\t\t\t<Stack gap=\"dense\" align=\"end\" className=\"progress--details text-end\">\n\t\t\t\t\t\t{valueSlot ?? (showValue ? <ProgressValue /> : null)}\n\t\t\t\t\t\t{metadata !== undefined &&\n\t\t\t\t\t\t\t(isSimpleText(metadata) ? (\n\t\t\t\t\t\t\t\t<Text tag=\"span\" size=\"xs\" type=\"secondary\" className=\"progress--metadata tabular-nums\">\n\t\t\t\t\t\t\t\t\t{metadata}\n\t\t\t\t\t\t\t\t</Text>\n\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\tmetadata\n\t\t\t\t\t\t\t))}\n\t\t\t\t\t</Stack>\n\t\t\t\t)}\n\t\t\t</>\n\t\t) : null);\n\tconst resolvedTrack = trackSlot ?? (\n\t\t<ProgressTrack {...trackProps} size={trackProps?.size ?? size}>\n\t\t\t{trackProps?.children ?? <ProgressIndicator {...indicatorProps} tone={indicatorProps?.tone ?? tone} />}\n\t\t</ProgressTrack>\n\t);\n\n\treturn (\n\t\t<ProgressContext.Provider value={contextValue}>\n\t\t\t<ProgressPrimitive.Root\n\t\t\t\tref={ref}\n\t\t\t\tvalue={value}\n\t\t\t\tmin={min}\n\t\t\t\tmax={max}\n\t\t\t\tformat={format}\n\t\t\t\tlocale={resolvedLocale}\n\t\t\t\tgetAriaValueText={resolvedGetAriaValueText}\n\t\t\t\taria-describedby={descriptionIds}\n\t\t\t\tdata-slot=\"progress\"\n\t\t\t\tdata-size={size}\n\t\t\t\tdata-tone={tone}\n\t\t\t\tclassName={mergeStateClassName<ProgressRootState>(\n\t\t\t\t\t'progress--component grid min-w-0 w-full grid-cols-[minmax(0,1fr)_auto] items-start gap-x-space-lg gap-y-space-sm',\n\t\t\t\t\tclassName,\n\t\t\t\t)}\n\t\t\t\t{...props}\n\t\t\t>\n\t\t\t\t{resolvedHeader}\n\t\t\t\t{resolvedTrack}\n\t\t\t</ProgressPrimitive.Root>\n\t\t</ProgressContext.Provider>\n\t);\n});\nProgress.displayName = 'Progress';\n\nconst ProgressTrack = forwardRef<HTMLDivElement, ProgressTrackProps>(function ProgressTrack(\n\t{ className, size: sizeProp, ...props },\n\tref,\n) {\n\tconst { defaultScale } = useDensityConfig();\n\tconst size = resolveComponentScale(sizeProp, defaultScale);\n\treturn (\n\t\t<ProgressPrimitive.Track\n\t\t\tref={ref}\n\t\t\tdata-slot=\"progress-track\"\n\t\t\tdata-size={size}\n\t\t\tclassName={mergeStateClassName<ProgressTrackState>(\n\t\t\t\tcn(\n\t\t\t\t\t'progress-track--component progress--track relative col-span-full flex w-full items-center overflow-hidden rounded-full bg-muted',\n\t\t\t\t\ttrackHeightClasses[size],\n\t\t\t\t),\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t/>\n\t);\n});\nProgressTrack.displayName = 'ProgressTrack';\n\nconst ProgressIndicator = forwardRef<HTMLDivElement, ProgressIndicatorProps>(function ProgressIndicator(\n\t{ className, tone = 'primary', ...props },\n\tref,\n) {\n\treturn (\n\t\t<ProgressPrimitive.Indicator\n\t\t\tref={ref}\n\t\t\tdata-slot=\"progress-indicator\"\n\t\t\tdata-tone={tone}\n\t\t\tclassName={mergeStateClassName<ProgressIndicatorState>(\n\t\t\t\tcn(\n\t\t\t\t\t'progress-indicator--component progress--indicator h-full rounded-full transition-[width] duration-300 ease-out motion-reduce:transition-none',\n\t\t\t\t\t'data-[indeterminate]:w-full motion-safe:data-[indeterminate]:animate-pulse',\n\t\t\t\t\tINDICATOR_TONE_CLASSNAMES[tone],\n\t\t\t\t),\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t/>\n\t);\n});\nProgressIndicator.displayName = 'ProgressIndicator';\n\nconst ProgressLabel = forwardRef<HTMLSpanElement, ProgressLabelProps>(function ProgressLabel(\n\t{ className, children, ...props },\n\tref,\n) {\n\treturn (\n\t\t<ProgressPrimitive.Label\n\t\t\tref={ref}\n\t\t\tdata-slot=\"progress-label\"\n\t\t\tclassName={mergeStateClassName<ProgressLabelState>(\n\t\t\t\t'progress-label--component progress--label min-w-0',\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t>\n\t\t\t{isSimpleText(children) ? (\n\t\t\t\t<Text tag=\"span\" weight=\"medium\" lineHeight=\"tight\" className=\"block\">\n\t\t\t\t\t{children}\n\t\t\t\t</Text>\n\t\t\t) : (\n\t\t\t\tchildren\n\t\t\t)}\n\t\t</ProgressPrimitive.Label>\n\t);\n});\nProgressLabel.displayName = 'ProgressLabel';\n\nconst ProgressValue = forwardRef<HTMLSpanElement, ProgressValueProps>(function ProgressValue(\n\t{ className, children, ...props },\n\tref,\n) {\n\tconst context = useContext(ProgressContext);\n\n\treturn (\n\t\t<ProgressPrimitive.Value\n\t\t\tref={ref}\n\t\t\tdata-slot=\"progress-value\"\n\t\t\tclassName={mergeStateClassName<ProgressValueState>(\n\t\t\t\t'progress-value--component progress--value whitespace-nowrap',\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t>\n\t\t\t{(_primitiveFormattedValue, primitiveValue) => {\n\t\t\t\tconst value = context?.value ?? primitiveValue;\n\t\t\t\tconst formattedValue = context?.formattedValue ?? _primitiveFormattedValue;\n\t\t\t\tconst content = children ? children(formattedValue, value) : formattedValue;\n\n\t\t\t\tif (content === null || content === undefined) return null;\n\t\t\t\treturn isSimpleText(content) ? (\n\t\t\t\t\t// The percentage is the bar's primary value, so it mirrors\n\t\t\t\t\t// ProgressLabel: provider-default size and medium weight. Pinning\n\t\t\t\t\t// it to `xs`/secondary demoted the headline number below its own\n\t\t\t\t\t// caption and left the two off a shared baseline.\n\t\t\t\t\t<Text tag=\"span\" weight=\"medium\" lineHeight=\"tight\" className=\"block tabular-nums\">\n\t\t\t\t\t\t{content}\n\t\t\t\t\t</Text>\n\t\t\t\t) : (\n\t\t\t\t\tcontent\n\t\t\t\t);\n\t\t\t}}\n\t\t</ProgressPrimitive.Value>\n\t);\n});\nProgressValue.displayName = 'ProgressValue';\n\nexport { Progress, ProgressTrack, ProgressIndicator, ProgressLabel, ProgressValue, defaultProgressStrings };\nexport type { ProgressStrings };\n"],"mappings":";;;;;;;;;;;AAKA,IAAaW,IAA0C,EAC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B,CAAA;AAE3B,CAAC;AACD,EAAc,cAAc"}
|
|
1
|
+
{"version":3,"file":"progress-BvF2oCdV.js","names":["Progress","_Fragment","ProgressPrimitive","useFormattingConfig","useDensityConfig","resolveComponentScale","cn","Text","Stack","trackHeightClasses","Fragment$1","defaultProgressStrings","ProgressContext","createContext","isSimpleText","value","INDICATOR_TONE_CLASSNAMES","mergeStateClassName","className","baseClassName","state","normalizeRange","min","minProp","maxCandidate","maxProp","normalizeValue","max","formatProgressValue","format","locale","normalized","Progress$1","forwardRef","valueProp","showValueProp","sizeProp","stringsProp","ariaDescribedBy","props","strings","useStrings","formatting","size","defaultScale","resolvedLocale","descriptionId","useId","formattedValue","usesGeneratedHeader","headerSlot","children","showValue","label","hasSummary","description","metadata","valueSlot","descriptionIds","resolvedGetAriaValueText","normalizedFormattedValue","currentValue","getAriaValueText","contextValue","useMemo","resolvedHeader","ProgressLabel","ProgressValue","resolvedTrack","trackSlot","ProgressTrack","trackProps","ProgressIndicator","indicatorProps","tone","Progress","context","useContext","primitiveValue","_primitiveFormattedValue","content"],"sources":["../src/components/base/feedback/progress.strings.ts","../src/components/base/feedback/progress.tsx"],"sourcesContent":["export interface ProgressStrings {\n\t/** Screen-reader value announced while progress is indeterminate. */\n\tindeterminateValue: string;\n}\n\nexport const defaultProgressStrings: ProgressStrings = {\n\tindeterminateValue: 'In progress',\n};\n","import { trackHeightClasses } from '../../../lib/track-recipes';\n/**\n * Progress — token-driven Base UI progress wrapper for completion, quota,\n * and long-running task states.\n *\n * The root keeps the Base UI accessibility contract while adding a concise\n * admin summary API (`label`, `description`, `metadata`, `showValue`),\n * semantic tones, structural sizes, stable DOM hooks, and composition slots.\n * Consumers can still assemble `ProgressLabel`, `ProgressValue`,\n * `ProgressTrack`, and `ProgressIndicator` directly.\n */\nimport { Progress as ProgressPrimitive } from '@base-ui/react/progress';\nimport { createContext, forwardRef, useContext, useId, useMemo, type ReactNode } from 'react';\n\nimport { Text } from '../../typography';\nimport { Stack } from '../structure';\nimport { useDensityConfig, useFormattingConfig, type ComponentScale } from '../../../lib/ui-provider';\nimport { resolveComponentScale } from '../../../lib/ui-provider/scale';\nimport { useStrings, type StringsProp } from '../../../lib/strings';\nimport { cn } from '../../../lib/utils';\nimport type { SemanticTone } from '../../../lib/component-vocabulary';\n\nimport { defaultProgressStrings, type ProgressStrings } from './progress.strings';\n\nexport type ProgressSize = ComponentScale;\nexport type ProgressTone = SemanticTone;\n\ntype ProgressRootState = ProgressPrimitive.Root.State;\ntype ProgressTrackState = ProgressPrimitive.Track.State;\ntype ProgressIndicatorState = ProgressPrimitive.Indicator.State;\ntype ProgressLabelState = ProgressPrimitive.Label.State;\ntype ProgressValueState = ProgressPrimitive.Value.State;\n\ntype StatefulClassName<TState> = string | ((state: TState) => string | undefined) | undefined;\n\nexport interface ProgressProps extends Omit<\n\tProgressPrimitive.Root.Props,\n\t'children' | 'format' | 'getAriaValueText' | 'locale' | 'max' | 'min' | 'value'\n> {\n\t/** Current value. `null` renders an indeterminate state. */\n\tvalue: number | null;\n\t/** Minimum value used to normalize the visual percentage. @default 0 */\n\tmin?: number;\n\t/** Maximum value used to normalize the visual percentage. @default 100 */\n\tmax?: number;\n\t/** Intl options for formatting the raw value instead of the default normalized percentage. */\n\tformat?: Intl.NumberFormatOptions;\n\t/** Locale forwarded to `Intl.NumberFormat`. */\n\tlocale?: Intl.LocalesArgument;\n\t/** Human-readable text for the current value. Receives the wrapper's normalized display value. */\n\tgetAriaValueText?: (formattedValue: string | null, value: number | null) => string;\n\t/** Low-level compound content. `headerSlot` takes precedence when both are supplied. */\n\tchildren?: ReactNode;\n\t/** Accessible visual label. Supplying it also enables `showValue` by default. */\n\tlabel?: ReactNode;\n\t/** Supporting text automatically connected with `aria-describedby`. */\n\tdescription?: ReactNode;\n\t/** Optional right-aligned task metadata, such as \"18,400 of 25,000 rows\". */\n\tmetadata?: ReactNode;\n\t/** Show the formatted value beside the label. Defaults to `true` when `label` is supplied. */\n\tshowValue?: boolean;\n\t/** Replaces the formatted value while retaining the default summary layout. */\n\tvalueSlot?: ReactNode;\n\t/** Replaces the entire content above the track. */\n\theaderSlot?: ReactNode;\n\t/** Replaces the default track and indicator composition. */\n\ttrackSlot?: ReactNode;\n\t/** Track thickness. @default \"default\" */\n\tsize?: ProgressSize;\n\t/** Semantic indicator color. @default \"primary\" */\n\ttone?: ProgressTone;\n\t/** Props forwarded to the default track. Ignored when `trackSlot` is supplied. */\n\ttrackProps?: ProgressTrackProps;\n\t/** Props forwarded to the default indicator. Ignored when `trackSlot` is supplied. */\n\tindicatorProps?: ProgressIndicatorProps;\n\t/** Override the indeterminate screen-reader copy. */\n\tstrings?: StringsProp<ProgressStrings>;\n}\n\nexport interface ProgressTrackProps extends ProgressPrimitive.Track.Props {\n\t/** Track thickness. @default \"default\" */\n\tsize?: ProgressSize;\n}\n\nexport interface ProgressIndicatorProps extends ProgressPrimitive.Indicator.Props {\n\t/** Semantic fill color. @default \"primary\" */\n\ttone?: ProgressTone;\n}\n\nexport interface ProgressLabelProps extends ProgressPrimitive.Label.Props {\n\t/** Accessible label content. */\n\tchildren?: ReactNode;\n}\n\nexport interface ProgressValueProps extends Omit<ProgressPrimitive.Value.Props, 'children'> {\n\t/** Customize the formatted display while preserving the value semantics. */\n\tchildren?: (formattedValue: string | null, value: number | null) => ReactNode;\n}\n\ninterface ProgressContextValue {\n\tformattedValue: string | null;\n\tvalue: number | null;\n}\n\nconst ProgressContext = createContext<ProgressContextValue | null>(null);\n\nfunction isSimpleText(value: ReactNode): value is string | number | bigint {\n\treturn typeof value === 'string' || typeof value === 'number' || typeof value === 'bigint';\n}\n\n\n\nconst INDICATOR_TONE_CLASSNAMES: Record<ProgressTone, string> = {\n\tneutral: 'bg-muted-foreground',\n\tprimary: 'bg-primary',\n\tsecondary: 'bg-secondary-foreground',\n\tsuccess: 'bg-success',\n\tinfo: 'bg-info',\n\twarning: 'bg-warning',\n\tdestructive: 'bg-destructive',\n};\n\nfunction mergeStateClassName<TState>(\n\tbaseClassName: string,\n\tclassName: StatefulClassName<TState>,\n): string | ((state: TState) => string) {\n\tif (typeof className === 'function') {\n\t\treturn (state) => cn(baseClassName, className(state));\n\t}\n\n\treturn cn(baseClassName, className);\n}\n\nfunction normalizeRange(minProp: number | undefined, maxProp: number | undefined) {\n\tconst min = Number.isFinite(minProp) ? (minProp as number) : 0;\n\tconst maxCandidate = Number.isFinite(maxProp) ? (maxProp as number) : 100;\n\tconst max = maxCandidate > min ? maxCandidate : min + 100;\n\n\treturn { min, max };\n}\n\nfunction normalizeValue(value: number | null, min: number, max: number): number | null {\n\tif (value === null || !Number.isFinite(value)) return null;\n\treturn Math.min(max, Math.max(min, value));\n}\n\nfunction formatProgressValue(\n\tvalue: number | null,\n\tmin: number,\n\tmax: number,\n\tlocale: Intl.LocalesArgument | undefined,\n\tformat: Intl.NumberFormatOptions | undefined,\n): string | null {\n\tif (value === null) return null;\n\n\tif (format) {\n\t\treturn new Intl.NumberFormat(locale, format).format(value);\n\t}\n\n\tconst normalized = max === min ? 0 : (value - min) / (max - min);\n\treturn new Intl.NumberFormat(locale, {\n\t\tstyle: 'percent',\n\t\tmaximumFractionDigits: 0,\n\t}).format(normalized);\n}\n\nconst Progress = forwardRef<HTMLDivElement, ProgressProps>(function Progress(\n\t{\n\t\tvalue: valueProp,\n\t\tmin: minProp,\n\t\tmax: maxProp,\n\t\tformat,\n\t\tlocale,\n\t\tgetAriaValueText,\n\t\tchildren,\n\t\tlabel,\n\t\tdescription,\n\t\tmetadata,\n\t\tshowValue: showValueProp,\n\t\tvalueSlot,\n\t\theaderSlot,\n\t\ttrackSlot,\n\t\tsize: sizeProp,\n\t\ttone = 'primary',\n\t\ttrackProps,\n\t\tindicatorProps,\n\t\tstrings: stringsProp,\n\t\tclassName,\n\t\t'aria-describedby': ariaDescribedBy,\n\t\t...props\n\t},\n\tref,\n) {\n\tconst strings = useStrings(defaultProgressStrings, stringsProp);\n\tconst formatting = useFormattingConfig();\n\tconst { defaultScale } = useDensityConfig();\n\tconst size = resolveComponentScale(sizeProp, defaultScale);\n\tconst resolvedLocale = locale ?? formatting.locale;\n\tconst descriptionId = useId();\n\tconst { min, max } = normalizeRange(minProp, maxProp);\n\tconst value = normalizeValue(valueProp, min, max);\n\tconst formattedValue = formatProgressValue(value, min, max, resolvedLocale, format);\n\tconst usesGeneratedHeader = headerSlot === undefined && children === undefined;\n\tconst showValue = showValueProp ?? label !== undefined;\n\tconst hasSummary =\n\t\tlabel !== undefined || description !== undefined || metadata !== undefined || valueSlot !== undefined || showValue;\n\tconst descriptionIds =\n\t\t[ariaDescribedBy, usesGeneratedHeader && description !== undefined ? descriptionId : undefined]\n\t\t\t.filter(Boolean)\n\t\t\t.join(' ') || undefined;\n\tconst resolvedGetAriaValueText = (_formattedValue: string | null, currentValue: number | null) => {\n\t\tconst normalizedFormattedValue = formatProgressValue(currentValue, min, max, resolvedLocale, format);\n\t\tif (getAriaValueText) {\n\t\t\treturn getAriaValueText(normalizedFormattedValue, currentValue);\n\t\t}\n\t\treturn normalizedFormattedValue ?? strings.indeterminateValue;\n\t};\n\tconst contextValue = useMemo(() => ({ formattedValue, value }), [formattedValue, value]);\n\tconst resolvedHeader =\n\t\theaderSlot ??\n\t\tchildren ??\n\t\t(hasSummary ? (\n\t\t\t<>\n\t\t\t\t<Stack gap=\"dense\" className=\"progress--summary min-w-0\">\n\t\t\t\t\t{label !== undefined && <ProgressLabel>{label}</ProgressLabel>}\n\t\t\t\t\t{description !== undefined &&\n\t\t\t\t\t\t(isSimpleText(description) ? (\n\t\t\t\t\t\t\t<Text\n\t\t\t\t\t\t\t\tid={descriptionId}\n\t\t\t\t\t\t\t\ttag=\"span\"\n\t\t\t\t\t\t\t\tsize=\"xs\"\n\t\t\t\t\t\t\t\ttype=\"secondary\"\n\t\t\t\t\t\t\t\tclassName=\"progress--description block\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{description}\n\t\t\t\t\t\t\t</Text>\n\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t<div id={descriptionId} className=\"progress--description\">\n\t\t\t\t\t\t\t\t{description}\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t))}\n\t\t\t\t</Stack>\n\t\t\t\t{(showValue || valueSlot !== undefined || metadata !== undefined) && (\n\t\t\t\t\t<Stack gap=\"dense\" align=\"end\" className=\"progress--details text-end\">\n\t\t\t\t\t\t{valueSlot ?? (showValue ? <ProgressValue /> : null)}\n\t\t\t\t\t\t{metadata !== undefined &&\n\t\t\t\t\t\t\t(isSimpleText(metadata) ? (\n\t\t\t\t\t\t\t\t<Text tag=\"span\" size=\"xs\" type=\"secondary\" className=\"progress--metadata tabular-nums\">\n\t\t\t\t\t\t\t\t\t{metadata}\n\t\t\t\t\t\t\t\t</Text>\n\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\tmetadata\n\t\t\t\t\t\t\t))}\n\t\t\t\t\t</Stack>\n\t\t\t\t)}\n\t\t\t</>\n\t\t) : null);\n\tconst resolvedTrack = trackSlot ?? (\n\t\t<ProgressTrack {...trackProps} size={trackProps?.size ?? size}>\n\t\t\t{trackProps?.children ?? <ProgressIndicator {...indicatorProps} tone={indicatorProps?.tone ?? tone} />}\n\t\t</ProgressTrack>\n\t);\n\n\treturn (\n\t\t<ProgressContext.Provider value={contextValue}>\n\t\t\t<ProgressPrimitive.Root\n\t\t\t\tref={ref}\n\t\t\t\tvalue={value}\n\t\t\t\tmin={min}\n\t\t\t\tmax={max}\n\t\t\t\tformat={format}\n\t\t\t\tlocale={resolvedLocale}\n\t\t\t\tgetAriaValueText={resolvedGetAriaValueText}\n\t\t\t\taria-describedby={descriptionIds}\n\t\t\t\tdata-slot=\"progress\"\n\t\t\t\tdata-size={size}\n\t\t\t\tdata-tone={tone}\n\t\t\t\tclassName={mergeStateClassName<ProgressRootState>(\n\t\t\t\t\t'progress--component grid min-w-0 w-full grid-cols-[minmax(0,1fr)_auto] items-start gap-x-space-lg gap-y-space-sm',\n\t\t\t\t\tclassName,\n\t\t\t\t)}\n\t\t\t\t{...props}\n\t\t\t>\n\t\t\t\t{resolvedHeader}\n\t\t\t\t{resolvedTrack}\n\t\t\t</ProgressPrimitive.Root>\n\t\t</ProgressContext.Provider>\n\t);\n});\nProgress.displayName = 'Progress';\n\nconst ProgressTrack = forwardRef<HTMLDivElement, ProgressTrackProps>(function ProgressTrack(\n\t{ className, size: sizeProp, ...props },\n\tref,\n) {\n\tconst { defaultScale } = useDensityConfig();\n\tconst size = resolveComponentScale(sizeProp, defaultScale);\n\treturn (\n\t\t<ProgressPrimitive.Track\n\t\t\tref={ref}\n\t\t\tdata-slot=\"progress-track\"\n\t\t\tdata-size={size}\n\t\t\tclassName={mergeStateClassName<ProgressTrackState>(\n\t\t\t\tcn(\n\t\t\t\t\t'progress-track--component progress--track relative col-span-full flex w-full items-center overflow-hidden rounded-full bg-muted',\n\t\t\t\t\ttrackHeightClasses[size],\n\t\t\t\t),\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t/>\n\t);\n});\nProgressTrack.displayName = 'ProgressTrack';\n\nconst ProgressIndicator = forwardRef<HTMLDivElement, ProgressIndicatorProps>(function ProgressIndicator(\n\t{ className, tone = 'primary', ...props },\n\tref,\n) {\n\treturn (\n\t\t<ProgressPrimitive.Indicator\n\t\t\tref={ref}\n\t\t\tdata-slot=\"progress-indicator\"\n\t\t\tdata-tone={tone}\n\t\t\tclassName={mergeStateClassName<ProgressIndicatorState>(\n\t\t\t\tcn(\n\t\t\t\t\t'progress-indicator--component progress--indicator h-full rounded-full transition-[width] duration-300 ease-out motion-reduce:transition-none',\n\t\t\t\t\t'data-[indeterminate]:w-full motion-safe:data-[indeterminate]:animate-pulse',\n\t\t\t\t\tINDICATOR_TONE_CLASSNAMES[tone],\n\t\t\t\t),\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t/>\n\t);\n});\nProgressIndicator.displayName = 'ProgressIndicator';\n\nconst ProgressLabel = forwardRef<HTMLSpanElement, ProgressLabelProps>(function ProgressLabel(\n\t{ className, children, ...props },\n\tref,\n) {\n\treturn (\n\t\t<ProgressPrimitive.Label\n\t\t\tref={ref}\n\t\t\tdata-slot=\"progress-label\"\n\t\t\tclassName={mergeStateClassName<ProgressLabelState>(\n\t\t\t\t'progress-label--component progress--label min-w-0',\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t>\n\t\t\t{isSimpleText(children) ? (\n\t\t\t\t<Text tag=\"span\" weight=\"medium\" lineHeight=\"tight\" className=\"block\">\n\t\t\t\t\t{children}\n\t\t\t\t</Text>\n\t\t\t) : (\n\t\t\t\tchildren\n\t\t\t)}\n\t\t</ProgressPrimitive.Label>\n\t);\n});\nProgressLabel.displayName = 'ProgressLabel';\n\nconst ProgressValue = forwardRef<HTMLSpanElement, ProgressValueProps>(function ProgressValue(\n\t{ className, children, ...props },\n\tref,\n) {\n\tconst context = useContext(ProgressContext);\n\n\treturn (\n\t\t<ProgressPrimitive.Value\n\t\t\tref={ref}\n\t\t\tdata-slot=\"progress-value\"\n\t\t\tclassName={mergeStateClassName<ProgressValueState>(\n\t\t\t\t'progress-value--component progress--value whitespace-nowrap',\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t>\n\t\t\t{(_primitiveFormattedValue, primitiveValue) => {\n\t\t\t\tconst value = context?.value ?? primitiveValue;\n\t\t\t\tconst formattedValue = context?.formattedValue ?? _primitiveFormattedValue;\n\t\t\t\tconst content = children ? children(formattedValue, value) : formattedValue;\n\n\t\t\t\tif (content === null || content === undefined) return null;\n\t\t\t\treturn isSimpleText(content) ? (\n\t\t\t\t\t// The percentage is the bar's primary value, so it mirrors\n\t\t\t\t\t// ProgressLabel: provider-default size and medium weight. Pinning\n\t\t\t\t\t// it to `xs`/secondary demoted the headline number below its own\n\t\t\t\t\t// caption and left the two off a shared baseline.\n\t\t\t\t\t<Text tag=\"span\" weight=\"medium\" lineHeight=\"tight\" className=\"block tabular-nums\">\n\t\t\t\t\t\t{content}\n\t\t\t\t\t</Text>\n\t\t\t\t) : (\n\t\t\t\t\tcontent\n\t\t\t\t);\n\t\t\t}}\n\t\t</ProgressPrimitive.Value>\n\t);\n});\nProgressValue.displayName = 'ProgressValue';\n\nexport { Progress, ProgressTrack, ProgressIndicator, ProgressLabel, ProgressValue, defaultProgressStrings };\nexport type { ProgressStrings };\n"],"mappings":";;;;;;;;;;;AAKA,IAAaW,IAA0C,EACtD,oBAAoB,cACrB,GCiGMC,IAAkBC,EAA2C,IAAI;AAEvE,SAASC,EAAa,GAAqD;CAC1E,OAAO,OAAOC,KAAU,YAAY,OAAOA,KAAU,YAAY,OAAOA,KAAU;AACnF;AAIA,IAAMC,IAA0D;CAC/D,SAAS;CACT,SAAS;CACT,WAAW;CACX,SAAS;CACT,MAAM;CACN,SAAS;CACT,aAAa;AACd;AAEA,SAASC,EACR,GACA,GACuC;CAKvC,OAJI,OAAOC,KAAc,cAChB,MAAUZ,EAAGa,GAAeD,EAAUE,CAAK,CAAC,IAG9Cd,EAAGa,GAAeD,CAAS;AACnC;AAEA,SAASG,GAAe,GAA6B,GAA6B;CACjF,IAAMC,IAAM,OAAO,SAASC,CAAO,IAAKA,IAAqB,GACvDC,IAAe,OAAO,SAASC,CAAO,IAAKA,IAAqB;CAGtE,OAAO;EAAE;EAAK,KAFFD,IAAeF,IAAME,IAAeF,IAAM;CAEpC;AACnB;AAEA,SAASI,EAAe,GAAsB,GAAa,GAA4B;CAEtF,OADIX,MAAU,QAAQ,CAAC,OAAO,SAASA,CAAK,IAAU,OAC/C,KAAK,IAAIY,GAAK,KAAK,IAAIL,GAAKP,CAAK,CAAC;AAC1C;AAEA,SAASa,EACR,GACA,GACA,GACA,GACA,GACgB;CAChB,IAAIb,MAAU,MAAM,OAAO;CAE3B,IAAIc,GACH,OAAO,IAAI,KAAK,aAAaC,GAAQD,CAAM,CAAC,CAAC,OAAOd,CAAK;CAG1D,IAAMgB,IAAaJ,MAAQL,IAAM,KAAKP,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AMxB,IAAQ6D,GAAS,SAASE,GAC1B9B,IAAiB4B,GAAS,kBAAkBG,GAC5CC,IAAU7B,IAAWA,EAASH,GAAgBjC,CAAK,IAAIiC;GAG7D,OADIgC,KAAY,OAAsC,OAC/ClE,EAAakE,CAAO,IAK1B,kBAACzE,GAAD;IAAM,KAAI;IAAO,QAAO;IAAS,YAAW;IAAQ,WAAU;IAC5D,UAAAyE;GACI,CAAA,IAENA;EAEF;CACwB,CAAA;AAE3B,CAAC;AACD,EAAc,cAAc"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { t as e } from "./utils-
|
|
3
|
-
import { c as t } from "./typography-
|
|
4
|
-
import { t as n } from "./structure-
|
|
5
|
-
import { d as r, t as i } from "./smart-card-
|
|
6
|
-
import { r as a, t as o } from "./number-
|
|
2
|
+
import { t as e } from "./utils-CF3c95Io.js";
|
|
3
|
+
import { c as t } from "./typography-CSyJrh28.js";
|
|
4
|
+
import { t as n } from "./structure-C0V0_Fyf.js";
|
|
5
|
+
import { d as r, t as i } from "./smart-card-CqkzQsK-.js";
|
|
6
|
+
import { r as a, t as o } from "./number-E_OiIfJz.js";
|
|
7
7
|
import { forwardRef as s, useEffect as c, useRef as l, useState as u } from "react";
|
|
8
8
|
import { jsx as d, jsxs as f } from "react/jsx-runtime";
|
|
9
9
|
//#region src/components/blocks/commerce/receipt/receipt.tsx
|
|
@@ -113,4 +113,4 @@ function h({ items: r, currency: i, locale: s, unit: c, minorUnitScale: l, forma
|
|
|
113
113
|
//#endregion
|
|
114
114
|
export { m as n, h as t };
|
|
115
115
|
|
|
116
|
-
//# sourceMappingURL=receipt-
|
|
116
|
+
//# sourceMappingURL=receipt-D789Jwyy.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"receipt-
|
|
1
|
+
{"version":3,"file":"receipt-D789Jwyy.js","names":["NumberValue","cn","Text","Stack","hasRenderableContent","Card","Money","Number$1","paperClip","width","height","depth","inset","count","toothWidth","step","point","x","y","points","segment","Receipt","forwardRef","props","paper","useRef","clipPath","setClipPath","useState","toothDepth","element","update","rectangle","observer","children","header","footer","qrCode","hasFooter","className","shadow","ReceiptItems","items","item"],"sources":["../src/components/blocks/commerce/receipt/receipt.tsx","../src/components/blocks/commerce/receipt/receipt-items.tsx"],"sourcesContent":["import { forwardRef, useEffect, useRef, useState } from 'react';\nimport { Card, hasRenderableContent } from '../../../base/cards';\nimport { Stack } from '../../../base/structure';\nimport { cn } from '../../../../lib/utils';\nimport type { ReceiptProps } from './types';\n\nfunction paperClip(width: number, height: number, depth: number, toothWidth: number) {\n\tif (!(width > 0 && height > 0 && depth > 0)) return undefined;\n\tconst inset = Math.min(depth, height / 4);\n\tconst count = Math.max(1, Math.min(1024, Math.round(width / toothWidth)));\n\tconst step = width / count;\n\tconst point = (x: number, y: number) => `${Number(x.toFixed(2))}px ${Number(y.toFixed(2))}px`;\n\tconst points: string[] = [point(0, inset)];\n\tfor (let segment = 0; segment < count; segment++) {\n\t\tpoints.push(point((segment + 0.5) * step, 0), point((segment + 1) * step, inset));\n\t}\n\tpoints.push(point(width, height - inset));\n\tfor (let segment = count - 1; segment >= 0; segment--) {\n\t\tpoints.push(point((segment + 0.5) * step, height), point(segment * step, height - inset));\n\t}\n\treturn `polygon(${points.join(', ')})`;\n}\n\n/** Explicit paper surface: Card owns all content insets; clipping is decorative geometry. */\nexport const Receipt = forwardRef<HTMLDivElement, ReceiptProps>(function Receipt({\n\tchildren, header, footer, qrCode, padding = 'md', toothDepth = 5, toothWidth = 8,\n\tshadow = true, className, ...props\n}, ref) {\n\tconst paper = useRef<HTMLDivElement>(null);\n\tconst [clipPath, setClipPath] = useState<string>();\n\tconst depth = Number.isFinite(toothDepth) ? Math.max(0, toothDepth) : 5;\n\tconst width = Number.isFinite(toothWidth) ? Math.max(2, toothWidth) : 8;\n\tuseEffect(() => {\n\t\tconst element = paper.current;\n\t\tif (!element) return;\n\t\tconst update = () => {\n\t\t\tconst rectangle = element.getBoundingClientRect();\n\t\t\tsetClipPath(paperClip(rectangle.width, rectangle.height, depth, width));\n\t\t};\n\t\tupdate();\n\t\tif (typeof ResizeObserver === 'undefined') {\n\t\t\twindow.addEventListener('resize', update);\n\t\t\treturn () => window.removeEventListener('resize', update);\n\t\t}\n\t\tconst observer = new ResizeObserver(update);\n\t\tobserver.observe(element);\n\t\treturn () => observer.disconnect();\n\t}, [depth, width, children, header, footer, qrCode]);\n\tconst hasFooter = hasRenderableContent(footer) || hasRenderableContent(qrCode);\n\treturn <div {...props} ref={ref} className={cn('receipt--component relative isolate w-full min-w-0', className)}>\n\t\t{shadow && <div aria-hidden=\"true\" className=\"receipt--shadow pointer-events-none absolute inset-x-0 rounded-radius shadow-sm\" style={{ insetBlock: depth }} />}\n\t\t<Card ref={paper} surface=\"flat\" padding={padding} headerStart={header}\n\t\t\tfooterSlot={hasFooter ? <Stack gap=\"normal\" align=\"center\" className=\"receipt--footer w-full min-w-0\">{qrCode}{footer}</Stack> : undefined}\n\t\t\tclassName=\"receipt--paper relative bg-card text-card-foreground\" style={{ clipPath }}>\n\t\t\t{children}\n\t\t</Card>\n\t</div>;\n});\n","import { Stack } from '../../../base/structure';\nimport { Money } from '../../../primitives/money';\nimport { Number as NumberValue } from '../../../primitives/number';\nimport { Text } from '../../../typography/text';\nimport { cn } from '../../../../lib/utils';\nimport type { ReceiptItemsProps } from './types';\n\nexport function ReceiptItems({ items, currency, locale, unit, minorUnitScale, formatMode, className, ...props }: ReceiptItemsProps) {\n\tif (items.length === 0) return null;\n\treturn <Stack {...props} gap=\"md\" className={cn('receipt-items--component min-w-0', className)}>\n\t\t{items.map(item => <Stack key={item.id} direction=\"horizontal\" gap=\"md\" justify=\"between\" align=\"start\" wrap={false} className=\"receipt-items--item min-w-0\">\n\t\t\t<Stack gap=\"dense\" className=\"receipt-items--copy min-w-0 flex-1\">\n\t\t\t\t<Text type=\"inherit\" className=\"break-words [overflow-wrap:anywhere]\">{item.name} × <NumberValue type=\"inherit\" value={item.quantity} locale={locale} align=\"left\" /></Text>\n\t\t\t\t{item.description != null && <Text size=\"xs\" type=\"secondary\" className=\"break-words [overflow-wrap:anywhere]\">{item.description}</Text>}\n\t\t\t</Stack>\n\t\t\t<Money type=\"inherit\" amount={item.total ?? item.quantity * item.unitPrice} currency={currency} locale={locale} unit={unit} minorUnitScale={minorUnitScale} formatMode={formatMode} className=\"receipt-items--amount min-w-0 max-w-full whitespace-normal [overflow-wrap:anywhere]\" />\n\t\t</Stack>)}\n\t</Stack>;\n}\n"],"mappings":";;;;;;;;;AAMA,SAASQ,EAAU,GAAe,GAAgB,GAAe,GAAoB;CACpF,IAAI,EAAEC,IAAQ,KAAKC,IAAS,KAAKC,IAAQ,IAAI;CAC7C,IAAMC,IAAQ,KAAK,IAAID,GAAOD,IAAS,CAAC,GAClCG,IAAQ,KAAK,IAAI,GAAG,KAAK,IAAI,MAAM,KAAK,MAAMJ,IAAQK,CAAU,CAAC,CAAC,GAClEC,IAAON,IAAQI,GACfG,KAAS,GAAW,MAAc,GAAG,OAAOC,EAAE,QAAQ,CAAC,CAAC,EAAE,KAAK,OAAOC,EAAE,QAAQ,CAAC,CAAC,EAAE,KACpFC,IAAmB,CAACH,EAAM,GAAGJ,CAAK,CAAC;CACzC,KAAK,IAAIQ,IAAU,GAAGA,IAAUP,GAAO,KACtC,EAAO,KAAKG,GAAOI,IAAU,MAAOL,GAAM,CAAC,GAAGC,GAAOI,IAAU,KAAKL,GAAMH,CAAK,CAAC;CAEjF,EAAO,KAAKI,EAAMP,GAAOC,IAASE,CAAK,CAAC;CACxC,KAAK,IAAIQ,IAAUP,IAAQ,GAAGO,KAAW,GAAG,KAC3C,EAAO,KAAKJ,GAAOI,IAAU,MAAOL,GAAML,CAAM,GAAGM,EAAMI,IAAUL,GAAML,IAASE,CAAK,CAAC;CAEzF,OAAO,WAAWO,EAAO,KAAK,IAAI,EAAE;AACrC;AAGA,IAAaE,IAAUC,EAAyC,SAAiB,EAChF,aAAU,W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AAU;GAAuD,OAAO,EAAE,YAAS;GAClF;EACI,CAAA,CACF;;AACN,CAAC;;;AClDD,SAAgBK,EAAa,EAAE,UAAO,aAAU,WAAQ,SAAM,mBAAgB,eAAY,cAAW,GAAGlB,KAA4B;CAEnI,OADImB,EAAM,WAAW,IAAU,OACxB,kBAACvC,GAAD;EAAO,GAAIoB;EAAO,KAAI;EAAK,WAAWtB,EAAG,oCAAoCsC,CAAS;EAC3F,UAAAG,EAAM,KAAI,MAAQ,kBAACvC,GAAD;GAAqB,WAAU;GAAa,KAAI;GAAK,SAAQ;GAAU,OAAM;GAAQ,MAAM;GAAO,WAAU;GAA5G,UAAA,CAClB,kBAACA,GAAD;IAAO,KAAI;IAAQ,WAAU;IAA7B,UAAA,CACC,kBAACD,GAAD;KAAM,MAAK;KAAU,WAAU;KAA/B,UAAA;MAAuEyC,EAAK;MAAK;MAAG,kBAAC3C,GAAD;OAAa,MAAK;OAAU,OAAO2C,EAAK;OAAkB;OAAQ,OAAM;MAAQ,CAAA;KAAO;IAC1K,CAAA,GAAAA,EAAK,eAAe,QAAQ,kBAACzC,GAAD;KAAM,MAAK;KAAK,MAAK;KAAY,WAAU;KAAwC,UAAAyC,EAAK;IAAkB,CAAA,CACjI;GACP,CAAA,GAAA,kBAACrC,GAAD;IAAO,MAAK;IAAU,QAAQqC,EAAK,SAASA,EAAK,WAAWA,EAAK;IAAqB;IAAkB;IAAc;IAAsB;IAA4B;IAAY,WAAU;GAAuF,CAAA,CAC/Q;EANwB,GAAAA,EAAK,EAM7B,CAAC;CACF,CAAA;AACR"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { m as e } from "./ui-provider-
|
|
3
|
-
import { t } from "./utils-
|
|
4
|
-
import { n } from "./text.styles-
|
|
2
|
+
import { m as e } from "./ui-provider-CQCuCBcy.js";
|
|
3
|
+
import { t } from "./utils-CF3c95Io.js";
|
|
4
|
+
import { i as n } from "./text.styles-B64My8RZ.js";
|
|
5
5
|
import { n as r } from "./safe-image-src-C6kQSMBZ.js";
|
|
6
6
|
import { n as i, t as a } from "./sanitize-html-DsQmI48u.js";
|
|
7
7
|
import { t as o } from "./content-typography-CnwgMJ37.js";
|
|
@@ -75,4 +75,4 @@ _.displayName = "RichText";
|
|
|
75
75
|
//#endregion
|
|
76
76
|
export { _ as t };
|
|
77
77
|
|
|
78
|
-
//# sourceMappingURL=rich-text-
|
|
78
|
+
//# sourceMappingURL=rich-text-CLJEf76s.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rich-text-
|
|
1
|
+
{"version":3,"file":"rich-text-CLJEf76s.js","names":["useTypographyConfig","resolveTextClassNames","safeImageSrc","sanitizeHtmlTree","sanitizeHtml","contentTypographyClassName","VOID_ELEMENTS","toNumber","number","value","toReactProps","props","name","element","letter","renderNode","node","src","image","Fragment","renderImage","key","createElement","child","index","renderRichTextTree","tree","RichText","forwardRef","sizeProp","Tag","size","defaultTextSize","allowImages","images","sanitizedHtml","useMemo","html","classNames","cn"],"sources":["../src/components/typography/rich-text/rich-text-tree.tsx","../src/components/typography/rich-text/rich-text.tsx"],"sourcesContent":["import { createElement, Fragment, type ReactNode } from 'react';\nimport type { Element, Root, RootContent } from 'hast';\n\nimport { safeImageSrc } from '../../../lib/safe-image-src';\n\n/** An image in sanitized rich text, as handed to `renderImage`. */\nexport interface RichTextImageAttributes {\n\t/** Source that passed the package image policy (http, https, blob or relative). */\n\tsrc: string;\n\t/** Text alternative; empty for a decorative image. */\n\talt: string;\n\ttitle?: string;\n\twidth?: number;\n\theight?: number;\n}\n\nexport type RenderRichTextImage = (image: RichTextImageAttributes) => ReactNode;\n\nconst VOID_ELEMENTS = new Set(['br', 'img']);\n\nfunction toNumber(value: unknown): number | undefined {\n\tconst number = typeof value === 'number' ? value : Number(value);\n\treturn Number.isFinite(number) && number > 0 ? number : undefined;\n}\n\n/** hast properties are camelCase (`dataRefId`); the DOM attribute is `data-ref-id`. */\nfunction toReactProps(element: Element, key: number) {\n\tconst props: Record<string, unknown> = { key };\n\tfor (const [name, value] of Object.entries(element.properties)) {\n\t\tif (value == null || value === false) continue;\n\t\tif (name === 'className') props.className = Array.isArray(value) ? value.join(' ') : String(value);\n\t\telse if (/^data[A-Z]/.test(name)) props[name.replace(/[A-Z]/g, (letter) => `-${letter.toLowerCase()}`)] = String(value);\n\t\telse props[name] = Array.isArray(value) ? value.join(' ') : value;\n\t}\n\treturn props;\n}\n\nfunction renderNode(node: RootContent, key: number, renderImage: RenderRichTextImage): ReactNode {\n\tif (node.type === 'text') return node.value;\n\tif (node.type !== 'element') return null;\n\tif (node.tagName === 'img') {\n\t\tconst src = safeImageSrc(node.properties.src);\n\t\tif (!src) return null;\n\t\tconst image: RichTextImageAttributes = {\n\t\t\tsrc,\n\t\t\talt: typeof node.properties.alt === 'string' ? node.properties.alt : '',\n\t\t\ttitle: typeof node.properties.title === 'string' ? node.properties.title : undefined,\n\t\t\twidth: toNumber(node.properties.width),\n\t\t\theight: toNumber(node.properties.height),\n\t\t};\n\t\treturn <Fragment key={key}>{renderImage(image)}</Fragment>;\n\t}\n\tconst props = toReactProps(node, key);\n\tif (VOID_ELEMENTS.has(node.tagName)) return createElement(node.tagName, props);\n\treturn createElement(node.tagName, props, ...node.children.map((child, index) => renderNode(child, index, renderImage)));\n}\n\n/**\n * Renders an already sanitized tree as React elements, so each image can be\n * the consumer's own component (a framework image, a lightbox trigger) while\n * the surrounding markup keeps its structure. Server and client output match.\n */\nexport function renderRichTextTree(tree: Root, renderImage: RenderRichTextImage): ReactNode {\n\treturn tree.children.map((child, index) => renderNode(child, index, renderImage));\n}\n","import { forwardRef, useMemo } from 'react';\n\nimport { sanitizeHtml, sanitizeHtmlTree } from '../../../lib/sanitize-html';\nimport { useTypographyConfig } from '../../../lib/ui-provider';\nimport { cn } from '../../../lib/utils';\nimport { contentTypographyClassName } from '../content-typography';\n\nimport type { TextProps } from '../text';\nimport { resolveTextClassNames } from '../text.styles';\nimport { renderRichTextTree, type RenderRichTextImage } from './rich-text-tree';\n\nexport type { RenderRichTextImage, RichTextImageAttributes } from './rich-text-tree';\n\n/** Image rendering for read-only rich text. */\nexport interface RichTextImageRendering {\n\t/**\n\t * Renders each image, for example with a framework image component. It\n\t * receives only sources that passed the package image policy.\n\t */\n\trenderImage?: RenderRichTextImage;\n}\n\nexport interface RichTextProps\n\textends Omit<\n\t\tTextProps,\n\t\t'children' | 'content' | 'dangerouslySetInnerHTML'\n\t> {\n\t/** HTML sanitized through the package allowlist before rendering. */\n\thtml?: string | null;\n\t/**\n\t * Keeps images whose source is a web URL, a `blob:` preview or a relative\n\t * path (script and `data:` sources are removed). Pass `renderImage` to draw\n\t * each image with your own component. Default: images are removed.\n\t */\n\timages?: boolean | RichTextImageRendering;\n}\n\nexport const RichText = forwardRef<HTMLElement, RichTextProps>(\n\tfunction RichText(\n\t\t{\n\t\t\thtml,\n\t\t\ttype = 'main',\n\t\t\tsize: sizeProp,\n\t\t\talign = 'left',\n\t\t\tlineHeight = 'normal',\n\t\t\tweight = 'regular',\n\t\t\tclassName,\n\t\t\tnumeric = false,\n\t\t\ttag: Tag = 'p',\n\t\t\timages = false,\n\t\t\t...props\n\t\t},\n\t\tref,\n\t) {\n\t\tconst { defaultTextSize } = useTypographyConfig();\n\t\tconst size = sizeProp ?? defaultTextSize ?? 'sm';\n\t\tconst allowImages = Boolean(images);\n\t\tconst renderImage = typeof images === 'object' ? images.renderImage : undefined;\n\t\tconst sanitizedHtml = useMemo(() => sanitizeHtml(html ?? '', { images: allowImages }), [allowImages, html]);\n\t\t// Consumer image components need React elements; plain images keep the HTML path.\n\t\tconst tree = useMemo(\n\t\t\t() => (renderImage && sanitizedHtml ? renderRichTextTree(sanitizeHtmlTree(html ?? '', { images: true }), renderImage) : null),\n\t\t\t[html, renderImage, sanitizedHtml],\n\t\t);\n\n\t\tif (!sanitizedHtml) {\n\t\t\treturn null;\n\t\t}\n\n\t\tconst classNames = cn(contentTypographyClassName, resolveTextClassNames({\n\t\t\ttype,\n\t\t\tsize,\n\t\t\talign,\n\t\t\tlineHeight,\n\t\t\tweight,\n\t\t\tnumeric,\n\t\t\tclassName,\n\t\t}));\n\n\t\tif (tree) {\n\t\t\treturn (\n\t\t\t\t<Tag ref={ref as never} className={classNames} data-typography=\"rich-text\" {...props}>\n\t\t\t\t\t{tree}\n\t\t\t\t</Tag>\n\t\t\t);\n\t\t}\n\n\t\treturn (\n\t\t\t<Tag\n\t\t\t\tref={ref as never}\n\t\t\t\tclassName={classNames}\n\t\t\t\tdata-typography=\"rich-text\"\n\t\t\t\tdangerouslySetInnerHTML={{ __html: sanitizedHtml }}\n\t\t\t\t{...props}\n\t\t\t/>\n\t\t);\n\t},\n);\n\nRichText.displayName = 'RichText';\n"],"mappings":";;;;;;;;;;AAkBA,IAAMM,oBAAgB,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC;AAE3C,SAASC,EAAS,GAAoC;CACrD,IAAMC,IAAS,OAAOC,KAAU,WAAWA,IAAQ,OAAOA,CAAK;CAC/D,OAAO,OAAO,SAASD,CAAM,KAAKA,IAAS,IAAIA,IAAS,KAAA;AACzD;AAGA,SAASE,EAAa,GAAkB,GAAa;CACpD,IAAMC,IAAiC,EAAE,OAAI;CAC7C,KAAK,IAAM,CAACC,GAAMH,MAAU,OAAO,QAAQI,EAAQ,UAAU,GAC5D,AAAIJ,KAAS,QAAQA,MAAU,OAC3BG,MAAS,cAAa,EAAM,YAAY,MAAM,QAAQH,CAAK,IAAIA,EAAM,KAAK,GAAG,IAAI,OAAOA,CAAK,IACxF,aAAa,KAAKG,CAAI,IAAG,EAAMA,EAAK,QAAQ,WAAW,MAAW,IAAIE,EAAO,YAAY,GAAG,KAAK,OAAOL,CAAK,IACjH,EAAMG,KAAQ,MAAM,QAAQH,CAAK,IAAIA,EAAM,KAAK,GAAG,IAAIA;CAE7D,OAAOE;AACR;AAEA,SAASI,EAAW,GAAmB,GAAa,GAA6C;CAChG,IAAIC,EAAK,SAAS,QAAQ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AI,CAAC,GAEpGX,IAAOU,QACLhB,KAAee,IAAgBV,EAAmBtB,EAAiBkC,KAAQ,IAAI,EAAE,QAAQ,GAAK,CAAC,GAAGjB,CAAW,IAAI,MACxH;EAACiB;EAAMjB;EAAae;CAAa,CAClC;CAEA,IAAI,CAACA,GACJ,OAAO;CAGR,IAAMG,IAAaC,EAAGlC,GAA4BJ,EAAsB;EACvE;EACA;EACA;EACA;EACA;EACA;EACA;CACD,CAAC,CAAC;CAUF,OARIyB,IAEF,kBAACI,GAAD;EAAU;EAAc,WAAWQ;EAAY,mBAAgB;EAAY,GAAI3B;EAC7E,UAAAe;CACG,CAAA,IAKN,kBAACI,GAAD;EACM;EACL,WAAWQ;EACX,mBAAgB;EAChB,yBAAyB,EAAE,QAAQH,EAAc;EACjD,GAAIxB;CACJ,CAAA;AAEH,CACD;AAEA,EAAS,cAAc"}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { interpolateString as e, useStrings as t } from "./lib/strings.js";
|
|
3
|
-
import { t as n } from "./utils-
|
|
4
|
-
import { n as r } from "./buttons-
|
|
5
|
-
import { c as i } from "./typography-
|
|
6
|
-
import { t as a } from "./structure-
|
|
3
|
+
import { t as n } from "./utils-CF3c95Io.js";
|
|
4
|
+
import { n as r } from "./buttons-BbfzgczK.js";
|
|
5
|
+
import { c as i } from "./typography-CSyJrh28.js";
|
|
6
|
+
import { t as a } from "./structure-C0V0_Fyf.js";
|
|
7
7
|
import { n as o } from "./safe-image-src-C6kQSMBZ.js";
|
|
8
8
|
import { n as s } from "./content-typography-CnwgMJ37.js";
|
|
9
|
-
import { g as c } from "./primitives-
|
|
10
|
-
import { t as l } from "./number-
|
|
11
|
-
import { t as u } from "./input-
|
|
12
|
-
import { t as d } from "./form-field-
|
|
13
|
-
import { n as f, t as ee } from "./rich-text-editor-toolbar-
|
|
9
|
+
import { g as c } from "./primitives-Du64iDbb.js";
|
|
10
|
+
import { t as l } from "./number-E_OiIfJz.js";
|
|
11
|
+
import { t as u } from "./input-Cdw4k0fb.js";
|
|
12
|
+
import { t as d } from "./form-field-CsgRmdit.js";
|
|
13
|
+
import { n as f, t as ee } from "./rich-text-editor-toolbar-L__e4x47.js";
|
|
14
14
|
import { t as te } from "./rich-text-editor.strings-CB59ekH2.js";
|
|
15
15
|
import { forwardRef as p, useCallback as m, useEffect as h, useId as ne, useImperativeHandle as re, useMemo as g, useRef as _, useState as v } from "react";
|
|
16
16
|
import { Fragment as y, jsx as b, jsxs as x } from "react/jsx-runtime";
|
|
@@ -1193,4 +1193,4 @@ $.displayName = "RichTextEditor";
|
|
|
1193
1193
|
//#endregion
|
|
1194
1194
|
export { T as n, $ as t };
|
|
1195
1195
|
|
|
1196
|
-
//# sourceMappingURL=rich-text-editor-
|
|
1196
|
+
//# sourceMappingURL=rich-text-editor-Cm1dpUpQ.js.map
|