@cdx-ui/primitives 0.3.5 → 0.3.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 (82) hide show
  1. package/lib/commonjs/index.js +12 -0
  2. package/lib/commonjs/index.js.map +1 -1
  3. package/lib/commonjs/progress-bar/ProgressBarIndicator.js +56 -3
  4. package/lib/commonjs/progress-bar/ProgressBarIndicator.js.map +1 -1
  5. package/lib/commonjs/select/SelectEmpty.js +2 -13
  6. package/lib/commonjs/select/SelectEmpty.js.map +1 -1
  7. package/lib/commonjs/slider/useSliderPointer.js +9 -4
  8. package/lib/commonjs/slider/useSliderPointer.js.map +1 -1
  9. package/lib/commonjs/stepper/StepperRoot.js +119 -0
  10. package/lib/commonjs/stepper/StepperRoot.js.map +1 -0
  11. package/lib/commonjs/stepper/StepperStep.js +78 -0
  12. package/lib/commonjs/stepper/StepperStep.js.map +1 -0
  13. package/lib/commonjs/stepper/StepperStepPressable.js +63 -0
  14. package/lib/commonjs/stepper/StepperStepPressable.js.map +1 -0
  15. package/lib/commonjs/stepper/StepperStepTrigger.js +44 -0
  16. package/lib/commonjs/stepper/StepperStepTrigger.js.map +1 -0
  17. package/lib/commonjs/stepper/StepperStepTrigger.web.js +71 -0
  18. package/lib/commonjs/stepper/StepperStepTrigger.web.js.map +1 -0
  19. package/lib/commonjs/stepper/context.js +21 -0
  20. package/lib/commonjs/stepper/context.js.map +1 -0
  21. package/lib/commonjs/stepper/index.js +46 -0
  22. package/lib/commonjs/stepper/index.js.map +1 -0
  23. package/lib/commonjs/stepper/types.js +6 -0
  24. package/lib/commonjs/stepper/types.js.map +1 -0
  25. package/lib/module/index.js +1 -0
  26. package/lib/module/index.js.map +1 -1
  27. package/lib/module/progress-bar/ProgressBarIndicator.js +57 -5
  28. package/lib/module/progress-bar/ProgressBarIndicator.js.map +1 -1
  29. package/lib/module/select/SelectEmpty.js +2 -13
  30. package/lib/module/select/SelectEmpty.js.map +1 -1
  31. package/lib/module/slider/useSliderPointer.js +9 -4
  32. package/lib/module/slider/useSliderPointer.js.map +1 -1
  33. package/lib/module/stepper/StepperRoot.js +115 -0
  34. package/lib/module/stepper/StepperRoot.js.map +1 -0
  35. package/lib/module/stepper/StepperStep.js +74 -0
  36. package/lib/module/stepper/StepperStep.js.map +1 -0
  37. package/lib/module/stepper/StepperStepPressable.js +60 -0
  38. package/lib/module/stepper/StepperStepPressable.js.map +1 -0
  39. package/lib/module/stepper/StepperStepTrigger.js +40 -0
  40. package/lib/module/stepper/StepperStepTrigger.js.map +1 -0
  41. package/lib/module/stepper/StepperStepTrigger.web.js +67 -0
  42. package/lib/module/stepper/StepperStepTrigger.web.js.map +1 -0
  43. package/lib/module/stepper/context.js +11 -0
  44. package/lib/module/stepper/context.js.map +1 -0
  45. package/lib/module/stepper/index.js +7 -0
  46. package/lib/module/stepper/index.js.map +1 -0
  47. package/lib/module/stepper/types.js +4 -0
  48. package/lib/module/stepper/types.js.map +1 -0
  49. package/lib/typescript/index.d.ts +1 -0
  50. package/lib/typescript/index.d.ts.map +1 -1
  51. package/lib/typescript/progress-bar/ProgressBarIndicator.d.ts.map +1 -1
  52. package/lib/typescript/select/SelectEmpty.d.ts.map +1 -1
  53. package/lib/typescript/slider/useSliderPointer.d.ts.map +1 -1
  54. package/lib/typescript/stepper/StepperRoot.d.ts +7 -0
  55. package/lib/typescript/stepper/StepperRoot.d.ts.map +1 -0
  56. package/lib/typescript/stepper/StepperStep.d.ts +7 -0
  57. package/lib/typescript/stepper/StepperStep.d.ts.map +1 -0
  58. package/lib/typescript/stepper/StepperStepPressable.d.ts +8 -0
  59. package/lib/typescript/stepper/StepperStepPressable.d.ts.map +1 -0
  60. package/lib/typescript/stepper/StepperStepTrigger.d.ts +9 -0
  61. package/lib/typescript/stepper/StepperStepTrigger.d.ts.map +1 -0
  62. package/lib/typescript/stepper/StepperStepTrigger.web.d.ts +9 -0
  63. package/lib/typescript/stepper/StepperStepTrigger.web.d.ts.map +1 -0
  64. package/lib/typescript/stepper/context.d.ts +16 -0
  65. package/lib/typescript/stepper/context.d.ts.map +1 -0
  66. package/lib/typescript/stepper/index.d.ts +6 -0
  67. package/lib/typescript/stepper/index.d.ts.map +1 -0
  68. package/lib/typescript/stepper/types.d.ts +96 -0
  69. package/lib/typescript/stepper/types.d.ts.map +1 -0
  70. package/package.json +3 -3
  71. package/src/index.ts +1 -0
  72. package/src/progress-bar/ProgressBarIndicator.tsx +85 -6
  73. package/src/select/SelectEmpty.tsx +2 -22
  74. package/src/slider/useSliderPointer.ts +9 -4
  75. package/src/stepper/StepperRoot.tsx +148 -0
  76. package/src/stepper/StepperStep.tsx +101 -0
  77. package/src/stepper/StepperStepPressable.tsx +48 -0
  78. package/src/stepper/StepperStepTrigger.tsx +38 -0
  79. package/src/stepper/StepperStepTrigger.web.tsx +69 -0
  80. package/src/stepper/context.tsx +11 -0
  81. package/src/stepper/index.ts +16 -0
  82. package/src/stepper/types.ts +104 -0
