@pega/cosmos-react-core 10.0.0-build.4.5 → 10.0.0-build.4.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.
- package/lib/components/AppShell/AppShell.d.ts.map +1 -1
- package/lib/components/AppShell/AppShell.js +17 -3
- package/lib/components/AppShell/AppShell.js.map +1 -1
- package/lib/components/Dialog/InfoDialogWrapper.d.ts +4 -0
- package/lib/components/Dialog/InfoDialogWrapper.d.ts.map +1 -0
- package/lib/components/Dialog/InfoDialogWrapper.js +13 -0
- package/lib/components/Dialog/InfoDialogWrapper.js.map +1 -0
- package/lib/components/Dialog/TouchDialog.d.ts +5 -0
- package/lib/components/Dialog/TouchDialog.d.ts.map +1 -0
- package/lib/components/Dialog/TouchDialog.js +85 -0
- package/lib/components/Dialog/TouchDialog.js.map +1 -0
- package/lib/components/Dialog/TouchDialog.styles.d.ts +7 -0
- package/lib/components/Dialog/TouchDialog.styles.d.ts.map +1 -0
- package/lib/components/Dialog/TouchDialog.styles.js +62 -0
- package/lib/components/Dialog/TouchDialog.styles.js.map +1 -0
- package/lib/components/Dialog/TouchDialog.test-ids.d.ts +2 -0
- package/lib/components/Dialog/TouchDialog.test-ids.d.ts.map +1 -0
- package/lib/components/Dialog/TouchDialog.test-ids.js +3 -0
- package/lib/components/Dialog/TouchDialog.test-ids.js.map +1 -0
- package/lib/components/Dialog/TouchDialog.types.d.ts +42 -0
- package/lib/components/Dialog/TouchDialog.types.d.ts.map +1 -0
- package/lib/components/Dialog/TouchDialog.types.js +2 -0
- package/lib/components/Dialog/TouchDialog.types.js.map +1 -0
- package/lib/components/Dialog/TouchInfoDialog.d.ts +4 -0
- package/lib/components/Dialog/TouchInfoDialog.d.ts.map +1 -0
- package/lib/components/Dialog/TouchInfoDialog.js +14 -0
- package/lib/components/Dialog/TouchInfoDialog.js.map +1 -0
- package/lib/components/Dialog/index.d.ts +4 -1
- package/lib/components/Dialog/index.d.ts.map +1 -1
- package/lib/components/Dialog/index.js +3 -1
- package/lib/components/Dialog/index.js.map +1 -1
- package/lib/components/File/CompactList.js +1 -1
- package/lib/components/File/CompactList.js.map +1 -1
- package/lib/components/File/mimeTypes.json +1 -0
- package/lib/components/ListToolbar/PresetMenuPopover.d.ts.map +1 -1
- package/lib/components/ListToolbar/PresetMenuPopover.js +16 -5
- package/lib/components/ListToolbar/PresetMenuPopover.js.map +1 -1
- package/lib/components/MenuButton/MenuButton.d.ts.map +1 -1
- package/lib/components/MenuButton/MenuButton.js +33 -7
- package/lib/components/MenuButton/MenuButton.js.map +1 -1
- package/lib/components/MultiStepForm/FormProgress.styles.d.ts +25 -1
- package/lib/components/MultiStepForm/FormProgress.styles.d.ts.map +1 -1
- package/lib/components/MultiStepForm/FormProgress.styles.js +168 -5
- package/lib/components/MultiStepForm/FormProgress.styles.js.map +1 -1
- package/lib/components/MultiStepForm/HorizontalFormProgress.d.ts +2 -2
- package/lib/components/MultiStepForm/HorizontalFormProgress.d.ts.map +1 -1
- package/lib/components/MultiStepForm/HorizontalFormProgress.js +48 -22
- package/lib/components/MultiStepForm/HorizontalFormProgress.js.map +1 -1
- package/lib/components/MultiStepForm/MultiStepForm.d.ts.map +1 -1
- package/lib/components/MultiStepForm/MultiStepForm.js +2 -2
- package/lib/components/MultiStepForm/MultiStepForm.js.map +1 -1
- package/lib/components/MultiStepForm/MultiStepForm.types.d.ts +5 -0
- package/lib/components/MultiStepForm/MultiStepForm.types.d.ts.map +1 -1
- package/lib/components/MultiStepForm/MultiStepForm.types.js.map +1 -1
- package/lib/components/MultiStepForm/VerticalFormProgress.d.ts +2 -2
- package/lib/components/MultiStepForm/VerticalFormProgress.d.ts.map +1 -1
- package/lib/components/MultiStepForm/VerticalFormProgress.js +45 -20
- package/lib/components/MultiStepForm/VerticalFormProgress.js.map +1 -1
- package/lib/components/MultiStepForm/useFormProgressOverflow.d.ts +1 -1
- package/lib/components/MultiStepForm/useFormProgressOverflow.d.ts.map +1 -1
- package/lib/components/MultiStepForm/useFormProgressOverflow.js +17 -9
- package/lib/components/MultiStepForm/useFormProgressOverflow.js.map +1 -1
- package/lib/theme/theme.d.ts +12 -0
- package/lib/theme/theme.d.ts.map +1 -1
- package/lib/theme/themeDefinition.json +6 -0
- package/lib/theme/themeOverrides.schema.json +9 -0
- package/lib/utils/index.d.ts +1 -0
- package/lib/utils/index.d.ts.map +1 -1
- package/lib/utils/index.js +1 -0
- package/lib/utils/index.js.map +1 -1
- package/lib/utils/isTouchDevice.d.ts +3 -0
- package/lib/utils/isTouchDevice.d.ts.map +1 -0
- package/lib/utils/isTouchDevice.js +4 -0
- package/lib/utils/isTouchDevice.js.map +1 -0
- package/package.json +1 -1
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import styled, { css } from 'styled-components';
|
|
2
|
-
import { size } from 'polished';
|
|
2
|
+
import { lighten, size } from 'polished';
|
|
3
3
|
import { defaultThemeProp } from '../../theme';
|
|
4
|
+
import { tryCatch } from '../../utils';
|
|
4
5
|
import BareButton from '../Button/BareButton';
|
|
5
6
|
import Popover from '../Popover';
|
|
6
7
|
import { StyledText } from '../Text';
|
|
@@ -12,6 +13,10 @@ import { ellipsisOverflow } from '../../styles/mixins';
|
|
|
12
13
|
export const stepItemMinWidth = 15;
|
|
13
14
|
/** Min width of step marker without labels in ch units */
|
|
14
15
|
export const stepMarkerMinWidth = 3;
|
|
16
|
+
/** Min width of each bar segment in bars mode in ch units */
|
|
17
|
+
export const stepBarMinWidth = 3;
|
|
18
|
+
/** Min height of each vertical bar segment in bars mode */
|
|
19
|
+
export const stepVerticalBarMinHeight = '2.5rem';
|
|
15
20
|
export const CurrentStepPopover = styled(Popover) `
|
|
16
21
|
max-width: 100%;
|
|
17
22
|
background-color: transparent;
|
|
@@ -57,7 +62,7 @@ export const StyledBar = styled.div(({ shifted, theme }) => {
|
|
|
57
62
|
`;
|
|
58
63
|
});
|
|
59
64
|
StyledBar.defaultProps = defaultThemeProp;
|
|
60
|
-
export const StyledFill = styled.div(({ theme }) => {
|
|
65
|
+
export const StyledFill = styled.div(({ fillScale, theme }) => {
|
|
61
66
|
const { base: { animation: { speed: animationSpeed, timing: { ease: animationTiming } }, palette: { interactive } } } = theme;
|
|
62
67
|
const { ltr } = useDirection();
|
|
63
68
|
const markedLineThicknessFactor = 2;
|
|
@@ -70,7 +75,7 @@ export const StyledFill = styled.div(({ theme }) => {
|
|
|
70
75
|
top: calc(-50% * (${markedLineThicknessFactor} - 1));
|
|
71
76
|
background: ${interactive};
|
|
72
77
|
transition: all calc(2 * ${animationSpeed}) ${animationTiming};
|
|
73
|
-
transform: scaleX(
|
|
78
|
+
transform: scaleX(${fillScale});
|
|
74
79
|
transform-origin: ${ltr ? 0 : '100%'} 0;
|
|
75
80
|
|
|
76
81
|
@media (forced-colors: active) {
|
|
@@ -213,7 +218,7 @@ export const StyleHorizontalStepMarkers = styled.ol(({ showStepNames, theme }) =
|
|
|
213
218
|
|
|
214
219
|
li:first-child {
|
|
215
220
|
align-items: flex-start;
|
|
216
|
-
text-align:
|
|
221
|
+
text-align: start;
|
|
217
222
|
margin-inline-start: 0;
|
|
218
223
|
padding-inline-start: 0;
|
|
219
224
|
|
|
@@ -224,7 +229,7 @@ export const StyleHorizontalStepMarkers = styled.ol(({ showStepNames, theme }) =
|
|
|
224
229
|
|
|
225
230
|
li:last-child {
|
|
226
231
|
align-items: flex-end;
|
|
227
|
-
text-align:
|
|
232
|
+
text-align: end;
|
|
228
233
|
margin-inline-end: 0;
|
|
229
234
|
padding-inline-end: 0;
|
|
230
235
|
|
|
@@ -291,4 +296,162 @@ export const StyledHorizontalStepText = styled.div(({ theme }) => {
|
|
|
291
296
|
`;
|
|
292
297
|
});
|
|
293
298
|
StyledHorizontalStepText.defaultProps = defaultThemeProp;
|
|
299
|
+
export const StyleHorizontalBarList = styled.ol(({ showStepNames, theme }) => {
|
|
300
|
+
return css `
|
|
301
|
+
list-style-type: none;
|
|
302
|
+
|
|
303
|
+
li {
|
|
304
|
+
display: flex;
|
|
305
|
+
position: relative;
|
|
306
|
+
flex: 1 1 0;
|
|
307
|
+
min-width: ${`${showStepNames ? stepItemMinWidth : stepBarMinWidth}ch`};
|
|
308
|
+
flex-direction: column;
|
|
309
|
+
align-items: stretch;
|
|
310
|
+
text-align: center;
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
li:first-child {
|
|
314
|
+
text-align: start;
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
li:last-child {
|
|
318
|
+
text-align: end;
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
&:has(:focus-visible) {
|
|
322
|
+
box-shadow: ${theme.base.shadow['focus-group']};
|
|
323
|
+
}
|
|
324
|
+
`;
|
|
325
|
+
});
|
|
326
|
+
StyleHorizontalBarList.defaultProps = defaultThemeProp;
|
|
327
|
+
export const StyledHorizontalBarSegment = styled(BareButton)(({ current, completed, clickable, theme }) => {
|
|
328
|
+
const { base: { spacing, animation: { speed: animationSpeed, timing: { ease: animationTiming } }, palette: { interactive, 'primary-background': primaryBackground }, shadow: { focus: focusShadow }, 'hit-area': { 'finger-min': touchButtonSize } }, components: { 'form-control': { 'border-color': borderColor, 'border-width': borderWidth }, 'multi-step-form': { 'bar-indicator-border-radius': barIndicatorBorderRadius } } } = theme;
|
|
329
|
+
const maxBarHeight = `calc(${spacing} * 1.5)`;
|
|
330
|
+
const barHeight = current ? maxBarHeight : spacing;
|
|
331
|
+
const hoverBackground = tryCatch(() => lighten(0.1, interactive), () => interactive);
|
|
332
|
+
return css `
|
|
333
|
+
position: relative;
|
|
334
|
+
display: block;
|
|
335
|
+
width: 100%;
|
|
336
|
+
height: ${barHeight};
|
|
337
|
+
margin-block: calc((${maxBarHeight} - ${barHeight}) / 2);
|
|
338
|
+
border: ${borderWidth} solid transparent;
|
|
339
|
+
border-radius: ${barIndicatorBorderRadius};
|
|
340
|
+
background: ${current || completed ? interactive : primaryBackground};
|
|
341
|
+
transition:
|
|
342
|
+
background calc(2 * ${animationSpeed}) ${animationTiming},
|
|
343
|
+
border-color calc(2 * ${animationSpeed}) ${animationTiming};
|
|
344
|
+
|
|
345
|
+
${!current &&
|
|
346
|
+
css `
|
|
347
|
+
border-color: ${clickable ? interactive : borderColor};
|
|
348
|
+
|
|
349
|
+
@media (forced-colors: active) {
|
|
350
|
+
border-color: Highlight;
|
|
351
|
+
}
|
|
352
|
+
`}
|
|
353
|
+
|
|
354
|
+
${clickable &&
|
|
355
|
+
css `
|
|
356
|
+
cursor: pointer;
|
|
357
|
+
|
|
358
|
+
${!current &&
|
|
359
|
+
css `
|
|
360
|
+
&:hover {
|
|
361
|
+
background: ${hoverBackground};
|
|
362
|
+
}
|
|
363
|
+
`}
|
|
364
|
+
`}
|
|
365
|
+
|
|
366
|
+
&:focus-visible {
|
|
367
|
+
box-shadow: ${focusShadow};
|
|
368
|
+
|
|
369
|
+
@media (forced-colors: active) {
|
|
370
|
+
outline: 0.125rem solid Highlight;
|
|
371
|
+
outline-offset: 0.125rem;
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
@media (forced-colors: active) {
|
|
376
|
+
background: ${current || completed ? 'Highlight' : 'CanvasText'};
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
/* Touch hit-area expansion without affecting layout */
|
|
380
|
+
&::after {
|
|
381
|
+
content: '';
|
|
382
|
+
position: absolute;
|
|
383
|
+
inset-block: calc((${touchButtonSize} - ${barHeight}) / -2);
|
|
384
|
+
inset-inline: 0;
|
|
385
|
+
}
|
|
386
|
+
`;
|
|
387
|
+
});
|
|
388
|
+
StyledHorizontalBarSegment.defaultProps = defaultThemeProp;
|
|
389
|
+
export const StyledVerticalBarWrapper = styled.div(({ theme }) => {
|
|
390
|
+
return css `
|
|
391
|
+
min-width: 2rem;
|
|
392
|
+
padding-block: calc(${theme.base.spacing} / 2);
|
|
393
|
+
`;
|
|
394
|
+
});
|
|
395
|
+
StyledVerticalBarWrapper.defaultProps = defaultThemeProp;
|
|
396
|
+
export const StyledVerticalBarSegment = styled(BareButton)(({ current, completed, clickable, theme }) => {
|
|
397
|
+
const { base: { spacing, animation: { speed: animationSpeed }, palette: { interactive, 'primary-background': primaryBackground }, shadow: { focus: focusShadow }, 'hit-area': { 'finger-min': touchButtonSize } }, components: { 'form-control': { 'border-color': borderColor, 'border-width': borderWidth }, 'multi-step-form': { 'bar-indicator-border-radius': barIndicatorBorderRadius } } } = theme;
|
|
398
|
+
const barWidth = current ? `calc(${spacing} * 1.5)` : spacing;
|
|
399
|
+
const hoverBackground = tryCatch(() => lighten(0.1, interactive), () => interactive);
|
|
400
|
+
return css `
|
|
401
|
+
position: relative;
|
|
402
|
+
display: block;
|
|
403
|
+
width: ${barWidth};
|
|
404
|
+
min-height: ${stepVerticalBarMinHeight};
|
|
405
|
+
flex: 1 1 0;
|
|
406
|
+
border: ${borderWidth} solid transparent;
|
|
407
|
+
border-radius: ${barIndicatorBorderRadius};
|
|
408
|
+
background: ${current || completed ? interactive : primaryBackground};
|
|
409
|
+
transition:
|
|
410
|
+
background calc(2 * ${animationSpeed}),
|
|
411
|
+
border-color calc(2 * ${animationSpeed});
|
|
412
|
+
|
|
413
|
+
${!current &&
|
|
414
|
+
css `
|
|
415
|
+
border-color: ${clickable ? interactive : borderColor};
|
|
416
|
+
|
|
417
|
+
@media (forced-colors: active) {
|
|
418
|
+
border-color: Highlight;
|
|
419
|
+
}
|
|
420
|
+
`}
|
|
421
|
+
|
|
422
|
+
${clickable &&
|
|
423
|
+
css `
|
|
424
|
+
cursor: pointer;
|
|
425
|
+
|
|
426
|
+
${!current &&
|
|
427
|
+
css `
|
|
428
|
+
&:hover {
|
|
429
|
+
background: ${hoverBackground};
|
|
430
|
+
}
|
|
431
|
+
`}
|
|
432
|
+
`}
|
|
433
|
+
|
|
434
|
+
&:focus-visible {
|
|
435
|
+
box-shadow: ${focusShadow};
|
|
436
|
+
|
|
437
|
+
@media (forced-colors: active) {
|
|
438
|
+
outline: 0.125rem solid Highlight;
|
|
439
|
+
outline-offset: 0.125rem;
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
@media (forced-colors: active) {
|
|
444
|
+
background: ${current || completed ? 'Highlight' : 'CanvasText'};
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
/* Touch hit-area expansion without affecting layout */
|
|
448
|
+
&::after {
|
|
449
|
+
content: '';
|
|
450
|
+
position: absolute;
|
|
451
|
+
inset-block: 0;
|
|
452
|
+
inset-inline: calc((${touchButtonSize} - ${barWidth}) / -2);
|
|
453
|
+
}
|
|
454
|
+
`;
|
|
455
|
+
});
|
|
456
|
+
StyledVerticalBarSegment.defaultProps = defaultThemeProp;
|
|
294
457
|
//# 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;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,OA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,CAAC,CAAC;AAEH,cAAc,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAE/C,MAAM,CAAC,MAAM,wBAAwB,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE;IAC/D,MAAM,QAAQ,GAAG,iBAAiB,CAAC,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC;IAEtF,OAAO,GAAG,CAAA;qBACS,KAAK,CAAC,IAAI,CAAC,OAAO;;;iBAGtB,QAAQ,CAAC,GAAG;;GAE1B,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,wBAAwB,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';\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 @media (forced-colors: active) {\n background: CanvasText;\n }\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 @media (forced-colors: active) {\n background: Highlight;\n }\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-visible::before {\n box-shadow: ${focusShadow};\n\n @media (forced-colors: active) {\n outline: 0.125rem solid Highlight;\n outline-offset: 0.125rem;\n }\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 @media (forced-colors: active) {\n background: ${completed ? 'Highlight' : 'Canvas'};\n border-color: ${clickable ? 'Highlight' : 'CanvasText'};\n }\n }\n `}\n\n ${current &&\n css`\n &::before {\n background: ${interactive};\n\n @media (forced-colors: active) {\n background: Highlight;\n }\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 @media (forced-colors: active) {\n background: ${prior ? 'Highlight' : 'CanvasText'};\n }\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
|
+
{"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,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CA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E,MAAM,EAAE,EAAE,KAAK,EAAE,WAAW,EAAE,EAC9B,UAAU,EAAE,EAAE,YAAY,EAAE,eAAe,EAAE,EAC9C,EACD,UAAU,EAAE,EACV,cAAc,EAAE,EAAE,cAAc,EAAE,WAAW,EAAE,cAAc,EAAE,WAAW,EAAE,EAC5E,iBAAiB,EAAE,EAAE,6BAA6B,EAAE,wBAAwB,EAAE,EAC/E,EACF,GAAG,KAAK,CAAC;IAEV,MAAM,QAAQ,GAAG,OAAO,CAAC,CAAC,CAAC,QAAQ,OAAO,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC;IAC9D,MAAM,eAAe,GAAG,QAAQ,CAC9B,GAAG,EAAE,CAAC,OAAO,CAAC,GAAG,EAAE,WAAW,CAAC,EAC/B,GAAG,EAAE,CAAC,WAAW,CAClB,CAAC;IAEF,OAAO,GAAG,CAAA;;;aAGC,QAAQ;kBACH,wBAAwB;;cAE5B,WAAW;qBACJ,wBAAwB;kBAC3B,OAAO,IAAI,SAAS,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,iBAAiB;;4BAE5C,cAAc;8BACZ,cAAc;;MAEtC,CAAC,OAAO;QACV,GAAG,CAAA;sBACe,SAAS,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,WAAW;;;;;KAKtD;;MAEC,SAAS;QACX,GAAG,CAAA;;;QAGC,CAAC,OAAO;YACV,GAAG,CAAA;;wBAEe,eAAe;;OAEhC;KACF;;;oBAGe,WAAW;;;;;;;;;oBASX,OAAO,IAAI,SAAS,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,YAAY;;;;;;;;4BAQzC,eAAe,MAAM,QAAQ;;GAEtD,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,wBAAwB,CAAC,YAAY,GAAG,gBAAgB,CAAC","sourcesContent":["import styled, { css } from 'styled-components';\nimport { lighten, size } from 'polished';\n\nimport { defaultThemeProp } from '../../theme';\nimport { tryCatch } from '../../utils';\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\n/** Min width of each bar segment in bars mode in ch units */\nexport const stepBarMinWidth = 3;\n\n/** Min height of each vertical bar segment in bars mode */\nexport const stepVerticalBarMinHeight = '2.5rem';\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 @media (forced-colors: active) {\n background: CanvasText;\n }\n `;\n});\n\nStyledBar.defaultProps = defaultThemeProp;\n\nexport const StyledFill = styled.div<{ fillScale: number }>(({ fillScale, 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(${fillScale});\n transform-origin: ${ltr ? 0 : '100%'} 0;\n\n @media (forced-colors: active) {\n background: Highlight;\n }\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-visible::before {\n box-shadow: ${focusShadow};\n\n @media (forced-colors: active) {\n outline: 0.125rem solid Highlight;\n outline-offset: 0.125rem;\n }\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 @media (forced-colors: active) {\n background: ${completed ? 'Highlight' : 'Canvas'};\n border-color: ${clickable ? 'Highlight' : 'CanvasText'};\n }\n }\n `}\n\n ${current &&\n css`\n &::before {\n background: ${interactive};\n\n @media (forced-colors: active) {\n background: Highlight;\n }\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: start;\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: end;\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 @media (forced-colors: active) {\n background: ${prior ? 'Highlight' : 'CanvasText'};\n }\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\nexport const StyleHorizontalBarList = styled.ol<{ showStepNames?: boolean }>(\n ({ showStepNames, theme }) => {\n return css`\n list-style-type: none;\n\n li {\n display: flex;\n position: relative;\n flex: 1 1 0;\n min-width: ${`${showStepNames ? stepItemMinWidth : stepBarMinWidth}ch`};\n flex-direction: column;\n align-items: stretch;\n text-align: center;\n }\n\n li:first-child {\n text-align: start;\n }\n\n li:last-child {\n text-align: end;\n }\n\n &:has(:focus-visible) {\n box-shadow: ${theme.base.shadow['focus-group']};\n }\n `;\n }\n);\n\nStyleHorizontalBarList.defaultProps = defaultThemeProp;\n\nexport const StyledHorizontalBarSegment = styled(BareButton)<{\n current: boolean;\n completed?: boolean;\n clickable?: boolean;\n}>(({ current, completed, clickable, theme }) => {\n const {\n base: {\n spacing,\n animation: {\n speed: animationSpeed,\n timing: { ease: animationTiming }\n },\n palette: { interactive, 'primary-background': primaryBackground },\n shadow: { focus: focusShadow },\n 'hit-area': { 'finger-min': touchButtonSize }\n },\n components: {\n 'form-control': { 'border-color': borderColor, 'border-width': borderWidth },\n 'multi-step-form': { 'bar-indicator-border-radius': barIndicatorBorderRadius }\n }\n } = theme;\n\n const maxBarHeight = `calc(${spacing} * 1.5)`;\n const barHeight = current ? maxBarHeight : spacing;\n const hoverBackground = tryCatch(\n () => lighten(0.1, interactive),\n () => interactive\n );\n\n return css`\n position: relative;\n display: block;\n width: 100%;\n height: ${barHeight};\n margin-block: calc((${maxBarHeight} - ${barHeight}) / 2);\n border: ${borderWidth} solid transparent;\n border-radius: ${barIndicatorBorderRadius};\n background: ${current || completed ? interactive : primaryBackground};\n transition:\n background calc(2 * ${animationSpeed}) ${animationTiming},\n border-color calc(2 * ${animationSpeed}) ${animationTiming};\n\n ${!current &&\n css`\n border-color: ${clickable ? interactive : borderColor};\n\n @media (forced-colors: active) {\n border-color: Highlight;\n }\n `}\n\n ${clickable &&\n css`\n cursor: pointer;\n\n ${!current &&\n css`\n &:hover {\n background: ${hoverBackground};\n }\n `}\n `}\n\n &:focus-visible {\n box-shadow: ${focusShadow};\n\n @media (forced-colors: active) {\n outline: 0.125rem solid Highlight;\n outline-offset: 0.125rem;\n }\n }\n\n @media (forced-colors: active) {\n background: ${current || completed ? 'Highlight' : 'CanvasText'};\n }\n\n /* Touch hit-area expansion without affecting layout */\n &::after {\n content: '';\n position: absolute;\n inset-block: calc((${touchButtonSize} - ${barHeight}) / -2);\n inset-inline: 0;\n }\n `;\n});\n\nStyledHorizontalBarSegment.defaultProps = defaultThemeProp;\n\nexport const StyledVerticalBarWrapper = styled.div(({ theme }) => {\n return css`\n min-width: 2rem;\n padding-block: calc(${theme.base.spacing} / 2);\n `;\n});\n\nStyledVerticalBarWrapper.defaultProps = defaultThemeProp;\n\nexport const StyledVerticalBarSegment = styled(BareButton)<{\n current: boolean;\n completed?: boolean;\n clickable?: boolean;\n}>(({ current, completed, clickable, theme }) => {\n const {\n base: {\n spacing,\n animation: { speed: animationSpeed },\n palette: { interactive, 'primary-background': primaryBackground },\n shadow: { focus: focusShadow },\n 'hit-area': { 'finger-min': touchButtonSize }\n },\n components: {\n 'form-control': { 'border-color': borderColor, 'border-width': borderWidth },\n 'multi-step-form': { 'bar-indicator-border-radius': barIndicatorBorderRadius }\n }\n } = theme;\n\n const barWidth = current ? `calc(${spacing} * 1.5)` : spacing;\n const hoverBackground = tryCatch(\n () => lighten(0.1, interactive),\n () => interactive\n );\n\n return css`\n position: relative;\n display: block;\n width: ${barWidth};\n min-height: ${stepVerticalBarMinHeight};\n flex: 1 1 0;\n border: ${borderWidth} solid transparent;\n border-radius: ${barIndicatorBorderRadius};\n background: ${current || completed ? interactive : primaryBackground};\n transition:\n background calc(2 * ${animationSpeed}),\n border-color calc(2 * ${animationSpeed});\n\n ${!current &&\n css`\n border-color: ${clickable ? interactive : borderColor};\n\n @media (forced-colors: active) {\n border-color: Highlight;\n }\n `}\n\n ${clickable &&\n css`\n cursor: pointer;\n\n ${!current &&\n css`\n &:hover {\n background: ${hoverBackground};\n }\n `}\n `}\n\n &:focus-visible {\n box-shadow: ${focusShadow};\n\n @media (forced-colors: active) {\n outline: 0.125rem solid Highlight;\n outline-offset: 0.125rem;\n }\n }\n\n @media (forced-colors: active) {\n background: ${current || completed ? 'Highlight' : 'CanvasText'};\n }\n\n /* Touch hit-area expansion without affecting layout */\n &::after {\n content: '';\n position: absolute;\n inset-block: 0;\n inset-inline: calc((${touchButtonSize} - ${barWidth}) / -2);\n }\n `;\n});\n\nStyledVerticalBarSegment.defaultProps = defaultThemeProp;\n"]}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import type { FunctionComponent } from 'react';
|
|
2
1
|
import type { ForwardProps } from '../../types';
|
|
3
2
|
import type { MultiStepFormProps } from './MultiStepForm.types';
|
|
4
3
|
interface FormProgressProps {
|
|
5
4
|
steps: MultiStepFormProps['steps'];
|
|
6
5
|
currentStepId: MultiStepFormProps['currentStepId'];
|
|
6
|
+
variant?: MultiStepFormProps['variant'];
|
|
7
7
|
showStepNames?: boolean;
|
|
8
8
|
}
|
|
9
|
-
declare const HorizontalFormProgress:
|
|
9
|
+
declare const HorizontalFormProgress: ({ steps, currentStepId, showStepNames, variant, ...restProps }: FormProgressProps & ForwardProps) => import("react/jsx-runtime").JSX.Element;
|
|
10
10
|
export default HorizontalFormProgress;
|
|
11
11
|
//# sourceMappingURL=HorizontalFormProgress.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HorizontalFormProgress.d.ts","sourceRoot":"","sources":["../../../src/components/MultiStepForm/HorizontalFormProgress.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"HorizontalFormProgress.d.ts","sourceRoot":"","sources":["../../../src/components/MultiStepForm/HorizontalFormProgress.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAmBhD,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,OAAO,CAAC,EAAE,kBAAkB,CAAC,SAAS,CAAC,CAAC;IACxC,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAED,QAAA,MAAM,sBAAsB,GAAI,gEAM7B,iBAAiB,GAAG,YAAY,4CA2OlC,CAAC;AAEF,eAAe,sBAAsB,CAAC"}
|
|
@@ -7,28 +7,70 @@ import Flex from '../Flex';
|
|
|
7
7
|
import Text from '../Text';
|
|
8
8
|
import Tooltip from '../Tooltip';
|
|
9
9
|
import Button from '../Button';
|
|
10
|
-
import InfoDialog from '../Dialog
|
|
11
|
-
import { CurrentStepPopover, StepMarker, StyledBar, StyledFill, StyledFormProgress, StyledHorizontalStepText, StyleHorizontalStepMarkers } from './FormProgress.styles';
|
|
10
|
+
import { InfoDialog } from '../Dialog';
|
|
11
|
+
import { CurrentStepPopover, StepMarker, StyledBar, StyledFill, StyledFormProgress, StyledHorizontalBarSegment, StyledHorizontalStepText, StyleHorizontalBarList, StyleHorizontalStepMarkers } from './FormProgress.styles';
|
|
12
12
|
import VerticalFormProgress from './VerticalFormProgress';
|
|
13
13
|
import { useFormProgressOverflow } from './useFormProgressOverflow';
|
|
14
|
-
const HorizontalFormProgress = ({ steps, currentStepId, showStepNames = false, ...restProps }) => {
|
|
14
|
+
const HorizontalFormProgress = ({ steps, currentStepId, showStepNames = false, variant = 'dot', ...restProps }) => {
|
|
15
15
|
const t = useI18n();
|
|
16
|
+
const theme = useTheme();
|
|
17
|
+
const isBarsMode = variant === 'bar';
|
|
16
18
|
const [stepsDialogButtonEl, setStepsDialogButtonEl] = useElement();
|
|
17
19
|
const [showStepsDialog, setShowStepsDialog] = useState(false);
|
|
18
|
-
const { ref: formProgressRef, state: stepsAreOverflowing } = useFormProgressOverflow(steps.length, showStepNames);
|
|
20
|
+
const { ref: formProgressRef, state: stepsAreOverflowing } = useFormProgressOverflow(steps.length, showStepNames, isBarsMode);
|
|
19
21
|
const curIdx = steps.findIndex(step => step.id === currentStepId);
|
|
20
22
|
const curStep = steps[curIdx];
|
|
21
23
|
const fillScale = curIdx / (steps.length - 1);
|
|
22
24
|
const [currentStepEl, setCurrentStepEl] = useElement();
|
|
23
25
|
const [stepEls, setStepEls] = useState({});
|
|
24
26
|
const stepsRef = useRef(null);
|
|
25
|
-
const theme = useTheme();
|
|
26
27
|
const { rtl } = useDirection();
|
|
27
28
|
let popoverPlacement = 'bottom';
|
|
28
29
|
if (curIdx === 0)
|
|
29
30
|
popoverPlacement = rtl ? 'bottom-end' : 'bottom-start';
|
|
30
31
|
else if (curIdx === steps.length - 1)
|
|
31
32
|
popoverPlacement = rtl ? 'bottom-start' : 'bottom-end';
|
|
33
|
+
const numberOfSteps = steps.length;
|
|
34
|
+
const setStepElement = (stepId) => (el) => {
|
|
35
|
+
setStepEls(curr => {
|
|
36
|
+
const newEls = { ...curr };
|
|
37
|
+
if (!el && newEls[stepId]) {
|
|
38
|
+
delete newEls[stepId];
|
|
39
|
+
return newEls;
|
|
40
|
+
}
|
|
41
|
+
if (el)
|
|
42
|
+
return { ...newEls, [stepId]: el };
|
|
43
|
+
return newEls;
|
|
44
|
+
});
|
|
45
|
+
};
|
|
46
|
+
const renderStepName = ({ isCurrent, stepName, onMarkerClick }) => {
|
|
47
|
+
if (!showStepNames)
|
|
48
|
+
return null;
|
|
49
|
+
if (!!onMarkerClick && !isCurrent) {
|
|
50
|
+
return (_jsx(Button, { variant: 'link', onClick: onMarkerClick, as: StyledHorizontalStepText, tabIndex: -1, children: stepName }));
|
|
51
|
+
}
|
|
52
|
+
return (_jsx(Text, { variant: isCurrent ? 'h3' : undefined, as: StyledHorizontalStepText, children: stepName }));
|
|
53
|
+
};
|
|
54
|
+
const renderStepItem = (step, index) => {
|
|
55
|
+
const isCurrent = index === curIdx;
|
|
56
|
+
const markerContent = !showStepNames && !isCurrent ? (_jsx(Tooltip, { target: stepEls[step.id], showDelay: 'none', hideDelay: 'short', describeTarget: false, children: step.name })) : null;
|
|
57
|
+
const commonMarkerProps = {
|
|
58
|
+
id: step.id,
|
|
59
|
+
'data-step-marker': '',
|
|
60
|
+
'aria-label': `${step.name} - ${t('step_num', [index + 1, steps.length])}`,
|
|
61
|
+
'aria-current': isCurrent ? 'step' : undefined,
|
|
62
|
+
tabIndex: isCurrent ? 0 : -1,
|
|
63
|
+
current: isCurrent,
|
|
64
|
+
completed: step.completed,
|
|
65
|
+
onClick: step.onMarkerClick,
|
|
66
|
+
clickable: !!step.onMarkerClick && !isCurrent
|
|
67
|
+
};
|
|
68
|
+
return (_jsxs("li", { children: [isBarsMode ? (_jsx(StyledHorizontalBarSegment, { ref: setStepElement(step.id), ...commonMarkerProps, children: markerContent })) : (_jsx(StepMarker, { ref: setStepElement(step.id), depth: step.depth, ...commonMarkerProps, children: markerContent })), renderStepName({
|
|
69
|
+
isCurrent,
|
|
70
|
+
stepName: step.name,
|
|
71
|
+
onMarkerClick: step.onMarkerClick
|
|
72
|
+
})] }, step.id));
|
|
73
|
+
};
|
|
32
74
|
useArrows(stepsRef, {
|
|
33
75
|
selector: '[data-step-marker]',
|
|
34
76
|
dir: 'left-right',
|
|
@@ -50,7 +92,6 @@ const HorizontalFormProgress = ({ steps, currentStepId, showStepNames = false, .
|
|
|
50
92
|
setShowStepsDialog(false);
|
|
51
93
|
}
|
|
52
94
|
}, [stepsAreOverflowing]);
|
|
53
|
-
const numberOfSteps = steps.length;
|
|
54
95
|
return (_jsxs(StyledFormProgress, { ref: formProgressRef, ...restProps, container: { alignItems: 'center' }, showStepNames: showStepNames, children: [_jsx(CurrentStepPopover, { show: !showStepNames, target: currentStepEl, placement: popoverPlacement, strategy: 'absolute', portal: false, hideOnTargetHidden: true, modifiers: [
|
|
55
96
|
{
|
|
56
97
|
name: 'offset',
|
|
@@ -79,22 +120,7 @@ const HorizontalFormProgress = ({ steps, currentStepId, showStepNames = false, .
|
|
|
79
120
|
setShowStepsDialog(true);
|
|
80
121
|
}, children: t('step_num', [curIdx + 1, numberOfSteps]) }), _jsx(Text, { variant: 'h4', children: curStep.name }), stepsDialogButtonEl && showStepsDialog && (_jsx(InfoDialog, { heading: t('steps'), target: stepsDialogButtonEl, onDismiss: () => {
|
|
81
122
|
setShowStepsDialog(false);
|
|
82
|
-
}, placement: 'bottom-start', children: _jsx(VerticalFormProgress, { steps: steps, currentStepId: currentStepId }) }))] })) : (_jsxs(_Fragment, { children: [_jsx(Flex, { ref: stepsRef, as: StyleHorizontalStepMarkers, container: { justify: 'between', alignItems: 'start' }, item: { grow: 1 }, showStepNames: showStepNames, children: steps.map((
|
|
83
|
-
const isCurrent = index === curIdx;
|
|
84
|
-
return (_jsxs("li", { children: [_jsx(StepMarker, { ref: (el) => {
|
|
85
|
-
setStepEls(curr => {
|
|
86
|
-
const newEls = { ...curr };
|
|
87
|
-
if (!el && newEls[step.id]) {
|
|
88
|
-
delete newEls[step.id];
|
|
89
|
-
return newEls;
|
|
90
|
-
}
|
|
91
|
-
if (el)
|
|
92
|
-
return { ...newEls, [step.id]: el };
|
|
93
|
-
return newEls;
|
|
94
|
-
});
|
|
95
|
-
}, id: step.id, "data-step-marker": '', "aria-label": `${step.name} - ${t('step_num', [index + 1, steps.length])}`, "aria-current": isCurrent ? 'step' : undefined, tabIndex: isCurrent ? 0 : -1, current: isCurrent, depth: step.depth, completed: step.completed, onClick: step.onMarkerClick, clickable: !!step.onMarkerClick && !isCurrent, children: !showStepNames && !isCurrent && (_jsx(Tooltip, { target: stepEls[step.id], showDelay: 'none', hideDelay: 'short', describeTarget: false, children: step.name })) }), showStepNames &&
|
|
96
|
-
(!!step.onMarkerClick && !isCurrent ? (_jsx(Button, { variant: 'link', onClick: step.onMarkerClick, as: StyledHorizontalStepText, tabIndex: -1, children: step.name })) : (_jsx(Text, { variant: isCurrent ? 'h3' : undefined, as: StyledHorizontalStepText, children: step.name })))] }, step.id));
|
|
97
|
-
}) }), _jsx(StyledBar, { shifted: showStepNames, children: _jsx(StyledFill, { style: { '--fillScale': fillScale } }) })] }))] }));
|
|
123
|
+
}, placement: 'bottom-start', children: _jsx(VerticalFormProgress, { steps: steps, currentStepId: currentStepId, variant: variant }) }))] })) : (_jsxs(_Fragment, { children: [_jsx(Flex, { ref: stepsRef, as: isBarsMode ? StyleHorizontalBarList : StyleHorizontalStepMarkers, container: { justify: 'between', alignItems: 'start', gap: 1 }, item: { grow: 1 }, showStepNames: showStepNames, children: steps.map(renderStepItem) }), !isBarsMode && (_jsx(StyledBar, { shifted: showStepNames, children: _jsx(StyledFill, { fillScale: fillScale }) }))] }))] }));
|
|
98
124
|
};
|
|
99
125
|
export default HorizontalFormProgress;
|
|
100
126
|
//# sourceMappingURL=HorizontalFormProgress.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HorizontalFormProgress.js","sourceRoot":"","sources":["../../../src/components/MultiStepForm/HorizontalFormProgress.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,OAAO,EAAE,SAAS,EA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CACV,CAAC,CAAC,CAAC,CACF,KAAC,IAAI,IAAC,OAAO,EAAE,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,EAAE,EAAE,EAAE,wBAAwB,YACtE,IAAI,CAAC,IAAI,GACL,CACR,CAAC,KAjDG,IAAI,CAAC,EAAE,CAkDX,CACN,CAAC;wBACJ,CAAC,CAAC,GACG,EACP,KAAC,SAAS,IAAC,OAAO,EAAE,aAAa,YAC/B,KAAC,UAAU,IAAC,KAAK,EAAE,EAAE,aAAa,EAAE,SAAS,EAAmB,GAAI,GAC1D,IACX,CACJ,IACkB,CACtB,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,sBAAsB,CAAC","sourcesContent":["import { remToPx, stripUnit } from 'polished';\nimport { useEffect, useRef, useState } from 'react';\nimport type { FunctionComponent, CSSProperties } from 'react';\n\nimport { useArrows, useDirection, useElement, useI18n, useTheme } from '../../hooks';\nimport type { ForwardProps } from '../../types';\nimport { tryCatch } from '../../utils';\nimport Flex from '../Flex';\nimport Text from '../Text';\nimport Tooltip from '../Tooltip';\nimport Button from '../Button';\nimport InfoDialog from '../Dialog/InfoDialog';\n\nimport {\n CurrentStepPopover,\n StepMarker,\n StyledBar,\n StyledFill,\n StyledFormProgress,\n StyledHorizontalStepText,\n StyleHorizontalStepMarkers\n} from './FormProgress.styles';\nimport type { MultiStepFormProps } from './MultiStepForm.types';\nimport VerticalFormProgress from './VerticalFormProgress';\nimport { useFormProgressOverflow } from './useFormProgressOverflow';\n\ninterface FormProgressProps {\n steps: MultiStepFormProps['steps'];\n currentStepId: MultiStepFormProps['currentStepId'];\n showStepNames?: boolean;\n}\n\nconst HorizontalFormProgress: FunctionComponent<FormProgressProps & ForwardProps> = ({\n steps,\n currentStepId,\n showStepNames = false,\n ...restProps\n}) => {\n const t = useI18n();\n\n const [stepsDialogButtonEl, setStepsDialogButtonEl] = useElement<HTMLButtonElement>();\n const [showStepsDialog, setShowStepsDialog] = useState(false);\n\n const { ref: formProgressRef, state: stepsAreOverflowing } = useFormProgressOverflow(\n steps.length,\n showStepNames\n );\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 [stepEls, setStepEls] = useState<Record<string, HTMLElement>>({});\n const stepsRef = useRef(null);\n const theme = useTheme();\n const { rtl } = useDirection();\n\n let popoverPlacement: 'bottom' | 'bottom-start' | 'bottom-end' = 'bottom';\n if (curIdx === 0) popoverPlacement = rtl ? 'bottom-end' : 'bottom-start';\n else if (curIdx === steps.length - 1) popoverPlacement = rtl ? 'bottom-start' : 'bottom-end';\n\n useArrows(stepsRef, {\n selector: '[data-step-marker]',\n dir: 'left-right',\n initialFocusElement: currentStepEl\n });\n\n useArrows(stepsRef, {\n selector: '[data-step-marker]',\n cycle: false,\n dir: 'up-down',\n initialFocusElement: currentStepEl\n });\n\n useEffect(() => {\n if (stepEls[curStep.id] && stepEls[curStep.id] !== currentStepEl) {\n setCurrentStepEl(stepEls[curStep.id]);\n }\n }, [Object.keys(stepEls), curStep]);\n\n useEffect(() => {\n if (!stepsAreOverflowing) {\n setShowStepsDialog(false);\n }\n }, [stepsAreOverflowing]);\n\n const numberOfSteps = steps.length;\n\n return (\n <StyledFormProgress\n ref={formProgressRef}\n {...restProps}\n container={{ alignItems: 'center' }}\n showStepNames={showStepNames}\n >\n <CurrentStepPopover\n show={!showStepNames}\n target={currentStepEl}\n placement={popoverPlacement}\n strategy='absolute'\n portal={false}\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 name: 'placeAndContain',\n enabled: false\n },\n {\n name: 'flip',\n enabled: false\n },\n {\n name: 'preventOverflow',\n options: {\n padding: 0\n }\n }\n ]}\n >\n <Text variant='h4'>{curStep.name}</Text>\n </CurrentStepPopover>\n\n {stepsAreOverflowing ? (\n <div>\n <Button\n ref={setStepsDialogButtonEl}\n variant='link'\n onClick={() => {\n setShowStepsDialog(true);\n }}\n >\n {t('step_num', [curIdx + 1, numberOfSteps])}\n </Button>\n <Text variant='h4'>{curStep.name}</Text>\n {stepsDialogButtonEl && showStepsDialog && (\n <InfoDialog\n heading={t('steps')}\n target={stepsDialogButtonEl}\n onDismiss={() => {\n setShowStepsDialog(false);\n }}\n placement='bottom-start'\n >\n <VerticalFormProgress steps={steps} currentStepId={currentStepId} />\n </InfoDialog>\n )}\n </div>\n ) : (\n <>\n <Flex\n ref={stepsRef}\n as={StyleHorizontalStepMarkers}\n container={{ justify: 'between', alignItems: 'start' }}\n item={{ grow: 1 }}\n showStepNames={showStepNames}\n >\n {steps.map((step, index) => {\n const isCurrent = index === curIdx;\n return (\n <li key={step.id}>\n <StepMarker\n ref={(el: HTMLElement | null) => {\n setStepEls(curr => {\n const newEls = { ...curr };\n if (!el && newEls[step.id]) {\n delete newEls[step.id];\n return newEls;\n }\n if (el) return { ...newEls, [step.id]: el };\n return newEls;\n });\n }}\n id={step.id}\n data-step-marker=''\n aria-label={`${step.name} - ${t('step_num', [index + 1, steps.length])}`}\n aria-current={isCurrent ? 'step' : undefined}\n tabIndex={isCurrent ? 0 : -1}\n current={isCurrent}\n depth={step.depth}\n completed={step.completed}\n onClick={step.onMarkerClick}\n clickable={!!step.onMarkerClick && !isCurrent}\n >\n {!showStepNames && !isCurrent && (\n <Tooltip\n target={stepEls[step.id]}\n showDelay='none'\n hideDelay='short'\n describeTarget={false}\n >\n {step.name}\n </Tooltip>\n )}\n </StepMarker>\n {showStepNames &&\n (!!step.onMarkerClick && !isCurrent ? (\n <Button\n variant='link'\n onClick={step.onMarkerClick}\n as={StyledHorizontalStepText}\n tabIndex={-1}\n >\n {step.name}\n </Button>\n ) : (\n <Text variant={isCurrent ? 'h3' : undefined} as={StyledHorizontalStepText}>\n {step.name}\n </Text>\n ))}\n </li>\n );\n })}\n </Flex>\n <StyledBar shifted={showStepNames}>\n <StyledFill style={{ '--fillScale': fillScale } as CSSProperties} />\n </StyledBar>\n </>\n )}\n </StyledFormProgress>\n );\n};\n\nexport default HorizontalFormProgress;\n"]}
|
|
1
|
+
{"version":3,"file":"HorizontalFormProgress.js","sourceRoot":"","sources":["../../../src/components/MultiStepForm/HorizontalFormProgress.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEpD,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,UAAU,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAErF,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,OAAO,MAAM,YAAY,CAAC;AACjC,OAAO,MAAM,MAAM,WAAW,CAAC;AAC/B,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAEvC,OAAO,EACL,kBAAkB,EAClB,UAAU,EACV,SAAS,EACT,UAAU,EACV,kBAAkB,EAClB,0BAA0B,EAC1B,wBAAwB,EACxB,sBAAsB,EACtB,0BAA0B,EAC3B,MAAM,uBAAuB,CAAC;AAE/B,OAAO,oBAAoB,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AASpE,MAAM,sBAAsB,GAAG,CAAC,EAC9B,KAAK,EACL,aAAa,EACb,aAAa,GAAG,KAAK,EACrB,OAAO,GAAG,KAAK,EACf,GAAG,SAAS,EACqB,EAAE,EAAE;IACrC,MAAM,CAAC,GAAG,OAAO,EAAE,CAAC;IACpB,MAAM,KAAK,GAAG,QAAQ,EAAE,CAAC;IACzB,MAAM,UAAU,GAAG,OAAO,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AO,EAAE,GAAG,EAAE,CAAC,EAAE,EAC9D,IAAI,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE,EACjB,aAAa,EAAE,aAAa,YAE3B,KAAK,CAAC,GAAG,CAAC,cAAc,CAAC,GACrB,EAEN,CAAC,UAAU,IAAI,CACd,KAAC,SAAS,IAAC,OAAO,EAAE,aAAa,YAC/B,KAAC,UAAU,IAAC,SAAS,EAAE,SAAS,GAAI,GAC1B,CACb,IACA,CACJ,IACkB,CACtB,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,sBAAsB,CAAC","sourcesContent":["import { remToPx, stripUnit } from 'polished';\nimport { useEffect, useRef, useState } from 'react';\n\nimport { useArrows, useDirection, useElement, useI18n, useTheme } from '../../hooks';\nimport type { ForwardProps } from '../../types';\nimport { tryCatch } from '../../utils';\nimport Flex from '../Flex';\nimport Text from '../Text';\nimport Tooltip from '../Tooltip';\nimport Button from '../Button';\nimport { InfoDialog } from '../Dialog';\n\nimport {\n CurrentStepPopover,\n StepMarker,\n StyledBar,\n StyledFill,\n StyledFormProgress,\n StyledHorizontalBarSegment,\n StyledHorizontalStepText,\n StyleHorizontalBarList,\n StyleHorizontalStepMarkers\n} from './FormProgress.styles';\nimport type { MultiStepFormProps } from './MultiStepForm.types';\nimport VerticalFormProgress from './VerticalFormProgress';\nimport { useFormProgressOverflow } from './useFormProgressOverflow';\n\ninterface FormProgressProps {\n steps: MultiStepFormProps['steps'];\n currentStepId: MultiStepFormProps['currentStepId'];\n variant?: MultiStepFormProps['variant'];\n showStepNames?: boolean;\n}\n\nconst HorizontalFormProgress = ({\n steps,\n currentStepId,\n showStepNames = false,\n variant = 'dot',\n ...restProps\n}: FormProgressProps & ForwardProps) => {\n const t = useI18n();\n const theme = useTheme();\n const isBarsMode = variant === 'bar';\n\n const [stepsDialogButtonEl, setStepsDialogButtonEl] = useElement<HTMLButtonElement>();\n const [showStepsDialog, setShowStepsDialog] = useState(false);\n\n const { ref: formProgressRef, state: stepsAreOverflowing } = useFormProgressOverflow(\n steps.length,\n showStepNames,\n isBarsMode\n );\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 [stepEls, setStepEls] = useState<Record<string, HTMLElement>>({});\n const stepsRef = useRef(null);\n const { rtl } = useDirection();\n\n let popoverPlacement: 'bottom' | 'bottom-start' | 'bottom-end' = 'bottom';\n if (curIdx === 0) popoverPlacement = rtl ? 'bottom-end' : 'bottom-start';\n else if (curIdx === steps.length - 1) popoverPlacement = rtl ? 'bottom-start' : 'bottom-end';\n\n const numberOfSteps = steps.length;\n\n const setStepElement = (stepId: string) => (el: HTMLElement | null) => {\n setStepEls(curr => {\n const newEls = { ...curr };\n\n if (!el && newEls[stepId]) {\n delete newEls[stepId];\n return newEls;\n }\n\n if (el) return { ...newEls, [stepId]: el };\n\n return newEls;\n });\n };\n\n const renderStepName = ({\n isCurrent,\n stepName,\n onMarkerClick\n }: {\n isCurrent: boolean;\n stepName: string;\n onMarkerClick?: MultiStepFormProps['steps'][number]['onMarkerClick'];\n }) => {\n if (!showStepNames) return null;\n\n if (!!onMarkerClick && !isCurrent) {\n return (\n <Button variant='link' onClick={onMarkerClick} as={StyledHorizontalStepText} tabIndex={-1}>\n {stepName}\n </Button>\n );\n }\n\n return (\n <Text variant={isCurrent ? 'h3' : undefined} as={StyledHorizontalStepText}>\n {stepName}\n </Text>\n );\n };\n\n const renderStepItem = (step: MultiStepFormProps['steps'][number], index: number) => {\n const isCurrent = index === curIdx;\n const markerContent =\n !showStepNames && !isCurrent ? (\n <Tooltip\n target={stepEls[step.id]}\n showDelay='none'\n hideDelay='short'\n describeTarget={false}\n >\n {step.name}\n </Tooltip>\n ) : null;\n\n const commonMarkerProps = {\n id: step.id,\n 'data-step-marker': '',\n 'aria-label': `${step.name} - ${t('step_num', [index + 1, steps.length])}`,\n 'aria-current': isCurrent ? ('step' as const) : undefined,\n tabIndex: isCurrent ? 0 : -1,\n current: isCurrent,\n completed: step.completed,\n onClick: step.onMarkerClick,\n clickable: !!step.onMarkerClick && !isCurrent\n };\n\n return (\n <li key={step.id}>\n {isBarsMode ? (\n <StyledHorizontalBarSegment ref={setStepElement(step.id)} {...commonMarkerProps}>\n {markerContent}\n </StyledHorizontalBarSegment>\n ) : (\n <StepMarker ref={setStepElement(step.id)} depth={step.depth} {...commonMarkerProps}>\n {markerContent}\n </StepMarker>\n )}\n\n {renderStepName({\n isCurrent,\n stepName: step.name,\n onMarkerClick: step.onMarkerClick\n })}\n </li>\n );\n };\n\n useArrows(stepsRef, {\n selector: '[data-step-marker]',\n dir: 'left-right',\n initialFocusElement: currentStepEl\n });\n\n useArrows(stepsRef, {\n selector: '[data-step-marker]',\n cycle: false,\n dir: 'up-down',\n initialFocusElement: currentStepEl\n });\n\n useEffect(() => {\n if (stepEls[curStep.id] && stepEls[curStep.id] !== currentStepEl) {\n setCurrentStepEl(stepEls[curStep.id]);\n }\n }, [Object.keys(stepEls), curStep]);\n\n useEffect(() => {\n if (!stepsAreOverflowing) {\n setShowStepsDialog(false);\n }\n }, [stepsAreOverflowing]);\n\n return (\n <StyledFormProgress\n ref={formProgressRef}\n {...restProps}\n container={{ alignItems: 'center' }}\n showStepNames={showStepNames}\n >\n <CurrentStepPopover\n show={!showStepNames}\n target={currentStepEl}\n placement={popoverPlacement}\n strategy='absolute'\n portal={false}\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 name: 'placeAndContain',\n enabled: false\n },\n {\n name: 'flip',\n enabled: false\n },\n {\n name: 'preventOverflow',\n options: {\n padding: 0\n }\n }\n ]}\n >\n <Text variant='h4'>{curStep.name}</Text>\n </CurrentStepPopover>\n\n {stepsAreOverflowing ? (\n <div>\n <Button\n ref={setStepsDialogButtonEl}\n variant='link'\n onClick={() => {\n setShowStepsDialog(true);\n }}\n >\n {t('step_num', [curIdx + 1, numberOfSteps])}\n </Button>\n <Text variant='h4'>{curStep.name}</Text>\n\n {stepsDialogButtonEl && showStepsDialog && (\n <InfoDialog\n heading={t('steps')}\n target={stepsDialogButtonEl}\n onDismiss={() => {\n setShowStepsDialog(false);\n }}\n placement='bottom-start'\n >\n <VerticalFormProgress steps={steps} currentStepId={currentStepId} variant={variant} />\n </InfoDialog>\n )}\n </div>\n ) : (\n <>\n <Flex\n ref={stepsRef}\n as={isBarsMode ? StyleHorizontalBarList : StyleHorizontalStepMarkers}\n container={{ justify: 'between', alignItems: 'start', gap: 1 }}\n item={{ grow: 1 }}\n showStepNames={showStepNames}\n >\n {steps.map(renderStepItem)}\n </Flex>\n\n {!isBarsMode && (\n <StyledBar shifted={showStepNames}>\n <StyledFill fillScale={fillScale} />\n </StyledBar>\n )}\n </>\n )}\n </StyledFormProgress>\n );\n};\n\nexport default HorizontalFormProgress;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MultiStepForm.d.ts","sourceRoot":"","sources":["../../../src/components/MultiStepForm/MultiStepForm.tsx"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,aAAa,CAAC;AAWnE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAIhE,eAAO,MAAM,UAAU;cAA2B,OAAO;cAAY,OAAO;YAuB3E,CAAC;AAIF,eAAO,MAAM,iBAAiB,6NAAe,CAAC;AAE9C,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oLAIjC,CAAC;AAEF,eAAO,MAAM,yBAAyB;;uIAqBpC,CAAC;AAIH,QAAA,MAAM,aAAa,EAAE,+BAA+B,CAAC,kBAAkB,
|
|
1
|
+
{"version":3,"file":"MultiStepForm.d.ts","sourceRoot":"","sources":["../../../src/components/MultiStepForm/MultiStepForm.tsx"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,aAAa,CAAC;AAWnE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAIhE,eAAO,MAAM,UAAU;cAA2B,OAAO;cAAY,OAAO;YAuB3E,CAAC;AAIF,eAAO,MAAM,iBAAiB,6NAAe,CAAC;AAE9C,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oLAIjC,CAAC;AAEF,eAAO,MAAM,yBAAyB;;uIAqBpC,CAAC;AAIH,QAAA,MAAM,aAAa,EAAE,+BAA+B,CAAC,kBAAkB,CAyNtE,CAAC;AAEF,eAAe,aAAa,CAAC"}
|
|
@@ -58,7 +58,7 @@ export const StyledRequiredFieldLegend = styled(Text)(({ theme }) => {
|
|
|
58
58
|
`;
|
|
59
59
|
});
|
|
60
60
|
StyledRequiredFieldLegend.defaultProps = defaultThemeProp;
|
|
61
|
-
const MultiStepForm = forwardRef(function MultiStepForm({ currentStepId, steps, heading, progress, stepIndicator: stepIndicatorProp, showStepNames = false, ...restProps }, ref) {
|
|
61
|
+
const MultiStepForm = forwardRef(function MultiStepForm({ currentStepId, steps, heading, progress, stepIndicator: stepIndicatorProp, showStepNames = false, variant = 'dot', ...restProps }, ref) {
|
|
62
62
|
const showHorizontalStepNames = stepIndicatorProp === 'horizontal' ? showStepNames : undefined;
|
|
63
63
|
const multiStepRef = useConsolidatedRef(ref);
|
|
64
64
|
const headingRef = useRef(null);
|
|
@@ -184,7 +184,7 @@ const MultiStepForm = forwardRef(function MultiStepForm({ currentStepId, steps,
|
|
|
184
184
|
areas: areaDef,
|
|
185
185
|
rowGap: 2,
|
|
186
186
|
colGap: stepIndicator.startsWith('vertical') ? 4 : 2
|
|
187
|
-
}, inert: progress ? '' : undefined, children: [steps.length > 1 && (_jsxs(Grid, { ref: progressIndicatorRef, item: { area: 'stepIndicator' }, children: [stepIndicator === 'horizontal' && (_jsx(Grid, { item: { area: 'stepIndicator' }, as: HorizontalFormProgress, steps: steps, currentStepId: currentStepId, showStepNames: showHorizontalStepNames })), stepIndicator.startsWith('vertical') && (_jsx(Grid, { item: { area: 'stepIndicator' }, as: VerticalFormProgress, steps: steps, currentStepId: currentStepId })), _jsx(VisuallyHiddenText, { "aria-live": 'polite', children: previousId !== undefined && previousId !== currentStepId
|
|
187
|
+
}, inert: progress ? '' : undefined, children: [steps.length > 1 && (_jsxs(Grid, { ref: progressIndicatorRef, item: { area: 'stepIndicator' }, children: [stepIndicator === 'horizontal' && (_jsx(Grid, { item: { area: 'stepIndicator' }, as: HorizontalFormProgress, steps: steps, currentStepId: currentStepId, showStepNames: showHorizontalStepNames, variant: variant })), stepIndicator.startsWith('vertical') && (_jsx(Grid, { item: { area: 'stepIndicator' }, as: VerticalFormProgress, steps: steps, currentStepId: currentStepId, variant: variant })), _jsx(VisuallyHiddenText, { "aria-live": 'polite', children: previousId !== undefined && previousId !== currentStepId
|
|
188
188
|
? t('step_changed_to_name', [currentStep.name])
|
|
189
189
|
: '' })] })), currentStep.banners && _jsx(Grid, { item: { area: 'banners' }, children: currentStep.banners }), currentStep.description && (_jsx(StyledInstructionText, { item: { area: 'description' }, children: _jsx(HTML, { id: descriptionId, as: 'p', content: currentStep.description }) })), _jsx(Grid, { item: { area: 'content' }, as: StyledFormContent, ref: multiStepFormContentRef, children: currentStep.content }), _jsx(Progress, { visible: !!progress, focusOnVisible: true, placement: 'local', message: typeof progress === 'string' ? progress : undefined })] }), currentStep.actions && (_jsx(ResponsiveActions, { actionsRef: multiStepActionsRef, actionsEl: currentStep.actions }))] }));
|
|
190
190
|
});
|