@spark-ui/components 10.19.3 → 10.20.1
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/dist/{InputTrailingIcon-CZD9hydv.d.ts → Input-N8AWWSmt.d.mts} +10 -14
- package/dist/{InputTrailingIcon-DzmwLGtX.d.mts → Input-N8AWWSmt.d.ts} +10 -14
- package/dist/InputTrailingIcon-BBp7sE6D.d.mts +20 -0
- package/dist/InputTrailingIcon-ZZx8PoJy.d.ts +20 -0
- package/dist/docgen.json +893 -263
- package/dist/input/index.d.mts +4 -3
- package/dist/input/index.d.ts +4 -3
- package/dist/stepper/index.d.mts +54 -51
- package/dist/stepper/index.d.ts +54 -51
- package/dist/stepper/index.js +1677 -119
- package/dist/stepper/index.js.map +1 -1
- package/dist/stepper/index.mjs +201 -144
- package/dist/stepper/index.mjs.map +1 -1
- package/dist/textarea/index.d.mts +2 -2
- package/dist/textarea/index.d.ts +2 -2
- package/package.json +7 -5
- package/dist/Input-g0LpWuv0.d.mts +0 -17
- package/dist/Input-g0LpWuv0.d.ts +0 -17
package/dist/stepper/index.mjs
CHANGED
|
@@ -1,173 +1,230 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Input,
|
|
3
|
+
InputGroup
|
|
4
|
+
} from "../chunk-VBX7BTNU.mjs";
|
|
5
|
+
import {
|
|
6
|
+
IconButton
|
|
7
|
+
} from "../chunk-XYK6V3JF.mjs";
|
|
1
8
|
import {
|
|
2
9
|
Icon
|
|
3
10
|
} from "../chunk-UMUMFMFB.mjs";
|
|
11
|
+
import "../chunk-HEKSVWYW.mjs";
|
|
12
|
+
import "../chunk-GAK4SC2F.mjs";
|
|
4
13
|
import "../chunk-KEGAAGJW.mjs";
|
|
5
|
-
import
|
|
6
|
-
Slot
|
|
7
|
-
} from "../chunk-6QCEPQ3U.mjs";
|
|
8
|
-
|
|
9
|
-
// src/stepper/Buttons.tsx
|
|
10
|
-
import { NumberField } from "@base-ui-components/react/number-field";
|
|
11
|
-
import { Minus } from "@spark-ui/icons/Minus";
|
|
12
|
-
import { Plus } from "@spark-ui/icons/Plus";
|
|
13
|
-
import { cva } from "class-variance-authority";
|
|
14
|
+
import "../chunk-6QCEPQ3U.mjs";
|
|
14
15
|
|
|
15
|
-
// src/stepper/
|
|
16
|
-
import {
|
|
17
|
-
|
|
18
|
-
const Component = asChild ? Slot : defaultTag;
|
|
19
|
-
return asChild ? ({ ...props }) => /* @__PURE__ */ jsx(Component, { ...props }) : void 0;
|
|
20
|
-
}
|
|
16
|
+
// src/stepper/Stepper.tsx
|
|
17
|
+
import { useFormFieldControl } from "@spark-ui/components/form-field";
|
|
18
|
+
import { createContext, useContext, useRef } from "react";
|
|
21
19
|
|
|
22
|
-
// src/stepper/
|
|
23
|
-
import {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
{
|
|
39
|
-
variants: {
|
|
40
|
-
placement: {
|
|
41
|
-
left: "rounded-l-lg",
|
|
42
|
-
right: "rounded-r-lg"
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
);
|
|
47
|
-
var Decrement = ({ children, className, asChild = false, ...props }) => {
|
|
48
|
-
const render = useRenderSlot(asChild, "div");
|
|
49
|
-
return /* @__PURE__ */ jsx2(
|
|
50
|
-
NumberField.Decrement,
|
|
20
|
+
// src/stepper/useStepper.ts
|
|
21
|
+
import { useNumberField } from "@react-aria/numberfield";
|
|
22
|
+
import { useNumberFieldState } from "@react-stately/numberfield";
|
|
23
|
+
var useStepper = ({
|
|
24
|
+
inputRef,
|
|
25
|
+
locale = "fr",
|
|
26
|
+
...rest
|
|
27
|
+
}) => {
|
|
28
|
+
const state = useNumberFieldState({
|
|
29
|
+
...rest,
|
|
30
|
+
isDisabled: rest.disabled,
|
|
31
|
+
isReadOnly: rest.readOnly,
|
|
32
|
+
isRequired: rest.required,
|
|
33
|
+
locale
|
|
34
|
+
});
|
|
35
|
+
const { groupProps, inputProps, incrementButtonProps, decrementButtonProps } = useNumberField(
|
|
51
36
|
{
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
}
|
|
37
|
+
isWheelDisabled: false,
|
|
38
|
+
...rest,
|
|
39
|
+
isDisabled: rest.disabled,
|
|
40
|
+
isReadOnly: rest.readOnly,
|
|
41
|
+
isRequired: rest.required
|
|
42
|
+
},
|
|
43
|
+
state,
|
|
44
|
+
inputRef
|
|
61
45
|
);
|
|
46
|
+
return {
|
|
47
|
+
groupProps,
|
|
48
|
+
inputProps,
|
|
49
|
+
incrementButtonProps,
|
|
50
|
+
decrementButtonProps
|
|
51
|
+
};
|
|
62
52
|
};
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
53
|
+
|
|
54
|
+
// src/stepper/Stepper.tsx
|
|
55
|
+
import { jsx } from "react/jsx-runtime";
|
|
56
|
+
var StepperContext = createContext(null);
|
|
57
|
+
var Stepper = ({
|
|
58
|
+
children,
|
|
59
|
+
formatOptions,
|
|
60
|
+
minValue,
|
|
61
|
+
maxValue,
|
|
62
|
+
ref: forwardedRef,
|
|
63
|
+
...stepperProps
|
|
64
|
+
}) => {
|
|
65
|
+
const inputRef = useRef(null);
|
|
66
|
+
const {
|
|
67
|
+
groupProps,
|
|
68
|
+
inputProps: _inputProps,
|
|
69
|
+
incrementButtonProps: _incrementButtonProps,
|
|
70
|
+
decrementButtonProps: _decrementButtonProps
|
|
71
|
+
} = useStepper({
|
|
72
|
+
...{
|
|
73
|
+
...stepperProps,
|
|
74
|
+
/**
|
|
75
|
+
* To enable the possibility to init the stepper with empty (undefined) value,
|
|
76
|
+
* we need to force the empty value to NaN.
|
|
77
|
+
* Cf. https://github.com/adobe/react-spectrum/issues/5524
|
|
78
|
+
*/
|
|
79
|
+
..."value" in stepperProps && { value: stepperProps.value ?? NaN },
|
|
80
|
+
onChange: stepperProps.onValueChange
|
|
81
|
+
},
|
|
82
|
+
formatOptions,
|
|
83
|
+
minValue,
|
|
84
|
+
maxValue,
|
|
85
|
+
inputRef
|
|
86
|
+
});
|
|
87
|
+
const formFieldControlProps = useFormFieldControl();
|
|
88
|
+
const isWrappedInFormField = !!formFieldControlProps.id;
|
|
89
|
+
const incrementButtonProps = {
|
|
90
|
+
..._incrementButtonProps,
|
|
91
|
+
...isWrappedInFormField && { "aria-controls": formFieldControlProps.id }
|
|
92
|
+
};
|
|
93
|
+
const decrementButtonProps = {
|
|
94
|
+
..._decrementButtonProps,
|
|
95
|
+
...isWrappedInFormField && { "aria-controls": formFieldControlProps.id }
|
|
96
|
+
};
|
|
97
|
+
const inputProps = {
|
|
98
|
+
..._inputProps,
|
|
99
|
+
...isWrappedInFormField && {
|
|
100
|
+
id: formFieldControlProps.id,
|
|
101
|
+
required: formFieldControlProps.isRequired,
|
|
102
|
+
"aria-invalid": formFieldControlProps.isInvalid ? true : void 0
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
const { onValueChange: _, ...remainingStepperProps } = stepperProps;
|
|
106
|
+
return /* @__PURE__ */ jsx(
|
|
107
|
+
StepperContext.Provider,
|
|
67
108
|
{
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
109
|
+
value: { incrementButtonProps, decrementButtonProps, inputProps, inputRef },
|
|
110
|
+
children: /* @__PURE__ */ jsx(
|
|
111
|
+
InputGroup,
|
|
112
|
+
{
|
|
113
|
+
...remainingStepperProps,
|
|
114
|
+
...groupProps,
|
|
115
|
+
"data-spark-component": "stepper",
|
|
116
|
+
ref: forwardedRef,
|
|
117
|
+
children
|
|
118
|
+
}
|
|
119
|
+
)
|
|
76
120
|
}
|
|
77
121
|
);
|
|
78
122
|
};
|
|
79
|
-
|
|
80
|
-
|
|
123
|
+
Stepper.displayName = "Stepper";
|
|
124
|
+
var useStepperContext = () => {
|
|
125
|
+
const context = useContext(StepperContext);
|
|
126
|
+
if (!context) {
|
|
127
|
+
throw Error("useStepperContext must be used within a Stepper provider");
|
|
128
|
+
}
|
|
129
|
+
return context;
|
|
130
|
+
};
|
|
81
131
|
|
|
82
|
-
// src/stepper/
|
|
83
|
-
import {
|
|
84
|
-
import {
|
|
85
|
-
import {
|
|
86
|
-
import {
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
132
|
+
// src/stepper/StepperButton.tsx
|
|
133
|
+
import { useButton } from "@react-aria/button";
|
|
134
|
+
import { Minus } from "@spark-ui/icons/Minus";
|
|
135
|
+
import { Plus } from "@spark-ui/icons/Plus";
|
|
136
|
+
import { useRef as useRef2 } from "react";
|
|
137
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
138
|
+
var IncrementButton = ({
|
|
139
|
+
children,
|
|
140
|
+
design = "ghost",
|
|
141
|
+
intent = "neutral",
|
|
142
|
+
className,
|
|
143
|
+
ref: forwardedRef,
|
|
144
|
+
...rest
|
|
145
|
+
}) => {
|
|
146
|
+
const innerRef = useRef2(null);
|
|
147
|
+
const ref = forwardedRef && typeof forwardedRef !== "function" ? forwardedRef : innerRef;
|
|
148
|
+
const { incrementButtonProps } = useStepperContext();
|
|
149
|
+
const { buttonProps } = useButton({ ...incrementButtonProps, ...rest }, ref);
|
|
150
|
+
return /* @__PURE__ */ jsx2(InputGroup.TrailingAddon, { asChild: true, "data-spark-component": "stepper-increment-button", children: /* @__PURE__ */ jsx2(
|
|
151
|
+
IconButton,
|
|
91
152
|
{
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
"group-data-[field-state=alert]:border-alert",
|
|
101
|
-
"group-data-[field-state=success]:border-success",
|
|
102
|
-
"",
|
|
103
|
-
// Disabled and ReadOnly styles
|
|
104
|
-
"data-[disabled]:bg-on-surface/dim-5 data-[disabled]:text-on-surface/dim-3 data-[disabled]:cursor-not-allowed",
|
|
105
|
-
"data-[readonly]:bg-on-surface/dim-5",
|
|
106
|
-
// Focus styles
|
|
107
|
-
"focus:outline-outline-high focus:z-raised focus:outline-2 focus:-outline-offset-1",
|
|
108
|
-
className
|
|
109
|
-
),
|
|
110
|
-
...field.description && { "aria-describedby": field.description },
|
|
111
|
-
...field.isRequired && { required: true },
|
|
112
|
-
...field.state === "error" && { "aria-invalid": true },
|
|
113
|
-
...props
|
|
153
|
+
ref,
|
|
154
|
+
design,
|
|
155
|
+
intent,
|
|
156
|
+
className,
|
|
157
|
+
"aria-label": buttonProps["aria-label"],
|
|
158
|
+
...buttonProps,
|
|
159
|
+
disabled: rest.disabled || buttonProps.disabled,
|
|
160
|
+
children: children || /* @__PURE__ */ jsx2(Icon, { children: /* @__PURE__ */ jsx2(Plus, {}) })
|
|
114
161
|
}
|
|
115
|
-
);
|
|
162
|
+
) });
|
|
116
163
|
};
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
// src/stepper/Root.tsx
|
|
120
|
-
import { NumberField as NumberField3 } from "@base-ui-components/react/number-field";
|
|
121
|
-
import { useFormFieldControl as useFormFieldControl2 } from "@spark-ui/components/form-field";
|
|
122
|
-
import { cx as cx2 } from "class-variance-authority";
|
|
123
|
-
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
124
|
-
var Root = ({
|
|
164
|
+
var DecrementButton = ({
|
|
125
165
|
children,
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
minValue,
|
|
129
|
-
maxValue,
|
|
130
|
-
formatOptions,
|
|
131
|
-
step: stepProp,
|
|
166
|
+
design = "ghost",
|
|
167
|
+
intent = "neutral",
|
|
132
168
|
className,
|
|
133
|
-
|
|
169
|
+
ref: forwardedRef,
|
|
170
|
+
...rest
|
|
134
171
|
}) => {
|
|
135
|
-
const
|
|
136
|
-
const
|
|
137
|
-
const
|
|
138
|
-
const
|
|
139
|
-
return /* @__PURE__ */
|
|
140
|
-
|
|
172
|
+
const innerRef = useRef2(null);
|
|
173
|
+
const ref = forwardedRef && typeof forwardedRef !== "function" ? forwardedRef : innerRef;
|
|
174
|
+
const { decrementButtonProps } = useStepperContext();
|
|
175
|
+
const { buttonProps } = useButton({ ...decrementButtonProps, ...rest }, ref);
|
|
176
|
+
return /* @__PURE__ */ jsx2(InputGroup.LeadingAddon, { asChild: true, "data-spark-component": "stepper-decrement-button", children: /* @__PURE__ */ jsx2(
|
|
177
|
+
IconButton,
|
|
141
178
|
{
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
179
|
+
ref,
|
|
180
|
+
design,
|
|
181
|
+
intent,
|
|
182
|
+
className,
|
|
183
|
+
"aria-label": buttonProps["aria-label"],
|
|
184
|
+
...buttonProps,
|
|
185
|
+
disabled: rest.disabled || buttonProps.disabled,
|
|
186
|
+
children: children || /* @__PURE__ */ jsx2(Icon, { children: /* @__PURE__ */ jsx2(Minus, {}) })
|
|
187
|
+
}
|
|
188
|
+
) });
|
|
189
|
+
};
|
|
190
|
+
var StepperIncrementButton = Object.assign(IncrementButton, {
|
|
191
|
+
id: "TrailingAddon"
|
|
192
|
+
});
|
|
193
|
+
var StepperDecrementButton = Object.assign(DecrementButton, {
|
|
194
|
+
id: "LeadingAddon"
|
|
195
|
+
});
|
|
196
|
+
IncrementButton.displayName = "Stepper.DecrementButton";
|
|
197
|
+
DecrementButton.displayName = "Stepper.DecrementButton";
|
|
198
|
+
|
|
199
|
+
// src/stepper/StepperInput.tsx
|
|
200
|
+
import { useMergeRefs } from "@spark-ui/hooks/use-merge-refs";
|
|
201
|
+
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
202
|
+
var Input2 = ({ ref: forwardedRef, ...props }) => {
|
|
203
|
+
const { inputRef, inputProps } = useStepperContext();
|
|
204
|
+
const ref = useMergeRefs(forwardedRef, inputRef);
|
|
205
|
+
const { className = "", ...remainingProps } = props;
|
|
206
|
+
return /* @__PURE__ */ jsx3(
|
|
207
|
+
Input,
|
|
208
|
+
{
|
|
209
|
+
ref,
|
|
210
|
+
...remainingProps,
|
|
211
|
+
...inputProps,
|
|
212
|
+
className: `min-w-sz-56 text-center ${className}`
|
|
159
213
|
}
|
|
160
214
|
);
|
|
161
215
|
};
|
|
162
|
-
|
|
216
|
+
var StepperInput = Object.assign(Input2, {
|
|
217
|
+
id: "Input"
|
|
218
|
+
});
|
|
219
|
+
Input2.displayName = "Stepper.Input";
|
|
163
220
|
|
|
164
221
|
// src/stepper/index.ts
|
|
165
|
-
var
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
222
|
+
var Stepper2 = Object.assign(Stepper, { IncrementButton: StepperIncrementButton, DecrementButton: StepperDecrementButton, Input: StepperInput });
|
|
223
|
+
Stepper2.displayName = "Stepper";
|
|
224
|
+
StepperIncrementButton.displayName = "Stepper.IncrementButton";
|
|
225
|
+
StepperDecrementButton.displayName = "Stepper.DecrementButton";
|
|
226
|
+
StepperInput.displayName = "Stepper.Input";
|
|
170
227
|
export {
|
|
171
|
-
Stepper
|
|
228
|
+
Stepper2 as Stepper
|
|
172
229
|
};
|
|
173
230
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/stepper/Buttons.tsx","../../src/stepper/useRenderSlot.tsx","../../src/stepper/Input.tsx","../../src/stepper/Root.tsx","../../src/stepper/index.ts"],"sourcesContent":["import { NumberField } from '@base-ui-components/react/number-field'\nimport { Minus } from '@spark-ui/icons/Minus'\nimport { Plus } from '@spark-ui/icons/Plus'\nimport { cva } from 'class-variance-authority'\nimport { ComponentProps, ReactNode } from 'react'\n\nimport { Icon } from '../icon'\nimport { useRenderSlot } from './useRenderSlot'\n\nconst styles = cva(\n [\n // Base styles\n 'border-outline border-sm min-w-sz-44 text-on-surface flex cursor-pointer items-center justify-center bg-clip-padding select-none',\n 'hover:bg-neutral/dim-5',\n // Disabled and ReadOnly styles\n 'disabled:bg-on-surface/dim-5 disabled:text-on-surface/dim-3 disabled:cursor-not-allowed',\n 'data-[disabled]:bg-on-surface/dim-5 data-[disabled]:text-on-surface/dim-3 data-[disabled]:cursor-not-allowed',\n 'data-[readonly]:bg-on-surface/dim-5 data-[readonly]:text-on-surface/dim-3 data-[readonly]:cursor-not-allowed',\n // State styles\n 'group-data-[field-state=error]:border-error',\n 'group-data-[field-state=alert]:border-alert',\n 'group-data-[field-state=success]:border-success',\n ],\n {\n variants: {\n placement: {\n left: 'rounded-l-lg',\n right: 'rounded-r-lg',\n },\n },\n }\n)\n\ninterface DecrementProps extends Omit<ComponentProps<typeof NumberField.Decrement>, 'render'> {\n children?: ReactNode\n asChild?: boolean\n}\n\ninterface IncrementProps extends Omit<ComponentProps<typeof NumberField.Increment>, 'render'> {\n children?: ReactNode\n asChild?: boolean\n}\n\nexport const Decrement = ({ children, className, asChild = false, ...props }: DecrementProps) => {\n const render = useRenderSlot(asChild, 'div')\n\n return (\n <NumberField.Decrement\n data-spark-component=\"stepper-decrement-button\"\n className={styles({\n placement: 'left',\n className,\n })}\n render={render}\n {...props}\n >\n {children || (\n <Icon>\n <Minus />\n </Icon>\n )}\n </NumberField.Decrement>\n )\n}\n\nexport const Increment = ({ children, className, asChild = false, ...props }: IncrementProps) => {\n const render = useRenderSlot(asChild, 'div')\n\n return (\n <NumberField.Increment\n data-spark-component=\"stepper-increment-button\"\n className={styles({\n placement: 'right',\n className,\n })}\n render={render}\n {...props}\n >\n {children || (\n <Icon>\n <Plus />\n </Icon>\n )}\n </NumberField.Increment>\n )\n}\n\nDecrement.displayName = 'Stepper.DecrementButton'\nIncrement.displayName = 'Stepper.IncrementButton'\n","import { Slot } from '../slot'\n\nexport function useRenderSlot(asChild: boolean, defaultTag: string) {\n const Component = asChild ? Slot : defaultTag\n\n return asChild ? ({ ...props }) => <Component {...props} /> : undefined\n}\n","import { NumberField } from '@base-ui-components/react/number-field'\nimport { useFormFieldControl } from '@spark-ui/components/form-field'\nimport { cx } from 'class-variance-authority'\nimport { ComponentProps, ReactNode } from 'react'\n\ninterface Props extends Omit<ComponentProps<typeof NumberField.Input>, 'render'> {\n children?: ReactNode\n}\n\nexport const Input = ({ className, ...props }: Props) => {\n const field = useFormFieldControl()\n\n return (\n <NumberField.Input\n data-spark-component=\"stepper-input\"\n className={cx(\n // Base styles\n 'bg-surface text-on-surface px-lg h-sz-44 border-y-sm border-outline relative inline-flex w-full text-center',\n 'first:border-l-sm first:rounded-l-lg',\n 'last:border-r-sm last:rounded-r-lg',\n // State styles\n 'group-data-[field-state=error]:border-error',\n 'group-data-[field-state=alert]:border-alert',\n 'group-data-[field-state=success]:border-success',\n '',\n // Disabled and ReadOnly styles\n 'data-[disabled]:bg-on-surface/dim-5 data-[disabled]:text-on-surface/dim-3 data-[disabled]:cursor-not-allowed',\n 'data-[readonly]:bg-on-surface/dim-5',\n // Focus styles\n 'focus:outline-outline-high focus:z-raised focus:outline-2 focus:-outline-offset-1',\n className\n )}\n {...(field.description && { 'aria-describedby': field.description })}\n {...(field.isRequired && { required: true })}\n {...(field.state === 'error' && { 'aria-invalid': true })}\n {...props}\n />\n )\n}\n\nInput.displayName = 'Stepper.InputButton'\n","import { NumberField } from '@base-ui-components/react/number-field'\nimport { useFormFieldControl } from '@spark-ui/components/form-field'\nimport { cx } from 'class-variance-authority'\n\nimport { StepperProps } from './types'\nimport { useRenderSlot } from './useRenderSlot'\n\nexport const Root = ({\n children,\n allowWheelScrub = true,\n state: stateProp,\n minValue,\n maxValue,\n formatOptions,\n step: stepProp,\n className,\n ...props\n}: StepperProps) => {\n const render = useRenderSlot(true, 'div')\n\n const field = useFormFieldControl()\n const state = field.state ?? stateProp\n\n /**\n * By default, a percent format will increment in steps of 1 (100% on each increment)\n */\n const step = stepProp == null && formatOptions?.style === 'percent' ? 0.01 : stepProp\n\n return (\n <NumberField.Root\n data-spark-component=\"stepper\"\n allowWheelScrub={allowWheelScrub}\n render={render}\n min={minValue}\n max={maxValue}\n format={formatOptions}\n step={step}\n {...(field.id && { id: field.id })}\n {...props}\n >\n <NumberField.Group\n className={cx('group relative inline-flex w-full', className)}\n data-field-state={state}\n >\n {children}\n </NumberField.Group>\n </NumberField.Root>\n )\n}\n\nRoot.displayName = 'Stepper'\n","import { Decrement as DecrementButton, Increment as IncrementButton } from './Buttons'\nimport { Input } from './Input'\nimport { Root } from './Root'\n\nexport const Stepper: typeof Root & {\n IncrementButton: typeof IncrementButton\n DecrementButton: typeof DecrementButton\n Input: typeof Input\n} = Object.assign(Root, { IncrementButton, DecrementButton, Input })\n\nStepper.displayName = 'Stepper'\nIncrementButton.displayName = 'Stepper.IncrementButton'\nDecrementButton.displayName = 'Stepper.DecrementButton'\nInput.displayName = 'Stepper.Input'\n\nexport type { StepperProps, StepperButtonProps, StepperInputProps } from './types'\n"],"mappings":";;;;;;;;;AAAA,SAAS,mBAAmB;AAC5B,SAAS,aAAa;AACtB,SAAS,YAAY;AACrB,SAAS,WAAW;;;ACEiB;AAH9B,SAAS,cAAc,SAAkB,YAAoB;AAClE,QAAM,YAAY,UAAU,OAAO;AAEnC,SAAO,UAAU,CAAC,EAAE,GAAG,MAAM,MAAM,oBAAC,aAAW,GAAG,OAAO,IAAK;AAChE;;;ADoDU,gBAAAA,YAAA;AAjDV,IAAM,SAAS;AAAA,EACb;AAAA;AAAA,IAEE;AAAA,IACA;AAAA;AAAA,IAEA;AAAA,IACA;AAAA,IACA;AAAA;AAAA,IAEA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAAA,EACA;AAAA,IACE,UAAU;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AgB,cAAc;AAC9B,MAAM,cAAc;","names":["jsx","NumberField","jsx","NumberField","useFormFieldControl","cx","jsx","useFormFieldControl","NumberField","cx"]}
|
|
1
|
+
{"version":3,"sources":["../../src/stepper/Stepper.tsx","../../src/stepper/useStepper.ts","../../src/stepper/StepperButton.tsx","../../src/stepper/StepperInput.tsx","../../src/stepper/index.ts"],"sourcesContent":["import { useFormFieldControl } from '@spark-ui/components/form-field'\nimport { createContext, type PropsWithChildren, RefObject, useContext, useRef } from 'react'\n\nimport { InputGroup } from '../input'\nimport type { StepperProps, UseStepperReturn } from './types'\nimport { useStepper } from './useStepper'\n\nconst StepperContext = createContext<\n (Omit<UseStepperReturn, 'groupProps'> & { inputRef: RefObject<HTMLInputElement | null> }) | null\n>(null)\n\nexport const Stepper = ({\n children,\n formatOptions,\n minValue,\n maxValue,\n ref: forwardedRef,\n ...stepperProps\n}: PropsWithChildren<StepperProps>) => {\n const inputRef = useRef<HTMLInputElement>(null)\n\n const {\n groupProps,\n inputProps: _inputProps,\n incrementButtonProps: _incrementButtonProps,\n decrementButtonProps: _decrementButtonProps,\n } = useStepper({\n ...{\n ...stepperProps,\n /**\n * To enable the possibility to init the stepper with empty (undefined) value,\n * we need to force the empty value to NaN.\n * Cf. https://github.com/adobe/react-spectrum/issues/5524\n */\n ...('value' in stepperProps && { value: stepperProps.value ?? NaN }),\n onChange: stepperProps.onValueChange,\n },\n formatOptions,\n minValue,\n maxValue,\n inputRef,\n })\n\n const formFieldControlProps = useFormFieldControl()\n const isWrappedInFormField = !!formFieldControlProps.id\n\n const incrementButtonProps = {\n ..._incrementButtonProps,\n ...(isWrappedInFormField && { 'aria-controls': formFieldControlProps.id }),\n }\n\n const decrementButtonProps = {\n ..._decrementButtonProps,\n ...(isWrappedInFormField && { 'aria-controls': formFieldControlProps.id }),\n }\n\n const inputProps = {\n ..._inputProps,\n ...(isWrappedInFormField && {\n id: formFieldControlProps.id,\n required: formFieldControlProps.isRequired,\n 'aria-invalid': formFieldControlProps.isInvalid ? true : undefined,\n }),\n }\n\n const { onValueChange: _, ...remainingStepperProps } = stepperProps\n\n return (\n <StepperContext.Provider\n value={{ incrementButtonProps, decrementButtonProps, inputProps, inputRef }}\n >\n <InputGroup\n {...remainingStepperProps}\n {...groupProps}\n data-spark-component=\"stepper\"\n ref={forwardedRef}\n >\n {children}\n </InputGroup>\n </StepperContext.Provider>\n )\n}\n\nStepper.displayName = 'Stepper'\n\nexport const useStepperContext = () => {\n const context = useContext(StepperContext)\n\n if (!context) {\n throw Error('useStepperContext must be used within a Stepper provider')\n }\n\n return context\n}\n","import { useNumberField } from '@react-aria/numberfield'\nimport { useNumberFieldState } from '@react-stately/numberfield'\n\nimport type { UseStepperArgs, UseStepperReturn } from './types'\n\nexport const useStepper = ({\n inputRef,\n locale = 'fr',\n ...rest\n}: UseStepperArgs): UseStepperReturn => {\n const state = useNumberFieldState({\n ...rest,\n isDisabled: rest.disabled,\n isReadOnly: rest.readOnly,\n isRequired: rest.required,\n locale,\n })\n\n const { groupProps, inputProps, incrementButtonProps, decrementButtonProps } = useNumberField(\n {\n isWheelDisabled: false,\n ...rest,\n isDisabled: rest.disabled,\n isReadOnly: rest.readOnly,\n isRequired: rest.required,\n },\n state,\n inputRef\n )\n\n return {\n groupProps,\n inputProps,\n incrementButtonProps,\n decrementButtonProps,\n }\n}\n","import { useButton } from '@react-aria/button'\nimport { Minus } from '@spark-ui/icons/Minus'\nimport { Plus } from '@spark-ui/icons/Plus'\nimport { type PropsWithChildren, useRef } from 'react'\n\nimport { Icon } from '../icon'\nimport { IconButton } from '../icon-button'\nimport { InputGroup } from '../input'\nimport { useStepperContext } from './Stepper'\nimport type { StepperButtonProps } from './types'\n\nconst IncrementButton = ({\n children,\n design = 'ghost',\n intent = 'neutral',\n className,\n ref: forwardedRef,\n ...rest\n}: PropsWithChildren<StepperButtonProps>) => {\n const innerRef = useRef<HTMLButtonElement>(null)\n const ref = forwardedRef && typeof forwardedRef !== 'function' ? forwardedRef : innerRef\n\n const { incrementButtonProps } = useStepperContext()\n const { buttonProps } = useButton({ ...incrementButtonProps, ...rest }, ref)\n\n return (\n <InputGroup.TrailingAddon asChild data-spark-component=\"stepper-increment-button\">\n <IconButton\n ref={ref}\n design={design}\n intent={intent}\n className={className}\n aria-label={buttonProps['aria-label'] as string}\n {...buttonProps}\n disabled={rest.disabled || buttonProps.disabled}\n >\n {children || (\n <Icon>\n <Plus />\n </Icon>\n )}\n </IconButton>\n </InputGroup.TrailingAddon>\n )\n}\n\nconst DecrementButton = ({\n children,\n design = 'ghost',\n intent = 'neutral',\n className,\n ref: forwardedRef,\n ...rest\n}: PropsWithChildren<StepperButtonProps>) => {\n const innerRef = useRef<HTMLButtonElement>(null)\n const ref = forwardedRef && typeof forwardedRef !== 'function' ? forwardedRef : innerRef\n\n const { decrementButtonProps } = useStepperContext()\n const { buttonProps } = useButton({ ...decrementButtonProps, ...rest }, ref)\n\n return (\n <InputGroup.LeadingAddon asChild data-spark-component=\"stepper-decrement-button\">\n <IconButton\n ref={ref}\n design={design}\n intent={intent}\n className={className}\n aria-label={buttonProps['aria-label'] as string}\n {...buttonProps}\n disabled={rest.disabled || buttonProps.disabled}\n >\n {children || (\n <Icon>\n <Minus />\n </Icon>\n )}\n </IconButton>\n </InputGroup.LeadingAddon>\n )\n}\n\nexport const StepperIncrementButton = Object.assign(IncrementButton, {\n id: 'TrailingAddon',\n})\n\nexport const StepperDecrementButton = Object.assign(DecrementButton, {\n id: 'LeadingAddon',\n})\n\nIncrementButton.displayName = 'Stepper.DecrementButton'\nDecrementButton.displayName = 'Stepper.DecrementButton'\n","import { useMergeRefs } from '@spark-ui/hooks/use-merge-refs'\n\nimport { Input as SparkInput } from '../input'\nimport { useStepperContext } from './Stepper'\nimport type { StepperInputProps } from './types'\n\nconst Input = ({ ref: forwardedRef, ...props }: StepperInputProps) => {\n const { inputRef, inputProps } = useStepperContext()\n const ref = useMergeRefs(forwardedRef, inputRef)\n const { className = '', ...remainingProps } = props\n\n return (\n <SparkInput\n ref={ref}\n {...remainingProps}\n {...inputProps}\n className={`min-w-sz-56 text-center ${className}`}\n />\n )\n}\n\nexport const StepperInput = Object.assign(Input, {\n id: 'Input',\n})\n\nInput.displayName = 'Stepper.Input'\n","import { Stepper as Root } from './Stepper'\nimport {\n StepperDecrementButton as DecrementButton,\n StepperIncrementButton as IncrementButton,\n} from './StepperButton'\nimport { StepperInput as Input } from './StepperInput'\n\nexport const Stepper: typeof Root & {\n IncrementButton: typeof IncrementButton\n DecrementButton: typeof DecrementButton\n Input: typeof Input\n} = Object.assign(Root, { IncrementButton, DecrementButton, Input })\n\nStepper.displayName = 'Stepper'\nIncrementButton.displayName = 'Stepper.IncrementButton'\nDecrementButton.displayName = 'Stepper.DecrementButton'\nInput.displayName = 'Stepper.Input'\n\nexport type { StepperProps, StepperButtonProps, StepperInputProps } from './types'\n"],"mappings":";;;;;;;;;;;;;;;;AAAA,SAAS,2BAA2B;AACpC,SAAS,eAAkD,YAAY,cAAc;;;ACDrF,SAAS,sBAAsB;AAC/B,SAAS,2BAA2B;AAI7B,IAAM,aAAa,CAAC;AAAA,EACzB;AAAA,EACA,SAAS;AAAA,EACT,GAAG;AACL,MAAwC;AACtC,QAAM,QAAQ,oBAAoB;AAAA,IAChC,GAAG;AAAA,IACH,YAAY,KAAK;AAAA,IACjB,YAAY,KAAK;AAAA,IACjB,YAAY,KAAK;AAAA,IACjB;AAAA,EACF,CAAC;AAED,QAAM,EAAE,YAAY,YAAY,sBAAsB,qBAAqB,IAAI;AAAA,IAC7E;AAAA,MACE,iBAAiB;AAAA,MACjB,GAAG;AAAA,MACH,YAAY,KAAK;AAAA,MACjB,YAAY,KAAK;AAAA,MACjB,YAAY,KAAK;AAAA,IACnB;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAEA,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;;;ADmCM;AAhEN,IAAM,iBAAiB,cAErB,IAAI;AAEC,IAAM,UAA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1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import { ComponentPropsWithoutRef, Ref, PropsWithChildren } from 'react';
|
|
3
|
-
import { I as InputGroupProps, a as
|
|
4
|
-
import { I as
|
|
3
|
+
import { I as InputGroupProps, a as InputProps } from '../Input-N8AWWSmt.mjs';
|
|
4
|
+
import { I as InputLeadingIconProps, a as InputTrailingIconProps } from '../InputTrailingIcon-BBp7sE6D.mjs';
|
|
5
5
|
import 'class-variance-authority/types';
|
|
6
6
|
import 'class-variance-authority';
|
|
7
7
|
import '../icon/index.mjs';
|
package/dist/textarea/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import { ComponentPropsWithoutRef, Ref, PropsWithChildren } from 'react';
|
|
3
|
-
import { I as InputGroupProps, a as
|
|
4
|
-
import { I as
|
|
3
|
+
import { I as InputGroupProps, a as InputProps } from '../Input-N8AWWSmt.js';
|
|
4
|
+
import { I as InputLeadingIconProps, a as InputTrailingIconProps } from '../InputTrailingIcon-ZZx8PoJy.js';
|
|
5
5
|
import 'class-variance-authority/types';
|
|
6
6
|
import 'class-variance-authority';
|
|
7
7
|
import '../icon/index.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spark-ui/components",
|
|
3
|
-
"version": "10.
|
|
3
|
+
"version": "10.20.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "Spark (Leboncoin design system) components.",
|
|
6
6
|
"exports": {
|
|
@@ -49,11 +49,13 @@
|
|
|
49
49
|
"dependencies": {
|
|
50
50
|
"@base-ui-components/react": "^1.0.0-beta.3",
|
|
51
51
|
"@react-aria/button": "3.13.0",
|
|
52
|
+
"@react-aria/numberfield": "3.11.13",
|
|
52
53
|
"@react-aria/toast": "^3.0.0-beta.18",
|
|
54
|
+
"@react-stately/numberfield": "3.9.11",
|
|
53
55
|
"@react-stately/toast": "^3.0.0-beta.7",
|
|
54
|
-
"@spark-ui/hooks": "^10.
|
|
55
|
-
"@spark-ui/icons": "^10.
|
|
56
|
-
"@spark-ui/internal-utils": "^10.
|
|
56
|
+
"@spark-ui/hooks": "^10.20.1",
|
|
57
|
+
"@spark-ui/icons": "^10.20.1",
|
|
58
|
+
"@spark-ui/internal-utils": "^10.20.1",
|
|
57
59
|
"@zag-js/pagination": "1.25.0",
|
|
58
60
|
"@zag-js/react": "1.25.0",
|
|
59
61
|
"class-variance-authority": "0.7.1",
|
|
@@ -80,5 +82,5 @@
|
|
|
80
82
|
"url": "https://github.com/leboncoin/spark-web/issues?q=is%3Aopen+label%3A%22Component%3A+button%22"
|
|
81
83
|
},
|
|
82
84
|
"homepage": "https://sparkui.vercel.app",
|
|
83
|
-
"gitHead": "
|
|
85
|
+
"gitHead": "1549682ce3eeea71e559d56e059655c7b5be777c"
|
|
84
86
|
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { ComponentPropsWithoutRef, Ref } from 'react';
|
|
3
|
-
|
|
4
|
-
type InputPrimitiveProps = ComponentPropsWithoutRef<'input'>;
|
|
5
|
-
interface InputProps extends InputPrimitiveProps {
|
|
6
|
-
asChild?: boolean;
|
|
7
|
-
onValueChange?: (value: string) => void;
|
|
8
|
-
ref?: Ref<HTMLInputElement>;
|
|
9
|
-
}
|
|
10
|
-
declare const Input: {
|
|
11
|
-
({ className, asChild, onValueChange, onChange, onKeyDown, disabled: disabledProp, readOnly: readOnlyProp, ref, ...others }: InputProps): react_jsx_runtime.JSX.Element;
|
|
12
|
-
displayName: string;
|
|
13
|
-
} & {
|
|
14
|
-
id: string;
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
export { type InputProps as I, Input as a };
|
package/dist/Input-g0LpWuv0.d.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { ComponentPropsWithoutRef, Ref } from 'react';
|
|
3
|
-
|
|
4
|
-
type InputPrimitiveProps = ComponentPropsWithoutRef<'input'>;
|
|
5
|
-
interface InputProps extends InputPrimitiveProps {
|
|
6
|
-
asChild?: boolean;
|
|
7
|
-
onValueChange?: (value: string) => void;
|
|
8
|
-
ref?: Ref<HTMLInputElement>;
|
|
9
|
-
}
|
|
10
|
-
declare const Input: {
|
|
11
|
-
({ className, asChild, onValueChange, onChange, onKeyDown, disabled: disabledProp, readOnly: readOnlyProp, ref, ...others }: InputProps): react_jsx_runtime.JSX.Element;
|
|
12
|
-
displayName: string;
|
|
13
|
-
} & {
|
|
14
|
-
id: string;
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
export { type InputProps as I, Input as a };
|