@@ -0,0 +1,74 @@
1
+ "use strict";
2
+
3
+ import { forwardRef, useMemo } from 'react';
4
+ import { Platform, View } from 'react-native';
5
+ import { Slot } from '../slot';
6
+ import { dataAttributes, mergeDataAttributes } from '../utils/dataAttributes';
7
+ import { StepperStepProvider, useStepperContext, useStepperIndex } from './context';
8
+ import { jsx as _jsx } from "react/jsx-runtime";
9
+ function clampProgress(progress) {
10
+ return Number.isFinite(progress) ? Math.min(100, Math.max(0, progress)) : 0;
11
+ }
12
+ export const StepperStep = /*#__PURE__*/forwardRef(({
13
+ asChild,
14
+ children,
15
+ isComplete: isCompleteProp,
16
+ progress: progressProp = 0,
17
+ isDisabled = false,
18
+ role = 'listitem',
19
+ ...props
20
+ }, ref) => {
21
+ const index = useStepperIndex();
22
+ const {
23
+ currentStep,
24
+ count,
25
+ orientation,
26
+ labelPlacement,
27
+ isLinear,
28
+ hasStepChangeHandler
29
+ } = useStepperContext();
30
+ const isCurrent = index === currentStep;
31
+ const isComplete = isCompleteProp ?? index < currentStep;
32
+ const progress = clampProgress(progressProp);
33
+ const hasProgress = progress > 0 && !isComplete;
34
+ // The current step is never a button, so it adds no Tab stop that does nothing.
35
+ const isClickable = hasStepChangeHandler && !isDisabled && !isCurrent && (isComplete || !isLinear);
36
+ const state = useMemo(() => ({
37
+ index,
38
+ count,
39
+ isCurrent,
40
+ isComplete,
41
+ progress,
42
+ hasProgress,
43
+ isLast: index === count - 1,
44
+ isClickable,
45
+ isDisabled,
46
+ orientation,
47
+ labelPlacement
48
+ }), [index, count, isCurrent, isComplete, progress, hasProgress, isClickable, isDisabled, orientation, labelPlacement]);
49
+ const currentProps = Platform.OS === 'web' && isCurrent ? {
50
+ 'aria-current': 'step'
51
+ } : {};
52
+ const Comp = asChild ? Slot : View;
53
+ return /*#__PURE__*/_jsx(StepperStepProvider, {
54
+ value: state,
55
+ children: /*#__PURE__*/_jsx(Comp, {
56
+ ref: ref,
57
+ ...props,
58
+ role: role,
59
+ ...currentProps,
60
+ ...mergeDataAttributes(props, dataAttributes({
61
+ orientation,
62
+ labelPlacement,
63
+ current: isCurrent,
64
+ complete: isComplete,
65
+ progress: hasProgress,
66
+ clickable: isClickable,
67
+ disabled: isDisabled
68
+ })),
69
+ children: children
70
+ })
71
+ });
72
+ });
73
+ StepperStep.displayName = 'StepperStep';
74
+ //# sourceMappingURL=StepperStep.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["forwardRef","useMemo","Platform","View","Slot","dataAttributes","mergeDataAttributes","StepperStepProvider","useStepperContext","useStepperIndex","jsx","_jsx","clampProgress","progress","Number","isFinite","Math","min","max","StepperStep","asChild","children","isComplete","isCompleteProp","progressProp","isDisabled","role","props","ref","index","currentStep","count","orientation","labelPlacement","isLinear","hasStepChangeHandler","isCurrent","hasProgress","isClickable","state","isLast","currentProps","OS","Comp","value","current","complete","clickable","disabled","displayName"],"sourceRoot":"../../../src","sources":["stepper/StepperStep.tsx"],"mappings":";;AAAA,SAASA,UAAU,EAAEC,OAAO,QAA2B,OAAO;AAC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yB;IACvB4B,KAAK;IACLE,KAAK;IACLK,SAAS;IACTd,UAAU;IACVT,QAAQ;IACRwB,WAAW;IACXG,MAAM,EAAEX,KAAK,KAAKE,KAAK,GAAG,CAAC;IAC3BO,WAAW;IACXb,UAAU;IACVO,WAAW;IACXC;EACF,CAAC,CAAC,EACF,CACEJ,KAAK,EACLE,KAAK,EACLK,SAAS,EACTd,UAAU,EACVT,QAAQ,EACRwB,WAAW,EACXC,WAAW,EACXb,UAAU,EACVO,WAAW,EACXC,cAAc,CAElB,CAAC;EAED,MAAMQ,YAAY,GAChBvC,QAAQ,CAACwC,EAAE,KAAK,KAAK,IAAIN,SAAS,GAAI;IAAE,cAAc,EAAE;EAAO,CAAC,GAAa,CAAC,CAAC;EAEjF,MAAMO,IAAI,GAAGvB,OAAO,GAAGhB,IAAI,GAAGD,IAAI;EAElC,oBACEQ,IAAA,CAACJ,mBAAmB;IAACqC,KAAK,EAAEL,KAAM;IAAAlB,QAAA,eAChCV,IAAA,CAACgC,IAAI;MACHf,GAAG,EAAEA,GAAI;MAAA,GACLD,KAAK;MACTD,IAAI,EAAEA,IAAK;MAAA,GACPe,YAAY;MAAA,GACZnC,mBAAmB,CACrBqB,KAAK,EACLtB,cAAc,CAAC;QACb2B,WAAW;QACXC,cAAc;QACdY,OAAO,EAAET,SAAS;QAClBU,QAAQ,EAAExB,UAAU;QACpBT,QAAQ,EAAEwB,WAAW;QACrBU,SAAS,EAAET,WAAW;QACtBU,QAAQ,EAAEvB;MACZ,CAAC,CACH,CAAC;MAAAJ,QAAA,EAEAA;IAAQ,CACL;EAAC,CACY,CAAC;AAE1B,CACF,CAAC;AAEDF,WAAW,CAAC8B,WAAW,GAAG,aAAa","ignoreList":[]}
@@ -0,0 +1,60 @@
1
+ "use strict";
2
+
3
+ import { forwardRef } from 'react';
4
+ import { Pressable } from 'react-native';
5
+ import { composeEventHandlers } from '@cdx-ui/utils';
6
+ import { useFocusRing } from '@react-native-aria/focus';
7
+ import { useHover, usePress } from '@react-native-aria/interactions';
8
+ import { dataAttributes, mergeDataAttributes } from '../utils/dataAttributes';
9
+ import { useStepperContext, useStepperStep } from './context';
10
+
11
+ /**
12
+ * Press target for a clickable step: a `button` that is reachable with Tab and activates
13
+ * with Enter or Space. Rendered by `StepperStepTrigger` only while the step is clickable,
14
+ * so display-only steps add no focus stop and no interaction state.
15
+ */
16
+ import { jsx as _jsx } from "react/jsx-runtime";
17
+ export const StepperStepPressable = /*#__PURE__*/forwardRef(({
18
+ onPress,
19
+ ...props
20
+ }, ref) => {
21
+ const {
22
+ index
23
+ } = useStepperStep();
24
+ const {
25
+ setCurrentStep
26
+ } = useStepperContext();
27
+ const {
28
+ isFocusVisible,
29
+ focusProps
30
+ } = useFocusRing();
31
+ const {
32
+ pressProps,
33
+ isPressed
34
+ } = usePress({});
35
+ const {
36
+ isHovered,
37
+ hoverProps
38
+ } = useHover();
39
+ return /*#__PURE__*/_jsx(Pressable, {
40
+ ref: ref,
41
+ role: "button",
42
+ ...props,
43
+ ...mergeDataAttributes(props, dataAttributes({
44
+ hover: isHovered,
45
+ active: isPressed,
46
+ focusVisible: isFocusVisible
47
+ })),
48
+ onPress: composeEventHandlers(onPress, () => {
49
+ setCurrentStep(index);
50
+ }),
51
+ onPressIn: composeEventHandlers(props.onPressIn, pressProps.onPressIn),
52
+ onPressOut: composeEventHandlers(props.onPressOut, pressProps.onPressOut),
53
+ onHoverIn: composeEventHandlers(props.onHoverIn, hoverProps.onHoverIn),
54
+ onHoverOut: composeEventHandlers(props.onHoverOut, hoverProps.onHoverOut),
55
+ onFocus: composeEventHandlers(props.onFocus, focusProps.onFocus),
56
+ onBlur: composeEventHandlers(props.onBlur, focusProps.onBlur)
57
+ });
58
+ });
59
+ StepperStepPressable.displayName = 'StepperStepPressable';
60
+ //# sourceMappingURL=StepperStepPressable.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["forwardRef","Pressable","composeEventHandlers","useFocusRing","useHover","usePress","dataAttributes","mergeDataAttributes","useStepperContext","useStepperStep","jsx","_jsx","StepperStepPressable","onPress","props","ref","index","setCurrentStep","isFocusVisible","focusProps","pressProps","isPressed","isHovered","hoverProps","role","hover","active","focusVisible","onPressIn","onPressOut","onHoverIn","onHoverOut","onFocus","onBlur","displayName"],"sourceRoot":"../../../src","sources":["stepper/StepperStepPressable.tsx"],"mappings":";;AAAA,SAASA,UAAU,QAA2B,OAAO;AACrD,SAASC,SAAS,QAAyD,cAAc;AACzF,SAASC,oBAAoB,QAAQ,eAAe;AACpD,SAASC,YAAY,QAAQ,0BAA0B;AACvD,SAASC,QAAQ,EAAEC,QAAQ,QAAQ,iCAAiC;AACpE,SAASC,cAAc,EAAEC,mBAAmB,QAAQ,yBAAyB;AAC7E,SAASC,iBAAiB,EAAEC,cAAc,QAAQ,WAAW;;AAE7D;AACA;AACA;AACA;AACA;AAJA,SAAAC,GAAA,IAAAC,IAAA;AAKA,OAAO,MAAMC,oBAAoB,gBAAGZ,UAAU,CAC5C,CAAC;EAAEa,OAAO;EAAE,GAAGC;AAAM,CAAC,EAAEC,GAAG,KAAK;EAC9B,MAAM;IAAEC;EAAM,CAAC,GAAGP,cAAc,CAAC,CAAC;EAClC,MAAM;IAAEQ;EAAe,CAAC,GAAGT,iBAAiB,CAAC,CAAC;EAC9C,MAAM;IAAEU,cAAc;IAAEC;EAAW,CAAC,GAAGhB,YAAY,CAAC,CAGnD;EACD,MAAM;IAAEiB,UAAU;IAAEC;EAAU,CAAC,GAAGhB,QAAQ,CAAC,CAAC,CAAC,CAAC;EAC9C,MAAM;IAAEiB,SAAS;IAAEC;EAAW,CAAC,GAAGnB,QAAQ,CAAC,CAAC;EAE5C,oBACEO,IAAA,CAACV,SAAS;IACRc,GAAG,EAAEA,GAAI;IACTS,IAAI,EAAC,QAAQ;IAAA,GACTV,KAAK;IAAA,GACLP,mBAAmB,CACrBO,KAAK,EACLR,cAAc,CAAC;MAAEmB,KAAK,EAAEH,SAAS;MAAEI,MAAM,EAAEL,SAAS;MAAEM,YAAY,EAAET;IAAe,CAAC,CACtF,CAAC;IACDL,OAAO,EAAEX,oBAAoB,CAAwBW,OAAO,EAAE,MAAM;MAClEI,cAAc,CAACD,KAAK,CAAC;IACvB,CAAC,CAAE;IACHY,SAAS,EAAE1B,oBAAoB,CAACY,KAAK,CAACc,SAAS,EAAER,UAAU,CAACQ,SAAS,CAAE;IACvEC,UAAU,EAAE3B,oBAAoB,CAACY,KAAK,CAACe,UAAU,EAAET,UAAU,CAACS,UAAU,CAAE;IAC1EC,SAAS,EAAE5B,oBAAoB,CAACY,KAAK,CAACgB,SAAS,EAAEP,UAAU,CAACO,SAAS,CAAE;IACvEC,UAAU,EAAE7B,oBAAoB,CAACY,KAAK,CAACiB,UAAU,EAAER,UAAU,CAACQ,UAAU,CAAE;IAC1EC,OAAO,EAAE9B,oBAAoB,CAACY,KAAK,CAACkB,OAAO,EAAEb,UAAU,CAACa,OAAO,CAAE;IACjEC,MAAM,EAAE/B,oBAAoB,CAACY,KAAK,CAACmB,MAAM,EAAEd,UAAU,CAACc,MAAM;EAAE,CAC/D,CAAC;AAEN,CACF,CAAC;AAEDrB,oBAAoB,CAACsB,WAAW,GAAG,sBAAsB","ignoreList":[]}
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+
3
+ import { forwardRef } from 'react';
4
+ import { View } from 'react-native';
5
+ import { dataAttributes, mergeDataAttributes } from '../utils/dataAttributes';
6
+ import { useStepperContext, useStepperStep } from './context';
7
+ import { StepperStepPressable } from './StepperStepPressable';
8
+ import { jsx as _jsx } from "react/jsx-runtime";
9
+ /**
10
+ * Internal step region that carries the step's accessible name: the grouped visible
11
+ * content (indicator, title, description) followed by the state phrase. It becomes a
12
+ * `button` while the step is clickable. Not a public styled part; the styled
13
+ * `Stepper.Step` renders it around those slots.
14
+ */
15
+ export const StepperStepTrigger = /*#__PURE__*/forwardRef(({
16
+ children,
17
+ ...props
18
+ }, ref) => {
19
+ const state = useStepperStep();
20
+ const {
21
+ getStepAccessibilityText
22
+ } = useStepperContext();
23
+ const phrase = getStepAccessibilityText(state);
24
+ const Comp = state.isClickable ? StepperStepPressable : View;
25
+ return /*#__PURE__*/_jsx(Comp, {
26
+ ref: ref,
27
+ accessible: true,
28
+ accessibilityValue: phrase ? {
29
+ text: phrase
30
+ } : undefined,
31
+ ...props,
32
+ ...mergeDataAttributes(props, dataAttributes({
33
+ clickable: state.isClickable,
34
+ disabled: state.isDisabled
35
+ })),
36
+ children: children
37
+ });
38
+ });
39
+ StepperStepTrigger.displayName = 'StepperStepTrigger';
40
+ //# sourceMappingURL=StepperStepTrigger.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["forwardRef","View","dataAttributes","mergeDataAttributes","useStepperContext","useStepperStep","StepperStepPressable","jsx","_jsx","StepperStepTrigger","children","props","ref","state","getStepAccessibilityText","phrase","Comp","isClickable","accessible","accessibilityValue","text","undefined","clickable","disabled","isDisabled","displayName"],"sourceRoot":"../../../src","sources":["stepper/StepperStepTrigger.tsx"],"mappings":";;AAAA,SAASA,UAAU,QAA2B,OAAO;AACrD,SAASC,IAAI,QAAQ,cAAc;AACnC,SAASC,cAAc,EAAEC,mBAAmB,QAAQ,yBAAyB;AAC7E,SAASC,iBAAiB,EAAEC,cAAc,QAAQ,WAAW;AAC7D,SAASC,oBAAoB,QAAQ,wBAAwB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAG9D;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,kBAAkB,gBAAGT,UAAU,CAC1C,CAAC;EAAEU,QAAQ;EAAE,GAAGC;AAAM,CAAC,EAAEC,GAAG,KAAK;EAC/B,MAAMC,KAAK,GAAGR,cAAc,CAAC,CAAC;EAC9B,MAAM;IAAES;EAAyB,CAAC,GAAGV,iBAAiB,CAAC,CAAC;EACxD,MAAMW,MAAM,GAAGD,wBAAwB,CAACD,KAAK,CAAC;EAC9C,MAAMG,IAAI,GAAGH,KAAK,CAACI,WAAW,GAAGX,oBAAoB,GAAGL,IAAI;EAE5D,oBACEO,IAAA,CAACQ,IAAI;IACHJ,GAAG,EAAEA,GAAI;IACTM,UAAU;IACVC,kBAAkB,EAAEJ,MAAM,GAAG;MAAEK,IAAI,EAAEL;IAAO,CAAC,GAAGM,SAAU;IAAA,GACtDV,KAAK;IAAA,GACLR,mBAAmB,CACrBQ,KAAK,EACLT,cAAc,CAAC;MAAEoB,SAAS,EAAET,KAAK,CAACI,WAAW;MAAEM,QAAQ,EAAEV,KAAK,CAACW;IAAW,CAAC,CAC7E,CAAC;IAAAd,QAAA,EAEAA;EAAQ,CACL,CAAC;AAEX,CACF,CAAC;AAEDD,kBAAkB,CAACgB,WAAW,GAAG,oBAAoB","ignoreList":[]}
@@ -0,0 +1,67 @@
1
+ "use strict";
2
+
3
+ import { forwardRef, useLayoutEffect, useMemo, useRef } from 'react';
4
+ import { View } from 'react-native';
5
+ import { VisuallyHidden } from '@react-aria/visually-hidden';
6
+ import { composeEventHandlers, mergeRefs } from '@cdx-ui/utils';
7
+ import { dataAttributes, mergeDataAttributes } from '../utils/dataAttributes';
8
+ import { useStepperContext, useStepperStep } from './context';
9
+ import { StepperStepPressable } from './StepperStepPressable';
10
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
11
+ /**
12
+ * Internal step region that carries the step's accessible name. On web the state phrase
13
+ * is screen-reader-only text after the visible content, because browse-mode screen
14
+ * readers ignore `aria-label` on a list item. It becomes a `button` while the step is
15
+ * clickable. Not a public styled part.
16
+ */
17
+ export const StepperStepTrigger = /*#__PURE__*/forwardRef(({
18
+ children,
19
+ ...props
20
+ }, ref) => {
21
+ const state = useStepperStep();
22
+ const {
23
+ getStepAccessibilityText
24
+ } = useStepperContext();
25
+ const phrase = getStepAccessibilityText(state);
26
+ const Comp = state.isClickable ? StepperStepPressable : View;
27
+ const nodeRef = useRef(null);
28
+ const mergedRef = useMemo(() => mergeRefs(ref, nodeRef), [ref]);
29
+ // Activating a step makes it current, which swaps the focused button for a plain region
30
+ // and would drop focus to the document. Focus moves to that region instead, outside the
31
+ // Tab order.
32
+ const restoreFocusRef = useRef(false);
33
+ useLayoutEffect(() => {
34
+ const node = nodeRef.current;
35
+ if (!restoreFocusRef.current || state.isClickable || node === null) {
36
+ return;
37
+ }
38
+ restoreFocusRef.current = false;
39
+ node.tabIndex = -1;
40
+ node.focus({
41
+ preventScroll: true
42
+ });
43
+ }, [state.isClickable]);
44
+ const pressProps = state.isClickable ? {
45
+ onPress: () => {
46
+ restoreFocusRef.current = document.activeElement === nodeRef.current;
47
+ },
48
+ onBlur: composeEventHandlers(props.onBlur, () => {
49
+ restoreFocusRef.current = false;
50
+ })
51
+ } : {};
52
+ return /*#__PURE__*/_jsxs(Comp, {
53
+ ref: mergedRef,
54
+ ...props,
55
+ ...pressProps,
56
+ ...mergeDataAttributes(props, dataAttributes({
57
+ clickable: state.isClickable,
58
+ disabled: state.isDisabled
59
+ })),
60
+ children: [children, phrase ? /*#__PURE__*/_jsx(VisuallyHidden, {
61
+ elementType: "span",
62
+ children: `, ${phrase}`
63
+ }) : null]
64
+ });
65
+ });
66
+ StepperStepTrigger.displayName = 'StepperStepTrigger';
67
+ //# sourceMappingURL=StepperStepTrigger.web.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["forwardRef","useLayoutEffect","useMemo","useRef","View","VisuallyHidden","composeEventHandlers","mergeRefs","dataAttributes","mergeDataAttributes","useStepperContext","useStepperStep","StepperStepPressable","jsx","_jsx","jsxs","_jsxs","StepperStepTrigger","children","props","ref","state","getStepAccessibilityText","phrase","Comp","isClickable","nodeRef","mergedRef","restoreFocusRef","node","current","tabIndex","focus","preventScroll","pressProps","onPress","document","activeElement","onBlur","clickable","disabled","isDisabled","elementType","displayName"],"sourceRoot":"../../../src","sources":["stepper/StepperStepTrigger.web.tsx"],"mappings":";;AAAA,SAASA,UAAU,EAAEC,eAAe,EAAEC,OAAO,EAAEC,MAAM,QAA2B,OAAO;AACvF,SAASC,IAAI,QAAQ,cAAc;AACnC,SAASC,cAAc,QAAQ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K,CAACI,WAAW,CAAC,CAAC;EAEvB,MAAMS,UAAU,GAAGb,KAAK,CAACI,WAAW,GAChC;IACEU,OAAO,EAAEA,CAAA,KAAM;MACbP,eAAe,CAACE,OAAO,GACrBM,QAAQ,CAACC,aAAa,KAAMX,OAAO,CAACI,OAAyC;IACjF,CAAC;IACDQ,MAAM,EAAEhC,oBAAoB,CAACa,KAAK,CAACmB,MAAM,EAAE,MAAM;MAC/CV,eAAe,CAACE,OAAO,GAAG,KAAK;IACjC,CAAC;EACH,CAAC,GACD,CAAC,CAAC;EAEN,oBACEd,KAAA,CAACQ,IAAI;IACHJ,GAAG,EAAEO,SAAU;IAAA,GACXR,KAAK;IAAA,GACLe,UAAU;IAAA,GACVzB,mBAAmB,CACrBU,KAAK,EACLX,cAAc,CAAC;MAAE+B,SAAS,EAAElB,KAAK,CAACI,WAAW;MAAEe,QAAQ,EAAEnB,KAAK,CAACoB;IAAW,CAAC,CAC7E,CAAC;IAAAvB,QAAA,GAEAA,QAAQ,EACRK,MAAM,gBAAGT,IAAA,CAACT,cAAc;MAACqC,WAAW,EAAC,MAAM;MAAAxB,QAAA,EAAE,KAAKK,MAAM;IAAE,CAAiB,CAAC,GAAG,IAAI;EAAA,CAChF,CAAC;AAEX,CACF,CAAC;AAEDN,kBAAkB,CAAC0B,WAAW,GAAG,oBAAoB","ignoreList":[]}
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+
3
+ import { createContext } from '@cdx-ui/utils';
4
+ export const [StepperProvider, useStepperContext] = createContext('StepperContext');
5
+
6
+ /** Position of a direct child of `StepperRoot`, supplied by the root while it renders. */
7
+ export const [StepperIndexProvider, useStepperIndex] = createContext('StepperIndex');
8
+
9
+ /** Resolved state of the enclosing step. `useStepperStep` throws outside a `StepperStep`. */
10
+ export const [StepperStepProvider, useStepperStep] = createContext('StepperStep');
11
+ //# sourceMappingURL=context.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["createContext","StepperProvider","useStepperContext","StepperIndexProvider","useStepperIndex","StepperStepProvider","useStepperStep"],"sourceRoot":"../../../src","sources":["stepper/context.tsx"],"mappings":";;AAAA,SAASA,aAAa,QAAQ,eAAe;AAG7C,OAAO,MAAM,CAACC,eAAe,EAAEC,iBAAiB,CAAC,GAC/CF,aAAa,CAAsB,gBAAgB,CAAC;;AAEtD;AACA,OAAO,MAAM,CAACG,oBAAoB,EAAEC,eAAe,CAAC,GAAGJ,aAAa,CAAS,cAAc,CAAC;;AAE5F;AACA,OAAO,MAAM,CAACK,mBAAmB,EAAEC,cAAc,CAAC,GAAGN,aAAa,CAAmB,aAAa,CAAC","ignoreList":[]}
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+
3
+ export { useStepperContext, useStepperIndex, useStepperStep } from './context';
4
+ export { StepperRoot } from './StepperRoot';
5
+ export { StepperStep } from './StepperStep';
6
+ export { StepperStepTrigger } from './StepperStepTrigger';
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["useStepperContext","useStepperIndex","useStepperStep","StepperRoot","StepperStep","StepperStepTrigger"],"sourceRoot":"../../../src","sources":["stepper/index.ts"],"mappings":";;AAYA,SAASA,iBAAiB,EAAEC,eAAe,EAAEC,cAAc,QAAQ,WAAW;AAC9E,SAASC,WAAW,QAA+B,eAAe;AAClE,SAASC,WAAW,QAA+B,eAAe;AAClE,SAASC,kBAAkB,QAAQ,sBAAsB","ignoreList":[]}
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+
3
+ export {};
4
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sourceRoot":"../../../src","sources":["stepper/types.ts"],"mappings":"","ignoreList":[]}
@@ -43,6 +43,7 @@ export * from './progress-bar';
43
43
  export * from './radio';
