@pega/cosmos-react-core 3.0.0-dev.12.0 → 3.0.0-dev.13.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 (111) hide show
  1. package/lib/components/AppShell/AppHeader.d.ts.map +1 -1
  2. package/lib/components/AppShell/AppHeader.js +13 -3
  3. package/lib/components/AppShell/AppHeader.js.map +1 -1
  4. package/lib/components/AppShell/AppShell.d.ts.map +1 -1
  5. package/lib/components/AppShell/AppShell.js +8 -4
  6. package/lib/components/AppShell/AppShell.js.map +1 -1
  7. package/lib/components/AppShell/AppShell.styles.d.ts +1 -0
  8. package/lib/components/AppShell/AppShell.styles.d.ts.map +1 -1
  9. package/lib/components/AppShell/AppShell.styles.js +62 -77
  10. package/lib/components/AppShell/AppShell.styles.js.map +1 -1
  11. package/lib/components/AppShell/AppShell.types.d.ts +3 -0
  12. package/lib/components/AppShell/AppShell.types.d.ts.map +1 -1
  13. package/lib/components/AppShell/AppShell.types.js.map +1 -1
  14. package/lib/components/AppShell/AppShellContext.d.ts +3 -1
  15. package/lib/components/AppShell/AppShellContext.d.ts.map +1 -1
  16. package/lib/components/AppShell/AppShellContext.js +3 -1
  17. package/lib/components/AppShell/AppShellContext.js.map +1 -1
  18. package/lib/components/CompositeInput/CompositeInput.d.ts +5 -0
  19. package/lib/components/CompositeInput/CompositeInput.d.ts.map +1 -0
  20. package/lib/components/CompositeInput/CompositeInput.js +59 -0
  21. package/lib/components/CompositeInput/CompositeInput.js.map +1 -0
  22. package/lib/components/CompositeInput/CompositeInput.styles.d.ts +5 -0
  23. package/lib/components/CompositeInput/CompositeInput.styles.d.ts.map +1 -0
  24. package/lib/components/CompositeInput/CompositeInput.styles.js +54 -0
  25. package/lib/components/CompositeInput/CompositeInput.styles.js.map +1 -0
  26. package/lib/components/CompositeInput/CompositeInput.types.d.ts +50 -0
  27. package/lib/components/CompositeInput/CompositeInput.types.d.ts.map +1 -0
  28. package/lib/components/CompositeInput/CompositeInput.types.js +2 -0
  29. package/lib/components/CompositeInput/CompositeInput.types.js.map +1 -0
  30. package/lib/components/CompositeInput/index.d.ts +3 -0
  31. package/lib/components/CompositeInput/index.d.ts.map +1 -0
  32. package/lib/components/CompositeInput/index.js +2 -0
  33. package/lib/components/CompositeInput/index.js.map +1 -0
  34. package/lib/components/Currency/utils.js +2 -2
  35. package/lib/components/Currency/utils.js.map +1 -1
  36. package/lib/components/FieldGroup/FieldGroup.d.ts.map +1 -1
  37. package/lib/components/FieldGroup/FieldGroup.js +3 -2
  38. package/lib/components/FieldGroup/FieldGroup.js.map +1 -1
  39. package/lib/components/FieldGroup/FieldGroupList.d.ts.map +1 -1
  40. package/lib/components/FieldGroup/FieldGroupList.js +6 -2
  41. package/lib/components/FieldGroup/FieldGroupList.js.map +1 -1
  42. package/lib/components/Form/Form.d.ts +5 -16
  43. package/lib/components/Form/Form.d.ts.map +1 -1
  44. package/lib/components/Form/Form.js +14 -11
  45. package/lib/components/Form/Form.js.map +1 -1
  46. package/lib/components/Icon/Icon.d.ts.map +1 -1
  47. package/lib/components/Icon/Icon.js +1 -1
  48. package/lib/components/Icon/Icon.js.map +1 -1
  49. package/lib/components/MultiStepForm/FormProgress.d.ts +10 -0
  50. package/lib/components/MultiStepForm/FormProgress.d.ts.map +1 -0
  51. package/lib/components/{MultiStep/MultiStep.js → MultiStepForm/FormProgress.js} +8 -22
  52. package/lib/components/MultiStepForm/FormProgress.js.map +1 -0
  53. package/lib/components/{MultiStep/MultiStep.styles.d.ts → MultiStepForm/FormProgress.styles.d.ts} +2 -4
  54. package/lib/components/MultiStepForm/FormProgress.styles.d.ts.map +1 -0
  55. package/lib/components/{MultiStep/MultiStep.styles.js → MultiStepForm/FormProgress.styles.js} +2 -4
  56. package/lib/components/MultiStepForm/FormProgress.styles.js.map +1 -0
  57. package/lib/components/MultiStepForm/MultiStepForm.d.ts +9 -0
  58. package/lib/components/MultiStepForm/MultiStepForm.d.ts.map +1 -0
  59. package/lib/components/MultiStepForm/MultiStepForm.js +50 -0
  60. package/lib/components/MultiStepForm/MultiStepForm.js.map +1 -0
  61. package/lib/components/MultiStepForm/MultiStepForm.types.d.ts +49 -0
  62. package/lib/components/MultiStepForm/MultiStepForm.types.d.ts.map +1 -0
  63. package/lib/components/MultiStepForm/MultiStepForm.types.js +2 -0
  64. package/lib/components/MultiStepForm/MultiStepForm.types.js.map +1 -0
  65. package/lib/components/MultiStepForm/index.d.ts +2 -0
  66. package/lib/components/MultiStepForm/index.d.ts.map +1 -0
  67. package/lib/components/MultiStepForm/index.js +2 -0
  68. package/lib/components/MultiStepForm/index.js.map +1 -0
  69. package/lib/components/Number/NumberDisplay.d.ts +0 -5
  70. package/lib/components/Number/NumberDisplay.d.ts.map +1 -1
  71. package/lib/components/Number/NumberDisplay.js +8 -12
  72. package/lib/components/Number/NumberDisplay.js.map +1 -1
  73. package/lib/components/Number/NumberInput.d.ts.map +1 -1
  74. package/lib/components/Number/NumberInput.js +8 -5
  75. package/lib/components/Number/NumberInput.js.map +1 -1
  76. package/lib/components/Number/utils.d.ts +1 -4
  77. package/lib/components/Number/utils.d.ts.map +1 -1
  78. package/lib/components/Number/utils.js +5 -3
  79. package/lib/components/Number/utils.js.map +1 -1
  80. package/lib/components/SearchInput/SearchInput.d.ts.map +1 -1
  81. package/lib/components/SearchInput/SearchInput.js +5 -1
  82. package/lib/components/SearchInput/SearchInput.js.map +1 -1
  83. package/lib/components/Tabs/Tab.d.ts.map +1 -1
  84. package/lib/components/Tabs/Tab.js +0 -1
  85. package/lib/components/Tabs/Tab.js.map +1 -1
  86. package/lib/hooks/useI18n.d.ts +11 -7
  87. package/lib/hooks/useI18n.d.ts.map +1 -1
  88. package/lib/i18n/default.d.ts +11 -7
  89. package/lib/i18n/default.d.ts.map +1 -1
  90. package/lib/i18n/default.js +13 -7
  91. package/lib/i18n/default.js.map +1 -1
  92. package/lib/i18n/i18n.d.ts +22 -14
  93. package/lib/i18n/i18n.d.ts.map +1 -1
  94. package/lib/index.d.ts +2 -2
  95. package/lib/index.d.ts.map +1 -1
  96. package/lib/index.js +2 -2
  97. package/lib/index.js.map +1 -1
  98. package/package.json +1 -1
  99. package/lib/components/MultiStep/MultiStep.d.ts +0 -6
  100. package/lib/components/MultiStep/MultiStep.d.ts.map +0 -1
  101. package/lib/components/MultiStep/MultiStep.js.map +0 -1
  102. package/lib/components/MultiStep/MultiStep.styles.d.ts.map +0 -1
  103. package/lib/components/MultiStep/MultiStep.styles.js.map +0 -1
  104. package/lib/components/MultiStep/MultiStep.types.d.ts +0 -36
  105. package/lib/components/MultiStep/MultiStep.types.d.ts.map +0 -1
  106. package/lib/components/MultiStep/MultiStep.types.js +0 -2
  107. package/lib/components/MultiStep/MultiStep.types.js.map +0 -1
  108. package/lib/components/MultiStep/index.d.ts +0 -3
  109. package/lib/components/MultiStep/index.d.ts.map +0 -1
  110. package/lib/components/MultiStep/index.js +0 -2
  111. package/lib/components/MultiStep/index.js.map +0 -1
