@pega/cosmos-react-core 9.0.0-build.19.5 → 9.0.0-build.19.7

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 (52) hide show
  1. package/lib/components/AIRewrite/AIRewrite.d.ts +12 -0
  2. package/lib/components/AIRewrite/AIRewrite.d.ts.map +1 -0
  3. package/lib/components/AIRewrite/AIRewrite.js +52 -0
  4. package/lib/components/AIRewrite/AIRewrite.js.map +1 -0
  5. package/lib/components/AIRewrite/AIRewrite.test-ids.d.ts +2 -0
  6. package/lib/components/AIRewrite/AIRewrite.test-ids.d.ts.map +1 -0
  7. package/lib/components/AIRewrite/AIRewrite.test-ids.js +10 -0
  8. package/lib/components/AIRewrite/AIRewrite.test-ids.js.map +1 -0
  9. package/lib/components/AIRewrite/AIRewrite.types.d.ts +20 -0
  10. package/lib/components/AIRewrite/AIRewrite.types.d.ts.map +1 -0
  11. package/lib/components/AIRewrite/AIRewrite.types.js +2 -0
  12. package/lib/components/AIRewrite/AIRewrite.types.js.map +1 -0
  13. package/lib/components/AIRewrite/index.d.ts +4 -0
  14. package/lib/components/AIRewrite/index.d.ts.map +1 -0
  15. package/lib/components/AIRewrite/index.js +3 -0
  16. package/lib/components/AIRewrite/index.js.map +1 -0
  17. package/lib/components/MultiStepForm/FormProgress.styles.d.ts +17 -5
  18. package/lib/components/MultiStepForm/FormProgress.styles.d.ts.map +1 -1
  19. package/lib/components/MultiStepForm/FormProgress.styles.js +174 -69
  20. package/lib/components/MultiStepForm/FormProgress.styles.js.map +1 -1
  21. package/lib/components/MultiStepForm/HorizontalFormProgress.d.ts +2 -1
  22. package/lib/components/MultiStepForm/HorizontalFormProgress.d.ts.map +1 -1
  23. package/lib/components/MultiStepForm/HorizontalFormProgress.js +42 -24
  24. package/lib/components/MultiStepForm/HorizontalFormProgress.js.map +1 -1
  25. package/lib/components/MultiStepForm/MultiStepForm.d.ts +1 -1
  26. package/lib/components/MultiStepForm/MultiStepForm.d.ts.map +1 -1
  27. package/lib/components/MultiStepForm/MultiStepForm.js +18 -6
  28. package/lib/components/MultiStepForm/MultiStepForm.js.map +1 -1
  29. package/lib/components/MultiStepForm/MultiStepForm.types.d.ts +20 -6
  30. package/lib/components/MultiStepForm/MultiStepForm.types.d.ts.map +1 -1
  31. package/lib/components/MultiStepForm/MultiStepForm.types.js.map +1 -1
  32. package/lib/components/MultiStepForm/VerticalFormProgress.d.ts +1 -1
  33. package/lib/components/MultiStepForm/VerticalFormProgress.d.ts.map +1 -1
  34. package/lib/components/MultiStepForm/VerticalFormProgress.js +7 -4
  35. package/lib/components/MultiStepForm/VerticalFormProgress.js.map +1 -1
  36. package/lib/components/MultiStepForm/useFormProgressOverflow.d.ts +6 -0
  37. package/lib/components/MultiStepForm/useFormProgressOverflow.d.ts.map +1 -0
  38. package/lib/components/MultiStepForm/useFormProgressOverflow.js +34 -0
  39. package/lib/components/MultiStepForm/useFormProgressOverflow.js.map +1 -0
  40. package/lib/hooks/useI18n.d.ts +13 -0
  41. package/lib/hooks/useI18n.d.ts.map +1 -1
  42. package/lib/i18n/default.d.ts +13 -0
  43. package/lib/i18n/default.d.ts.map +1 -1
  44. package/lib/i18n/default.js +14 -0
  45. package/lib/i18n/default.js.map +1 -1
  46. package/lib/i18n/i18n.d.ts +13 -0
  47. package/lib/i18n/i18n.d.ts.map +1 -1
  48. package/lib/index.d.ts +2 -0
  49. package/lib/index.d.ts.map +1 -1
  50. package/lib/index.js +2 -0
  51. package/lib/index.js.map +1 -1
  52. package/package.json +1 -1
