@simplybusiness/mobius 4.8.7 → 4.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (115) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dist/cjs/components/Button/Button.js +8 -18
  3. package/dist/cjs/components/Button/Button.js.map +1 -1
  4. package/dist/cjs/components/Checkbox/Checkbox.js +8 -5
  5. package/dist/cjs/components/Checkbox/Checkbox.js.map +1 -1
  6. package/dist/cjs/components/Checkbox/CheckboxGroup.js +8 -5
  7. package/dist/cjs/components/Checkbox/CheckboxGroup.js.map +1 -1
  8. package/dist/cjs/components/Modal/Modal.js +8 -8
  9. package/dist/cjs/components/Modal/Modal.js.map +1 -1
  10. package/dist/cjs/components/NumberField/NumberField.js +8 -8
  11. package/dist/cjs/components/NumberField/NumberField.js.map +1 -1
  12. package/dist/cjs/components/Radio/RadioGroup.js +9 -6
  13. package/dist/cjs/components/Radio/RadioGroup.js.map +1 -1
  14. package/dist/cjs/components/Select/Select.js +11 -7
  15. package/dist/cjs/components/Select/Select.js.map +1 -1
  16. package/dist/cjs/components/TextArea/TextArea.js +6 -7
  17. package/dist/cjs/components/TextArea/TextArea.js.map +1 -1
  18. package/dist/cjs/components/TextField/TextField.js +11 -10
  19. package/dist/cjs/components/TextField/TextField.js.map +1 -1
  20. package/dist/cjs/hooks/index.js +2 -0
  21. package/dist/cjs/hooks/index.js.map +1 -1
  22. package/dist/cjs/hooks/useDeprecationWarning/index.js +20 -0
  23. package/dist/cjs/hooks/useDeprecationWarning/index.js.map +1 -0
  24. package/dist/cjs/hooks/useDeprecationWarning/useDeprecationWarning.js +32 -0
  25. package/dist/cjs/hooks/useDeprecationWarning/useDeprecationWarning.js.map +1 -0
  26. package/dist/cjs/hooks/useTextField/useTextField.js +1 -1
  27. package/dist/cjs/hooks/useTextField/useTextField.js.map +1 -1
  28. package/dist/cjs/hooks/useValidationClasses/index.js +20 -0
  29. package/dist/cjs/hooks/useValidationClasses/index.js.map +1 -0
  30. package/dist/cjs/hooks/useValidationClasses/useValidationClasses.js +26 -0
  31. package/dist/cjs/hooks/useValidationClasses/useValidationClasses.js.map +1 -0
  32. package/dist/cjs/tsconfig.tsbuildinfo +1 -1
  33. package/dist/esm/components/Button/Button.js +5 -7
  34. package/dist/esm/components/Button/Button.js.map +1 -1
  35. package/dist/esm/components/Checkbox/Checkbox.js +8 -5
  36. package/dist/esm/components/Checkbox/Checkbox.js.map +1 -1
  37. package/dist/esm/components/Checkbox/CheckboxGroup.js +8 -5
  38. package/dist/esm/components/Checkbox/CheckboxGroup.js.map +1 -1
  39. package/dist/esm/components/Checkbox/types.js.map +1 -1
  40. package/dist/esm/components/Modal/Modal.js +8 -8
  41. package/dist/esm/components/Modal/Modal.js.map +1 -1
  42. package/dist/esm/components/NumberField/NumberField.js +9 -9
  43. package/dist/esm/components/NumberField/NumberField.js.map +1 -1
  44. package/dist/esm/components/Radio/RadioGroup.js +9 -6
  45. package/dist/esm/components/Radio/RadioGroup.js.map +1 -1
  46. package/dist/esm/components/Select/Select.js +11 -7
  47. package/dist/esm/components/Select/Select.js.map +1 -1
  48. package/dist/esm/components/TextArea/TextArea.js +7 -8
  49. package/dist/esm/components/TextArea/TextArea.js.map +1 -1
  50. package/dist/esm/components/TextField/TextField.js +12 -11
  51. package/dist/esm/components/TextField/TextField.js.map +1 -1
  52. package/dist/esm/hooks/index.js +2 -0
  53. package/dist/esm/hooks/index.js.map +1 -1
  54. package/dist/esm/hooks/useDeprecationWarning/index.js +3 -0
  55. package/dist/esm/hooks/useDeprecationWarning/index.js.map +1 -0
  56. package/dist/esm/hooks/useDeprecationWarning/useDeprecationWarning.js +22 -0
  57. package/dist/esm/hooks/useDeprecationWarning/useDeprecationWarning.js.map +1 -0
  58. package/dist/esm/hooks/useTextField/types.js.map +1 -1
  59. package/dist/esm/hooks/useTextField/useTextField.js +1 -1
  60. package/dist/esm/hooks/useTextField/useTextField.js.map +1 -1
  61. package/dist/esm/hooks/useValidationClasses/index.js +3 -0
  62. package/dist/esm/hooks/useValidationClasses/index.js.map +1 -0
  63. package/dist/esm/hooks/useValidationClasses/useValidationClasses.js +16 -0
  64. package/dist/esm/hooks/useValidationClasses/useValidationClasses.js.map +1 -0
  65. package/dist/types/components/Button/Button.d.ts +0 -1
  66. package/dist/types/components/Checkbox/types.d.ts +3 -4
  67. package/dist/types/components/NumberField/NumberField.d.ts +2 -2
  68. package/dist/types/components/Radio/RadioGroup.d.ts +2 -2
  69. package/dist/types/components/TextArea/TextArea.d.ts +0 -1
  70. package/dist/types/hooks/index.d.ts +2 -0
  71. package/dist/types/hooks/useDeprecationWarning/index.d.ts +1 -0
  72. package/dist/types/hooks/useDeprecationWarning/useDeprecationWarning.d.ts +2 -0
  73. package/dist/types/hooks/useDeprecationWarning/useDeprecationWarning.test.d.ts +1 -0
  74. package/dist/types/hooks/useTextField/types.d.ts +2 -3
  75. package/dist/types/hooks/useValidationClasses/index.d.ts +1 -0
  76. package/dist/types/hooks/useValidationClasses/useValidationClasses.d.ts +3 -0
  77. package/dist/types/hooks/useValidationClasses/useValidationClasses.test.d.ts +1 -0
  78. package/package.json +18 -18
  79. package/src/components/Accordion/Accordion.stories.tsx +2 -2
  80. package/src/components/Button/Button.test.tsx +4 -2
  81. package/src/components/Button/Button.tsx +5 -13
  82. package/src/components/Checkbox/Checkbox.stories.tsx +3 -11
  83. package/src/components/Checkbox/Checkbox.test.tsx +3 -3
  84. package/src/components/Checkbox/Checkbox.tsx +8 -3
  85. package/src/components/Checkbox/CheckboxGroup.stories.tsx +9 -12
  86. package/src/components/Checkbox/CheckboxGroup.test.tsx +2 -5
  87. package/src/components/Checkbox/CheckboxGroup.tsx +12 -5
  88. package/src/components/Checkbox/types.ts +3 -4
  89. package/src/components/Modal/Modal.tsx +9 -16
  90. package/src/components/NumberField/NumberField.stories.tsx +3 -12
  91. package/src/components/NumberField/NumberField.tsx +26 -14
  92. package/src/components/PasswordField/PasswordField.stories.tsx +1 -10
  93. package/src/components/Radio/Radio.stories.tsx +3 -11
  94. package/src/components/Radio/Radio.test.tsx +3 -3
  95. package/src/components/Radio/RadioGroup.tsx +11 -6
  96. package/src/components/Select/Select.mdx +2 -2
  97. package/src/components/Select/Select.stories.tsx +4 -11
  98. package/src/components/Select/Select.test.tsx +1 -1
  99. package/src/components/Select/Select.tsx +13 -6
  100. package/src/components/TextArea/TextArea.stories.tsx +4 -13
  101. package/src/components/TextArea/TextArea.test.tsx +2 -6
  102. package/src/components/TextArea/TextArea.tsx +16 -10
  103. package/src/components/TextField/TextField.stories.tsx +3 -11
  104. package/src/components/TextField/TextField.test.tsx +5 -13
  105. package/src/components/TextField/TextField.tsx +22 -11
  106. package/src/hooks/index.tsx +2 -0
  107. package/src/hooks/useDeprecationWarning/index.ts +1 -0
  108. package/src/hooks/useDeprecationWarning/useDeprecationWarning.test.ts +51 -0
  109. package/src/hooks/useDeprecationWarning/useDeprecationWarning.ts +33 -0
  110. package/src/hooks/useTextField/types.tsx +2 -2
  111. package/src/hooks/useTextField/useTextField.test.tsx +7 -9
  112. package/src/hooks/useTextField/useTextField.tsx +1 -6
  113. package/src/hooks/useValidationClasses/index.ts +1 -0
  114. package/src/hooks/useValidationClasses/useValidationClasses.test.ts +85 -0
  115. package/src/hooks/useValidationClasses/useValidationClasses.ts +23 -0
