@spark-ui/components 10.18.1 → 10.19.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.
@@ -1,5 +1,5 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import * as react from 'react';
2
+ import * as React$1 from 'react';
3
3
  import { ComponentPropsWithoutRef } from 'react';
4
4
 
5
5
  interface AvatarImageProps$1 extends React.ImgHTMLAttributes<HTMLImageElement> {
@@ -45,7 +45,7 @@ declare const AvatarPlaceholder: {
45
45
  displayName: string;
46
46
  };
47
47
 
48
- interface AvatarProps extends react.HTMLAttributes<HTMLDivElement> {
48
+ interface AvatarProps extends React$1.HTMLAttributes<HTMLDivElement> {
49
49
  size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl';
50
50
  isOnline?: boolean;
51
51
  onlineText?: string;
@@ -1,5 +1,5 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import * as react from 'react';
2
+ import * as React$1 from 'react';
3
3
  import { ComponentPropsWithoutRef } from 'react';
4
4
 
5
5
  interface AvatarImageProps$1 extends React.ImgHTMLAttributes<HTMLImageElement> {
@@ -45,7 +45,7 @@ declare const AvatarPlaceholder: {
45
45
  displayName: string;
46
46
  };
47
47
 
48
- interface AvatarProps extends react.HTMLAttributes<HTMLDivElement> {
48
+ interface AvatarProps extends React$1.HTMLAttributes<HTMLDivElement> {
49
49
  size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl';
50
50
  isOnline?: boolean;
51
51
  onlineText?: string;
package/dist/docgen.json CHANGED
@@ -43840,6 +43840,362 @@
43840
43840
  }
43841
43841
  }
43842
43842
  },
43843
+ "Toast": {
43844
+ "tags": {},
43845
+ "description": "",
43846
+ "displayName": "Toast",
43847
+ "methods": [],
43848
+ "props": {
43849
+ "toast": {
43850
+ "defaultValue": null,
43851
+ "description": "",
43852
+ "name": "toast",
43853
+ "declarations": [
43854
+ {
43855
+ "fileName": "src/toast/Toast.tsx",
43856
+ "name": "TypeLiteral"
43857
+ }
43858
+ ],
43859
+ "required": true,
43860
+ "type": {
43861
+ "name": "ToastObject"
43862
+ }
43863
+ }
43864
+ }
43865
+ },
43866
+ "ToastProvider": {
43867
+ "tags": {},
43868
+ "description": "",
43869
+ "displayName": "ToastProvider",
43870
+ "methods": [],
43871
+ "props": {
43872
+ "timeout": {
43873
+ "defaultValue": {
43874
+ "value": "5000"
43875
+ },
43876
+ "description": "The default amount of time (in ms) before a toast is auto dismissed.\nA value of `0` will prevent the toast from being dismissed automatically.",
43877
+ "name": "timeout",
43878
+ "parent": {
43879
+ "fileName": "spark-web/node_modules/@base-ui-components/react/toast/provider/ToastProvider.d.ts",
43880
+ "name": "Props"
43881
+ },
43882
+ "declarations": [
43883
+ {
43884
+ "fileName": "spark-web/node_modules/@base-ui-components/react/toast/provider/ToastProvider.d.ts",
43885
+ "name": "Props"
43886
+ }
43887
+ ],
43888
+ "required": false,
43889
+ "type": {
43890
+ "name": "number"
43891
+ }
43892
+ },
43893
+ "limit": {
43894
+ "defaultValue": {
43895
+ "value": 3
43896
+ },
43897
+ "description": "The maximum number of toasts that can be displayed at once.\nWhen the limit is reached, the oldest toast will be removed to make room for the new one.",
43898
+ "name": "limit",
43899
+ "parent": {
43900
+ "fileName": "spark-web/node_modules/@base-ui-components/react/toast/provider/ToastProvider.d.ts",
43901
+ "name": "Props"
43902
+ },
43903
+ "declarations": [
43904
+ {
43905
+ "fileName": "spark-web/node_modules/@base-ui-components/react/toast/provider/ToastProvider.d.ts",
43906
+ "name": "Props"
43907
+ }
43908
+ ],
43909
+ "required": false,
43910
+ "type": {
43911
+ "name": "number"
43912
+ }
43913
+ },
43914
+ "toastManager": {
43915
+ "defaultValue": null,
43916
+ "description": "A global manager for toasts to use outside of a React component.",
43917
+ "name": "toastManager",
43918
+ "parent": {
43919
+ "fileName": "spark-web/node_modules/@base-ui-components/react/toast/provider/ToastProvider.d.ts",
43920
+ "name": "Props"
43921
+ },
43922
+ "declarations": [
43923
+ {
43924
+ "fileName": "spark-web/node_modules/@base-ui-components/react/toast/provider/ToastProvider.d.ts",
43925
+ "name": "Props"
43926
+ }
43927
+ ],
43928
+ "required": false,
43929
+ "type": {
43930
+ "name": "ToastManager"
43931
+ }
43932
+ }
43933
+ }
43934
+ },
43935
+ "ToastTrigger": {
43936
+ "tags": {},
43937
+ "description": "",
43938
+ "displayName": "ToastTrigger",
43939
+ "methods": [],
43940
+ "props": {
43941
+ "asChild": {
43942
+ "defaultValue": {
43943
+ "value": false
43944
+ },
43945
+ "description": "",
43946
+ "name": "asChild",
43947
+ "parent": {
43948
+ "fileName": "src/toast/index.tsx",
43949
+ "name": "ToastTriggerProps"
43950
+ },
43951
+ "declarations": [
43952
+ {
43953
+ "fileName": "src/toast/index.tsx",
43954
+ "name": "ToastTriggerProps"
43955
+ }
43956
+ ],
43957
+ "required": false,
43958
+ "type": {
43959
+ "name": "boolean"
43960
+ }
43961
+ },
43962
+ "title": {
43963
+ "defaultValue": null,
43964
+ "description": "",
43965
+ "name": "title",
43966
+ "parent": {
43967
+ "fileName": "src/toast/index.tsx",
43968
+ "name": "ToastTriggerProps"
43969
+ },
43970
+ "declarations": [
43971
+ {
43972
+ "fileName": "src/toast/index.tsx",
43973
+ "name": "ToastTriggerProps"
43974
+ }
43975
+ ],
43976
+ "required": true,
43977
+ "type": {
43978
+ "name": "string"
43979
+ }
43980
+ },
43981
+ "description": {
43982
+ "defaultValue": null,
43983
+ "description": "",
43984
+ "name": "description",
43985
+ "parent": {
43986
+ "fileName": "src/toast/index.tsx",
43987
+ "name": "ToastTriggerProps"
43988
+ },
43989
+ "declarations": [
43990
+ {
43991
+ "fileName": "src/toast/index.tsx",
43992
+ "name": "ToastTriggerProps"
43993
+ }
43994
+ ],
43995
+ "required": false,
43996
+ "type": {
43997
+ "name": "string"
43998
+ }
43999
+ },
44000
+ "timeout": {
44001
+ "defaultValue": {
44002
+ "value": 5000
44003
+ },
44004
+ "description": "",
44005
+ "name": "timeout",
44006
+ "parent": {
44007
+ "fileName": "src/toast/index.tsx",
44008
+ "name": "ToastTriggerProps"
44009
+ },
44010
+ "declarations": [
44011
+ {
44012
+ "fileName": "src/toast/index.tsx",
44013
+ "name": "ToastTriggerProps"
44014
+ }
44015
+ ],
44016
+ "required": false,
44017
+ "type": {
44018
+ "name": "number"
44019
+ }
44020
+ },
44021
+ "priority": {
44022
+ "defaultValue": {
44023
+ "value": "low"
44024
+ },
44025
+ "description": "The priority of the toast.\n- `low` - The toast will be announced politely.\n- `high` - The toast will be announced urgently.",
44026
+ "name": "priority",
44027
+ "parent": {
44028
+ "fileName": "spark-web/node_modules/@base-ui-components/react/toast/useToastManager.d.ts",
44029
+ "name": "ToastObject"
44030
+ },
44031
+ "declarations": [
44032
+ {
44033
+ "fileName": "spark-web/node_modules/@base-ui-components/react/toast/useToastManager.d.ts",
44034
+ "name": "ToastObject"
44035
+ }
44036
+ ],
44037
+ "required": false,
44038
+ "type": {
44039
+ "name": "enum",
44040
+ "raw": "\"high\" | \"low\"",
44041
+ "value": [
44042
+ {
44043
+ "value": "\"high\""
44044
+ },
44045
+ {
44046
+ "value": "\"low\""
44047
+ }
44048
+ ]
44049
+ }
44050
+ },
44051
+ "design": {
44052
+ "defaultValue": {
44053
+ "value": "filled"
44054
+ },
44055
+ "description": "",
44056
+ "name": "design",
44057
+ "parent": {
44058
+ "fileName": "components/src/toast/types.ts",
44059
+ "name": "ToastData"
44060
+ },
44061
+ "declarations": [
44062
+ {
44063
+ "fileName": "components/src/toast/types.ts",
44064
+ "name": "ToastData"
44065
+ }
44066
+ ],
44067
+ "required": false,
44068
+ "type": {
44069
+ "name": "enum",
44070
+ "raw": "ToastDesign",
44071
+ "value": [
44072
+ {
44073
+ "value": "\"filled\""
44074
+ },
44075
+ {
44076
+ "value": "\"tinted\""
44077
+ }
44078
+ ]
44079
+ }
44080
+ },
44081
+ "intent": {
44082
+ "defaultValue": {
44083
+ "value": "neutral"
44084
+ },
44085
+ "description": "",
44086
+ "name": "intent",
44087
+ "parent": {
44088
+ "fileName": "components/src/toast/types.ts",
44089
+ "name": "ToastData"
44090
+ },
44091
+ "declarations": [
44092
+ {
44093
+ "fileName": "components/src/toast/types.ts",
44094
+ "name": "ToastData"
44095
+ }
44096
+ ],
44097
+ "required": false,
44098
+ "type": {
44099
+ "name": "enum",
44100
+ "raw": "ToastIntent",
44101
+ "value": [
44102
+ {
44103
+ "value": "\"main\""
44104
+ },
44105
+ {
44106
+ "value": "\"alert\""
44107
+ },
44108
+ {
44109
+ "value": "\"support\""
44110
+ },
44111
+ {
44112
+ "value": "\"accent\""
44113
+ },
44114
+ {
44115
+ "value": "\"success\""
44116
+ },
44117
+ {
44118
+ "value": "\"info\""
44119
+ },
44120
+ {
44121
+ "value": "\"neutral\""
44122
+ },
44123
+ {
44124
+ "value": "\"surface\""
44125
+ },
44126
+ {
44127
+ "value": "\"basic\""
44128
+ },
44129
+ {
44130
+ "value": "\"error\""
44131
+ },
44132
+ {
44133
+ "value": "\"surfaceInverse\""
44134
+ }
44135
+ ]
44136
+ }
44137
+ },
44138
+ "icon": {
44139
+ "defaultValue": null,
44140
+ "description": "",
44141
+ "name": "icon",
44142
+ "parent": {
44143
+ "fileName": "components/src/toast/types.ts",
44144
+ "name": "ToastData"
44145
+ },
44146
+ "declarations": [
44147
+ {
44148
+ "fileName": "components/src/toast/types.ts",
44149
+ "name": "ToastData"
44150
+ }
44151
+ ],
44152
+ "required": false,
44153
+ "type": {
44154
+ "name": "ReactNode"
44155
+ }
44156
+ },
44157
+ "isClosable": {
44158
+ "defaultValue": {
44159
+ "value": true
44160
+ },
44161
+ "description": "",
44162
+ "name": "isClosable",
44163
+ "parent": {
44164
+ "fileName": "components/src/toast/types.ts",
44165
+ "name": "ToastData"
44166
+ },
44167
+ "declarations": [
44168
+ {
44169
+ "fileName": "components/src/toast/types.ts",
44170
+ "name": "ToastData"
44171
+ }
44172
+ ],
44173
+ "required": false,
44174
+ "type": {
44175
+ "name": "boolean"
44176
+ }
44177
+ },
44178
+ "action": {
44179
+ "defaultValue": null,
44180
+ "description": "",
44181
+ "name": "action",
44182
+ "parent": {
44183
+ "fileName": "components/src/toast/types.ts",
44184
+ "name": "ToastData"
44185
+ },
44186
+ "declarations": [
44187
+ {
44188
+ "fileName": "components/src/toast/types.ts",
44189
+ "name": "ToastData"
44190
+ }
44191
+ ],
44192
+ "required": false,
44193
+ "type": {
44194
+ "name": "any"
44195
+ }
44196
+ }
44197
+ }
44198
+ },
43843
44199
  "VisuallyHidden": {
43844
44200
  "tags": {},
43845
44201
  "description": "",
@@ -207,7 +207,7 @@ var Input = ({ className, ...props }) => {
207
207
  "data-spark-component": "stepper-input",
208
208
  className: (0, import_class_variance_authority3.cx)(
209
209
  // Base styles
210
- "bg-surface text-on-surface h-sz-44 border-y-sm border-outline text-center",
210
+ "bg-surface text-on-surface px-lg h-sz-44 border-y-sm border-outline relative inline-flex w-full text-center",
211
211
  "first:border-l-sm first:rounded-l-lg",
212
212
  "last:border-r-sm last:rounded-r-lg",
213
213
  // State styles
@@ -263,7 +263,14 @@ var Root = ({
263
263
  step,
264
264
  ...field.id && { id: field.id },
265
265
  ...props,
266
- children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_number_field3.NumberField.Group, { className: (0, import_class_variance_authority4.cx)("group flex", className), "data-field-state": state, children })
266
+ children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
267
+ import_number_field3.NumberField.Group,
268
+ {
269
+ className: (0, import_class_variance_authority4.cx)("group relative inline-flex w-full", className),
270
+ "data-field-state": state,
271
+ children
272
+ }
273
+ )
267
274
  }
268
275
  );
269
276
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/stepper/index.ts","../../src/stepper/Buttons.tsx","../../src/icon/Icon.tsx","../../src/slot/Slot.tsx","../../src/visually-hidden/VisuallyHidden.tsx","../../src/icon/Icon.styles.tsx","../../src/stepper/useRenderSlot.tsx","../../src/stepper/Input.tsx","../../src/stepper/Root.tsx"],"sourcesContent":["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","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 { Children, cloneElement, ComponentPropsWithoutRef, ReactElement, ReactNode } from 'react'\n\nimport { VisuallyHidden } from '../visually-hidden'\nimport { iconStyles, IconVariantsProps } from './Icon.styles'\n\nexport interface IconProps extends IconVariantsProps, ComponentPropsWithoutRef<'svg'> {\n /**\n * The svg icon that will be wrapped\n */\n children: ReactNode\n /**\n * The accessible label for the icon. This label will be visually hidden but announced to screen\n * reader users, similar to `alt` text for `img` tags.\n */\n label?: string\n}\n\nexport const Icon = ({\n label,\n className,\n size = 'current',\n intent = 'current',\n children,\n ...others\n}: IconProps) => {\n const child = Children.only(children)\n\n return (\n <>\n {cloneElement(child as ReactElement<Record<string, any>>, {\n className: iconStyles({ className, size, intent }),\n 'data-spark-component': 'icon',\n 'aria-hidden': 'true',\n focusable: 'false',\n ...others,\n })}\n\n {label && <VisuallyHidden>{label}</VisuallyHidden>}\n </>\n )\n}\n\nIcon.displayName = 'Icon'\n","import { Slot as RadixSlot } from 'radix-ui'\nimport {\n cloneElement,\n HTMLAttributes,\n isValidElement,\n PropsWithChildren,\n ReactNode,\n Ref,\n} from 'react'\n\nexport const Slottable: typeof RadixSlot.Slottable = RadixSlot.Slottable\n\nexport type SlotProps = PropsWithChildren<HTMLAttributes<HTMLElement>> & {\n ref?: Ref<HTMLElement>\n}\n\nexport const Slot = ({ ref, ...props }: SlotProps) => {\n return <RadixSlot.Root ref={ref} {...props} />\n}\n\n/**\n * When using Radix `Slot` component, it will consider its first child to merge its props with.\n * In some cases, you might need to wrap the top child with additional markup without breaking this behaviour.\n */\nexport const wrapPolymorphicSlot = (\n asChild: boolean | undefined,\n children: ReactNode,\n callback: (children: ReactNode) => ReactNode\n) => {\n if (!asChild) return callback(children) // If polymorphic behaviour is not used, we keep the original children\n\n return isValidElement(children)\n ? cloneElement(\n children,\n undefined,\n callback((children.props as { children: ReactNode }).children)\n )\n : null\n}\n","import { HTMLAttributes, PropsWithChildren, Ref } from 'react'\n\nimport { Slot } from '../slot'\n\nexport type VisuallyHiddenProps = PropsWithChildren<HTMLAttributes<HTMLElement>> & {\n /**\n * Change the default rendered element for the one passed as a child, merging their props and behavior.\n */\n asChild?: boolean\n ref?: Ref<HTMLElement>\n}\n\nexport const VisuallyHidden = ({ asChild = false, ref, ...props }: VisuallyHiddenProps) => {\n const Component = asChild ? Slot : 'span'\n\n return (\n <Component\n {...props}\n ref={ref}\n style={{\n // See: https://github.com/twbs/bootstrap/blob/main/scss/mixins/_visually-hidden.scss\n position: 'absolute',\n border: 0,\n width: 1,\n height: 1,\n padding: 0,\n margin: -1,\n overflow: 'hidden',\n clip: 'rect(0, 0, 0, 0)',\n whiteSpace: 'nowrap',\n wordWrap: 'normal',\n ...props.style,\n }}\n />\n )\n}\n\nVisuallyHidden.displayName = 'VisuallyHidden'\n","import { makeVariants } from '@spark-ui/internal-utils'\nimport { cva, VariantProps } from 'class-variance-authority'\n\nexport const iconStyles = cva(['fill-current shrink-0'], {\n variants: {\n /**\n * Color scheme of the icon.\n */\n intent: makeVariants<\n 'intent',\n [\n 'current',\n 'main',\n 'support',\n 'accent',\n 'basic',\n 'success',\n 'alert',\n 'error',\n 'info',\n 'neutral',\n ]\n >({\n current: ['text-current'],\n main: ['text-main'],\n support: ['text-support'],\n accent: ['text-accent'],\n basic: ['text-basic'],\n success: ['text-success'],\n alert: ['text-alert'],\n error: ['text-error'],\n info: ['text-info'],\n neutral: ['text-neutral'],\n }),\n /**\n * Sets the size of the icon.\n */\n size: makeVariants<'size', ['current', 'sm', 'md', 'lg', 'xl']>({\n current: ['u-current-font-size'],\n sm: ['w-sz-16', 'h-sz-16'],\n md: ['w-sz-24', 'h-sz-24'],\n lg: ['w-sz-32', 'h-sz-32'],\n xl: ['w-sz-40', 'h-sz-40'],\n }),\n },\n})\n\nexport type IconVariantsProps = VariantProps<typeof iconStyles>\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 h-sz-44 border-y-sm border-outline 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 className={cx('group flex', className)} data-field-state={state}>\n {children}\n </NumberField.Group>\n </NumberField.Root>\n )\n}\n\nRoot.displayName = 'Stepper'\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,0BAA4B;AAC5B,mBAAsB;AACtB,kBAAqB;AACrB,IAAAA,mCAAoB;;;ACHpB,IAAAC,gBAA0F;;;ACA1F,sBAAkC;AAClC,mBAOO;AASE;AAPF,IAAM,YAAwC,gBAAAC,KAAU;AAMxD,IAAM,OAAO,CAAC,EAAE,KAAK,GAAG,MAAM,MAAiB;AACpD,SAAO,4CAAC,gBAAAA,KAAU,MAAV,EAAe,KAAW,GAAG,OAAO;AAC9C;;;ACFI,IAAAC,sBAAA;AAJG,IAAM,iBAAiB,CAAC,EAAE,UAAU,OAAO,KAAK,GAAG,MAAM,MAA2B;AACzF,QAAM,YAAY,UAAU,OAAO;AAEnC,SACE;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MAC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IAAC,iCAAY;AAAA,IAAZ;AAAA,MACC,wBAAqB;AAAA,MACrB;AAAA,MACA;AAAA,MACA,KAAK;AAAA,MACL,KAAK;AAAA,MACL,QAAQ;AAAA,MACR;AAAA,MACC,GAAI,MAAM,MAAM,EAAE,IAAI,MAAM,GAAG;AAAA,MAC/B,GAAG;AAAA,MAEJ,uDAAC,iCAAY,OAAZ,EAAkB,eAAW,qCAAG,cAAc,SAAS,GAAG,oBAAkB,OAC1E,UACH;AAAA;AAAA,EACF;AAEJ;AAEA,KAAK,cAAc;;;AR3CZ,IAAM,UAIT,OAAO,OAAO,MAAM,EAAE,4BAAiB,4BAAiB,MAAM,CAAC;AAEnE,QAAQ,cAAc;AACtB,UAAgB,cAAc;AAC9B,UAAgB,cAAc;AAC9B,MAAM,cAAc;","names":["import_class_variance_authority","import_react","RadixSlot","import_jsx_runtime","import_jsx_runtime","import_jsx_runtime","import_jsx_runtime","import_number_field","import_class_variance_authority","import_jsx_runtime","import_number_field","import_form_field","import_class_variance_authority","import_jsx_runtime"]}
1
+ {"version":3,"sources":["../../src/stepper/index.ts","../../src/stepper/Buttons.tsx","../../src/icon/Icon.tsx","../../src/slot/Slot.tsx","../../src/visually-hidden/VisuallyHidden.tsx","../../src/icon/Icon.styles.tsx","../../src/stepper/useRenderSlot.tsx","../../src/stepper/Input.tsx","../../src/stepper/Root.tsx"],"sourcesContent":["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","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 { Children, cloneElement, ComponentPropsWithoutRef, ReactElement, ReactNode } from 'react'\n\nimport { VisuallyHidden } from '../visually-hidden'\nimport { iconStyles, IconVariantsProps } from './Icon.styles'\n\nexport interface IconProps extends IconVariantsProps, ComponentPropsWithoutRef<'svg'> {\n /**\n * The svg icon that will be wrapped\n */\n children: ReactNode\n /**\n * The accessible label for the icon. This label will be visually hidden but announced to screen\n * reader users, similar to `alt` text for `img` tags.\n */\n label?: string\n}\n\nexport const Icon = ({\n label,\n className,\n size = 'current',\n intent = 'current',\n children,\n ...others\n}: IconProps) => {\n const child = Children.only(children)\n\n return (\n <>\n {cloneElement(child as ReactElement<Record<string, any>>, {\n className: iconStyles({ className, size, intent }),\n 'data-spark-component': 'icon',\n 'aria-hidden': 'true',\n focusable: 'false',\n ...others,\n })}\n\n {label && <VisuallyHidden>{label}</VisuallyHidden>}\n </>\n )\n}\n\nIcon.displayName = 'Icon'\n","import { Slot as RadixSlot } from 'radix-ui'\nimport {\n cloneElement,\n HTMLAttributes,\n isValidElement,\n PropsWithChildren,\n ReactNode,\n Ref,\n} from 'react'\n\nexport const Slottable: typeof RadixSlot.Slottable = RadixSlot.Slottable\n\nexport type SlotProps = PropsWithChildren<HTMLAttributes<HTMLElement>> & {\n ref?: Ref<HTMLElement>\n}\n\nexport const Slot = ({ ref, ...props }: SlotProps) => {\n return <RadixSlot.Root ref={ref} {...props} />\n}\n\n/**\n * When using Radix `Slot` component, it will consider its first child to merge its props with.\n * In some cases, you might need to wrap the top child with additional markup without breaking this behaviour.\n */\nexport const wrapPolymorphicSlot = (\n asChild: boolean | undefined,\n children: ReactNode,\n callback: (children: ReactNode) => ReactNode\n) => {\n if (!asChild) return callback(children) // If polymorphic behaviour is not used, we keep the original children\n\n return isValidElement(children)\n ? cloneElement(\n children,\n undefined,\n callback((children.props as { children: ReactNode }).children)\n )\n : null\n}\n","import { HTMLAttributes, PropsWithChildren, Ref } from 'react'\n\nimport { Slot } from '../slot'\n\nexport type VisuallyHiddenProps = PropsWithChildren<HTMLAttributes<HTMLElement>> & {\n /**\n * Change the default rendered element for the one passed as a child, merging their props and behavior.\n */\n asChild?: boolean\n ref?: Ref<HTMLElement>\n}\n\nexport const VisuallyHidden = ({ asChild = false, ref, ...props }: VisuallyHiddenProps) => {\n const Component = asChild ? Slot : 'span'\n\n return (\n <Component\n {...props}\n ref={ref}\n style={{\n // See: https://github.com/twbs/bootstrap/blob/main/scss/mixins/_visually-hidden.scss\n position: 'absolute',\n border: 0,\n width: 1,\n height: 1,\n padding: 0,\n margin: -1,\n overflow: 'hidden',\n clip: 'rect(0, 0, 0, 0)',\n whiteSpace: 'nowrap',\n wordWrap: 'normal',\n ...props.style,\n }}\n />\n )\n}\n\nVisuallyHidden.displayName = 'VisuallyHidden'\n","import { makeVariants } from '@spark-ui/internal-utils'\nimport { cva, VariantProps } from 'class-variance-authority'\n\nexport const iconStyles = cva(['fill-current shrink-0'], {\n variants: {\n /**\n * Color scheme of the icon.\n */\n intent: makeVariants<\n 'intent',\n [\n 'current',\n 'main',\n 'support',\n 'accent',\n 'basic',\n 'success',\n 'alert',\n 'error',\n 'info',\n 'neutral',\n ]\n >({\n current: ['text-current'],\n main: ['text-main'],\n support: ['text-support'],\n accent: ['text-accent'],\n basic: ['text-basic'],\n success: ['text-success'],\n alert: ['text-alert'],\n error: ['text-error'],\n info: ['text-info'],\n neutral: ['text-neutral'],\n }),\n /**\n * Sets the size of the icon.\n */\n size: makeVariants<'size', ['current', 'sm', 'md', 'lg', 'xl']>({\n current: ['u-current-font-size'],\n sm: ['w-sz-16', 'h-sz-16'],\n md: ['w-sz-24', 'h-sz-24'],\n lg: ['w-sz-32', 'h-sz-32'],\n xl: ['w-sz-40', 'h-sz-40'],\n }),\n },\n})\n\nexport type IconVariantsProps = VariantProps<typeof iconStyles>\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"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,0BAA4B;AAC5B,mBAAsB;AACtB,kBAAqB;AACrB,IAAAA,mCAAoB;;;ACHpB,IAAAC,gBAA0F;;;ACA1F,sBAAkC;AAClC,mBAOO;AASE;AAPF,IAAM,YAAwC,gBAAAC,KAAU;AAMxD,IAAM,OAAO,CAAC,EAAE,KAAK,GAAG,MAAM,MAAiB;AACpD,SAAO,4CAAC,gBAAAA,KAAU,MAAV,EAAe,KAAW,GAAG,OAAO;AAC9C;;;ACFI,IAAAC,sBAAA;AAJG,IAAM,iBAAiB,CAAC,EAAE,UAAU,OAAO,KAAK,GAAG,MAAM,MAA2B;AACzF,QAAM,YAAY,UAAU,OAAO;AAEnC,SACE;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACJ;AAAA,MACA,OAAO;AAAA;AAAA,QAEL,UAAU;AAAA,QACV,QAAQ;AAAA,QACR,OAAO;AAAA,QACP,QAAQ;AAAA,QACR,SAAS;AAAA,QACT,QAAQ;AAAA,QACR,UAAU;AAAA,QACV,MAAM;AAAA,QACN,YAAY;AAAA,QACZ,UAAU;AAAA,QACV,GAAG,MAAM;AAAA,MACX;AAAA;AAAA,EACF;AAEJ;AAEA,eAAe,cAAc;;;ACrC7B,4BAA6B;AAC7B,sCAAkC;AAE3B,IAAM,iBAAa,qCAAI,CAAC,uBAAuB,GA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AAEJ;AAEA,KAAK,cAAc;;;AR9CZ,IAAM,UAIT,OAAO,OAAO,MAAM,EAAE,4BAAiB,4BAAiB,MAAM,CAAC;AAEnE,QAAQ,cAAc;AACtB,UAAgB,cAAc;AAC9B,UAAgB,cAAc;AAC9B,MAAM,cAAc;","names":["import_class_variance_authority","import_react","RadixSlot","import_jsx_runtime","import_jsx_runtime","import_jsx_runtime","import_jsx_runtime","import_number_field","import_class_variance_authority","import_jsx_runtime","import_number_field","import_form_field","import_class_variance_authority","import_jsx_runtime"]}
@@ -92,7 +92,7 @@ var Input = ({ className, ...props }) => {
92
92
  "data-spark-component": "stepper-input",
93
93
  className: cx(
94
94
  // Base styles
95
- "bg-surface text-on-surface h-sz-44 border-y-sm border-outline text-center",
95
+ "bg-surface text-on-surface px-lg h-sz-44 border-y-sm border-outline relative inline-flex w-full text-center",
96
96
  "first:border-l-sm first:rounded-l-lg",
97
97
  "last:border-r-sm last:rounded-r-lg",
98
98
  // State styles
@@ -148,7 +148,14 @@ var Root = ({
148
148
  step,
149
149
  ...field.id && { id: field.id },
150
150
  ...props,
151
- children: /* @__PURE__ */ jsx4(NumberField3.Group, { className: cx2("group flex", className), "data-field-state": state, children })
151
+ children: /* @__PURE__ */ jsx4(
152
+ NumberField3.Group,
153
+ {
154
+ className: cx2("group relative inline-flex w-full", className),
155
+ "data-field-state": state,
156
+ children
157
+ }
158
+ )
152
159
  }
153
160
  );
154
161
  };
@@ -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 h-sz-44 border-y-sm border-outline 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 className={cx('group flex', className)} data-field-state={state}>\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;AAAA,MACR,WAAW;AAAA,QACT,MAAM;AAAA,QACN,OAAO;AAAA,MACT;AAAA,IACF;AAAA,EACF;AACF;AAYO,IAAM,YAAY,CAAC,EAAE,UAAU,WAAW,UAAU,OAAO,GAAG,MAAM,MAAsB;AAC/F,QAAM,SAAS,cA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AAW,EAAE,gBAAgB,KAAK;AAAA,MACtD,GAAG;AAAA;AAAA,EACN;AAEJ;AAEA,MAAM,cAAc;;;ACxCpB,SAAS,eAAAE,oBAAmB;AAC5B,SAAS,uBAAAC,4BAA2B;AACpC,SAAS,MAAAC,WAAU;AAsCb,gBAAAC,YAAA;AAjCC,IAAM,OAAO,CAAC;AAAA,EACnB;AAAA,EACA,kBAAkB;AAAA,EAClB,OAAO;AAAA,EACP;AAAA,EACA;AAAA,EACA;AAAA,EACA,MAAM;AAAA,EACN;AAAA,EACA,GAAG;AACL,MAAoB;AAClB,QAAM,SAAS,cAAc,MAAM,KAAK;AAExC,QAAM,QAAQC,qBAAoB;AAClC,QAAM,QAAQ,MAAM,SAAS;AAK7B,QAAM,OAAO,YAAY,QAAQ,eAAe,UAAU,YAAY,OAAO;AAE7E,SACE,gBAAAD;AAAA,IAACE,aAAY;AAAA,IAAZ;AAAA,MACC,wBAAqB;AAAA,MACrB;AAAA,MACA;AAAA,MACA,KAAK;AAAA,MACL,KAAK;AAAA,MACL,QAAQ;AAAA,MACR;AAAA,MACC,GAAI,MAAM,MAAM,EAAE,IAAI,MAAM,GAAG;AAAA,MAC/B,GAAG;AAAA,MAEJ,0BAAAF,KAACE,aAAY,OAAZ,EAAkB,WAAWC,IAAG,cAAc,SAAS,GAAG,oBAAkB,OAC1E,UACH;AAAA;AAAA,EACF;AAEJ;AAEA,KAAK,cAAc;;;AC3CZ,IAAM,UAIT,OAAO,OAAO,MAAM,EAAE,4BAAiB,4BAAiB,MAAM,CAAC;AAEnE,QAAQ,cAAc;AACtB,UAAgB,cAAc;AAC9B,UAAgB,cAAc;AAC9B,MAAM,cAAc;","names":["jsx","NumberField","jsx","NumberField","useFormFieldControl","cx","jsx","useFormFieldControl","NumberField","cx"]}
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,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AAC;AAEnE,QAAQ,cAAc;AACtB,UAAgB,cAAc;AAC9B,UAAgB,cAAc;AAC9B,MAAM,cAAc;","names":["jsx","NumberField","jsx","NumberField","useFormFieldControl","cx","jsx","useFormFieldControl","NumberField","cx"]}
@@ -0,0 +1,56 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { Toast } from '@base-ui-components/react/toast';
3
+ import * as React from 'react';
4
+ import { ButtonProps } from '../button/index.mjs';
5
+ import 'class-variance-authority/types';
6
+ import 'class-variance-authority';
7
+
8
+ type ToastIntent = 'main' | 'support' | 'accent' | 'basic' | 'success' | 'alert' | 'error' | 'info' | 'neutral' | 'surface' | 'surfaceInverse';
9
+ type ToastDesign = 'tinted' | 'filled';
10
+ interface ToastData {
11
+ icon?: React.ReactNode;
12
+ design?: ToastDesign;
13
+ intent?: ToastIntent;
14
+ isClosable?: boolean;
15
+ closeLabel?: string;
16
+ action?: {
17
+ close?: boolean;
18
+ label: string;
19
+ onClick: () => void;
20
+ } & ButtonProps;
21
+ }
22
+ type ToastObject = Toast.Root.ToastObject<ToastData>;
23
+ interface AddOptions extends Omit<ToastObject, 'id' | 'animation' | 'height' | 'ref' | 'limited'> {
24
+ id?: string;
25
+ }
26
+ type UpdateOptions = Partial<AddOptions>;
27
+ interface PromiseOptions<Value> {
28
+ loading: string | UpdateOptions;
29
+ success: string | UpdateOptions | ((result: Value) => string | UpdateOptions);
30
+ error: string | UpdateOptions | ((error: any) => string | UpdateOptions);
31
+ }
32
+ interface UseToastManagerReturnValue {
33
+ toasts: ToastObject[];
34
+ add: (options: AddOptions) => string;
35
+ update: (toastId: string, options: UpdateOptions) => void;
36
+ close: (toastId: string) => void;
37
+ promise: <Value>(promise: Promise<Value>, options: PromiseOptions<Value>) => Promise<Value>;
38
+ closeAll: () => void;
39
+ }
40
+
41
+ declare function useToastManager(): UseToastManagerReturnValue;
42
+
43
+ interface ToastProviderProps extends React.ComponentProps<typeof Toast.Provider> {
44
+ children: React.ReactNode;
45
+ }
46
+ declare function ToastProvider({ children, limit }: ToastProviderProps): react_jsx_runtime.JSX.Element;
47
+ interface ToastTriggerProps extends React.ComponentPropsWithRef<'button'>, Pick<ToastObject, 'priority'>, Pick<ToastData, 'design' | 'intent' | 'icon' | 'isClosable' | 'action'> {
48
+ children: React.ReactNode;
49
+ asChild?: boolean;
50
+ title: string;
51
+ description?: string;
52
+ timeout?: number;
53
+ }
54
+ declare function ToastTrigger({ children, onClick, asChild, title, description, timeout, design, intent, isClosable, icon, action, priority, }: ToastTriggerProps): react_jsx_runtime.JSX.Element;
55
+
56
+ export { type ToastData, type ToastDesign, type ToastIntent, type ToastObject, ToastProvider, ToastTrigger, type UseToastManagerReturnValue, useToastManager };