@@ -0,0 +1,12 @@
1
+ import type { AIRewriteProps } from './AIRewrite.types';
2
+ /**
3
+ * AIRewrite - A popover dialog for AI-powered text rewriting
4
+ *
5
+ * Renders in three modes:
6
+ * 1. Form mode (default) — collects rewrite action + optional instructions
7
+ * 2. Loading mode (isLoading=true) — shows progress while the AI processes
8
+ * 3. Review mode (rewrittenText is set) — editable text area with Apply / Back
9
+ */
10
+ declare const AIRewrite: ({ target, testId, onSubmit, onCancel, isLoading, rewrittenText, onApply, onBack }: AIRewriteProps) => import("react/jsx-runtime").JSX.Element;
11
+ export default AIRewrite;
12
+ //# sourceMappingURL=AIRewrite.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AIRewrite.d.ts","sourceRoot":"","sources":["../../../src/components/AIRewrite/AIRewrite.tsx"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,cAAc,EAAY,MAAM,mBAAmB,CAAC;AAGlE;;;;;;;GAOG;AACH,QAAA,MAAM,SAAS,GAAI,mFAShB,cAAc,4CA8GhB,CAAC;AAEF,eAAe,SAAS,CAAC"}
@@ -0,0 +1,52 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useEffect, useState } from 'react';
3
+ import { FormDialog, RadioButtonGroup, RadioButton, TextArea, useI18n, useTestIds, Flex } from '@pega/cosmos-react-core';
4
+ import { getAIRewriteTestIds } from './AIRewrite.test-ids';
5
+ /**
6
+ * AIRewrite - A popover dialog for AI-powered text rewriting
7
+ *
8
+ * Renders in three modes:
9
+ * 1. Form mode (default) — collects rewrite action + optional instructions
10
+ * 2. Loading mode (isLoading=true) — shows progress while the AI processes
11
+ * 3. Review mode (rewrittenText is set) — editable text area with Apply / Back
12
+ */
13
+ const AIRewrite = ({ target, testId, onSubmit, onCancel, isLoading, rewrittenText, onApply, onBack }) => {
14
+ const t = useI18n();
15
+ const testIds = useTestIds(testId, getAIRewriteTestIds);
16
+ const [selectedAction, setSelectedAction] = useState('improve');
17
+ const [additionalInstructions, setAdditionalInstructions] = useState('');
18
+ const [editableRewrittenText, setEditableRewrittenText] = useState(rewrittenText ?? '');
19
+ // Sync editable text whenever a new AI result arrives
20
+ useEffect(() => {
21
+ if (rewrittenText !== undefined) {
22
+ setEditableRewrittenText(rewrittenText);
23
+ }
24
+ }, [rewrittenText]);
25
+ const handleActionChange = (e) => {
26
+ const newAction = e.target.value;
27
+ if (newAction === 'improve' ||
28
+ newAction === 'shorter' ||
29
+ newAction === 'professional' ||
30
+ newAction === 'friendly') {
31
+ setSelectedAction(newAction);
32
+ }
33
+ };
34
+ const handleSubmit = () => {
35
+ onSubmit(selectedAction, additionalInstructions);
36
+ };
37
+ const handleCancel = () => {
38
+ target.focus();
39
+ onCancel();
40
+ };
41
+ // Review mode — show the AI result in an editable field
42
+ if (rewrittenText !== undefined) {
43
+ return (_jsx(FormDialog, { target: target, heading: t('ai_rewrite_title'), onDismiss: handleCancel, onCancel: { text: t('ai_rewrite_back'), handler: () => onBack?.() }, onSubmit: { text: t('ai_rewrite_apply'), handler: () => onApply?.(editableRewrittenText) }, children: _jsx(TextArea, { label: t('ai_rewrite_result_label'), value: editableRewrittenText, onChange: e => setEditableRewrittenText(e.target.value), "data-testid": testIds.reviewTextArea }) }));
44
+ }
45
+ // Form mode (default or loading)
46
+ return (_jsx(FormDialog, { target: target, heading: t('ai_rewrite_title'), progress: isLoading, onCancel: handleCancel, onSubmit: {
47
+ disabled: isLoading,
48
+ handler: handleSubmit
49
+ }, children: _jsxs(Flex, { container: { direction: 'column', rowGap: 2 }, children: [_jsxs(RadioButtonGroup, { name: 'aiAction', label: t('ai_rewrite_label'), required: true, children: [_jsx(RadioButton, { value: 'improve', label: t('ai_rewrite_improve'), checked: selectedAction === 'improve', onChange: handleActionChange, "data-testid": testIds.radioClearer }), _jsx(RadioButton, { value: 'shorter', label: t('ai_rewrite_shorter'), checked: selectedAction === 'shorter', onChange: handleActionChange, "data-testid": testIds.radioShorter }), _jsx(RadioButton, { value: 'professional', label: t('ai_rewrite_professional'), checked: selectedAction === 'professional', onChange: handleActionChange, "data-testid": testIds.radioProfessional }), _jsx(RadioButton, { value: 'friendly', label: t('ai_rewrite_friendly'), checked: selectedAction === 'friendly', onChange: handleActionChange, "data-testid": testIds.radioFriendly })] }), _jsx(TextArea, { label: t('ai_rewrite_instructions_label'), info: t('ai_rewrite_instructions_info'), value: additionalInstructions, onChange: e => setAdditionalInstructions(e.target.value), maxLength: 200, "data-testid": testIds.instructionsInput })] }) }));
50
+ };
51
+ export default AIRewrite;
52
+ //# sourceMappingURL=AIRewrite.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AIRewrite.js","sourceRoot":"","sources":["../../../src/components/AIRewrite/AIRewrite.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAG5C,OAAO,EACL,UAAU,EACV,gBAAgB,EAChB,WAAW,EACX,QAAQ,EACR,OAAO,EACP,UAAU,EACV,IAAI,EACL,MAAM,yBAAyB,CAAC;AAGjC,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAE3D;;;;;;;GAOG;AACH,MAAM,SAAS,GAAG,CAAC,EACjB,MAAM,EACN,MAAM,EACN,QAAQ,EACR,QAAQ,EACR,SAAS,EACT,aAAa,EACb,OAAO,EACP,MAAM,EACS,EAAE,EAAE;IACnB,MAAM,CAAC,GAAG,OAAO,EAAE,CAAC;IACpB,MAAM,OAAO,GAAG,UAAU,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAAC;IACxD,MAAM,CAAC,cAAc,EAAE,iBAAiB,CAAC,GAAG,QAAQ,CAAW,SAAS,CAAC,CAAC;IAC1E,MAAM,CAAC,sBAAsB,EAAE,yBAAyB,CAAC,GAAG,QAAQ,CAAC,EAAE,CAAC,CAAC;IACzE,MAAM,CAAC,qBAAqB,EAAE,wBAAwB,CAAC,GAAG,QAAQ,CAAC,aAAa,IAAI,EAAE,CAAC,CAAC;IAExF,sDAAsD;IACtD,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,aAAa,KAAK,SAAS,EAAE,CAAC;YAChC,wBAAwB,CAAC,aAAa,CAAC,CAAC;QAC1C,CAAC;IACH,CAAC,EAAE,CAAC,aAAa,CAAC,CAAC,CAAC;IAEpB,MAAM,kBAAkB,GAAG,CAAC,CAAgC,EAAE,EAAE;QAC9D,MAAM,SAAS,GAAG,CAAC,CAAC,MAA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AM,CAAC,KAAK,CAAC,EACxD,SAAS,EAAE,GAAG,iBACD,OAAO,CAAC,iBAAiB,GACtC,IACG,GACI,CACd,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,SAAS,CAAC","sourcesContent":["import { useEffect, useState } from 'react';\nimport type { ChangeEvent } from 'react';\n\nimport {\n FormDialog,\n RadioButtonGroup,\n RadioButton,\n TextArea,\n useI18n,\n useTestIds,\n Flex\n} from '@pega/cosmos-react-core';\n\nimport type { AIRewriteProps, AIAction } from './AIRewrite.types';\nimport { getAIRewriteTestIds } from './AIRewrite.test-ids';\n\n/**\n * AIRewrite - A popover dialog for AI-powered text rewriting\n *\n * Renders in three modes:\n * 1. Form mode (default) — collects rewrite action + optional instructions\n * 2. Loading mode (isLoading=true) — shows progress while the AI processes\n * 3. Review mode (rewrittenText is set) — editable text area with Apply / Back\n */\nconst AIRewrite = ({\n target,\n testId,\n onSubmit,\n onCancel,\n isLoading,\n rewrittenText,\n onApply,\n onBack\n}: AIRewriteProps) => {\n const t = useI18n();\n const testIds = useTestIds(testId, getAIRewriteTestIds);\n const [selectedAction, setSelectedAction] = useState<AIAction>('improve');\n const [additionalInstructions, setAdditionalInstructions] = useState('');\n const [editableRewrittenText, setEditableRewrittenText] = useState(rewrittenText ?? '');\n\n // Sync editable text whenever a new AI result arrives\n useEffect(() => {\n if (rewrittenText !== undefined) {\n setEditableRewrittenText(rewrittenText);\n }\n }, [rewrittenText]);\n\n const handleActionChange = (e: ChangeEvent<HTMLInputElement>) => {\n const newAction = e.target.value;\n if (\n newAction === 'improve' ||\n newAction === 'shorter' ||\n newAction === 'professional' ||\n newAction === 'friendly'\n ) {\n setSelectedAction(newAction);\n }\n };\n\n const handleSubmit = () => {\n onSubmit(selectedAction, additionalInstructions);\n };\n\n const handleCancel = () => {\n target.focus();\n onCancel();\n };\n\n // Review mode — show the AI result in an editable field\n if (rewrittenText !== undefined) {\n return (\n <FormDialog\n target={target}\n heading={t('ai_rewrite_title')}\n onDismiss={handleCancel}\n onCancel={{ text: t('ai_rewrite_back'), handler: () => onBack?.() }}\n onSubmit={{ text: t('ai_rewrite_apply'), handler: () => onApply?.(editableRewrittenText) }}\n >\n <TextArea\n label={t('ai_rewrite_result_label')}\n value={editableRewrittenText}\n onChange={e => setEditableRewrittenText(e.target.value)}\n data-testid={testIds.reviewTextArea}\n />\n </FormDialog>\n );\n }\n\n // Form mode (default or loading)\n return (\n <FormDialog\n target={target}\n heading={t('ai_rewrite_title')}\n progress={isLoading}\n onCancel={handleCancel}\n onSubmit={{\n disabled: isLoading,\n handler: handleSubmit\n }}\n >\n <Flex container={{ direction: 'column', rowGap: 2 }}>\n <RadioButtonGroup name='aiAction' label={t('ai_rewrite_label')} required>\n <RadioButton\n value='improve'\n label={t('ai_rewrite_improve')}\n checked={selectedAction === 'improve'}\n onChange={handleActionChange}\n data-testid={testIds.radioClearer}\n />\n <RadioButton\n value='shorter'\n label={t('ai_rewrite_shorter')}\n checked={selectedAction === 'shorter'}\n onChange={handleActionChange}\n data-testid={testIds.radioShorter}\n />\n <RadioButton\n value='professional'\n label={t('ai_rewrite_professional')}\n checked={selectedAction === 'professional'}\n onChange={handleActionChange}\n data-testid={testIds.radioProfessional}\n />\n <RadioButton\n value='friendly'\n label={t('ai_rewrite_friendly')}\n checked={selectedAction === 'friendly'}\n onChange={handleActionChange}\n data-testid={testIds.radioFriendly}\n />\n </RadioButtonGroup>\n\n <TextArea\n label={t('ai_rewrite_instructions_label')}\n info={t('ai_rewrite_instructions_info')}\n value={additionalInstructions}\n onChange={e => setAdditionalInstructions(e.target.value)}\n maxLength={200}\n data-testid={testIds.instructionsInput}\n />\n </Flex>\n </FormDialog>\n );\n};\n\nexport default AIRewrite;\n"]}
@@ -0,0 +1,2 @@
1
+ export declare const getAIRewriteTestIds: (testIdProp?: import("../..").TestIdProp["testId"]) => import("../..").TestIdsRecord<readonly ["radio-clearer", "radio-shorter", "radio-professional", "radio-friendly", "instructions-input", "review-text-area"]>;
2
+ //# sourceMappingURL=AIRewrite.test-ids.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AIRewrite.test-ids.d.ts","sourceRoot":"","sources":["../../../src/components/AIRewrite/AIRewrite.test-ids.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,mBAAmB,qNAOrB,CAAC"}
@@ -0,0 +1,10 @@
1
+ import { createTestIds } from '../../utils';
2
+ export const getAIRewriteTestIds = createTestIds('ai-rewrite-popover', [
3
+ 'radio-clearer',
4
+ 'radio-shorter',
5
+ 'radio-professional',
6
+ 'radio-friendly',
7
+ 'instructions-input',
8
+ 'review-text-area'
9
+ ]);
10
+ //# sourceMappingURL=AIRewrite.test-ids.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AIRewrite.test-ids.js","sourceRoot":"","sources":["../../../src/components/AIRewrite/AIRewrite.test-ids.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5C,MAAM,CAAC,MAAM,mBAAmB,GAAG,aAAa,CAAC,oBAAoB,EAAE;IACrE,eAAe;IACf,eAAe;IACf,oBAAoB;IACpB,gBAAgB;IAChB,oBAAoB;IACpB,kBAAkB;CACV,CAAC,CAAC","sourcesContent":["import { createTestIds } from '../../utils';\n\nexport const getAIRewriteTestIds = createTestIds('ai-rewrite-popover', [\n 'radio-clearer',\n 'radio-shorter',\n 'radio-professional',\n 'radio-friendly',\n 'instructions-input',\n 'review-text-area'\n] as const);\n"]}
@@ -0,0 +1,20 @@
1
+ import type { TestIdProp } from '../../types';
2
+ /** AI rewrite action types */
3
+ export type AIAction = 'improve' | 'shorter' | 'professional' | 'friendly';
4
+ export interface AIRewriteProps extends TestIdProp {
5
+ /** The button element that triggered the popover */
6
+ target: HTMLElement;
7
+ /** Callback when user submits the rewrite form */
8
+ onSubmit: (rewriteAction: AIAction, additionalInstructions: string) => void;
9
+ /** Callback when user cancels or dismisses the popover */
10
+ onCancel: () => void;
11
+ /** When true, shows a loading/progress state while the AI is generating a result */
12
+ isLoading?: boolean;
13
+ /** When set, transitions the popover to a review step showing the AI-generated text in an editable field */
14
+ rewrittenText?: string;
15
+ /** Called when the user accepts the (optionally edited) rewritten text in the review step */
16
+ onApply?: (text: string) => void;
17
+ /** Called when the user clicks Back in the review step to return to the form */
18
+ onBack?: () => void;
19
+ }
20
+ //# sourceMappingURL=AIRewrite.types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AIRewrite.types.d.ts","sourceRoot":"","sources":["../../../src/components/AIRewrite/AIRewrite.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE9C,8BAA8B;AAC9B,MAAM,MAAM,QAAQ,GAAG,SAAS,GAAG,SAAS,GAAG,cAAc,GAAG,UAAU,CAAC;AAE3E,MAAM,WAAW,cAAe,SAAQ,UAAU;IAChD,oDAAoD;IACpD,MAAM,EAAE,WAAW,CAAC;IAEpB,kDAAkD;IAClD,QAAQ,EAAE,CAAC,aAAa,EAAE,QAAQ,EAAE,sBAAsB,EAAE,MAAM,KAAK,IAAI,CAAC;IAE5E,0DAA0D;IAC1D,QAAQ,EAAE,MAAM,IAAI,CAAC;IAErB,oFAAoF;IACpF,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB,4GAA4G;IAC5G,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB,6FAA6F;IAC7F,OAAO,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAEjC,gFAAgF;IAChF,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;CACrB"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=AIRewrite.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AIRewrite.types.js","sourceRoot":"","sources":["../../../src/components/AIRewrite/AIRewrite.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { TestIdProp } from '../../types';\n\n/** AI rewrite action types */\nexport type AIAction = 'improve' | 'shorter' | 'professional' | 'friendly';\n\nexport interface AIRewriteProps extends TestIdProp {\n /** The button element that triggered the popover */\n target: HTMLElement;\n\n /** Callback when user submits the rewrite form */\n onSubmit: (rewriteAction: AIAction, additionalInstructions: string) => void;\n\n /** Callback when user cancels or dismisses the popover */\n onCancel: () => void;\n\n /** When true, shows a loading/progress state while the AI is generating a result */\n isLoading?: boolean;\n\n /** When set, transitions the popover to a review step showing the AI-generated text in an editable field */\n rewrittenText?: string;\n\n /** Called when the user accepts the (optionally edited) rewritten text in the review step */\n onApply?: (text: string) => void;\n\n /** Called when the user clicks Back in the review step to return to the form */\n onBack?: () => void;\n}\n"]}
@@ -0,0 +1,4 @@
1
+ export { default } from './AIRewrite';
2
+ export type { AIRewriteProps, AIAction } from './AIRewrite.types';
3
+ export { getAIRewriteTestIds } from './AIRewrite.test-ids';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/AIRewrite/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACtC,YAAY,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAClE,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC"}
@@ -0,0 +1,3 @@
1
+ export { default } from './AIRewrite';
2
+ export { getAIRewriteTestIds } from './AIRewrite.test-ids';
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/AIRewrite/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAEtC,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC","sourcesContent":["export { default } from './AIRewrite';\nexport type { AIRewriteProps, AIAction } from './AIRewrite.types';\nexport { getAIRewriteTestIds } from './AIRewrite.test-ids';\n"]}
@@ -1,18 +1,30 @@
1
1
  import type { Step } from './MultiStepForm.types';