44
44
  export * from './accordion';
45
45
  export * from './slider';
46
+ export * from './stepper';
46
47
  export type { InteractionState } from './types';
47
48
  export { FormControlContext, useFormControlContext } from '@cdx-ui/utils';
48
49
  export { dataAttributes, mergeDataAttributes } from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,yBAA0B,SAAQ,SAAS;IAC1D,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;CAC5B;AAED,eAAO,MAAM,oBAAoB,4GAmBhC,CAAC"}
1
+ {"version":3,"file":"ProgressBarIndicator.d.ts","sourceRoot":"","sources":["../../../src/progress-bar/ProgressBarIndicator.tsx"],"names":[],"mappings":"AACA,OAAO,EAEL,IAAI,EAEJ,KAAK,SAAS,EAEf,MAAM,cAAc,CAAC;AA0BtB,MAAM,WAAW,yBAA0B,SAAQ,SAAS;IAC1D,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;CAC5B;AAED,eAAO,MAAM,oBAAoB,4GAyEhC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"SelectEmpty.d.ts","sourceRoot":"","sources":["../../../src/select/SelectEmpty.tsx"],"names":[],"mappings":"AAQA,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAGpC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAEjD,MAAM,WAAW,gBAAiB,SAAQ,iBAAiB;IACzD,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAgBD;;;GAGG;AACH,eAAO,MAAM,WAAW,mGAsBvB,CAAC"}
1
+ {"version":3,"file":"SelectEmpty.d.ts","sourceRoot":"","sources":["../../../src/select/SelectEmpty.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAIpC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAEjD,MAAM,WAAW,gBAAiB,SAAQ,iBAAiB;IACzD,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;GAGG;AACH,eAAO,MAAM,WAAW,mGAsBvB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"useSliderPointer.d.ts","sourceRoot":"","sources":["../../../src/slider/useSliderPointer.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AACnD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAGjD,wBAAgB,gBAAgB,CAAC,WAAW,EAAE;IAC5C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,GAAG;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE,CAS3B;AAED,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,MAAM,EACb,WAAW,EAAE,iBAAiB,GAAG,IAAI,EACrC,WAAW,EAAE,iBAAiB,EAC9B,SAAS,EAAE,MAAM,GAChB,MAAM,CAUR;AAQD,wBAAgB,gBAAgB,CAAC,EAC/B,UAAU,EACV,aAAa,EACb,iBAAiB,EACjB,WAAW,EACX,WAAW,EACX,SAAS,GACV,EAAE;IACD,UAAU,EAAE,OAAO,CAAC;IACpB,aAAa,EAAE,CAAC,QAAQ,EAAE,OAAO,KAAK,IAAI,CAAC;IAC3C,iBAAiB,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;IAC/D,WAAW,EAAE,iBAAiB,GAAG,IAAI,CAAC;IACtC,WAAW,EAAE,iBAAiB,CAAC;IAC/B,SAAS,EAAE,MAAM,CAAC;CACnB;uBAyBY,MAAM,SACN,MAAM,gBACC,MAAM,wBACE,iBAAiB;EAuE5C"}
1
+ {"version":3,"file":"useSliderPointer.d.ts","sourceRoot":"","sources":["../../../src/slider/useSliderPointer.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AACnD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAGjD,wBAAgB,gBAAgB,CAAC,WAAW,EAAE;IAC5C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,GAAG;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE,CAS3B;AAED,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,MAAM,EACb,WAAW,EAAE,iBAAiB,GAAG,IAAI,EACrC,WAAW,EAAE,iBAAiB,EAC9B,SAAS,EAAE,MAAM,GAChB,MAAM,CAUR;AAQD,wBAAgB,gBAAgB,CAAC,EAC/B,UAAU,EACV,aAAa,EACb,iBAAiB,EACjB,WAAW,EACX,WAAW,EACX,SAAS,GACV,EAAE;IACD,UAAU,EAAE,OAAO,CAAC;IACpB,aAAa,EAAE,CAAC,QAAQ,EAAE,OAAO,KAAK,IAAI,CAAC;IAC3C,iBAAiB,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;IAC/D,WAAW,EAAE,iBAAiB,GAAG,IAAI,CAAC;IACtC,WAAW,EAAE,iBAAiB,CAAC;IAC/B,SAAS,EAAE,MAAM,CAAC;CACnB;uBA8BY,MAAM,SACN,MAAM,gBACC,MAAM,wBACE,iBAAiB;EAuE5C"}
@@ -0,0 +1,7 @@
1
+ import { View } from 'react-native';
2
+ import type { IStepperProps } from './types';
3
+ export interface StepperRootProps extends IStepperProps {
4
+ readonly className?: string;
5
+ }
6
+ export declare const StepperRoot: import("react").ForwardRefExoticComponent<StepperRootProps & import("react").RefAttributes<View>>;
7
+ //# sourceMappingURL=StepperRoot.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"StepperRoot.d.ts","sourceRoot":"","sources":["../../../src/stepper/StepperRoot.tsx"],"names":[],"mappings":"AASA,OAAO,EAAY,IAAI,EAAE,MAAM,cAAc,CAAC;AAK9C,OAAO,KAAK,EAAE,aAAa,EAAoB,MAAM,SAAS,CAAC;AAE/D,MAAM,WAAW,gBAAiB,SAAQ,aAAa;IACrD,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;CAC7B;AA+CD,eAAO,MAAM,WAAW,mGAgFvB,CAAC"}
@@ -0,0 +1,7 @@
1
+ import { View } from 'react-native';
2
+ import type { IStepperStepProps } from './types';
3
+ export interface StepperStepProps extends IStepperStepProps {
4
+ readonly className?: string;
5
+ }
6
+ export declare const StepperStep: import("react").ForwardRefExoticComponent<StepperStepProps & import("react").RefAttributes<View>>;
7
+ //# sourceMappingURL=StepperStep.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"StepperStep.d.ts","sourceRoot":"","sources":["../../../src/stepper/StepperStep.tsx"],"names":[],"mappings":"AACA,OAAO,EAAY,IAAI,EAAE,MAAM,cAAc,CAAC;AAI9C,OAAO,KAAK,EAAE,iBAAiB,EAAoB,MAAM,SAAS,CAAC;AAEnE,MAAM,WAAW,gBAAiB,SAAQ,iBAAiB;IACzD,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;CAC7B;AAMD,eAAO,MAAM,WAAW,mGAmFvB,CAAC"}
@@ -0,0 +1,8 @@
1
+ import { type PressableProps } from 'react-native';
2
+ /**
3
+ * Press target for a clickable step: a `button` that is reachable with Tab and activates
4
+ * with Enter or Space. Rendered by `StepperStepTrigger` only while the step is clickable,
5
+ * so display-only steps add no focus stop and no interaction state.
6
+ */
7
+ export declare const StepperStepPressable: import("react").ForwardRefExoticComponent<PressableProps & import("react").RefAttributes<import("react-native").View>>;
8
+ //# sourceMappingURL=StepperStepPressable.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"StepperStepPressable.d.ts","sourceRoot":"","sources":["../../../src/stepper/StepperStepPressable.tsx"],"names":[],"mappings":"AACA,OAAO,EAAyC,KAAK,cAAc,EAAE,MAAM,cAAc,CAAC;AAO1F;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,wHAgChC,CAAC"}
@@ -0,0 +1,9 @@
1
+ import { View } from 'react-native';
2
+ /**
3
+ * Internal step region that carries the step's accessible name: the grouped visible
4
+ * content (indicator, title, description) followed by the state phrase. It becomes a
5
+ * `button` while the step is clickable. Not a public styled part; the styled
6
+ * `Stepper.Step` renders it around those slots.
7
+ */
8
+ export declare const StepperStepTrigger: import("react").ForwardRefExoticComponent<import("react-native").ViewProps & import("react").RefAttributes<View>>;
9
+ //# sourceMappingURL=StepperStepTrigger.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"StepperStepTrigger.d.ts","sourceRoot":"","sources":["../../../src/stepper/StepperStepTrigger.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAMpC;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB,mHAsB9B,CAAC"}
@@ -0,0 +1,9 @@
1
+ import { View } from 'react-native';
2
+ /**
3
+ * Internal step region that carries the step's accessible name. On web the state phrase
4
+ * is screen-reader-only text after the visible content, because browse-mode screen
5
+ * readers ignore `aria-label` on a list item. It becomes a `button` while the step is
6
+ * clickable. Not a public styled part.
7
+ */
8
+ export declare const StepperStepTrigger: import("react").ForwardRefExoticComponent<import("react-native").ViewProps & import("react").RefAttributes<View>>;
9
+ //# sourceMappingURL=StepperStepTrigger.web.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"StepperStepTrigger.web.d.ts","sourceRoot":"","sources":["../../../src/stepper/StepperStepTrigger.web.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAQpC;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB,mHAmD9B,CAAC"}
@@ -0,0 +1,16 @@
1
+ import type { StepperContextValue, StepperStepState } from './types';
2
+ export declare const StepperProvider: import("react").FunctionComponent<{
3
+ children: import("react").ReactNode;
4
+ value: StepperContextValue;
5
+ }>, useStepperContext: () => StepperContextValue;
6
+ /** Position of a direct child of `StepperRoot`, supplied by the root while it renders. */
7
+ export declare const StepperIndexProvider: import("react").FunctionComponent<{
8
+ children: import("react").ReactNode;
9
+ value: number;
10
+ }>, useStepperIndex: () => number;
11
+ /** Resolved state of the enclosing step. `useStepperStep` throws outside a `StepperStep`. */
12
+ export declare const StepperStepProvider: import("react").FunctionComponent<{
13
+ children: import("react").ReactNode;
14
+ value: StepperStepState;
15
+ }>, useStepperStep: () => StepperStepState;
16
+ //# sourceMappingURL=context.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../src/stepper/context.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAErE,eAAO,MAAO,eAAe;;;IAAE,iBAAiB,2BACM,CAAC;AAEvD,0FAA0F;AAC1F,eAAO,MAAO,oBAAoB;;;IAAE,eAAe,cAAyC,CAAC;AAE7F,6FAA6F;AAC7F,eAAO,MAAO,mBAAmB;;;IAAE,cAAc,wBAAkD,CAAC"}
@@ -0,0 +1,6 @@
1
+ export type { IStepperProps, IStepperStepProps, IStepperStepTriggerProps, InterfaceStepperProps, InterfaceStepperStepProps, StepperContextValue, StepperLabelPlacement, StepperOrientation, StepperStepState, } from './types';
2
+ export { useStepperContext, useStepperIndex, useStepperStep } from './context';
3
+ export { StepperRoot, type StepperRootProps } from './StepperRoot';
4
+ export { StepperStep, type StepperStepProps } from './StepperStep';
5
+ export { StepperStepTrigger } from './StepperStepTrigger';
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/stepper/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,aAAa,EACb,iBAAiB,EACjB,wBAAwB,EACxB,qBAAqB,EACrB,yBAAyB,EACzB,mBAAmB,EACnB,qBAAqB,EACrB,kBAAkB,EAClB,gBAAgB,GACjB,MAAM,SAAS,CAAC;AAEjB,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAC/E,OAAO,EAAE,WAAW,EAAE,KAAK,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACnE,OAAO,EAAE,WAAW,EAAE,KAAK,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACnE,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC"}
@@ -0,0 +1,96 @@
1
+ import type { ViewProps } from 'react-native';
2
+ export type StepperOrientation = 'horizontal' | 'vertical';
3
+ export type StepperLabelPlacement = 'end' | 'bottom';
4
+ export interface StepperStepState {
5
+ /** Zero-based position among the steps. */
6
+ readonly index: number;
7
+ /** Number of steps rendered. */
8
+ readonly count: number;
9
+ readonly isCurrent: boolean;
10
+ /** Resolved completion: the explicit `isComplete`, or `index < currentStep`. */
11
+ readonly isComplete: boolean;
12
+ /** Clamped to 0–100. Non-finite values are 0. */
13
+ readonly progress: number;
14
+ /** True when the partial ring is drawn: `0 < progress` and not complete. */
15
+ readonly hasProgress: boolean;
16
+ readonly isLast: boolean;
17
+ /** True when the step renders as a button. */
18
+ readonly isClickable: boolean;
19
+ readonly isDisabled: boolean;
20
+ readonly orientation: StepperOrientation;
21
+ readonly labelPlacement: StepperLabelPlacement;
22
+ }
23
+ export interface InterfaceStepperProps extends ViewProps {
24
+ /**
25
+ * Controlled, zero-based current step. A value outside `0…count-1` means no step is
26
+ * current; a value `>= count` makes every step complete by default.
27
+ */
28
+ readonly currentStep?: number;
29
+ /**
30
+ * Uncontrolled starting step. Ignored when `currentStep` is set.
31
+ * @default 0
32
+ */
33
+ readonly defaultStep?: number;
34
+ /** Called with the pressed step's index. Setting it makes eligible steps clickable. */
35
+ readonly onStepChange?: (index: number) => void;
36
+ /**
37
+ * When `true`, only complete steps are clickable. When `false`, every non-current,
38
+ * non-disabled step is.
39
+ * @default true
40
+ */
41
+ readonly isLinear?: boolean;
42
+ /**
43
+ * `'horizontal'` lays the steps out in a row. `labelPlacement` chooses where each label sits.
44
+ * @default 'vertical'
45
+ */
46
+ readonly orientation?: StepperOrientation;
47
+ /**
48
+ * Horizontal only; ignored when `orientation` is `'vertical'`. `'end'` puts each label after
49
+ * its indicator, sizes steps to their labels and stretches the separators between them.
50
+ * `'bottom'` gives every step an equal column with the indicator and label centered.
51
+ * @default 'end'
52
+ */
53
+ readonly labelPlacement?: StepperLabelPlacement;
54
+ /**
55
+ * Returns the state phrase appended to each step's title for assistive technology,
56
+ * replacing the English default (for example `"current step, 40% complete"`).
57
+ */
58
+ readonly getStepAccessibilityText?: (state: StepperStepState) => string;
59
+ /** @default false */
60
+ readonly asChild?: boolean;
61
+ }
62
+ export type IStepperProps = InterfaceStepperProps;
63
+ export interface InterfaceStepperStepProps extends ViewProps {
64
+ /**
65
+ * Whether the step is complete. An explicit value wins in both directions.
66
+ * @default index < currentStep
67
+ */
68
+ readonly isComplete?: boolean;
69
+ /**
70
+ * Partial progress, 0–100. Values outside the range are clamped; non-finite values are `0`.
71
+ * @default 0
72
+ */
73
+ readonly progress?: number;
74
+ /**
75
+ * Only affects clickability. A disabled step still shows its state.
76
+ * @default false
77
+ */
78
+ readonly isDisabled?: boolean;
79
+ /** @default false */
80
+ readonly asChild?: boolean;
81
+ }
82
+ export type IStepperStepProps = InterfaceStepperStepProps;
83
+ export type IStepperStepTriggerProps = ViewProps;
84
+ export interface StepperContextValue {
85
+ /** Resolved current step (controlled or uncontrolled). */
86
+ readonly currentStep: number;
87
+ readonly count: number;
88
+ readonly orientation: StepperOrientation;
89
+ readonly labelPlacement: StepperLabelPlacement;
90
+ readonly isLinear: boolean;
91
+ /** True when the consumer passed `onStepChange`. */
92
+ readonly hasStepChangeHandler: boolean;
93
+ readonly setCurrentStep: (index: number) => void;
94
+ readonly getStepAccessibilityText: (state: StepperStepState) => string;
95
+ }
96
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/stepper/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE9C,MAAM,MAAM,kBAAkB,GAAG,YAAY,GAAG,UAAU,CAAC;AAE3D,MAAM,MAAM,qBAAqB,GAAG,KAAK,GAAG,QAAQ,CAAC;AAErD,MAAM,WAAW,gBAAgB;IAC/B,2CAA2C;IAC3C,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,gCAAgC;IAChC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;IAC5B,gFAAgF;IAChF,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC;IAC7B,iDAAiD;IACjD,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,4EAA4E;IAC5E,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAC;IAC9B,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IACzB,8CAA8C;IAC9C,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAC;IAC9B,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC;IAC7B,QAAQ,CAAC,WAAW,EAAE,kBAAkB,CAAC;IACzC,QAAQ,CAAC,cAAc,EAAE,qBAAqB,CAAC;CAChD;AAED,MAAM,WAAW,qBAAsB,SAAQ,SAAS;IACtD;;;OAGG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B;;;OAGG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,uFAAuF;IACvF,QAAQ,CAAC,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAChD;;;;OAIG;IACH,QAAQ,CAAC,QAA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,KAAK,MAAM,CAAC;CACxE"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cdx-ui/primitives",
3
- "version": "0.3.5",
3
+ "version": "0.3.7",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
@@ -69,8 +69,8 @@
69
69
  "@react-stately/disclosure": "3.1.1",
70
70
  "@react-stately/radio": "3.12.0",
71
71
  "@react-stately/toggle": "3.9.4",
72
- "@cdx-ui/formatters": "0.3.5",
73
- "@cdx-ui/utils": "0.3.5"
72
+ "@cdx-ui/formatters": "0.3.7",
73
+ "@cdx-ui/utils": "0.3.7"
74
74
  },
75
75
  "devDependencies": {
76
76
  "@types/react": "19.2.14",
package/src/index.ts CHANGED
@@ -76,6 +76,7 @@ export * from './progress-bar';
76
76
  export * from './radio';
77
77
  export * from './accordion';
78
78
  export * from './slider';
79
+ export * from './stepper';
79
80
  export type { InteractionState } from './types';
80
81
  export { FormControlContext, useFormControlContext } from '@cdx-ui/utils';
81
82
  export { dataAttributes, mergeDataAttributes } from './utils/dataAttributes';