@servicetitan/anvil2 1.46.0 → 1.46.2
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 +32 -0
- package/dist/{Alert-BNGvfMAV.js → Alert-CPOBY6O5.js} +2 -2
- package/dist/{Alert-BNGvfMAV.js.map → Alert-CPOBY6O5.js.map} +1 -1
- package/dist/Alert.js +1 -1
- package/dist/{Announcement-CoheCP1i.js → Announcement-BvzAEdx8.js} +2 -2
- package/dist/{Announcement-CoheCP1i.js.map → Announcement-BvzAEdx8.js.map} +1 -1
- package/dist/Announcement.js +1 -1
- package/dist/AnvilProvider-C_qRQnE6.js.map +1 -1
- package/dist/Avatar-CyGjhToG.js.map +1 -1
- package/dist/Avatar-D07f9NH_.js.map +1 -1
- package/dist/Badge-DCA9mfc2.js.map +1 -1
- package/dist/Breadcrumbs-C4_PEolS.js.map +1 -1
- package/dist/{Button-BxFXQ0-n.js → Button-VNQQgZ45.js} +2 -2
- package/dist/{Button-BxFXQ0-n.js.map → Button-VNQQgZ45.js.map} +1 -1
- package/dist/Button.css +48 -48
- package/dist/Button.js +1 -1
- package/dist/Button.module-C1g9rrJs.js +25 -0
- package/dist/Button.module-C1g9rrJs.js.map +1 -0
- package/dist/{ButtonCompound-BF2Q6gGX.js → ButtonCompound-BbPK-Xjj.js} +2 -2
- package/dist/{ButtonCompound-BF2Q6gGX.js.map → ButtonCompound-BbPK-Xjj.js.map} +1 -1
- package/dist/ButtonCompound.js +1 -1
- package/dist/{ButtonLink-CXv65WVV.js → ButtonLink-CqR1F5Wn.js} +3 -3
- package/dist/{ButtonLink-CXv65WVV.js.map → ButtonLink-CqR1F5Wn.js.map} +1 -1
- package/dist/ButtonLink.js +1 -1
- package/dist/{ButtonToggle-pSwg7NvT.js → ButtonToggle-PCeSG-5D.js} +3 -3
- package/dist/{ButtonToggle-pSwg7NvT.js.map → ButtonToggle-PCeSG-5D.js.map} +1 -1
- package/dist/ButtonToggle.js +1 -1
- package/dist/{Calendar-BQ5F2ENO.js → Calendar-X9qUi6Vx.js} +269 -123
- package/dist/Calendar-X9qUi6Vx.js.map +1 -0
- package/dist/Calendar.js +1 -1
- package/dist/Card-vTYeSkxt.js.map +1 -1
- package/dist/{Checkbox-DDrmVC-u.js → Checkbox-BDohwHXQ.js} +2 -2
- package/dist/{Checkbox-DDrmVC-u.js.map → Checkbox-BDohwHXQ.js.map} +1 -1
- package/dist/{Checkbox-Dl4KTwEJ.js → Checkbox-CcYtto5f.js} +2 -2
- package/dist/{Checkbox-Dl4KTwEJ.js.map → Checkbox-CcYtto5f.js.map} +1 -1
- package/dist/Checkbox.js +2 -2
- package/dist/Chip-Bz-vlQ4D.js.map +1 -1
- package/dist/{Combobox-B9nesJuc.js → Combobox-DQmW8Tyl.js} +144 -53
- package/dist/Combobox-DQmW8Tyl.js.map +1 -0
- package/dist/Combobox.js +1 -1
- package/dist/{DateField-DXxPsRtf.js → DateField-C43nfkbx.js} +7 -7
- package/dist/{DateField-DXxPsRtf.js.map → DateField-C43nfkbx.js.map} +1 -1
- package/dist/DateField.js +1 -1
- package/dist/{DateFieldRange-Xauviu1w.js → DateFieldRange-g7n5QYww.js} +8 -8
- package/dist/{DateFieldRange-Xauviu1w.js.map → DateFieldRange-g7n5QYww.js.map} +1 -1
- package/dist/DateFieldRange.js +1 -1
- package/dist/{DateFieldSingle-yLnwpVzd.js → DateFieldSingle-D3tneqeG.js} +8 -8
- package/dist/{DateFieldSingle-yLnwpVzd.js.map → DateFieldSingle-D3tneqeG.js.map} +1 -1
- package/dist/DateFieldSingle.js +1 -1
- package/dist/{DateFieldYearless-Ba7HiTiI.js → DateFieldYearless-3JBVj3wn.js} +4 -4
- package/dist/{DateFieldYearless-Ba7HiTiI.js.map → DateFieldYearless-3JBVj3wn.js.map} +1 -1
- package/dist/DateFieldYearless.js +1 -1
- package/dist/{DaysOfTheWeek-BYSYZySH.js → DaysOfTheWeek-RcPgDoM3.js} +4 -4
- package/dist/{DaysOfTheWeek-BYSYZySH.js.map → DaysOfTheWeek-RcPgDoM3.js.map} +1 -1
- package/dist/DaysOfTheWeek.js +1 -1
- package/dist/Details-CF8DImjw.js.map +1 -1
- package/dist/{Dialog-CgkrvrQu.js → Dialog-FNJ16gY6.js} +6 -6
- package/dist/{Dialog-CgkrvrQu.js.map → Dialog-FNJ16gY6.js.map} +1 -1
- package/dist/Dialog.js +1 -1
- package/dist/Divider-DJe8kLf2.js.map +1 -1
- package/dist/Dnd.js +1 -1
- package/dist/DndSort.js +2 -2
- package/dist/DndSort.js.map +1 -1
- package/dist/{Drawer-CM4ZbAro.js → Drawer-DT31CMRd.js} +6 -6
- package/dist/{Drawer-CM4ZbAro.js.map → Drawer-DT31CMRd.js.map} +1 -1
- package/dist/Drawer.js +1 -1
- package/dist/{DrawerContext-DboTgTmo.js → DrawerContext-D4tWTLVf.js} +27 -10
- package/dist/DrawerContext-D4tWTLVf.js.map +1 -0
- package/dist/{EditCard-WKzZ2XCz.js → EditCard-CZzL0nx7.js} +2 -2
- package/dist/{EditCard-WKzZ2XCz.js.map → EditCard-CZzL0nx7.js.map} +1 -1
- package/dist/EditCard.js +1 -1
- package/dist/{FieldLabel-BsbTTyom.js → FieldLabel-BP8QK5UR.js} +2 -2
- package/dist/{FieldLabel-BsbTTyom.js.map → FieldLabel-BP8QK5UR.js.map} +1 -1
- package/dist/FieldLabel.js +1 -1
- package/dist/FieldMessage-B7uQ8vmr.js.map +1 -1
- package/dist/Flex-BdQMekvA.js.map +1 -1
- package/dist/Grid-MGUC698u.js.map +1 -1
- package/dist/Helper-BkIDJqgA.js.map +1 -1
- package/dist/Icon-D8SPKeO4.js.map +1 -1
- package/dist/{InputMask-_F139qFu.js → InputMask-CPuYMcw9.js} +3 -3
- package/dist/{InputMask-_F139qFu.js.map → InputMask-CPuYMcw9.js.map} +1 -1
- package/dist/InputMask.js +1 -1
- package/dist/Layout-CUUb2PVr.js.map +1 -1
- package/dist/Link-eRsLWPaQ.js.map +1 -1
- package/dist/LinkButton-2lXfrVoU.js.map +1 -1
- package/dist/{ListView-pb3rIcze.js → ListView-BJI8BQJ-.js} +2 -2
- package/dist/{ListView-pb3rIcze.js.map → ListView-BJI8BQJ-.js.map} +1 -1
- package/dist/ListView.js +1 -1
- package/dist/Listbox-CUhMbFm2.js.map +1 -1
- package/dist/LocalizationContext-UsmB5mnR.js.map +1 -1
- package/dist/LocalizationProvider-DEZyjW5d.js.map +1 -1
- package/dist/{Menu-C8we5CHP.js → Menu-t_11BIhU.js} +10 -5
- package/dist/Menu-t_11BIhU.js.map +1 -0
- package/dist/Menu.js +1 -1
- package/dist/{NumberField-CkZZrkYC.js → NumberField-Bjf9Tyvf.js} +6 -6
- package/dist/{NumberField-CkZZrkYC.js.map → NumberField-Bjf9Tyvf.js.map} +1 -1
- package/dist/NumberField.js +1 -1
- package/dist/Overflow.js.map +1 -1
- package/dist/{Page-cKXkjMmd.js → Page-BAyXnhz2.js} +9 -9
- package/dist/Page-BAyXnhz2.js.map +1 -0
- package/dist/Page.js +1 -1
- package/dist/{Pagination-ta8a2cJN.js → Pagination-DCBic619.js} +47 -23
- package/dist/Pagination-DCBic619.js.map +1 -0
- package/dist/Pagination.css +6 -6
- package/dist/Pagination.js +1 -1
- package/dist/{Popover-r26xMIfm.js → Popover-CrksxqKk.js} +11 -5
- package/dist/Popover-CrksxqKk.js.map +1 -0
- package/dist/Popover.js +1 -1
- package/dist/PortalProvider-9lXkQ0xY.js.map +1 -1
- package/dist/{ProgressBar-DXcXZEJ2.js → ProgressBar-CgsAW2d8.js} +2 -2
- package/dist/{ProgressBar-DXcXZEJ2.js.map → ProgressBar-CgsAW2d8.js.map} +1 -1
- package/dist/ProgressBar.js +1 -1
- package/dist/{Radio-C89VCMXd.js → Radio-C_rvxw74.js} +2 -2
- package/dist/{Radio-C89VCMXd.js.map → Radio-C_rvxw74.js.map} +1 -1
- package/dist/Radio.js +2 -2
- package/dist/{RadioGroup-C_4buUtG.js → RadioGroup-DxBblSrx.js} +2 -2
- package/dist/{RadioGroup-C_4buUtG.js.map → RadioGroup-DxBblSrx.js.map} +1 -1
- package/dist/SearchField-Bb0uObwG.js.map +1 -1
- package/dist/{SegmentedControl-CsjjV1Dz.js → SegmentedControl-DC4BpdH5.js} +3 -3
- package/dist/{SegmentedControl-CsjjV1Dz.js.map → SegmentedControl-DC4BpdH5.js.map} +1 -1
- package/dist/SegmentedControl.js +1 -1
- package/dist/{SelectCard-BTYZg9TG.js → SelectCard-DunNE9R3.js} +3 -3
- package/dist/{SelectCard-BTYZg9TG.js.map → SelectCard-DunNE9R3.js.map} +1 -1
- package/dist/SelectCard.js +1 -1
- package/dist/{SelectTrigger-f1hvRrSC.js → SelectTrigger-BYysLREL.js} +2 -2
- package/dist/{SelectTrigger-f1hvRrSC.js.map → SelectTrigger-BYysLREL.js.map} +1 -1
- package/dist/SelectTrigger.js +1 -1
- package/dist/{SelectTriggerBase-DP9fmRSo.js → SelectTriggerBase-DqUpJgzk.js} +3 -3
- package/dist/{SelectTriggerBase-DP9fmRSo.js.map → SelectTriggerBase-DqUpJgzk.js.map} +1 -1
- package/dist/{SideNav-CBAzYyML.js → SideNav-B9AWmF_H.js} +2 -2
- package/dist/SideNav-B9AWmF_H.js.map +1 -0
- package/dist/SideNav.js +1 -1
- package/dist/Skeleton.js.map +1 -1
- package/dist/Spinner-wmO8Epw0.js.map +1 -1
- package/dist/SrOnly-CTsYSuby.js.map +1 -1
- package/dist/{Stepper-D-fOH9TF.js → Stepper-DHTrvfXw.js} +3 -3
- package/dist/{Stepper-D-fOH9TF.js.map → Stepper-DHTrvfXw.js.map} +1 -1
- package/dist/Stepper.js +1 -1
- package/dist/Switch-C2ddZcr9.js.map +1 -1
- package/dist/{Tab-wNucMTgo.js → Tab-0zx9hsw8.js} +44 -36
- package/dist/Tab-0zx9hsw8.js.map +1 -0
- package/dist/Tab.js +1 -1
- package/dist/Text-BqvcbXyp.js.map +1 -1
- package/dist/{TextField-D8fow9j7.js → TextField-CFWs3lm9.js} +2 -2
- package/dist/{TextField-D8fow9j7.js.map → TextField-CFWs3lm9.js.map} +1 -1
- package/dist/{TextField-BiHxlzE3.js → TextField-Cge6IRo5.js} +2 -2
- package/dist/{TextField-BiHxlzE3.js.map → TextField-Cge6IRo5.js.map} +1 -1
- package/dist/TextField.js +1 -1
- package/dist/{Textarea-BdVJJlbP.js → Textarea-CXd3NKkW.js} +2 -2
- package/dist/{Textarea-BdVJJlbP.js.map → Textarea-CXd3NKkW.js.map} +1 -1
- package/dist/Textarea.js +1 -1
- package/dist/ThemeProvider-Be3Pvtpz.js.map +1 -1
- package/dist/ThemeProviderContext-l52GohYT.js.map +1 -1
- package/dist/{TimeField-CmbErrsZ.js → TimeField-4v5aCwiG.js} +345 -355
- package/dist/TimeField-4v5aCwiG.js.map +1 -0
- package/dist/TimeField.js +1 -1
- package/dist/Toast.js +2 -2
- package/dist/{Toaster-9cpG_tWR.js → Toaster-D-rNSLTq.js} +17 -17
- package/dist/{Toaster-9cpG_tWR.js.map → Toaster-D-rNSLTq.js.map} +1 -1
- package/dist/{Toaster-B7zUwJOt.js → Toaster-bON5Xc1P.js} +2 -2
- package/dist/{Toaster-B7zUwJOt.js.map → Toaster-bON5Xc1P.js.map} +1 -1
- package/dist/{Toolbar-D4zuUFhb.js → Toolbar-B2Jsuptz.js} +14 -14
- package/dist/{Toolbar-D4zuUFhb.js.map → Toolbar-B2Jsuptz.js.map} +1 -1
- package/dist/Toolbar.js +1 -1
- package/dist/{Tooltip-BI3Xs75X.js → Tooltip-CtCLw_vx.js} +8 -2
- package/dist/{Tooltip-BI3Xs75X.js.map → Tooltip-CtCLw_vx.js.map} +1 -1
- package/dist/Tooltip.js +1 -1
- package/dist/TrackingProvider-BtSjkmpM.js.map +1 -1
- package/dist/assets/icons/st/gnav_legacy_search_filled.svg +1 -1
- package/dist/assets/icons/st/gnav_legacy_search_outline.svg +1 -1
- package/dist/beta.js +1 -1
- package/dist/childrenToString-Bz9MqbHb.js.map +1 -1
- package/dist/components/Combobox/ComboboxTypes.d.ts +10 -5
- package/dist/components/Combobox/internal/ComboboxGroupContext.d.ts +1 -1
- package/dist/components/Combobox/internal/useGroups.d.ts +2 -2
- package/dist/components/DndSort/internal/test-utils.d.ts +1 -1
- package/dist/components/TimeField/TimeField.d.ts +4 -1
- package/dist/extends-Bg2s_OKl.js.map +1 -1
- package/dist/getActiveElement-BcSyVE7S.js.map +1 -1
- package/dist/getKeyboardFocusableElements-QqcABz0D.js.map +1 -1
- package/dist/{index-V5Ez2gq_.js → index-DrM3iid4.js} +2 -2
- package/dist/{index-V5Ez2gq_.js.map → index-DrM3iid4.js.map} +1 -1
- package/dist/index-tZvMCc77.js.map +1 -1
- package/dist/{index.esm-D889iexm.js → index.esm-BwMVvxTV.js} +199 -144
- package/dist/index.esm-BwMVvxTV.js.map +1 -0
- package/dist/index.js +45 -45
- package/dist/index.js.map +1 -1
- package/dist/makeZeroShortcutPreprocessor-CxsiGTRW.js.map +1 -1
- package/dist/{proxy-CreWmH-e.js → proxy-BbFHSE6L.js} +8631 -8680
- package/dist/proxy-BbFHSE6L.js.map +1 -0
- package/dist/{use-reduced-motion-znCm41qB.js → use-reduced-motion-DSpxmqyT.js} +3 -3
- package/dist/use-reduced-motion-DSpxmqyT.js.map +1 -0
- package/dist/useAccessibleColor-BYKjkGRg.js.map +1 -1
- package/dist/useBreakpoint-Cv5fnZxs.js.map +1 -1
- package/dist/{useDateFieldOrchestration-BNJCsRkS.js → useDateFieldOrchestration-DyAc3gPJ.js} +3 -3
- package/dist/{useDateFieldOrchestration-BNJCsRkS.js.map → useDateFieldOrchestration-DyAc3gPJ.js.map} +1 -1
- package/dist/{useDialogTransitionStates-2NaE_noq.js → useDialogTransitionStates-C1TtiwA_.js} +3 -3
- package/dist/{useDialogTransitionStates-2NaE_noq.js.map → useDialogTransitionStates-C1TtiwA_.js.map} +1 -1
- package/dist/useFocusWithin-BhhgRXdZ.js.map +1 -1
- package/dist/useInfiniteCombobox-WcRgC9p6.js.map +1 -1
- package/dist/useIntersectionObserver-BEmMDO3P.js.map +1 -1
- package/dist/useLayoutPropsUtil-DjD5IMh0.js.map +1 -1
- package/dist/useMergeRefs-Bde85AWI.js.map +1 -1
- package/dist/{useOnClickOutside-BHEWMLa9.js → useOnClickOutside-B1ddwORK.js} +5 -2
- package/dist/useOnClickOutside-B1ddwORK.js.map +1 -0
- package/dist/useOptionallyControlledState-DbDuos5L.js.map +1 -1
- package/dist/usePopoverCloseDelayWorkaround-BZcjPkvT.js.map +1 -1
- package/dist/{usePopoverSupport-DIjjfodl.js → usePopoverSupport-CWTCDfN2.js} +2 -2
- package/dist/{usePopoverSupport-DIjjfodl.js.map → usePopoverSupport-CWTCDfN2.js.map} +1 -1
- package/dist/usePrefersColorScheme-_hT7dK7_.js.map +1 -1
- package/dist/usePrevious-Bvq-5auG.js.map +1 -1
- package/dist/useSize.js.map +1 -1
- package/dist/{useSwipe-CULmVQEk.js → useSwipe-Cp-CJxLU.js} +2 -2
- package/dist/{useSwipe-CULmVQEk.js.map → useSwipe-Cp-CJxLU.js.map} +1 -1
- package/dist/useSwipe.js +1 -1
- package/dist/useTrackingContext-DRwDL8DE.js.map +1 -1
- package/dist/useTrackingId.js.map +1 -1
- package/package.json +12 -18
- package/dist/Button.module-pUNSKoVC.js +0 -25
- package/dist/Button.module-pUNSKoVC.js.map +0 -1
- package/dist/Calendar-BQ5F2ENO.js.map +0 -1
- package/dist/Combobox-B9nesJuc.js.map +0 -1
- package/dist/DrawerContext-DboTgTmo.js.map +0 -1
- package/dist/Menu-C8we5CHP.js.map +0 -1
- package/dist/Page-cKXkjMmd.js.map +0 -1
- package/dist/Pagination-ta8a2cJN.js.map +0 -1
- package/dist/Popover-r26xMIfm.js.map +0 -1
- package/dist/SideNav-CBAzYyML.js.map +0 -1
- package/dist/Tab-wNucMTgo.js.map +0 -1
- package/dist/TimeField-CmbErrsZ.js.map +0 -1
- package/dist/index.esm-D889iexm.js.map +0 -1
- package/dist/proxy-CreWmH-e.js.map +0 -1
- package/dist/use-reduced-motion-znCm41qB.js.map +0 -1
- package/dist/useOnClickOutside-BHEWMLa9.js.map +0 -1
|
@@ -6,7 +6,7 @@ import { S as SvgCheck } from './check-Cf67OWrZ.js';
|
|
|
6
6
|
import { C as Card } from './Card-vTYeSkxt.js';
|
|
7
7
|
import { T as Text } from './Text-BqvcbXyp.js';
|
|
8
8
|
import { I as Icon } from './Icon-D8SPKeO4.js';
|
|
9
|
-
import { B as Button } from './Button-
|
|
9
|
+
import { B as Button } from './Button-VNQQgZ45.js';
|
|
10
10
|
import { u as useLayoutPropsUtil } from './useLayoutPropsUtil-DjD5IMh0.js';
|
|
11
11
|
|
|
12
12
|
import './EditCard.css';const container = "_container_1bs09_11";
|
|
@@ -108,4 +108,4 @@ const EditCard = forwardRef(
|
|
|
108
108
|
EditCard.displayName = "EditCard";
|
|
109
109
|
|
|
110
110
|
export { EditCard as E };
|
|
111
|
-
//# sourceMappingURL=EditCard-
|
|
111
|
+
//# sourceMappingURL=EditCard-CZzL0nx7.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EditCard-
|
|
1
|
+
{"version":3,"file":"EditCard-CZzL0nx7.js","sources":["../../hammer-icon/mdi/round/priority_high.svg","../src/components/EditCard/EditCard.tsx"],"sourcesContent":["import * as React from \"react\";\nconst SvgPriorityHigh = (props) => /* @__PURE__ */ React.createElement(\"svg\", { xmlns: \"http://www.w3.org/2000/svg\", width: \"1em\", height: \"1em\", viewBox: \"0 0 24 24\", ...props }, /* @__PURE__ */ React.createElement(\"circle\", { cx: 12, cy: 19, r: 2 }), /* @__PURE__ */ React.createElement(\"path\", { d: \"M12 3c-1.1 0-2 .9-2 2v8c0 1.1.9 2 2 2s2-.9 2-2V5c0-1.1-.9-2-2-2z\" }));\nexport default SvgPriorityHigh;\n","import cx from \"classnames\";\nimport styles from \"./EditCard.module.scss\";\nimport { ComponentPropsWithoutRef, forwardRef } from \"react\";\nimport { LayoutUtilProps } from \"../../types\";\nimport Check from \"@servicetitan/hammer-icon/mdi/round/check.svg\";\nimport PriorityHigh from \"@servicetitan/hammer-icon/mdi/round/priority_high.svg\";\nimport { useLayoutPropsUtil } from \"../../internal/hooks\";\nimport { Card } from \"../Card\";\nimport { Text } from \"../Text\";\nimport { Icon } from \"../Icon\";\nimport { Button } from \"../Button\";\n\n/**\n * Props for the EditCard component\n * @extends ComponentPropsWithoutRef<\"div\">\n * @extends LayoutUtilProps\n */\nexport type EditCardProps = ComponentPropsWithoutRef<\"div\"> &\n LayoutUtilProps & {\n /**\n * The header text to display. Can be a string or an object mapping states to different text.\n */\n headerText:\n | string\n | {\n \"not started\": string;\n \"in progress\": string;\n error: string;\n complete: string;\n };\n /**\n * The current state of the edit card.\n */\n state: EditCardState;\n /**\n * Text to display on the save button.\n * @default \"Save\"\n */\n saveButtonText?: string;\n /**\n * Text to display on the edit button.\n * @default \"Edit\"\n */\n editButtonText?: string;\n /**\n * Whether to disable the edit button.\n * @default false\n */\n disableEdit?: boolean;\n /**\n * Whether to disable the save button.\n * @default false\n */\n disableSave?: boolean;\n /**\n * Callback function called when the state changes.\n */\n onStateChange?: (changeType: EditCardChange) => void;\n };\n\n/**\n * The type of state change that can occur.\n * @property {\"edit\"} edit - User clicked the edit button to start editing\n * @property {\"save\"} save - User clicked the save button to save changes\n * @property {\"cancel\"} cancel - User clicked the cancel button to discard changes\n */\nexport type EditCardChange = \"edit\" | \"save\" | \"cancel\";\n\n/**\n * The current state of the edit card.\n * @property {\"not started\"} not started - Initial state, content is not being edited\n * @property {\"in progress\"} in progress - User is currently editing the content\n * @property {\"error\"} error - An error occurred during the edit process\n * @property {\"complete\"} complete - Edit was successfully completed\n */\nexport type EditCardState =\n | \"not started\"\n | \"in progress\"\n | \"error\"\n | \"complete\";\n\n/**\n * EditCard component for managing editable content with different states and actions.\n *\n * Features:\n * - Four distinct states: not started, in progress, error, and complete\n * - Visual indicators for each state with appropriate icons\n * - Dynamic header text that can change based on state\n * - Edit and save buttons with customizable text\n * - Optional button disabling for different states\n * - State change callbacks for handling user interactions\n * - Built on Card component with consistent styling\n * - Supports layout utilities for positioning and spacing\n * - Accessible with proper ARIA attributes\n * - Visual state indicators with color-coded borders\n * - Automatic tracking ID generation for analytics\n *\n * @example\n * <EditCard\n * headerText=\"User Profile\"\n * state=\"not started\"\n * onStateChange={(change) => console.log(change)}\n * >\n * <Text>Profile information goes here</Text>\n * </EditCard>\n */\nexport const EditCard = forwardRef<HTMLDivElement, EditCardProps>(\n (props, ref) => {\n const { layoutStyles, componentProps } = useLayoutPropsUtil(props);\n const {\n children,\n className,\n style,\n headerText,\n state,\n editButtonText = \"Edit\",\n saveButtonText = \"Save\",\n disableEdit = false,\n disableSave = false,\n onStateChange,\n ...rest\n } = componentProps;\n\n const kebabState = state?.replaceAll(\" \", \"-\");\n\n const editCardClassNames = cx(\n styles[\"edit-card\"],\n styles[`edit-card-${kebabState}`],\n className,\n );\n\n return (\n <Card\n padding=\"large\"\n className={editCardClassNames}\n data-anv=\"edit-card\"\n style={style}\n ref={ref}\n {...rest}\n >\n <div\n className={cx(styles.indicator, styles[`indicator-${kebabState}`])}\n >\n {state === \"complete\" && <Icon svg={Check} />}\n {state === \"error\" && <Icon svg={PriorityHigh} />}\n </div>\n <div className={styles.container}>\n <div className={styles.header}>\n <Text className={styles.heading} variant=\"headline\" el=\"h3\">\n {typeof headerText === \"string\" ? headerText : headerText[state]}\n </Text>\n {state !== \"in progress\" && (\n <Button\n disabled={disableEdit}\n onClick={() => onStateChange?.(\"edit\")}\n >\n {editButtonText}\n </Button>\n )}\n </div>\n {children && (\n <div className={styles.content} style={layoutStyles}>\n {children}\n </div>\n )}\n {state === \"in progress\" && (\n <div className={styles.footer}>\n <Button onClick={() => onStateChange?.(\"cancel\")}>Cancel</Button>\n <Button\n appearance=\"primary\"\n onClick={() => onStateChange?.(\"save\")}\n disabled={disableSave}\n >\n {saveButtonText}\n </Button>\n </div>\n )}\n </div>\n </Card>\n );\n },\n);\n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EAAS,KAAA,EAAO,cACpC,QAAA,EACH,CAAA;AAAA,YAED,UAAU,aAAA,oBACT,IAAA,CAAC,KAAA,EAAA,EAAI,SAAA,EAAW,OAAO,MAAA,EACrB,QAAA,EAAA;AAAA,8BAAA,GAAA,CAAC,UAAO,OAAA,EAAS,MAAM,aAAA,GAAgB,QAAQ,GAAG,QAAA,EAAA,QAAA,EAAM,CAAA;AAAA,8BACxD,GAAA;AAAA,gBAAC,MAAA;AAAA,gBAAA;AAAA,kBACC,UAAA,EAAW,SAAA;AAAA,kBACX,OAAA,EAAS,MAAM,aAAA,GAAgB,MAAM,CAAA;AAAA,kBACrC,QAAA,EAAU,WAAA;AAAA,kBAET,QAAA,EAAA;AAAA;AAAA;AACH,aAAA,EACF;AAAA,WAAA,EAEJ;AAAA;AAAA;AAAA,KACF;AAAA,EAEJ;AACF;AAEA,QAAA,CAAS,WAAA,GAAc,UAAA;;;;"}
|
package/dist/EditCard.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { E as EditCard, E as default } from './EditCard-
|
|
1
|
+
export { E as EditCard, E as default } from './EditCard-CZzL0nx7.js';
|
|
2
2
|
//# sourceMappingURL=EditCard.js.map
|
|
@@ -2,7 +2,7 @@ import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
|
2
2
|
import { forwardRef } from 'react';
|
|
3
3
|
import { c as cx } from './index-tZvMCc77.js';
|
|
4
4
|
import { S as SrOnly } from './SrOnly-CTsYSuby.js';
|
|
5
|
-
import { T as Tooltip } from './Tooltip-
|
|
5
|
+
import { T as Tooltip } from './Tooltip-CtCLw_vx.js';
|
|
6
6
|
import { I as Icon } from './Icon-D8SPKeO4.js';
|
|
7
7
|
import { S as SvgInfo } from './info-CYpG6tcI.js';
|
|
8
8
|
|
|
@@ -73,4 +73,4 @@ const FieldLabel = forwardRef(
|
|
|
73
73
|
FieldLabel.displayName = "FieldLabel";
|
|
74
74
|
|
|
75
75
|
export { FieldLabel as F };
|
|
76
|
-
//# sourceMappingURL=FieldLabel-
|
|
76
|
+
//# sourceMappingURL=FieldLabel-BP8QK5UR.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FieldLabel-
|
|
1
|
+
{"version":3,"file":"FieldLabel-BP8QK5UR.js","sources":["../src/components/FieldLabel/internal/FieldLabelMoreInfoIcon.tsx","../src/components/FieldLabel/FieldLabel.tsx"],"sourcesContent":["import { FieldLabelProps } from \"../FieldLabel\";\nimport { Tooltip } from \"../../Tooltip\";\nimport { Icon } from \"../../Icon\";\nimport Info from \"@servicetitan/hammer-icon/mdi/round/info.svg\";\nimport styles from \"../FieldLabel.module.scss\";\n\n/**\n * Internal component for rendering the info icon with tooltip.\n *\n * @param props - Component props\n * @param props.moreInfo - The content to display in the tooltip\n * @param props.openMoreInfo - Controls the tooltip open state\n */\nexport const FieldLabelMoreInfoIcon = ({\n moreInfo,\n openMoreInfo,\n}: {\n moreInfo: FieldLabelProps[\"moreInfo\"];\n openMoreInfo: FieldLabelProps[\"openMoreInfo\"];\n}) => {\n return (\n <Tooltip\n open={openMoreInfo}\n placement=\"top\"\n offset={5}\n fallbackPlacements={[\"right\", \"bottom\", \"left\"]}\n >\n <Tooltip.Trigger className={styles[\"info-trigger\"]}>\n <Icon svg={Info} />\n </Tooltip.Trigger>\n <Tooltip.Content className={styles[\"info-content\"]}>\n {moreInfo}\n </Tooltip.Content>\n </Tooltip>\n );\n};\n","import { forwardRef, ComponentPropsWithoutRef, ReactNode } from \"react\";\nimport cx from \"classnames\";\n\nimport styles from \"./FieldLabel.module.scss\";\nimport { TooltipProps } from \"../Tooltip\";\nimport { SrOnly } from \"../SrOnly\";\nimport { FieldLabelMoreInfoIcon } from \"./internal/FieldLabelMoreInfoIcon\";\n\n/**\n * Props for the FieldLabel component.\n */\nexport type FieldLabelProps = Omit<ComponentPropsWithoutRef<\"label\">, \"id\"> & {\n /** Unique identifier for the label element */\n id?: string;\n /**\n * Whether the field is required. Shows a red asterisk (*) when true.\n * @default false\n */\n required?: boolean;\n /** Additional information to display in a tooltip */\n moreInfo?: ReactNode;\n /**\n * Controls the open state of the more info tooltip.\n * @default false\n */\n openMoreInfo?: TooltipProps[\"open\"];\n};\n\n/**\n * FieldLabel component for form field labels with optional required indicator and help tooltip.\n *\n * Features:\n * - Accessible form label with proper semantic HTML\n * - Optional required field indicator with red asterisk\n * - Help tooltip with info icon for additional context\n * - Screen reader support for required field announcement\n * - Controlled and uncontrolled tooltip state management\n * - Flexible content support for label text and help information\n * - Proper ARIA attributes and semantic structure\n * - Responsive design with consistent typography\n *\n * @example\n * <FieldLabel htmlFor=\"email\" required>\n * Email Address\n * </FieldLabel>\n * <input id=\"email\" type=\"email\" />\n *\n * @example\n * <FieldLabel\n * htmlFor=\"password\"\n * required\n * moreInfo=\"Password must be at least 8 characters long\"\n * >\n * Password\n * </FieldLabel>\n * <input id=\"password\" type=\"password\" />\n */\nexport const FieldLabel = forwardRef<HTMLLabelElement, FieldLabelProps>(\n (props, ref) => {\n const { children, className, moreInfo, required, openMoreInfo, ...rest } =\n props;\n const FieldLabelClassNames = cx([styles[\"label\"]], className);\n\n return (\n <label\n className={FieldLabelClassNames}\n data-anv=\"label\"\n ref={ref}\n {...rest}\n >\n <div className={styles[\"top-container\"]} aria-atomic=\"true\">\n <span className={styles[\"label-text\"]}>\n {children}\n {required ? (\n <>\n <span aria-hidden className={styles[\"required\"]}>\n *\n </span>\n <SrOnly>Required</SrOnly>\n </>\n ) : null}\n </span>\n {moreInfo ? (\n <FieldLabelMoreInfoIcon\n moreInfo={moreInfo}\n openMoreInfo={openMoreInfo}\n />\n ) : null}\n </div>\n\n {moreInfo ? <SrOnly>{moreInfo}</SrOnly> : null}\n </label>\n );\n },\n);\n\nFieldLabel.displayName = \"FieldLabel\";\n"],"names":["Info"],"mappings":";;;;;;;;;;;;;;;;;;;AAaO,MAAM,yBAAyB,CAAC;AAAA,EACrC,QAAA;AAAA,EACA;AACF,CAAA,KAGM;AACJ,EAAA,uBAC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ACE,QAAA,EAAA;AAAA,gCAAA,GAAA,CAAC,UAAK,aAAA,EAAW,IAAA,EAAC,WAAW,MAAA,CAAO,UAAU,GAAG,QAAA,EAAA,GAAA,EAEjD,CAAA;AAAA,gCACA,GAAA,CAAC,UAAO,QAAA,EAAA,UAAA,EAAQ;AAAA,eAAA,EAClB,CAAA,GACE;AAAA,aAAA,EACN,CAAA;AAAA,YACC,QAAA,mBACC,GAAA;AAAA,cAAC,sBAAA;AAAA,cAAA;AAAA,gBACC,QAAA;AAAA,gBACA;AAAA;AAAA,aACF,GACE;AAAA,WAAA,EACN,CAAA;AAAA,UAEC,QAAA,mBAAW,GAAA,CAAC,MAAA,EAAA,EAAQ,QAAA,EAAA,QAAA,EAAS,CAAA,GAAY;AAAA;AAAA;AAAA,KAC5C;AAAA,EAEJ;AACF;AAEA,UAAA,CAAW,WAAA,GAAc,YAAA;;;;"}
|
package/dist/FieldLabel.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { F as FieldLabel, F as default } from './FieldLabel-
|
|
1
|
+
export { F as FieldLabel, F as default } from './FieldLabel-BP8QK5UR.js';
|
|
2
2
|
//# sourceMappingURL=FieldLabel.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FieldMessage-B7uQ8vmr.js","sources":["../src/components/FieldMessage/FieldMessage.tsx"],"sourcesContent":["import {\n forwardRef,\n type AriaAttributes,\n type ReactElement,\n type ComponentPropsWithoutRef,\n} from \"react\";\nimport cx from \"classnames\";\nimport styles from \"./FieldMessage.module.scss\";\nimport { Icon } from \"../Icon\";\nimport Error from \"@servicetitan/hammer-icon/mdi/round/warning.svg\";\n\n/**\n * Props for the FieldMessage component\n * @extends ComponentPropsWithoutRef<\"div\">\n */\nexport type FieldMessageProps = ComponentPropsWithoutRef<\"div\"> & {\n /**\n * Unique identifier for the field message container.\n */\n id?: string;\n /**\n * Hint text or element to display when there's no error.\n */\n hint?: ReactElement | string;\n /**\n * Description text or element to display below the main message.\n */\n description?: ReactElement | string;\n /**\n * Error message or element to display when there's an error.\n */\n errorMessage?: ReactElement | string;\n /**\n * aria-live attribute value for the error message.\n * @default assertive\n * @remarks Controls how screen readers announce error messages. \"assertive\" interrupts current speech, \"polite\" waits for current speech to finish.\n * @link https://www.w3.org/WAI/tutorials/forms/notifications/\n */\n errorAriaLive?: AriaAttributes[\"aria-live\"];\n};\n\n/**\n * FieldMessage component for displaying hints, descriptions, and error messages for form fields.\n *\n * Features:\n * - Displays hint text when no error is present\n * - Shows error messages with warning icon when errors occur\n * - Supports both string and React element content\n * - Configurable aria-live behavior for screen readers\n * - Optional description text for additional context\n * - Accessible with proper ARIA attributes\n * - Visual error indicators with warning icons\n * - Conditional rendering based on error state\n * - Supports layout utilities for positioning and spacing\n *\n * @example\n * <FieldMessage\n * hint=\"Enter your email address\"\n * description=\"We'll use this to send you updates\"\n * errorMessage=\"Please enter a valid email address\"\n * />\n */\nexport const FieldMessage = forwardRef<HTMLDivElement, FieldMessageProps>(\n (props, ref) => {\n const {\n id,\n hint,\n description,\n errorAriaLive = \"assertive\",\n errorMessage,\n className,\n ...rest\n } = props;\n\n return (\n <div\n {...rest}\n className={cx(styles[\"messages\"], className)}\n ref={ref}\n id={id}\n >\n {errorMessage ? (\n <div className={styles[\"error-container\"]}>\n <Icon\n inherit\n className={styles[\"error-icon\"]}\n aria-hidden\n svg={Error}\n />\n <span className={styles[\"error-message\"]} aria-live={errorAriaLive}>\n {errorMessage}\n </span>\n </div>\n ) : (\n (hint ?? null)\n )}\n {description ? (\n <div className={styles[\"description-container\"]}>\n {description ? <span>{description}</span> : null}\n </div>\n ) : null}\n </div>\n );\n },\n);\n\nFieldMessage.displayName = \"FieldMessage\";\n"],"names":["Error"],"mappings":";;;;;;;;;;;;;AA8DO,MAAM,
|
|
1
|
+
{"version":3,"file":"FieldMessage-B7uQ8vmr.js","sources":["../src/components/FieldMessage/FieldMessage.tsx"],"sourcesContent":["import {\n forwardRef,\n type AriaAttributes,\n type ReactElement,\n type ComponentPropsWithoutRef,\n} from \"react\";\nimport cx from \"classnames\";\nimport styles from \"./FieldMessage.module.scss\";\nimport { Icon } from \"../Icon\";\nimport Error from \"@servicetitan/hammer-icon/mdi/round/warning.svg\";\n\n/**\n * Props for the FieldMessage component\n * @extends ComponentPropsWithoutRef<\"div\">\n */\nexport type FieldMessageProps = ComponentPropsWithoutRef<\"div\"> & {\n /**\n * Unique identifier for the field message container.\n */\n id?: string;\n /**\n * Hint text or element to display when there's no error.\n */\n hint?: ReactElement | string;\n /**\n * Description text or element to display below the main message.\n */\n description?: ReactElement | string;\n /**\n * Error message or element to display when there's an error.\n */\n errorMessage?: ReactElement | string;\n /**\n * aria-live attribute value for the error message.\n * @default assertive\n * @remarks Controls how screen readers announce error messages. \"assertive\" interrupts current speech, \"polite\" waits for current speech to finish.\n * @link https://www.w3.org/WAI/tutorials/forms/notifications/\n */\n errorAriaLive?: AriaAttributes[\"aria-live\"];\n};\n\n/**\n * FieldMessage component for displaying hints, descriptions, and error messages for form fields.\n *\n * Features:\n * - Displays hint text when no error is present\n * - Shows error messages with warning icon when errors occur\n * - Supports both string and React element content\n * - Configurable aria-live behavior for screen readers\n * - Optional description text for additional context\n * - Accessible with proper ARIA attributes\n * - Visual error indicators with warning icons\n * - Conditional rendering based on error state\n * - Supports layout utilities for positioning and spacing\n *\n * @example\n * <FieldMessage\n * hint=\"Enter your email address\"\n * description=\"We'll use this to send you updates\"\n * errorMessage=\"Please enter a valid email address\"\n * />\n */\nexport const FieldMessage = forwardRef<HTMLDivElement, FieldMessageProps>(\n (props, ref) => {\n const {\n id,\n hint,\n description,\n errorAriaLive = \"assertive\",\n errorMessage,\n className,\n ...rest\n } = props;\n\n return (\n <div\n {...rest}\n className={cx(styles[\"messages\"], className)}\n ref={ref}\n id={id}\n >\n {errorMessage ? (\n <div className={styles[\"error-container\"]}>\n <Icon\n inherit\n className={styles[\"error-icon\"]}\n aria-hidden\n svg={Error}\n />\n <span className={styles[\"error-message\"]} aria-live={errorAriaLive}>\n {errorMessage}\n </span>\n </div>\n ) : (\n (hint ?? null)\n )}\n {description ? (\n <div className={styles[\"description-container\"]}>\n {description ? <span>{description}</span> : null}\n </div>\n ) : null}\n </div>\n );\n },\n);\n\nFieldMessage.displayName = \"FieldMessage\";\n"],"names":["Error"],"mappings":";;;;;;;;;;;;;AA8DO,MAAM,YAAA,GAAe,UAAA;AAAA,EAC1B,CAAC,OAAO,GAAA,KAAQ;AACd,IAAA,MAAM;AAAA,MACJ,EAAA;AAAA,MACA,IAAA;AAAA,MACA,WAAA;AAAA,MACA,aAAA,GAAgB,WAAA;AAAA,MAChB,YAAA;AAAA,MACA,SAAA;AAAA,MACA,GAAG;AAAA,KACL,GAAI,KAAA;AAEJ,IAAA,uBACE,IAAA;AAAA,MAAC,KAAA;AAAA,MAAA;AAAA,QACE,GAAG,IAAA;AAAA,QACJ,SAAA,EAAW,EAAA,CAAG,MAAA,CAAO,UAAU,GAAG,SAAS,CAAA;AAAA,QAC3C,GAAA;AAAA,QACA,EAAA;AAAA,QAEC,QAAA,EAAA;AAAA,UAAA,YAAA,mBACC,IAAA,CAAC,KAAA,EAAA,EAAI,SAAA,EAAW,MAAA,CAAO,iBAAiB,CAAA,EACtC,QAAA,EAAA;AAAA,4BAAA,GAAA;AAAA,cAAC,IAAA;AAAA,cAAA;AAAA,gBACC,OAAA,EAAO,IAAA;AAAA,gBACP,SAAA,EAAW,OAAO,YAAY,CAAA;AAAA,gBAC9B,aAAA,EAAW,IAAA;AAAA,gBACX,GAAA,EAAKA;AAAA;AAAA,aACP;AAAA,4BACA,GAAA,CAAC,UAAK,SAAA,EAAW,MAAA,CAAO,eAAe,CAAA,EAAG,WAAA,EAAW,eAClD,QAAA,EAAA,YAAA,EACH;AAAA,WAAA,EACF,IAEC,IAAA,IAAQ,IAAA;AAAA,UAEV,WAAA,mBACC,GAAA,CAAC,KAAA,EAAA,EAAI,SAAA,EAAW,MAAA,CAAO,uBAAuB,CAAA,EAC3C,QAAA,EAAA,WAAA,mBAAc,GAAA,CAAC,MAAA,EAAA,EAAM,QAAA,EAAA,WAAA,EAAY,CAAA,GAAU,MAC9C,CAAA,GACE;AAAA;AAAA;AAAA,KACN;AAAA,EAEJ;AACF;AAEA,YAAA,CAAa,WAAA,GAAc,cAAA;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Flex-BdQMekvA.js","sources":["../src/components/Flex/Flex.tsx"],"sourcesContent":["import { ComponentPropsWithoutRef, forwardRef } from \"react\";\nimport cx from \"classnames\";\nimport styles from \"./Flex.module.scss\";\nimport { FlexSpecificProps } from \"./internal/FlexSpecificProps\";\nimport { useLayoutPropsUtil } from \"../../internal/hooks\";\n\n/**\n * Props for the Flex component\n * @extends ComponentPropsWithoutRef<\"div\">\n * @extends FlexSpecificProps\n */\nexport type FlexProps = ComponentPropsWithoutRef<\"div\"> &\n FlexSpecificProps & {\n /**\n * Responsive props for small screens (sm breakpoint).\n */\n sm?: FlexSpecificProps;\n /**\n * Responsive props for medium screens (md breakpoint).\n */\n md?: FlexSpecificProps;\n /**\n * Responsive props for large screens (lg breakpoint).\n */\n lg?: FlexSpecificProps;\n /**\n * Responsive props for extra large screens (xl breakpoint).\n */\n xl?: FlexSpecificProps;\n /**\n * Responsive props for extra extra large screens (xxl breakpoint).\n */\n xxl?: FlexSpecificProps;\n };\n\n/**\n * Flex component for creating flexible layouts using CSS Flexbox.\n *\n * Features:\n * - CSS Flexbox layout with full control over flex properties\n * - Support for both flex and inline-flex display modes\n * - Responsive design with breakpoint-specific props (sm, md, lg, xl, xxl)\n * - Comprehensive layout utilities for spacing, alignment, and positioning\n * - Automatic style generation and class management\n * - Support for all standard div element props\n * - Flexible direction, grow, shrink, basis, and wrap controls\n * - Deprecated flexShrink prop with modern shrink alternative\n *\n * @example\n * <Flex direction=\"row\" gap=\"4\" alignItems=\"center\">\n * <div>Item 1</div>\n * <div>Item 2</div>\n * <div>Item 3</div>\n * </Flex>\n *\n * @example\n * <Flex\n * direction=\"column\"\n * gap=\"2\"\n * md={{ direction: \"row\", gap: \"4\" }}\n * >\n * <div>Item 1</div>\n * <div>Item 2</div>\n * <div>Item 3</div>\n * </Flex>\n */\nexport const Flex = forwardRef<HTMLDivElement, FlexProps>((props, ref) => {\n const {\n inline,\n direction,\n grow,\n shrink,\n basis,\n wrap,\n sm,\n md,\n lg,\n xl,\n xxl,\n ...nonLayoutProps\n } = props;\n const combineLayoutProps = {\n ...nonLayoutProps,\n flexDirection: direction,\n flexGrow: grow,\n flexShrink: shrink,\n flexBasis: basis,\n flexWrap: wrap,\n sm: {\n ...sm,\n flexDirection: sm?.direction,\n flexGrow: sm?.grow,\n flexShrink: sm?.shrink,\n flexBasis: sm?.basis,\n flexWrap: sm?.wrap,\n },\n md: {\n ...md,\n flexDirection: md?.direction,\n flexGrow: md?.grow,\n flexShrink: md?.shrink,\n flexBasis: md?.basis,\n flexWrap: md?.wrap,\n },\n lg: {\n ...lg,\n flexDirection: lg?.direction,\n flexGrow: lg?.grow,\n flexShrink: lg?.shrink,\n flexBasis: lg?.basis,\n flexWrap: lg?.wrap,\n },\n xl: {\n ...xl,\n flexDirection: xl?.direction,\n flexGrow: xl?.grow,\n flexShrink: xl?.shrink,\n flexBasis: xl?.basis,\n flexWrap: xl?.wrap,\n },\n xxl: {\n ...xxl,\n flexDirection: xxl?.direction,\n flexGrow: xxl?.grow,\n flexShrink: xxl?.shrink,\n flexBasis: xxl?.basis,\n flexWrap: xxl?.wrap,\n },\n };\n const { layoutStyles, componentProps } =\n useLayoutPropsUtil(combineLayoutProps);\n\n const { children, className, style, ...rest } = componentProps;\n\n const flexClassNames = cx(className, {\n [styles[\"flex\"]]: !inline,\n [styles[\"inline-flex\"]]: inline,\n });\n\n const styleCombined = {\n ...style,\n ...layoutStyles,\n };\n\n return (\n <div\n className={flexClassNames}\n data-anv=\"flex\"\n style={styleCombined}\n ref={ref}\n {...rest}\n >\n {children}\n </div>\n );\n});\n\nFlex.displayName = \"Flex\";\n"],"names":[],"mappings":";;;;;;;;;;;AAkEO,MAAM,
|
|
1
|
+
{"version":3,"file":"Flex-BdQMekvA.js","sources":["../src/components/Flex/Flex.tsx"],"sourcesContent":["import { ComponentPropsWithoutRef, forwardRef } from \"react\";\nimport cx from \"classnames\";\nimport styles from \"./Flex.module.scss\";\nimport { FlexSpecificProps } from \"./internal/FlexSpecificProps\";\nimport { useLayoutPropsUtil } from \"../../internal/hooks\";\n\n/**\n * Props for the Flex component\n * @extends ComponentPropsWithoutRef<\"div\">\n * @extends FlexSpecificProps\n */\nexport type FlexProps = ComponentPropsWithoutRef<\"div\"> &\n FlexSpecificProps & {\n /**\n * Responsive props for small screens (sm breakpoint).\n */\n sm?: FlexSpecificProps;\n /**\n * Responsive props for medium screens (md breakpoint).\n */\n md?: FlexSpecificProps;\n /**\n * Responsive props for large screens (lg breakpoint).\n */\n lg?: FlexSpecificProps;\n /**\n * Responsive props for extra large screens (xl breakpoint).\n */\n xl?: FlexSpecificProps;\n /**\n * Responsive props for extra extra large screens (xxl breakpoint).\n */\n xxl?: FlexSpecificProps;\n };\n\n/**\n * Flex component for creating flexible layouts using CSS Flexbox.\n *\n * Features:\n * - CSS Flexbox layout with full control over flex properties\n * - Support for both flex and inline-flex display modes\n * - Responsive design with breakpoint-specific props (sm, md, lg, xl, xxl)\n * - Comprehensive layout utilities for spacing, alignment, and positioning\n * - Automatic style generation and class management\n * - Support for all standard div element props\n * - Flexible direction, grow, shrink, basis, and wrap controls\n * - Deprecated flexShrink prop with modern shrink alternative\n *\n * @example\n * <Flex direction=\"row\" gap=\"4\" alignItems=\"center\">\n * <div>Item 1</div>\n * <div>Item 2</div>\n * <div>Item 3</div>\n * </Flex>\n *\n * @example\n * <Flex\n * direction=\"column\"\n * gap=\"2\"\n * md={{ direction: \"row\", gap: \"4\" }}\n * >\n * <div>Item 1</div>\n * <div>Item 2</div>\n * <div>Item 3</div>\n * </Flex>\n */\nexport const Flex = forwardRef<HTMLDivElement, FlexProps>((props, ref) => {\n const {\n inline,\n direction,\n grow,\n shrink,\n basis,\n wrap,\n sm,\n md,\n lg,\n xl,\n xxl,\n ...nonLayoutProps\n } = props;\n const combineLayoutProps = {\n ...nonLayoutProps,\n flexDirection: direction,\n flexGrow: grow,\n flexShrink: shrink,\n flexBasis: basis,\n flexWrap: wrap,\n sm: {\n ...sm,\n flexDirection: sm?.direction,\n flexGrow: sm?.grow,\n flexShrink: sm?.shrink,\n flexBasis: sm?.basis,\n flexWrap: sm?.wrap,\n },\n md: {\n ...md,\n flexDirection: md?.direction,\n flexGrow: md?.grow,\n flexShrink: md?.shrink,\n flexBasis: md?.basis,\n flexWrap: md?.wrap,\n },\n lg: {\n ...lg,\n flexDirection: lg?.direction,\n flexGrow: lg?.grow,\n flexShrink: lg?.shrink,\n flexBasis: lg?.basis,\n flexWrap: lg?.wrap,\n },\n xl: {\n ...xl,\n flexDirection: xl?.direction,\n flexGrow: xl?.grow,\n flexShrink: xl?.shrink,\n flexBasis: xl?.basis,\n flexWrap: xl?.wrap,\n },\n xxl: {\n ...xxl,\n flexDirection: xxl?.direction,\n flexGrow: xxl?.grow,\n flexShrink: xxl?.shrink,\n flexBasis: xxl?.basis,\n flexWrap: xxl?.wrap,\n },\n };\n const { layoutStyles, componentProps } =\n useLayoutPropsUtil(combineLayoutProps);\n\n const { children, className, style, ...rest } = componentProps;\n\n const flexClassNames = cx(className, {\n [styles[\"flex\"]]: !inline,\n [styles[\"inline-flex\"]]: inline,\n });\n\n const styleCombined = {\n ...style,\n ...layoutStyles,\n };\n\n return (\n <div\n className={flexClassNames}\n data-anv=\"flex\"\n style={styleCombined}\n ref={ref}\n {...rest}\n >\n {children}\n </div>\n );\n});\n\nFlex.displayName = \"Flex\";\n"],"names":[],"mappings":";;;;;;;;;;;AAkEO,MAAM,IAAA,GAAO,UAAA,CAAsC,CAAC,KAAA,EAAO,GAAA,KAAQ;AACxE,EAAA,MAAM;AAAA,IACJ,MAAA;AAAA,IACA,SAAA;AAAA,I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ChB,WAAW,EAAA,EAAI,KAAA;AAAA,MACf,UAAU,EAAA,EAAI;AAAA,KAChB;AAAA,IACA,GAAA,EAAK;AAAA,MACH,GAAG,GAAA;AAAA,MACH,eAAe,GAAA,EAAK,SAAA;AAAA,MACpB,UAAU,GAAA,EAAK,IAAA;AAAA,MACf,YAAY,GAAA,EAAK,MAAA;AAAA,MACjB,WAAW,GAAA,EAAK,KAAA;AAAA,MAChB,UAAU,GAAA,EAAK;AAAA;AACjB,GACF;AACA,EAAA,MAAM,EAAE,YAAA,EAAc,cAAA,EAAe,GACnC,mBAAmB,kBAAkB,CAAA;AAEvC,EAAA,MAAM,EAAE,QAAA,EAAU,SAAA,EAAW,KAAA,EAAO,GAAG,MAAK,GAAI,cAAA;AAEhD,EAAA,MAAM,cAAA,GAAiB,GAAG,SAAA,EAAW;AAAA,IACnC,CAAC,MAAA,CAAO,MAAM,CAAC,GAAG,CAAC,MAAA;AAAA,IACnB,CAAC,MAAA,CAAO,aAAa,CAAC,GAAG;AAAA,GAC1B,CAAA;AAED,EAAA,MAAM,aAAA,GAAgB;AAAA,IACpB,GAAG,KAAA;AAAA,IACH,GAAG;AAAA,GACL;AAEA,EAAA,uBACE,GAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,SAAA,EAAW,cAAA;AAAA,MACX,UAAA,EAAS,MAAA;AAAA,MACT,KAAA,EAAO,aAAA;AAAA,MACP,GAAA;AAAA,MACC,GAAG,IAAA;AAAA,MAEH;AAAA;AAAA,GACH;AAEJ,CAAC;AAED,IAAA,CAAK,WAAA,GAAc,MAAA;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Grid-MGUC698u.js","sources":["../src/components/Grid/internal/GridItem.tsx","../src/components/Grid/Grid.tsx"],"sourcesContent":["import { ComponentPropsWithoutRef, forwardRef } from \"react\";\nimport cx from \"classnames\";\n\nimport styles from \"../Grid.module.scss\";\nimport { useLayoutPropsUtil } from \"../../../internal/hooks\";\nimport { LayoutUtilProps } from \"../../../types\";\n\n/**\n * Props for the GridItem component\n * @extends ComponentPropsWithoutRef<\"div\">\n * @extends LayoutUtilProps\n */\nexport type GridItemProps = ComponentPropsWithoutRef<\"div\"> & LayoutUtilProps;\n\n/**\n * GridItem component for individual items within a CSS Grid layout.\n *\n * Features:\n * - Individual grid item with full layout utility support\n * - Automatic grid item styling and class management\n * - Comprehensive layout utilities for positioning and sizing\n * - Support for all standard div element props\n * - Flexible grid positioning and sizing controls\n * - Automatic style generation and class management\n * - Works seamlessly with Grid component\n *\n * @example\n * <Grid templateColumns=\"repeat(2, 1fr)\" gap=\"4\">\n * <Grid.Item>Grid Item 1</Grid.Item>\n * <Grid.Item>Grid Item 2</Grid.Item>\n * </Grid>\n */\nexport const GridItem = forwardRef<HTMLDivElement, GridItemProps>(\n (props, ref) => {\n const { layoutStyles, componentProps } = useLayoutPropsUtil(props);\n const { className, children, style, ...rest } = componentProps;\n\n const gridItemClassNames = cx([styles[\"grid-item\"]], className, {});\n\n const styleCombined = {\n ...style,\n ...layoutStyles,\n };\n\n return (\n <div\n className={gridItemClassNames}\n data-anv=\"grid-item\"\n ref={ref}\n style={styleCombined}\n {...rest}\n >\n {children}\n </div>\n );\n },\n);\n\nGridItem.displayName = \"GridItem\";\n","import { ComponentPropsWithoutRef, forwardRef } from \"react\";\nimport cx from \"classnames\";\n\nimport { useLayoutPropsUtil } from \"../../internal/hooks\";\nimport styles from \"./Grid.module.scss\";\nimport { GridSpecificProps } from \"./internal/GridSpecificProps\";\nimport { GridItem } from \"./internal/GridItem\";\n\n/**\n * Props for the Grid component\n * @extends ComponentPropsWithoutRef<\"div\">\n * @extends GridSpecificProps\n */\nexport type GridProps = ComponentPropsWithoutRef<\"div\"> & {\n /**\n * Applies `display: inline-grid` instead of `grid`\n */\n inline?: boolean;\n} & GridSpecificProps & {\n /**\n * Responsive props for small screens (sm breakpoint).\n */\n sm?: GridSpecificProps;\n /**\n * Responsive props for medium screens (md breakpoint).\n */\n md?: GridSpecificProps;\n /**\n * Responsive props for large screens (lg breakpoint).\n */\n lg?: GridSpecificProps;\n /**\n * Responsive props for extra large screens (xl breakpoint).\n */\n xl?: GridSpecificProps;\n /**\n * Responsive props for extra extra large screens (xxl breakpoint).\n */\n xxl?: GridSpecificProps;\n };\n\nconst GridElement = forwardRef<HTMLDivElement, GridProps>((props, ref) => {\n const {\n inline,\n templateColumns,\n templateRows,\n templateAreas,\n autoColumns,\n autoRows,\n sm,\n md,\n lg,\n xl,\n xxl,\n ...nonLayoutProps\n } = props;\n const combineLayoutProps = {\n ...nonLayoutProps,\n gridTemplateColumns: props.templateColumns,\n gridTemplateRows: props.templateRows,\n gridTemplateAreas: props.templateAreas,\n gridAutoColumns: props.autoColumns,\n gridAutoRows: props.autoRows,\n sm: {\n ...sm,\n gridTemplateColumns: sm?.templateColumns,\n gridTemplateRows: sm?.templateRows,\n gridTemplateAreas: sm?.templateAreas,\n gridAutoColumns: sm?.autoColumns,\n gridAutoRows: sm?.autoRows,\n },\n md: {\n ...md,\n gridTemplateColumns: md?.templateColumns,\n gridTemplateRows: md?.templateRows,\n gridTemplateAreas: md?.templateAreas,\n gridAutoColumns: md?.autoColumns,\n gridAutoRows: md?.autoRows,\n },\n lg: {\n ...lg,\n gridTemplateColumns: lg?.templateColumns,\n gridTemplateRows: lg?.templateRows,\n gridTemplateAreas: lg?.templateAreas,\n gridAutoColumns: lg?.autoColumns,\n gridAutoRows: lg?.autoRows,\n },\n xl: {\n ...xl,\n gridTemplateColumns: xl?.templateColumns,\n gridTemplateRows: xl?.templateRows,\n gridTemplateAreas: xl?.templateAreas,\n gridAutoColumns: xl?.autoColumns,\n gridAutoRows: xl?.autoRows,\n },\n xxl: {\n ...xxl,\n gridTemplateColumns: xxl?.templateColumns,\n gridTemplateRows: xxl?.templateRows,\n gridTemplateAreas: xxl?.templateAreas,\n gridAutoColumns: xxl?.autoColumns,\n gridAutoRows: xxl?.autoRows,\n },\n };\n const { layoutStyles, componentProps } =\n useLayoutPropsUtil(combineLayoutProps);\n const { children, className, style, ...rest } = componentProps;\n\n const gridClassNames = cx(className, {\n [styles[\"grid\"]]: !inline,\n [styles[\"inline-grid\"]]: inline,\n });\n\n const styleCombined = {\n ...style,\n ...layoutStyles,\n };\n\n return (\n <div\n className={gridClassNames}\n data-anv=\"grid\"\n style={styleCombined}\n ref={ref}\n {...rest}\n >\n {children}\n </div>\n );\n});\n\nGridElement.displayName = \"Grid\";\n\n/**\n * Grid component for creating CSS Grid layouts with responsive design.\n *\n * Features:\n * - CSS Grid layout with full control over grid properties\n * - Support for both grid and inline-grid display modes\n * - Responsive design with breakpoint-specific props (sm, md, lg, xl, xxl)\n * - Comprehensive layout utilities for spacing, alignment, and positioning\n * - Template columns, rows, and areas configuration\n * - Auto columns and rows sizing\n * - Automatic style generation and class management\n * - Support for all standard div element props\n * - Flexible grid template and auto-sizing controls\n * - Automatic tracking ID generation for analytics\n * - Compound component structure with Item sub-component\n *\n * @example\n * <Grid templateColumns=\"repeat(3, 1fr)\" gap=\"4\">\n * <Grid.Item>Grid Item 1</Grid.Item>\n * <Grid.Item>Grid Item 2</Grid.Item>\n * <Grid.Item>Grid Item 3</Grid.Item>\n * </Grid>\n *\n * @example\n * <Grid\n * templateColumns=\"repeat(1, 1fr)\"\n * gap=\"2\"\n * md={{ templateColumns: \"repeat(3, 1fr)\", gap: \"4\" }}\n * >\n * <Grid.Item>Grid Item 1</Grid.Item>\n * <Grid.Item>Grid Item 2</Grid.Item>\n * <Grid.Item>Grid Item 3</Grid.Item>\n * </Grid>\n */\nexport const Grid = Object.assign(GridElement, {\n /**\n * GridItem component for individual items within a CSS Grid layout.\n *\n * Features:\n * - Individual grid item with full layout utility support\n * - Automatic grid item styling and class management\n * - Comprehensive layout utilities for positioning and sizing\n * - Support for all standard div element props\n * - Flexible grid positioning and sizing controls\n * - Automatic style generation and class management\n * - Works seamlessly with Grid component\n * - Automatic tracking ID generation for analytics\n *\n * @example\n * <Grid templateColumns=\"repeat(2, 1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AA;AAAA,MACvB,mBAAmB,GAAK,EAAA,aAAA;AAAA,MACxB,iBAAiB,GAAK,EAAA,WAAA;AAAA,MACtB,cAAc,GAAK,EAAA;AAAA;AACrB,GACF;AACA,EAAA,MAAM,EAAE,YAAA,EAAc,cAAe,EAAA,GACnC,mBAAmB,kBAAkB,CAAA;AACvC,EAAA,MAAM,EAAE,QAAU,EAAA,SAAA,EAAW,KAAO,EAAA,GAAG,MAAS,GAAA,cAAA;AAEhD,EAAM,MAAA,cAAA,GAAiB,GAAG,SAAW,EAAA;AAAA,IACnC,CAAC,MAAA,CAAO,MAAM,CAAC,GAAG,CAAC,MAAA;AAAA,IACnB,CAAC,MAAA,CAAO,aAAa,CAAC,GAAG;AAAA,GAC1B,CAAA;AAED,EAAA,MAAM,aAAgB,GAAA;AAAA,IACpB,GAAG,KAAA;AAAA,IACH,GAAG;AAAA,GACL;AAEA,EACE,uBAAA,GAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,SAAW,EAAA,cAAA;AAAA,MACX,UAAS,EAAA,MAAA;AAAA,MACT,KAAO,EAAA,aAAA;AAAA,MACP,GAAA;AAAA,MACC,GAAG,IAAA;AAAA,MAEH;AAAA;AAAA,GACH;AAEJ,CAAC,CAAA;AAED,WAAA,CAAY,WAAc,GAAA,MAAA;AAoCb,MAAA,IAAA,GAAO,MAAO,CAAA,MAAA,CAAO,WAAa,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAoB7C,IAAM,EAAA;AACR,CAAC;;;;"}
|
|
1
|
+
{"version":3,"file":"Grid-MGUC698u.js","sources":["../src/components/Grid/internal/GridItem.tsx","../src/components/Grid/Grid.tsx"],"sourcesContent":["import { ComponentPropsWithoutRef, forwardRef } from \"react\";\nimport cx from \"classnames\";\n\nimport styles from \"../Grid.module.scss\";\nimport { useLayoutPropsUtil } from \"../../../internal/hooks\";\nimport { LayoutUtilProps } from \"../../../types\";\n\n/**\n * Props for the GridItem component\n * @extends ComponentPropsWithoutRef<\"div\">\n * @extends LayoutUtilProps\n */\nexport type GridItemProps = ComponentPropsWithoutRef<\"div\"> & LayoutUtilProps;\n\n/**\n * GridItem component for individual items within a CSS Grid layout.\n *\n * Features:\n * - Individual grid item with full layout utility support\n * - Automatic grid item styling and class management\n * - Comprehensive layout utilities for positioning and sizing\n * - Support for all standard div element props\n * - Flexible grid positioning and sizing controls\n * - Automatic style generation and class management\n * - Works seamlessly with Grid component\n *\n * @example\n * <Grid templateColumns=\"repeat(2, 1fr)\" gap=\"4\">\n * <Grid.Item>Grid Item 1</Grid.Item>\n * <Grid.Item>Grid Item 2</Grid.Item>\n * </Grid>\n */\nexport const GridItem = forwardRef<HTMLDivElement, GridItemProps>(\n (props, ref) => {\n const { layoutStyles, componentProps } = useLayoutPropsUtil(props);\n const { className, children, style, ...rest } = componentProps;\n\n const gridItemClassNames = cx([styles[\"grid-item\"]], className, {});\n\n const styleCombined = {\n ...style,\n ...layoutStyles,\n };\n\n return (\n <div\n className={gridItemClassNames}\n data-anv=\"grid-item\"\n ref={ref}\n style={styleCombined}\n {...rest}\n >\n {children}\n </div>\n );\n },\n);\n\nGridItem.displayName = \"GridItem\";\n","import { ComponentPropsWithoutRef, forwardRef } from \"react\";\nimport cx from \"classnames\";\n\nimport { useLayoutPropsUtil } from \"../../internal/hooks\";\nimport styles from \"./Grid.module.scss\";\nimport { GridSpecificProps } from \"./internal/GridSpecificProps\";\nimport { GridItem } from \"./internal/GridItem\";\n\n/**\n * Props for the Grid component\n * @extends ComponentPropsWithoutRef<\"div\">\n * @extends GridSpecificProps\n */\nexport type GridProps = ComponentPropsWithoutRef<\"div\"> & {\n /**\n * Applies `display: inline-grid` instead of `grid`\n */\n inline?: boolean;\n} & GridSpecificProps & {\n /**\n * Responsive props for small screens (sm breakpoint).\n */\n sm?: GridSpecificProps;\n /**\n * Responsive props for medium screens (md breakpoint).\n */\n md?: GridSpecificProps;\n /**\n * Responsive props for large screens (lg breakpoint).\n */\n lg?: GridSpecificProps;\n /**\n * Responsive props for extra large screens (xl breakpoint).\n */\n xl?: GridSpecificProps;\n /**\n * Responsive props for extra extra large screens (xxl breakpoint).\n */\n xxl?: GridSpecificProps;\n };\n\nconst GridElement = forwardRef<HTMLDivElement, GridProps>((props, ref) => {\n const {\n inline,\n templateColumns,\n templateRows,\n templateAreas,\n autoColumns,\n autoRows,\n sm,\n md,\n lg,\n xl,\n xxl,\n ...nonLayoutProps\n } = props;\n const combineLayoutProps = {\n ...nonLayoutProps,\n gridTemplateColumns: props.templateColumns,\n gridTemplateRows: props.templateRows,\n gridTemplateAreas: props.templateAreas,\n gridAutoColumns: props.autoColumns,\n gridAutoRows: props.autoRows,\n sm: {\n ...sm,\n gridTemplateColumns: sm?.templateColumns,\n gridTemplateRows: sm?.templateRows,\n gridTemplateAreas: sm?.templateAreas,\n gridAutoColumns: sm?.autoColumns,\n gridAutoRows: sm?.autoRows,\n },\n md: {\n ...md,\n gridTemplateColumns: md?.templateColumns,\n gridTemplateRows: md?.templateRows,\n gridTemplateAreas: md?.templateAreas,\n gridAutoColumns: md?.autoColumns,\n gridAutoRows: md?.autoRows,\n },\n lg: {\n ...lg,\n gridTemplateColumns: lg?.templateColumns,\n gridTemplateRows: lg?.templateRows,\n gridTemplateAreas: lg?.templateAreas,\n gridAutoColumns: lg?.autoColumns,\n gridAutoRows: lg?.autoRows,\n },\n xl: {\n ...xl,\n gridTemplateColumns: xl?.templateColumns,\n gridTemplateRows: xl?.templateRows,\n gridTemplateAreas: xl?.templateAreas,\n gridAutoColumns: xl?.autoColumns,\n gridAutoRows: xl?.autoRows,\n },\n xxl: {\n ...xxl,\n gridTemplateColumns: xxl?.templateColumns,\n gridTemplateRows: xxl?.templateRows,\n gridTemplateAreas: xxl?.templateAreas,\n gridAutoColumns: xxl?.autoColumns,\n gridAutoRows: xxl?.autoRows,\n },\n };\n const { layoutStyles, componentProps } =\n useLayoutPropsUtil(combineLayoutProps);\n const { children, className, style, ...rest } = componentProps;\n\n const gridClassNames = cx(className, {\n [styles[\"grid\"]]: !inline,\n [styles[\"inline-grid\"]]: inline,\n });\n\n const styleCombined = {\n ...style,\n ...layoutStyles,\n };\n\n return (\n <div\n className={gridClassNames}\n data-anv=\"grid\"\n style={styleCombined}\n ref={ref}\n {...rest}\n >\n {children}\n </div>\n );\n});\n\nGridElement.displayName = \"Grid\";\n\n/**\n * Grid component for creating CSS Grid layouts with responsive design.\n *\n * Features:\n * - CSS Grid layout with full control over grid properties\n * - Support for both grid and inline-grid display modes\n * - Responsive design with breakpoint-specific props (sm, md, lg, xl, xxl)\n * - Comprehensive layout utilities for spacing, alignment, and positioning\n * - Template columns, rows, and areas configuration\n * - Auto columns and rows sizing\n * - Automatic style generation and class management\n * - Support for all standard div element props\n * - Flexible grid template and auto-sizing controls\n * - Automatic tracking ID generation for analytics\n * - Compound component structure with Item sub-component\n *\n * @example\n * <Grid templateColumns=\"repeat(3, 1fr)\" gap=\"4\">\n * <Grid.Item>Grid Item 1</Grid.Item>\n * <Grid.Item>Grid Item 2</Grid.Item>\n * <Grid.Item>Grid Item 3</Grid.Item>\n * </Grid>\n *\n * @example\n * <Grid\n * templateColumns=\"repeat(1, 1fr)\"\n * gap=\"2\"\n * md={{ templateColumns: \"repeat(3, 1fr)\", gap: \"4\" }}\n * >\n * <Grid.Item>Grid Item 1</Grid.Item>\n * <Grid.Item>Grid Item 2</Grid.Item>\n * <Grid.Item>Grid Item 3</Grid.Item>\n * </Grid>\n */\nexport const Grid = Object.assign(GridElement, {\n /**\n * GridItem component for individual items within a CSS Grid layout.\n *\n * Features:\n * - Individual grid item with full layout utility support\n * - Automatic grid item styling and class management\n * - Comprehensive layout utilities for positioning and sizing\n * - Support for all standard div element props\n * - Flexible grid positioning and sizing controls\n * - Automatic style generation and class management\n * - Works seamlessly with Grid component\n * - Automatic tracking ID generation for analytics\n *\n * @example\n * <Gr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1B,kBAAkB,GAAA,EAAK,YAAA;AAAA,MACvB,mBAAmB,GAAA,EAAK,aAAA;AAAA,MACxB,iBAAiB,GAAA,EAAK,WAAA;AAAA,MACtB,cAAc,GAAA,EAAK;AAAA;AACrB,GACF;AACA,EAAA,MAAM,EAAE,YAAA,EAAc,cAAA,EAAe,GACnC,mBAAmB,kBAAkB,CAAA;AACvC,EAAA,MAAM,EAAE,QAAA,EAAU,SAAA,EAAW,KAAA,EAAO,GAAG,MAAK,GAAI,cAAA;AAEhD,EAAA,MAAM,cAAA,GAAiB,GAAG,SAAA,EAAW;AAAA,IACnC,CAAC,MAAA,CAAO,MAAM,CAAC,GAAG,CAAC,MAAA;AAAA,IACnB,CAAC,MAAA,CAAO,aAAa,CAAC,GAAG;AAAA,GAC1B,CAAA;AAED,EAAA,MAAM,aAAA,GAAgB;AAAA,IACpB,GAAG,KAAA;AAAA,IACH,GAAG;AAAA,GACL;AAEA,EAAA,uBACE,GAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,SAAA,EAAW,cAAA;AAAA,MACX,UAAA,EAAS,MAAA;AAAA,MACT,KAAA,EAAO,aAAA;AAAA,MACP,GAAA;AAAA,MACC,GAAG,IAAA;AAAA,MAEH;AAAA;AAAA,GACH;AAEJ,CAAC,CAAA;AAED,WAAA,CAAY,WAAA,GAAc,MAAA;AAoCnB,MAAM,IAAA,GAAO,MAAA,CAAO,MAAA,CAAO,WAAA,EAAa;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAoB7C,IAAA,EAAM;AACR,CAAC;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Helper-BkIDJqgA.js","sources":["../src/internal/components/Helper/Helper.tsx"],"sourcesContent":["import { forwardRef, AriaAttributes, ReactElement } from \"react\";\nimport styles from \"./Helper.module.scss\";\nimport { FieldMessage } from \"../../../components/FieldMessage\";\nimport { SrOnly } from \"../../../components/SrOnly\";\n\nexport type HelperProps = {\n id?: string;\n // required?: boolean;\n hint?: ReactElement | string;\n description?: ReactElement | string;\n errorMessage?: ReactElement | string;\n /**\n * aria-live for the error message\n * @default assertive\n * @link https://www.w3.org/WAI/tutorials/forms/notifications/\n */\n errorAriaLive?: AriaAttributes[\"aria-live\"];\n maxLength?: number;\n inputLength?: number;\n isTyping?: boolean;\n showCounter?: boolean;\n};\n\nexport const Helper = forwardRef<HTMLDivElement, HelperProps>((props, ref) => {\n const {\n id,\n hint,\n description,\n errorAriaLive = \"assertive\",\n errorMessage,\n maxLength,\n isTyping,\n inputLength = 0,\n showCounter,\n } = props;\n\n return (\n <div className={styles[\"helper\"]} ref={ref} id={id}>\n <FieldMessage\n className={styles[\"messages\"]}\n hint={hint}\n description={description}\n errorAriaLive={errorAriaLive}\n errorMessage={errorMessage}\n />\n\n {showCounter ? (\n <div className={styles[\"counter\"]}>\n <span aria-hidden=\"true\">\n {inputLength}/{maxLength}\n </span>\n </div>\n ) : null}\n {isTyping && !!maxLength ? (\n maxLength - inputLength >= 1 ? (\n <SrOnly>\n {/* TODO: potential localization */}\n <span aria-live=\"polite\" aria-atomic=\"true\">{`${\n maxLength - inputLength\n } character${maxLength - inputLength !== 1 ? \"s\" : \"\"} left`}</span>\n </SrOnly>\n ) : (\n <SrOnly>\n {/* TODO: potential localization */}\n <span role=\"alert\">Maximum characters count reached</span>\n </SrOnly>\n )\n ) : null}\n </div>\n );\n});\n\nHelper.displayName = \"Helper\";\n"],"names":[],"mappings":";;;;;;;;;;;AAuBO,MAAM,
|
|
1
|
+
{"version":3,"file":"Helper-BkIDJqgA.js","sources":["../src/internal/components/Helper/Helper.tsx"],"sourcesContent":["import { forwardRef, AriaAttributes, ReactElement } from \"react\";\nimport styles from \"./Helper.module.scss\";\nimport { FieldMessage } from \"../../../components/FieldMessage\";\nimport { SrOnly } from \"../../../components/SrOnly\";\n\nexport type HelperProps = {\n id?: string;\n // required?: boolean;\n hint?: ReactElement | string;\n description?: ReactElement | string;\n errorMessage?: ReactElement | string;\n /**\n * aria-live for the error message\n * @default assertive\n * @link https://www.w3.org/WAI/tutorials/forms/notifications/\n */\n errorAriaLive?: AriaAttributes[\"aria-live\"];\n maxLength?: number;\n inputLength?: number;\n isTyping?: boolean;\n showCounter?: boolean;\n};\n\nexport const Helper = forwardRef<HTMLDivElement, HelperProps>((props, ref) => {\n const {\n id,\n hint,\n description,\n errorAriaLive = \"assertive\",\n errorMessage,\n maxLength,\n isTyping,\n inputLength = 0,\n showCounter,\n } = props;\n\n return (\n <div className={styles[\"helper\"]} ref={ref} id={id}>\n <FieldMessage\n className={styles[\"messages\"]}\n hint={hint}\n description={description}\n errorAriaLive={errorAriaLive}\n errorMessage={errorMessage}\n />\n\n {showCounter ? (\n <div className={styles[\"counter\"]}>\n <span aria-hidden=\"true\">\n {inputLength}/{maxLength}\n </span>\n </div>\n ) : null}\n {isTyping && !!maxLength ? (\n maxLength - inputLength >= 1 ? (\n <SrOnly>\n {/* TODO: potential localization */}\n <span aria-live=\"polite\" aria-atomic=\"true\">{`${\n maxLength - inputLength\n } character${maxLength - inputLength !== 1 ? \"s\" : \"\"} left`}</span>\n </SrOnly>\n ) : (\n <SrOnly>\n {/* TODO: potential localization */}\n <span role=\"alert\">Maximum characters count reached</span>\n </SrOnly>\n )\n ) : null}\n </div>\n );\n});\n\nHelper.displayName = \"Helper\";\n"],"names":[],"mappings":";;;;;;;;;;;AAuBO,MAAM,MAAA,GAAS,UAAA,CAAwC,CAAC,KAAA,EAAO,GAAA,KAAQ;AAC5E,EAAA,MAAM;AAAA,IACJ,EAAA;AAAA,IACA,IAAA;AAAA,IACA,WAAA;AAAA,IACA,aAAA,GAAgB,WAAA;AAAA,IAChB,YAAA;AAAA,IACA,SAAA;AAAA,IACA,QAAA;AAAA,IACA,WAAA,GAAc,CAAA;AAAA,IACd;AAAA,GACF,GAAI,KAAA;AAEJ,EAAA,4BACG,KAAA,EAAA,EAAI,SAAA,EAAW,OAAO,QAAQ,CAAA,EAAG,KAAU,EAAA,EAC1C,QAAA,EAAA;AAAA,oBAAA,GAAA;AAAA,MAAC,YAAA;AAAA,MAAA;AAAA,QACC,SAAA,EAAW,OAAO,UAAU,CAAA;AAAA,QAC5B,IAAA;AAAA,QACA,WAAA;AAAA,QACA,aAAA;AAAA,QACA;AAAA;AAAA,KACF;AAAA,IAEC,WAAA,mBACC,GAAA,CAAC,KAAA,EAAA,EAAI,SAAA,EAAW,MAAA,CAAO,SAAS,CAAA,EAC9B,QAAA,kBAAA,IAAA,CAAC,MAAA,EAAA,EAAK,aAAA,EAAY,MAAA,EACf,QAAA,EAAA;AAAA,MAAA,WAAA;AAAA,MAAY,GAAA;AAAA,MAAE;AAAA,KAAA,EACjB,GACF,CAAA,GACE,IAAA;AAAA,IACH,QAAA,IAAY,CAAC,CAAC,SAAA,GACb,YAAY,WAAA,IAAe,CAAA,mBACzB,GAAA,CAAC,MAAA,EAAA,EAEC,8BAAC,MAAA,EAAA,EAAK,WAAA,EAAU,QAAA,EAAS,aAAA,EAAY,QAAQ,QAAA,EAAA,CAAA,EAC3C,SAAA,GAAY,WACd,CAAA,UAAA,EAAa,YAAY,WAAA,KAAgB,CAAA,GAAI,GAAA,GAAM,EAAE,SAAQ,CAAA,EAC/D,CAAA,mBAEA,GAAA,CAAC,MAAA,EAAA,EAEC,8BAAC,MAAA,EAAA,EAAK,IAAA,EAAK,OAAA,EAAQ,QAAA,EAAA,kCAAA,EAAgC,GACrD,CAAA,GAEA;AAAA,GAAA,EACN,CAAA;AAEJ,CAAC;AAED,MAAA,CAAO,WAAA,GAAc,QAAA;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Icon-D8SPKeO4.js","sources":["../src/components/Icon/Icon.tsx"],"sourcesContent":["import { LayoutUtilProps, Size, Svg } from \"../../types\";\nimport { ComponentPropsWithoutRef, forwardRef } from \"react\";\nimport styles from \"./Icon.module.scss\";\nimport { useLayoutPropsUtil } from \"../../internal/hooks\";\nimport cx from \"classnames\";\n\n/**\n * Props for the Icon component\n * @extends Omit<ComponentPropsWithoutRef<\"span\">, \"children\">\n * @extends Omit<LayoutUtilProps, \"flex\" | \"flexBasis\" | \"flexGrow\" | \"flexShrink\">\n */\nexport type IconProps = Omit<ComponentPropsWithoutRef<\"span\">, \"children\"> &\n Omit<LayoutUtilProps, \"flex\" | \"flexBasis\" | \"flexGrow\" | \"flexShrink\"> & {\n /**\n * Apply a specific color to the icon.\n */\n color?: string;\n\n /**\n * The size of the icon.\n * @default medium\n */\n size?: Extract<Size, \"small\" | \"medium\" | \"large\" | \"xlarge\">;\n\n /**\n * Assets passed in using svgr.\n */\n svg: Svg;\n\n /**\n * Whether the icon should inherit the color from its parent element.\n * @default false\n */\n inherit?: boolean;\n };\n\n/**\n * Icon component for displaying SVG icons with consistent styling and sizing.\n *\n * Features:\n * - SVG icon rendering with consistent styling\n * - Four predefined sizes: small, medium, large, xlarge\n * - Custom color support with optional inheritance\n * - Layout utilities for positioning and spacing\n * - Support for all standard span element props\n * - Flexible color inheritance and custom color options\n * - Consistent sizing across different icon sets\n *\n * @example\n * import Close from \"@servicetitan/anvil2/assets/icons/material/round/close.svg\";\n *\n * <Icon svg={Close} size=\"medium\" />\n *\n * @example\n * import Info from \"@servicetitan/anvil2/assets/icons/material/round/info.svg\";\n *\n * <Icon\n * svg={Info}\n * size=\"large\"\n * color=\"#007bff\"\n * inherit={false}\n * />\n */\nexport const Icon = forwardRef<HTMLSpanElement, IconProps>((props, ref) => {\n const { layoutStyles, componentProps } = useLayoutPropsUtil(props);\n const {\n size = \"medium\",\n className,\n svg: Svg,\n inherit,\n style,\n color,\n ...rest\n } = componentProps;\n\n const iconClassNames = cx([styles[\"icon\"]], className, {\n [styles[\"small\"]]: size === \"small\",\n [styles[\"medium\"]]: size === \"medium\",\n [styles[\"large\"]]: size === \"large\",\n [styles[\"xlarge\"]]: size === \"xlarge\",\n });\n\n const styleCombined = {\n color: color ? color : inherit ? \"inherit\" : undefined,\n ...style,\n ...layoutStyles,\n };\n\n return (\n <span\n className={iconClassNames}\n data-anv=\"icon\"\n style={styleCombined}\n ref={ref}\n {...rest}\n >\n <Svg />\n </span>\n );\n});\n\nIcon.displayName = \"Icon\";\n"],"names":["Svg"],"mappings":";;;;;;;;;;;;;;;;;;AA+DO,MAAM,
|
|
1
|
+
{"version":3,"file":"Icon-D8SPKeO4.js","sources":["../src/components/Icon/Icon.tsx"],"sourcesContent":["import { LayoutUtilProps, Size, Svg } from \"../../types\";\nimport { ComponentPropsWithoutRef, forwardRef } from \"react\";\nimport styles from \"./Icon.module.scss\";\nimport { useLayoutPropsUtil } from \"../../internal/hooks\";\nimport cx from \"classnames\";\n\n/**\n * Props for the Icon component\n * @extends Omit<ComponentPropsWithoutRef<\"span\">, \"children\">\n * @extends Omit<LayoutUtilProps, \"flex\" | \"flexBasis\" | \"flexGrow\" | \"flexShrink\">\n */\nexport type IconProps = Omit<ComponentPropsWithoutRef<\"span\">, \"children\"> &\n Omit<LayoutUtilProps, \"flex\" | \"flexBasis\" | \"flexGrow\" | \"flexShrink\"> & {\n /**\n * Apply a specific color to the icon.\n */\n color?: string;\n\n /**\n * The size of the icon.\n * @default medium\n */\n size?: Extract<Size, \"small\" | \"medium\" | \"large\" | \"xlarge\">;\n\n /**\n * Assets passed in using svgr.\n */\n svg: Svg;\n\n /**\n * Whether the icon should inherit the color from its parent element.\n * @default false\n */\n inherit?: boolean;\n };\n\n/**\n * Icon component for displaying SVG icons with consistent styling and sizing.\n *\n * Features:\n * - SVG icon rendering with consistent styling\n * - Four predefined sizes: small, medium, large, xlarge\n * - Custom color support with optional inheritance\n * - Layout utilities for positioning and spacing\n * - Support for all standard span element props\n * - Flexible color inheritance and custom color options\n * - Consistent sizing across different icon sets\n *\n * @example\n * import Close from \"@servicetitan/anvil2/assets/icons/material/round/close.svg\";\n *\n * <Icon svg={Close} size=\"medium\" />\n *\n * @example\n * import Info from \"@servicetitan/anvil2/assets/icons/material/round/info.svg\";\n *\n * <Icon\n * svg={Info}\n * size=\"large\"\n * color=\"#007bff\"\n * inherit={false}\n * />\n */\nexport const Icon = forwardRef<HTMLSpanElement, IconProps>((props, ref) => {\n const { layoutStyles, componentProps } = useLayoutPropsUtil(props);\n const {\n size = \"medium\",\n className,\n svg: Svg,\n inherit,\n style,\n color,\n ...rest\n } = componentProps;\n\n const iconClassNames = cx([styles[\"icon\"]], className, {\n [styles[\"small\"]]: size === \"small\",\n [styles[\"medium\"]]: size === \"medium\",\n [styles[\"large\"]]: size === \"large\",\n [styles[\"xlarge\"]]: size === \"xlarge\",\n });\n\n const styleCombined = {\n color: color ? color : inherit ? \"inherit\" : undefined,\n ...style,\n ...layoutStyles,\n };\n\n return (\n <span\n className={iconClassNames}\n data-anv=\"icon\"\n style={styleCombined}\n ref={ref}\n {...rest}\n >\n <Svg />\n </span>\n );\n});\n\nIcon.displayName = \"Icon\";\n"],"names":["Svg"],"mappings":";;;;;;;;;;;;;;;;;;AA+DO,MAAM,IAAA,GAAO,UAAA,CAAuC,CAAC,KAAA,EAAO,GAAA,KAAQ;AACzE,EAAA,MAAM,EAAE,YAAA,EAAc,cAAA,EAAe,GAAI,mBAAmB,KAAK,CAAA;AACjE,EAAA,MAAM;AAAA,IACJ,IAAA,GAAO,QAAA;AAAA,IACP,SAAA;AAAA,IACA,GAAA,EAAKA,IAAAA;AAAA,IACL,OAAA;AAAA,IACA,KAAA;AAAA,IACA,KAAA;AAAA,IACA,GAAG;AAAA,GACL,GAAI,cAAA;AAEJ,EAAA,MAAM,iBAAiB,EAAA,CAAG,CAAC,OAAO,MAAM,CAAC,GAAG,SAAA,EAAW;AAAA,IACrD,CAAC,MAAA,CAAO,OAAO,CAAC,GAAG,IAAA,KAAS,OAAA;AAAA,IAC5B,CAAC,MAAA,CAAO,QAAQ,CAAC,GAAG,IAAA,KAAS,QAAA;AAAA,IAC7B,CAAC,MAAA,CAAO,OAAO,CAAC,GAAG,IAAA,KAAS,OAAA;AAAA,IAC5B,CAAC,MAAA,CAAO,QAAQ,CAAC,GAAG,IAAA,KAAS;AAAA,GAC9B,CAAA;AAED,EAAA,MAAM,aAAA,GAAgB;AAAA,IACpB,KAAA,EAAO,KAAA,GAAQ,KAAA,GAAQ,OAAA,GAAU,SAAA,GAAY,MAAA;AAAA,IAC7C,GAAG,KAAA;AAAA,IACH,GAAG;AAAA,GACL;AAEA,EAAA,uBACE,GAAA;AAAA,IAAC,MAAA;AAAA,IAAA;AAAA,MACC,SAAA,EAAW,cAAA;AAAA,MACX,UAAA,EAAS,MAAA;AAAA,MACT,KAAA,EAAO,aAAA;AAAA,MACP,GAAA;AAAA,MACC,GAAG,IAAA;AAAA,MAEJ,QAAA,kBAAA,GAAA,CAACA,MAAA,EAAI;AAAA;AAAA,GACP;AAEJ,CAAC;AAED,IAAA,CAAK,WAAA,GAAc,MAAA;;;;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx } from 'react/jsx-runtime';
|
|
2
2
|
import { forwardRef, useRef, useMemo, isValidElement, cloneElement } from 'react';
|
|
3
|
-
import { u as useMergeRefs } from './DrawerContext-
|
|
4
|
-
import { T as TextField } from './TextField-
|
|
3
|
+
import { u as useMergeRefs } from './DrawerContext-D4tWTLVf.js';
|
|
4
|
+
import { T as TextField } from './TextField-CFWs3lm9.js';
|
|
5
5
|
import { u as useOptionallyControlledState } from './useOptionallyControlledState-DbDuos5L.js';
|
|
6
6
|
import { c as childrenToString } from './childrenToString-Bz9MqbHb.js';
|
|
7
7
|
import { useTrackingId } from './useTrackingId.js';
|
|
@@ -261,4 +261,4 @@ const InputMask = forwardRef(
|
|
|
261
261
|
InputMask.displayName = "InputMask";
|
|
262
262
|
|
|
263
263
|
export { InputMask as I };
|
|
264
|
-
//# sourceMappingURL=InputMask-
|
|
264
|
+
//# sourceMappingURL=InputMask-CPuYMcw9.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InputMask-_F139qFu.js","sources":["../src/components/InputMask/internal/constants.ts","../src/components/InputMask/internal/utils.ts","../src/components/InputMask/InputMask.tsx"],"sourcesContent":["export const MASK_CHARS = [\"a\", \"9\", \"*\"];\n","import { MASK_CHARS } from \"./constants\";\n\n/**\n * This function applies the mask to the input value, returning a new string that matches the mask's format.\n * @param value - a string representing the raw input value (e.g., what the user typed)\n * @param mask - a string representing the desired input mask (e.g., \"99/99/9999\" for a date)\n * @param defaultMaskCharacter - a string representing the default mask character (e.g., \"_\")\n * @returns a string representing the masked value (e.g., \"12/31/2025\" for a date)\n *\n * @example\n * applyMask(\"1234567890\", \"99/99/9999\", \"_\") // \"12/31/2025\"\n * applyMask(\"1234567890\", \"999-999-9999\", \"-\") // \"123-456-7890\"\n * applyMask(\"123\", \"99/99\", \"_\") // \"12/3_\"\n */\nexport function applyMask(\n value: string,\n mask: string,\n defaultMaskCharacter: string,\n) {\n let maskedValue = \"\";\n let valueIndex = 0;\n for (let i = 0; i < mask.length; i++) {\n const maskChar = mask[i];\n if (MASK_CHARS.includes(maskChar)) {\n // Find next acceptable char in value\n while (\n valueIndex < value.length &&\n !isAcceptableChar(value[valueIndex], maskChar)\n ) {\n valueIndex++;\n }\n if (valueIndex < value.length) {\n maskedValue += value[valueIndex];\n valueIndex++;\n } else {\n maskedValue += defaultMaskCharacter;\n }\n } else {\n maskedValue += maskChar;\n }\n }\n return maskedValue;\n}\n/**\n * This function checks if a character is acceptable for a given mask character.\n * @param char - a string representing the character to check\n * @param maskChar - a string representing the mask character\n * @returns a boolean indicating if the character is acceptable\n */\nfunction isAcceptableChar(char: string, maskChar: string) {\n if (maskChar === \"9\") {\n return /\\d/.test(char);\n }\n if (maskChar === \"a\") {\n return /[a-zA-Z]/.test(char);\n }\n if (maskChar === \"*\") {\n return /[a-zA-Z0-9]/.test(char);\n }\n return false;\n}\n/**\n * This function finds the next open character in a given value.\n * @param value - a string representing the value to search\n * @param defaultMaskCharacter - a string representing the default mask character (e.g., \"_\")\n * @returns a number representing the index of the next open character\n */\nexport function getNextOpenCharacterIndex(\n value: string,\n defaultMaskCharacter: string,\n) {\n let idx = value.indexOf(defaultMaskCharacter);\n if (idx < 0) {\n idx = value.length;\n }\n return idx;\n}\n/**\n * This function finds the first non-fixed character in the value.\n * @param startingIndex - a number representing the index to start searching from\n * @param fixedCharacterIndices - an array of numbers representing the indices of the fixed characters\n * @returns a number representing the index of the first non-fixed character\n */\nexport function getFirstNonFixedCharacterIndex(\n startingIndex: number,\n fixedCharacterIndices: number[],\n) {\n let idx = startingIndex;\n while (fixedCharacterIndices.includes(idx)) {\n idx++;\n }\n return idx;\n}\n/**\n * This function finds the last filled character in a given value.\n * @param value - a string representing the value to search\n * @param mask - a string representing the mask\n * @returns a number representing the index of the last filled character\n */\nexport function getLastFilledCharacterIndex(value: string, mask: string) {\n let idx = value\n .split(\"\")\n .findLastIndex((char, i) => isAcceptableChar(char, mask[i]));\n if (idx < 0) {\n idx = 0;\n }\n return idx;\n}\n/**\n * This function finds the first filled character in a given value.\n * @param value - a string representing the value to search\n * @param mask - a string representing the mask\n * @returns a number representing the index of the first filled character\n */\nexport function getFirstFilledCharacterIndex(value: string, mask: string) {\n let idx = value\n .split(\"\")\n .findIndex((char, i) => isAcceptableChar(char, mask[i]));\n if (idx < 0) {\n idx = 0;\n }\n return idx;\n}\n","import {\n ChangeEvent,\n ChangeEventHandler,\n FocusEvent,\n KeyboardEvent,\n InputHTMLAttributes,\n ReactElement,\n cloneElement,\n forwardRef,\n isValidElement,\n useRef,\n useMemo,\n MouseEvent,\n} from \"react\";\nimport { useMergeRefs } from \"@floating-ui/react\";\nimport { useOptionallyControlledState } from \"../../internal/hooks\";\nimport { useTrackingId } from \"../../hooks\";\nimport { TextField, TextFieldProps } from \"../TextField/internal/TextField\";\nimport { childrenToString } from \"../../internal/functions\";\nimport {\n applyMask,\n getLastFilledCharacterIndex,\n getFirstFilledCharacterIndex,\n getFirstNonFixedCharacterIndex,\n getNextOpenCharacterIndex,\n} from \"./internal/utils\";\nimport { MASK_CHARS } from \"./internal/constants\";\nimport { DataTrackingId } from \"../../types\";\n\n/**\n * Props for InputMask when using with children\n */\ninterface InputMaskPropsWithChildren {\n /**\n * Custom input element to be wrapped with mask functionality.\n */\n children: ReactElement<InputHTMLAttributes<HTMLInputElement>>;\n /**\n * Additional props to pass to the input element.\n */\n inputProps?: InputHTMLAttributes<HTMLInputElement>;\n}\n\n/**\n * Props for InputMask when using without children\n */\ninterface InputMaskPropsWithoutChildren {\n /**\n * No children allowed when using default TextField.\n */\n children?: never;\n /**\n * Props to pass to the default TextField component.\n */\n inputProps?: TextFieldProps;\n}\n\n/**\n * Configuration for custom mask handler matching\n */\ninterface ICustomMaskHandlerMatch {\n /**\n * Regular expression pattern to match against input.\n */\n matchPattern: RegExp;\n /**\n * Starting position in the input string.\n */\n startPosition: number;\n /**\n * Ending position in the input string.\n */\n endPosition: number;\n}\n\n/**\n * Configuration for custom mask handler application\n */\ninterface ICustomMaskHandlerApply {\n /**\n * Pattern to apply when match is found.\n */\n applyPattern: string;\n /**\n * Offset to apply to cursor position after transformation.\n */\n caretOffset: number;\n}\n\n/**\n * Custom mask handler for advanced input transformations\n */\ninterface ICustomMaskHandler {\n /**\n * Matching configuration for the handler.\n */\n match: ICustomMaskHandlerMatch;\n /**\n * Application configuration for the handler.\n */\n apply: ICustomMaskHandlerApply;\n}\n\n/**\n * Shared props for InputMask component\n */\ninterface SharedInputMaskProps {\n /**\n * The mask pattern to apply to the input.\n * - \"9\" for digits only\n * - \"a\" for letters only\n * - \"*\" for alphanumeric\n * - Any other character is treated as a fixed character\n */\n mask: string;\n /**\n * Character to display for unfilled mask positions.\n * @default \"_\"\n */\n defaultMaskCharacter?: string;\n /**\n * Controlled value for the input.\n */\n value?: string;\n /**\n * Default value for uncontrolled input.\n */\n defaultValue?: string;\n /**\n * Callback function called when input value changes.\n */\n onChange?: ChangeEventHandler<HTMLInputElement>;\n /**\n * Array of custom mask handlers for advanced transformations.\n */\n customMaskHandler?: ICustomMaskHandler[];\n}\n\ntype SpecialChange = {\n reason: \"Backspace\" | \"Delete\" | \"Edit\";\n start: number;\n end: number;\n};\n\n/**\n * Props for the InputMask component\n * @property {string} mask - The mask pattern to apply to the input (9 for digits, a for letters, * for alphanumeric)\n * @property {string} [defaultMaskCharacter] - Character to display for unfilled mask positions\n * @property {array} [customMaskHandler] - Array of custom mask handlers for advanced transformations\n * @property {object} [inputProps] - Props to pass to the input component\n * @property {ReactElement} [children] - Custom input element to be wrapped with mask functionality\n * @property {string} [data-tracking-id] - Custom tracking ID for analytics\n */\nexport type InputMaskProps = SharedInputMaskProps &\n (InputMaskPropsWithChildren | InputMaskPropsWithoutChildren) &\n DataTrackingId;\n\n/**\n * InputMask component for applying input masks and formatting to text inputs.\n *\n * @deprecated Use the TextField component with custom masking instead. Over time, we intend to release additional components with built-in masking.\n */\nexport const InputMask = forwardRef<HTMLInputElement, InputMaskProps>(\n (\n {\n children,\n mask,\n defaultMaskCharacter = \"_\",\n value,\n defaultValue,\n onChange,\n inputProps,\n \"data-tracking-id\": dataTrackingId,\n },\n ref,\n ) => {\n const [v, setV] = useOptionallyControlledState({\n controlledValue:\n value !== undefined\n ? applyMask(value, mask, defaultMaskCharacter)\n : undefined,\n defaultValue: applyMask(defaultValue || \"\", mask, defaultMaskCharacter),\n // Omitting the onChange handler here because we want to handle it ourselves (i.e. send an event instead of just the value)\n });\n const specialChange = useRef<SpecialChange | null>(null);\n\n const inputRef = useRef<HTMLInputElement>(null);\n\n const passInRef = useMergeRefs([inputRef, ref]);\n\n const currentOpenCharacterCount = useMemo(() => {\n return v.split(\"\").filter((char) => char === defaultMaskCharacter).length;\n }, [v, defaultMaskCharacter]);\n\n const fixedCharacterIndices = useMemo(() => {\n const fixedIndices: number[] = [];\n mask.split(\"\").forEach((char, i) => {\n if (!MASK_CHARS.includes(char)) {\n fixedIndices.push(i);\n }\n });\n return fixedIndices;\n }, [mask]);\n\n const moveCursorTo = (start: number, end: number = start) => {\n requestAnimationFrame(() => {\n inputRef.current?.setSelectionRange(start, end);\n });\n };\n\n const handleChange = (e: ChangeEvent<HTMLInputElement>) => {\n let newVal = applyMask(e.target.value, mask, defaultMaskCharacter);\n if (\n // A single character was backspaced\n specialChange.current?.reason === \"Backspace\" &&\n specialChange.current.start === specialChange.current.end\n ) {\n // If the character before the backspace is a fixed character, we need to remove the filled character before the fixed character\n if (fixedCharacterIndices.includes(specialChange.current.start - 1)) {\n const removeIndex = getLastFilledCharacterIndex(\n newVal.slice(0, specialChange.current.start),\n mask,\n );\n newVal = applyMask(\n newVal.slice(0, removeIndex) + newVal.slice(removeIndex + 1),\n mask,\n defaultMaskCharacter,\n );\n moveCursorTo(removeIndex, removeIndex);\n } else {\n const idx = Math.min(\n getLastFilledCharacterIndex(newVal, mask) + 1,\n specialChange.current.start - 1,\n );\n moveCursorTo(idx, idx);\n }\n } else if (\n // A single character was deleted\n specialChange.current?.reason === \"Delete\" &&\n specialChange.current.start === specialChange.current.end\n ) {\n // If the character after the delete is a fixed character, we need to remove the filled character after the fixed character\n if (fixedCharacterIndices.includes(specialChange.current.start)) {\n const removeIndex = getFirstFilledCharacterIndex(\n newVal.slice(specialChange.current.start + 1),\n mask,\n );\n newVal = applyMask(\n newVal.slice(0, removeIndex) + newVal.slice(removeIndex + 1),\n mask,\n defaultMaskCharacter,\n );\n }\n const firstFilledIdx = getFirstFilledCharacterIndex(newVal, mask);\n const targetIdx = Math.max(firstFilledIdx, specialChange.current.start);\n moveCursorTo(targetIdx, targetIdx);\n } else if (\n specialChange.current?.reason === \"Edit\" &&\n specialChange.current.start === specialChange.current.end // A single character was edited\n ) {\n const firstNonFixedIdx = getFirstNonFixedCharacterIndex(\n specialChange.current.start + 1,\n fixedCharacterIndices,\n );\n moveCursorTo(firstNonFixedIdx, firstNonFixedIdx);\n } else {\n const newIndex = getNextOpenCharacterIndex(\n newVal,\n defaultMaskCharacter,\n );\n moveCursorTo(newIndex, newIndex);\n }\n\n setV(newVal);\n if (inputRef.current) {\n inputRef.current.value = newVal;\n }\n onChange?.({ ...e, target: { ...e.target, value: newVal } });\n };\n\n const handleFocus = (e: FocusEvent<HTMLInputElement>) => {\n requestAnimationFrame(() => {\n if (\n e.target.selectionStart === null ||\n e.target.selectionStart === undefined ||\n e.target.selectionStart >= v.length\n ) {\n const newIndex = getNextOpenCharacterIndex(v, defaultMaskCharacter);\n moveCursorTo(newIndex, newIndex);\n }\n });\n inputProps?.onFocus?.(e);\n };\n\n const handleKeyDown = (e: KeyboardEvent<HTMLInputElement>) => {\n const target = e.target as HTMLInputElement;\n if (target.selectionStart === null || target.selectionEnd === null) {\n return;\n }\n if (e.key === \"Backspace\") {\n specialChange.current = {\n reason: \"Backspace\",\n start: target.selectionStart,\n end: target.selectionEnd,\n };\n } else if (e.key === \"Delete\") {\n specialChange.current = {\n reason: \"Delete\",\n start: target.selectionStart,\n end: target.selectionEnd,\n };\n } else if (currentOpenCharacterCount === 0) {\n specialChange.current = {\n reason: \"Edit\",\n start: target.selectionStart,\n end: target.selectionEnd,\n };\n } else {\n specialChange.current = null;\n }\n inputProps?.onKeyDown?.(e);\n };\n\n const handleClick = (e: MouseEvent<HTMLInputElement>) => {\n // For future use.\n e.preventDefault();\n e.stopPropagation();\n inputProps?.onClick?.(e);\n };\n\n const handleBlur = (e: FocusEvent<HTMLInputElement>) => {\n // For future use.\n e.preventDefault();\n e.stopPropagation();\n inputProps?.onBlur?.(e);\n };\n\n const mergedInputProps = {\n ...inputProps,\n ...(children && isValidElement(children) ? children.props : {}),\n value: v,\n onChange: handleChange,\n onFocus: handleFocus,\n onKeyDown: handleKeyDown,\n onClick: handleClick,\n onBlur: handleBlur,\n ref: passInRef,\n };\n\n const isInputEmpty = useMemo(() => {\n if (v.length === 0) {\n return true;\n }\n return v === applyMask(\"\", mask, defaultMaskCharacter);\n }, [v, defaultMaskCharacter, mask]);\n\n const data = {\n label:\n \"label\" in mergedInputProps\n ? childrenToString(mergedInputProps.label)\n : null,\n labelProps:\n \"labelProps\" in mergedInputProps ? mergedInputProps.labelProps : null,\n prefix: childrenToString(mergedInputProps.prefix),\n hint:\n \"hint\" in mergedInputProps\n ? childrenToString(mergedInputProps.hint)\n : null,\n description:\n \"description\" in mergedInputProps\n ? childrenToString(mergedInputProps.description)\n : null,\n size: mergedInputProps.size,\n type: mergedInputProps.type,\n };\n\n const trackingId = useTrackingId({\n name: \"InputMask\",\n data,\n hasOverride: !!dataTrackingId,\n });\n\n return children && isValidElement(children) && children.type === \"input\" ? (\n cloneElement(children, {\n ...mergedInputProps,\n \"data-tracking-id\": trackingId,\n } as InputHTMLAttributes<HTMLInputElement> & {\n \"data-tracking-id\"?: string;\n })\n ) : (\n <TextField\n data-input-empty={isInputEmpty}\n data-tracking-id={trackingId}\n {...(mergedInputProps as TextFieldProps)}\n />\n );\n },\n);\n\nInputMask.displayName = \"InputMask\";\n"],"names":[],"mappings":";;;;;;;;AAAO,MAAM,UAAa,GAAA,CAAC,GAAK,EAAA,GAAA,EAAK,GAAG,CAAA;;ACcxB,SAAA,SAAA,CACd,KACA,EAAA,IAAA,EACA,oBACA,EAAA;AACA,EAAA,IAAI,WAAc,GAAA,EAAA;AAClB,EAAA,IAAI,UAAa,GAAA,CAAA;AACjB,EAAA,KAAA,IAAS,CAAI,GAAA,CAAA,EAAG,CAAI,GAAA,IAAA,CAAK,QAAQ,CAAK,EAAA,EAAA;AACpC,IAAM,MAAA,QAAA,GAAW,KAAK,CAAC,CAAA;AACvB,IAAI,IAAA,UAAA,CAAW,QAAS,CAAA,QAAQ,CAAG,EAAA;AAEjC,MACE,OAAA,UAAA,GAAa,MAAM,MACnB,IAAA,CAAC,iBAAiB,KAAM,CAAA,UAAU,CAAG,EAAA,QAAQ,CAC7C,EAAA;AACA,QAAA,UAAA,EAAA;AAAA;AAEF,MAAI,IAAA,UAAA,GAAa,MAAM,MAAQ,EAAA;AAC7B,QAAA,WAAA,IAAe,MAAM,UAAU,CAAA;AAC/B,QAAA,UAAA,EAAA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AAC,SAAA;AAAA,MAAA;AAAA,QACC,kBAAkB,EAAA,YAAA;AAAA,QAClB,kBAAkB,EAAA,UAAA;AAAA,QACjB,GAAI;AAAA;AAAA,KACP;AAAA;AAGN;AAEA,SAAA,CAAU,WAAc,GAAA,WAAA;;;;"}
|
|
1
|
+
{"version":3,"file":"InputMask-CPuYMcw9.js","sources":["../src/components/InputMask/internal/constants.ts","../src/components/InputMask/internal/utils.ts","../src/components/InputMask/InputMask.tsx"],"sourcesContent":["export const MASK_CHARS = [\"a\", \"9\", \"*\"];\n","import { MASK_CHARS } from \"./constants\";\n\n/**\n * This function applies the mask to the input value, returning a new string that matches the mask's format.\n * @param value - a string representing the raw input value (e.g., what the user typed)\n * @param mask - a string representing the desired input mask (e.g., \"99/99/9999\" for a date)\n * @param defaultMaskCharacter - a string representing the default mask character (e.g., \"_\")\n * @returns a string representing the masked value (e.g., \"12/31/2025\" for a date)\n *\n * @example\n * applyMask(\"1234567890\", \"99/99/9999\", \"_\") // \"12/31/2025\"\n * applyMask(\"1234567890\", \"999-999-9999\", \"-\") // \"123-456-7890\"\n * applyMask(\"123\", \"99/99\", \"_\") // \"12/3_\"\n */\nexport function applyMask(\n value: string,\n mask: string,\n defaultMaskCharacter: string,\n) {\n let maskedValue = \"\";\n let valueIndex = 0;\n for (let i = 0; i < mask.length; i++) {\n const maskChar = mask[i];\n if (MASK_CHARS.includes(maskChar)) {\n // Find next acceptable char in value\n while (\n valueIndex < value.length &&\n !isAcceptableChar(value[valueIndex], maskChar)\n ) {\n valueIndex++;\n }\n if (valueIndex < value.length) {\n maskedValue += value[valueIndex];\n valueIndex++;\n } else {\n maskedValue += defaultMaskCharacter;\n }\n } else {\n maskedValue += maskChar;\n }\n }\n return maskedValue;\n}\n/**\n * This function checks if a character is acceptable for a given mask character.\n * @param char - a string representing the character to check\n * @param maskChar - a string representing the mask character\n * @returns a boolean indicating if the character is acceptable\n */\nfunction isAcceptableChar(char: string, maskChar: string) {\n if (maskChar === \"9\") {\n return /\\d/.test(char);\n }\n if (maskChar === \"a\") {\n return /[a-zA-Z]/.test(char);\n }\n if (maskChar === \"*\") {\n return /[a-zA-Z0-9]/.test(char);\n }\n return false;\n}\n/**\n * This function finds the next open character in a given value.\n * @param value - a string representing the value to search\n * @param defaultMaskCharacter - a string representing the default mask character (e.g., \"_\")\n * @returns a number representing the index of the next open character\n */\nexport function getNextOpenCharacterIndex(\n value: string,\n defaultMaskCharacter: string,\n) {\n let idx = value.indexOf(defaultMaskCharacter);\n if (idx < 0) {\n idx = value.length;\n }\n return idx;\n}\n/**\n * This function finds the first non-fixed character in the value.\n * @param startingIndex - a number representing the index to start searching from\n * @param fixedCharacterIndices - an array of numbers representing the indices of the fixed characters\n * @returns a number representing the index of the first non-fixed character\n */\nexport function getFirstNonFixedCharacterIndex(\n startingIndex: number,\n fixedCharacterIndices: number[],\n) {\n let idx = startingIndex;\n while (fixedCharacterIndices.includes(idx)) {\n idx++;\n }\n return idx;\n}\n/**\n * This function finds the last filled character in a given value.\n * @param value - a string representing the value to search\n * @param mask - a string representing the mask\n * @returns a number representing the index of the last filled character\n */\nexport function getLastFilledCharacterIndex(value: string, mask: string) {\n let idx = value\n .split(\"\")\n .findLastIndex((char, i) => isAcceptableChar(char, mask[i]));\n if (idx < 0) {\n idx = 0;\n }\n return idx;\n}\n/**\n * This function finds the first filled character in a given value.\n * @param value - a string representing the value to search\n * @param mask - a string representing the mask\n * @returns a number representing the index of the first filled character\n */\nexport function getFirstFilledCharacterIndex(value: string, mask: string) {\n let idx = value\n .split(\"\")\n .findIndex((char, i) => isAcceptableChar(char, mask[i]));\n if (idx < 0) {\n idx = 0;\n }\n return idx;\n}\n","import {\n ChangeEvent,\n ChangeEventHandler,\n FocusEvent,\n KeyboardEvent,\n InputHTMLAttributes,\n ReactElement,\n cloneElement,\n forwardRef,\n isValidElement,\n useRef,\n useMemo,\n MouseEvent,\n} from \"react\";\nimport { useMergeRefs } from \"@floating-ui/react\";\nimport { useOptionallyControlledState } from \"../../internal/hooks\";\nimport { useTrackingId } from \"../../hooks\";\nimport { TextField, TextFieldProps } from \"../TextField/internal/TextField\";\nimport { childrenToString } from \"../../internal/functions\";\nimport {\n applyMask,\n getLastFilledCharacterIndex,\n getFirstFilledCharacterIndex,\n getFirstNonFixedCharacterIndex,\n getNextOpenCharacterIndex,\n} from \"./internal/utils\";\nimport { MASK_CHARS } from \"./internal/constants\";\nimport { DataTrackingId } from \"../../types\";\n\n/**\n * Props for InputMask when using with children\n */\ninterface InputMaskPropsWithChildren {\n /**\n * Custom input element to be wrapped with mask functionality.\n */\n children: ReactElement<InputHTMLAttributes<HTMLInputElement>>;\n /**\n * Additional props to pass to the input element.\n */\n inputProps?: InputHTMLAttributes<HTMLInputElement>;\n}\n\n/**\n * Props for InputMask when using without children\n */\ninterface InputMaskPropsWithoutChildren {\n /**\n * No children allowed when using default TextField.\n */\n children?: never;\n /**\n * Props to pass to the default TextField component.\n */\n inputProps?: TextFieldProps;\n}\n\n/**\n * Configuration for custom mask handler matching\n */\ninterface ICustomMaskHandlerMatch {\n /**\n * Regular expression pattern to match against input.\n */\n matchPattern: RegExp;\n /**\n * Starting position in the input string.\n */\n startPosition: number;\n /**\n * Ending position in the input string.\n */\n endPosition: number;\n}\n\n/**\n * Configuration for custom mask handler application\n */\ninterface ICustomMaskHandlerApply {\n /**\n * Pattern to apply when match is found.\n */\n applyPattern: string;\n /**\n * Offset to apply to cursor position after transformation.\n */\n caretOffset: number;\n}\n\n/**\n * Custom mask handler for advanced input transformations\n */\ninterface ICustomMaskHandler {\n /**\n * Matching configuration for the handler.\n */\n match: ICustomMaskHandlerMatch;\n /**\n * Application configuration for the handler.\n */\n apply: ICustomMaskHandlerApply;\n}\n\n/**\n * Shared props for InputMask component\n */\ninterface SharedInputMaskProps {\n /**\n * The mask pattern to apply to the input.\n * - \"9\" for digits only\n * - \"a\" for letters only\n * - \"*\" for alphanumeric\n * - Any other character is treated as a fixed character\n */\n mask: string;\n /**\n * Character to display for unfilled mask positions.\n * @default \"_\"\n */\n defaultMaskCharacter?: string;\n /**\n * Controlled value for the input.\n */\n value?: string;\n /**\n * Default value for uncontrolled input.\n */\n defaultValue?: string;\n /**\n * Callback function called when input value changes.\n */\n onChange?: ChangeEventHandler<HTMLInputElement>;\n /**\n * Array of custom mask handlers for advanced transformations.\n */\n customMaskHandler?: ICustomMaskHandler[];\n}\n\ntype SpecialChange = {\n reason: \"Backspace\" | \"Delete\" | \"Edit\";\n start: number;\n end: number;\n};\n\n/**\n * Props for the InputMask component\n * @property {string} mask - The mask pattern to apply to the input (9 for digits, a for letters, * for alphanumeric)\n * @property {string} [defaultMaskCharacter] - Character to display for unfilled mask positions\n * @property {array} [customMaskHandler] - Array of custom mask handlers for advanced transformations\n * @property {object} [inputProps] - Props to pass to the input component\n * @property {ReactElement} [children] - Custom input element to be wrapped with mask functionality\n * @property {string} [data-tracking-id] - Custom tracking ID for analytics\n */\nexport type InputMaskProps = SharedInputMaskProps &\n (InputMaskPropsWithChildren | InputMaskPropsWithoutChildren) &\n DataTrackingId;\n\n/**\n * InputMask component for applying input masks and formatting to text inputs.\n *\n * @deprecated Use the TextField component with custom masking instead. Over time, we intend to release additional components with built-in masking.\n */\nexport const InputMask = forwardRef<HTMLInputElement, InputMaskProps>(\n (\n {\n children,\n mask,\n defaultMaskCharacter = \"_\",\n value,\n defaultValue,\n onChange,\n inputProps,\n \"data-tracking-id\": dataTrackingId,\n },\n ref,\n ) => {\n const [v, setV] = useOptionallyControlledState({\n controlledValue:\n value !== undefined\n ? applyMask(value, mask, defaultMaskCharacter)\n : undefined,\n defaultValue: applyMask(defaultValue || \"\", mask, defaultMaskCharacter),\n // Omitting the onChange handler here because we want to handle it ourselves (i.e. send an event instead of just the value)\n });\n const specialChange = useRef<SpecialChange | null>(null);\n\n const inputRef = useRef<HTMLInputElement>(null);\n\n const passInRef = useMergeRefs([inputRef, ref]);\n\n const currentOpenCharacterCount = useMemo(() => {\n return v.split(\"\").filter((char) => char === defaultMaskCharacter).length;\n }, [v, defaultMaskCharacter]);\n\n const fixedCharacterIndices = useMemo(() => {\n const fixedIndices: number[] = [];\n mask.split(\"\").forEach((char, i) => {\n if (!MASK_CHARS.includes(char)) {\n fixedIndices.push(i);\n }\n });\n return fixedIndices;\n }, [mask]);\n\n const moveCursorTo = (start: number, end: number = start) => {\n requestAnimationFrame(() => {\n inputRef.current?.setSelectionRange(start, end);\n });\n };\n\n const handleChange = (e: ChangeEvent<HTMLInputElement>) => {\n let newVal = applyMask(e.target.value, mask, defaultMaskCharacter);\n if (\n // A single character was backspaced\n specialChange.current?.reason === \"Backspace\" &&\n specialChange.current.start === specialChange.current.end\n ) {\n // If the character before the backspace is a fixed character, we need to remove the filled character before the fixed character\n if (fixedCharacterIndices.includes(specialChange.current.start - 1)) {\n const removeIndex = getLastFilledCharacterIndex(\n newVal.slice(0, specialChange.current.start),\n mask,\n );\n newVal = applyMask(\n newVal.slice(0, removeIndex) + newVal.slice(removeIndex + 1),\n mask,\n defaultMaskCharacter,\n );\n moveCursorTo(removeIndex, removeIndex);\n } else {\n const idx = Math.min(\n getLastFilledCharacterIndex(newVal, mask) + 1,\n specialChange.current.start - 1,\n );\n moveCursorTo(idx, idx);\n }\n } else if (\n // A single character was deleted\n specialChange.current?.reason === \"Delete\" &&\n specialChange.current.start === specialChange.current.end\n ) {\n // If the character after the delete is a fixed character, we need to remove the filled character after the fixed character\n if (fixedCharacterIndices.includes(specialChange.current.start)) {\n const removeIndex = getFirstFilledCharacterIndex(\n newVal.slice(specialChange.current.start + 1),\n mask,\n );\n newVal = applyMask(\n newVal.slice(0, removeIndex) + newVal.slice(removeIndex + 1),\n mask,\n defaultMaskCharacter,\n );\n }\n const firstFilledIdx = getFirstFilledCharacterIndex(newVal, mask);\n const targetIdx = Math.max(firstFilledIdx, specialChange.current.start);\n moveCursorTo(targetIdx, targetIdx);\n } else if (\n specialChange.current?.reason === \"Edit\" &&\n specialChange.current.start === specialChange.current.end // A single character was edited\n ) {\n const firstNonFixedIdx = getFirstNonFixedCharacterIndex(\n specialChange.current.start + 1,\n fixedCharacterIndices,\n );\n moveCursorTo(firstNonFixedIdx, firstNonFixedIdx);\n } else {\n const newIndex = getNextOpenCharacterIndex(\n newVal,\n defaultMaskCharacter,\n );\n moveCursorTo(newIndex, newIndex);\n }\n\n setV(newVal);\n if (inputRef.current) {\n inputRef.current.value = newVal;\n }\n onChange?.({ ...e, target: { ...e.target, value: newVal } });\n };\n\n const handleFocus = (e: FocusEvent<HTMLInputElement>) => {\n requestAnimationFrame(() => {\n if (\n e.target.selectionStart === null ||\n e.target.selectionStart === undefined ||\n e.target.selectionStart >= v.length\n ) {\n const newIndex = getNextOpenCharacterIndex(v, defaultMaskCharacter);\n moveCursorTo(newIndex, newIndex);\n }\n });\n inputProps?.onFocus?.(e);\n };\n\n const handleKeyDown = (e: KeyboardEvent<HTMLInputElement>) => {\n const target = e.target as HTMLInputElement;\n if (target.selectionStart === null || target.selectionEnd === null) {\n return;\n }\n if (e.key === \"Backspace\") {\n specialChange.current = {\n reason: \"Backspace\",\n start: target.selectionStart,\n end: target.selectionEnd,\n };\n } else if (e.key === \"Delete\") {\n specialChange.current = {\n reason: \"Delete\",\n start: target.selectionStart,\n end: target.selectionEnd,\n };\n } else if (currentOpenCharacterCount === 0) {\n specialChange.current = {\n reason: \"Edit\",\n start: target.selectionStart,\n end: target.selectionEnd,\n };\n } else {\n specialChange.current = null;\n }\n inputProps?.onKeyDown?.(e);\n };\n\n const handleClick = (e: MouseEvent<HTMLInputElement>) => {\n // For future use.\n e.preventDefault();\n e.stopPropagation();\n inputProps?.onClick?.(e);\n };\n\n const handleBlur = (e: FocusEvent<HTMLInputElement>) => {\n // For future use.\n e.preventDefault();\n e.stopPropagation();\n inputProps?.onBlur?.(e);\n };\n\n const mergedInputProps = {\n ...inputProps,\n ...(children && isValidElement(children) ? children.props : {}),\n value: v,\n onChange: handleChange,\n onFocus: handleFocus,\n onKeyDown: handleKeyDown,\n onClick: handleClick,\n onBlur: handleBlur,\n ref: passInRef,\n };\n\n const isInputEmpty = useMemo(() => {\n if (v.length === 0) {\n return true;\n }\n return v === applyMask(\"\", mask, defaultMaskCharacter);\n }, [v, defaultMaskCharacter, mask]);\n\n const data = {\n label:\n \"label\" in mergedInputProps\n ? childrenToString(mergedInputProps.label)\n : null,\n labelProps:\n \"labelProps\" in mergedInputProps ? mergedInputProps.labelProps : null,\n prefix: childrenToString(mergedInputProps.prefix),\n hint:\n \"hint\" in mergedInputProps\n ? childrenToString(mergedInputProps.hint)\n : null,\n description:\n \"description\" in mergedInputProps\n ? childrenToString(mergedInputProps.description)\n : null,\n size: mergedInputProps.size,\n type: mergedInputProps.type,\n };\n\n const trackingId = useTrackingId({\n name: \"InputMask\",\n data,\n hasOverride: !!dataTrackingId,\n });\n\n return children && isValidElement(children) && children.type === \"input\" ? (\n cloneElement(children, {\n ...mergedInputProps,\n \"data-tracking-id\": trackingId,\n } as InputHTMLAttributes<HTMLInputElement> & {\n \"data-tracking-id\"?: string;\n })\n ) : (\n <TextField\n data-input-empty={isInputEmpty}\n data-tracking-id={trackingId}\n {...(mergedInputProps as TextFieldProps)}\n />\n );\n },\n);\n\nInputMask.displayName = \"InputMask\";\n"],"names":[],"mappings":";;;;;;;;AAAO,MAAM,UAAA,GAAa,CAAC,GAAA,EAAK,GAAA,EAAK,GAAG,CAAA;;ACcjC,SAAS,SAAA,CACd,KAAA,EACA,IAAA,EACA,oBAAA,EACA;AACA,EAAA,IAAI,WAAA,GAAc,EAAA;AAClB,EAAA,IAAI,UAAA,GAAa,CAAA;AACjB,EAAA,KAAA,IAAS,CAAA,GAAI,CAAA,EAAG,CAAA,GAAI,IAAA,CAAK,QAAQ,CAAA,EAAA,EAAK;AACpC,IAAA,MAAM,QAAA,GAAW,KAAK,CAAC,CAAA;AACvB,IAAA,IAAI,UAAA,CAAW,QAAA,CAAS,QAAQ,CAAA,EAAG;AAEjC,MAAA,OACE,UAAA,GAAa,MAAM,MAAA,IACnB,CAAC,iBAAi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AAA,MACN,MAAM,gBAAA,CAAiB,IAAA;AAAA,MACvB,MAAM,gBAAA,CAAiB;AAAA,KACzB;AAEA,IAAA,MAAM,aAAa,aAAA,CAAc;AAAA,MAC/B,IAAA,EAAM,WAAA;AAAA,MACN,IAAA;AAAA,MACA,WAAA,EAAa,CAAC,CAAC;AAAA,KAChB,CAAA;AAED,IAAA,OAAO,QAAA,IAAY,eAAe,QAAQ,CAAA,IAAK,SAAS,IAAA,KAAS,OAAA,GAC/D,aAAa,QAAA,EAAU;AAAA,MACrB,GAAG,gBAAA;AAAA,MACH,kBAAA,EAAoB;AAAA,KAGrB,CAAA,mBAED,GAAA;AAAA,MAAC,SAAA;AAAA,MAAA;AAAA,QACC,kBAAA,EAAkB,YAAA;AAAA,QAClB,kBAAA,EAAkB,UAAA;AAAA,QACjB,GAAI;AAAA;AAAA,KACP;AAAA,EAEJ;AACF;AAEA,SAAA,CAAU,WAAA,GAAc,WAAA;;;;"}
|
package/dist/InputMask.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { I as InputMask, I as default } from './InputMask-
|
|
1
|
+
export { I as InputMask, I as default } from './InputMask-CPuYMcw9.js';
|
|
2
2
|
//# sourceMappingURL=InputMask.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Layout-CUUb2PVr.js","sources":["../src/components/Layout/Layout.tsx"],"sourcesContent":["import { ComponentPropsWithoutRef, forwardRef } from \"react\";\nimport cx from \"classnames\";\nimport styles from \"./Layout.module.scss\";\n\n/**\n * Props for the Layout component.\n */\nexport type LayoutProps = ComponentPropsWithoutRef<\"div\"> & {\n /** Whether the layout should be fluid (full width) instead of constrained */\n fluid?: boolean;\n /** The spacing variant for the layout grid */\n variant?: \"default\" | \"wide\" | \"narrow\";\n};\n\n/**\n * Layout container component that provides a responsive grid system.\n *\n * Features:\n * - CSS Grid-based responsive layout system\n * - Container with max-width constraint (1280px) by default\n * - Fluid option for full-width layouts\n * - Three spacing variants: default, wide, and narrow\n * - Container queries for responsive behavior\n * - Automatic tracking ID generation for analytics\n * - Semantic HTML structure with proper accessibility\n * - Flexible content area for child Layout.Item components\n * - Consistent spacing and alignment across breakpoints\n *\n * @example\n * <Layout>\n * <Layout.Item span={6}>Left Column</Layout.Item>\n * <Layout.Item span={6}>Right Column</Layout.Item>\n * </Layout>\n *\n * @example\n * <Layout fluid variant=\"wide\">\n * <Layout.Item span={4}>Column 1</Layout.Item>\n * <Layout.Item span={4}>Column 2</Layout.Item>\n * <Layout.Item span={4}>Column 3</Layout.Item>\n * </Layout>\n *\n * @example\n * <Layout variant=\"narrow\">\n * <Layout.Item span={12}>\n * <h1>Full Width Content</h1>\n * <p>This content spans the full width of the layout.</p>\n * </Layout.Item>\n * </Layout>\n */\nexport const LayoutElement = forwardRef<HTMLDivElement, LayoutProps>(\n (props, ref) => {\n const {\n children,\n className,\n fluid = false,\n variant = \"default\",\n ...rest\n } = props;\n\n return (\n <div className={cx(styles.container, { [styles.fluid]: fluid })}>\n <div\n className={cx(\n styles.grid,\n {\n [styles.wide]: variant === \"wide\",\n [styles.narrow]: variant === \"narrow\",\n },\n className,\n )}\n ref={ref}\n {...rest}\n >\n {children}\n </div>\n </div>\n );\n },\n);\n\nLayoutElement.displayName = \"Layout\";\n\n/**\n * Props for the Layout.Item component.\n */\nexport type LayoutItemProps = ComponentPropsWithoutRef<\"div\"> & {\n /** Default span across all breakpoints (1-12) */\n span?: number;\n /** Extra small breakpoint span (1-12) */\n xs?: number;\n /** Small breakpoint span (1-12) */\n sm?: number;\n /** Medium breakpoint span (1-12) */\n md?: number;\n /** Large breakpoint span (1-12) */\n lg?: number;\n /** Extra large breakpoint span (1-12) */\n xl?: number;\n /** Extra extra large breakpoint span (1-12) */\n xxl?: number;\n};\n\n// TODO: clamp span numbers higher than 12\n\n/**\n * Layout item component that defines grid columns within a Layout container.\n *\n * Features:\n * - Responsive grid columns with breakpoint-specific spans\n * - 12-column grid system for flexible layouts\n * - Breakpoint-specific span controls (xs, sm, md, lg, xl, xxl)\n * - Default span fallback for all breakpoints\n * - Automatic responsive behavior using container queries\n * - Semantic HTML structure with proper accessibility\n * - Flexible content area for any child components\n * - Consistent spacing and alignment with parent Layout\n * - Automatic tracking ID generation for analytics\n *\n * Breakpoints:\n * - xs: Extra small (mobile)\n * - sm: Small (tablet portrait)\n * - md: Medium (tablet landscape)\n * - lg: Large (desktop)\n * - xl: Extra large (large desktop)\n * - xxl: Extra extra large (ultra-wide)\n *\n * @example\n * <Layout>\n * <Layout.Item span={6} md={4} lg={3}>\n * <Card>Responsive Card</Card>\n * </Layout.Item>\n * <Layout.Item span={6} md={8} lg={9}>\n * <Card>Main Content</Card>\n * </Layout.Item>\n * </Layout>\n *\n * @example\n * <Layout>\n * <Layout.Item span={12} md={6}>\n * <h2>Left Column</h2>\n * <p>This takes full width on mobile, half width on medium+ screens.</p>\n * </Layout.Item>\n * <Layout.Item span={12} md={6}>\n * <h2>Right Column</h2>\n * <p>This also takes full width on mobile, half width on medium+ screens.</p>\n * </Layout.Item>\n * </Layout>\n *\n * @example\n * <Layout variant=\"wide\">\n * <Layout.Item span={1} sm={2} md={3} lg={4}>\n * <Button>Small Button</Button>\n * </Layout.Item>\n * <Layout.Item span={11} sm={10} md={9} lg={8}>\n * <TextField placeholder=\"Search...\" />\n * </Layout.Item>\n * </Layout>\n */\nexport const LayoutItem = forwardRef<HTMLDivElement, LayoutItemProps>(\n (\n { children, className, span = 12, xs, sm, md, lg, xl, xxl, ...props },\n ref,\n ) => {\n return (\n <div\n ref={ref}\n {...props}\n className={cx(\n styles.cell,\n styles[`xs${xs || span}`],\n {\n [styles[`sm${sm}`]]: sm,\n [styles[`md${md}`]]: md,\n [styles[`lg${lg}`]]: lg,\n [styles[`xl${xl}`]]: xl,\n [styles[`xxl${xxl}`]]: xxl,\n },\n className,\n )}\n >\n {children}\n </div>\n );\n },\n);\n\nLayoutItem.displayName = \"LayoutItem\";\n\n/**\n * Layout component with compound component pattern.\n *\n * @example\n * <Layout>\n * <Layout.Item span={6}>Left</Layout.Item>\n * <Layout.Item span={6}>Right</Layout.Item>\n * </Layout>\n */\nexport const Layout = Object.assign(LayoutElement, {\n Item: LayoutItem,\n});\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiDO,MAAM,
|
|
1
|
+
{"version":3,"file":"Layout-CUUb2PVr.js","sources":["../src/components/Layout/Layout.tsx"],"sourcesContent":["import { ComponentPropsWithoutRef, forwardRef } from \"react\";\nimport cx from \"classnames\";\nimport styles from \"./Layout.module.scss\";\n\n/**\n * Props for the Layout component.\n */\nexport type LayoutProps = ComponentPropsWithoutRef<\"div\"> & {\n /** Whether the layout should be fluid (full width) instead of constrained */\n fluid?: boolean;\n /** The spacing variant for the layout grid */\n variant?: \"default\" | \"wide\" | \"narrow\";\n};\n\n/**\n * Layout container component that provides a responsive grid system.\n *\n * Features:\n * - CSS Grid-based responsive layout system\n * - Container with max-width constraint (1280px) by default\n * - Fluid option for full-width layouts\n * - Three spacing variants: default, wide, and narrow\n * - Container queries for responsive behavior\n * - Automatic tracking ID generation for analytics\n * - Semantic HTML structure with proper accessibility\n * - Flexible content area for child Layout.Item components\n * - Consistent spacing and alignment across breakpoints\n *\n * @example\n * <Layout>\n * <Layout.Item span={6}>Left Column</Layout.Item>\n * <Layout.Item span={6}>Right Column</Layout.Item>\n * </Layout>\n *\n * @example\n * <Layout fluid variant=\"wide\">\n * <Layout.Item span={4}>Column 1</Layout.Item>\n * <Layout.Item span={4}>Column 2</Layout.Item>\n * <Layout.Item span={4}>Column 3</Layout.Item>\n * </Layout>\n *\n * @example\n * <Layout variant=\"narrow\">\n * <Layout.Item span={12}>\n * <h1>Full Width Content</h1>\n * <p>This content spans the full width of the layout.</p>\n * </Layout.Item>\n * </Layout>\n */\nexport const LayoutElement = forwardRef<HTMLDivElement, LayoutProps>(\n (props, ref) => {\n const {\n children,\n className,\n fluid = false,\n variant = \"default\",\n ...rest\n } = props;\n\n return (\n <div className={cx(styles.container, { [styles.fluid]: fluid })}>\n <div\n className={cx(\n styles.grid,\n {\n [styles.wide]: variant === \"wide\",\n [styles.narrow]: variant === \"narrow\",\n },\n className,\n )}\n ref={ref}\n {...rest}\n >\n {children}\n </div>\n </div>\n );\n },\n);\n\nLayoutElement.displayName = \"Layout\";\n\n/**\n * Props for the Layout.Item component.\n */\nexport type LayoutItemProps = ComponentPropsWithoutRef<\"div\"> & {\n /** Default span across all breakpoints (1-12) */\n span?: number;\n /** Extra small breakpoint span (1-12) */\n xs?: number;\n /** Small breakpoint span (1-12) */\n sm?: number;\n /** Medium breakpoint span (1-12) */\n md?: number;\n /** Large breakpoint span (1-12) */\n lg?: number;\n /** Extra large breakpoint span (1-12) */\n xl?: number;\n /** Extra extra large breakpoint span (1-12) */\n xxl?: number;\n};\n\n// TODO: clamp span numbers higher than 12\n\n/**\n * Layout item component that defines grid columns within a Layout container.\n *\n * Features:\n * - Responsive grid columns with breakpoint-specific spans\n * - 12-column grid system for flexible layouts\n * - Breakpoint-specific span controls (xs, sm, md, lg, xl, xxl)\n * - Default span fallback for all breakpoints\n * - Automatic responsive behavior using container queries\n * - Semantic HTML structure with proper accessibility\n * - Flexible content area for any child components\n * - Consistent spacing and alignment with parent Layout\n * - Automatic tracking ID generation for analytics\n *\n * Breakpoints:\n * - xs: Extra small (mobile)\n * - sm: Small (tablet portrait)\n * - md: Medium (tablet landscape)\n * - lg: Large (desktop)\n * - xl: Extra large (large desktop)\n * - xxl: Extra extra large (ultra-wide)\n *\n * @example\n * <Layout>\n * <Layout.Item span={6} md={4} lg={3}>\n * <Card>Responsive Card</Card>\n * </Layout.Item>\n * <Layout.Item span={6} md={8} lg={9}>\n * <Card>Main Content</Card>\n * </Layout.Item>\n * </Layout>\n *\n * @example\n * <Layout>\n * <Layout.Item span={12} md={6}>\n * <h2>Left Column</h2>\n * <p>This takes full width on mobile, half width on medium+ screens.</p>\n * </Layout.Item>\n * <Layout.Item span={12} md={6}>\n * <h2>Right Column</h2>\n * <p>This also takes full width on mobile, half width on medium+ screens.</p>\n * </Layout.Item>\n * </Layout>\n *\n * @example\n * <Layout variant=\"wide\">\n * <Layout.Item span={1} sm={2} md={3} lg={4}>\n * <Button>Small Button</Button>\n * </Layout.Item>\n * <Layout.Item span={11} sm={10} md={9} lg={8}>\n * <TextField placeholder=\"Search...\" />\n * </Layout.Item>\n * </Layout>\n */\nexport const LayoutItem = forwardRef<HTMLDivElement, LayoutItemProps>(\n (\n { children, className, span = 12, xs, sm, md, lg, xl, xxl, ...props },\n ref,\n ) => {\n return (\n <div\n ref={ref}\n {...props}\n className={cx(\n styles.cell,\n styles[`xs${xs || span}`],\n {\n [styles[`sm${sm}`]]: sm,\n [styles[`md${md}`]]: md,\n [styles[`lg${lg}`]]: lg,\n [styles[`xl${xl}`]]: xl,\n [styles[`xxl${xxl}`]]: xxl,\n },\n className,\n )}\n >\n {children}\n </div>\n );\n },\n);\n\nLayoutItem.displayName = \"LayoutItem\";\n\n/**\n * Layout component with compound component pattern.\n *\n * @example\n * <Layout>\n * <Layout.Item span={6}>Left</Layout.Item>\n * <Layout.Item span={6}>Right</Layout.Item>\n * </Layout>\n */\nexport const Layout = Object.assign(LayoutElement, {\n Item: LayoutItem,\n});\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiDO,MAAM,aAAA,GAAgB,UAAA;AAAA,EAC3B,CAAC,OAAO,GAAA,KAAQ;AACd,IAAA,MAAM;AAAA,MACJ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AA,EAAA,EAAK,EAAE,CAAA,CAAE,CAAC,GAAG,EAAA;AAAA,YACrB,CAAC,MAAA,CAAO,CAAA,EAAA,EAAK,EAAE,CAAA,CAAE,CAAC,GAAG,EAAA;AAAA,YACrB,CAAC,MAAA,CAAO,CAAA,EAAA,EAAK,EAAE,CAAA,CAAE,CAAC,GAAG,EAAA;AAAA,YACrB,CAAC,MAAA,CAAO,CAAA,GAAA,EAAM,GAAG,CAAA,CAAE,CAAC,GAAG;AAAA,WACzB;AAAA,UACA;AAAA,SACF;AAAA,QAEC;AAAA;AAAA,KACH;AAAA,EAEJ;AACF;AAEA,UAAA,CAAW,WAAA,GAAc,YAAA;AAWlB,MAAM,MAAA,GAAS,MAAA,CAAO,MAAA,CAAO,aAAA,EAAe;AAAA,EACjD,IAAA,EAAM;AACR,CAAC;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Link-eRsLWPaQ.js","sources":["../../hammer-icon/mdi/round/open_in_new.svg","../src/components/Link/internal/LinkHeadless.tsx","../src/components/Link/useLinkStyles.ts","../src/components/Link/internal/Link.tsx","../src/components/Link/Link.tsx"],"sourcesContent":["import * as React from \"react\";\nconst SvgOpenInNew = (props) => /* @__PURE__ */ React.createElement(\"svg\", { xmlns: \"http://www.w3.org/2000/svg\", width: \"1em\", height: \"1em\", viewBox: \"0 0 24 24\", ...props }, /* @__PURE__ */ React.createElement(\"path\", { d: \"M18 19H6c-.55 0-1-.45-1-1V6c0-.55.45-1 1-1h5c.55 0 1-.45 1-1s-.45-1-1-1H5a2 2 0 0 0-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2v-6c0-.55-.45-1-1-1s-1 .45-1 1v5c0 .55-.45 1-1 1zM14 4c0 .55.45 1 1 1h2.59l-9.13 9.13a.996.996 0 1 0 1.41 1.41L19 6.41V9c0 .55.45 1 1 1s1-.45 1-1V4c0-.55-.45-1-1-1h-5c-.55 0-1 .45-1 1z\" }));\nexport default SvgOpenInNew;\n","import { forwardRef, ComponentPropsWithoutRef } from \"react\";\n\nimport styles from \"./Link.module.scss\";\nimport { Icon } from \"../../Icon\";\nimport OpenInNew from \"@servicetitan/hammer-icon/mdi/round/open_in_new.svg\";\n\n/**\n * Props for the LinkHeadless component.\n * @extends ComponentPropsWithoutRef<\"a\">\n */\nexport type LinkHeadlessProps = ComponentPropsWithoutRef<\"a\">;\n\n/**\n * Headless link component for creating accessible hyperlinks.\n *\n * Features:\n * - Security attributes (rel=\"noopener noreferrer\") for external links\n *\n * @example\n * <LinkHeadless href=\"/dashboard\">\n * Go to Dashboard\n * </LinkHeadless>\n *\n * @example\n * <LinkHeadless href=\"https://example.com\" target=\"_blank\">\n * External Documentation\n * </LinkHeadless>\n *\n */\nexport const LinkHeadless = forwardRef<HTMLAnchorElement, LinkHeadlessProps>(\n ({ children, ...props }, ref) => {\n return (\n <a\n rel=\"noopener noreferrer\"\n data-anv=\"link-headless\"\n ref={ref}\n {...props}\n >\n {children}\n {props.target === \"_blank\" && (\n <Icon className={styles[\"open-in-new\"]} inherit svg={OpenInNew} />\n )}\n </a>\n );\n },\n);\n\nLinkHeadless.displayName = \"LinkHeadless\";\n","import cx from \"classnames\";\n\nimport { LayoutUtilProps } from \"../../types\";\nimport { LinkProps } from \"./Link\";\nimport { useLayoutPropsUtil } from \"../../internal/hooks\";\n\nimport styles from \"./internal/Link.module.scss\";\n\n/**\n * Props for the useLinkStyles hook.\n * @extends LayoutUtilProps\n */\nexport type UseLinkStylesProps = LayoutUtilProps &\n Pick<LinkProps, \"className\" | \"appearance\" | \"quiet\" | \"style\">;\n\n/**\n * Hook for generating link styles and class names.\n *\n * @param props - The link style properties\n * @returns Object containing linkClassNames and styleCombined\n */\nexport const useLinkStyles = (props: UseLinkStylesProps) => {\n const { layoutStyles, componentProps } = useLayoutPropsUtil(props);\n const { className, appearance = \"primary\", quiet, style } = componentProps;\n\n const linkClassNames = cx([styles[\"link\"]], className, {\n [styles[\"quiet\"]]: quiet,\n [styles[\"secondary\"]]: appearance === \"secondary\",\n });\n\n const styleCombined = Object.assign({}, style, layoutStyles);\n\n return { linkClassNames, styleCombined };\n};\n","import { forwardRef, ComponentPropsWithoutRef } from \"react\";\n\nimport { LayoutUtilProps } from \"../../../types\";\n\nimport { LinkHeadless } from \"./LinkHeadless\";\n\nimport { useLinkStyles } from \"../useLinkStyles\";\n\n/**\n * Props for the Link component.\n * @extends ComponentPropsWithoutRef<\"a\">\n * @extends LayoutUtilProps\n */\nexport type LinkProps = ComponentPropsWithoutRef<\"a\"> &\n LayoutUtilProps &\n (\n | {\n /**\n * The visual appearance of the link.\n * @default \"primary\"\n */\n appearance?: \"primary\";\n /** Whether the link should have a quieter, less prominent appearance */\n quiet?: boolean;\n }\n | {\n /** The visual appearance of the link. Secondary appearance cannot be quiet. */\n appearance: \"secondary\";\n quiet?: false;\n }\n );\n\n/**\n * Link component for creating accessible, styled hyperlinks.\n *\n * Features:\n * - Two visual appearances: primary (default) and secondary\n * - Quiet mode for less prominent styling\n * - Automatic external link icon for target=\"_blank\" links\n * - Security attributes (rel=\"noopener noreferrer\") for external links\n * - Full accessibility support with proper focus management\n * - Supports layout utilities for positioning and spacing\n * - Flexible content support for text and other elements\n * - Responsive design with consistent typography\n * - Hover and focus states with proper visual feedback\n * - Screen reader support for external link announcements\n *\n * @example\n * <Link href=\"/dashboard\" appearance=\"primary\">\n * Go to Dashboard\n * </Link>\n *\n * @example\n * <Link href=\"https://example.com\" target=\"_blank\" quiet>\n * External Documentation\n * </Link>\n *\n * @example\n * <Link href=\"/settings\" appearance=\"secondary\">\n * Settings\n * </Link>\n *\n * @example\n * <Link href=\"/profile\" gap=\"2\" alignItems=\"center\">\n * <Avatar name=\"John Doe\" size=\"small\" />\n * View Profile\n * </Link>\n */\nexport const Link = forwardRef<HTMLAnchorElement, LinkProps>((props, ref) => {\n const { appearance, className, quiet, style, children, ...rest } = props;\n const { linkClassNames, styleCombined } = useLinkStyles({\n appearance,\n className,\n quiet,\n style,\n });\n\n return (\n <LinkHeadless\n className={linkClassNames}\n data-anv=\"link\"\n ref={ref}\n style={styleCombined}\n {...rest}\n >\n {children}\n </LinkHeadless>\n );\n});\n\nLink.displayName = \"Link\";\n","import { Ref, forwardRef } from \"react\";\n\nimport { childrenToString } from \"../../internal/functions\";\nimport { DataTrackingId, DistributiveOmit } from \"../../types\";\nimport { useTrackingId } from \"../../hooks\";\n\nimport { LinkProps as BaseLinkProps, Link as BaseLink } from \"./internal/Link\";\n\n/**\n * Props for the Link component.\n * @extends Omit<BaseLinkProps, \"href\">\n * @extends DataTrackingId\n */\nexport type LinkProps = DistributiveOmit<BaseLinkProps, \"href\"> &\n DataTrackingId &\n (\n | {\n pathname?: never;\n search?: never;\n href?: BaseLinkProps[\"href\"];\n }\n | {\n pathname: string;\n search?: string;\n href?: never;\n }\n | {\n pathname?: never;\n search?: never;\n href?: never;\n }\n );\n\n/**\n * Link component for creating accessible, styled hyperlinks with tracking support.\n *\n * Features:\n * - Two visual appearances: primary (default) and secondary\n * - Quiet mode for less prominent styling\n * - Automatic external link icon for target=\"_blank\" links\n * - Security attributes (rel=\"noopener noreferrer\") for external links\n * - Full accessibility support with proper focus management\n * - Supports layout utilities for positioning and spacing\n * - Flexible content support for text and other elements\n * - Responsive design with consistent typography\n * - Hover and focus states with proper visual feedback\n * - Screen reader support for external link announcements\n * - Automatic tracking ID generation for analytics\n * - Client-side navigation support with pathname and search params\n * - History API integration for single-page application navigation\n *\n * @example\n * <Link href=\"/dashboard\" appearance=\"primary\">\n * Go to Dashboard\n * </Link>\n *\n * @example\n * <Link pathname=\"/settings\" search=\"?tab=profile\">\n * Profile Settings\n * </Link>\n *\n * @example\n * <Link href=\"https://example.com\" target=\"_blank\" quiet>\n * External Documentation\n * </Link>\n *\n * @example\n * <Link href=\"/profile\" gap=\"2\" alignItems=\"center\">\n * <Avatar name=\"John Doe\" size=\"small\" />\n * View Profile\n * </Link>\n */\nexport const Link = forwardRef(\n (props: LinkProps, ref: Ref<HTMLAnchorElement>) => {\n const { onClick, pathname, children, search, ...rest } = props;\n const data = {\n appearance: props.appearance,\n quiet: props.quiet,\n children: childrenToString(children),\n };\n\n const handleClick = (\n ...args: Parameters<NonNullable<LinkProps[\"onClick\"]>>\n ) => {\n if (pathname) {\n const to = pathname + (search ?? \"\");\n args[0].preventDefault();\n history.pushState(null, \"\", to);\n onClick?.(...args);\n } else {\n onClick?.(...args);\n }\n };\n\n const trackingId = useTrackingId({\n name: \"Link\",\n data,\n hasOverride: !!rest[\"data-tracking-id\"],\n });\n\n return (\n <BaseLink\n onClick={handleClick}\n ref={ref}\n data-tracking-id={trackingId}\n {...rest}\n >\n {children}\n </BaseLink>\n );\n },\n);\n\nLink.displayName = BaseLink.displayName;\n"],"names":["styles","OpenInNew","Link","BaseLink"],"mappings":";;;;;;;;;;AACA,MAAM,YAAY,GAAG,CAAC,KAAK,qBAAqB,KAAK,CAAC,aAAa,CAAC,KAAK,EAAE,EAAE,KAAK,EAAE,4BAA4B,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,GAAG,KAAK,EAAE,kBAAkB,KAAK,CAAC,aAAa,CAAC,MAAM,EAAE,EAAE,CAAC,EAAE,oTAAoT,EAAE,CAAC,CAAC;;AC4BnhB,MAAM,YAAe,GAAA,UAAA;AAAA,EAC1B,CAAC,EAAE,QAAA,EAAU,GAAG,KAAA,IAAS,GAAQ,KAAA;AAC/B,IACE,uBAAA,IAAA;AAAA,MAAC,GAAA;AAAA,MAAA;AAAA,QACC,GAAI,EAAA,qBAAA;AAAA,QACJ,UAAS,EAAA,eAAA;AAAA,QACT,GAAA;AAAA,QACC,GAAG,KAAA;AAAA,QAEH,QAAA,EAAA;AAAA,UAAA,QAAA;AAAA,UACA,KAAM,CAAA,MAAA,KAAW,QAChB,oBAAA,GAAA,CAAC,IAAK,EAAA,EAAA,SAAA,EAAWA,UAAO,CAAA,aAAa,CAAG,EAAA,OAAA,EAAO,IAA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K,WAAc,GAAA,MAAA;;AClBZ,MAAM,IAAO,GAAA,UAAA;AAAA,EAClB,CAAC,OAAkB,GAAgC,KAAA;AACjD,IAAA,MAAM,EAAE,OAAS,EAAA,QAAA,EAAU,UAAU,MAAQ,EAAA,GAAG,MAAS,GAAA,KAAA;AACzD,IAAA,MAAM,IAAO,GAAA;AAAA,MACX,YAAY,KAAM,CAAA,UAAA;AAAA,MAClB,OAAO,KAAM,CAAA,KAAA;AAAA,MACb,QAAA,EAAU,iBAAiB,QAAQ;AAAA,KACrC;AAEA,IAAM,MAAA,WAAA,GAAc,IACf,IACA,KAAA;AACH,MAAA,IAAI,QAAU,EAAA;AACZ,QAAM,MAAA,EAAA,GAAK,YAAY,MAAU,IAAA,EAAA,CAAA;AACjC,QAAK,IAAA,CAAA,CAAC,EAAE,cAAe,EAAA;AACvB,QAAQ,OAAA,CAAA,SAAA,CAAU,IAAM,EAAA,EAAA,EAAI,EAAE,CAAA;AAC9B,QAAA,OAAA,GAAU,GAAG,IAAI,CAAA;AAAA,OACZ,MAAA;AACL,QAAA,OAAA,GAAU,GAAG,IAAI,CAAA;AAAA;AACnB,KACF;AAEA,IAAA,MAAM,aAAa,aAAc,CAAA;AAAA,MAC/B,IAAM,EAAA,MAAA;AAAA,MACN,IAAA;AAAA,MACA,WAAa,EAAA,CAAC,CAAC,IAAA,CAAK,kBAAkB;AAAA,KACvC,CAAA;AAED,IACE,uBAAA,GAAA;AAAA,MAACC,MAAA;AAAA,MAAA;AAAA,QACC,OAAS,EAAA,WAAA;AAAA,QACT,GAAA;AAAA,QACA,kBAAkB,EAAA,UAAA;AAAA,QACjB,GAAG,IAAA;AAAA,QAEH;AAAA;AAAA,KACH;AAAA;AAGN;AAEA,IAAA,CAAK,cAAcA,MAAS,CAAA,WAAA;;;;"}
|
|
1
|
+
{"version":3,"file":"Link-eRsLWPaQ.js","sources":["../../hammer-icon/mdi/round/open_in_new.svg","../src/components/Link/internal/LinkHeadless.tsx","../src/components/Link/useLinkStyles.ts","../src/components/Link/internal/Link.tsx","../src/components/Link/Link.tsx"],"sourcesContent":["import * as React from \"react\";\nconst SvgOpenInNew = (props) => /* @__PURE__ */ React.createElement(\"svg\", { xmlns: \"http://www.w3.org/2000/svg\", width: \"1em\", height: \"1em\", viewBox: \"0 0 24 24\", ...props }, /* @__PURE__ */ React.createElement(\"path\", { d: \"M18 19H6c-.55 0-1-.45-1-1V6c0-.55.45-1 1-1h5c.55 0 1-.45 1-1s-.45-1-1-1H5a2 2 0 0 0-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2v-6c0-.55-.45-1-1-1s-1 .45-1 1v5c0 .55-.45 1-1 1zM14 4c0 .55.45 1 1 1h2.59l-9.13 9.13a.996.996 0 1 0 1.41 1.41L19 6.41V9c0 .55.45 1 1 1s1-.45 1-1V4c0-.55-.45-1-1-1h-5c-.55 0-1 .45-1 1z\" }));\nexport default SvgOpenInNew;\n","import { forwardRef, ComponentPropsWithoutRef } from \"react\";\n\nimport styles from \"./Link.module.scss\";\nimport { Icon } from \"../../Icon\";\nimport OpenInNew from \"@servicetitan/hammer-icon/mdi/round/open_in_new.svg\";\n\n/**\n * Props for the LinkHeadless component.\n * @extends ComponentPropsWithoutRef<\"a\">\n */\nexport type LinkHeadlessProps = ComponentPropsWithoutRef<\"a\">;\n\n/**\n * Headless link component for creating accessible hyperlinks.\n *\n * Features:\n * - Security attributes (rel=\"noopener noreferrer\") for external links\n *\n * @example\n * <LinkHeadless href=\"/dashboard\">\n * Go to Dashboard\n * </LinkHeadless>\n *\n * @example\n * <LinkHeadless href=\"https://example.com\" target=\"_blank\">\n * External Documentation\n * </LinkHeadless>\n *\n */\nexport const LinkHeadless = forwardRef<HTMLAnchorElement, LinkHeadlessProps>(\n ({ children, ...props }, ref) => {\n return (\n <a\n rel=\"noopener noreferrer\"\n data-anv=\"link-headless\"\n ref={ref}\n {...props}\n >\n {children}\n {props.target === \"_blank\" && (\n <Icon className={styles[\"open-in-new\"]} inherit svg={OpenInNew} />\n )}\n </a>\n );\n },\n);\n\nLinkHeadless.displayName = \"LinkHeadless\";\n","import cx from \"classnames\";\n\nimport { LayoutUtilProps } from \"../../types\";\nimport { LinkProps } from \"./Link\";\nimport { useLayoutPropsUtil } from \"../../internal/hooks\";\n\nimport styles from \"./internal/Link.module.scss\";\n\n/**\n * Props for the useLinkStyles hook.\n * @extends LayoutUtilProps\n */\nexport type UseLinkStylesProps = LayoutUtilProps &\n Pick<LinkProps, \"className\" | \"appearance\" | \"quiet\" | \"style\">;\n\n/**\n * Hook for generating link styles and class names.\n *\n * @param props - The link style properties\n * @returns Object containing linkClassNames and styleCombined\n */\nexport const useLinkStyles = (props: UseLinkStylesProps) => {\n const { layoutStyles, componentProps } = useLayoutPropsUtil(props);\n const { className, appearance = \"primary\", quiet, style } = componentProps;\n\n const linkClassNames = cx([styles[\"link\"]], className, {\n [styles[\"quiet\"]]: quiet,\n [styles[\"secondary\"]]: appearance === \"secondary\",\n });\n\n const styleCombined = Object.assign({}, style, layoutStyles);\n\n return { linkClassNames, styleCombined };\n};\n","import { forwardRef, ComponentPropsWithoutRef } from \"react\";\n\nimport { LayoutUtilProps } from \"../../../types\";\n\nimport { LinkHeadless } from \"./LinkHeadless\";\n\nimport { useLinkStyles } from \"../useLinkStyles\";\n\n/**\n * Props for the Link component.\n * @extends ComponentPropsWithoutRef<\"a\">\n * @extends LayoutUtilProps\n */\nexport type LinkProps = ComponentPropsWithoutRef<\"a\"> &\n LayoutUtilProps &\n (\n | {\n /**\n * The visual appearance of the link.\n * @default \"primary\"\n */\n appearance?: \"primary\";\n /** Whether the link should have a quieter, less prominent appearance */\n quiet?: boolean;\n }\n | {\n /** The visual appearance of the link. Secondary appearance cannot be quiet. */\n appearance: \"secondary\";\n quiet?: false;\n }\n );\n\n/**\n * Link component for creating accessible, styled hyperlinks.\n *\n * Features:\n * - Two visual appearances: primary (default) and secondary\n * - Quiet mode for less prominent styling\n * - Automatic external link icon for target=\"_blank\" links\n * - Security attributes (rel=\"noopener noreferrer\") for external links\n * - Full accessibility support with proper focus management\n * - Supports layout utilities for positioning and spacing\n * - Flexible content support for text and other elements\n * - Responsive design with consistent typography\n * - Hover and focus states with proper visual feedback\n * - Screen reader support for external link announcements\n *\n * @example\n * <Link href=\"/dashboard\" appearance=\"primary\">\n * Go to Dashboard\n * </Link>\n *\n * @example\n * <Link href=\"https://example.com\" target=\"_blank\" quiet>\n * External Documentation\n * </Link>\n *\n * @example\n * <Link href=\"/settings\" appearance=\"secondary\">\n * Settings\n * </Link>\n *\n * @example\n * <Link href=\"/profile\" gap=\"2\" alignItems=\"center\">\n * <Avatar name=\"John Doe\" size=\"small\" />\n * View Profile\n * </Link>\n */\nexport const Link = forwardRef<HTMLAnchorElement, LinkProps>((props, ref) => {\n const { appearance, className, quiet, style, children, ...rest } = props;\n const { linkClassNames, styleCombined } = useLinkStyles({\n appearance,\n className,\n quiet,\n style,\n });\n\n return (\n <LinkHeadless\n className={linkClassNames}\n data-anv=\"link\"\n ref={ref}\n style={styleCombined}\n {...rest}\n >\n {children}\n </LinkHeadless>\n );\n});\n\nLink.displayName = \"Link\";\n","import { Ref, forwardRef } from \"react\";\n\nimport { childrenToString } from \"../../internal/functions\";\nimport { DataTrackingId, DistributiveOmit } from \"../../types\";\nimport { useTrackingId } from \"../../hooks\";\n\nimport { LinkProps as BaseLinkProps, Link as BaseLink } from \"./internal/Link\";\n\n/**\n * Props for the Link component.\n * @extends Omit<BaseLinkProps, \"href\">\n * @extends DataTrackingId\n */\nexport type LinkProps = DistributiveOmit<BaseLinkProps, \"href\"> &\n DataTrackingId &\n (\n | {\n pathname?: never;\n search?: never;\n href?: BaseLinkProps[\"href\"];\n }\n | {\n pathname: string;\n search?: string;\n href?: never;\n }\n | {\n pathname?: never;\n search?: never;\n href?: never;\n }\n );\n\n/**\n * Link component for creating accessible, styled hyperlinks with tracking support.\n *\n * Features:\n * - Two visual appearances: primary (default) and secondary\n * - Quiet mode for less prominent styling\n * - Automatic external link icon for target=\"_blank\" links\n * - Security attributes (rel=\"noopener noreferrer\") for external links\n * - Full accessibility support with proper focus management\n * - Supports layout utilities for positioning and spacing\n * - Flexible content support for text and other elements\n * - Responsive design with consistent typography\n * - Hover and focus states with proper visual feedback\n * - Screen reader support for external link announcements\n * - Automatic tracking ID generation for analytics\n * - Client-side navigation support with pathname and search params\n * - History API integration for single-page application navigation\n *\n * @example\n * <Link href=\"/dashboard\" appearance=\"primary\">\n * Go to Dashboard\n * </Link>\n *\n * @example\n * <Link pathname=\"/settings\" search=\"?tab=profile\">\n * Profile Settings\n * </Link>\n *\n * @example\n * <Link href=\"https://example.com\" target=\"_blank\" quiet>\n * External Documentation\n * </Link>\n *\n * @example\n * <Link href=\"/profile\" gap=\"2\" alignItems=\"center\">\n * <Avatar name=\"John Doe\" size=\"small\" />\n * View Profile\n * </Link>\n */\nexport const Link = forwardRef(\n (props: LinkProps, ref: Ref<HTMLAnchorElement>) => {\n const { onClick, pathname, children, search, ...rest } = props;\n const data = {\n appearance: props.appearance,\n quiet: props.quiet,\n children: childrenToString(children),\n };\n\n const handleClick = (\n ...args: Parameters<NonNullable<LinkProps[\"onClick\"]>>\n ) => {\n if (pathname) {\n const to = pathname + (search ?? \"\");\n args[0].preventDefault();\n history.pushState(null, \"\", to);\n onClick?.(...args);\n } else {\n onClick?.(...args);\n }\n };\n\n const trackingId = useTrackingId({\n name: \"Link\",\n data,\n hasOverride: !!rest[\"data-tracking-id\"],\n });\n\n return (\n <BaseLink\n onClick={handleClick}\n ref={ref}\n data-tracking-id={trackingId}\n {...rest}\n >\n {children}\n </BaseLink>\n );\n },\n);\n\nLink.displayName = BaseLink.displayName;\n"],"names":["styles","OpenInNew","Link","BaseLink"],"mappings":";;;;;;;;;;AACA,MAAM,YAAY,GAAG,CAAC,KAAK,qBAAqB,KAAK,CAAC,aAAa,CAAC,KAAK,EAAE,EAAE,KAAK,EAAE,4BAA4B,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EA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