2
+ /** Min width of each step item including labels in ch units */
3
+ export declare const stepItemMinWidth = 15;
4
+ /** Min width of step marker without labels in ch units */
5
+ export declare const stepMarkerMinWidth = 3;
2
6
  export declare const CurrentStepPopover: import("styled-components").StyledComponent<(<Modifiers extends string = string>(props: import("../Popover").PopoverProps<Modifiers> & import("../..").ForwardProps) => import("react").ReactElement | null), import("styled-components").DefaultTheme, {}, never>;
3
- export declare const StyledBar: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
7
+ export declare const StyledBar: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {
8
+ shifted?: boolean;
9
+ }, never>;
4
10
  export declare const StyledFill: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
5
- export declare const StyledFormProgress: import("styled-components").StyledComponent<import("../..").ForwardRefForwardPropsComponent<import("../Flex").FlexProps>, import("styled-components").DefaultTheme, {}, never>;
6
- export declare const StyledStepMarkers: import("styled-components").StyledComponent<"ol", import("styled-components").DefaultTheme, {}, never>;
7
- export declare const StyledVerticalStepMarkers: import("styled-components").StyledComponent<"ol", import("styled-components").DefaultTheme, {}, never>;
11
+ export declare const StyledFormProgress: import("styled-components").StyledComponent<import("../..").ForwardRefForwardPropsComponent<import("../Flex").FlexProps>, import("styled-components").DefaultTheme, {
12
+ showStepNames?: boolean;
13
+ }, never>;
8
14
  export declare const StepMarker: import("styled-components").StyledComponent<import("../..").ForwardRefForwardPropsComponent<import("../Button/BareButton").BareButtonProps>, import("styled-components").DefaultTheme, {
9
15
  current: boolean;
10
16
  depth: Step["depth"];
11
- prior: boolean;
17
+ completed?: Step["completed"];
18
+ clickable?: boolean;
19
+ }, never>;
20
+ export declare const StyleHorizontalStepMarkers: import("styled-components").StyledComponent<"ol", import("styled-components").DefaultTheme, {
21
+ showStepNames?: boolean;
12
22
  }, never>;