@@ -23,19 +23,18 @@ function _interop_require_default(obj) {
23
23
  };
24
24
  }
25
25
  const TextArea = /*#__PURE__*/ (0, _react.forwardRef)((props, ref)=>{
26
- const { isDisabled, className, errorMessage, label, validationState, ...otherProps } = props;
26
+ const { isDisabled, className, errorMessage, label, validationState, isInvalid, ...otherProps } = props;
27
27
  const { inputProps, labelProps, errorMessageProps } = (0, _hooks.useTextField)(props);
28
28
  // Set class name for atom, including interaction state
29
29
  const classes = (0, _dedupe.default)("mobius", "mobius/TextArea", className);
30
- const inputClasses = (0, _dedupe.default)("mobius/TextAreaInput", {
31
- "--is-valid": validationState === "valid",
32
- "--is-invalid": validationState === "invalid"
30
+ const validationClasses = (0, _hooks.useValidationClasses)({
31
+ validationState,
32
+ isInvalid
33
33
  });
34
+ const inputClasses = (0, _dedupe.default)("mobius/TextAreaInput", validationClasses);
34
35
  const labelClasses = (0, _dedupe.default)({
35
- "--is-valid": validationState === "valid",
36
- "--is-invalid": validationState === "invalid",
37
36
  "--is-disabled": isDisabled
38
- });
37
+ }, validationClasses);
39
38
  return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_Flex.Flex, {
40
39
  flexDirection: "column",
41
40
  className: classes,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/TextArea/TextArea.tsx"],"sourcesContent":["\"use client\";\n\nimport { Ref, forwardRef, RefAttributes } from \"react\";\nimport classNames from \"classnames/dedupe\";\nimport { DOMProps } from \"../../types/dom\";\nimport { TextAreaInput } from \"../TextAreaInput\";\nimport { Label } from \"../Label\";\nimport { ForwardedRefComponent } from \"../../types/components\";\nimport { Flex } from \"../Flex\";\nimport { ErrorMessage } from \"../ErrorMessage\";\nimport { UseTextFieldProps, useTextField } from \"../../hooks\";\n\nexport type TextAreaElementType = HTMLTextAreaElement;\n\nexport interface TextAreaProps\n extends UseTextFieldProps,\n DOMProps,\n RefAttributes<TextAreaElementType> {\n className?: string;\n errorMessage?: string;\n validationState?: \"valid\" | \"invalid\";\n}\n\nexport type TextAreaRef = Ref<TextAreaElementType>;\n\nconst TextArea: ForwardedRefComponent<TextAreaProps, TextAreaElementType> =\n forwardRef((props: TextAreaProps, ref: TextAreaRef) => {\n const {\n isDisabled,\n className,\n errorMessage,\n label,\n validationState,\n ...otherProps\n } = props;\n\n const { inputProps, labelProps, errorMessageProps } = useTextField(props);\n\n // Set class name for atom, including interaction state\n const classes = classNames(\"mobius\", \"mobius/TextArea\", className);\n const inputClasses = classNames(\"mobius/TextAreaInput\", {\n \"--is-valid\": validationState === \"valid\",\n \"--is-invalid\": validationState === \"invalid\",\n });\n const labelClasses = classNames({\n \"--is-valid\": validationState === \"valid\",\n \"--is-invalid\": validationState === \"invalid\",\n \"--is-disabled\": isDisabled,\n });\n\n return (\n <Flex flexDirection=\"column\" className={classes}>\n {label && (\n <Label {...labelProps} className={labelClasses}>\n {props.label}\n </Label>\n )}\n <TextAreaInput\n {...otherProps}\n {...inputProps}\n ref={ref}\n className={inputClasses}\n isDisabled={isDisabled}\n aria-invalid={errorMessage != null}\n />\n <ErrorMessage {...errorMessageProps} errorMessage={errorMessage} />\n </Flex>\n );\n });\n\nTextArea.displayName = \"TextArea\";\nexport { TextArea };\n"],"names":["TextArea","forwardRef","props","ref","isDisabled","className","errorMessage","label","validationState","otherProps","inputProps","labelProps","errorMessageProps","useTextField","classes","classNames","inputClasses","labelClasses","Flex","flexDirection","Label","TextAreaInput","aria-invalid","ErrorMessage","displayName"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA;;;;;+BAuESA;;;eAAAA;;;;uBArEsC;+DACxB;+BAEO;uBACR;sBAED;8BACQ;uBACmB;;;;;;AAehD,MAAMA,yBACJC,IAAAA,iBAAU,EAAC,CAACC,OAAsBC;IAChC,MAAM,EACJC,UAAU,EACVC,SAAS,EACTC,YAAY,EACZC,KAAK,EACLC,eAAe,EACf,GAAGC,YACJ,GAAGP;IAEJ,MAAM,EAAEQ,UAAU,EAAEC,UAAU,EAAEC,iBAAiB,EAAE,GAAGC,IAAAA,mBAAY,EAACX;IAEnE,uDAAuD;IACvD,MAAMY,UAAUC,IAAAA,eAAU,EAAC,UAAU,mBAAmBV;IACxD,MAAMW,eAAeD,IAAAA,eAAU,EAAC,wBAAwB;QACtD,cAAcP,oBAAoB;QAClC,gBAAgBA,oBAAoB;IACtC;IACA,MAAMS,eAAeF,IAAAA,eAAU,EAAC;QAC9B,cAAcP,oBAAoB;QAClC,gBAAgBA,oBAAoB;QACpC,iBAAiBJ;IACnB;IAEA,qBACE,sBAACc,UAAI;QAACC,eAAc;QAASd,WAAWS;;YACrCP,uBACC,qBAACa,YAAK;gBAAE,GAAGT,UAAU;gBAAEN,WAAWY;0BAC/Bf,MAAMK,KAAK;;0BAGhB,qBAACc,4BAAa;gBACX,GAAGZ,UAAU;gBACb,GAAGC,UAAU;gBACdP,KAAKA;gBACLE,WAAWW;gBACXZ,YAAYA;gBACZkB,gBAAchB,gBAAgB;;0BAEhC,qBAACiB,0BAAY;gBAAE,GAAGX,iBAAiB;gBAAEN,cAAcA;;;;AAGzD;AAEFN,SAASwB,WAAW,GAAG"}
1
+ {"version":3,"sources":["../../../../src/components/TextArea/TextArea.tsx"],"sourcesContent":["\"use client\";\n\nimport { Ref, forwardRef, RefAttributes } from \"react\";\nimport classNames from \"classnames/dedupe\";\nimport { DOMProps } from \"../../types/dom\";\nimport { TextAreaInput } from \"../TextAreaInput\";\nimport { Label } from \"../Label\";\nimport { ForwardedRefComponent } from \"../../types/components\";\nimport { Flex } from \"../Flex\";\nimport { ErrorMessage } from \"../ErrorMessage\";\nimport {\n UseTextFieldProps,\n useTextField,\n useValidationClasses,\n} from \"../../hooks\";\n\nexport type TextAreaElementType = HTMLTextAreaElement;\n\nexport interface TextAreaProps\n extends UseTextFieldProps,\n DOMProps,\n RefAttributes<TextAreaElementType> {\n className?: string;\n errorMessage?: string;\n}\n\nexport type TextAreaRef = Ref<TextAreaElementType>;\n\nconst TextArea: ForwardedRefComponent<TextAreaProps, TextAreaElementType> =\n forwardRef((props: TextAreaProps, ref: TextAreaRef) => {\n const {\n isDisabled,\n className,\n errorMessage,\n label,\n validationState,\n isInvalid,\n ...otherProps\n } = props;\n\n const { inputProps, labelProps, errorMessageProps } = useTextField(props);\n\n // Set class name for atom, including interaction state\n const classes = classNames(\"mobius\", \"mobius/TextArea\", className);\n const validationClasses = useValidationClasses({\n validationState,\n isInvalid,\n });\n const inputClasses = classNames(\"mobius/TextAreaInput\", validationClasses);\n const labelClasses = classNames(\n {\n \"--is-disabled\": isDisabled,\n },\n validationClasses,\n );\n\n return (\n <Flex flexDirection=\"column\" className={classes}>\n {label && (\n <Label {...labelProps} className={labelClasses}>\n {props.label}\n </Label>\n )}\n <TextAreaInput\n {...otherProps}\n {...inputProps}\n ref={ref}\n className={inputClasses}\n isDisabled={isDisabled}\n aria-invalid={errorMessage != null}\n />\n <ErrorMessage {...errorMessageProps} errorMessage={errorMessage} />\n </Flex>\n );\n });\n\nTextArea.displayName = \"TextArea\";\nexport { TextArea };\n"],"names":["TextArea","forwardRef","props","ref","isDisabled","className","errorMessage","label","validationState","isInvalid","otherProps","inputProps","labelProps","errorMessageProps","useTextField","classes","classNames","validationClasses","useValidationClasses","inputClasses","labelClasses","Flex","flexDirection","Label","TextAreaInput","aria-invalid","ErrorMessage","displayName"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA;;;;;+BA6ESA;;;eAAAA;;;;uBA3EsC;+DACxB;+BAEO;uBACR;sBAED;8BACQ;uBAKtB;;;;;;AAcP,MAAMA,yBACJC,IAAAA,iBAAU,EAAC,CAACC,OAAsBC;IAChC,MAAM,EACJC,UAAU,EACVC,SAAS,EACTC,YAAY,EACZC,KAAK,EACLC,eAAe,EACfC,SAAS,EACT,GAAGC,YACJ,GAAGR;IAEJ,MAAM,EAAES,UAAU,EAAEC,UAAU,EAAEC,iBAAiB,EAAE,GAAGC,IAAAA,mBAAY,EAACZ;IAEnE,uDAAuD;IACvD,MAAMa,UAAUC,IAAAA,eAAU,EAAC,UAAU,mBAAmBX;IACxD,MAAMY,oBAAoBC,IAAAA,2BAAoB,EAAC;QAC7CV;QACAC;IACF;IACA,MAAMU,eAAeH,IAAAA,eAAU,EAAC,wBAAwBC;IACxD,MAAMG,eAAeJ,IAAAA,eAAU,EAC7B;QACE,iBAAiBZ;IACnB,GACAa;IAGF,qBACE,sBAACI,UAAI;QAACC,eAAc;QAASjB,WAAWU;;YACrCR,uBACC,qBAACgB,YAAK;gBAAE,GAAGX,UAAU;gBAAEP,WAAWe;0BAC/BlB,MAAMK,KAAK;;0BAGhB,qBAACiB,4BAAa;gBACX,GAAGd,UAAU;gBACb,GAAGC,UAAU;gBACdR,KAAKA;gBACLE,WAAWc;gBACXf,YAAYA;gBACZqB,gBAAcnB,gBAAgB;;0BAEhC,qBAACoB,0BAAY;gBAAE,GAAGb,iBAAiB;gBAAEP,cAAcA;;;;AAGzD;AAEFN,SAAS2B,WAAW,GAAG"}
@@ -22,29 +22,30 @@ function _interop_require_default(obj) {
22
22
  };
23
23
  }
24
24
  const TextField = /*#__PURE__*/ (0, _react.forwardRef)((props, ref)=>{
25
- const { isDisabled, type = "text", validationState, className, label, errorMessage, children, isRequired, prefixInside, prefixOutside, suffixInside, suffixOutside, ...otherProps } = props;
25
+ const { isDisabled, type = "text", validationState, isInvalid, className, label, errorMessage, children, isRequired, prefixInside, prefixOutside, suffixInside, suffixOutside, ...otherProps } = props;
26
26
  const { inputProps, labelProps, errorMessageProps } = (0, _hooks.useTextField)({
27
27
  ...props,
28
28
  "aria-errormessage": errorMessage
29
29
  });
30
30
  const hidden = type === "hidden";
31
+ const validationClasses = (0, _hooks.useValidationClasses)({
32
+ validationState,
33
+ isInvalid
34
+ });
31
35
  const textfieldClasses = {
32
36
  "--is-disabled": isDisabled,
33
- "--is-valid": validationState === "valid",
34
- "--is-invalid": validationState === "invalid",
35
37
  "--is-required": typeof isRequired === "boolean" && isRequired,
36
38
  "--is-optional": typeof isRequired === "boolean" && !isRequired,
37
39
  "--is-hidden": hidden,
38
40
  [className || ""]: true
39
41
  };
42
+ const sharedClasses = (0, _dedupe.default)(validationClasses, textfieldClasses);
40
43
  const labelClasses = (0, _dedupe.default)({
41
- "--is-disabled": isDisabled,
42
- "--is-valid": validationState === "valid",
43
- "--is-invalid": validationState === "invalid"
44
- });
45
- const containerClasses = (0, _dedupe.default)("mobius", "mobius/TextField", textfieldClasses);
46
- const inputClasses = (0, _dedupe.default)("mobius", "mobius/TextInput", textfieldClasses);
47
- const inputWrapperClasses = (0, _dedupe.default)("mobius/TextFieldInputWrapper", textfieldClasses);
44
+ "--is-disabled": isDisabled
45
+ }, validationClasses);
46
+ const containerClasses = (0, _dedupe.default)("mobius", "mobius/TextField", sharedClasses);
47
+ const inputClasses = (0, _dedupe.default)("mobius", "mobius/TextInput", sharedClasses);
48
+ const inputWrapperClasses = (0, _dedupe.default)("mobius/TextFieldInputWrapper", sharedClasses);
48
49
  return /*#__PURE__*/ (0, _jsxruntime.jsxs)("div", {
49
50
  className: containerClasses,
50
51
  children: [
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/TextField/TextField.tsx"],"sourcesContent":["\"use client\";\n\nimport classNames from \"classnames/dedupe\";\nimport {\n HTMLInputTypeAttribute,\n ReactElement,\n ReactNode,\n Ref,\n RefAttributes,\n forwardRef,\n} from \"react\";\nimport { UseTextFieldProps, useTextField } from \"../../hooks\";\nimport { DOMProps, FocusEvents } from \"../../types\";\nimport { ForwardedRefComponent } from \"../../types/components\";\nimport { ErrorMessage } from \"../ErrorMessage\";\nimport { Label } from \"../Label\";\nimport { adornmentWithClassName } from \"./adornmentWithClassName\";\n\nexport type TextFieldElementType = HTMLInputElement;\nexport interface TextFieldProps\n extends DOMProps,\n FocusEvents,\n UseTextFieldProps,\n RefAttributes<TextFieldElementType> {\n className?: string;\n errorMessage?: string;\n children?: ReactNode;\n label?: string;\n type?: Exclude<\n HTMLInputTypeAttribute,\n | \"button\"\n | \"checkbox\"\n | \"color\"\n | \"date\"\n | \"datetime-local\"\n | \"file\"\n | \"image\"\n | \"month\"\n | \"radio\"\n | \"range\"\n | \"reset\"\n | \"submit\"\n | \"week\"\n >;\n prefixInside?: ReactElement;\n prefixOutside?: ReactElement;\n suffixInside?: ReactElement;\n suffixOutside?: ReactElement;\n}\n\nexport type TextFieldRef = Ref<TextFieldElementType>;\n\nconst TextField: ForwardedRefComponent<TextFieldProps, TextFieldElementType> =\n forwardRef((props: TextFieldProps, ref: TextFieldRef) => {\n const {\n isDisabled,\n type = \"text\",\n validationState,\n className,\n label,\n errorMessage,\n children,\n isRequired,\n prefixInside,\n prefixOutside,\n suffixInside,\n suffixOutside,\n ...otherProps\n } = props;\n\n const { inputProps, labelProps, errorMessageProps } = useTextField({\n ...props,\n \"aria-errormessage\": errorMessage,\n });\n\n const hidden = type === \"hidden\";\n\n const textfieldClasses = {\n \"--is-disabled\": isDisabled,\n \"--is-valid\": validationState === \"valid\",\n \"--is-invalid\": validationState === \"invalid\",\n \"--is-required\": typeof isRequired === \"boolean\" && isRequired,\n \"--is-optional\": typeof isRequired === \"boolean\" && !isRequired,\n \"--is-hidden\": hidden,\n [className || \"\"]: true,\n };\n\n const labelClasses = classNames({\n \"--is-disabled\": isDisabled,\n \"--is-valid\": validationState === \"valid\",\n \"--is-invalid\": validationState === \"invalid\",\n });\n\n const containerClasses = classNames(\n \"mobius\",\n \"mobius/TextField\",\n textfieldClasses,\n );\n\n const inputClasses = classNames(\n \"mobius\",\n \"mobius/TextInput\",\n textfieldClasses,\n );\n\n const inputWrapperClasses = classNames(\n \"mobius/TextFieldInputWrapper\",\n textfieldClasses,\n );\n\n return (\n <div className={containerClasses}>\n {label && !hidden && (\n <Label {...labelProps} className={labelClasses}>\n {label}\n </Label>\n )}\n <div className=\"mobius/TextFieldInnerContainer\">\n {adornmentWithClassName(\n prefixOutside,\n \"mobius/TextFieldPrefixOutside\",\n )}\n <div className={inputWrapperClasses}>\n {adornmentWithClassName(\n prefixInside,\n \"mobius/TextFieldPrefixInside\",\n )}\n <input\n {...otherProps}\n {...inputProps}\n ref={ref}\n type={type}\n className={inputClasses}\n />\n {adornmentWithClassName(\n suffixInside,\n \"mobius/TextFieldSuffixInside\",\n )}\n </div>\n {adornmentWithClassName(\n suffixOutside,\n \"mobius/TextFieldSuffixOutside\",\n )}\n </div>\n {children && <div className=\"mobius/TextFieldChildren\">{children}</div>}\n\n <ErrorMessage {...errorMessageProps} errorMessage={errorMessage} />\n </div>\n );\n });\n\nTextField.displayName = \"TextField\";\nexport { TextField };\n"],"names":["TextField","forwardRef","props","ref","isDisabled","type","validationState","className","label","errorMessage","children","isRequired","prefixInside","prefixOutside","suffixInside","suffixOutside","otherProps","inputProps","labelProps","errorMessageProps","useTextField","hidden","textfieldClasses","labelClasses","classNames","containerClasses","inputClasses","inputWrapperClasses","div","Label","adornmentWithClassName","input","ErrorMessage","displayName"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA;;;;;+BAwJSA;;;eAAAA;;;;+DAtJc;uBAQhB;uBACyC;8BAGnB;uBACP;wCACiB;;;;;;AAoCvC,MAAMA,0BACJC,IAAAA,iBAAU,EAAC,CAACC,OAAuBC;IACjC,MAAM,EACJC,UAAU,EACVC,OAAO,MAAM,EACbC,eAAe,EACfC,SAAS,EACTC,KAAK,EACLC,YAAY,EACZC,QAAQ,EACRC,UAAU,EACVC,YAAY,EACZC,aAAa,EACbC,YAAY,EACZC,aAAa,EACb,GAAGC,YACJ,GAAGd;IAEJ,MAAM,EAAEe,UAAU,EAAEC,UAAU,EAAEC,iBAAiB,EAAE,GAAGC,IAAAA,mBAAY,EAAC;QACjE,GAAGlB,KAAK;QACR,qBAAqBO;IACvB;IAEA,MAAMY,SAAShB,SAAS;IAExB,MAAMiB,mBAAmB;QACvB,iBAAiBlB;QACjB,cAAcE,oBAAoB;QAClC,gBAAgBA,oBAAoB;QACpC,iBAAiB,OAAOK,eAAe,aAAaA;QACpD,iBAAiB,OAAOA,eAAe,aAAa,CAACA;QACrD,eAAeU;QACf,CAACd,aAAa,GAAG,EAAE;IACrB;IAEA,MAAMgB,eAAeC,IAAAA,eAAU,EAAC;QAC9B,iBAAiBpB;QACjB,cAAcE,oBAAoB;QAClC,gBAAgBA,oBAAoB;IACtC;IAEA,MAAMmB,mBAAmBD,IAAAA,eAAU,EACjC,UACA,oBACAF;IAGF,MAAMI,eAAeF,IAAAA,eAAU,EAC7B,UACA,oBACAF;IAGF,MAAMK,sBAAsBH,IAAAA,eAAU,EACpC,gCACAF;IAGF,qBACE,sBAACM;QAAIrB,WAAWkB;;YACbjB,SAAS,CAACa,wBACT,qBAACQ,YAAK;gBAAE,GAAGX,UAAU;gBAAEX,WAAWgB;0BAC/Bf;;0BAGL,sBAACoB;gBAAIrB,WAAU;;oBACZuB,IAAAA,8CAAsB,EACrBjB,eACA;kCAEF,sBAACe;wBAAIrB,WAAWoB;;4BACbG,IAAAA,8CAAsB,EACrBlB,cACA;0CAEF,qBAACmB;gCACE,GAAGf,UAAU;gCACb,GAAGC,UAAU;gCACdd,KAAKA;gCACLE,MAAMA;gCACNE,WAAWmB;;4BAEZI,IAAAA,8CAAsB,EACrBhB,cACA;;;oBAGHgB,IAAAA,8CAAsB,EACrBf,eACA;;;YAGHL,0BAAY,qBAACkB;gBAAIrB,WAAU;0BAA4BG;;0BAExD,qBAACsB,0BAAY;gBAAE,GAAGb,iBAAiB;gBAAEV,cAAcA;;;;AAGzD;AAEFT,UAAUiC,WAAW,GAAG"}
1
+ {"version":3,"sources":["../../../../src/components/TextField/TextField.tsx"],"sourcesContent":["\"use client\";\n\nimport classNames from \"classnames/dedupe\";\nimport {\n HTMLInputTypeAttribute,\n ReactElement,\n ReactNode,\n Ref,\n RefAttributes,\n forwardRef,\n} from \"react\";\nimport {\n UseTextFieldProps,\n useTextField,\n useValidationClasses,\n} from \"../../hooks\";\nimport { DOMProps, FocusEvents } from \"../../types\";\nimport { ForwardedRefComponent } from \"../../types/components\";\nimport { ErrorMessage } from \"../ErrorMessage\";\nimport { Label } from \"../Label\";\nimport { adornmentWithClassName } from \"./adornmentWithClassName\";\n\nexport type TextFieldElementType = HTMLInputElement;\nexport interface TextFieldProps\n extends DOMProps,\n FocusEvents,\n UseTextFieldProps,\n RefAttributes<TextFieldElementType> {\n className?: string;\n errorMessage?: string;\n children?: ReactNode;\n label?: string;\n type?: Exclude<\n HTMLInputTypeAttribute,\n | \"button\"\n | \"checkbox\"\n | \"color\"\n | \"date\"\n | \"datetime-local\"\n | \"file\"\n | \"image\"\n | \"month\"\n | \"radio\"\n | \"range\"\n | \"reset\"\n | \"submit\"\n | \"week\"\n >;\n prefixInside?: ReactElement;\n prefixOutside?: ReactElement;\n suffixInside?: ReactElement;\n suffixOutside?: ReactElement;\n}\n\nexport type TextFieldRef = Ref<TextFieldElementType>;\n\nconst TextField: ForwardedRefComponent<TextFieldProps, TextFieldElementType> =\n forwardRef((props: TextFieldProps, ref: TextFieldRef) => {\n const {\n isDisabled,\n type = \"text\",\n validationState,\n isInvalid,\n className,\n label,\n errorMessage,\n children,\n isRequired,\n prefixInside,\n prefixOutside,\n suffixInside,\n suffixOutside,\n ...otherProps\n } = props;\n\n const { inputProps, labelProps, errorMessageProps } = useTextField({\n ...props,\n \"aria-errormessage\": errorMessage,\n });\n\n const hidden = type === \"hidden\";\n\n const validationClasses = useValidationClasses({\n validationState,\n isInvalid,\n });\n\n const textfieldClasses = {\n \"--is-disabled\": isDisabled,\n \"--is-required\": typeof isRequired === \"boolean\" && isRequired,\n \"--is-optional\": typeof isRequired === \"boolean\" && !isRequired,\n \"--is-hidden\": hidden,\n [className || \"\"]: true,\n };\n\n const sharedClasses = classNames(validationClasses, textfieldClasses);\n\n const labelClasses = classNames(\n {\n \"--is-disabled\": isDisabled,\n },\n validationClasses,\n );\n\n const containerClasses = classNames(\n \"mobius\",\n \"mobius/TextField\",\n sharedClasses,\n );\n\n const inputClasses = classNames(\n \"mobius\",\n \"mobius/TextInput\",\n sharedClasses,\n );\n\n const inputWrapperClasses = classNames(\n \"mobius/TextFieldInputWrapper\",\n sharedClasses,\n );\n\n return (\n <div className={containerClasses}>\n {label && !hidden && (\n <Label {...labelProps} className={labelClasses}>\n {label}\n </Label>\n )}\n <div className=\"mobius/TextFieldInnerContainer\">\n {adornmentWithClassName(\n prefixOutside,\n \"mobius/TextFieldPrefixOutside\",\n )}\n <div className={inputWrapperClasses}>\n {adornmentWithClassName(\n prefixInside,\n \"mobius/TextFieldPrefixInside\",\n )}\n <input\n {...otherProps}\n {...inputProps}\n ref={ref}\n type={type}\n className={inputClasses}\n />\n {adornmentWithClassName(\n suffixInside,\n \"mobius/TextFieldSuffixInside\",\n )}\n </div>\n {adornmentWithClassName(\n suffixOutside,\n \"mobius/TextFieldSuffixOutside\",\n )}\n </div>\n {children && <div className=\"mobius/TextFieldChildren\">{children}</div>}\n\n <ErrorMessage {...errorMessageProps} errorMessage={errorMessage} />\n </div>\n );\n });\n\nTextField.displayName = \"TextField\";\nexport { TextField };\n"],"names":["TextField","forwardRef","props","ref","isDisabled","type","validationState","isInvalid","className","label","errorMessage","children","isRequired","prefixInside","prefixOutside","suffixInside","suffixOutside","otherProps","inputProps","labelProps","errorMessageProps","useTextField","hidden","validationClasses","useValidationClasses","textfieldClasses","sharedClasses","classNames","labelClasses","containerClasses","inputClasses","inputWrapperClasses","div","Label","adornmentWithClassName","input","ErrorMessage","displayName"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA;;;;;+BAmKSA;;;eAAAA;;;;+DAjKc;uBAQhB;uBAKA;8BAGsB;uBACP;wCACiB;;;;;;AAoCvC,MAAMA,0BACJC,IAAAA,iBAAU,EAAC,CAACC,OAAuBC;IACjC,MAAM,EACJC,UAAU,EACVC,OAAO,MAAM,EACbC,eAAe,EACfC,SAAS,EACTC,SAAS,EACTC,KAAK,EACLC,YAAY,EACZC,QAAQ,EACRC,UAAU,EACVC,YAAY,EACZC,aAAa,EACbC,YAAY,EACZC,aAAa,EACb,GAAGC,YACJ,GAAGf;IAEJ,MAAM,EAAEgB,UAAU,EAAEC,UAAU,EAAEC,iBAAiB,EAAE,GAAGC,IAAAA,mBAAY,EAAC;QACjE,GAAGnB,KAAK;QACR,qBAAqBQ;IACvB;IAEA,MAAMY,SAASjB,SAAS;IAExB,MAAMkB,oBAAoBC,IAAAA,2BAAoB,EAAC;QAC7ClB;QACAC;IACF;IAEA,MAAMkB,mBAAmB;QACvB,iBAAiBrB;QACjB,iBAAiB,OAAOQ,eAAe,aAAaA;QACpD,iBAAiB,OAAOA,eAAe,aAAa,CAACA;QACrD,eAAeU;QACf,CAACd,aAAa,GAAG,EAAE;IACrB;IAEA,MAAMkB,gBAAgBC,IAAAA,eAAU,EAACJ,mBAAmBE;IAEpD,MAAMG,eAAeD,IAAAA,eAAU,EAC7B;QACE,iBAAiBvB;IACnB,GACAmB;IAGF,MAAMM,mBAAmBF,IAAAA,eAAU,EACjC,UACA,oBACAD;IAGF,MAAMI,eAAeH,IAAAA,eAAU,EAC7B,UACA,oBACAD;IAGF,MAAMK,sBAAsBJ,IAAAA,eAAU,EACpC,gCACAD;IAGF,qBACE,sBAACM;QAAIxB,WAAWqB;;YACbpB,SAAS,CAACa,wBACT,qBAACW,YAAK;gBAAE,GAAGd,UAAU;gBAAEX,WAAWoB;0BAC/BnB;;0BAGL,sBAACuB;gBAAIxB,WAAU;;oBACZ0B,IAAAA,8CAAsB,EACrBpB,eACA;kCAEF,sBAACkB;wBAAIxB,WAAWuB;;4BACbG,IAAAA,8CAAsB,EACrBrB,cACA;0CAEF,qBAACsB;gCACE,GAAGlB,UAAU;gCACb,GAAGC,UAAU;gCACdf,KAAKA;gCACLE,MAAMA;gCACNG,WAAWsB;;4BAEZI,IAAAA,8CAAsB,EACrBnB,cACA;;;oBAGHmB,IAAAA,8CAAsB,EACrBlB,eACA;;;YAGHL,0BAAY,qBAACqB;gBAAIxB,WAAU;0BAA4BG;;0BAExD,qBAACyB,0BAAY;gBAAE,GAAGhB,iBAAiB;gBAAEV,cAAcA;;;;AAGzD;AAEFV,UAAUqC,WAAW,GAAG"}
@@ -5,11 +5,13 @@ Object.defineProperty(exports, "__esModule", {
5
5
  _export_star(require("./useBodyScrollLock"), exports);
6
6
  _export_star(require("./useBreakpoint"), exports);
7
7
  _export_star(require("./useButton"), exports);
8
+ _export_star(require("./useDeprecationWarning"), exports);
8
9
  _export_star(require("./useDialog"), exports);
9
10
  _export_star(require("./useDialogPolyfill"), exports);
10
11
  _export_star(require("./useLabel"), exports);
11
12
  _export_star(require("./useOnClickOutside"), exports);
12
13
  _export_star(require("./useTextField"), exports);
14
+ _export_star(require("./useValidationClasses"), exports);
13
15
  _export_star(require("./useWindowEvent"), exports);
14
16
  function _export_star(from, to) {
15
17
  Object.keys(from).forEach(function(k) {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/hooks/index.tsx"],"sourcesContent":["export * from \"./useBodyScrollLock\";\nexport * from \"./useBreakpoint\";\nexport * from \"./useButton\";\nexport * from \"./useDialog\";\nexport * from \"./useDialogPolyfill\";\nexport * from \"./useLabel\";\nexport * from \"./useOnClickOutside\";\nexport * from \"./useTextField\";\nexport * from \"./useWindowEvent\";\n"],"names":[],"rangeMappings":";;;;;;;;;;;;","mappings":";;;;qBAAc;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA"}
1
+ {"version":3,"sources":["../../../src/hooks/index.tsx"],"sourcesContent":["export * from \"./useBodyScrollLock\";\nexport * from \"./useBreakpoint\";\nexport * from \"./useButton\";\nexport * from \"./useDeprecationWarning\";\nexport * from \"./useDialog\";\nexport * from \"./useDialogPolyfill\";\nexport * from \"./useLabel\";\nexport * from \"./useOnClickOutside\";\nexport * from \"./useTextField\";\nexport * from \"./useValidationClasses\";\nexport * from \"./useWindowEvent\";\n"],"names":[],"rangeMappings":";;;;;;;;;;;;;;","mappings":";;;;qBAAc;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA"}
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ _export_star(require("./useDeprecationWarning"), exports);
6
+ function _export_star(from, to) {
7
+ Object.keys(from).forEach(function(k) {
8
+ if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
9
+ Object.defineProperty(to, k, {
10
+ enumerable: true,
11
+ get: function() {
12
+ return from[k];
13
+ }
14
+ });
15
+ }
16
+ });
17
+ return from;
18
+ }
19
+
20
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/hooks/useDeprecationWarning/index.ts"],"sourcesContent":["export * from \"./useDeprecationWarning\";\n"],"names":[],"rangeMappings":";;;;","mappings":";;;;qBAAc"}
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "useDeprecationWarning", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return useDeprecationWarning;
9
+ }
10
+ });
11
+ const _react = require("react");
12
+ const useDeprecationWarning = (props)=>{
13
+ const hasWarned = (0, _react.useRef)(false);
14
+ const deprecatedProps = Object.entries(props).reduce((acc, [key, value])=>{
15
+ if (value) {
16
+ acc.push(key);
17
+ }
18
+ return acc;
19
+ }, []);
20
+ const noDeprecatedProps = deprecatedProps.length === 0;
21
+ if (noDeprecatedProps) {
22
+ return;
23
+ }
24
+ if (!hasWarned.current) {
25
+ deprecatedProps.forEach((prop)=>{
26
+ console.warn(`Deprecation warning: Mobius no longer supports the prop '${prop}'. Please refer to the documentation for more information.`);
27
+ });
28
+ hasWarned.current = true;
29
+ }
30
+ };
31
+
32
+ //# sourceMappingURL=useDeprecationWarning.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/hooks/useDeprecationWarning/useDeprecationWarning.ts"],"sourcesContent":["import { useRef } from \"react\";\n\nexport type UseDeprecationWarningProps = Record<string, unknown>;\n\nexport const useDeprecationWarning = (props: UseDeprecationWarningProps) => {\n const hasWarned = useRef<boolean>(false);\n const deprecatedProps = Object.entries(props).reduce<string[]>(\n (acc, [key, value]) => {\n if (value) {\n acc.push(key);\n }\n\n return acc;\n },\n [],\n );\n\n const noDeprecatedProps = deprecatedProps.length === 0;\n\n if (noDeprecatedProps) {\n return;\n }\n\n if (!hasWarned.current) {\n deprecatedProps.forEach(prop => {\n console.warn(\n `Deprecation warning: Mobius no longer supports the prop '${prop}'. Please refer to the documentation for more information.`,\n );\n });\n\n hasWarned.current = true;\n }\n};\n"],"names":["useDeprecationWarning","props","hasWarned","useRef","deprecatedProps","Object","entries","reduce","acc","key","value","push","noDeprecatedProps","length","current","forEach","prop","console","warn"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAIaA;;;eAAAA;;;uBAJU;AAIhB,MAAMA,wBAAwB,CAACC;IACpC,MAAMC,YAAYC,IAAAA,aAAM,EAAU;IAClC,MAAMC,kBAAkBC,OAAOC,OAAO,CAACL,OAAOM,MAAM,CAClD,CAACC,KAAK,CAACC,KAAKC,MAAM;QAChB,IAAIA,OAAO;YACTF,IAAIG,IAAI,CAACF;QACX;QAEA,OAAOD;IACT,GACA,EAAE;IAGJ,MAAMI,oBAAoBR,gBAAgBS,MAAM,KAAK;IAErD,IAAID,mBAAmB;QACrB;IACF;IAEA,IAAI,CAACV,UAAUY,OAAO,EAAE;QACtBV,gBAAgBW,OAAO,CAACC,CAAAA;YACtBC,QAAQC,IAAI,CACV,CAAC,yDAAyD,EAAEF,KAAK,0DAA0D,CAAC;QAEhI;QAEAd,UAAUY,OAAO,GAAG;IACtB;AACF"}
@@ -38,7 +38,7 @@ function useTextField(props) {
38
38
  disabled: isDisabled,
39
39
  readOnly: isReadOnly,
40
40
  "aria-required": isRequired === true ? true : undefined,
41
- "aria-invalid": props.validationState === "invalid" ? true : props.validationState === "valid" ? false : undefined,
41
+ "aria-invalid": props.isInvalid,
42
42
  "aria-describedby": ariaDescribedBy,
43
43
  "aria-errormessage": props["aria-errormessage"],
44
44
  type: inputElementType === "input" ? props.type : undefined,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/hooks/useTextField/useTextField.tsx"],"sourcesContent":["import { useId } from \"react\";\nimport { spaceDelimitedList } from \"../../utils/spaceDelimitedList\";\nimport { useLabel } from \"../useLabel/useLabel\";\nimport { UseTextFieldProps, UseTextFieldReturn } from \"./types\";\n\nexport function useTextField(props: UseTextFieldProps): UseTextFieldReturn {\n const {\n isDisabled = false,\n isReadOnly = false,\n isRequired = false,\n inputElementType = \"input\",\n } = props;\n const { labelProps, fieldProps } = useLabel(props);\n\n const descriptionId = useId();\n const descriptionProps = { id: descriptionId };\n\n const errorMessageId = useId();\n const errorMessageProps = { id: errorMessageId };\n\n const ariaDescribedBy = spaceDelimitedList([\n props.description && descriptionId,\n props.errorMessage && errorMessageId,\n props[\"aria-describedby\"],\n ]);\n\n return {\n descriptionProps,\n errorMessageProps,\n labelProps,\n inputProps: {\n defaultValue: props.defaultValue,\n value: props.value,\n onChange: props.onChange,\n disabled: isDisabled,\n readOnly: isReadOnly,\n \"aria-required\": isRequired === true ? true : undefined,\n \"aria-invalid\":\n props.validationState === \"invalid\"\n ? true\n : props.validationState === \"valid\"\n ? false\n : undefined,\n \"aria-describedby\": ariaDescribedBy,\n \"aria-errormessage\": props[\"aria-errormessage\"],\n\n type: inputElementType === \"input\" ? props.type : undefined,\n pattern: inputElementType === \"input\" ? props.pattern : undefined,\n\n autoComplete: props.autoComplete,\n maxLength: props.maxLength,\n minLength: props.minLength,\n name: props.name,\n placeholder: props.placeholder,\n inputMode: props.inputMode,\n\n // Clipboard events\n onCopy: props.onCopy,\n onCut: props.onCut,\n onPaste: props.onPaste,\n\n // Composition events\n onCompositionEnd: props.onCompositionEnd,\n onCompositionStart: props.onCompositionStart,\n onCompositionUpdate: props.onCompositionUpdate,\n\n // Selection events\n onSelect: props.onSelect,\n\n // Input events\n onBeforeInput: props.onBeforeInput,\n onInput: props.onInput,\n\n // Focus events\n onFocus: props.onFocus,\n onBlur: props.onBlur,\n\n ...fieldProps,\n },\n };\n}\n"],"names":["useTextField","props","isDisabled","isReadOnly","isRequired","inputElementType","labelProps","fieldProps","useLabel","descriptionId","useId","descriptionProps","id","errorMessageId","errorMessageProps","ariaDescribedBy","spaceDelimitedList","description","errorMessage","inputProps","defaultValue","value","onChange","disabled","readOnly","undefined","validationState","type","pattern","autoComplete","maxLength","minLength","name","placeholder","inputMode","onCopy","onCut","onPaste","onCompositionEnd","onCompositionStart","onCompositionUpdate","onSelect","onBeforeInput","onInput","onFocus","onBlur"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAKgBA;;;eAAAA;;;uBALM;oCACa;0BACV;AAGlB,SAASA,aAAaC,KAAwB;IACnD,MAAM,EACJC,aAAa,KAAK,EAClBC,aAAa,KAAK,EAClBC,aAAa,KAAK,EAClBC,mBAAmB,OAAO,EAC3B,GAAGJ;IACJ,MAAM,EAAEK,UAAU,EAAEC,UAAU,EAAE,GAAGC,IAAAA,kBAAQ,EAACP;IAE5C,MAAMQ,gBAAgBC,IAAAA,YAAK;IAC3B,MAAMC,mBAAmB;QAAEC,IAAIH;IAAc;IAE7C,MAAMI,iBAAiBH,IAAAA,YAAK;IAC5B,MAAMI,oBAAoB;QAAEF,IAAIC;IAAe;IAE/C,MAAME,kBAAkBC,IAAAA,sCAAkB,EAAC;QACzCf,MAAMgB,WAAW,IAAIR;QACrBR,MAAMiB,YAAY,IAAIL;QACtBZ,KAAK,CAAC,mBAAmB;KAC1B;IAED,OAAO;QACLU;QACAG;QACAR;QACAa,YAAY;YACVC,cAAcnB,MAAMmB,YAAY;YAChCC,OAAOpB,MAAMoB,KAAK;YAClBC,UAAUrB,MAAMqB,QAAQ;YACxBC,UAAUrB;YACVsB,UAAUrB;YACV,iBAAiBC,eAAe,OAAO,OAAOqB;YAC9C,gBACExB,MAAMyB,eAAe,KAAK,YACtB,OACAzB,MAAMyB,eAAe,KAAK,UACxB,QACAD;YACR,oBAAoBV;YACpB,qBAAqBd,KAAK,CAAC,oBAAoB;YAE/C0B,MAAMtB,qBAAqB,UAAUJ,MAAM0B,IAAI,GAAGF;YAClDG,SAASvB,qBAAqB,UAAUJ,MAAM2B,OAAO,GAAGH;YAExDI,cAAc5B,MAAM4B,YAAY;YAChCC,WAAW7B,MAAM6B,SAAS;YAC1BC,WAAW9B,MAAM8B,SAAS;YAC1BC,MAAM/B,MAAM+B,IAAI;YAChBC,aAAahC,MAAMgC,WAAW;YAC9BC,WAAWjC,MAAMiC,SAAS;YAE1B,mBAAmB;YACnBC,QAAQlC,MAAMkC,MAAM;YACpBC,OAAOnC,MAAMmC,KAAK;YAClBC,SAASpC,MAAMoC,OAAO;YAEtB,qBAAqB;YACrBC,kBAAkBrC,MAAMqC,gBAAgB;YACxCC,oBAAoBtC,MAAMsC,kBAAkB;YAC5CC,qBAAqBvC,MAAMuC,mBAAmB;YAE9C,mBAAmB;YACnBC,UAAUxC,MAAMwC,QAAQ;YAExB,eAAe;YACfC,eAAezC,MAAMyC,aAAa;YAClCC,SAAS1C,MAAM0C,OAAO;YAEtB,eAAe;YACfC,SAAS3C,MAAM2C,OAAO;YACtBC,QAAQ5C,MAAM4C,MAAM;YAEpB,GAAGtC,UAAU;QACf;IACF;AACF"}
1
+ {"version":3,"sources":["../../../../src/hooks/useTextField/useTextField.tsx"],"sourcesContent":["import { useId } from \"react\";\nimport { spaceDelimitedList } from \"../../utils/spaceDelimitedList\";\nimport { useLabel } from \"../useLabel/useLabel\";\nimport { UseTextFieldProps, UseTextFieldReturn } from \"./types\";\n\nexport function useTextField(props: UseTextFieldProps): UseTextFieldReturn {\n const {\n isDisabled = false,\n isReadOnly = false,\n isRequired = false,\n inputElementType = \"input\",\n } = props;\n const { labelProps, fieldProps } = useLabel(props);\n\n const descriptionId = useId();\n const descriptionProps = { id: descriptionId };\n\n const errorMessageId = useId();\n const errorMessageProps = { id: errorMessageId };\n\n const ariaDescribedBy = spaceDelimitedList([\n props.description && descriptionId,\n props.errorMessage && errorMessageId,\n props[\"aria-describedby\"],\n ]);\n\n return {\n descriptionProps,\n errorMessageProps,\n labelProps,\n inputProps: {\n defaultValue: props.defaultValue,\n value: props.value,\n onChange: props.onChange,\n disabled: isDisabled,\n readOnly: isReadOnly,\n \"aria-required\": isRequired === true ? true : undefined,\n \"aria-invalid\": props.isInvalid,\n \"aria-describedby\": ariaDescribedBy,\n \"aria-errormessage\": props[\"aria-errormessage\"],\n\n type: inputElementType === \"input\" ? props.type : undefined,\n pattern: inputElementType === \"input\" ? props.pattern : undefined,\n\n autoComplete: props.autoComplete,\n maxLength: props.maxLength,\n minLength: props.minLength,\n name: props.name,\n placeholder: props.placeholder,\n inputMode: props.inputMode,\n\n // Clipboard events\n onCopy: props.onCopy,\n onCut: props.onCut,\n onPaste: props.onPaste,\n\n // Composition events\n onCompositionEnd: props.onCompositionEnd,\n onCompositionStart: props.onCompositionStart,\n onCompositionUpdate: props.onCompositionUpdate,\n\n // Selection events\n onSelect: props.onSelect,\n\n // Input events\n onBeforeInput: props.onBeforeInput,\n onInput: props.onInput,\n\n // Focus events\n onFocus: props.onFocus,\n onBlur: props.onBlur,\n\n ...fieldProps,\n },\n };\n}\n"],"names":["useTextField","props","isDisabled","isReadOnly","isRequired","inputElementType","labelProps","fieldProps","useLabel","descriptionId","useId","descriptionProps","id","errorMessageId","errorMessageProps","ariaDescribedBy","spaceDelimitedList","description","errorMessage","inputProps","defaultValue","value","onChange","disabled","readOnly","undefined","isInvalid","type","pattern","autoComplete","maxLength","minLength","name","placeholder","inputMode","onCopy","onCut","onPaste","onCompositionEnd","onCompositionStart","onCompositionUpdate","onSelect","onBeforeInput","onInput","onFocus","onBlur"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAKgBA;;;eAAAA;;;uBALM;oCACa;0BACV;AAGlB,SAASA,aAAaC,KAAwB;IACnD,MAAM,EACJC,aAAa,KAAK,EAClBC,aAAa,KAAK,EAClBC,aAAa,KAAK,EAClBC,mBAAmB,OAAO,EAC3B,GAAGJ;IACJ,MAAM,EAAEK,UAAU,EAAEC,UAAU,EAAE,GAAGC,IAAAA,kBAAQ,EAACP;IAE5C,MAAMQ,gBAAgBC,IAAAA,YAAK;IAC3B,MAAMC,mBAAmB;QAAEC,IAAIH;IAAc;IAE7C,MAAMI,iBAAiBH,IAAAA,YAAK;IAC5B,MAAMI,oBAAoB;QAAEF,IAAIC;IAAe;IAE/C,MAAME,kBAAkBC,IAAAA,sCAAkB,EAAC;QACzCf,MAAMgB,WAAW,IAAIR;QACrBR,MAAMiB,YAAY,IAAIL;QACtBZ,KAAK,CAAC,mBAAmB;KAC1B;IAED,OAAO;QACLU;QACAG;QACAR;QACAa,YAAY;YACVC,cAAcnB,MAAMmB,YAAY;YAChCC,OAAOpB,MAAMoB,KAAK;YAClBC,UAAUrB,MAAMqB,QAAQ;YACxBC,UAAUrB;YACVsB,UAAUrB;YACV,iBAAiBC,eAAe,OAAO,OAAOqB;YAC9C,gBAAgBxB,MAAMyB,SAAS;YAC/B,oBAAoBX;YACpB,qBAAqBd,KAAK,CAAC,oBAAoB;YAE/C0B,MAAMtB,qBAAqB,UAAUJ,MAAM0B,IAAI,GAAGF;YAClDG,SAASvB,qBAAqB,UAAUJ,MAAM2B,OAAO,GAAGH;YAExDI,cAAc5B,MAAM4B,YAAY;YAChCC,WAAW7B,MAAM6B,SAAS;YAC1BC,WAAW9B,MAAM8B,SAAS;YAC1BC,MAAM/B,MAAM+B,IAAI;YAChBC,aAAahC,MAAMgC,WAAW;YAC9BC,WAAWjC,MAAMiC,SAAS;YAE1B,mBAAmB;YACnBC,QAAQlC,MAAMkC,MAAM;YACpBC,OAAOnC,MAAMmC,KAAK;YAClBC,SAASpC,MAAMoC,OAAO;YAEtB,qBAAqB;YACrBC,kBAAkBrC,MAAMqC,gBAAgB;YACxCC,oBAAoBtC,MAAMsC,kBAAkB;YAC5CC,qBAAqBvC,MAAMuC,mBAAmB;YAE9C,mBAAmB;YACnBC,UAAUxC,MAAMwC,QAAQ;YAExB,eAAe;YACfC,eAAezC,MAAMyC,aAAa;YAClCC,SAAS1C,MAAM0C,OAAO;YAEtB,eAAe;YACfC,SAAS3C,MAAM2C,OAAO;YACtBC,QAAQ5C,MAAM4C,MAAM;YAEpB,GAAGtC,UAAU;QACf;IACF;AACF"}
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ _export_star(require("./useValidationClasses"), exports);
6
+ function _export_star(from, to) {
7
+ Object.keys(from).forEach(function(k) {
8
+ if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
9
+ Object.defineProperty(to, k, {
10
+ enumerable: true,
11
+ get: function() {
12
+ return from[k];
13
+ }
14
+ });
15
+ }
16
+ });
17
+ return from;
18
+ }
19
+
20
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/hooks/useValidationClasses/index.ts"],"sourcesContent":["export * from \"./useValidationClasses\";\n"],"names":[],"rangeMappings":";;;;","mappings":";;;;qBAAc"}
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "useValidationClasses", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return useValidationClasses;
9
+ }
10
+ });
11
+ const _useDeprecationWarning = require("../useDeprecationWarning");
12
+ const useValidationClasses = (props)=>{
13
+ const { validationState, isInvalid } = props;
14
+ (0, _useDeprecationWarning.useDeprecationWarning)({
15
+ validationState
16
+ });
17
+ if (isInvalid || validationState === "invalid") {
18
+ return "--is-invalid";
19
+ }
20
+ if (isInvalid === false || validationState === "valid") {
21
+ return "--is-valid";
22
+ }
23
+ return "";
24
+ };
25
+
26
+ //# sourceMappingURL=useValidationClasses.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/hooks/useValidationClasses/useValidationClasses.ts"],"sourcesContent":["import { Validation } from \"../../types\";\nimport { useDeprecationWarning } from \"../useDeprecationWarning\";\n\nexport type GetValidationClassesProps = Pick<\n Validation,\n \"validationState\" | \"isInvalid\"\n>;\n\nexport const useValidationClasses = (props: GetValidationClassesProps) => {\n const { validationState, isInvalid } = props;\n\n useDeprecationWarning({ validationState });\n\n if (isInvalid || validationState === \"invalid\") {\n return \"--is-invalid\";\n }\n\n if (isInvalid === false || validationState === \"valid\") {\n return \"--is-valid\";\n }\n\n return \"\";\n};\n"],"names":["useValidationClasses","props","validationState","isInvalid","useDeprecationWarning"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAQaA;;;eAAAA;;;uCAPyB;AAO/B,MAAMA,uBAAuB,CAACC;IACnC,MAAM,EAAEC,eAAe,EAAEC,SAAS,EAAE,GAAGF;IAEvCG,IAAAA,4CAAqB,EAAC;QAAEF;IAAgB;IAExC,IAAIC,aAAaD,oBAAoB,WAAW;QAC9C,OAAO;IACT;IAEA,IAAIC,cAAc,SAASD,oBAAoB,SAAS;QACtD,OAAO;IACT;IAEA,OAAO;AACT"}