@@ -0,0 +1,50 @@
1
+ import { ComponentType, Ref } from 'react';
2
+ import { BaseProps, DeferInfer, NoChildrenProp } from '../../types';
3
+ import { FormControlProps } from '../FormControl';
4
+ export interface CompositeInputProps<P extends object = object> extends BaseProps, NoChildrenProp {
5
+ /**
6
+ * Sets DOM id for the control and associates label element via 'for' attribute.
7
+ * If an id is not pass, a random id will be generated for any render.
8
+ */
9
+ id?: FormControlProps['id'];
10
+ /** Set visual state based on a validation state. */
11
+ status?: FormControlProps['status'];
12
+ /** Pass a string or a fragment with an Icon and string. */
13
+ label?: FormControlProps['label'];
14
+ /** Visually hides the label region. */
15
+ labelHidden?: FormControlProps['labelHidden'];
16
+ /** It is recommended to pass a simple string to offer guidance. Text will be styled based on status prop. */
17
+ info?: FormControlProps['info'];
18
+ /** Indicate if the field is required. The browser defaults to false. */
19
+ required?: FormControlProps['required'];
20
+ /** Disable the control. The browser defaults to false. */
21
+ disabled?: FormControlProps['disabled'];
22
+ /** Callback when clear button is clicked. */
23
+ onClear: () => void;
24
+ /** String representation of the complex value. */
25
+ value?: string;
26
+ /** Text visible when on value has been set. */
27
+ placeholder?: FormControlProps['placeholder'];
28
+ /** Value form options. */
29
+ dialog: {
30
+ /**
31
+ * A component to render the main portion of the form.
32
+ */
33
+ renderer: ComponentType<P>;
34
+ /**
35
+ * A props object that will be passed to the form renderer.
36
+ */
37
+ rendererProps?: DeferInfer<P>;
38
+ /** Callback when cancel button is clicked. */
39
+ onCancel: ({ close }: {
40
+ close: () => void;
41
+ }) => void;
42
+ /** Callback when apply button is clicked. */
43
+ onApply: ({ close }: {
44
+ close: () => void;
45
+ }) => void;
46
+ };
47
+ /** Ref forwarded to the wrapping element. */
48
+ ref?: Ref<HTMLDivElement>;
49
+ }
50
+ //# sourceMappingURL=CompositeInput.types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CompositeInput.types.d.ts","sourceRoot":"","sources":["../../../src/components/CompositeInput/CompositeInput.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAE3C,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AACpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAElD,MAAM,WAAW,mBAAmB,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,CAAE,SAAQ,SAAS,EAAE,cAAc;IAC/F;;;OAGG;IACH,EAAE,CAAC,EAAE,gBAAgB,CAAC,IAAI,CAAC,CAAC;IAC5B,oDAAoD;IACpD,MAAM,CAAC,EAAE,gBAAgB,CAAC,QAAQ,CAAC,CAAC;IACpC,2DAA2D;IAC3D,KAAK,CAAC,EAAE,gBAAgB,CAAC,OAAO,CAAC,CAAC;IAClC,uCAAuC;IACvC,WAAW,CAAC,EAAE,gBAAgB,CAAC,aAAa,CAAC,CAAC;IAC9C,6GAA6G;IAC7G,IAAI,CAAC,EAAE,gBAAgB,CAAC,MAAM,CAAC,CAAC;IAChC,wEAAwE;IACxE,QAAQ,CAAC,EAAE,gBAAgB,CAAC,UAAU,CAAC,CAAC;IACxC,0DAA0D;IAC1D,QAAQ,CAAC,EAAE,gBAAgB,CAAC,UAAU,CAAC,CAAC;IACxC,6CAA6C;IAC7C,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,kDAAkD;IAClD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,+CAA+C;IAC/C,WAAW,CAAC,EAAE,gBAAgB,CAAC,aAAa,CAAC,CAAC;IAC9C,0BAA0B;IAC1B,MAAM,EAAE;QACN;;WAEG;QACH,QAAQ,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC;QAC3B;;WAEG;QACH,aAAa,CAAC,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC;QAC9B,8CAA8C;QAC9C,QAAQ,EAAE,CAAC,EAAE,KAAK,EAAE,EAAE;YAAE,KAAK,EAAE,MAAM,IAAI,CAAA;SAAE,KAAK,IAAI,CAAC;QACrD,6CAA6C;QAC7C,OAAO,EAAE,CAAC,EAAE,KAAK,EAAE,EAAE;YAAE,KAAK,EAAE,MAAM,IAAI,CAAA;SAAE,KAAK,IAAI,CAAC;KACrD,CAAC;IACF,6CAA6C;IAC7C,GAAG,CAAC,EAAE,GAAG,CAAC,cAAc,CAAC,CAAC;CAC3B"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=CompositeInput.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CompositeInput.types.js","sourceRoot":"","sources":["../../../src/components/CompositeInput/CompositeInput.types.ts"],"names":[],"mappings":"","sourcesContent":["import { ComponentType, Ref } from 'react';\n\nimport { BaseProps, DeferInfer, NoChildrenProp } from '../../types';\nimport { FormControlProps } from '../FormControl';\n\nexport interface CompositeInputProps<P extends object = object> extends BaseProps, NoChildrenProp {\n /**\n * Sets DOM id for the control and associates label element via 'for' attribute.\n * If an id is not pass, a random id will be generated for any render.\n */\n id?: FormControlProps['id'];\n /** Set visual state based on a validation state. */\n status?: FormControlProps['status'];\n /** Pass a string or a fragment with an Icon and string. */\n label?: FormControlProps['label'];\n /** Visually hides the label region. */\n labelHidden?: FormControlProps['labelHidden'];\n /** It is recommended to pass a simple string to offer guidance. Text will be styled based on status prop. */\n info?: FormControlProps['info'];\n /** Indicate if the field is required. The browser defaults to false. */\n required?: FormControlProps['required'];\n /** Disable the control. The browser defaults to false. */\n disabled?: FormControlProps['disabled'];\n /** Callback when clear button is clicked. */\n onClear: () => void;\n /** String representation of the complex value. */\n value?: string;\n /** Text visible when on value has been set. */\n placeholder?: FormControlProps['placeholder'];\n /** Value form options. */\n dialog: {\n /**\n * A component to render the main portion of the form.\n */\n renderer: ComponentType<P>;\n /**\n * A props object that will be passed to the form renderer.\n */\n rendererProps?: DeferInfer<P>;\n /** Callback when cancel button is clicked. */\n onCancel: ({ close }: { close: () => void }) => void;\n /** Callback when apply button is clicked. */\n onApply: ({ close }: { close: () => void }) => void;\n };\n /** Ref forwarded to the wrapping element. */\n ref?: Ref<HTMLDivElement>;\n}\n"]}
@@ -0,0 +1,3 @@
1
+ export { default as CompositeInput } from './CompositeInput';
2
+ export { CompositeInputProps } from './CompositeInput.types';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/CompositeInput/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { default as CompositeInput } from './CompositeInput';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/CompositeInput/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,kBAAkB,CAAC","sourcesContent":["export { default as CompositeInput } from './CompositeInput';\nexport { CompositeInputProps } from './CompositeInput.types';\n"]}
@@ -13,8 +13,8 @@ export const isValidCurrency = (currency) => {
13
13
  export const getFormattedValue = (value, locale, currency, { showGroupSeparators = true, showAs = 'code', numberOfDecimals } = {}) => {
14
14
  if (!currency)
15
15
  return getNumberFormattedValue(value, locale, undefined, {
16
- showGroupSeparators,
17
- numberOfDecimals
16
+ useGrouping: showGroupSeparators,
17
+ maximumFractionDigits: numberOfDecimals
18
18
  });
19
19
  const isCurrency = isValidCurrency(currency);
20
20
  const [integer, fractionPart] = value.split('.', 2);
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/components/Currency/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AACxE,OAAO,EAAE,iBAAiB,IAAI,uBAAuB,EAAE,MAAM,iBAAiB,CAAC;AAE/E,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,QAAgB,EAAE,EAAE;IAClD,IAAI;QACF,kCAAkC;QAClC,IAAI,IAAI,CAAC,YAAY,CAAC,SAAS,EAAE,EAAE,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,CAAC,CAAC;QAClE,OAAO,IAAI,CAAC;KACb;IAAC,MAAM;QACN,OAAO,KAAK,CAAC;KACd;AACH,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAC/B,KAAa,EACb,MAAc,EACd,QAAiB,EACjB,EACE,mBAAmB,GAAG,IAAI,EAC1B,MAAM,GAAG,MAAM,EACf,gBAAgB,KAC4E,EAAE,EAChG,EAAE;IACF,IAAI,CAAC,QAAQ;QACX,OAAO,uBAAuB,CAAC,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE;YACvD,mBAAmB;YACnB,gBAAgB;SACjB,CAAC,CAAC;IAEL,MAAM,UAAU,GAAG,eAAe,CAAC,QAAQ,CAAC,CAAC;IAC7C,MAAM,CAAC,OAA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CAAC,UAAU,EAAE,WAAW,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC,CAAC,MAAM,EACnE,EAAE,CACH,CAAC;KACL;IACD,OAAO,SAAS,CAAC;AACnB,CAAC,CAAC;AAEF,MAAM,UAAU,gCAAgC,CAAC,MAAc,EAAE,eAAwB;IACvF,OAAO,eAAe;QACpB,CAAC,CAAC,IAAI,IAAI,CAAC,YAAY,CAAC,MAAM,EAAE;YAC5B,KAAK,EAAE,UAAU;YACjB,QAAQ,EAAE,eAAe;SAC1B,CAAC,CAAC,eAAe,EAAE,CAAC,qBAAqB;QAC5C,CAAC,CAAC,yBAAyB,CAAC;AAChC,CAAC;AAOD,MAAM,UAAU,cAAc,CAAC,KAAsB,EAAE,EAAE,MAAM,EAAE,OAAO,EAAyB;IAC/F,MAAM,SAAS,GAAG,IAAI,IAAI,CAAC,YAAY,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAEzD,OAAO,SAAS,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AACjC,CAAC","sourcesContent":["import { NUMBER_MAX_DECIMAL_PLACES } from '../Number/NumberInput.types';\nimport { getFormattedValue as getNumberFormattedValue } from '../Number/utils';\n\nexport const isValidCurrency = (currency: string) => {\n try {\n // eslint-disable-next-line no-new\n new Intl.NumberFormat(undefined, { style: 'currency', currency });\n return true;\n } catch {\n return false;\n }\n};\n\nexport const getFormattedValue = (\n value: string,\n locale: string,\n currency?: string,\n {\n showGroupSeparators = true,\n showAs = 'code',\n numberOfDecimals\n }: { showGroupSeparators?: boolean; showAs?: 'code' | 'symbol'; numberOfDecimals?: number } = {}\n) => {\n if (!currency)\n return getNumberFormattedValue(value, locale, undefined, {\n showGroupSeparators,\n numberOfDecimals\n });\n\n const isCurrency = isValidCurrency(currency);\n const [integer, fractionPart] = value.split('.', 2) as [string, string?];\n\n const formatter = new Intl.NumberFormat(locale, {\n useGrouping: showGroupSeparators,\n maximumFractionDigits: numberOfDecimals,\n minimumFractionDigits: numberOfDecimals,\n ...(isCurrency\n ? {\n style: 'currency',\n currency,\n currencyDisplay: showAs\n }\n : {})\n });\n\n let formatted = value;\n\n if (value && !Number.isNaN(parseFloat(integer))) {\n const endsWithDot = fractionPart === '';\n const valueNumber = Number(endsWithDot ? `${value}1` : value);\n formatted = formatter.formatToParts(valueNumber).reduce((result, { type, value: part }) => {\n if (type === 'fraction' && endsWithDot) return result;\n return result + part;\n }, '');\n } else if (currency) {\n formatted = formatter\n .formatToParts(value.startsWith('-') ? -1 : 1)\n .reduce(\n (result, { type, value: part }) =>\n ['currency', 'minusSign'].includes(type) ? result + part : result,\n ''\n );\n }\n return formatted;\n};\n\nexport function getCurrencyMaximumFractionDigits(locale: string, currencyISOCode?: string): number {\n return currencyISOCode\n ? new Intl.NumberFormat(locale, {\n style: 'currency',\n currency: currencyISOCode\n }).resolvedOptions().maximumFractionDigits\n : NUMBER_MAX_DECIMAL_PLACES;\n}\n\ninterface CurrencyFormatOptions {\n locale: string;\n options?: Intl.NumberFormatOptions;\n}\n\nexport function formatCurrency(value: number | bigint, { locale, options }: CurrencyFormatOptions) {\n const formatter = new Intl.NumberFormat(locale, options);\n\n return formatter.format(value);\n}\n"]}
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/components/Currency/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AACxE,OAAO,EAAE,iBAAiB,IAAI,uBAAuB,EAAE,MAAM,iBAAiB,CAAC;AAE/E,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,QAAgB,EAAE,EAAE;IAClD,IAAI;QACF,kCAAkC;QAClC,IAAI,IAAI,CAAC,YAAY,CAAC,SAAS,EAAE,EAAE,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,CAAC,CAAC;QAClE,OAAO,IAAI,CAAC;KACb;IAAC,MAAM;QACN,OAAO,KAAK,CAAC;K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AAI,EAAE,EAAE,EAAE;YACxF,IAAI,IAAI,KAAK,UAAU,IAAI,WAAW;gBAAE,OAAO,MAAM,CAAC;YACtD,OAAO,MAAM,GAAG,IAAI,CAAC;QACvB,CAAC,EAAE,EAAE,CAAC,CAAC;KACR;SAAM,IAAI,QAAQ,EAAE;QACnB,SAAS,GAAG,SAAS;aAClB,aAAa,CAAC,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;aAC7C,MAAM,CACL,CAAC,MAAM,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE,EAAE,CAChC,CAAC,UAAU,EAAE,WAAW,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC,CAAC,MAAM,EACnE,EAAE,CACH,CAAC;KACL;IACD,OAAO,SAAS,CAAC;AACnB,CAAC,CAAC;AAEF,MAAM,UAAU,gCAAgC,CAAC,MAAc,EAAE,eAAwB;IACvF,OAAO,eAAe;QACpB,CAAC,CAAC,IAAI,IAAI,CAAC,YAAY,CAAC,MAAM,EAAE;YAC5B,KAAK,EAAE,UAAU;YACjB,QAAQ,EAAE,eAAe;SAC1B,CAAC,CAAC,eAAe,EAAE,CAAC,qBAAqB;QAC5C,CAAC,CAAC,yBAAyB,CAAC;AAChC,CAAC;AAOD,MAAM,UAAU,cAAc,CAAC,KAAsB,EAAE,EAAE,MAAM,EAAE,OAAO,EAAyB;IAC/F,MAAM,SAAS,GAAG,IAAI,IAAI,CAAC,YAAY,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAEzD,OAAO,SAAS,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AACjC,CAAC","sourcesContent":["import { NUMBER_MAX_DECIMAL_PLACES } from '../Number/NumberInput.types';\nimport { getFormattedValue as getNumberFormattedValue } from '../Number/utils';\n\nexport const isValidCurrency = (currency: string) => {\n try {\n // eslint-disable-next-line no-new\n new Intl.NumberFormat(undefined, { style: 'currency', currency });\n return true;\n } catch {\n return false;\n }\n};\n\nexport const getFormattedValue = (\n value: string,\n locale: string,\n currency?: string,\n {\n showGroupSeparators = true,\n showAs = 'code',\n numberOfDecimals\n }: { showGroupSeparators?: boolean; showAs?: 'code' | 'symbol'; numberOfDecimals?: number } = {}\n) => {\n if (!currency)\n return getNumberFormattedValue(value, locale, undefined, {\n useGrouping: showGroupSeparators,\n maximumFractionDigits: numberOfDecimals\n });\n\n const isCurrency = isValidCurrency(currency);\n const [integer, fractionPart] = value.split('.', 2) as [string, string?];\n\n const formatter = new Intl.NumberFormat(locale, {\n useGrouping: showGroupSeparators,\n maximumFractionDigits: numberOfDecimals,\n minimumFractionDigits: numberOfDecimals,\n ...(isCurrency\n ? {\n style: 'currency',\n currency,\n currencyDisplay: showAs\n }\n : {})\n });\n\n let formatted = value;\n\n if (value && !Number.isNaN(parseFloat(integer))) {\n const endsWithDot = fractionPart === '';\n const valueNumber = Number(endsWithDot ? `${value}1` : value);\n formatted = formatter.formatToParts(valueNumber).reduce((result, { type, value: part }) => {\n if (type === 'fraction' && endsWithDot) return result;\n return result + part;\n }, '');\n } else if (currency) {\n formatted = formatter\n .formatToParts(value.startsWith('-') ? -1 : 1)\n .reduce(\n (result, { type, value: part }) =>\n ['currency', 'minusSign'].includes(type) ? result + part : result,\n ''\n );\n }\n return formatted;\n};\n\nexport function getCurrencyMaximumFractionDigits(locale: string, currencyISOCode?: string): number {\n return currencyISOCode\n ? new Intl.NumberFormat(locale, {\n style: 'currency',\n currency: currencyISOCode\n }).resolvedOptions().maximumFractionDigits\n : NUMBER_MAX_DECIMAL_PLACES;\n}\n\ninterface CurrencyFormatOptions {\n locale: string;\n options?: Intl.NumberFormatOptions;\n}\n\nexport function formatCurrency(value: number | bigint, { locale, options }: CurrencyFormatOptions) {\n const formatter = new Intl.NumberFormat(locale, options);\n\n return formatter.format(value);\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"FieldGroup.d.ts","sourceRoot":"","sources":["../../../src/components/FieldGroup/FieldGroup.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAwB,iBAAiB,EAAmB,GAAG,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AASjG,OAAgB,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAEnD,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAMtD,MAAM,WAAW,eAAgB,SAAQ,SAAS;IAChD,sCAAsC;IACtC,QAAQ,EAAE,SAAS,CAAC;IACpB,2EAA2E;IAC3E,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;OAGG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;;OAGG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,gDAAgD;IAChD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,gDAAgD;IAChD,OAAO,CAAC,EAAE,YAAY,CAAC,OAAO,CAAC,CAAC;IAChC,2CAA2C;IAC3C,GAAG,CAAC,EAAE,GAAG,CAAC,mBAAmB,CAAC,CAAC;CAChC;AAQD,eAAO,MAAM,sBAAsB;UAAyB,OAAO;SAsClE,CAAC;AAIF,eAAO,MAAM,gBAAgB,8GAqC5B,CAAC;AAoBF,QAAA,MAAM,UAAU,EAAE,iBAAiB,CAAC,eAAe,GAAG,YAAY,CAgEjE,CAAC;AAEF,eAAe,UAAU,CAAC"}
1
+ {"version":3,"file":"FieldGroup.d.ts","sourceRoot":"","sources":["../../../src/components/FieldGroup/FieldGroup.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAwB,iBAAiB,EAAmB,GAAG,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AASjG,OAAgB,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAEnD,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAMtD,MAAM,WAAW,eAAgB,SAAQ,SAAS;IAChD,sCAAsC;IACtC,QAAQ,EAAE,SAAS,CAAC;IACpB,2EAA2E;IAC3E,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;OAGG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;;OAGG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,gDAAgD;IAChD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,gDAAgD;IAChD,OAAO,CAAC,EAAE,YAAY,CAAC,OAAO,CAAC,CAAC;IAChC,2CAA2C;IAC3C,GAAG,CAAC,EAAE,GAAG,CAAC,mBAAmB,CAAC,CAAC;CAChC;AAQD,eAAO,MAAM,sBAAsB;UAAyB,OAAO;SAsClE,CAAC;AAIF,eAAO,MAAM,gBAAgB,8GAsC5B,CAAC;AAoBF,QAAA,MAAM,UAAU,EAAE,iBAAiB,CAAC,eAAe,GAAG,YAAY,CAgEjE,CAAC;AAEF,eAAe,UAAU,CAAC"}
@@ -32,7 +32,7 @@ export const StyledFieldGroupLegend = styled.legend(({ open, theme: { base: { sp
32
32
  transform: rotate(0);
33
33
  }
34
34
 
35
- > ${StyledFlex} {
35
+ > ${StyledFlex} ${StyledButton} {
36
36
  min-height: ${hitAreaMouse};
37
37
 
38
38
  @media (pointer: 'coarse') {
@@ -41,10 +41,11 @@ export const StyledFieldGroupLegend = styled.legend(({ open, theme: { base: { sp
41
41
  }
42
42
  `);
43
43
  StyledFieldGroupLegend.defaultProps = defaultThemeProp;
44
- export const StyledFieldGroup = styled.fieldset(({ theme: { base: { 'font-size': fontSize, 'font-scale': fontScale }, components: { text } } }) => {
44
+ export const StyledFieldGroup = styled.fieldset(({ theme: { base: { 'font-size': fontSize, 'font-scale': fontScale, spacing }, components: { text } } }) => {
45
45
  const fontSizes = calculateFontSize(fontSize, fontScale);
46
46
  return css `
47
47
  border: none;
48
+ margin-block-start: calc(3 * ${spacing});
48
49
 
49
50
  ${StyledFieldGroupLegend} ${StyledButton} {
50
51
  font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,GAAG,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC;oBACvB,CAAC,mBACc,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,gBAC1B,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,aAAa,EAAE,CAAC,IAAI,CAAC,CAAC,YAE7D,MAAC,IAAI,IACH,SAAS,EAAE,EAAE,SAAS,EAAE,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,GAAG,EAAE,GAAG,EAAE,EAC/D,WAAW,EAAC,MAAM,aAElB,KAAC,IAAI,IAAC,IAAI,EAAC,aAAa,GAAG,EAC3B,yBAAO,IAAI,GAAQ,IACd,GACA,CACV,CAAC,CAAC,CAAC,CACF,yBAAO,IAAI,GAAQ,CACpB,GACgB,CACpB,EACA,WAAW,CAAC,CAAC,CAAC,CACb,KAAC,cAAc,IAAC,SAAS,EAAE,CAAC,IAAI,YAAG,eAAe,GAAkB,CACrE,CAAC,CAAC,CAAC,CACF,eAAe,CAChB,IACgB,CACpB,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,UAAU,CAAC","sourcesContent":["import { forwardRef, useState, FunctionComponent, PropsWithoutRef, Ref, ReactNode } from 'react';\nimport styled, { css } from 'styled-components';\n\nimport Button, { StyledButton } from '../Button';\nimport ExpandCollapse from '../ExpandCollapse';\nimport Flex, { StyledFlex } from '../Flex';\nimport HTML from '../HTML';\nimport Icon, { StyledIcon, registerIcon } from '../Icon';\nimport * as caretRightIcon from '../Icon/icons/caret-right.icon';\nimport Actions, { ActionsProps } from '../Actions';\nimport { defaultThemeProp } from '../../theme';\nimport { BaseProps, ForwardProps } from '../../types';\nimport { useI18n, useUID } from '../../hooks';\nimport { calculateFontSize, FontSize } from '../../styles';\n\nregisterIcon(caretRightIcon);\n\nexport interface FieldGroupProps extends BaseProps {\n /** The content of the Field Group. */\n children: ReactNode;\n /** A description of the field group to be displayed above the controls. */\n description?: string;\n /**\n * If true, the Field Group will be able to collapse the content of its children by clicking on the name.\n * @default false\n */\n collapsible?: boolean;\n /**\n * If true, the Field Group will be collapsed on the first render.\n * @default false\n */\n defaultCollapsed?: boolean;\n /** The name associated with the Field Group. */\n name?: string;\n /** An array of actions to add to the header. */\n actions?: ActionsProps['items'];\n /** A reference to the wrapping element. */\n ref?: Ref<HTMLFieldSetElement>;\n}\n\ninterface FieldGroupLegendProps {\n open: boolean;\n actions?: ActionsProps['items'];\n children?: ReactNode;\n}\n\nexport const StyledFieldGroupLegend = styled.legend<{ open: boolean }>(\n ({\n open,\n theme: {\n base: {\n spacing,\n animation,\n 'hit-area': { 'mouse-min': hitAreaMouse, 'finger-min': hitAreaFinger }\n }\n }\n }) => css`\n width: 100%;\n margin-bottom: 0;\n ${open &&\n css`\n margin-block-end: calc(1.5 * ${spacing});\n `}\n transition: margin-block-end ${animation.speed} ${animation.timing.ease};\n\n button ${StyledIcon} {\n transition: transform ${animation.speed} ${animation.timing.ease};\n }\n\n button[aria-expanded='true'] ${StyledIcon} {\n transform: rotate(90deg);\n }\n button[aria-expanded='false'] ${StyledIcon} {\n transform: rotate(0);\n }\n\n > ${StyledFlex} {\n min-height: ${hitAreaMouse};\n\n @media (pointer: 'coarse') {\n min-height: ${hitAreaFinger};\n }\n }\n `\n);\n\nStyledFieldGroupLegend.defaultProps = defaultThemeProp;\n\nexport const StyledFieldGroup = styled.fieldset(\n ({\n theme: {\n base: { 'font-size': fontSize, 'font-scale': fontScale },\n components: { text }\n }\n }) => {\n const fontSizes = calculateFontSize(fontSize, fontScale);\n\n return css`\n border: none;\n\n ${StyledFieldGroupLegend} ${StyledButton} {\n font-weight: inherit;\n }\n\n & ${StyledFieldGroupLegend} {\n font-size: ${fontSizes[text.h3['font-size'] as FontSize]};\n font-weight: ${text.h3['font-weight']};\n }\n\n & & ${StyledFieldGroupLegend} {\n font-size: ${fontSizes[text.h4['font-size'] as FontSize]};\n font-weight: ${text.h4['font-weight']};\n }\n\n & & & ${StyledFieldGroupLegend} {\n font-size: ${fontSizes[text.h5['font-size'] as FontSize]};\n font-weight: ${text.h5['font-weight']};\n }\n\n & & & & ${StyledFieldGroupLegend} {\n font-size: ${fontSizes[text.h6['font-size'] as FontSize]};\n font-weight: ${text.h6['font-weight']};\n }\n `;\n }\n);\n\nStyledFieldGroup.defaultProps = defaultThemeProp;\n\nconst FieldGroupLegend: FunctionComponent<FieldGroupLegendProps> = ({\n children,\n open,\n actions,\n ...restProps\n}) => {\n return (\n <StyledFieldGroupLegend open={open} {...restProps}>\n <Flex container={{ alignItems: 'center', justify: 'between' }}>\n {children}\n {actions && <Actions items={actions} />}\n </Flex>\n </StyledFieldGroupLegend>\n );\n};\n\nconst FieldGroup: FunctionComponent<FieldGroupProps & ForwardProps> = forwardRef(\n (\n {\n children,\n description,\n name,\n actions,\n collapsible = false,\n defaultCollapsed = false,\n ...restProps\n }: PropsWithoutRef<FieldGroupProps>,\n ref: FieldGroupProps['ref']\n ) => {\n const [open, setOpen] = useState(!defaultCollapsed);\n const t = useI18n();\n const uid = useUID();\n\n const descAndChildren = (\n <Flex container={{ direction: 'column', gap: 3 }}>\n {description && <HTML id={`${uid}-description`} as='p' content={description} />}\n <div>{children}</div>\n </Flex>\n );\n\n return (\n <StyledFieldGroup\n aria-label={name}\n aria-describedby={description ? `${uid}-description` : undefined}\n {...restProps}\n ref={ref}\n >\n {name && (\n <FieldGroupLegend open={open} actions={actions}>\n {collapsible ? (\n <Button\n type='button'\n variant='text'\n onClick={() => {\n setOpen(cur => !cur);\n }}\n aria-expanded={open ? 'true' : 'false'}\n aria-label={t(open ? 'collapse_noun' : 'expand_noun', [name])}\n >\n <Flex\n container={{ direction: 'row', alignItems: 'center', gap: 0.5 }}\n forwardedAs='span'\n >\n <Icon name='caret-right' />\n <span>{name}</span>\n </Flex>\n </Button>\n ) : (\n <span>{name}</span>\n )}\n </FieldGroupLegend>\n )}\n {collapsible ? (\n <ExpandCollapse collapsed={!open}>{descAndChildren}</ExpandCollapse>\n ) : (\n descAndChildren\n )}\n </StyledFieldGroup>\n );\n }\n);\n\nexport default FieldGroup;\n"]}
1
+ {"version":3,"file":"FieldGroup.js","sourceRoot":"","sources":["../../../src/components/FieldGroup/FieldGroup.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAsD,MAAM,OAAO,CAAC;AACjG,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,MAAM,EAAE,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACjD,OAAO,cAAc,MAAM,mBAAmB,CAAC;AAC/C,OAAO,IAAI,EAAE,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAC3C,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,IAAI,EAAE,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACzD,OAAO,KAAK,cAAc,MAAM,gCAAgC,CAAC;AACjE,OAAO,OAAyB,MAAM,YAAY,CAAC;AACnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE/C,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,iBAAiB,EAAY,MAAM,cAAc,CAAC;AAE3D,YAAY,CAAC,cAAc,CAAC,CAAC;AA+B7B,MAAM,CAAC,MAAM,sBAAsB,GAAG,MAAM,CAAC,MAAM,CACjD,CAAC,EACC,IAAI,EACJ,KAAK,EAAE,EACL,IAAI,EAAE,EACJ,OAAO,EACP,SAAS,EACT,UAAU,EAAE,EAAE,WAAW,EAAE,YAAY,EAAE,YAAY,EAAE,aAAa,EAAE,EACvE,EACF,EACF,EAAE,EAAE,CAAC,GAAG,CAAA;;;MAGL,IAAI;IACN,GAAG,CAAA;qCAC8B,OAAO;KACvC;mCAC8B,SAAS,CAAC,KAAK,IAAI,SAAS,CAAC,MAAM,CAAC,IAAI;;aAE9D,UAAU;8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IACL,IAAI,EAAC,QAAQ,EACb,OAAO,EAAC,MAAM,EACd,OAAO,EAAE,GAAG,EAAE;wBACZ,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC;oBACvB,CAAC,mBACc,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,gBAC1B,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,aAAa,EAAE,CAAC,IAAI,CAAC,CAAC,YAE7D,MAAC,IAAI,IACH,SAAS,EAAE,EAAE,SAAS,EAAE,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,GAAG,EAAE,GAAG,EAAE,EAC/D,WAAW,EAAC,MAAM,aAElB,KAAC,IAAI,IAAC,IAAI,EAAC,aAAa,GAAG,EAC3B,yBAAO,IAAI,GAAQ,IACd,GACA,CACV,CAAC,CAAC,CAAC,CACF,yBAAO,IAAI,GAAQ,CACpB,GACgB,CACpB,EACA,WAAW,CAAC,CAAC,CAAC,CACb,KAAC,cAAc,IAAC,SAAS,EAAE,CAAC,IAAI,YAAG,eAAe,GAAkB,CACrE,CAAC,CAAC,CAAC,CACF,eAAe,CAChB,IACgB,CACpB,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,UAAU,CAAC","sourcesContent":["import { forwardRef, useState, FunctionComponent, PropsWithoutRef, Ref, ReactNode } from 'react';\nimport styled, { css } from 'styled-components';\n\nimport Button, { StyledButton } from '../Button';\nimport ExpandCollapse from '../ExpandCollapse';\nimport Flex, { StyledFlex } from '../Flex';\nimport HTML from '../HTML';\nimport Icon, { StyledIcon, registerIcon } from '../Icon';\nimport * as caretRightIcon from '../Icon/icons/caret-right.icon';\nimport Actions, { ActionsProps } from '../Actions';\nimport { defaultThemeProp } from '../../theme';\nimport { BaseProps, ForwardProps } from '../../types';\nimport { useI18n, useUID } from '../../hooks';\nimport { calculateFontSize, FontSize } from '../../styles';\n\nregisterIcon(caretRightIcon);\n\nexport interface FieldGroupProps extends BaseProps {\n /** The content of the Field Group. */\n children: ReactNode;\n /** A description of the field group to be displayed above the controls. */\n description?: string;\n /**\n * If true, the Field Group will be able to collapse the content of its children by clicking on the name.\n * @default false\n */\n collapsible?: boolean;\n /**\n * If true, the Field Group will be collapsed on the first render.\n * @default false\n */\n defaultCollapsed?: boolean;\n /** The name associated with the Field Group. */\n name?: string;\n /** An array of actions to add to the header. */\n actions?: ActionsProps['items'];\n /** A reference to the wrapping element. */\n ref?: Ref<HTMLFieldSetElement>;\n}\n\ninterface FieldGroupLegendProps {\n open: boolean;\n actions?: ActionsProps['items'];\n children?: ReactNode;\n}\n\nexport const StyledFieldGroupLegend = styled.legend<{ open: boolean }>(\n ({\n open,\n theme: {\n base: {\n spacing,\n animation,\n 'hit-area': { 'mouse-min': hitAreaMouse, 'finger-min': hitAreaFinger }\n }\n }\n }) => css`\n width: 100%;\n margin-bottom: 0;\n ${open &&\n css`\n margin-block-end: calc(1.5 * ${spacing});\n `}\n transition: margin-block-end ${animation.speed} ${animation.timing.ease};\n\n button ${StyledIcon} {\n transition: transform ${animation.speed} ${animation.timing.ease};\n }\n\n button[aria-expanded='true'] ${StyledIcon} {\n transform: rotate(90deg);\n }\n button[aria-expanded='false'] ${StyledIcon} {\n transform: rotate(0);\n }\n\n > ${StyledFlex} ${StyledButton} {\n min-height: ${hitAreaMouse};\n\n @media (pointer: 'coarse') {\n min-height: ${hitAreaFinger};\n }\n }\n `\n);\n\nStyledFieldGroupLegend.defaultProps = defaultThemeProp;\n\nexport const StyledFieldGroup = styled.fieldset(\n ({\n theme: {\n base: { 'font-size': fontSize, 'font-scale': fontScale, spacing },\n components: { text }\n }\n }) => {\n const fontSizes = calculateFontSize(fontSize, fontScale);\n\n return css`\n border: none;\n margin-block-start: calc(3 * ${spacing});\n\n ${StyledFieldGroupLegend} ${StyledButton} {\n font-weight: inherit;\n }\n\n & ${StyledFieldGroupLegend} {\n font-size: ${fontSizes[text.h3['font-size'] as FontSize]};\n font-weight: ${text.h3['font-weight']};\n }\n\n & & ${StyledFieldGroupLegend} {\n font-size: ${fontSizes[text.h4['font-size'] as FontSize]};\n font-weight: ${text.h4['font-weight']};\n }\n\n & & & ${StyledFieldGroupLegend} {\n font-size: ${fontSizes[text.h5['font-size'] as FontSize]};\n font-weight: ${text.h5['font-weight']};\n }\n\n & & & & ${StyledFieldGroupLegend} {\n font-size: ${fontSizes[text.h6['font-size'] as FontSize]};\n font-weight: ${text.h6['font-weight']};\n }\n `;\n }\n);\n\nStyledFieldGroup.defaultProps = defaultThemeProp;\n\nconst FieldGroupLegend: FunctionComponent<FieldGroupLegendProps> = ({\n children,\n open,\n actions,\n ...restProps\n}) => {\n return (\n <StyledFieldGroupLegend open={open} {...restProps}>\n <Flex container={{ alignItems: 'center', justify: 'between' }}>\n {children}\n {actions && <Actions items={actions} />}\n </Flex>\n </StyledFieldGroupLegend>\n );\n};\n\nconst FieldGroup: FunctionComponent<FieldGroupProps & ForwardProps> = forwardRef(\n (\n {\n children,\n description,\n name,\n actions,\n collapsible = false,\n defaultCollapsed = false,\n ...restProps\n }: PropsWithoutRef<FieldGroupProps>,\n ref: FieldGroupProps['ref']\n ) => {\n const [open, setOpen] = useState(!defaultCollapsed);\n const t = useI18n();\n const uid = useUID();\n\n const descAndChildren = (\n <Flex container={{ direction: 'column', gap: 3 }}>\n {description && <HTML id={`${uid}-description`} as='p' content={description} />}\n <div>{children}</div>\n </Flex>\n );\n\n return (\n <StyledFieldGroup\n aria-label={name}\n aria-describedby={description ? `${uid}-description` : undefined}\n {...restProps}\n ref={ref}\n >\n {name && (\n <FieldGroupLegend open={open} actions={actions}>\n {collapsible ? (\n <Button\n type='button'\n variant='text'\n onClick={() => {\n setOpen(cur => !cur);\n }}\n aria-expanded={open ? 'true' : 'false'}\n aria-label={t(open ? 'collapse_noun' : 'expand_noun', [name])}\n >\n <Flex\n container={{ direction: 'row', alignItems: 'center', gap: 0.5 }}\n forwardedAs='span'\n >\n <Icon name='caret-right' />\n <span>{name}</span>\n </Flex>\n </Button>\n ) : (\n <span>{name}</span>\n )}\n </FieldGroupLegend>\n )}\n {collapsible ? (\n <ExpandCollapse collapsed={!open}>{descAndChildren}</ExpandCollapse>\n ) : (\n descAndChildren\n )}\n </StyledFieldGroup>\n );\n }\n);\n\nexport default FieldGroup;\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"FieldGroupList.d.ts","sourceRoot":"","sources":["../../../src/components/FieldGroup/FieldGroupList.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAA+B,GAAG,EAAE,MAAM,OAAO,CAAC;AAG5E,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAO3C,OAAmB,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAI3D,MAAM,WAAW,uBAAwB,SAAQ,eAAe;IAC9D,0CAA0C;IAC1C,EAAE,EAAE,MAAM,CAAC;CACZ;AAED,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,uBAAuB,EAAE,CAAC;IACjC,KAAK,CAAC,EAAE,MAAM,IAAI,CAAC;IACnB,QAAQ,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAChC,GAAG,CAAC,EAAE,GAAG,CAAC,cAAc,CAAC,CAAC;CAC3B;AAWD,eAAO,MAAM,cAAc,qJAe1B,CAAC;AAaF,QAAA,MAAM,cAAc,EAAE,iBAAiB,CAAC,mBAAmB,GAAG,YAAY,CA6CzE,CAAC;AAEF,eAAe,cAAc,CAAC"}
1
+ {"version":3,"file":"FieldGroupList.d.ts","sourceRoot":"","sources":["../../../src/components/FieldGroup/FieldGroupList.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAA+B,GAAG,EAAE,MAAM,OAAO,CAAC;AAG5E,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAO3C,OAAmB,EAAE,eAAe,EAAoB,MAAM,cAAc,CAAC;AAI7E,MAAM,WAAW,uBAAwB,SAAQ,eAAe;IAC9D,0CAA0C;IAC1C,EAAE,EAAE,MAAM,CAAC;CACZ;AAED,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,uBAAuB,EAAE,CAAC;IACjC,KAAK,CAAC,EAAE,MAAM,IAAI,CAAC;IACnB,QAAQ,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAChC,GAAG,CAAC,EAAE,GAAG,CAAC,cAAc,CAAC,CAAC;CAC3B;AAeD,eAAO,MAAM,cAAc,qJAe1B,CAAC;AAaF,QAAA,MAAM,cAAc,EAAE,iBAAiB,CAAC,mBAAmB,GAAG,YAAY,CA6CzE,CAAC;AAEF,eAAe,cAAc,CAAC"}
@@ -6,10 +6,14 @@ import Icon, { registerIcon } from '../Icon';
6
6
  import * as plusIcon from '../Icon/icons/plus.icon';
7
7
  import { useI18n } from '../../hooks';
8
8
  import { defaultThemeProp } from '../../theme';
9
- import FieldGroup from './FieldGroup';
9
+ import FieldGroup, { StyledFieldGroup } from './FieldGroup';
10
10
  registerIcon(plusIcon);
11
11
  const StyledFieldGroupList = styled.div(({ theme }) => css `
12
- margin-top: ${theme.base.spacing};
12
+ margin-block-start: ${theme.base.spacing};
13
+
14
+ ${StyledFieldGroup} {
15
+ margin-block-start: 0;
16
+ }
13
17
  `);
14
18
  StyledFieldGroupList.defaultProps = defaultThemeProp;
15
19
  export const StyledListItem = styled(FieldGroup)(({ theme }) => css `
@@ -1 +1 @@
1
- {"version":3,"file":"FieldGroupList.js","sourceRoot":"","sources":["../../../src/components/FieldGroup/FieldGroupList.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAqB,UAAU,EAAwB,MAAM,OAAO,CAAC;AAC5E,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAGhD,OAAO,MAAM,MAAM,WAAW,CAAC;AAC/B,OAAO,IAAI,EAAE,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAC7C,OA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CAAC;IAEpB,OAAO,CACL,MAAC,oBAAoB,IAAC,GAAG,EAAE,GAAG,KAAM,SAAS,aAC1C,KAAK,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,aAAa,EAA2B,EAAE,EAAE;gBAC/E,OAAO,CACL,KAAC,cAAc,IAEb,IAAI,EAAE,IAAI,KACN,aAAa,EACjB,OAAO,EACL,QAAQ;wBACN,CAAC,CAAC;4BACE;gCACE,EAAE,EAAE,QAAQ;gCACZ,IAAI,EAAE,CAAC,CAAC,QAAQ,CAAC;gCACjB,IAAI,EAAE,OAAO;gCACb,QAAQ,EAAE,IAAI;gCACd,OAAO,EAAE,QAAQ;oCACf,CAAC,CAAC,GAAG,EAAE;wCACH,QAAQ,CAAC,EAAE,CAAC,CAAC;oCACf,CAAC;oCACH,CAAC,CAAC,SAAS;6BACd;yBACF;wBACH,CAAC,CAAC,SAAS,YAGd,QAAQ,IArBJ,EAAE,CAsBQ,CAClB,CAAC;YACJ,CAAC,CAAC,EACD,KAAK,IAAI,CACR,MAAC,eAAe,IAAC,OAAO,EAAC,MAAM,EAAC,OAAO,EAAE,KAAK,aAC5C,KAAC,IAAI,IAAC,IAAI,EAAC,MAAM,GAAG,OAAE,CAAC,CAAC,KAAK,CAAC,IACd,CACnB,IACoB,CACxB,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,cAAc,CAAC","sourcesContent":["import { FunctionComponent, forwardRef, PropsWithoutRef, Ref } from 'react';\nimport styled, { css } from 'styled-components';\n\nimport { ForwardProps } from '../../types';\nimport Button from '../Button';\nimport Icon, { registerIcon } from '../Icon';\nimport * as plusIcon from '../Icon/icons/plus.icon';\nimport { useI18n } from '../../hooks';\nimport { defaultThemeProp } from '../../theme';\n\nimport FieldGroup, { FieldGroupProps } from './FieldGroup';\n\nregisterIcon(plusIcon);\n\nexport interface FieldGroupListItemProps extends FieldGroupProps {\n /** The ID of the field group list item */\n id: string;\n}\n\nexport interface FieldGroupListProps {\n items: FieldGroupListItemProps[];\n onAdd?: () => void;\n onDelete?: (id: string) => void;\n ref?: Ref<HTMLDivElement>;\n}\n\nconst StyledFieldGroupList = styled.div(\n ({ theme }) =>\n css`\n margin-top: ${theme.base.spacing};\n `\n);\n\nStyledFieldGroupList.defaultProps = defaultThemeProp;\n\nexport const StyledListItem = styled(FieldGroup)(\n ({ theme }) =>\n css`\n padding: ${theme.base.spacing} 0 calc(2 * ${theme.base.spacing});\n border-bottom: 0.0625rem solid ${theme.base.palette['border-line']};\n margin-bottom: calc(2 * ${theme.base.spacing});\n\n legend {\n margin-bottom: -${theme.base.spacing};\n }\n\n & > * {\n margin: ${theme.base.spacing} 0;\n }\n `\n);\n\nStyledListItem.defaultProps = defaultThemeProp;\n\nconst StyledAddButton = styled(Button)(\n ({ theme }) =>\n css`\n margin-top: ${theme.base.spacing};\n `\n);\n\nStyledAddButton.defaultProps = defaultThemeProp;\n\nconst FieldGroupList: FunctionComponent<FieldGroupListProps & ForwardProps> = forwardRef(\n (\n { items, onAdd, onDelete, ...restProps }: PropsWithoutRef<FieldGroupListProps>,\n ref: FieldGroupListProps['ref']\n ) => {\n const t = useI18n();\n\n return (\n <StyledFieldGroupList ref={ref} {...restProps}>\n {items.map(({ id, children, name, ...restItemProps }: FieldGroupListItemProps) => {\n return (\n <StyledListItem\n key={id}\n name={name}\n {...restItemProps}\n actions={\n onDelete\n ? [\n {\n id: 'delete',\n text: t('delete'),\n icon: 'trash',\n iconOnly: true,\n onClick: onDelete\n ? () => {\n onDelete(id);\n }\n : undefined\n }\n ]\n : undefined\n }\n >\n {children}\n </StyledListItem>\n );\n })}\n {onAdd && (\n <StyledAddButton variant='link' onClick={onAdd}>\n <Icon name='plus' /> {t('add')}\n </StyledAddButton>\n )}\n </StyledFieldGroupList>\n );\n }\n);\n\nexport default FieldGroupList;\n"]}
1
+ {"version":3,"file":"FieldGroupList.js","sourceRoot":"","sources":["../../../src/components/FieldGroup/FieldGroupList.t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port styled, { css } from 'styled-components';\n\nimport { ForwardProps } from '../../types';\nimport Button from '../Button';\nimport Icon, { registerIcon } from '../Icon';\nimport * as plusIcon from '../Icon/icons/plus.icon';\nimport { useI18n } from '../../hooks';\nimport { defaultThemeProp } from '../../theme';\n\nimport FieldGroup, { FieldGroupProps, StyledFieldGroup } from './FieldGroup';\n\nregisterIcon(plusIcon);\n\nexport interface FieldGroupListItemProps extends FieldGroupProps {\n /** The ID of the field group list item */\n id: string;\n}\n\nexport interface FieldGroupListProps {\n items: FieldGroupListItemProps[];\n onAdd?: () => void;\n onDelete?: (id: string) => void;\n ref?: Ref<HTMLDivElement>;\n}\n\nconst StyledFieldGroupList = styled.div(\n ({ theme }) =>\n css`\n margin-block-start: ${theme.base.spacing};\n\n ${StyledFieldGroup} {\n margin-block-start: 0;\n }\n `\n);\n\nStyledFieldGroupList.defaultProps = defaultThemeProp;\n\nexport const StyledListItem = styled(FieldGroup)(\n ({ theme }) =>\n css`\n padding: ${theme.base.spacing} 0 calc(2 * ${theme.base.spacing});\n border-bottom: 0.0625rem solid ${theme.base.palette['border-line']};\n margin-bottom: calc(2 * ${theme.base.spacing});\n\n legend {\n margin-bottom: -${theme.base.spacing};\n }\n\n & > * {\n margin: ${theme.base.spacing} 0;\n }\n `\n);\n\nStyledListItem.defaultProps = defaultThemeProp;\n\nconst StyledAddButton = styled(Button)(\n ({ theme }) =>\n css`\n margin-top: ${theme.base.spacing};\n `\n);\n\nStyledAddButton.defaultProps = defaultThemeProp;\n\nconst FieldGroupList: FunctionComponent<FieldGroupListProps & ForwardProps> = forwardRef(\n (\n { items, onAdd, onDelete, ...restProps }: PropsWithoutRef<FieldGroupListProps>,\n ref: FieldGroupListProps['ref']\n ) => {\n const t = useI18n();\n\n return (\n <StyledFieldGroupList ref={ref} {...restProps}>\n {items.map(({ id, children, name, ...restItemProps }: FieldGroupListItemProps) => {\n return (\n <StyledListItem\n key={id}\n name={name}\n {...restItemProps}\n actions={\n onDelete\n ? [\n {\n id: 'delete',\n text: t('delete'),\n icon: 'trash',\n iconOnly: true,\n onClick: onDelete\n ? () => {\n onDelete(id);\n }\n : undefined\n }\n ]\n : undefined\n }\n >\n {children}\n </StyledListItem>\n );\n })}\n {onAdd && (\n <StyledAddButton variant='link' onClick={onAdd}>\n <Icon name='plus' /> {t('add')}\n </StyledAddButton>\n )}\n </StyledFieldGroupList>\n );\n }\n);\n\nexport default FieldGroupList;\n"]}
@@ -1,21 +1,10 @@
1
- import { FC, ReactNode, Ref } from 'react';
2
- import { BaseProps, ForwardProps } from '../../types';
3
- export interface FormProps extends BaseProps {
1
+ import { FC } from 'react';
2
+ import { ForwardProps, OmitStrict } from '../../types';
3
+ import { type BaseFormProps } from '../MultiStepForm/MultiStepForm.types';
4
+ export interface FormProps extends OmitStrict<BaseFormProps, 'content'> {
4
5
  /** The Form content. Recommended composing form elements within a layout template such as Grid or Flex as the only child. */
5
- children: ReactNode;
6
- /** Region for Form Actions. */
7
- actions?: ReactNode;
8
- /** The heading of the form. */
9
- heading?: string;
10
- /** A description of the form to be displayed above the controls. */
11
- description?: string;
12
- /** Region for Banners above the Form. */
13
- banners?: ReactNode;
14
- /** Ref forwarded to the wrapping element. */
15
- ref?: Ref<HTMLFormElement>;
6
+ children: BaseFormProps['content'];
16
7
  }
17
- export declare const StyledForm: import("styled-components").StyledComponent<"form", import("styled-components").DefaultTheme, {}, never>;
18
- export declare const StyledFormContent: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
19
8
  declare const Form: FC<FormProps & ForwardProps>;
20
9
  export default Form;
21
10
  //# sourceMappingURL=Form.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Form.d.ts","sourceRoot":"","sources":["../../../src/components/Form/Form.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,EAAE,EAAE,SAAS,EAAE,GAAG,EAAmB,MAAM,OAAO,CAAC;AAIxE,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAKtD,MAAM,WAAW,SAAU,SAAQ,SAAS;IAC1C,6HAA6H;IAC7H,QAAQ,EAAE,SAAS,CAAC;IACpB,+BAA+B;IAC/B,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB,+BAA+B;IAC/B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,oEAAoE;IACpE,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,yCAAyC;IACzC,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB,6CAA6C;IAC7C,GAAG,CAAC,EAAE,GAAG,CAAC,eAAe,CAAC,CAAC;CAC5B;AAED,eAAO,MAAM,UAAU,0GAAgB,CAAC;AACxC,eAAO,MAAM,iBAAiB,yGAAe,CAAC;AAE9C,QAAA,MAAM,IAAI,EAAE,EAAE,CAAC,SAAS,GAAG,YAAY,CAkCtC,CAAC;AAEF,eAAe,IAAI,CAAC"}
1
+ {"version":3,"file":"Form.d.ts","sourceRoot":"","sources":["../../../src/components/Form/Form.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,EAAE,EAAmB,MAAM,OAAO,CAAC;AAExD,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAGvD,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,sCAAsC,CAAC;AAE1E,MAAM,WAAW,SAAU,SAAQ,UAAU,CAAC,aAAa,EAAE,SAAS,CAAC;IACrE,6HAA6H;IAC7H,QAAQ,EAAE,aAAa,CAAC,SAAS,CAAC,CAAC;CACpC;AAED,QAAA,MAAM,IAAI,EAAE,EAAE,CAAC,SAAS,GAAG,YAAY,CA0BtC,CAAC;AAEF,eAAe,IAAI,CAAC"}
@@ -1,16 +1,19 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { forwardRef } from 'react';
3
- import styled from 'styled-components';
4
3
  import { useUID } from '../../hooks';
5
- import Flex from '../Flex';
6
- import Text from '../Text';
7
- import HTML from '../HTML';
8
- export const StyledForm = styled.form ``;
9
- export const StyledFormContent = styled.div ``;
10
- const Form = forwardRef((props, ref) => {
11
- const { children, actions, heading, description, banners, ...restProps } = props;
12
- const uid = useUID();
13
- return (_jsxs(Flex, { container: { direction: 'column', gap: 3 }, as: StyledForm, ref: ref, ...restProps, "aria-labelledby": heading ? `${uid}-heading` : undefined, "aria-describedby": description ? `${uid}-description` : undefined, children: [banners, (heading || description) && (_jsxs(Flex, { container: { direction: 'column', gap: 1 }, children: [heading && (_jsx(Text, { id: `${uid}-heading`, variant: 'h3', children: heading })), description && _jsx(HTML, { id: `${uid}-description`, as: 'p', content: description })] })), _jsx(Flex, { as: StyledFormContent, container: { direction: 'column', gap: 3 }, children: children }), actions && _jsx(Flex, { container: { justify: 'between', alignItems: 'center' }, children: actions })] }));
4
+ import MultiStepForm from '../MultiStepForm';
5
+ const Form = forwardRef(({ children, actions, heading, description, banners, ...restProps }, ref) => {
6
+ const stepId = useUID();
7
+ return (_jsx(MultiStepForm, { ...restProps, heading: heading, steps: [
8
+ {
9
+ id: stepId,
10
+ name: '',
11
+ actions,
12
+ content: children,
13
+ description,
14
+ banners
15
+ }
16
+ ], currentStepId: stepId, ref: ref }));
14
17
  });
15
18
  export default Form;
16
19
  //# sourceMappingURL=Form.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Form.js","sourceRoot":"","sources":["../../../src/components/Form/Form.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAuC,MAAM,OAAO,CAAC;AACxE,OAAO,MAAM,MAAM,mBAAmB,CAAC;AAEvC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,IAAI,MAAM,SAAS,CAAC;AAiB3B,MAAM,CAAC,MAAM,UAAU,GAAG,MAAM,CAAC,IAAI,CAAA,EAAE,CAAC;AACxC,MAAM,CAAC,MAA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YAAG,OAAO,GAAQ,IACtF,CACR,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,IAAI,CAAC","sourcesContent":["import { forwardRef, FC, ReactNode, Ref, PropsWithoutRef } from 'react';\nimport styled from 'styled-components';\n\nimport { useUID } from '../../hooks';\nimport { BaseProps, ForwardProps } from '../../types';\nimport Flex from '../Flex';\nimport Text from '../Text';\nimport HTML from '../HTML';\n\nexport interface FormProps extends BaseProps {\n /** The Form content. Recommended composing form elements within a layout template such as Grid or Flex as the only child. */\n children: ReactNode;\n /** Region for Form Actions. */\n actions?: ReactNode;\n /** The heading of the form. */\n heading?: string;\n /** A description of the form to be displayed above the controls. */\n description?: string;\n /** Region for Banners above the Form. */\n banners?: ReactNode;\n /** Ref forwarded to the wrapping element. */\n ref?: Ref<HTMLFormElement>;\n}\n\nexport const StyledForm = styled.form``;\nexport const StyledFormContent = styled.div``;\n\nconst Form: FC<FormProps & ForwardProps> = forwardRef(\n (props: PropsWithoutRef<FormProps>, ref: FormProps['ref']) => {\n const { children, actions, heading, description, banners, ...restProps } = props;\n\n const uid = useUID();\n\n return (\n <Flex\n container={{ direction: 'column', gap: 3 }}\n as={StyledForm}\n ref={ref}\n {...restProps}\n aria-labelledby={heading ? `${uid}-heading` : undefined}\n aria-describedby={description ? `${uid}-description` : undefined}\n >\n {banners}\n {(heading || description) && (\n <Flex container={{ direction: 'column', gap: 1 }}>\n {heading && (\n <Text id={`${uid}-heading`} variant='h3'>\n {heading}\n </Text>\n )}\n {description && <HTML id={`${uid}-description`} as='p' content={description} />}\n </Flex>\n )}\n <Flex as={StyledFormContent} container={{ direction: 'column', gap: 3 }}>\n {children}\n </Flex>\n\n {actions && <Flex container={{ justify: 'between', alignItems: 'center' }}>{actions}</Flex>}\n </Flex>\n );\n }\n);\n\nexport default Form;\n"]}
1
+ {"version":3,"file":"Form.js","sourceRoot":"","sources":["../../../src/components/Form/Form.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAuB,MAAM,OAAO,CAAC;AAGxD,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,aAAa,MAAM,kBAAkB,CAAC;AAQ7C,MAAM,IAAI,GAAiC,UAAU,CACnD,CACE,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,GAAG,SAAS,EAA8B,EAC9F,GAAqB,EACrB,EAAE;IACF,MAAM,MAAM,GAAG,MAAM,EAAE,CAAC;IAExB,OAAO,CACL,KAAC,aAAa,OACR,SAAS,EACb,OAAO,EAAE,OAAO,EAChB,KAAK,EAAE;YACL;gBACE,EAAE,EAAE,MAAM;gBACV,IAAI,EAAE,EAAE;gBACR,OAAO;gBACP,OAAO,EAAE,QAAQ;gBACjB,WAAW;gBACX,OAAO;aACR;SACF,EACD,aAAa,EAAE,MAAM,EACrB,GAAG,EAAE,GAAG,GACR,CACH,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,IAAI,CAAC","sourcesContent":["import { forwardRef, FC, PropsWithoutRef } from 'react';\n\nimport { ForwardProps, OmitStrict } from '../../types';\nimport { useUID } from '../../hooks';\nimport MultiStepForm from '../MultiStepForm';\nimport { type BaseFormProps } from '../MultiStepForm/MultiStepForm.types';\n\nexport interface FormProps extends OmitStrict<BaseFormProps, 'content'> {\n /** The Form content. Recommended composing form elements within a layout template such as Grid or Flex as the only child. */\n children: BaseFormProps['content'];\n}\n\nconst Form: FC<FormProps & ForwardProps> = forwardRef(\n (\n { children, actions, heading, description, banners, ...restProps }: PropsWithoutRef<FormProps>,\n ref: FormProps['ref']\n ) => {\n const stepId = useUID();\n\n return (\n <MultiStepForm\n {...restProps}\n heading={heading}\n steps={[\n {\n id: stepId,\n name: '',\n actions,\n content: children,\n description,\n banners\n }\n ]}\n currentStepId={stepId}\n ref={ref}\n />\n );\n }\n);\n\nexport default Form;\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"Icon.d.ts","sourceRoot":"","sources":["../../../src/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G,IAAI,EAAE,MAAM,CAAC;IACb,oCAAoC;IACpC,GAAG,CAAC,EAAE,GAAG,CAAC,aAAa,CAAC,CAAC;CAC1B;AAID,eAAO,MAAM,YAAY,aAAc,UAAU,EAAE,SAIlD,CAAC;AAEF,eAAO,MAAM,iBAAiB,aAAc,UAAU,EAAE,SAIvD,CAAC;AAEF,eAAO,MAAM,UAAU,yGAMtB,CAAC;AAIF,QAAA,MAAM,IAAI,EAAE,iBAAiB,CAAC,SAAS,GAAG,YAAY,CAkCrD,CAAC;AAEF,eAAe,IAAI,CAAC"}
@@ -45,7 +45,7 @@ const Icon = forwardRef(({ name, ...restProps }, ref) => {
45
45
  controller.abort();
46
46
  };
47
47
  }, [name]);
48
- return (_jsx(StyledIcon, { ...restProps, role: 'img', ref: ref, xmlns: 'http://www.w3.org/2000/svg', viewBox: iconDef.viewBox, children: _jsx(iconDef.Component, {}) }));
48
+ return (_jsx(StyledIcon, { role: 'presentation', ...restProps, viewBox: iconDef.viewBox, ref: ref, children: _jsx(iconDef.Component, {}) }));
49
49
  });
50
50
  export default Icon;
51
51
  //# sourceMappingURL=Icon.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Icon.js","sourceRoot":"","sources":["../../../src/components/Icon/Icon.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,UAAU,EACV,QAAQ,EACR,SAAS,EAKV,MAAM,OAAO,CAAC;AACf,OAAO,MAAM,MAAM,mBAAmB,CAAC;AAoBvC,MAAM,YAAY,GAAG,IAAI,GAAG,EAA0B,CAAC;AAEvD,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,GAAG,KAAmB,EAAE,EAAE;IACrD,KAAK,CAAC,OAAO,CAAC,CAAC,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,EAAE,EAAE;QACrC,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,IAAI,CAAC;YAAE,YAAY,CAAC,GAAG,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IAC/D,CAAC,CA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;gBAC5B,UAAU,CAAC,YAAY,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,mBAAmB,CAAC,CAAC;QACrE,CAAC,CAAC;aACD,KAAK,CAAC,GAAG,EAAE;YACV,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,OAAO;gBAAE,UAAU,CAAC,mBAAmB,CAAC,CAAC;QAClE,CAAC,CAAC,CAAC;QAEL,OAAO,GAAG,EAAE;YACV,UAAU,CAAC,KAAK,EAAE,CAAC;QACrB,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC;IAEX,OAAO,CACL,KAAC,UAAU,OACL,SAAS,EACb,IAAI,EAAC,KAAK,EACV,GAAG,EAAE,GAAG,EACR,KAAK,EAAC,4BAA4B,EAClC,OAAO,EAAE,OAAO,CAAC,OAAO,YAExB,KAAC,OAAO,CAAC,SAAS,KAAG,GACV,CACd,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,IAAI,CAAC","sourcesContent":["import {\n forwardRef,\n useState,\n useEffect,\n FunctionComponent,\n Ref,\n PropsWithoutRef,\n ComponentType\n} from 'react';\nimport styled from 'styled-components';\n\nimport { BaseProps, ForwardProps, NoChildrenProp } from '../../types';\n\nexport interface IconDefinition {\n Component: ComponentType;\n viewBox?: string;\n}\n\nexport interface IconModule extends IconDefinition {\n name: string;\n}\n\nexport interface IconProps extends BaseProps, NoChildrenProp {\n /** The name indicating the Cosmos Icon. Reference the catalog above for the available names. */\n name: string;\n /** Ref for the wrapping element. */\n ref?: Ref<SVGSVGElement>;\n}\n\nconst iconRegistry = new Map<string, IconDefinition>();\n\nexport const registerIcon = (...icons: IconModule[]) => {\n icons.forEach(({ name, ...iconDef }) => {\n if (!iconRegistry.has(name)) iconRegistry.set(name, iconDef);\n });\n};\n\nexport const forceRegisterIcon = (...icons: IconModule[]) => {\n icons.forEach(({ name, ...iconDef }) => {\n iconRegistry.set(name, iconDef);\n });\n};\n\nexport const StyledIcon = styled.svg`\n display: inline-block;\n fill: currentColor;\n height: 1.125rem;\n width: 1.125rem;\n vertical-align: middle;\n`;\n\nconst emptyIconDefinition: Readonly<IconDefinition> = Object.freeze({ Component: () => null });\n\nconst Icon: FunctionComponent<IconProps & ForwardProps> = forwardRef(\n ({ name, ...restProps }: PropsWithoutRef<IconProps>, ref: IconProps['ref']) => {\n const [iconDef, setIconDef] = useState(iconRegistry.get(name) ?? emptyIconDefinition);\n\n useEffect(() => {\n if (iconRegistry.has(name)) {\n setIconDef(iconRegistry.get(name)!);\n return;\n }\n\n const controller = new AbortController();\n import(`./icons/${encodeURIComponent(name)}.icon`)\n .then((module: IconModule) => {\n if (!module.name || !module.Component) throw new Error('Malformed icon definition');\n\n registerIcon(module);\n if (!controller.signal.aborted)\n setIconDef(iconRegistry.get(module.name) ?? emptyIconDefinition);\n })\n .catch(() => {\n if (!controller.signal.aborted) setIconDef(emptyIconDefinition);\n });\n\n return () => {\n controller.abort();\n };\n }, [name]);\n\n return (\n <StyledIcon\n {...restProps}\n role='img'\n ref={ref}\n xmlns='http://www.w3.org/2000/svg'\n viewBox={iconDef.viewBox}\n >\n <iconDef.Component />\n </StyledIcon>\n );\n }\n);\n\nexport default Icon;\n"]}
1
+ {"version":3,"file":"Icon.js","sourceRoot":"","sources":["../../../src/components/Icon/Icon.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,UAAU,EACV,QAAQ,EACR,SAAS,EAKV,MAAM,OAAO,CAAC;AACf,OAAO,MAAM,MAAM,mBAAmB,CAAC;AAoBvC,MAAM,YAAY,GAAG,IAAI,GAAG,EAA0B,CAAC;AAEvD,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,GAAG,KAAmB,EAAE,EAAE;IACrD,KAAK,CAAC,OAAO,CAAC,CAAC,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,EAAE,EAAE;QACrC,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,IAAI,CAAC;YAAE,YAAY,CAAC,GAAG,CAA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;YACrB,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,OAAO;gBAC5B,UAAU,CAAC,YAAY,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,mBAAmB,CAAC,CAAC;QACrE,CAAC,CAAC;aACD,KAAK,CAAC,GAAG,EAAE;YACV,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,OAAO;gBAAE,UAAU,CAAC,mBAAmB,CAAC,CAAC;QAClE,CAAC,CAAC,CAAC;QAEL,OAAO,GAAG,EAAE;YACV,UAAU,CAAC,KAAK,EAAE,CAAC;QACrB,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC;IAEX,OAAO,CACL,KAAC,UAAU,IAAC,IAAI,EAAC,cAAc,KAAK,SAAS,EAAE,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE,GAAG,EAAE,GAAG,YAC/E,KAAC,OAAO,CAAC,SAAS,KAAG,GACV,CACd,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,IAAI,CAAC","sourcesContent":["import {\n forwardRef,\n useState,\n useEffect,\n FunctionComponent,\n Ref,\n PropsWithoutRef,\n ComponentType\n} from 'react';\nimport styled from 'styled-components';\n\nimport { BaseProps, ForwardProps, NoChildrenProp } from '../../types';\n\nexport interface IconDefinition {\n Component: ComponentType;\n viewBox?: string;\n}\n\nexport interface IconModule extends IconDefinition {\n name: string;\n}\n\nexport interface IconProps extends BaseProps, NoChildrenProp {\n /** The name indicating the Cosmos Icon. Reference the catalog above for the available names. */\n name: string;\n /** Ref for the wrapping element. */\n ref?: Ref<SVGSVGElement>;\n}\n\nconst iconRegistry = new Map<string, IconDefinition>();\n\nexport const registerIcon = (...icons: IconModule[]) => {\n icons.forEach(({ name, ...iconDef }) => {\n if (!iconRegistry.has(name)) iconRegistry.set(name, iconDef);\n });\n};\n\nexport const forceRegisterIcon = (...icons: IconModule[]) => {\n icons.forEach(({ name, ...iconDef }) => {\n iconRegistry.set(name, iconDef);\n });\n};\n\nexport const StyledIcon = styled.svg`\n display: inline-block;\n fill: currentColor;\n height: 1.125rem;\n width: 1.125rem;\n vertical-align: middle;\n`;\n\nconst emptyIconDefinition: Readonly<IconDefinition> = Object.freeze({ Component: () => null });\n\nconst Icon: FunctionComponent<IconProps & ForwardProps> = forwardRef(\n ({ name, ...restProps }: PropsWithoutRef<IconProps>, ref: IconProps['ref']) => {\n const [iconDef, setIconDef] = useState(iconRegistry.get(name) ?? emptyIconDefinition);\n\n useEffect(() => {\n if (iconRegistry.has(name)) {\n setIconDef(iconRegistry.get(name)!);\n return;\n }\n\n const controller = new AbortController();\n import(`./icons/${encodeURIComponent(name)}.icon`)\n .then((module: IconModule) => {\n if (!module.name || !module.Component) throw new Error('Malformed icon definition');\n\n registerIcon(module);\n if (!controller.signal.aborted)\n setIconDef(iconRegistry.get(module.name) ?? emptyIconDefinition);\n })\n .catch(() => {\n if (!controller.signal.aborted) setIconDef(emptyIconDefinition);\n });\n\n return () => {\n controller.abort();\n };\n }, [name]);\n\n return (\n <StyledIcon role='presentation' {...restProps} viewBox={iconDef.viewBox} ref={ref}>\n <iconDef.Component />\n </StyledIcon>\n );\n }\n);\n\nexport default Icon;\n"]}
@@ -0,0 +1,10 @@
1
+ import { FunctionComponent } from 'react';
2
+ import { ForwardProps } from '../../types';
3
+ import type MultiStepFormProps from './MultiStepForm.types';
4
+ interface FormProgressProps {
5
+ steps: MultiStepFormProps['steps'];
6
+ currentStepId: MultiStepFormProps['currentStepId'];
7
+ }
8
+ declare const FormProgress: FunctionComponent<FormProgressProps & ForwardProps>;
9
+ export default FormProgress;
10
+ //# sourceMappingURL=FormProgress.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FormProgress.d.ts","sourceRoot":"","sources":["../../../src/components/MultiStepForm/FormProgress.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAoC,MAAM,OAAO,CAAC;AAG5E,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAa3C,OAAO,KAAK,kBAAkB,MAAM,uBAAuB,CAAC;AAE5D,UAAU,iBAAiB;IACzB,KAAK,EAAE,kBAAkB,CAAC,OAAO,CAAC,CAAC;IACnC,aAAa,EAAE,kBAAkB,CAAC,eAAe,CAAC,CAAC;CACpD;AAED,QAAA,MAAM,YAAY,EAAE,iBAAiB,CAAC,iBAAiB,GAAG,YAAY,CA0FrE,CAAC;AAEF,eAAe,YAAY,CAAC"}
@@ -1,15 +1,14 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { remToPx, stripUnit } from 'polished';
3
- import { forwardRef, useRef, useEffect } from 'react';
3
+ import { useRef, useEffect } from 'react';
4
4
  import { useElement, useTheme } from '../../hooks';
5
- import { getFocusables, tryCatch } from '../../utils';
5
+ import { tryCatch } from '../../utils';
6
6
  import Flex from '../Flex';
7
- import Form from '../Form';
8
7
  import Text from '../Text';
9
8
  import Tooltip from '../Tooltip';
10
- import StyledMultiStep, { CurrentStepPopover, StepMarker, StyledBar, StyledFill, StyledFormProgress } from './MultiStep.styles';
11
- const FormProgress = ({ steps, currentId, ...restProps }) => {
12
- const curIdx = steps.findIndex(step => step.id === currentId);
9
+ import { CurrentStepPopover, StepMarker, StyledBar, StyledFill, StyledFormProgress } from './FormProgress.styles';
10
+ const FormProgress = ({ steps, currentStepId, ...restProps }) => {
11
+ const curIdx = steps.findIndex(step => step.id === currentStepId);
13
12
  const curStep = steps[curIdx];
14
13
  const fillScale = curIdx / (steps.length - 1);
15
14
  const [currentStepEl, setCurrentStepEl] = useElement();
@@ -36,21 +35,8 @@ const FormProgress = ({ steps, currentId, ...restProps }) => {
36
35
  ], children: _jsx(Text, { variant: 'h4', children: curStep.name }) }), _jsx(Flex, { container: { justify: 'between', alignItems: 'center' }, item: { grow: 1 }, children: steps.map((step, index) => {
37
36
  return (_jsx(StepMarker, { ref: (el) => {
38
37
  stepRefs.current[index] = el;
39
- }, "aria-label": step.name, "aria-describedby": step.id, current: index === curIdx, depth: step.depth, prior: index < curIdx, onClick: step.onClick, children: index !== curIdx && (_jsx(Tooltip, { id: step.id, target: stepRefs.current[index], showDelay: 'none', hideDelay: 'short', portal: false, children: step.name })) }, step.id));
38
+ }, "aria-label": step.name, "aria-describedby": step.id, current: index === curIdx, depth: step.depth, prior: index < curIdx, onClick: step.onMarkerClick, children: index !== curIdx && (_jsx(Tooltip, { id: step.id, target: stepRefs.current[index], showDelay: 'none', hideDelay: 'short', portal: false, children: step.name })) }, step.id));
40
39
  }) }), _jsx(StyledBar, { children: _jsx(StyledFill, { style: { '--fillScale': fillScale } }) })] }));
41
40
  };
42
- const MultiStep = forwardRef(({ currentId, steps, ...restProps }, ref) => {
43
- const multiStepContentRef = useRef(null);
44
- const currentStep = steps.find(step => step.id === currentId);
45
- useEffect(() => {
46
- const focusableElements = getFocusables(multiStepContentRef);
47
- if (focusableElements.length)
48
- focusableElements[0].focus();
49
- }, [currentId]);
50
- return (_jsxs(Flex, { as: StyledMultiStep, ref: ref, container: {
51
- direction: 'column',
52
- gap: 3
53
- }, ...restProps, children: [_jsx(FormProgress, { steps: steps, currentId: currentId }), _jsx(Form, { ref: multiStepContentRef, actions: currentStep.actions, banners: currentStep.banners, children: currentStep.content })] }));
54
- });
55
- export default MultiStep;
56
- //# sourceMappingURL=MultiStep.js.map
41
+ export default FormProgress;
42
+ //# sourceMappingURL=FormProgress.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FormProgress.js","sourceRoot":"","sources":["../../../src/components/MultiStepForm/FormProgress.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAC9C,OAAO,EAAoC,MAAM,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAE5E,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEnD,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,IA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ACjB,MAAM,EAAE,KAAK,YAEZ,IAAI,CAAC,IAAI,GACF,CACX,IArBI,IAAI,CAAC,EAAE,CAsBD,CACd,CAAC;gBACJ,CAAC,CAAC,GACG,EAEP,KAAC,SAAS,cACR,KAAC,UAAU,IAAC,KAAK,EAAE,EAAE,aAAa,EAAE,SAAS,EAAmB,GAAI,GAC1D,IACO,CACtB,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,YAAY,CAAC","sourcesContent":["import { remToPx, stripUnit } from 'polished';\nimport { FunctionComponent, CSSProperties, useRef, useEffect } from 'react';\n\nimport { useElement, useTheme } from '../../hooks';\nimport { ForwardProps } from '../../types';\nimport { tryCatch } from '../../utils';\nimport Flex from '../Flex';\nimport Text from '../Text';\nimport Tooltip from '../Tooltip';\n\nimport {\n CurrentStepPopover,\n StepMarker,\n StyledBar,\n StyledFill,\n StyledFormProgress\n} from './FormProgress.styles';\nimport type MultiStepFormProps from './MultiStepForm.types';\n\ninterface FormProgressProps {\n steps: MultiStepFormProps['steps'];\n currentStepId: MultiStepFormProps['currentStepId'];\n}\n\nconst FormProgress: FunctionComponent<FormProgressProps & ForwardProps> = ({\n steps,\n currentStepId,\n ...restProps\n}) => {\n const curIdx = steps.findIndex(step => step.id === currentStepId);\n const curStep = steps[curIdx];\n const fillScale = curIdx / (steps.length - 1);\n\n const [currentStepEl, setCurrentStepEl] = useElement();\n const stepRefs = useRef<HTMLElement[]>([]);\n const theme = useTheme();\n\n let popoverPlacement: 'top' | 'top-start' | 'top-end' = 'top';\n if (curIdx === 0) popoverPlacement = 'top-start';\n else if (curIdx === steps.length - 1) popoverPlacement = 'top-end';\n\n useEffect(() => {\n setCurrentStepEl(stepRefs.current[curIdx]);\n }, [stepRefs.current, curIdx]);\n\n return (\n <StyledFormProgress\n {...restProps}\n container={{ alignItems: 'center' }}\n role='progressbar'\n aria-valuenow={curIdx}\n aria-valuemin={0}\n aria-valuetext={curStep.name}\n aria-valuemax={steps.length}\n >\n <CurrentStepPopover\n show\n target={currentStepEl}\n placement={popoverPlacement}\n strategy='absolute'\n hideOnTargetHidden\n modifiers={[\n {\n name: 'offset',\n options: {\n offset: [\n 0,\n tryCatch(\n () => stripUnit(remToPx(theme.base.spacing)),\n () => 8\n )\n ]\n }\n }\n ]}\n >\n <Text variant='h4'>{curStep.name}</Text>\n </CurrentStepPopover>\n <Flex container={{ justify: 'between', alignItems: 'center' }} item={{ grow: 1 }}>\n {steps.map((step, index) => {\n return (\n <StepMarker\n key={step.id}\n ref={(el: HTMLElement) => {\n stepRefs.current[index] = el;\n }}\n aria-label={step.name}\n aria-describedby={step.id}\n current={index === curIdx}\n depth={step.depth}\n prior={index < curIdx}\n onClick={step.onMarkerClick}\n >\n {index !== curIdx && (\n <Tooltip\n id={step.id}\n target={stepRefs.current[index]}\n showDelay='none'\n hideDelay='short'\n portal={false}\n >\n {step.name}\n </Tooltip>\n )}\n </StepMarker>\n );\n })}\n </Flex>\n\n <StyledBar>\n <StyledFill style={{ '--fillScale': fillScale } as CSSProperties} />\n </StyledBar>\n </StyledFormProgress>\n );\n};\n\nexport default FormProgress;\n"]}
@@ -1,4 +1,4 @@
1
- import { Step } from './MultiStep.types';
1
+ import { type Step } from './MultiStepForm.types';
2
2
  export declare const CurrentStepPopover: import("styled-components").StyledComponent<(<Modifiers extends string = string>(props: import("../Popover").PopoverProps<Modifiers> & import("../..").ForwardProps) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | null), import("styled-components").DefaultTheme, {}, never>;
3
3
  export declare const StyledBar: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
4
4
  export declare const StyledFill: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
@@ -8,6 +8,4 @@ export declare const StepMarker: import("styled-components").StyledComponent<imp
8
8
  depth: Step['depth'];
9
9
  prior: boolean;
10
10
  }, never>;
11
- declare const StyledMultiStep: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
12
- export default StyledMultiStep;
13
- //# sourceMappingURL=MultiStep.styles.d.ts.map
11
+ //# sourceMappingURL=FormProgress.styles.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FormProgress.styles.d.ts","sourceRoot":"","sources":["../../../src/components/MultiStepForm/FormProgress.styles.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,KAAK,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAElD,eAAO,MAAM,kBAAkB,8TAa9B,CAAC;AAEF,eAAO,MAAM,SAAS,yGAapB,CAAC;AAIH,eAAO,MAAM,UAAU,yGAsBrB,CAAC;AAIH,eAAO,MAAM,kBAAkB,iMAe7B,CAAC;AAIH,eAAO,MAAM,UAAU;aACZ,OAAO;WACT,IAAI,CAAC,OAAO,CAAC;WACb,OAAO;SA6Ed,CAAC"}
@@ -50,7 +50,7 @@ export const StyledFormProgress = styled(Flex)(({ theme }) => {
50
50
  const fontSizes = calculateFontSize(fontSize, fontScale);
51
51
  return css `
52
52
  position: relative;
53
- padding-block-start: calc(${spacing} * 2 + ${fontSizes[h4fontSize]} * 1.35);
53
+ padding-block-start: calc(${spacing} + ${fontSizes[h4fontSize]} * 1.35);
54
54
  `;
55
55
  });
56
56
  StyledFormProgress.defaultProps = defaultThemeProp;
@@ -116,6 +116,4 @@ export const StepMarker = styled(BareButton)(({ current, depth, prior, theme })
116
116
  `;
117
117
  });
118
118
  StepMarker.defaultProps = defaultThemeProp;
119
- const StyledMultiStep = styled.div ``;
120
- export default StyledMultiStep;
121
- //# sourceMappingURL=MultiStep.styles.js.map
119
+ //# sourceMappingURL=FormProgress.styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FormProgress.styles.js","sourceRoot":"","sources":["../../../src/components/MultiStepForm/FormProgress.styles.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAEhC,OAAO,IAAI,MA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,GAAG,iBAAiB,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC;IACrE,MAAM,mBAAmB,GAAG,QAAQ,cAAc,SAAS,CAAC;IAE5D,OAAO,GAAG,CAAA;;;;MAIN,IAAI,CAAC,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,mBAAmB,CAAC,CAAC,CAAC,cAAc,CAAC;;kBAE5C,iBAAiB;8BACL,WAAW;+BACV,cAAc,KAAK,eAAe;;MAE3D,OAAO;QACT,GAAG,CAAA;oBACa,WAAW;sBACT,WAAW;KAC5B;;MAEC,KAAK;QACP,GAAG,CAAA;sBACe,WAAW;KAC5B;;;;;aAKQ,KAAK,KAAK,CAAC;QAChB,CAAC,CAAC,SAAS,UAAU,MAAM,mBAAmB,UAAU;QACxD,CAAC,CAAC,SAAS,UAAU,MAAM,cAAc,UAAU;cAC7C,KAAK,KAAK,CAAC;QACjB,CAAC,CAAC,SAAS,UAAU,MAAM,mBAAmB,UAAU;QACxD,CAAC,CAAC,SAAS,UAAU,MAAM,cAAc,UAAU;QACnD,IAAI,CAAC,UAAU,CAAC;;;eAGT,KAAK,KAAK,CAAC;QAChB,CAAC,CAAC,SAAS,eAAe,MAAM,mBAAmB,UAAU;QAC7D,CAAC,CAAC,SAAS,eAAe,MAAM,cAAc,UAAU;gBAClD,KAAK,KAAK,CAAC;QACjB,CAAC,CAAC,SAAS,eAAe,MAAM,mBAAmB,UAAU;QAC7D,CAAC,CAAC,SAAS,eAAe,MAAM,cAAc,UAAU;UACxD,IAAI,CAAC,eAAe,CAAC;;;;;;;;;;;;;;oBAcX,WAAW;;GAE5B,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,UAAU,CAAC,YAAY,GAAG,gBAAgB,CAAC","sourcesContent":["import styled, { css } from 'styled-components';\nimport { size } from 'polished';\n\nimport Flex from '../Flex';\nimport { defaultThemeProp } from '../../theme';\nimport BareButton from '../Button/BareButton';\nimport Popover from '../Popover';\nimport { StyledText } from '../Text';\nimport { calculateFontSize, FontSize } from '../../styles';\nimport { useDirection } from '../../hooks';\n\nimport { type Step } from './MultiStepForm.types';\n\nexport const CurrentStepPopover = styled(Popover)`\n max-width: 100%;\n background-color: transparent;\n\n ::after {\n filter: none;\n }\n\n & > ${StyledText} {\n overflow: hidden;\n white-space: nowrap;\n text-overflow: ellipsis;\n }\n`;\n\nexport const StyledBar = styled.div(({ theme }) => {\n const {\n base: {\n palette: { 'border-line': borderColor }\n }\n } = theme;\n\n return css`\n position: absolute;\n width: 100%;\n height: 0.0625rem;\n background: ${borderColor};\n `;\n});\n\nStyledBar.defaultProps = defaultThemeProp;\n\nexport const StyledFill = styled.div(({ theme }) => {\n const {\n base: {\n animation: {\n speed: animationSpeed,\n timing: { ease: animationTiming }\n },\n palette: { interactive }\n }\n } = theme;\n\n const { ltr } = useDirection();\n\n return css`\n position: absolute;\n width: 100%;\n height: 100%;\n background: ${interactive};\n transition: all calc(2 * ${animationSpeed}) ${animationTiming};\n transform: scaleX(var(--fillScale));\n transform-origin: ${ltr ? 0 : '100%'} 0;\n `;\n});\n\nStyledFill.defaultProps = defaultThemeProp;\n\nexport const StyledFormProgress = styled(Flex)(({ theme }) => {\n const {\n base: { spacing, 'font-size': fontSize, 'font-scale': fontScale },\n components: {\n text: {\n h4: { 'font-size': h4fontSize }\n }\n }\n } = theme;\n const fontSizes = calculateFontSize(fontSize, fontScale);\n\n return css`\n position: relative;\n padding-block-start: calc(${spacing} + ${fontSizes[h4fontSize as FontSize]} * 1.35);\n `;\n});\n\nStyledFormProgress.defaultProps = defaultThemeProp;\n\nexport const StepMarker = styled(BareButton)<{\n current: boolean;\n depth: Step['depth'];\n prior: boolean;\n}>(({ current, depth, prior, theme }) => {\n const {\n base: {\n 'font-size': fontSize,\n 'font-scale': fontScale,\n animation: {\n speed: animationSpeed,\n timing: { ease: animationTiming }\n },\n palette: { interactive, 'primary-background': primaryBackground },\n shadow: { focus: focusShadow },\n 'hit-area': { 'mouse-min': buttonSize, 'finger-min': touchButtonSize }\n },\n components: {\n 'form-control': { 'border-color': borderColor }\n }\n } = theme;\n const { m: stepMarkerSize } = calculateFontSize(fontSize, fontScale);\n const smallStepMarkerSize = `calc(${stepMarkerSize} / 1.5)`;\n\n return css`\n display: block;\n position: relative;\n z-index: 1;\n ${size(depth === 1 ? smallStepMarkerSize : stepMarkerSize)}\n border-radius: 100%;\n background: ${primaryBackground};\n border: 0.0625rem solid ${borderColor};\n transition: all calc(2 * ${animationSpeed}) ${animationTiming};\n\n ${current &&\n css`\n background: ${interactive};\n border-color: ${interactive};\n `}\n\n ${prior &&\n css`\n border-color: ${interactive};\n `}\n\n ::after {\n content: '';\n position: absolute;\n top: ${depth === 1\n ? `calc((${buttonSize} - ${smallStepMarkerSize}) / -2) `\n : `calc((${buttonSize} - ${stepMarkerSize}) / -2) `};\n left: ${depth === 1\n ? `calc((${buttonSize} - ${smallStepMarkerSize}) / -2) `\n : `calc((${buttonSize} - ${stepMarkerSize}) / -2) `};\n ${size(buttonSize)}\n\n @media (pointer: coarse) {\n top: ${depth === 1\n ? `calc((${touchButtonSize} - ${smallStepMarkerSize}) / -2) `\n : `calc((${touchButtonSize} - ${stepMarkerSize}) / -2) `};\n left: ${depth === 1\n ? `calc((${touchButtonSize} - ${smallStepMarkerSize}) / -2) `\n : `calc((${touchButtonSize} - ${stepMarkerSize}) / -2) `};\n ${size(touchButtonSize)}\n }\n }\n\n &:first-child::after {\n left: 0;\n }\n\n &:last-child::after {\n left: unset;\n right: 0;\n }\n\n :focus {\n box-shadow: ${focusShadow};\n }\n `;\n});\n\nStepMarker.defaultProps = defaultThemeProp;\n"]}
@@ -0,0 +1,9 @@
1
+ import { FunctionComponent } from 'react';
2
+ import { ForwardProps } from '../../types';
3
+ import MultiStepFormProps from './MultiStepForm.types';
4
+ export declare const StyledForm: import("styled-components").StyledComponent<"form", import("styled-components").DefaultTheme, {}, never>;
5
+ export declare const StyledFormContent: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
6
+ export declare const StyledRequiredFieldLegend: import("styled-components").StyledComponent<FunctionComponent<import("../Text").TextProps & ForwardProps>, import("styled-components").DefaultTheme, {}, never>;
7
+ export declare const MultiStepForm: FunctionComponent<MultiStepFormProps & ForwardProps>;
8
+ export default MultiStepForm;
9
+ //# sourceMappingURL=MultiStepForm.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MultiStepForm.d.ts","sourceRoot":"","sources":["../../../src/components/MultiStepForm/MultiStepForm.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,iBAAiB,EAAsC,MAAM,OAAO,CAAC;AAI1F,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAQ3C,OAAO,kBAA4B,MAAM,uBAAuB,CAAC;AAGjE,eAAO,MAAM,UAAU,0GAAgB,CAAC;AACxC,eAAO,MAAM,iBAAiB,yGAAe,CAAC;AAE9C,eAAO,MAAM,yBAAyB,iKAqBpC,CAAC;AAEH,eAAO,MAAM,aAAa,EAAE,iBAAiB,CAAC,kBAAkB,GAAG,YAAY,CAoE9E,CAAC;AAEF,eAAe,aAAa,CAAC"}