23
+ export declare const StyledVerticalStepMarkers: import("styled-components").StyledComponent<"ol", import("styled-components").DefaultTheme, {}, never>;
13
24
  export declare const StyledBulletWrapper: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {
14
25
  hasNext: boolean;
15
26
  prior: boolean;
16
27
  }, never>;
17
28
  export declare const StyledStepText: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
29
+ export declare const StyledHorizontalStepText: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
18
30
  //# sourceMappingURL=FormProgress.styles.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"FormProgress.styles.d.ts","sourceRoot":"","sources":["../../../src/components/MultiStepForm/FormProgress.styles.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAElD,eAAO,MAAM,kBAAkB,oQAY9B,CAAC;AAEF,eAAO,MAAM,SAAS,yGAapB,CAAC;AAIH,eAAO,MAAM,UAAU,yGAsBrB,CAAC;AAIH,eAAO,MAAM,kBAAkB,gLAe7B,CAAC;AAIH,eAAO,MAAM,iBAAiB,wGAY5B,CAAC;AAIH,eAAO,MAAM,yBAAyB,wGAErC,CAAC;AAEF,eAAO,MAAM,UAAU;aACZ,OAAO;WACT,IAAI,CAAC,OAAO,CAAC;WACb,OAAO;SA2Ed,CAAC;AAIH,eAAO,MAAM,mBAAmB;aACrB,OAAO;WACT,OAAO;SA+Bd,CAAC;AAIH,eAAO,MAAM,cAAc,yGAKzB,CAAC"}
