@spark-ui/components 10.19.3 → 10.20.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,10 +1,11 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import { ComponentPropsWithoutRef, Ref } from 'react';
3
- import { c as InputGroup$1, d as InputLeadingIcon, e as InputTrailingIcon } from '../InputTrailingIcon-DzmwLGtX.mjs';
4
- export { I as InputGroupProps, a as InputLeadingIconProps, b as InputTrailingIconProps } from '../InputTrailingIcon-DzmwLGtX.mjs';
3
+ import { b as InputGroup$1 } from '../Input-N8AWWSmt.mjs';
4
+ export { c as Input, I as InputGroupProps, a as InputProps } from '../Input-N8AWWSmt.mjs';
5
5
  import * as class_variance_authority_types from 'class-variance-authority/types';
6
6
  import { VariantProps } from 'class-variance-authority';
7
- export { a as Input, I as InputProps } from '../Input-g0LpWuv0.mjs';
7
+ import { b as InputLeadingIcon, c as InputTrailingIcon } from '../InputTrailingIcon-BBp7sE6D.mjs';
8
+ export { I as InputLeadingIconProps, a as InputTrailingIconProps } from '../InputTrailingIcon-BBp7sE6D.mjs';
8
9
  import '../icon/index.mjs';
9
10
 
10
11
  interface InputClearButtonProps extends ComponentPropsWithoutRef<'button'> {
@@ -1,10 +1,11 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import { ComponentPropsWithoutRef, Ref } from 'react';
3
- import { c as InputGroup$1, d as InputLeadingIcon, e as InputTrailingIcon } from '../InputTrailingIcon-CZD9hydv.js';
4
- export { I as InputGroupProps, a as InputLeadingIconProps, b as InputTrailingIconProps } from '../InputTrailingIcon-CZD9hydv.js';
3
+ import { b as InputGroup$1 } from '../Input-N8AWWSmt.js';
4
+ export { c as Input, I as InputGroupProps, a as InputProps } from '../Input-N8AWWSmt.js';
5
5
  import * as class_variance_authority_types from 'class-variance-authority/types';
6
6
  import { VariantProps } from 'class-variance-authority';
7
- export { a as Input, I as InputProps } from '../Input-g0LpWuv0.js';
7
+ import { b as InputLeadingIcon, c as InputTrailingIcon } from '../InputTrailingIcon-ZZx8PoJy.js';
8
+ export { I as InputLeadingIconProps, a as InputTrailingIconProps } from '../InputTrailingIcon-ZZx8PoJy.js';
8
9
  import '../icon/index.js';
9
10
 
10
11
  interface InputClearButtonProps extends ComponentPropsWithoutRef<'button'> {
@@ -1,78 +1,81 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { NumberField } from '@base-ui-components/react/number-field';
3
- import { ComponentProps, ReactNode, Ref } from 'react';
2
+ import { RefObject, Ref, PropsWithChildren } from 'react';
3
+ import { AriaButtonOptions } from '@react-aria/button';
4
+ import { NumberFieldStateOptions } from '@react-stately/numberfield';
5
+ import { AriaNumberFieldProps } from '@react-types/numberfield';
4
6
  import { IconButtonProps } from '../icon-button/index.mjs';
5
- import { I as InputProps } from '../Input-g0LpWuv0.mjs';
7
+ import { I as InputGroupProps, a as InputProps } from '../Input-N8AWWSmt.mjs';
6
8
  import '../button/index.mjs';
7
9
  import 'class-variance-authority/types';
8
10
  import 'class-variance-authority';
9
11
 
10
- interface DecrementProps extends Omit<ComponentProps<typeof NumberField.Decrement>, 'render'> {
11
- children?: ReactNode;
12
- asChild?: boolean;
13
- }
14
- interface IncrementProps extends Omit<ComponentProps<typeof NumberField.Increment>, 'render'> {
15
- children?: ReactNode;
16
- asChild?: boolean;
17
- }
18
- declare const Decrement: {
19
- ({ children, className, asChild, ...props }: DecrementProps): react_jsx_runtime.JSX.Element;
20
- displayName: string;
21
- };
22
- declare const Increment: {
23
- ({ children, className, asChild, ...props }: IncrementProps): react_jsx_runtime.JSX.Element;
24
- displayName: string;
25
- };
26
-
27
- interface Props extends Omit<ComponentProps<typeof NumberField.Input>, 'render'> {
28
- children?: ReactNode;
29
- }
30
- declare const Input: {
31
- ({ className, ...props }: Props): react_jsx_runtime.JSX.Element;
32
- displayName: string;
12
+ /**
13
+ * As we're using React Spectrum library to build this component, we also want
14
+ * to build our typing uppon theirs.
15
+ * Still, we have to adapt it to avoid exposing useless props.
16
+ */
17
+ type StepperButtonProps = Omit<IconButtonProps, 'shape' | 'size' | 'disabled' | 'asChild' | 'isLoading' | 'loadingLabel'> & Omit<AriaButtonOptions<'button'>, 'elementType' | 'href' | 'target' | 'isDisabled' | 'excludeFromTabOrder' | 'aria-label' | 'preventFocusOnPress'> & {
18
+ disabled?: boolean;
19
+ ref?: Ref<HTMLButtonElement>;
33
20
  };
34
-
35
- interface StepperProps extends Omit<ComponentProps<typeof NumberField.Root>, 'render' | 'min' | 'max' | 'format'> {
36
- children: ReactNode;
21
+ type SpectrumNumberFieldPropsFilter = 'isDisabled' | 'isReadOnly' | 'isRequired' | 'isInvalid' | 'validationState' | 'validationBehavior' | 'validate' | 'label' | 'description' | 'errorMessage' | 'isWheelDisabled' | 'id' | 'onCopy' | 'onCut' | 'onPaste' | 'onCompositionStart' | 'onCompositionEnd' | 'onCompositionUpdate' | 'onSelect' | 'onBeforeInput' | 'onInput';
22
+ interface UseStepperArgs extends Omit<Omit<NumberFieldStateOptions, 'locale'> & Omit<AriaNumberFieldProps, 'incrementAriaLabel' | 'decrementAriaLabel'>, SpectrumNumberFieldPropsFilter> {
23
+ inputRef: RefObject<HTMLInputElement | null>;
37
24
  /**
38
- * Assign a specific state to the group, either `error`, `alert` or `success`. The outline styles will be updated.
25
+ * Sets the component as interactive or not.
39
26
  */
40
- state?: 'error' | 'alert' | 'success';
27
+ disabled?: boolean;
41
28
  /**
42
- * The minimum value of the input element.
29
+ * Sets the component as editable or not.
43
30
  */
44
- minValue?: number;
31
+ readOnly?: boolean;
45
32
  /**
46
- * The maximum value of the input element.
33
+ * Sets the component as mandatory for form validation.
47
34
  */
48
- maxValue?: number;
35
+ required?: boolean;
49
36
  /**
50
- * Options to format the input value.
37
+ * The [BCP47](https://www.ietf.org/rfc/bcp/bcp47.txt) language code for the locale.
38
+ * @default 'fr'
51
39
  */
52
- formatOptions?: Intl.NumberFormatOptions;
40
+ locale?: string;
53
41
  }
54
- /**
55
- * As we're using React Spectrum library to build this component, we also want
56
- * to build our typing uppon theirs.
57
- * Still, we have to adapt it to avoid exposing useless props.
58
- */
59
- type StepperButtonProps = Omit<IconButtonProps, 'shape' | 'size' | 'disabled' | 'asChild' | 'isLoading' | 'loadingLabel'> & {
60
- disabled?: boolean;
61
- ref?: Ref<HTMLButtonElement>;
42
+ type StepperProps = Omit<Omit<UseStepperArgs, 'inputRef' | 'aria-label'> & Omit<InputGroupProps, 'onClear'>, 'onChange'> & {
43
+ onValueChange?: (e: number) => void;
44
+ ref?: Ref<HTMLDivElement>;
62
45
  };
63
46
  type StepperInputProps = Omit<InputProps, 'asChild'> & {
64
47
  ref?: Ref<HTMLInputElement>;
65
48
  };
66
49
 
67
- declare const Root: {
68
- ({ children, allowWheelScrub, state: stateProp, minValue, maxValue, formatOptions, step: stepProp, className, ...props }: StepperProps): react_jsx_runtime.JSX.Element;
50
+ declare const Stepper$1: {
51
+ ({ children, formatOptions, minValue, maxValue, ref: forwardedRef, ...stepperProps }: PropsWithChildren<StepperProps>): react_jsx_runtime.JSX.Element;
52
+ displayName: string;
53
+ };
54
+
55
+ declare const StepperIncrementButton: {
56
+ ({ children, design, intent, className, ref: forwardedRef, ...rest }: PropsWithChildren<StepperButtonProps>): react_jsx_runtime.JSX.Element;
57
+ displayName: string;
58
+ } & {
59
+ id: string;
60
+ };
61
+ declare const StepperDecrementButton: {
62
+ ({ children, design, intent, className, ref: forwardedRef, ...rest }: PropsWithChildren<StepperButtonProps>): react_jsx_runtime.JSX.Element;
63
+ displayName: string;
64
+ } & {
65
+ id: string;
66
+ };
67
+
68
+ declare const StepperInput: {
69
+ ({ ref: forwardedRef, ...props }: StepperInputProps): react_jsx_runtime.JSX.Element;
69
70
  displayName: string;
71
+ } & {
72
+ id: string;
70
73
  };
71
74
 
72
- declare const Stepper: typeof Root & {
73
- IncrementButton: typeof Increment;
74
- DecrementButton: typeof Decrement;
75
- Input: typeof Input;
75
+ declare const Stepper: typeof Stepper$1 & {
76
+ IncrementButton: typeof StepperIncrementButton;
77
+ DecrementButton: typeof StepperDecrementButton;
78
+ Input: typeof StepperInput;
76
79
  };
77
80
 
78
81
  export { Stepper, type StepperButtonProps, type StepperInputProps, type StepperProps };
@@ -1,78 +1,81 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { NumberField } from '@base-ui-components/react/number-field';
3
- import { ComponentProps, ReactNode, Ref } from 'react';
2
+ import { RefObject, Ref, PropsWithChildren } from 'react';
3
+ import { AriaButtonOptions } from '@react-aria/button';
4
+ import { NumberFieldStateOptions } from '@react-stately/numberfield';
5
+ import { AriaNumberFieldProps } from '@react-types/numberfield';
4
6
  import { IconButtonProps } from '../icon-button/index.js';
5
- import { I as InputProps } from '../Input-g0LpWuv0.js';
7
+ import { I as InputGroupProps, a as InputProps } from '../Input-N8AWWSmt.js';
6
8
  import '../button/index.js';
7
9
  import 'class-variance-authority/types';
8
10
  import 'class-variance-authority';
9
11
 
10
- interface DecrementProps extends Omit<ComponentProps<typeof NumberField.Decrement>, 'render'> {
11
- children?: ReactNode;
12
- asChild?: boolean;
13
- }
14
- interface IncrementProps extends Omit<ComponentProps<typeof NumberField.Increment>, 'render'> {
15
- children?: ReactNode;
16
- asChild?: boolean;
17
- }
18
- declare const Decrement: {
19
- ({ children, className, asChild, ...props }: DecrementProps): react_jsx_runtime.JSX.Element;
20
- displayName: string;
21
- };
22
- declare const Increment: {
23
- ({ children, className, asChild, ...props }: IncrementProps): react_jsx_runtime.JSX.Element;
24
- displayName: string;
25
- };
26
-
27
- interface Props extends Omit<ComponentProps<typeof NumberField.Input>, 'render'> {
28
- children?: ReactNode;
29
- }
30
- declare const Input: {
31
- ({ className, ...props }: Props): react_jsx_runtime.JSX.Element;
32
- displayName: string;
12
+ /**
13
+ * As we're using React Spectrum library to build this component, we also want
14
+ * to build our typing uppon theirs.
15
+ * Still, we have to adapt it to avoid exposing useless props.
16
+ */
17
+ type StepperButtonProps = Omit<IconButtonProps, 'shape' | 'size' | 'disabled' | 'asChild' | 'isLoading' | 'loadingLabel'> & Omit<AriaButtonOptions<'button'>, 'elementType' | 'href' | 'target' | 'isDisabled' | 'excludeFromTabOrder' | 'aria-label' | 'preventFocusOnPress'> & {
18
+ disabled?: boolean;
19
+ ref?: Ref<HTMLButtonElement>;
33
20
  };
34
-
35
- interface StepperProps extends Omit<ComponentProps<typeof NumberField.Root>, 'render' | 'min' | 'max' | 'format'> {
36
- children: ReactNode;
21
+ type SpectrumNumberFieldPropsFilter = 'isDisabled' | 'isReadOnly' | 'isRequired' | 'isInvalid' | 'validationState' | 'validationBehavior' | 'validate' | 'label' | 'description' | 'errorMessage' | 'isWheelDisabled' | 'id' | 'onCopy' | 'onCut' | 'onPaste' | 'onCompositionStart' | 'onCompositionEnd' | 'onCompositionUpdate' | 'onSelect' | 'onBeforeInput' | 'onInput';
22
+ interface UseStepperArgs extends Omit<Omit<NumberFieldStateOptions, 'locale'> & Omit<AriaNumberFieldProps, 'incrementAriaLabel' | 'decrementAriaLabel'>, SpectrumNumberFieldPropsFilter> {
23
+ inputRef: RefObject<HTMLInputElement | null>;
37
24
  /**
38
- * Assign a specific state to the group, either `error`, `alert` or `success`. The outline styles will be updated.
25
+ * Sets the component as interactive or not.
39
26
  */
40
- state?: 'error' | 'alert' | 'success';
27
+ disabled?: boolean;
41
28
  /**
42
- * The minimum value of the input element.
29
+ * Sets the component as editable or not.
43
30
  */
44
- minValue?: number;
31
+ readOnly?: boolean;
45
32
  /**
46
- * The maximum value of the input element.
33
+ * Sets the component as mandatory for form validation.
47
34
  */
48
- maxValue?: number;
35
+ required?: boolean;
49
36
  /**
50
- * Options to format the input value.
37
+ * The [BCP47](https://www.ietf.org/rfc/bcp/bcp47.txt) language code for the locale.
38
+ * @default 'fr'
51
39
  */
52
- formatOptions?: Intl.NumberFormatOptions;
40
+ locale?: string;
53
41
  }
54
- /**
55
- * As we're using React Spectrum library to build this component, we also want
56
- * to build our typing uppon theirs.
57
- * Still, we have to adapt it to avoid exposing useless props.
58
- */
59
- type StepperButtonProps = Omit<IconButtonProps, 'shape' | 'size' | 'disabled' | 'asChild' | 'isLoading' | 'loadingLabel'> & {
60
- disabled?: boolean;
61
- ref?: Ref<HTMLButtonElement>;
42
+ type StepperProps = Omit<Omit<UseStepperArgs, 'inputRef' | 'aria-label'> & Omit<InputGroupProps, 'onClear'>, 'onChange'> & {
43
+ onValueChange?: (e: number) => void;
44
+ ref?: Ref<HTMLDivElement>;
62
45
  };
63
46
  type StepperInputProps = Omit<InputProps, 'asChild'> & {
64
47
  ref?: Ref<HTMLInputElement>;
65
48
  };
66
49
 
67
- declare const Root: {
68
- ({ children, allowWheelScrub, state: stateProp, minValue, maxValue, formatOptions, step: stepProp, className, ...props }: StepperProps): react_jsx_runtime.JSX.Element;
50
+ declare const Stepper$1: {
51
+ ({ children, formatOptions, minValue, maxValue, ref: forwardedRef, ...stepperProps }: PropsWithChildren<StepperProps>): react_jsx_runtime.JSX.Element;
52
+ displayName: string;
53
+ };
54
+
55
+ declare const StepperIncrementButton: {
56
+ ({ children, design, intent, className, ref: forwardedRef, ...rest }: PropsWithChildren<StepperButtonProps>): react_jsx_runtime.JSX.Element;
57
+ displayName: string;
58
+ } & {
59
+ id: string;
60
+ };
61
+ declare const StepperDecrementButton: {
62
+ ({ children, design, intent, className, ref: forwardedRef, ...rest }: PropsWithChildren<StepperButtonProps>): react_jsx_runtime.JSX.Element;
63
+ displayName: string;
64
+ } & {
65
+ id: string;
66
+ };
67
+
68
+ declare const StepperInput: {
69
+ ({ ref: forwardedRef, ...props }: StepperInputProps): react_jsx_runtime.JSX.Element;
69
70
  displayName: string;
71
+ } & {
72
+ id: string;
70
73
  };
71
74
 
72
- declare const Stepper: typeof Root & {
73
- IncrementButton: typeof Increment;
74
- DecrementButton: typeof Decrement;
75
- Input: typeof Input;
75
+ declare const Stepper: typeof Stepper$1 & {
76
+ IncrementButton: typeof StepperIncrementButton;
77
+ DecrementButton: typeof StepperDecrementButton;
78
+ Input: typeof StepperInput;
76
79
  };
77
80
 
78
81
  export { Stepper, type StepperButtonProps, type StepperInputProps, type StepperProps };