@servicetitan/anvil2 1.49.0 → 1.49.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 +14 -0
- package/dist/{Calendar-B7ypKGUn.js → Calendar-BkJs1qTF.js} +55 -65
- package/dist/Calendar-BkJs1qTF.js.map +1 -0
- package/dist/{Calendar-1MhJ03iy.js → Calendar-WHERvu2Y.js} +2 -2
- package/dist/{Calendar-1MhJ03iy.js.map → Calendar-WHERvu2Y.js.map} +1 -1
- package/dist/Calendar.css +52 -51
- package/dist/Calendar.js +2 -2
- package/dist/{Combobox-C4COM7BZ.js → Combobox-RjBDpgFV.js} +3 -3
- package/dist/{Combobox-C4COM7BZ.js.map → Combobox-RjBDpgFV.js.map} +1 -1
- package/dist/Combobox.js +1 -1
- package/dist/{DateField-C5rA3USK.js → DateField-BNleIuS8.js} +4 -4
- package/dist/{DateField-C5rA3USK.js.map → DateField-BNleIuS8.js.map} +1 -1
- package/dist/DateField.js +1 -1
- package/dist/{DateFieldRange-BLfEH-oC.js → DateFieldRange-BBgvno-_.js} +8 -5
- package/dist/{DateFieldRange-BLfEH-oC.js.map → DateFieldRange-BBgvno-_.js.map} +1 -1
- package/dist/DateFieldRange.js +1 -1
- package/dist/{DateFieldSingle-7Cx_FMtb.js → DateFieldSingle-Bcwkxogy.js} +8 -5
- package/dist/{DateFieldSingle-7Cx_FMtb.js.map → DateFieldSingle-Bcwkxogy.js.map} +1 -1
- package/dist/DateFieldSingle.js +1 -1
- package/dist/{DateFieldYearless-D2uo-uqE.js → DateFieldYearless-DnVJaBBq.js} +2 -1
- package/dist/{DateFieldYearless-D2uo-uqE.js.map → DateFieldYearless-DnVJaBBq.js.map} +1 -1
- package/dist/DateFieldYearless.js +1 -1
- package/dist/Dnd.js +1 -1
- package/dist/DndSort.js +3 -2
- package/dist/DndSort.js.map +1 -1
- package/dist/{InputMask-fS5nqXdI.js → InputMask-Cd01c3Tj.js} +2 -2
- package/dist/{InputMask-fS5nqXdI.js.map → InputMask-Cd01c3Tj.js.map} +1 -1
- package/dist/InputMask.js +1 -1
- package/dist/{SegmentedControl-C-QOwO7q.js → SegmentedControl-DK1cwC7A.js} +11 -2
- package/dist/SegmentedControl-DK1cwC7A.js.map +1 -0
- package/dist/SegmentedControl.js +1 -1
- package/dist/{Stepper-B0U_YrbZ.js → Stepper-BZr9ytpD.js} +4 -1
- package/dist/Stepper-BZr9ytpD.js.map +1 -0
- package/dist/Stepper.js +1 -1
- package/dist/{Switch-DjL2CsQi.js → Switch-BXDPs2mD.js} +4 -2
- package/dist/Switch-BXDPs2mD.js.map +1 -0
- package/dist/Switch.js +1 -1
- package/dist/{TextField-DOSwy_gm.js → TextField-CpVkZxMT.js} +2 -2
- package/dist/{TextField-DOSwy_gm.js.map → TextField-CpVkZxMT.js.map} +1 -1
- package/dist/{TextField-DcyjojNg.js → TextField-CygbgVVt.js} +3 -2
- package/dist/TextField-CygbgVVt.js.map +1 -0
- package/dist/TextField.js +1 -1
- package/dist/{TimeField-C4s8fjDG.js → TimeField-BkOB5ESa.js} +3 -2
- package/dist/{TimeField-C4s8fjDG.js.map → TimeField-BkOB5ESa.js.map} +1 -1
- package/dist/TimeField.js +1 -1
- package/dist/{Toolbar-BvFwcXOk.js → Toolbar-is5509wJ.js} +5 -5
- package/dist/{Toolbar-BvFwcXOk.js.map → Toolbar-is5509wJ.js.map} +1 -1
- package/dist/Toolbar.js +1 -1
- package/dist/beta.js +3 -3
- package/dist/components/Dnd/DndHandleButton.d.ts +2 -1
- package/dist/{index-B25zeBIC.js → index-ByS9WvPk.js} +2 -1
- package/dist/index-ByS9WvPk.js.map +1 -0
- package/dist/index.js +13 -13
- package/dist/{utils-B8bmyfFR.js → utils-aSAOVHjX.js} +2 -2
- package/dist/{utils-B8bmyfFR.js.map → utils-aSAOVHjX.js.map} +1 -1
- package/package.json +2 -2
- package/dist/Calendar-B7ypKGUn.js.map +0 -1
- package/dist/SegmentedControl-C-QOwO7q.js.map +0 -1
- package/dist/Stepper-B0U_YrbZ.js.map +0 -1
- package/dist/Switch-DjL2CsQi.js.map +0 -1
- package/dist/TextField-DcyjojNg.js.map +0 -1
- package/dist/index-B25zeBIC.js.map +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx } from 'react/jsx-runtime';
|
|
2
2
|
import { forwardRef, useRef, useMemo, isValidElement, cloneElement } from 'react';
|
|
3
3
|
import { u as useMergeRefs } from './DrawerContext-D4tWTLVf.js';
|
|
4
|
-
import { T as TextField } from './TextField-
|
|
4
|
+
import { T as TextField } from './TextField-CygbgVVt.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-Cd01c3Tj.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InputMask-fS5nqXdI.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,iBAAiB,KAAA,CAAM,UAAU,CAAA,EAAG,QAAQ,CAAA,EAC7C;AACA,QAAA,UAAA,EAAA;AAAA,MACF;AACA,MAAA,IAAI,UAAA,GAAa,MAAM,MAAA,EAAQ;AAC7B,QAAA,WAAA,IAAe,MAAM,UAAU,CAAA;AAC/B,QAAA,UAAA,EAAA;AAAA,MACF,CAAA,MAAO;AACL,QAAA,WAAA,IAAe,oBAAA;AAAA,MACjB;AAAA,IACF,CAAA,MAAO;AACL,MAAA,WAAA,IAAe,QAAA;AAAA,IACjB;AAAA,EACF;AACA,EAAA,OAAO,WAAA;AACT;AAOA,SAAS,gBAAA,CAAiB,MAAc,QAAA,EAAkB;AACxD,EAAA,IAAI,aAAa,GAAA,EAAK;AACpB,IAAA,OAAO,IAAA,CAAK,KAAK,IAAI,CAAA;AAAA,EACvB;AACA,EAAA,IAAI,aAAa,GAAA,EAAK;AACpB,IAAA,OAAO,UAAA,CAAW,KAAK,IAAI,CAAA;AAAA,EAC7B;AACA,EAAA,IAAI,aAAa,GAAA,EAAK;AACpB,IAAA,OAAO,a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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,iBAAiB,KAAA,CAAM,UAAU,CAAA,EAAG,QAAQ,CAAA,EAC7C;AACA,QAAA,UAAA,EAAA;AAAA,MACF;AACA,MAAA,IAAI,UAAA,GAAa,MAAM,MAAA,EAAQ;AAC7B,QAAA,WAAA,IAAe,MAAM,UAAU,CAAA;AAC/B,QAAA,UAAA,EAAA;AAAA,MACF,CAAA,MAAO;AACL,QAAA,WAAA,IA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,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-Cd01c3Tj.js';
|
|
2
2
|
//# sourceMappingURL=InputMask.js.map
|
|
@@ -30,7 +30,14 @@ const styles = {
|
|
|
30
30
|
};
|
|
31
31
|
|
|
32
32
|
const SegmentedControlSegment = forwardRef((props, ref) => {
|
|
33
|
-
const {
|
|
33
|
+
const {
|
|
34
|
+
icon,
|
|
35
|
+
value,
|
|
36
|
+
children,
|
|
37
|
+
className,
|
|
38
|
+
"aria-label": ariaLabel,
|
|
39
|
+
...rest
|
|
40
|
+
} = props;
|
|
34
41
|
const shouldReduceMotion = useReducedMotion();
|
|
35
42
|
const { current, setCurrent, name } = useContext(SegmentedControlContext);
|
|
36
43
|
const labelRef = useRef(null);
|
|
@@ -45,6 +52,7 @@ const SegmentedControlSegment = forwardRef((props, ref) => {
|
|
|
45
52
|
data,
|
|
46
53
|
hasOverride: !!props["data-tracking-id"]
|
|
47
54
|
});
|
|
55
|
+
const computedAriaLabel = !children ? ariaLabel || value : void 0;
|
|
48
56
|
return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs(
|
|
49
57
|
"label",
|
|
50
58
|
{
|
|
@@ -52,6 +60,7 @@ const SegmentedControlSegment = forwardRef((props, ref) => {
|
|
|
52
60
|
ref: useMergeRefs([labelRef, ref]),
|
|
53
61
|
"data-tracking-id": trackingId,
|
|
54
62
|
"data-anv": "segmented-control-segment",
|
|
63
|
+
"aria-label": computedAriaLabel,
|
|
55
64
|
...rest,
|
|
56
65
|
children: [
|
|
57
66
|
/* @__PURE__ */ jsx(
|
|
@@ -162,4 +171,4 @@ const SegmentedControl = Object.assign(SegmentedControlElement, {
|
|
|
162
171
|
});
|
|
163
172
|
|
|
164
173
|
export { SegmentedControl as S, SegmentedControlSegment as a };
|
|
165
|
-
//# sourceMappingURL=SegmentedControl-
|
|
174
|
+
//# sourceMappingURL=SegmentedControl-DK1cwC7A.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SegmentedControl-DK1cwC7A.js","sources":["../src/components/SegmentedControl/internal/SegmentedControlContext.ts","../src/components/SegmentedControl/SegmentedControlSegment.tsx","../src/components/SegmentedControl/SegmentedControl.tsx"],"sourcesContent":["import { createContext } from \"react\";\n\nimport { SegmentedControlSegmentProps } from \"../SegmentedControlSegment\";\nimport { SegmentedControlProps } from \"../SegmentedControl\";\n\n/**\n * Context props for SegmentedControl internal state management\n */\nexport type SegmentedControlContextProps = {\n /**\n * Currently selected segment value\n */\n current?: SegmentedControlSegmentProps[\"value\"];\n /**\n * Function to set the current segment\n */\n setCurrent?: (value: SegmentedControlSegmentProps[\"value\"]) => void;\n /**\n * Change handler for the segmented control\n */\n onChange?: SegmentedControlProps[\"onChange\"];\n /**\n * Name attribute for radio inputs\n */\n name?: string;\n};\n\nexport const SegmentedControlContext =\n createContext<SegmentedControlContextProps>({});\n","import {\n useContext,\n useRef,\n forwardRef,\n ComponentPropsWithoutRef,\n} from \"react\";\nimport cx from \"classnames\";\nimport { core } from \"@servicetitan/hammer-token\";\n\nimport { DataTrackingId } from \"../../types\";\nimport { Icon, IconProps } from \"../Icon\";\nimport { motion, useReducedMotion } from \"motion/react\";\nimport { useMergeRefs, useTrackingId } from \"../../hooks\";\n\nimport { SegmentedControlContext } from \"./internal/SegmentedControlContext\";\n\nimport styles from \"./SegmentedControl.module.scss\";\n\n/**\n * State object returned by segment interactions\n */\nexport type SegmentState = {\n /**\n * Whether the segment is checked\n */\n checked: boolean;\n /**\n * The value of the segment\n */\n value?: SegmentedControlSegmentProps[\"value\"];\n};\n\n/**\n * Props for the SegmentedControlSegment component\n * @extends ComponentPropsWithoutRef<\"label\">\n */\nexport type SegmentedControlSegmentProps = ComponentPropsWithoutRef<\"label\"> & {\n /**\n * Optional icon to display in the segment\n */\n icon?: IconProps[\"svg\"];\n /**\n * Value of the segment\n */\n value: string;\n /**\n * The content to display in the segment\n */\n children?: React.ReactNode;\n} & DataTrackingId;\n\n/**\n * SegmentedControlSegment component for individual segments within a segmented control.\n *\n * Features:\n * - Individual segment with radio input\n * - Optional icon support\n * - Animated selection indicator\n * - Accessibility support with proper ARIA attributes\n * - Context integration with parent SegmentedControl\n * - Motion animations with reduced motion support\n * - Icon-only mode when no children provided\n * - Data tracking id support\n *\n * @example\n * <SegmentedControl.Segment value=\"option1\" icon={Icon1}>\n * Option 1\n * </SegmentedControl.Segment>\n *\n * @example\n * <SegmentedControl.Segment value=\"icon-only\" icon={IconOnly} />\n */\nexport const SegmentedControlSegment = forwardRef<\n HTMLLabelElement,\n SegmentedControlSegmentProps\n>((props, ref) => {\n const {\n icon,\n value,\n children,\n className,\n \"aria-label\": ariaLabel,\n ...rest\n } = props;\n const shouldReduceMotion = useReducedMotion();\n const { current, setCurrent, name } = useContext(SegmentedControlContext);\n const labelRef = useRef<HTMLSpanElement>(null);\n\n const classNames = cx(styles.segment, className, {\n [styles[\"icon-only\"]]: icon && !children,\n });\n\n const data = {\n value: props.value,\n };\n\n const trackingId = useTrackingId({\n name: \"SegmentedControlSegment\",\n data,\n hasOverride: !!props[\"data-tracking-id\"],\n });\n\n // For icon-only segments (no children), use aria-label if provided, otherwise fall back to value\n const computedAriaLabel = !children ? ariaLabel || value : undefined;\n\n return (\n <>\n <label\n className={classNames}\n ref={useMergeRefs([labelRef, ref])}\n data-tracking-id={trackingId}\n data-anv=\"segmented-control-segment\"\n aria-label={computedAriaLabel}\n {...rest}\n >\n <input\n type=\"radio\"\n name={name}\n value={value}\n onChange={() => setCurrent?.(value)}\n checked={current === value}\n aria-checked={current === value}\n />\n {icon ? <Icon svg={icon} aria-hidden /> : null}\n {children}\n {current === value && (\n <motion.span\n layoutId={name}\n className={styles[\"select-indicator\"]}\n transition={{\n duration: shouldReduceMotion\n ? 0\n : +core.primitive.Duration.value.replace(\"ms\", \"\") / 1000,\n }}\n />\n )}\n </label>\n </>\n );\n});\n\nSegmentedControlSegment.displayName = \"SegmentedControlSegment\";\n","import { forwardRef, useId, ComponentPropsWithoutRef, useRef } from \"react\";\nimport cx from \"classnames\";\nimport { motion } from \"motion/react\";\n\nimport { DataTrackingId, LayoutUtilProps, Size } from \"../../types\";\nimport { useMergeRefs, useTrackingId } from \"../../hooks\";\nimport { useOptionallyControlledState } from \"../../internal/hooks\";\n\nimport { SegmentedControlContext } from \"./internal/SegmentedControlContext\";\nimport {\n SegmentedControlSegment,\n SegmentedControlSegmentProps,\n} from \"./SegmentedControlSegment\";\n\nimport styles from \"./SegmentedControl.module.scss\";\n\n/**\n * Base props for SegmentedControl component\n * @extends Omit<ComponentPropsWithoutRef<\"div\">, \"onAnimationStart\" | \"onDragStart\" | \"onDragEnd\" | \"onDrag\" | \"onChange\">\n * @extends LayoutUtilProps\n */\ntype BaseSegmentedControlProps = Omit<\n ComponentPropsWithoutRef<\"div\">,\n \"onAnimationStart\" | \"onDragStart\" | \"onDragEnd\" | \"onDrag\" | \"onChange\"\n> &\n LayoutUtilProps &\n DataTrackingId & {\n /**\n * Callback when segment is changed\n */\n onChange?: (value: SegmentedControlSegmentProps[\"value\"]) => void;\n\n /**\n * Size of the segment\n * @default \"medium\"\n */\n size?: Extract<Size, \"small\" | \"medium\">;\n\n /**\n * Whether to fill available width\n * @default false\n */\n fill?: boolean;\n\n /**\n * Name attribute for radio inputs\n * @remarks If empty, it will auto generate one using useId()\n */\n name?: string;\n\n /**\n * The segments to render within the segmented control\n */\n children?: React.ReactNode;\n };\n\n/**\n * Props for controlled SegmentedControl\n */\ntype ControlledSegmentedControlProps = BaseSegmentedControlProps & {\n /**\n * Selected segment (controlled mode)\n */\n selected: SegmentedControlSegmentProps[\"value\"];\n defaultSelected?: never;\n};\n\n/**\n * Props for uncontrolled SegmentedControl\n */\ntype UncontrolledSegmentedControlProps = BaseSegmentedControlProps & {\n /**\n * Initial selection (uncontrolled mode)\n */\n defaultSelected: SegmentedControlSegmentProps[\"value\"];\n selected?: never;\n};\n\n/**\n * Props for the SegmentedControl component\n */\nexport type SegmentedControlProps =\n | ControlledSegmentedControlProps\n | UncontrolledSegmentedControlProps;\n\nconst SegmentedControlElement = forwardRef<\n HTMLDivElement,\n SegmentedControlProps\n>((props, ref) => {\n const {\n className,\n onClick,\n onChange,\n children,\n size = \"medium\",\n defaultSelected,\n selected,\n name,\n fill,\n ...rest\n } = props;\n\n const [current, setCurrent] = useOptionallyControlledState({\n controlledValue: selected,\n defaultValue: defaultSelected,\n onChange,\n });\n\n const segmentedControlRef = useRef<HTMLDivElement>(null);\n\n const SegmentedControlClassNames = cx(\n styles[\"segmented-control\"],\n styles[size],\n className,\n {\n [styles.fill]: fill,\n },\n );\n\n const uid = useId();\n\n const data = {\n name: props.name,\n };\n\n const trackingId = useTrackingId({\n name: \"SegmentedControl\",\n data,\n hasOverride: !!props[\"data-tracking-id\"],\n });\n\n return (\n <motion.div\n transition={{ duration: 0 }}\n layout\n role=\"radiogroup\"\n className={SegmentedControlClassNames}\n data-anv=\"segmented-control\"\n data-tracking-id={trackingId}\n ref={useMergeRefs([segmentedControlRef, ref])}\n {...rest}\n >\n <SegmentedControlContext.Provider\n value={{ current, setCurrent, name: name ?? uid }}\n >\n {children}\n </SegmentedControlContext.Provider>\n </motion.div>\n );\n});\n\nSegmentedControlElement.displayName = \"SegmentedControl\";\n\n/**\n * SegmentedControl component for selecting one option from a group of related choices.\n *\n * Features:\n * - Supports both controlled and uncontrolled modes\n * - Multiple size variants (small, medium)\n * - Optional fill width mode\n * - Smooth animations with motion\n * - Accessibility support with proper radio group semantics\n * - Layout utility props for positioning and spacing\n * - Context-based state management\n * - Auto-generated or custom name attributes\n * - Segment support via SegmentedControl.Segment\n * - Data tracking id support\n *\n * @example\n * <SegmentedControl\n * selected={selectedValue}\n * onChange={setSelectedValue}\n * size=\"medium\"\n * >\n * <SegmentedControl.Segment value=\"option1\">Option 1</SegmentedControl.Segment>\n * <SegmentedControl.Segment value=\"option2\">Option 2</SegmentedControl.Segment>\n * <SegmentedControl.Segment value=\"option3\">Option 3</SegmentedControl.Segment>\n * </SegmentedControl>\n *\n * @example\n * <SegmentedControl\n * defaultSelected=\"small\"\n * size=\"small\"\n * fill\n * >\n * <SegmentedControl.Segment value=\"small\" icon={SmallIcon}>Small</SegmentedControl.Segment>\n * <SegmentedControl.Segment value=\"large\" icon={LargeIcon}>Large</SegmentedControl.Segment>\n * </SegmentedControl>\n */\nexport const SegmentedControl = Object.assign(SegmentedControlElement, {\n /**\n * SegmentedControlSegment component for individual segments within a segmented control.\n *\n * Features:\n * - Individual segment with radio input\n * - Optional icon support\n * - Animated selection indicator\n * - Accessibility support with proper ARIA attributes\n * - Context integration with parent SegmentedControl\n * - Motion animations with reduced motion support\n *\n * @example\n * <SegmentedControl.Segment value=\"option1\" icon={Icon1}>\n * Option 1\n * </SegmentedControl.Segment>\n */\n Segment: SegmentedControlSegment,\n});\n\nexport default SegmentedControl;\n"],"names":["core.primitive.Duration"],"mappings":";;;;;;;;;;;AA2BO,MAAM,uBAAA,GACX,aAAA,CAA4C,EAAE,CAAA;;;;;;;;;;;;;;;;;;;;AC4CzC,MAAM,uBAAA,GAA0B,UAAA,CAGrC,CAAC,KAAA,EAAO,GAAA,KAAQ;AAChB,EAAA,MAAM;AAAA,IACJ,IAAA;AAAA,IACA,KAAA;AAAA,IACA,QAAA;AAAA,IACA,SAAA;AAAA,IACA,YAAA,E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} from './SegmentedControl-
|
|
1
|
+
export { S as SegmentedControl, a as SegmentedControlSegment, S as default } from './SegmentedControl-DK1cwC7A.js';
|
|
2
2
|
//# sourceMappingURL=SegmentedControl.js.map
|
|
@@ -82,6 +82,7 @@ const StepperStep = forwardRef(
|
|
|
82
82
|
onKeyDown,
|
|
83
83
|
controls,
|
|
84
84
|
className,
|
|
85
|
+
"aria-label": ariaLabel,
|
|
85
86
|
...rest
|
|
86
87
|
} = props;
|
|
87
88
|
const index = useRef();
|
|
@@ -156,6 +157,7 @@ const StepperStep = forwardRef(
|
|
|
156
157
|
break;
|
|
157
158
|
}
|
|
158
159
|
};
|
|
160
|
+
const childrenText = typeof children === "string" ? children : typeof children === "number" ? String(children) : void 0;
|
|
159
161
|
return /* @__PURE__ */ jsxs(
|
|
160
162
|
"button",
|
|
161
163
|
{
|
|
@@ -165,6 +167,7 @@ const StepperStep = forwardRef(
|
|
|
165
167
|
className: stepClassNames,
|
|
166
168
|
"aria-selected": selected,
|
|
167
169
|
"aria-controls": controls,
|
|
170
|
+
"aria-label": childrenText || ariaLabel,
|
|
168
171
|
tabIndex: allowNavigateToPrevStep && selected ? 0 : -1,
|
|
169
172
|
"data-completed": completed,
|
|
170
173
|
onClick: onClickHandler,
|
|
@@ -615,4 +618,4 @@ const Stepper = Object.assign(StepperElement, {
|
|
|
615
618
|
});
|
|
616
619
|
|
|
617
620
|
export { Stepper as S, StepperFinalPanel as a, StepperList as b, StepperNextButton as c, StepperPanel as d, StepperPrevButton as e, StepperStep as f };
|
|
618
|
-
//# sourceMappingURL=Stepper-
|
|
621
|
+
//# sourceMappingURL=Stepper-BZr9ytpD.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Stepper-BZr9ytpD.js","sources":["../src/components/Stepper/internal/StepperContext.ts","../src/components/Stepper/StepperList.tsx","../src/components/Stepper/StepperStep.tsx","../src/components/Stepper/StepperPanel.tsx","../src/components/Stepper/StepperFinalPanel.tsx","../src/components/Stepper/StepperNextButton.tsx","../src/components/Stepper/StepperPrevButton.tsx","../src/components/Stepper/Stepper.tsx"],"sourcesContent":["import { Dispatch, SetStateAction, createContext } from \"react\";\n\nexport type StepperContextProps = {\n current: number;\n setCurrent: Dispatch<SetStateAction<number>>;\n currentId: string;\n setCurrentId: Dispatch<SetStateAction<string>>;\n focus: number;\n setFocus: Dispatch<SetStateAction<number>>;\n onComplete?: () => void;\n items?: NodeListOf<HTMLElement>;\n allCompleted?: boolean;\n setAllCompleted?: Dispatch<SetStateAction<boolean>>;\n allowNavigateToPrevStep?: boolean;\n};\n\nexport const StepperContext = createContext<StepperContextProps>({\n current: 0,\n currentId: \"\",\n focus: 0,\n setFocus: () => undefined,\n setCurrent: () => undefined,\n setCurrentId: () => undefined,\n});\n","import { ComponentPropsWithoutRef, forwardRef, useContext } from \"react\";\nimport cx from \"classnames\";\n\nimport { StepperContext } from \"./internal/StepperContext\";\n\nimport styles from \"./StepperList.module.scss\";\n\n/**\n * Props for the StepperList component\n * @extends ComponentPropsWithoutRef<\"div\">\n */\nexport type StepperListProps = ComponentPropsWithoutRef<\"div\">;\n\n/**\n * Container component for organizing and displaying stepper steps.\n *\n * Features:\n * - Groups multiple stepper steps together\n * - Displays current step label\n * - Responsive design with mobile-friendly layout\n * - Accessible with proper ARIA roles\n * - Automatic step organization\n * - Visual step indicators\n * - Context-based current step display\n * - Flexible layout with CSS Grid/Flexbox\n * - Container queries for responsive behavior\n *\n * @example\n * <Stepper.List>\n * <Stepper.Step controls=\"step1\">Step 1</Stepper.Step>\n * <Stepper.Step controls=\"step2\">Step 2</Stepper.Step>\n * <Stepper.Step controls=\"step3\">Step 3</Stepper.Step>\n * </Stepper.List>\n */\nexport const StepperList = forwardRef<HTMLDivElement, StepperListProps>(\n (props, ref) => {\n const { className, children, onKeyDown, ...rest } = props;\n const { current, items } = useContext(StepperContext);\n\n const tabListClassNames = cx(styles[\"stepper-list\"], className);\n const currentLabel =\n items?.[current].querySelectorAll(\"span\")[1].textContent;\n\n return (\n <div\n {...rest}\n className={tabListClassNames}\n data-anv=\"stepper-list\"\n ref={ref}\n role=\"tablist\"\n >\n <div className={styles[\"stepper-steps\"]}>{children}</div>\n <span className={styles.label}>{currentLabel}</span>\n </div>\n );\n },\n);\n\nStepperList.displayName = \"StepperList\";\n","import {\n forwardRef,\n useContext,\n MouseEvent,\n useRef,\n ComponentPropsWithoutRef,\n useEffect,\n useState,\n KeyboardEvent,\n} from \"react\";\nimport cx from \"classnames\";\nimport Check from \"@servicetitan/hammer-icon/mdi/round/check.svg\";\n\nimport { Icon } from \"../Icon\";\nimport { StepperContext } from \"./internal/StepperContext\";\nimport { useMergeRefs } from \"../../hooks\";\n\nimport styles from \"./StepperStep.module.scss\";\n\n/**\n * Props for the StepperStep component\n * @extends ComponentPropsWithoutRef<\"button\">\n */\nexport type StepperStepProps = Omit<\n ComponentPropsWithoutRef<\"button\">,\n \"onClick\" | \"disabled\"\n> & {\n /**\n * ID of the panel that this step is controlling.\n * Must match the id prop of the corresponding Stepper.Panel.\n */\n controls: string;\n\n /**\n * Called when the step is clicked.\n * @param e Mouse event object\n * @param index Index of the step in the stepper\n */\n onClick?: (e: MouseEvent<HTMLButtonElement>, index?: number) => void;\n};\n\n/**\n * Individual step component for the Stepper.\n *\n * Features:\n * - Visual progress indicator with animated bar\n * - Check icon for completed steps\n * - Keyboard navigation support\n * - Accessible with proper ARIA attributes\n * - Click handling for step navigation\n * - Visual states for current, completed, and future steps\n * - Responsive design with mobile-friendly layout\n * - Focus management for keyboard users\n * - Custom styling support\n *\n * @example\n * <Stepper.Step controls=\"step1\">\n * Personal Information\n * </Stepper.Step>\n *\n * @example\n * <Stepper.Step\n * controls=\"step2\"\n * onClick={(e, index) => console.log(`Clicked step ${index}`)}\n * >\n * Contact Details\n * </Stepper.Step>\n */\nexport const StepperStep = forwardRef<HTMLButtonElement, StepperStepProps>(\n (props, ref) => {\n const stepRef = useRef<HTMLButtonElement>(null);\n const {\n current,\n items,\n setCurrent,\n focus,\n setFocus,\n allCompleted,\n allowNavigateToPrevStep,\n } = useContext(StepperContext);\n const {\n onClick,\n children,\n onFocus,\n onKeyDown,\n controls,\n className,\n \"aria-label\": ariaLabel,\n ...rest\n } = props;\n\n const index = useRef<number>();\n const [selected, setSelected] = useState(false);\n const [completed, setCompleted] = useState(\n // Below is to be used for custom overriding\n // completed state for a step\n // Check Stepper.stories.tsx#103 for the use case\n stepRef.current?.getAttribute(\"data-completed\") === \"true\"\n ? true\n : undefined,\n );\n\n useEffect(() => {\n if (!items) return;\n index.current = Array.prototype.indexOf.call(items, stepRef.current);\n\n setCompleted(index.current < current);\n setSelected(index.current === current);\n }, [current, items]);\n\n const stepClassNames = cx(styles[\"stepper-step\"], className, {\n [styles[\"can-navigate\"]]: allowNavigateToPrevStep,\n [styles[\"all-completed\"]]: allCompleted,\n });\n\n const onClickHandler = (e: MouseEvent<HTMLButtonElement>) => {\n onClick?.(e, index.current);\n if (\n !allowNavigateToPrevStep ||\n selected ||\n index.current === undefined ||\n !items ||\n index.current > current\n ) {\n return;\n }\n setCurrent(index.current ?? 0);\n setFocus(index.current);\n items[index.current].focus();\n };\n\n const onKeyDownHandler = (e: KeyboardEvent<HTMLButtonElement>) => {\n onKeyDown?.(e);\n const focusableItems = Array.prototype.filter.call(\n items,\n (item) =>\n item.getAttribute(\"data-completed\") === \"true\" ||\n item.getAttribute(\"aria-selected\") === \"true\",\n );\n const prevFocus = focus - 1;\n const nextFocus = focus + 1;\n switch (e.code) {\n case \"Enter\":\n case \"Space\":\n e.preventDefault();\n setCurrent(focus);\n break;\n case \"ArrowRight\":\n e.preventDefault();\n if (nextFocus === focusableItems.length) {\n setFocus(0);\n focusableItems[0].focus();\n focusableItems[0].setAttribute(\"tabindex\", \"0\");\n stepRef.current?.setAttribute(\"tabindex\", \"-1\");\n return;\n }\n stepRef.current?.setAttribute(\"tabindex\", \"-1\");\n setFocus(nextFocus);\n focusableItems[nextFocus].focus();\n focusableItems[nextFocus].setAttribute(\"tabindex\", \"0\");\n break;\n case \"ArrowLeft\":\n e.preventDefault();\n if (focus === 0) {\n const lastItemIndex = focusableItems.length - 1;\n setFocus(lastItemIndex);\n focusableItems[lastItemIndex].focus();\n focusableItems[lastItemIndex].setAttribute(\"tabindex\", \"0\");\n stepRef.current?.setAttribute(\"tabindex\", \"-1\");\n return;\n }\n stepRef.current?.setAttribute(\"tabindex\", \"-1\");\n setFocus(prevFocus);\n focusableItems[prevFocus].focus();\n focusableItems[prevFocus].setAttribute(\"tabindex\", \"0\");\n break;\n }\n };\n\n // Extract text content from children for aria-label fallback\n const childrenText =\n typeof children === \"string\"\n ? children\n : typeof children === \"number\"\n ? String(children)\n : undefined;\n\n return (\n <button\n type=\"button\"\n role=\"tab\"\n data-anv=\"stepper-step\"\n className={stepClassNames}\n aria-selected={selected}\n aria-controls={controls}\n aria-label={childrenText || ariaLabel}\n tabIndex={allowNavigateToPrevStep && selected ? 0 : -1}\n data-completed={completed}\n onClick={onClickHandler}\n onKeyDown={allowNavigateToPrevStep ? onKeyDownHandler : onKeyDown}\n {...rest}\n ref={useMergeRefs([stepRef, ref])}\n >\n <span className={styles.bar} />\n <span className={styles.label}>\n <span className={styles.circle}>\n <Icon svg={Check} inherit aria-hidden />\n </span>\n\n {children}\n </span>\n </button>\n );\n },\n);\n\nStepperStep.displayName = \"StepperStep\";\n","import {\n ComponentPropsWithoutRef,\n forwardRef,\n useContext,\n useEffect,\n} from \"react\";\nimport cx from \"classnames\";\nimport { core } from \"@servicetitan/hammer-token\";\nimport { motion } from \"motion/react\";\n\nimport { LayoutUtilProps } from \"../../types\";\nimport { useLayoutPropsUtil } from \"../../internal/hooks\";\nimport { Overflow } from \"../Overflow\";\nimport { StepperContext } from \"./internal/StepperContext\";\n\nimport styles from \"./StepperPanel.module.scss\";\n\n/**\n * Props for the StepperPanel component\n * @extends ComponentPropsWithoutRef<\"div\">\n * @extends LayoutUtilProps\n */\nexport type StepperPanelProps = Omit<\n ComponentPropsWithoutRef<\"div\">,\n \"onAnimationStart\" | \"onDragStart\" | \"onDragEnd\" | \"onDrag\"\n> &\n LayoutUtilProps & {\n /**\n * Unique identifier for the panel.\n * Must match the controls prop of the corresponding Stepper.Step.\n */\n id: string;\n };\n\n/**\n * Content panel component for displaying step content in the Stepper.\n *\n * Features:\n * - Displays content for the current step only\n * - Smooth fade-in/fade-out animations\n * - Automatic overflow handling with scroll support\n * - Accessible with proper ARIA roles\n * - Layout utilities for positioning and spacing\n * - Motion animations for smooth transitions\n * - Focus management for keyboard navigation\n * - Responsive design with flexible layout\n * - Context-based visibility control\n *\n * @example\n * <Stepper.Panel id=\"step1\">\n * <h2>Personal Information</h2>\n * <form>\n * <label htmlFor=\"name\">Name:</label>\n * <input id=\"name\" type=\"text\" />\n * </form>\n * </Stepper.Panel>\n *\n * @example\n * <Stepper.Panel id=\"step2\" className=\"custom-panel\">\n * <div className=\"step-content\">\n * <h2>Contact Details</h2>\n * <p>Please provide your contact information.</p>\n * </div>\n * </Stepper.Panel>\n */\nexport const StepperPanel = forwardRef<HTMLDivElement, StepperPanelProps>(\n (props, ref) => {\n const { layoutStyles, componentProps } = useLayoutPropsUtil(props);\n const { id, className, style, children, ...rest } = componentProps;\n const { current, items, allCompleted, setCurrentId } =\n useContext(StepperContext);\n\n const currentId = items?.[current].getAttribute(\"aria-controls\");\n const isCurrent = currentId === id;\n\n useEffect(() => {\n if (isCurrent && !allCompleted) {\n setCurrentId(currentId ?? \"\");\n }\n }, [allCompleted, isCurrent, currentId, setCurrentId]);\n\n const tabPanelClassNames = cx(styles[\"stepper-panel\"], className);\n const styleCombined = {\n ...style,\n ...layoutStyles,\n };\n\n if (isCurrent && !allCompleted) {\n return (\n <motion.div\n style={styleCombined}\n className={tabPanelClassNames}\n transition={{\n opacity: {\n duration:\n +core.primitive.DurationSlow.value.replace(\"ms\", \"\") / 1000,\n },\n }}\n initial={{ opacity: 0 }}\n animate={{ opacity: 1 }}\n exit={{ opacity: 0 }}\n layout\n {...rest}\n role=\"tabpanel\"\n data-anv=\"stepper-panel\"\n id={id}\n ref={ref}\n >\n <Overflow flexGrow={1}>{children}</Overflow>\n </motion.div>\n );\n }\n return <></>;\n },\n);\n\nStepperPanel.displayName = \"StepperPanel\";\n","import {\n ComponentPropsWithoutRef,\n forwardRef,\n useContext,\n useEffect,\n} from \"react\";\nimport cx from \"classnames\";\nimport { core } from \"@servicetitan/hammer-token\";\nimport { motion } from \"motion/react\";\n\nimport { LayoutUtilProps } from \"../../types\";\nimport { Overflow } from \"../Overflow\";\nimport { StepperContext } from \"./internal/StepperContext\";\nimport { useLayoutPropsUtil } from \"../../internal/hooks\";\n\nimport styles from \"./StepperPanel.module.scss\";\n\n/**\n * Props for the StepperFinalPanel component\n * @extends ComponentPropsWithoutRef<\"div\">\n * @extends LayoutUtilProps\n */\nexport type StepperFinalPanelProps = Omit<\n ComponentPropsWithoutRef<\"div\">,\n \"onAnimationStart\" | \"onDragStart\" | \"onDragEnd\" | \"onDrag\"\n> &\n LayoutUtilProps;\n\n/**\n * Final panel component displayed when all stepper steps are completed.\n *\n * Features:\n * - Displays only when all steps are completed\n * - Smooth fade-in animation on completion\n * - Automatic overflow handling with scroll support\n * - Accessible with proper ARIA roles\n * - Layout utilities for positioning and spacing\n * - Motion animations for smooth transitions\n * - Focus management for keyboard navigation\n * - Responsive design with flexible layout\n * - Context-based visibility control\n *\n * @example\n * <Stepper.FinalPanel>\n * <h2>Congratulations!</h2>\n * <p>You have successfully completed all steps.</p>\n * <Button onClick={handleSubmit}>Submit</Button>\n * </Stepper.FinalPanel>\n */\nexport const StepperFinalPanel = forwardRef<\n HTMLDivElement,\n StepperFinalPanelProps\n>((props, ref) => {\n const { layoutStyles, componentProps } = useLayoutPropsUtil(props);\n const { id, className, style, children, ...rest } = componentProps;\n const { allCompleted, setCurrentId } = useContext(StepperContext);\n\n useEffect(() => {\n if (allCompleted) {\n setCurrentId(\"final-panel\");\n }\n }, [allCompleted, setCurrentId]);\n\n const tabPanelClassNames = cx(styles[\"stepper-panel\"], className);\n const styleCombined = {\n ...style,\n ...layoutStyles,\n };\n\n if (allCompleted) {\n return (\n <motion.div\n style={styleCombined}\n className={tabPanelClassNames}\n transition={{\n opacity: {\n duration:\n +core.primitive.DurationSlow.value.replace(\"ms\", \"\") / 1000,\n },\n }}\n initial={{ opacity: 0 }}\n animate={{ opacity: 1 }}\n exit={{ opacity: 0 }}\n layout\n {...rest}\n role=\"tabpanel\"\n data-anv=\"stepper-final-panel\"\n tabIndex={0}\n ref={ref}\n >\n <Overflow>{children}</Overflow>\n </motion.div>\n );\n }\n return null;\n});\n\nStepperFinalPanel.displayName = \"StepperFinalPanel\";\n","import { forwardRef, useContext, MouseEvent } from \"react\";\n\nimport { Button, ButtonProps } from \"../Button\";\nimport { DataTrackingId } from \"../../types\";\nimport { useTrackingId } from \"../../hooks\";\n\nimport { StepperContext } from \"./internal/StepperContext\";\n\n/**\n * Props for the StepperNextButton component\n * @extends ButtonProps\n */\nexport type StepperNextButtonProps = Omit<ButtonProps, \"children\"> & {\n /**\n * Label for the next button.\n * @default \"Next\"\n */\n nextLabel?: string;\n\n /**\n * Label for the complete button (shown on the last step).\n * @default \"Complete\"\n */\n completeLabel?: string;\n\n /**\n * Called when the \"Next\" button is clicked.\n * @param e MouseEvent<HTMLButtonElement>\n * @returns If the function returns `false`, or a Promise that resolves to `false`, the next step will not be executed.\n */\n onClick?: (\n e: MouseEvent<HTMLButtonElement>,\n ) => void | boolean | Promise<boolean>;\n} & DataTrackingId;\n\n/**\n * Next button component for navigating to the next step in the Stepper.\n *\n * Features:\n * - Automatically advances to the next step\n * - Changes label to \"Complete\" on the final step\n * - Supports async validation with Promise return\n * - Prevents navigation when validation fails\n * - Hides when all steps are completed\n * - Accessible with proper button semantics\n * - Customizable appearance and styling\n * - Integration with stepper context\n * - Automatic completion handling\n * - Automatic tracking ID generation for analytics\n *\n * @example\n * <Stepper.NextButton\n * nextLabel=\"Continue\"\n * completeLabel=\"Finish\"\n * />\n *\n * @example\n * <Stepper.NextButton\n * onClick={async (e) => {\n * const isValid = await validateForm();\n * return isValid;\n * }}\n * appearance=\"primary\"\n * />\n */\nexport const StepperNextButton = forwardRef<\n HTMLButtonElement,\n StepperNextButtonProps\n>((props, ref) => {\n const {\n setAllCompleted,\n onComplete,\n setCurrent,\n setFocus,\n items,\n current,\n allCompleted,\n } = useContext(StepperContext);\n const {\n onClick,\n onFocus,\n nextLabel = \"Next\",\n completeLabel = \"Complete\",\n appearance = \"primary\",\n ...rest\n } = props;\n\n const proceedToNextStep = () => {\n if (items && current === items.length - 1) {\n items.forEach((item) => item.setAttribute(\"tabindex\", \"-1\"));\n setAllCompleted?.(true);\n onComplete?.();\n return;\n }\n setCurrent(current + 1);\n setFocus(current + 1);\n };\n\n const onClickHandler = (e: MouseEvent<HTMLButtonElement>) => {\n const onClickResult = onClick?.(e);\n\n // check if onClick returns a Promise\n if (\n onClickResult !== undefined &&\n !!onClickResult &&\n (onClickResult as unknown) instanceof Promise\n ) {\n (onClickResult as unknown as Promise<boolean>).then((result) => {\n if (result === false) return;\n proceedToNextStep();\n });\n\n // otherwise, onClick returns a boolean or void\n } else {\n if ((onClickResult as void | boolean) === false) return;\n proceedToNextStep();\n }\n };\n\n const data = {\n nextLabel: props.nextLabel,\n completeLabel: props.completeLabel,\n };\n\n const trackingId = useTrackingId({\n name: \"StepperNextButton\",\n data,\n hasOverride: !!props[\"data-tracking-id\"],\n });\n\n return allCompleted ? null : (\n <Button\n data-anv=\"stepper-next-button\"\n data-tracking-id={trackingId}\n onClick={onClickHandler}\n appearance={appearance}\n ref={ref}\n {...rest}\n >\n {items && current === items.length - 1 ? completeLabel : nextLabel}\n </Button>\n );\n});\n\nStepperNextButton.displayName = \"StepperNextButton\";\n","import { forwardRef, useContext, MouseEvent } from \"react\";\n\nimport { DataTrackingId } from \"../../types\";\nimport { Button, ButtonProps } from \"../Button\";\nimport { useTrackingId } from \"../../hooks\";\n\nimport { StepperContext } from \"./internal/StepperContext\";\n\n/**\n * Props for the StepperPrevButton component\n * @extends ButtonProps\n */\nexport type StepperPrevButtonProps = Omit<ButtonProps, \"children\"> & {\n /**\n * Label for the previous button.\n * @default \"Previous\"\n */\n label?: string;\n} & DataTrackingId;\n\n/**\n * Previous button component for navigating to the previous step in the Stepper.\n *\n * Features:\n * - Navigates to the previous step when available\n * - Hides when on the first step\n * - Restores navigation when returning from completion\n * - Accessible with proper button semantics\n * - Customizable label and styling\n * - Integration with stepper context\n * - Automatic focus management\n * - Support for completion state handling\n * - Automatic tracking ID generation for analytics\n *\n * @example\n * <Stepper.PrevButton label=\"Go Back\" />\n *\n * @example\n * <Stepper.PrevButton\n * label=\"Previous Step\"\n * appearance=\"secondary\"\n * onClick={(e) => console.log('Going back')}\n * />\n */\nexport const StepperPrevButton = forwardRef<\n HTMLButtonElement,\n StepperPrevButtonProps\n>((props, ref) => {\n const {\n setCurrent,\n setFocus,\n allCompleted,\n setAllCompleted,\n items,\n current,\n allowNavigateToPrevStep,\n } = useContext(StepperContext);\n const { onClick, label = \"Previous\", onFocus, ...rest } = props;\n\n const onClickHandler = (e: MouseEvent<HTMLButtonElement>) => {\n if (allCompleted) {\n setAllCompleted?.(false);\n if (allowNavigateToPrevStep) {\n items?.[current].setAttribute(\"tabindex\", \"0\");\n }\n } else {\n setCurrent(current - 1);\n setFocus(current - 1);\n }\n\n onClick?.(e);\n };\n\n const data = {\n label: props.label,\n };\n\n const trackingId = useTrackingId({\n name: \"StepperPrevButton\",\n data,\n hasOverride: !!props[\"data-tracking-id\"],\n });\n\n return current === 0 ? null : (\n <Button\n data-anv=\"stepper-prev-button\"\n data-tracking-id={trackingId}\n onClick={onClickHandler}\n ref={ref}\n {...rest}\n >\n {label}\n </Button>\n );\n});\n\nStepperPrevButton.displayName = \"StepperPrevButton\";\n","import {\n ComponentPropsWithoutRef,\n forwardRef,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from \"react\";\nimport cx from \"classnames\";\nimport { motion } from \"motion/react\";\n\nimport { useMergeRefs } from \"../../hooks\";\nimport { LayoutUtilProps } from \"../../types\";\nimport { useLayoutPropsUtil } from \"../../internal/hooks\";\n\nimport { StepperList } from \"./StepperList\";\nimport { StepperStep } from \"./StepperStep\";\nimport { StepperPanel } from \"./StepperPanel\";\nimport { StepperFinalPanel } from \"./StepperFinalPanel\";\nimport { StepperNextButton } from \"./StepperNextButton\";\nimport { StepperPrevButton } from \"./StepperPrevButton\";\nimport { StepperContext } from \"./internal/StepperContext\";\n\nimport styles from \"./Stepper.module.scss\";\n\n/**\n * Props for the Stepper component\n * @extends ComponentPropsWithoutRef<\"div\">\n * @extends LayoutUtilProps\n */\nexport type StepperProps = Omit<\n ComponentPropsWithoutRef<\"div\">,\n \"onAnimationStart\" | \"onDragStart\" | \"onDragEnd\" | \"onDrag\" | \"onChange\"\n> &\n LayoutUtilProps & {\n /**\n * Default step to start on.\n * @default undefined\n */\n defaultIndex?: number;\n\n /**\n * Allows users to navigate to previous steps.\n * @default undefined\n */\n allowNavigateToPrevStep?: boolean;\n\n /**\n * Returns current step data when step changes.\n * @param data Object containing currentStepId and currentStepIndex\n * @param data.currentStepId ID given to Stepper.Panel, or \"final-panel\"\n * @param data.currentStepIndex Index of current step, or undefined on final panel\n */\n onChange?: (data: {\n currentStepId: string | \"final-panel\";\n currentStepIndex?: number;\n }) => void;\n\n /**\n * Called when all steps are completed.\n */\n onComplete?: () => void;\n };\n\nconst StepperElement = forwardRef<HTMLDivElement, StepperProps>(\n (props, ref) => {\n const { layoutStyles, componentProps } = useLayoutPropsUtil(props);\n const {\n defaultIndex,\n className,\n allowNavigateToPrevStep,\n children,\n onChange,\n onComplete,\n style,\n ...rest\n } = componentProps;\n const tabRef = useRef<HTMLDivElement>(null);\n const [items, setItems] = useState<NodeListOf<HTMLElement>>();\n const [allCompleted, setAllCompleted] = useState(false);\n const [current, setCurrent] = useState<number>(defaultIndex ?? 0);\n const [currentId, setCurrentId] = useState<string>(\"\");\n const [focus, setFocus] = useState<number>(defaultIndex ?? 0);\n const stepperClassNames = cx(styles[\"stepper\"], className);\n\n useEffect(() => {\n setItems(tabRef.current?.querySelectorAll(\"[role=tab]:not([disabled])\"));\n }, []);\n\n useEffect(() => {\n onChange?.({\n currentStepId: currentId,\n currentStepIndex: allCompleted ? undefined : current,\n });\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [allCompleted, currentId, onChange]);\n\n const styleCombined = { ...style, ...layoutStyles };\n\n const value = useMemo(\n () => ({\n current,\n setCurrent,\n currentId,\n setCurrentId,\n focus,\n setFocus,\n onComplete,\n items,\n allCompleted,\n setAllCompleted,\n allowNavigateToPrevStep,\n }),\n [\n current,\n currentId,\n focus,\n onComplete,\n items,\n allCompleted,\n setAllCompleted,\n allowNavigateToPrevStep,\n ],\n );\n\n return (\n <StepperContext.Provider value={value}>\n <motion.div\n transition={{ duration: 0 }}\n layout\n className={stepperClassNames}\n data-anv=\"stepper\"\n style={styleCombined}\n {...rest}\n ref={useMergeRefs([tabRef, ref])}\n >\n {children}\n </motion.div>\n </StepperContext.Provider>\n );\n },\n);\n\nStepperElement.displayName = \"Stepper\";\n\n/**\n * Stepper component for creating multi-step workflows and forms.\n *\n * Features:\n * - Multi-step navigation with visual progress indicators\n * - Keyboard navigation support with arrow keys\n * - Optional navigation to previous steps\n * - Smooth animations and transitions\n * - Accessible with proper ARIA roles and attributes\n * - Customizable step labels and content\n * - Completion state handling\n * - Layout utilities for positioning and spacing\n * - Motion animations for step transitions\n * - Context-based state management\n *\n * @example\n * <Stepper defaultIndex={0} allowNavigateToPrevStep>\n * <Stepper.List>\n * <Stepper.Step controls=\"step1\">Step 1</Stepper.Step>\n * <Stepper.Step controls=\"step2\">Step 2</Stepper.Step>\n * <Stepper.Step controls=\"step3\">Step 3</Stepper.Step>\n * </Stepper.List>\n *\n * <Stepper.Panel id=\"step1\">\n * <h2>Step 1 Content</h2>\n * <p>This is the first step content.</p>\n * </Stepper.Panel>\n *\n * <Stepper.Panel id=\"step2\">\n * <h2>Step 2 Content</h2>\n * <p>This is the second step content.</p>\n * </Stepper.Panel>\n *\n * <Stepper.Panel id=\"step3\">\n * <h2>Step 3 Content</h2>\n * <p>This is the final step content.</p>\n * </Stepper.Panel>\n *\n * <Stepper.FinalPanel>\n * <h2>Completed!</h2>\n * <p>All steps have been completed successfully.</p>\n * </Stepper.FinalPanel>\n *\n * <Stepper.PrevButton />\n * <Stepper.NextButton />\n * </Stepper>\n */\nexport const Stepper = Object.assign(StepperElement, {\n /**\n * Individual step component for the Stepper.\n *\n * Features:\n * - Visual progress indicator with animated bar\n * - Check icon for completed steps\n * - Keyboard navigation support\n * - Accessible with proper ARIA attributes\n * - Click handling for step navigation\n * - Visual states for current, completed, and future steps\n * - Responsive design with mobile-friendly layout\n * - Focus management for keyboard users\n * - Custom styling support\n *\n * @example\n * <Stepper.Step controls=\"step1\">\n * Personal Information\n * </Stepper.Step>\n *\n * @example\n * <Stepper.Step\n * controls=\"step2\"\n * onClick={(e, index) => console.log(`Clicked step ${index}`)}\n * >\n * Contact Details\n * </Stepper.Step>\n */\n Step: StepperStep,\n\n /**\n * Container component for organizing and displaying stepper steps.\n *\n * Features:\n * - Groups multiple stepper steps together\n * - Displays current step label\n * - Responsive design with mobile-friendly layout\n * - Accessible with proper ARIA roles\n * - Automatic step organization\n * - Visual step indicators\n * - Context-based current step display\n * - Flexible layout with CSS Grid/Flexbox\n * - Container queries for responsive behavior\n *\n * @example\n * <Stepper.List>\n * <Stepper.Step controls=\"step1\">Step 1</Stepper.Step>\n * <Stepper.Step controls=\"step2\">Step 2</Stepper.Step>\n * <Stepper.Step controls=\"step3\">Step 3</Stepper.Step>\n * </Stepper.List>\n */\n List: StepperList,\n\n /**\n * Content panel component for displaying step content in the Stepper.\n *\n * Features:\n * - Displays content for the current step only\n * - Smooth fade-in/fade-out animations\n * - Automatic overflow handling with scroll support\n * - Accessible with proper ARIA roles\n * - Layout utilities for positioning and spacing\n * - Motion animations for smooth transitions\n * - Focus management for keyboard navigation\n * - Responsive design with flexible layout\n * - Context-based visibility control\n *\n * @example\n * <Stepper.Panel id=\"step1\">\n * <h2>Personal Information</h2>\n * <form>\n * <label htmlFor=\"name\">Name:</label>\n * <input id=\"name\" type=\"text\" />\n * </form>\n * </Stepper.Panel>\n */\n Panel: StepperPanel,\n\n /**\n * Next button component for navigating to the next step in the Stepper.\n *\n * Features:\n * - Automatically advances to the next step\n * - Changes label to \"Complete\" on the final step\n * - Supports async validation with Promise return\n * - Prevents navigation when validation fails\n * - Hides when all steps are completed\n * - Accessible with proper button semantics\n * - Customizable appearance and styling\n * - Integration with stepper context\n * - Automatic completion handling\n *\n * @example\n * <Stepper.NextButton\n * nextLabel=\"Continue\"\n * completeLabel=\"Finish\"\n * />\n *\n * @example\n * <Stepper.NextButton\n * onClick={async (e) => {\n * const isValid = await validateForm();\n * return isValid;\n * }}\n * appearance=\"primary\"\n * />\n */\n NextButton: StepperNextButton,\n\n /**\n * Previous button component for navigating to the previous step in the Stepper.\n *\n * Features:\n * - Navigates to the previous step when available\n * - Hides when on the first step\n * - Restores navigation when returning from completion\n * - Accessible with proper button semantics\n * - Customizable label and styling\n * - Integration with stepper context\n * - Automatic focus management\n * - Support for completion state handling\n *\n * @example\n * <Stepper.PrevButton label=\"Go Back\" />\n *\n * @example\n * <Stepper.PrevButton\n * label=\"Previous Step\"\n * appearance=\"secondary\"\n * onClick={(e) => console.log('Going back')}\n * />\n */\n PrevButton: StepperPrevButton,\n\n /**\n * Final panel component displayed when all stepper steps are completed.\n *\n * Features:\n * - Displays only when all steps are completed\n * - Smooth fade-in animation on completion\n * - Automatic overflow handling with scroll support\n * - Accessible with proper ARIA roles\n * - Layout utilities for positioning and spacing\n * - Motion animations for smooth transitions\n * - Focus management for keyboard navigation\n * - Responsive design with flexible layout\n * - Context-based visibility control\n *\n * @example\n * <Stepper.FinalPanel>\n * <h2>Congratulations!</h2>\n * <p>You have successfully completed all steps.</p>\n * <Button onClick={handleSubmit}>Submit</Button>\n * </Stepper.FinalPanel>\n */\n FinalPanel: St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A,EA4BnD,IAAA,EAAM,WAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAuBN,IAAA,EAAM,WAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAyBN,KAAA,EAAO,YAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EA+BP,UAAA,EAAY,iBAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAyBZ,UAAA,EAAY,iBAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAuBZ,UAAA,EAAY;AACd,CAAC;;;;"}
|
package/dist/Stepper.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { S as Stepper, a as StepperFinalPanel, b as StepperList, c as StepperNextButton, d as StepperPanel, e as StepperPrevButton, f as StepperStep, S as default } from './Stepper-
|
|
1
|
+
export { S as Stepper, a as StepperFinalPanel, b as StepperList, c as StepperNextButton, d as StepperPanel, e as StepperPrevButton, f as StepperStep, S as default } from './Stepper-BZr9ytpD.js';
|
|
2
2
|
//# sourceMappingURL=Stepper.js.map
|
|
@@ -31,6 +31,7 @@ const Switch = forwardRef(
|
|
|
31
31
|
defaultChecked,
|
|
32
32
|
value,
|
|
33
33
|
style,
|
|
34
|
+
"aria-label": ariaLabel,
|
|
34
35
|
...rest
|
|
35
36
|
} = componentProps;
|
|
36
37
|
const helperUid = useId();
|
|
@@ -39,7 +40,7 @@ const Switch = forwardRef(
|
|
|
39
40
|
};
|
|
40
41
|
const data = {
|
|
41
42
|
label: childrenToString(label),
|
|
42
|
-
ariaLabel:
|
|
43
|
+
ariaLabel: ariaLabel || "Toggle option",
|
|
43
44
|
ariaLabelledBy: rest["aria-labelledby"],
|
|
44
45
|
value
|
|
45
46
|
};
|
|
@@ -65,6 +66,7 @@ const Switch = forwardRef(
|
|
|
65
66
|
role: "switch",
|
|
66
67
|
value,
|
|
67
68
|
"aria-checked": checked ?? defaultChecked,
|
|
69
|
+
"aria-label": label ? void 0 : ariaLabel || "Toggle option",
|
|
68
70
|
checked,
|
|
69
71
|
defaultChecked,
|
|
70
72
|
onChange: onChangeHandler,
|
|
@@ -82,4 +84,4 @@ const Switch = forwardRef(
|
|
|
82
84
|
Switch.displayName = "Switch";
|
|
83
85
|
|
|
84
86
|
export { Switch as S };
|
|
85
|
-
//# sourceMappingURL=Switch-
|
|
87
|
+
//# sourceMappingURL=Switch-BXDPs2mD.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Switch-BXDPs2mD.js","sources":["../src/components/Switch/Switch.tsx"],"sourcesContent":["import {\n ChangeEvent,\n ComponentPropsWithoutRef,\n ReactElement,\n Ref,\n forwardRef,\n useId,\n} from \"react\";\nimport { useTrackingId } from \"../../hooks\";\nimport { DataTrackingId, LayoutUtilProps } from \"../../types\";\nimport { childrenToString } from \"../../internal/functions\";\nimport { useLayoutPropsUtil } from \"../../internal/hooks\";\nimport Check from \"@servicetitan/hammer-icon/mdi/round/check.svg\";\nimport Icon from \"../Icon\";\nimport Flex from \"../Flex\";\nimport { Helper } from \"../../internal/components\";\n\nimport cx from \"classnames\";\nimport styles from \"./Switch.module.scss\";\n\n/**\n * State object returned by the Switch onChange callback\n */\nexport type SwitchState = {\n /**\n * Whether the switch is currently checked\n */\n checked: boolean;\n /**\n * The value of the switch input\n */\n value?: string | number | readonly string[];\n};\n\n/**\n * Props for the Switch component\n * @extends ComponentPropsWithoutRef<\"input\">\n * @extends LayoutUtilProps\n */\nexport type SwitchProps = Omit<ComponentPropsWithoutRef<\"input\">, \"onChange\"> &\n LayoutUtilProps & {\n /**\n * Callback when switch is changed.\n * @param e Change event object\n * @param state Current switch state with checked status and value\n */\n onChange?: (e: ChangeEvent<HTMLInputElement>, state: SwitchState) => void;\n\n /**\n * Label for the switch.\n * @remarks This should either be a string or have text content inside for accessibility\n */\n label?: ReactElement | string;\n\n /**\n * Description text to display below the label\n */\n description?: string;\n } & DataTrackingId;\n\n/**\n * Switch component for toggling between on/off states.\n *\n * Features:\n * - Toggle switch with smooth animations\n * - Check icon indicator when active\n * - Accessible with proper ARIA roles and attributes\n * - Keyboard navigation support (Space/Enter)\n * - Controlled and uncontrolled state management\n * - Customizable label and styling\n * - Layout utilities for positioning and spacing\n * - Focus management with visible focus indicators\n * - Hover states and visual feedback\n * - Disabled state support\n * - Automatic tracking ID generation for analytics\n *\n * @example\n * <Switch\n * label=\"Enable notifications\"\n * onChange={(e, state) => console.log('Switch toggled:', state.checked)}\n * />\n */\nexport const Switch = forwardRef(\n (props: SwitchProps, ref: Ref<HTMLInputElement>) => {\n const { layoutStyles, componentProps } = useLayoutPropsUtil(props);\n const {\n label,\n description,\n className,\n onChange,\n checked,\n defaultChecked,\n value,\n style,\n \"aria-label\": ariaLabel,\n ...rest\n } = componentProps;\n\n const helperUid = useId();\n\n const onChangeHandler = (e: ChangeEvent<HTMLInputElement>) => {\n onChange?.(e, { value, checked: e.target.checked });\n };\n\n const data = {\n label: childrenToString(label),\n ariaLabel: ariaLabel || \"Toggle option\",\n ariaLabelledBy: rest[\"aria-labelledby\"],\n value,\n };\n\n const trackingId = useTrackingId({\n name: \"Switch\",\n data,\n hasOverride: !!rest[\"data-tracking-id\"],\n });\n\n const switchClassNames = cx(styles[\"switch\"], className);\n\n const styleCombined = {\n ...style,\n ...layoutStyles,\n alignItems: description ? \"flex-start\" : \"center\",\n };\n\n return (\n <label className={switchClassNames} style={styleCombined}>\n <input\n data-tracking-id={trackingId}\n data-anv=\"switch\"\n ref={ref}\n type=\"checkbox\"\n role=\"switch\"\n value={value}\n aria-checked={checked ?? defaultChecked}\n aria-label={label ? undefined : ariaLabel || \"Toggle option\"}\n checked={checked}\n defaultChecked={defaultChecked}\n onChange={onChangeHandler}\n {...rest}\n />\n <span aria-hidden className={styles[\"toggle\"]}>\n <span className={styles[\"indicator\"]}>\n <Icon svg={Check} className={styles[\"check\"]} />\n </span>\n </span>\n {label || description ? (\n <Flex direction=\"column\" gap={1}>\n {label && label}\n {description && <Helper id={helperUid} description={description} />}\n </Flex>\n ) : null}\n </label>\n );\n },\n);\n\nSwitch.displayName = \"Switch\";\n"],"names":["Check"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAkFO,MAAM,MAAA,GAAS,UAAA;AAAA,EACpB,CAAC,OAAoB,GAAA,KAA+B;AAClD,IAAA,MAAM,EAAE,YAAA,EAAc,cAAA,EAAe,GAAI,mBAAmB,KAAK,CAAA;AACjE,IAAA,MAAM;AAAA,MACJ,KAAA;AAAA,MACA,WAAA;AAAA,MACA,SAAA;AAAA,MACA,QAAA;AAAA,MACA,OAAA;AAAA,MACA,cAAA;AAAA,MACA,KAAA;AAAA,MACA,KAAA;AAAA,MACA,YAAA,EAAc,SAAA;AAAA,MACd,GAAG;AAAA,KACL,GAAI,cAAA;AAEJ,IAAA,MAAM,YAAY,KAAA,EAAM;AAExB,IAAA,MAAM,eAAA,GAAkB,CAAC,CAAA,KAAqC;AAC5D,MAAA,QAAA,GAAW,GAAG,EAAE,KAAA,EAAO,SAAS,CAAA,CAAE,MAAA,CAAO,SAAS,CAAA;AAAA,IACpD,CAAA;AAEA,IAAA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A,GAAA,CAAC,IAAA,EAAA,EAAK,GAAA,EAAKA,QAAA,EAAO,WAAW,MAAA,CAAO,OAAO,CAAA,EAAG,CAAA,EAChD,CAAA,EACF,CAAA;AAAA,MACC,SAAS,WAAA,mBACR,IAAA,CAAC,QAAK,SAAA,EAAU,QAAA,EAAS,KAAK,CAAA,EAC3B,QAAA,EAAA;AAAA,QAAA,KAAA,IAAS,KAAA;AAAA,QACT,WAAA,oBAAe,GAAA,CAAC,MAAA,EAAA,EAAO,EAAA,EAAI,WAAW,WAAA,EAA0B;AAAA,OAAA,EACnE,CAAA,GACE;AAAA,KAAA,EACN,CAAA;AAAA,EAEJ;AACF;AAEA,MAAA,CAAO,WAAA,GAAc,QAAA;;;;"}
|
package/dist/Switch.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { S as Switch, S as default } from './Switch-
|
|
1
|
+
export { S as Switch, S as default } from './Switch-BXDPs2mD.js';
|
|
2
2
|
//# sourceMappingURL=Switch.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx } from 'react/jsx-runtime';
|
|
2
2
|
import { forwardRef } from 'react';
|
|
3
|
-
import { T as TextField$1 } from './TextField-
|
|
3
|
+
import { T as TextField$1 } from './TextField-CygbgVVt.js';
|
|
4
4
|
|
|
5
5
|
const TextField = forwardRef(
|
|
6
6
|
(props, ref) => {
|
|
@@ -10,4 +10,4 @@ const TextField = forwardRef(
|
|
|
10
10
|
TextField.displayName = "TextField";
|
|
11
11
|
|
|
12
12
|
export { TextField as T };
|
|
13
|
-
//# sourceMappingURL=TextField-
|
|
13
|
+
//# sourceMappingURL=TextField-CpVkZxMT.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextField-
|
|
1
|
+
{"version":3,"file":"TextField-CpVkZxMT.js","sources":["../src/components/TextField/TextField.tsx"],"sourcesContent":["import { forwardRef } from \"react\";\nimport {\n TextField as CoreTextField,\n TextFieldProps as CoreTextFieldProps,\n} from \"./internal/TextField\";\nimport { MaxLengthCounterProps } from \"../../types\";\n\nexport type TextFieldProps = Omit<CoreTextFieldProps, \"prefix\"> & {\n prefix?: string;\n} & MaxLengthCounterProps;\n\nexport const TextField = forwardRef<HTMLInputElement, TextFieldProps>(\n (props, ref) => {\n return <CoreTextField ref={ref} {...props} />;\n },\n);\n\nTextField.displayName = \"TextField\";\n"],"names":["CoreTextField"],"mappings":";;;;AAWO,MAAM,SAAA,GAAY,UAAA;AAAA,EACvB,CAAC,OAAO,GAAA,KAAQ;AACd,IAAA,uBAAO,GAAA,CAACA,WAAA,EAAA,EAAc,GAAA,EAAW,GAAG,KAAA,EAAO,CAAA;AAAA,EAC7C;AACF;AAEA,SAAA,CAAU,WAAA,GAAc,WAAA;;;;"}
|
|
@@ -54,6 +54,7 @@ const TextField = forwardRef(
|
|
|
54
54
|
labelProps,
|
|
55
55
|
style,
|
|
56
56
|
placeholder,
|
|
57
|
+
"aria-label": ariaLabelProp,
|
|
57
58
|
...rest
|
|
58
59
|
} = componentProps;
|
|
59
60
|
const inputRef = useRef(null);
|
|
@@ -154,7 +155,7 @@ const TextField = forwardRef(
|
|
|
154
155
|
value: value ?? "",
|
|
155
156
|
"data-tracking-id": trackingId,
|
|
156
157
|
...rest,
|
|
157
|
-
"aria-label": label ? void 0 : placeholder,
|
|
158
|
+
"aria-label": ariaLabelProp || (label ? void 0 : placeholder),
|
|
158
159
|
"aria-describedby": hasHelperText ? helperUid : void 0,
|
|
159
160
|
"aria-invalid": error ? !!error : void 0
|
|
160
161
|
}
|
|
@@ -194,4 +195,4 @@ const TextField = forwardRef(
|
|
|
194
195
|
TextField.displayName = "InternalTextField";
|
|
195
196
|
|
|
196
197
|
export { TextField as T };
|
|
197
|
-
//# sourceMappingURL=TextField-
|
|
198
|
+
//# sourceMappingURL=TextField-CygbgVVt.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TextField-CygbgVVt.js","sources":["../src/components/TextField/internal/TextField.tsx"],"sourcesContent":["import {\n ChangeEventHandler,\n ComponentPropsWithoutRef,\n FocusEventHandler,\n ReactElement,\n ReactNode,\n Ref,\n forwardRef,\n useId,\n useMemo,\n useRef,\n useState,\n} from \"react\";\nimport { useTrackingId, useMergeRefs } from \"../../../hooks\";\nimport {\n DataTrackingId,\n LayoutUtilProps,\n Size,\n MaxLengthCounterProps,\n} from \"../../../types\";\nimport {\n useLayoutPropsUtil,\n useOptionallyControlledState,\n} from \"../../../internal/hooks\";\nimport { Helper, HelperProps } from \"../../../internal/components\";\nimport { Spinner } from \"../../Spinner\";\nimport styles from \"../TextField.module.scss\";\nimport cx from \"classnames\";\nimport { FieldLabel, FieldLabelProps } from \"../../FieldLabel\";\nimport { childrenToString } from \"../../../internal/functions\";\n\nexport type TextFieldProps = Omit<\n ComponentPropsWithoutRef<\"input\">,\n \"size\" | \"prefix\"\n> &\n LayoutUtilProps & {\n error?: ReactElement | string | boolean;\n label?: FieldLabelProps[\"children\"];\n prefix?: string | ReactElement;\n suffix?: string | ReactElement;\n size?: Extract<Size, \"small\" | \"medium\" | \"large\">;\n type?: \"text\" | \"email\" | \"tel\" | \"url\" | \"password\" | \"number\";\n description?: HelperProps[\"description\"];\n errorAriaLive?: HelperProps[\"errorAriaLive\"];\n hint?: HelperProps[\"hint\"];\n loading?: boolean;\n disabled?: boolean;\n labelProps?: FieldLabelProps;\n moreInfo?: ReactNode;\n } & MaxLengthCounterProps &\n DataTrackingId;\n\nexport const TextField = forwardRef(\n (props: TextFieldProps, ref: Ref<HTMLInputElement>) => {\n const data = {\n label: childrenToString(props.label),\n labelProps: props.labelProps,\n prefix: childrenToString(props.prefix),\n hint: childrenToString(props.hint),\n description: childrenToString(props.description),\n size: props.size,\n type: props.type,\n };\n\n const trackingId = useTrackingId({\n name: \"TextField\",\n data,\n hasOverride: !!props[\"data-tracking-id\"],\n });\n\n const { layoutStyles, componentProps } = useLayoutPropsUtil(props);\n const {\n className,\n error,\n errorAriaLive: errorAriaLiveProp = \"assertive\",\n defaultValue: defaultValueProp,\n value: valueProp,\n label,\n moreInfo,\n prefix,\n suffix,\n size,\n type = \"text\",\n required,\n onChange,\n onFocus,\n onBlur,\n id: idProp,\n description,\n hint,\n showCounter,\n maxLength,\n loading,\n disabled,\n labelProps,\n style,\n placeholder,\n \"aria-label\": ariaLabelProp,\n ...rest\n } = componentProps;\n\n const inputRef = useRef<HTMLInputElement>(null);\n const [isTyping, setIsTyping] = useState(false);\n const [openInfo, setOpenInfo] = useState(false);\n const [errorAriaLive, setErrorAriaLive] =\n useState<HelperProps[\"errorAriaLive\"]>(\"off\");\n\n // Use the optionally controlled state for value\n const [value, setValue] = useOptionallyControlledState<typeof valueProp>({\n controlledValue: valueProp,\n defaultValue: defaultValueProp,\n });\n\n const length = useMemo(() => {\n if (\n typeof value === \"string\" ||\n typeof value === \"number\" ||\n Array.isArray(value)\n ) {\n return String(value).length;\n }\n return 0;\n }, [value]);\n\n const onChangeHandler: ChangeEventHandler<HTMLInputElement> = (e) => {\n setValue(e.target.value);\n onChange?.(e);\n if (!isTyping) {\n setIsTyping(true);\n }\n };\n\n const focusHandler: FocusEventHandler<HTMLInputElement> = (e) => {\n onFocus?.(e);\n setOpenInfo(true);\n setErrorAriaLive(errorAriaLiveProp);\n };\n\n const blurHandler: FocusEventHandler<HTMLInputElement> = (e) => {\n onBlur?.(e);\n setOpenInfo(false);\n setErrorAriaLive(\"off\");\n if (isTyping) {\n setIsTyping(false);\n }\n };\n\n const labelUid = useId();\n const id = idProp ?? labelUid;\n\n const prefixUid = useId();\n const suffixUid = useId();\n\n const helperUid = useId();\n\n const errorMessage = typeof error !== \"boolean\" ? error : undefined;\n\n const styleCombined = { ...style, ...layoutStyles };\n\n const hasHelperText = hint || showCounter || errorMessage || description;\n\n return (\n <div\n className={cx(styles[\"textfield\"], className)}\n data-anv=\"textfield\"\n style={styleCombined}\n >\n {label && (\n <FieldLabel\n moreInfo={moreInfo}\n openMoreInfo={openInfo}\n required={required}\n htmlFor={id}\n {...labelProps}\n >\n {label}\n </FieldLabel>\n )}\n <div\n className={cx(styles[\"input-wrapper\"], {\n [styles[\"small\"]]: size === \"small\",\n [styles[\"large\"]]: size === \"large\",\n })}\n role=\"presentation\"\n onClick={() => inputRef.current?.focus()}\n >\n {prefix ? (\n <div\n aria-hidden\n className={styles[\"prefix\"]}\n id={`prefix${prefixUid}`}\n >\n {prefix}\n </div>\n ) : null}\n <input\n id={id}\n className={cx(styles[\"input\"], {\n [styles[\"error\"]]: error,\n })}\n onChange={onChangeHandler}\n onFocus={focusHandler}\n onBlur={blurHandler}\n ref={useMergeRefs([ref, inputRef])}\n required={required}\n maxLength={maxLength}\n placeholder={placeholder}\n type={type}\n disabled={disabled}\n value={value ?? \"\"}\n data-tracking-id={trackingId}\n {...rest}\n aria-label={ariaLabelProp || (label ? undefined : placeholder)}\n aria-describedby={hasHelperText ? helperUid : undefined}\n aria-invalid={error ? !!error : undefined}\n />\n {loading ? (\n <div className={styles[\"loading-spinner-wrapper\"]}>\n <Spinner size=\"small\" />\n </div>\n ) : null}\n {suffix ? (\n <div\n className={styles[\"suffix\"]}\n aria-hidden\n id={`suffix${suffixUid}`}\n >\n {suffix}\n </div>\n ) : null}\n </div>\n {hasHelperText ? (\n <Helper\n id={helperUid}\n hint={hint}\n maxLength={maxLength}\n inputLength={length}\n isTyping={isTyping}\n showCounter={showCounter}\n errorMessage={errorMessage}\n errorAriaLive={errorAriaLive}\n description={description}\n />\n ) : null}\n </div>\n );\n },\n);\nTextField.displayName = \"InternalTextField\";\n"],"names":["styles"],"mappings":";;;;;;;;;;;;;AAoDO,MAAM,SAAA,GAAY,UAAA;AAAA,EACvB,CAAC,OAAuB,GAAA,KAA+B;AACrD,IAAA,MAAM,IAAA,GAAO;AAAA,MACX,KAAA,EAAO,gBAAA,CAAiB,KAAA,CAAM,KAAK,CAAA;AAAA,MACnC,YAAY,KAAA,CAAM,UAAA;AAAA,MAClB,MAAA,EAAQ,gBAAA,CAAiB,KAAA,CAAM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AA,EAAWA,gBAAO,QAAQ,CAAA;AAAA,oBAC1B,aAAA,EAAW,IAAA;AAAA,oBACX,EAAA,EAAI,SAAS,SAAS,CAAA,CAAA;AAAA,oBAErB,QAAA,EAAA;AAAA;AAAA,iBACH,GACE;AAAA;AAAA;AAAA,WACN;AAAA,UACC,aAAA,mBACC,GAAA;AAAA,YAAC,MAAA;AAAA,YAAA;AAAA,cACC,EAAA,EAAI,SAAA;AAAA,cACJ,IAAA;AAAA,cACA,SAAA;AAAA,cACA,WAAA,EAAa,MAAA;AAAA,cACb,QAAA;AAAA,cACA,WAAA;AAAA,cACA,YAAA;AAAA,cACA,aAAA;AAAA,cACA;AAAA;AAAA,WACF,GACE;AAAA;AAAA;AAAA,KACN;AAAA,EAEJ;AACF;AACA,SAAA,CAAU,WAAA,GAAc,mBAAA;;;;"}
|
package/dist/TextField.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { T as TextField, T as default } from './TextField-
|
|
1
|
+
export { T as TextField, T as default } from './TextField-CpVkZxMT.js';
|
|
2
2
|
//# sourceMappingURL=TextField.js.map
|
|
@@ -3,7 +3,7 @@ import * as React from 'react';
|
|
|
3
3
|
import { useState, useEffect, forwardRef, useRef, useMemo, useCallback, useImperativeHandle } from 'react';
|
|
4
4
|
import { i as maskitoTimeOptionsGenerator, a as maskitoWithPlaceholder, u as useMaskito } from './index.esm-C2ZhC_8d.js';
|
|
5
5
|
import { I as Icon } from './Icon-BSuTVNaa.js';
|
|
6
|
-
import { T as TextField } from './TextField-
|
|
6
|
+
import { T as TextField } from './TextField-CygbgVVt.js';
|
|
7
7
|
import { c as cx } from './index-tZvMCc77.js';
|
|
8
8
|
import { u as useMergeRefs } from './useMergeRefs-Dfmtq9cI.js';
|
|
9
9
|
import { P as Popover } from './Popover-CIPg_ZgX.js';
|
|
@@ -861,6 +861,7 @@ const TimeField = (props) => {
|
|
|
861
861
|
error: errorProp,
|
|
862
862
|
className: popoverDisabled ? className : void 0,
|
|
863
863
|
...rest,
|
|
864
|
+
"aria-label": label ? void 0 : "Select a time",
|
|
864
865
|
"data-anv": "time-field"
|
|
865
866
|
}
|
|
866
867
|
);
|
|
@@ -928,4 +929,4 @@ const TimeField = (props) => {
|
|
|
928
929
|
TimeField.displayName = "TimeField";
|
|
929
930
|
|
|
930
931
|
export { TimeField as T };
|
|
931
|
-
//# sourceMappingURL=TimeField-
|
|
932
|
+
//# sourceMappingURL=TimeField-BkOB5ESa.js.map
|