1
+ {"version":3,"file":"FormProgress.styles.d.ts","sourceRoot":"","sources":["../../../src/components/MultiStepForm/FormProgress.styles.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAElD,+DAA+D;AAC/D,eAAO,MAAM,gBAAgB,KAAK,CAAC;AAEnC,0DAA0D;AAC1D,eAAO,MAAM,kBAAkB,IAAI,CAAC;AAEpC,eAAO,MAAM,kBAAkB,oQAU9B,CAAC;AAyBF,eAAO,MAAM,SAAS;cAA0B,OAAO;SAkBrD,CAAC;AAIH,eAAO,MAAM,UAAU,yGA2BrB,CAAC;AAIH,eAAO,MAAM,kBAAkB;oBAAkC,OAAO;SAmBtE,CAAC;AAIH,eAAO,MAAM,UAAU;aACZ,OAAO;WACT,IAAI,CAAC,OAAO,CAAC;gBACR,IAAI,CAAC,WAAW,CAAC;gBACjB,OAAO;SAqGnB,CAAC;AAIH,eAAO,MAAM,0BAA0B;oBAA+B,OAAO;SAsD5E,CAAC;AAIF,eAAO,MAAM,yBAAyB,wGAErC,CAAC;AAEF,eAAO,MAAM,mBAAmB;aACrB,OAAO;WACT,OAAO;SAuCd,CAAC;AAIH,eAAO,MAAM,cAAc,yGAKzB,CAAC;AAIH,eAAO,MAAM,wBAAwB,yGAUnC,CAAC"}
@@ -7,6 +7,11 @@ import { StyledText } from '../Text';
7
7
  import { calculateFontSize } from '../../styles';
8
8
  import { useDirection } from '../../hooks';
9
9
  import Flex from '../Flex';
10
+ import { ellipsisOverflow } from '../../styles/mixins';
11
+ /** Min width of each step item including labels in ch units */
12
+ export const stepItemMinWidth = 15;
13
+ /** Min width of step marker without labels in ch units */
14
+ export const stepMarkerMinWidth = 3;
10
15
  export const CurrentStepPopover = styled(Popover) `
11
16
  max-width: 100%;
12
17
  background-color: transparent;
@@ -15,17 +20,35 @@ export const CurrentStepPopover = styled(Popover) `
15
20
  animation: none;
16
21
 
17
22
  & > ${StyledText} {
18
- overflow: hidden;
19
- white-space: nowrap;
20
- text-overflow: ellipsis;
23
+ ${ellipsisOverflow}
21
24
  }
22
25
  `;
23
- export const StyledBar = styled.div(({ theme }) => {
24
- const { components: { 'form-control': { 'border-color': borderColor } } } = theme;
26
+ const calculateStepMarkerSizes = (fontSize, fontScale) => {
27
+ const { m: stepMarkerSize } = calculateFontSize(fontSize, fontScale);
28
+ return {
29
+ stepMarkerSize,
30
+ smallStepMarkerSize: `calc(${stepMarkerSize} / 1.5)`,
31
+ bigStepMarkerSize: `calc(${stepMarkerSize} * 1.5)`
32
+ };
33
+ };
34
+ const calculateBarTopPadding = (fontSize, fontScale, lineHeight) => {
35
+ const { bigStepMarkerSize } = calculateStepMarkerSizes(fontSize, fontScale);
36
+ return {
37
+ // assuming the step progress always contains current step marker which is the biggest one,
38
+ // the top padding of the bar should be half of the big step marker size minus line height of the bar
39
+ // to be vertically centered
40
+ stepBarTopPadding: `calc((${bigStepMarkerSize} / 2) - (${lineHeight} / 2))`
41
+ };
42
+ };
43
+ export const StyledBar = styled.div(({ shifted, theme }) => {
44
+ const { base: { 'font-size': fontSize, 'font-scale': fontScale }, components: { 'form-control': { 'border-color': borderColor } } } = theme;
45
+ const lineHeight = '0.125rem';
46
+ const { stepBarTopPadding } = calculateBarTopPadding(fontSize, fontScale, lineHeight);
25
47
  return css `
26
48
  position: absolute;
49
+ ${shifted && `inset-block-start: ${stepBarTopPadding};`}
27
50
  width: 100%;
28
- height: 0.0625rem;
51
+ height: ${lineHeight};
29
52
  background: ${borderColor};
30
53
  `;
31
54
  });
@@ -33,10 +56,14 @@ StyledBar.defaultProps = defaultThemeProp;
33
56
  export const StyledFill = styled.div(({ theme }) => {
34
57
  const { base: { animation: { speed: animationSpeed, timing: { ease: animationTiming } }, palette: { interactive } } } = theme;
35
58
  const { ltr } = useDirection();
59
+ const markedLineThicknessFactor = 2;
36
60
  return css `
37
61
  position: absolute;
38
62
  width: 100%;
39
- height: 100%;
63
+ height: calc(100% * ${markedLineThicknessFactor});
64
+
65
+ /* top position based on line thickness factor to keep the fill centered */
66
+ top: calc(-50% * (${markedLineThicknessFactor} - 1));
40
67
  background: ${interactive};
41
68
  transition: all calc(2 * ${animationSpeed}) ${animationTiming};
42
69
  transform: scaleX(var(--fillScale));
@@ -44,107 +71,174 @@ export const StyledFill = styled.div(({ theme }) => {
44
71
  `;
45
72
  });
46
73
  StyledFill.defaultProps = defaultThemeProp;
47
- export const StyledFormProgress = styled(Flex)(({ theme }) => {
48
- const { base: { spacing, 'font-size': fontSize, 'font-scale': fontScale }, components: { text: { h4: { 'font-size': h4fontSize } } } } = theme;
74
+ export const StyledFormProgress = styled(Flex)(({ showStepNames, theme }) => {
75
+ const { base: { spacing, 'font-size': fontSize, 'font-scale': fontScale }, components: { text: { h4: { 'font-size': h3fontSize } } } } = theme;
49
76
  const fontSizes = calculateFontSize(fontSize, fontScale);
50
77
  return css `
51
78
  position: relative;
52
- padding-block-start: calc(${spacing} + ${fontSizes[h4fontSize]} * 1.35);
79
+ ${!showStepNames &&
80
+ `padding-block-end: calc(${spacing} + ${fontSizes[h3fontSize]} * 1.35);`}
53
81
  `;
54
82
  });
55
83
  StyledFormProgress.defaultProps = defaultThemeProp;
56
- export const StyledStepMarkers = styled.ol(({ theme }) => {
57
- return css `
58
- list-style-type: none;
59
-
60
- li {
61
- display: flex;
84
+ export const StepMarker = styled(BareButton)(({ current, depth, completed, clickable, theme }) => {
85
+ const { base: { 'font-size': fontSize, 'font-scale': fontScale, animation: { speed: animationSpeed, timing: { ease: animationTiming } }, palette: { interactive, 'primary-background': primaryBackground }, shadow: { focus: focusShadow }, 'hit-area': { 'mouse-min': buttonSize, 'finger-min': touchButtonSize } }, components: { 'form-control': { 'border-color': borderColor, 'border-width': borderWidth } } } = theme;
86
+ const { stepMarkerSize, smallStepMarkerSize, bigStepMarkerSize } = calculateStepMarkerSizes(fontSize, fontScale);
87
+ // Determine the actual size for this marker based on its state
88
+ let markerSize = stepMarkerSize;
89
+ if (current) {
90
+ markerSize = bigStepMarkerSize;
62
91
  }
63
-
64
- &:has(:focus-visible) {
65
- box-shadow: ${theme.base.shadow['focus-group']};
92
+ else if (depth === 1) {
93
+ markerSize = smallStepMarkerSize;
66
94
  }
67
- `;
68
- });
69
- StyledStepMarkers.defaultProps = defaultThemeProp;
70
- export const StyledVerticalStepMarkers = styled.ol `
71
- list-style-type: none;
72
- `;
73
- export const StepMarker = styled(BareButton)(({ current, depth, prior, theme }) => {
74
- const { base: { 'font-size': fontSize, 'font-scale': fontScale, animation: { speed: animationSpeed, timing: { ease: animationTiming } }, palette: { interactive, 'primary-background': primaryBackground }, shadow: { focus: focusShadow }, 'hit-area': { 'mouse-min': buttonSize, 'finger-min': touchButtonSize } }, components: { 'form-control': { 'border-color': borderColor } } } = theme;
75
- const { m: stepMarkerSize } = calculateFontSize(fontSize, fontScale);
76
- const smallStepMarkerSize = `calc(${stepMarkerSize} / 1.5)`;
77
95
  return css `
78
96
  position: relative;
79
97
  z-index: 1;
80
- ${size(depth === 1 ? smallStepMarkerSize : stepMarkerSize)}
81
- border-radius: 100%;
82
- background: ${primaryBackground};
83
- border: 0.0625rem solid ${borderColor};
84
- transition: all calc(2 * ${animationSpeed}) ${animationTiming};
85
98
 
86
- ${current &&
99
+ /* Fixed container size based on the biggest marker to prevent layout shifts */
100
+ ${size(bigStepMarkerSize)}
101
+ display: flex;
102
+ align-items: center;
103
+ justify-content: center;
104
+ flex-shrink: 0;
105
+
106
+ ${clickable
107
+ ? css `
108
+ border-color: ${interactive};
109
+ `
110
+ : css `
111
+ cursor: default;
112
+ `}
113
+
114
+ &::before {
115
+ content: '';
116
+ ${size(markerSize)}
117
+ position: absolute;
118
+ border-radius: 100%;
119
+ transition: all calc(2 * ${animationSpeed}) ${animationTiming};
120
+ }
121
+
122
+ &:focus::before {
123
+ box-shadow: ${focusShadow};
124
+ }
125
+
126
+ ${!current &&
87
127
  css `
88
- background: ${interactive};
89
- border-color: ${interactive};
128
+ border-color: transparent;
129
+ background: transparent;
130
+
131
+ &::before {
132
+ background: ${primaryBackground};
133
+ border: calc(2 * ${borderWidth}) solid ${clickable ? interactive : borderColor};
134
+
135
+ ${completed &&
136
+ css `
137
+ background: ${interactive};
138
+ border-color: ${interactive};
139
+ `}
140
+ }
90
141
  `}
91
- ${prior &&
142
+
143
+ ${current &&
92
144
  css `
93
- border-color: ${interactive};
145
+ &::before {
146
+ background: ${interactive};
147
+ }
94
148
  `}
149
+
95
150
  ::after {
96
151
  content: '';
97
152
  position: absolute;
98
153
  ${size(buttonSize)}
99
- inset-block-start: ${depth === 1
100
- ? `calc((${buttonSize} - ${smallStepMarkerSize}) / -2) `
101
- : `calc((${buttonSize} - ${stepMarkerSize}) / -2) `};
102
- inset-inline-start: ${depth === 1
103
- ? `calc((${buttonSize} - ${smallStepMarkerSize}) / -2) `
104
- : `calc((${buttonSize} - ${stepMarkerSize}) / -2) `};
154
+ inset-block-start: ${`calc((${buttonSize} - ${bigStepMarkerSize}) / -2) `};
155
+ inset-inline-start: ${`calc((${buttonSize} - ${bigStepMarkerSize}) / -2) `};
105
156
 
106
157
  @media (pointer: coarse) {
107
- inset-block-start: ${depth === 1
108
- ? `calc((${touchButtonSize} - ${smallStepMarkerSize}) / -2) `
109
- : `calc((${touchButtonSize} - ${stepMarkerSize}) / -2) `};
110
- inset-inline-start: ${depth === 1
111
- ? `calc((${touchButtonSize} - ${smallStepMarkerSize}) / -2) `
112
- : `calc((${touchButtonSize} - ${stepMarkerSize}) / -2) `};
158
+ inset-block-start: ${`calc((${touchButtonSize} - ${bigStepMarkerSize}) / -2) `};
159
+ inset-inline-start: ${`calc((${touchButtonSize} - ${bigStepMarkerSize}) / -2) `};
113
160
  ${size(touchButtonSize)}
114
161
  }
115
162
  }
163
+ `;
164
+ });
165
+ StepMarker.defaultProps = defaultThemeProp;
166
+ export const StyleHorizontalStepMarkers = styled.ol(({ showStepNames, theme }) => {
167
+ return css `
168
+ list-style-type: none;
169
+ justify-content: space-between;
116
170
 
117
- &:not(:only-child):first-child::after {
118
- inset-inline-start: 0;
119
- }
171
+ li {
172
+ display: flex;
173
+ position: relative;
174
+ flex: 1 1 0;
120
175
 
121
- &:not(:only-child):last-child::after {
122
- inset-inline-start: unset;
123
- inset-inline-end: 0;
124
- }
176
+ /* min width changes based on whether step names are shown */
177
+ min-width: ${`${showStepNames ? stepItemMinWidth : stepMarkerMinWidth}ch`};
178
+ font-size: small;
179
+ margin-inline: ${theme.base.spacing};
180
+ flex-direction: column;
181
+ align-items: center;
182
+ text-align: center;
183
+ }
125
184
 
126
- :focus {
127
- box-shadow: ${focusShadow};
128
- }
129
- `;
185
+ li:first-child,
186
+ li:last-child {
187
+ flex: 0.5 1 0;
188
+ /* stylelint-disable-next-line unit-allowed-list */
189
+ min-width: ${`${showStepNames ? stepItemMinWidth / 2 : stepMarkerMinWidth / 2}ch`};
190
+ }
191
+
192
+ li:first-child {
193
+ align-items: flex-start;
194
+ text-align: left;
195
+ margin-inline-start: 0;
196
+ padding-inline-start: 0;
197
+
198
+ ${StepMarker}::before {
199
+ inset-inline-start: 0;
200
+ }
201
+ }
202
+
203
+ li:last-child {
204
+ align-items: flex-end;
205
+ text-align: right;
206
+ margin-inline-end: 0;
207
+ padding-inline-end: 0;
208
+
209
+ ${StepMarker}::before {
210
+ inset-inline-end: 0;
211
+ }
212
+ }
213
+
214
+ &:has(:focus-visible) {
215
+ box-shadow: ${theme.base.shadow['focus-group']};
216
+ }
217
+ `;
130
218
  });
131
- StepMarker.defaultProps = defaultThemeProp;
219
+ StyleHorizontalStepMarkers.defaultProps = defaultThemeProp;
220
+ export const StyledVerticalStepMarkers = styled.ol `
221
+ list-style-type: none;
222
+ `;
132
223
  export const StyledBulletWrapper = styled.div(({ theme, hasNext, prior }) => {
133
- const { base: { animation: { speed: animationSpeed }, palette: { interactive } }, components: { 'form-control': { 'border-color': borderColor } } } = theme;
224
+ const { base: { 'font-size': fontSize, 'font-scale': fontScale, animation: { speed: animationSpeed }, palette: { interactive } }, components: { 'form-control': { 'border-color': borderColor } } } = theme;
225
+ const baseLineWidth = '0.125rem';
226
+ const lineWidth = prior ? `calc(2 * ${baseLineWidth})` : baseLineWidth;
227
+ const { bigStepMarkerSize } = calculateStepMarkerSizes(fontSize, fontScale);
134
228
  return css `
135
229
  position: relative;
136
- text-align: center;
137
230
  min-width: 2rem;
138
- padding-block-start: calc(1.15 * ${theme.base.spacing});
139
231
 
140
232
  ${hasNext &&
141
233
  css `
142
234
  &::after {
143
235
  content: '';
144
236
  position: absolute;
145
- margin-block-start: 0.85rem;
146
- inset-inline-start: calc(50% - 0.03125rem);
147
- width: 0.0625rem;
237
+
238
+ /* Center the line horizontally and vertically relative to the step marker */
239
+ inset-block-start: calc(${bigStepMarkerSize});
240
+ inset-inline-start: calc(50% - (${lineWidth} / 2));
241
+ width: ${lineWidth};
148
242
  height: 100%;
149
243
  background: ${prior ? interactive : borderColor};
150
244
  transition: background calc(2 * ${animationSpeed});
@@ -160,4 +254,15 @@ export const StyledStepText = styled.div(({ theme }) => {
160
254
  `;
161
255
  });
162
256
  StyledStepText.defaultProps = defaultThemeProp;
257
+ export const StyledHorizontalStepText = styled.div(({ theme }) => {
258
+ const fontSize = calculateFontSize(theme.base['font-size'], theme.base['font-scale']);
259
+ return css `
260
+ padding-block: ${theme.base.spacing};
261
+ overflow-wrap: break-word;
262
+ min-width: inherit;
263
+ font-size: ${fontSize.xxs};
264
+ text-align: inherit;
265
+ `;
266
+ });
267
+ StyledHorizontalStepText.defaultProps = defaultThemeProp;
163
268
  //# sourceMappingURL=FormProgress.styles.js.map
@@ -1 +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,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,UAAU,MAAM,sBAAsB,CAAC;AAC9C,OAAO,OAAO,MAAM,YAAY,CAAC;AACjC,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,iBAAiB,EAAiB,MAAM,cAAc,CAAC;AAChE,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,IAAI,MAAM,SAAS,CAAC;AAI3B,MAAM,CAAC,MAAM,kBAAkB,GAAG,MAAM,CAAC,OAAO,CAAC,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EAAE,EAAE,KAAK,EAAE,cAAc,EAAE,EACpC,OAAO,EAAE,EAAE,WAAW,EAAE,EACzB,EACD,UAAU,EAAE,EACV,cAAc,EAAE,EAAE,cAAc,EAAE,WAAW,EAAE,EAChD,EACF,GAAG,KAAK,CAAC;IACV,OAAO,GAAG,CAAA;;;;uCAI2B,KAAK,CAAC,IAAI,CAAC,OAAO;;MAEnD,OAAO;QACT,GAAG,CAAA;;;;;;;;sBAQe,KAAK,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,WAAW;0CACb,cAAc;;KAEnD;GACF,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,mBAAmB,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAEpD,MAAM,CAAC,MAAM,cAAc,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE;IACrD,OAAO,GAAG,CAAA;qBACS,KAAK,CAAC,IAAI,CAAC,OAAO;;GAEpC,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,cAAc,CAAC,YAAY,GAAG,gBAAgB,CAAC","sourcesContent":["import styled, { css } from 'styled-components';\nimport { size } from 'polished';\n\nimport { defaultThemeProp } from '../../theme';\nimport BareButton from '../Button/BareButton';\nimport Popover from '../Popover';\nimport { StyledText } from '../Text';\nimport { calculateFontSize, type FontSize } from '../../styles';\nimport { useDirection } from '../../hooks';\nimport Flex from '../Flex';\n\nimport type { Step } from './MultiStepForm.types';\n\nexport const CurrentStepPopover = styled(Popover)`\n max-width: 100%;\n background-color: transparent;\n z-index: 0;\n box-shadow: none;\n animation: none;\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 components: {\n 'form-control': { 'border-color': 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 StyledStepMarkers = styled.ol(({ theme }) => {\n return css`\n list-style-type: none;\n\n li {\n display: flex;\n }\n\n &:has(:focus-visible) {\n box-shadow: ${theme.base.shadow['focus-group']};\n }\n `;\n});\n\nStyledStepMarkers.defaultProps = defaultThemeProp;\n\nexport const StyledVerticalStepMarkers = styled.ol`\n list-style-type: none;\n`;\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\n const { m: stepMarkerSize } = calculateFontSize(fontSize, fontScale);\n const smallStepMarkerSize = `calc(${stepMarkerSize} / 1.5)`;\n\n return css`\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 ${prior &&\n css`\n border-color: ${interactive};\n `}\n ::after {\n content: '';\n position: absolute;\n ${size(buttonSize)}\n inset-block-start: ${depth === 1\n ? `calc((${buttonSize} - ${smallStepMarkerSize}) / -2) `\n : `calc((${buttonSize} - ${stepMarkerSize}) / -2) `};\n inset-inline-start: ${depth === 1\n ? `calc((${buttonSize} - ${smallStepMarkerSize}) / -2) `\n : `calc((${buttonSize} - ${stepMarkerSize}) / -2) `};\n\n @media (pointer: coarse) {\n inset-block-start: ${depth === 1\n ? `calc((${touchButtonSize} - ${smallStepMarkerSize}) / -2) `\n : `calc((${touchButtonSize} - ${stepMarkerSize}) / -2) `};\n inset-inline-start: ${depth === 1\n ? `calc((${touchButtonSize} - ${smallStepMarkerSize}) / -2) `\n : `calc((${touchButtonSize} - ${stepMarkerSize}) / -2) `};\n ${size(touchButtonSize)}\n }\n }\n\n &:not(:only-child):first-child::after {\n inset-inline-start: 0;\n }\n\n &:not(:only-child):last-child::after {\n inset-inline-start: unset;\n inset-inline-end: 0;\n }\n\n :focus {\n box-shadow: ${focusShadow};\n }\n `;\n});\n\nStepMarker.defaultProps = defaultThemeProp;\n\nexport const StyledBulletWrapper = styled.div<{\n hasNext: boolean;\n prior: boolean;\n}>(({ theme, hasNext, prior }) => {\n const {\n base: {\n animation: { speed: animationSpeed },\n palette: { interactive }\n },\n components: {\n 'form-control': { 'border-color': borderColor }\n }\n } = theme;\n return css`\n position: relative;\n text-align: center;\n min-width: 2rem;\n padding-block-start: calc(1.15 * ${theme.base.spacing});\n\n ${hasNext &&\n css`\n &::after {\n content: '';\n position: absolute;\n margin-block-start: 0.85rem;\n inset-inline-start: calc(50% - 0.03125rem);\n width: 0.0625rem;\n height: 100%;\n background: ${prior ? interactive : borderColor};\n transition: background calc(2 * ${animationSpeed});\n }\n `}\n `;\n});\n\nStyledBulletWrapper.defaultProps = defaultThemeProp;\n\nexport const StyledStepText = styled.div(({ theme }) => {\n return css`\n padding-block: ${theme.base.spacing};\n overflow-wrap: break-word;\n `;\n});\n\nStyledStepText.defaultProps = defaultThemeProp;\n"]}
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,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,UAAU,MAAM,sBAAsB,CAAC;AAC9C,OAAO,OAAO,MAAM,YAAY,CAAC;AACjC,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,iBAAiB,EAAiB,MAAM,cAAc,CAAC;AAChE,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAIvD,+DAA+D;AAC/D,MAAM,CAAC,MAAM,gBAAgB,GAAG,EAAE,CAAC;AAEnC,0DAA0D;AAC1D,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC;AAEpC,MAAM,CAAC,MAAM,kBAAkB,GAAG,MAAM,CAAC,OAAO,CAAC,CAAA;;;;;;;QAOzC,UAAU;MACZ,gBAAgB;;CAErB,CAAC;AAEF,MAAM,wBAAwB,GAAG,CAAC,QAAgB,EAAE,SAA0B,EAAE,EAAE;IAChF,MAAM,EAAE,CAAC,EAAE,cAAc,EAAE,GAAG,iBAAiB,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC;IACrE,OAAO;QACL,c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gB,CAAC","sourcesContent":["import styled, { css } from 'styled-components';\nimport { size } from 'polished';\n\nimport { defaultThemeProp } from '../../theme';\nimport BareButton from '../Button/BareButton';\nimport Popover from '../Popover';\nimport { StyledText } from '../Text';\nimport { calculateFontSize, type FontSize } from '../../styles';\nimport { useDirection } from '../../hooks';\nimport Flex from '../Flex';\nimport { ellipsisOverflow } from '../../styles/mixins';\n\nimport type { Step } from './MultiStepForm.types';\n\n/** Min width of each step item including labels in ch units */\nexport const stepItemMinWidth = 15;\n\n/** Min width of step marker without labels in ch units */\nexport const stepMarkerMinWidth = 3;\n\nexport const CurrentStepPopover = styled(Popover)`\n max-width: 100%;\n background-color: transparent;\n z-index: 0;\n box-shadow: none;\n animation: none;\n\n & > ${StyledText} {\n ${ellipsisOverflow}\n }\n`;\n\nconst calculateStepMarkerSizes = (fontSize: string, fontScale: string | number) => {\n const { m: stepMarkerSize } = calculateFontSize(fontSize, fontScale);\n return {\n stepMarkerSize,\n smallStepMarkerSize: `calc(${stepMarkerSize} / 1.5)`,\n bigStepMarkerSize: `calc(${stepMarkerSize} * 1.5)`\n };\n};\n\nconst calculateBarTopPadding = (\n fontSize: string,\n fontScale: string | number,\n lineHeight: string\n) => {\n const { bigStepMarkerSize } = calculateStepMarkerSizes(fontSize, fontScale);\n return {\n // assuming the step progress always contains current step marker which is the biggest one,\n // the top padding of the bar should be half of the big step marker size minus line height of the bar\n // to be vertically centered\n stepBarTopPadding: `calc((${bigStepMarkerSize} / 2) - (${lineHeight} / 2))`\n };\n};\n\nexport const StyledBar = styled.div<{ shifted?: boolean }>(({ shifted, theme }) => {\n const {\n base: { 'font-size': fontSize, 'font-scale': fontScale },\n components: {\n 'form-control': { 'border-color': borderColor }\n }\n } = theme;\n\n const lineHeight = '0.125rem';\n const { stepBarTopPadding } = calculateBarTopPadding(fontSize, fontScale, lineHeight);\n\n return css`\n position: absolute;\n ${shifted && `inset-block-start: ${stepBarTopPadding};`}\n width: 100%;\n height: ${lineHeight};\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 const markedLineThicknessFactor = 2;\n\n return css`\n position: absolute;\n width: 100%;\n height: calc(100% * ${markedLineThicknessFactor});\n\n /* top position based on line thickness factor to keep the fill centered */\n top: calc(-50% * (${markedLineThicknessFactor} - 1));\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)<{ showStepNames?: boolean }>(({\n showStepNames,\n theme\n}) => {\n const {\n base: { spacing, 'font-size': fontSize, 'font-scale': fontScale },\n components: {\n text: {\n h4: { 'font-size': h3fontSize }\n }\n }\n } = theme;\n const fontSizes = calculateFontSize(fontSize, fontScale);\n\n return css`\n position: relative;\n ${!showStepNames &&\n `padding-block-end: calc(${spacing} + ${fontSizes[h3fontSize as FontSize]} * 1.35);`}\n `;\n});\n\nStyledFormProgress.defaultProps = defaultThemeProp;\n\nexport const StepMarker = styled(BareButton)<{\n current: boolean;\n depth: Step['depth'];\n completed?: Step['completed'];\n clickable?: boolean;\n}>(({ current, depth, completed, clickable, 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, 'border-width': borderWidth }\n }\n } = theme;\n\n const { stepMarkerSize, smallStepMarkerSize, bigStepMarkerSize } = calculateStepMarkerSizes(\n fontSize,\n fontScale\n );\n\n // Determine the actual size for this marker based on its state\n let markerSize = stepMarkerSize;\n if (current) {\n markerSize = bigStepMarkerSize;\n } else if (depth === 1) {\n markerSize = smallStepMarkerSize;\n }\n\n return css`\n position: relative;\n z-index: 1;\n\n /* Fixed container size based on the biggest marker to prevent layout shifts */\n ${size(bigStepMarkerSize)}\n display: flex;\n align-items: center;\n justify-content: center;\n flex-shrink: 0;\n\n ${clickable\n ? css`\n border-color: ${interactive};\n `\n : css`\n cursor: default;\n `}\n\n &::before {\n content: '';\n ${size(markerSize)}\n position: absolute;\n border-radius: 100%;\n transition: all calc(2 * ${animationSpeed}) ${animationTiming};\n }\n\n &:focus::before {\n box-shadow: ${focusShadow};\n }\n\n ${!current &&\n css`\n border-color: transparent;\n background: transparent;\n\n &::before {\n background: ${primaryBackground};\n border: calc(2 * ${borderWidth}) solid ${clickable ? interactive : borderColor};\n\n ${completed &&\n css`\n background: ${interactive};\n border-color: ${interactive};\n `}\n }\n `}\n\n ${current &&\n css`\n &::before {\n background: ${interactive};\n }\n `}\n\n ::after {\n content: '';\n position: absolute;\n ${size(buttonSize)}\n inset-block-start: ${`calc((${buttonSize} - ${bigStepMarkerSize}) / -2) `};\n inset-inline-start: ${`calc((${buttonSize} - ${bigStepMarkerSize}) / -2) `};\n\n @media (pointer: coarse) {\n inset-block-start: ${`calc((${touchButtonSize} - ${bigStepMarkerSize}) / -2) `};\n inset-inline-start: ${`calc((${touchButtonSize} - ${bigStepMarkerSize}) / -2) `};\n ${size(touchButtonSize)}\n }\n }\n `;\n});\n\nStepMarker.defaultProps = defaultThemeProp;\n\nexport const StyleHorizontalStepMarkers = styled.ol<{ showStepNames?: boolean }>(\n ({ showStepNames, theme }) => {\n return css`\n list-style-type: none;\n justify-content: space-between;\n\n li {\n display: flex;\n position: relative;\n flex: 1 1 0;\n\n /* min width changes based on whether step names are shown */\n min-width: ${`${showStepNames ? stepItemMinWidth : stepMarkerMinWidth}ch`};\n font-size: small;\n margin-inline: ${theme.base.spacing};\n flex-direction: column;\n align-items: center;\n text-align: center;\n }\n\n li:first-child,\n li:last-child {\n flex: 0.5 1 0;\n /* stylelint-disable-next-line unit-allowed-list */\n min-width: ${`${showStepNames ? stepItemMinWidth / 2 : stepMarkerMinWidth / 2}ch`};\n }\n\n li:first-child {\n align-items: flex-start;\n text-align: left;\n margin-inline-start: 0;\n padding-inline-start: 0;\n\n ${StepMarker}::before {\n inset-inline-start: 0;\n }\n }\n\n li:last-child {\n align-items: flex-end;\n text-align: right;\n margin-inline-end: 0;\n padding-inline-end: 0;\n\n ${StepMarker}::before {\n inset-inline-end: 0;\n }\n }\n\n &:has(:focus-visible) {\n box-shadow: ${theme.base.shadow['focus-group']};\n }\n `;\n }\n);\n\nStyleHorizontalStepMarkers.defaultProps = defaultThemeProp;\n\nexport const StyledVerticalStepMarkers = styled.ol`\n list-style-type: none;\n`;\n\nexport const StyledBulletWrapper = styled.div<{\n hasNext: boolean;\n prior: boolean;\n}>(({ theme, hasNext, prior }) => {\n const {\n base: {\n 'font-size': fontSize,\n 'font-scale': fontScale,\n animation: { speed: animationSpeed },\n palette: { interactive }\n },\n components: {\n 'form-control': { 'border-color': borderColor }\n }\n } = theme;\n\n const baseLineWidth = '0.125rem';\n const lineWidth = prior ? `calc(2 * ${baseLineWidth})` : baseLineWidth;\n\n const { bigStepMarkerSize } = calculateStepMarkerSizes(fontSize, fontScale);\n\n return css`\n position: relative;\n min-width: 2rem;\n\n ${hasNext &&\n css`\n &::after {\n content: '';\n position: absolute;\n\n /* Center the line horizontally and vertically relative to the step marker */\n inset-block-start: calc(${bigStepMarkerSize});\n inset-inline-start: calc(50% - (${lineWidth} / 2));\n width: ${lineWidth};\n height: 100%;\n background: ${prior ? interactive : borderColor};\n transition: background calc(2 * ${animationSpeed});\n }\n `}\n `;\n});\n\nStyledBulletWrapper.defaultProps = defaultThemeProp;\n\nexport const StyledStepText = styled.div(({ theme }) => {\n return css`\n padding-block: ${theme.base.spacing};\n overflow-wrap: break-word;\n `;\n});\n\nStyledStepText.defaultProps = defaultThemeProp;\n\nexport const StyledHorizontalStepText = styled.div(({ theme }) => {\n const fontSize = calculateFontSize(theme.base['font-size'], theme.base['font-scale']);\n\n return css`\n padding-block: ${theme.base.spacing};\n overflow-wrap: break-word;\n min-width: inherit;\n font-size: ${fontSize.xxs};\n text-align: inherit;\n `;\n});\n\nStyledHorizontalStepText.defaultProps = defaultThemeProp;\n"]}
@@ -1,9 +1,10 @@
1
1
  import type { FunctionComponent } from 'react';
2
2
  import type { ForwardProps } from '../../types';
3
- import type MultiStepFormProps from './MultiStepForm.types';
3
+ import type { MultiStepFormProps } from './MultiStepForm.types';
4
4
  interface FormProgressProps {
5
5
  steps: MultiStepFormProps['steps'];
6
6
  currentStepId: MultiStepFormProps['currentStepId'];
7
+ showStepNames?: boolean;
7
8
  }
8
9
  declare const HorizontalFormProgress: FunctionComponent<FormProgressProps & ForwardProps>;
9
10
  export default HorizontalFormProgress;
@@ -1 +1 @@
1
- {"version":3,"file":"HorizontalFormProgress.d.ts","sourceRoot":"","sources":["../../../src/components/MultiStepForm/HorizontalFormProgress.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAiB,MAAM,OAAO,CAAC;AAG9D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAchD,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,sBAAsB,EAAE,iBAAiB,CAAC,iBAAiB,GAAG,YAAY,CAmI/E,CAAC;AAEF,eAAe,sBAAsB,CAAC"}
1
+ {"version":3,"file":"HorizontalFormProgress.d.ts","sourceRoot":"","sources":["../../../src/components/MultiStepForm/HorizontalFormProgress.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAiB,MAAM,OAAO,CAAC;AAG9D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAiBhD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAIhE,UAAU,iBAAiB;IACzB,KAAK,EAAE,kBAAkB,CAAC,OAAO,CAAC,CAAC;IACnC,aAAa,EAAE,kBAAkB,CAAC,eAAe,CAAC,CAAC;IACnD,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAED,QAAA,MAAM,sBAAsB,EAAE,iBAAiB,CAAC,iBAAiB,GAAG,YAAY,CAwM/E,CAAC;AAEF,eAAe,sBAAsB,CAAC"}