@spark-ui/components 17.11.3 → 17.12.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.
@@ -0,0 +1,35 @@
1
+ import { ComponentPropsWithoutRef, PropsWithChildren, Ref } from 'react';
2
+ export interface ToggleGroupProps extends PropsWithChildren, ComponentPropsWithoutRef<'div'> {
3
+ /**
4
+ * Change the component to the HTML tag or custom component of the only child. This will merge the original component props with the props of the supplied element/component and change the underlying DOM node.
5
+ * @default false
6
+ */
7
+ asChild?: boolean;
8
+ /**
9
+ * Whether multiple toggles can be pressed at the same time.
10
+ * @default false
11
+ */
12
+ multiple?: boolean;
13
+ /**
14
+ * The default value(s) of the toggle group when it is initially rendered.
15
+ * Use when you do not need to control its value(s).
16
+ * Must be an array even for single selection mode.
17
+ */
18
+ defaultValue?: readonly any[];
19
+ /**
20
+ * The controlled value(s) of the toggle group.
21
+ * Must be used in conjunction with `onValueChange`.
22
+ * Must be an array even for single selection mode.
23
+ */
24
+ value?: readonly any[];
25
+ /**
26
+ * Event handler called when the value changes.
27
+ * Always receives an array, even for single selection mode.
28
+ */
29
+ onValueChange?: (value: readonly any[]) => void;
30
+ ref?: Ref<HTMLDivElement>;
31
+ }
32
+ export declare const ToggleGroup: {
33
+ ({ asChild, multiple, children, className, ref, ...rest }: ToggleGroupProps): import("react/jsx-runtime").JSX.Element;
34
+ displayName: string;
35
+ };
@@ -0,0 +1,3 @@
1
+ export declare const rootStyles: ({ className }: {
2
+ className?: string;
3
+ }) => string;
@@ -0,0 +1,23 @@
1
+ import { ComponentPropsWithoutRef, Ref } from 'react';
2
+ export interface ToggleGroupToggleProps extends ComponentPropsWithoutRef<'button'> {
3
+ /**
4
+ * A unique value that identifies the toggle within the group.
5
+ */
6
+ value: any;
7
+ /**
8
+ * Change the component to the HTML tag or custom component of the only child. This will merge the original component props with the props of the supplied element/component and change the underlying DOM node.
9
+ * @default false
10
+ */
11
+ asChild?: boolean;
12
+ /**
13
+ * When true, prevents the user from interacting with the toggle.
14
+ * @default false
15
+ */
16
+ disabled?: boolean;
17
+ ref?: Ref<HTMLButtonElement>;
18
+ }
19
+ /** A toggle button within a toggle group. Renders a <button> element. */
20
+ export declare const ToggleGroupToggle: {
21
+ ({ asChild, value, disabled, children, className, ref, ...rest }: ToggleGroupToggleProps): import("react/jsx-runtime").JSX.Element;
22
+ displayName: string;
23
+ };
@@ -0,0 +1,10 @@
1
+ import { ToggleGroup as Root } from './ToggleGroup';
2
+ import { ToggleGroupToggle as Toggle } from './ToggleGroupToggle';
3
+ /**
4
+ * A set of two-state buttons that can be toggled on or off within a group context.
5
+ */
6
+ export declare const ToggleGroup: typeof Root & {
7
+ Toggle: typeof Toggle;
8
+ };
9
+ export { type ToggleGroupProps } from './ToggleGroup';
10
+ export { type ToggleGroupToggleProps } from './ToggleGroupToggle';
@@ -0,0 +1,10 @@
1
+ import { ToggleGroup as Root } from './ToggleGroup';
2
+ import { ToggleGroupToggle as Toggle } from './ToggleGroupToggle';
3
+ /**
4
+ * A set of two-state buttons that can be toggled on or off within a group context.
5
+ */
6
+ export declare const ToggleGroup: typeof Root & {
7
+ Toggle: typeof Toggle;
8
+ };
9
+ export { type ToggleGroupProps } from './ToggleGroup';
10
+ export { type ToggleGroupToggleProps } from './ToggleGroupToggle';
@@ -0,0 +1,2 @@
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../chunk-C91j1N6u.js`);const e=require(`../slot/index.js`);let t=require(`class-variance-authority`),n=require(`react/jsx-runtime`),r=require(`@base-ui/react/toggle-group`),i=require(`@base-ui/react/toggle`);function a(t){return t?({...t})=>(0,n.jsx)(e.Slot,{...t}):void 0}var o=({asChild:e=!1,multiple:i=!1,children:o,className:s,ref:c,...l})=>{let u=a(e);return(0,n.jsx)(r.ToggleGroup,{...l,ref:c,multiple:i,className:(0,t.cx)(`gap-none inline-flex`,s),"data-spark-component":`toggle-group`,...e&&{render:u},children:o})};o.displayName=`ToggleGroup`;var s=({asChild:e=!1,value:r,disabled:o=!1,children:s,className:c,ref:l,...u})=>{let d=a(e);return(0,n.jsx)(i.Toggle,{"data-spark-component":`toggle-group-toggle`,ref:l,className:(0,t.cx)(`focus-visible:u-outline-inset`,`disabled:cursor-not-allowed disabled:opacity-dim-3`,c),...e&&{render:d},disabled:o,value:r,...u,children:s})};s.displayName=`ToggleGroup.Toggle`;var c=Object.assign(o,{Toggle:s});c.displayName=`ToggleGroup`,s.displayName=`ToggleGroup.Toggle`,exports.ToggleGroup=c;
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../src/toggle-group/useRenderSlot.tsx","../../src/toggle-group/ToggleGroup.tsx","../../src/toggle-group/ToggleGroupToggle.tsx","../../src/toggle-group/index.ts"],"sourcesContent":["import { Slot } from '../slot'\n\nexport function useRenderSlot(asChild: boolean) {\n return asChild ? ({ ...props }: object) => <Slot {...props} /> : undefined\n}\n","import { ToggleGroup as BaseToggleGroup } from '@base-ui/react/toggle-group'\nimport { cx } from 'class-variance-authority'\nimport { type ComponentPropsWithoutRef, type PropsWithChildren, Ref } from 'react'\n\nimport { useRenderSlot } from './useRenderSlot'\n\nexport interface ToggleGroupProps extends PropsWithChildren, ComponentPropsWithoutRef<'div'> {\n /**\n * Change the component to the HTML tag or custom component of the only child. This will merge the original component props with the props of the supplied element/component and change the underlying DOM node.\n * @default false\n */\n asChild?: boolean\n /**\n * Whether multiple toggles can be pressed at the same time.\n * @default false\n */\n multiple?: boolean\n /**\n * The default value(s) of the toggle group when it is initially rendered.\n * Use when you do not need to control its value(s).\n * Must be an array even for single selection mode.\n */\n defaultValue?: readonly any[]\n /**\n * The controlled value(s) of the toggle group.\n * Must be used in conjunction with `onValueChange`.\n * Must be an array even for single selection mode.\n */\n value?: readonly any[]\n /**\n * Event handler called when the value changes.\n * Always receives an array, even for single selection mode.\n */\n onValueChange?: (value: readonly any[]) => void\n ref?: Ref<HTMLDivElement>\n}\n\nexport const ToggleGroup = ({\n /**\n * Default Base UI Primitive values\n * see https://base-ui.com/react/components/toggle-group\n */\n asChild = false,\n multiple = false,\n children,\n className,\n ref,\n ...rest\n}: ToggleGroupProps) => {\n const renderSlot = useRenderSlot(asChild)\n\n return (\n <BaseToggleGroup\n {...rest}\n ref={ref}\n multiple={multiple}\n className={cx('gap-none inline-flex', className)}\n data-spark-component=\"toggle-group\"\n {...(asChild && { render: renderSlot })}\n >\n {children}\n </BaseToggleGroup>\n )\n}\n\nToggleGroup.displayName = 'ToggleGroup'\n","import { Toggle } from '@base-ui/react/toggle'\nimport { cx } from 'class-variance-authority'\nimport { type ComponentPropsWithoutRef, Ref } from 'react'\n\nimport { useRenderSlot } from './useRenderSlot'\n\nexport interface ToggleGroupToggleProps extends ComponentPropsWithoutRef<'button'> {\n /**\n * A unique value that identifies the toggle within the group.\n */\n value: any\n /**\n * Change the component to the HTML tag or custom component of the only child. This will merge the original component props with the props of the supplied element/component and change the underlying DOM node.\n * @default false\n */\n asChild?: boolean\n /**\n * When true, prevents the user from interacting with the toggle.\n * @default false\n */\n disabled?: boolean\n ref?: Ref<HTMLButtonElement>\n}\n\n/** A toggle button within a toggle group. Renders a <button> element. */\nexport const ToggleGroupToggle = ({\n /**\n * Default Base UI Primitive values\n * see https://base-ui.com/react/components/toggle\n */\n asChild = false,\n value,\n disabled = false,\n children,\n className,\n ref,\n ...rest\n}: ToggleGroupToggleProps) => {\n const renderSlot = useRenderSlot(asChild)\n\n return (\n <Toggle\n data-spark-component=\"toggle-group-toggle\"\n ref={ref}\n className={cx(\n 'focus-visible:u-outline-inset',\n 'disabled:cursor-not-allowed disabled:opacity-dim-3',\n className\n )}\n {...(asChild && { render: renderSlot })}\n disabled={disabled}\n value={value}\n {...rest}\n >\n {children}\n </Toggle>\n )\n}\n\nToggleGroupToggle.displayName = 'ToggleGroup.Toggle'\n","import { ToggleGroup as Root } from './ToggleGroup'\nimport { ToggleGroupToggle as Toggle } from './ToggleGroupToggle'\n\n/**\n * A set of two-state buttons that can be toggled on or off within a group context.\n */\nexport const ToggleGroup: typeof Root & {\n Toggle: typeof Toggle\n} = Object.assign(Root, {\n Toggle,\n})\n\nToggleGroup.displayName = 'ToggleGroup'\nToggle.displayName = 'ToggleGroup.Toggle'\n\nexport { type ToggleGroupProps } from './ToggleGroup'\nexport { type ToggleGroupToggleProps } from './ToggleGroupToggle'\n"],"mappings":"4RAEA,SAAgB,EAAc,EAAkB,CAC9C,OAAO,GAAW,CAAE,GAAG,MAAoB,EAAA,EAAA,KAAC,EAAA,KAAD,CAAM,GAAI,EAAS,CAAA,CAAG,IAAA,GCkCnE,IAAa,GAAe,CAK1B,UAAU,GACV,WAAW,GACX,WACA,YACA,MACA,GAAG,KACmB,CACtB,IAAM,EAAa,EAAc,EAAQ,CAEzC,OACE,EAAA,EAAA,KAAC,EAAA,YAAD,CACE,GAAI,EACC,MACK,WACV,WAAA,EAAA,EAAA,IAAc,uBAAwB,EAAU,CAChD,uBAAqB,eACrB,GAAK,GAAW,CAAE,OAAQ,EAAY,CAErC,WACe,CAAA,EAItB,EAAY,YAAc,cCxC1B,IAAa,GAAqB,CAKhC,UAAU,GACV,QACA,WAAW,GACX,WACA,YACA,MACA,GAAG,KACyB,CAC5B,IAAM,EAAa,EAAc,EAAQ,CAEzC,OACE,EAAA,EAAA,KAAC,EAAA,OAAD,CACE,uBAAqB,sBAChB,MACL,WAAA,EAAA,EAAA,IACE,gCACA,qDACA,EACD,CACD,GAAK,GAAW,CAAE,OAAQ,EAAY,CAC5B,WACH,QACP,GAAI,EAEH,WACM,CAAA,EAIb,EAAkB,YAAc,qBCrDhC,IAAa,EAET,OAAO,OAAO,EAAM,CACtB,OAAA,EACD,CAAC,CAEF,EAAY,YAAc,cAC1B,EAAO,YAAc"}
@@ -0,0 +1,48 @@
1
+ import { Slot as e } from "../slot/index.mjs";
2
+ import { cx as t } from "class-variance-authority";
3
+ import { jsx as n } from "react/jsx-runtime";
4
+ import { ToggleGroup as r } from "@base-ui/react/toggle-group";
5
+ import { Toggle as i } from "@base-ui/react/toggle";
6
+ //#region src/toggle-group/useRenderSlot.tsx
7
+ function a(t) {
8
+ return t ? ({ ...t }) => /* @__PURE__ */ n(e, { ...t }) : void 0;
9
+ }
10
+ //#endregion
11
+ //#region src/toggle-group/ToggleGroup.tsx
12
+ var o = ({ asChild: e = !1, multiple: i = !1, children: o, className: s, ref: c, ...l }) => {
13
+ let u = a(e);
14
+ return /* @__PURE__ */ n(r, {
15
+ ...l,
16
+ ref: c,
17
+ multiple: i,
18
+ className: t("gap-none inline-flex", s),
19
+ "data-spark-component": "toggle-group",
20
+ ...e && { render: u },
21
+ children: o
22
+ });
23
+ };
24
+ o.displayName = "ToggleGroup";
25
+ //#endregion
26
+ //#region src/toggle-group/ToggleGroupToggle.tsx
27
+ var s = ({ asChild: e = !1, value: r, disabled: o = !1, children: s, className: c, ref: l, ...u }) => {
28
+ let d = a(e);
29
+ return /* @__PURE__ */ n(i, {
30
+ "data-spark-component": "toggle-group-toggle",
31
+ ref: l,
32
+ className: t("focus-visible:u-outline-inset", "disabled:cursor-not-allowed disabled:opacity-dim-3", c),
33
+ ...e && { render: d },
34
+ disabled: o,
35
+ value: r,
36
+ ...u,
37
+ children: s
38
+ });
39
+ };
40
+ s.displayName = "ToggleGroup.Toggle";
41
+ //#endregion
42
+ //#region src/toggle-group/index.ts
43
+ var c = Object.assign(o, { Toggle: s });
44
+ c.displayName = "ToggleGroup", s.displayName = "ToggleGroup.Toggle";
45
+ //#endregion
46
+ export { c as ToggleGroup };
47
+
48
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../../src/toggle-group/useRenderSlot.tsx","../../src/toggle-group/ToggleGroup.tsx","../../src/toggle-group/ToggleGroupToggle.tsx","../../src/toggle-group/index.ts"],"sourcesContent":["import { Slot } from '../slot'\n\nexport function useRenderSlot(asChild: boolean) {\n return asChild ? ({ ...props }: object) => <Slot {...props} /> : undefined\n}\n","import { ToggleGroup as BaseToggleGroup } from '@base-ui/react/toggle-group'\nimport { cx } from 'class-variance-authority'\nimport { type ComponentPropsWithoutRef, type PropsWithChildren, Ref } from 'react'\n\nimport { useRenderSlot } from './useRenderSlot'\n\nexport interface ToggleGroupProps extends PropsWithChildren, ComponentPropsWithoutRef<'div'> {\n /**\n * Change the component to the HTML tag or custom component of the only child. This will merge the original component props with the props of the supplied element/component and change the underlying DOM node.\n * @default false\n */\n asChild?: boolean\n /**\n * Whether multiple toggles can be pressed at the same time.\n * @default false\n */\n multiple?: boolean\n /**\n * The default value(s) of the toggle group when it is initially rendered.\n * Use when you do not need to control its value(s).\n * Must be an array even for single selection mode.\n */\n defaultValue?: readonly any[]\n /**\n * The controlled value(s) of the toggle group.\n * Must be used in conjunction with `onValueChange`.\n * Must be an array even for single selection mode.\n */\n value?: readonly any[]\n /**\n * Event handler called when the value changes.\n * Always receives an array, even for single selection mode.\n */\n onValueChange?: (value: readonly any[]) => void\n ref?: Ref<HTMLDivElement>\n}\n\nexport const ToggleGroup = ({\n /**\n * Default Base UI Primitive values\n * see https://base-ui.com/react/components/toggle-group\n */\n asChild = false,\n multiple = false,\n children,\n className,\n ref,\n ...rest\n}: ToggleGroupProps) => {\n const renderSlot = useRenderSlot(asChild)\n\n return (\n <BaseToggleGroup\n {...rest}\n ref={ref}\n multiple={multiple}\n className={cx('gap-none inline-flex', className)}\n data-spark-component=\"toggle-group\"\n {...(asChild && { render: renderSlot })}\n >\n {children}\n </BaseToggleGroup>\n )\n}\n\nToggleGroup.displayName = 'ToggleGroup'\n","import { Toggle } from '@base-ui/react/toggle'\nimport { cx } from 'class-variance-authority'\nimport { type ComponentPropsWithoutRef, Ref } from 'react'\n\nimport { useRenderSlot } from './useRenderSlot'\n\nexport interface ToggleGroupToggleProps extends ComponentPropsWithoutRef<'button'> {\n /**\n * A unique value that identifies the toggle within the group.\n */\n value: any\n /**\n * Change the component to the HTML tag or custom component of the only child. This will merge the original component props with the props of the supplied element/component and change the underlying DOM node.\n * @default false\n */\n asChild?: boolean\n /**\n * When true, prevents the user from interacting with the toggle.\n * @default false\n */\n disabled?: boolean\n ref?: Ref<HTMLButtonElement>\n}\n\n/** A toggle button within a toggle group. Renders a <button> element. */\nexport const ToggleGroupToggle = ({\n /**\n * Default Base UI Primitive values\n * see https://base-ui.com/react/components/toggle\n */\n asChild = false,\n value,\n disabled = false,\n children,\n className,\n ref,\n ...rest\n}: ToggleGroupToggleProps) => {\n const renderSlot = useRenderSlot(asChild)\n\n return (\n <Toggle\n data-spark-component=\"toggle-group-toggle\"\n ref={ref}\n className={cx(\n 'focus-visible:u-outline-inset',\n 'disabled:cursor-not-allowed disabled:opacity-dim-3',\n className\n )}\n {...(asChild && { render: renderSlot })}\n disabled={disabled}\n value={value}\n {...rest}\n >\n {children}\n </Toggle>\n )\n}\n\nToggleGroupToggle.displayName = 'ToggleGroup.Toggle'\n","import { ToggleGroup as Root } from './ToggleGroup'\nimport { ToggleGroupToggle as Toggle } from './ToggleGroupToggle'\n\n/**\n * A set of two-state buttons that can be toggled on or off within a group context.\n */\nexport const ToggleGroup: typeof Root & {\n Toggle: typeof Toggle\n} = Object.assign(Root, {\n Toggle,\n})\n\nToggleGroup.displayName = 'ToggleGroup'\nToggle.displayName = 'ToggleGroup.Toggle'\n\nexport { type ToggleGroupProps } from './ToggleGroup'\nexport { type ToggleGroupToggleProps } from './ToggleGroupToggle'\n"],"mappings":";;;;;;AAEA,SAAgB,EAAc,GAAkB;AAC9C,QAAO,KAAW,EAAE,GAAG,QAAoB,kBAAC,GAAD,EAAM,GAAI,GAAS,CAAA,GAAG,KAAA;;;;ACkCnE,IAAa,KAAe,EAK1B,aAAU,IACV,cAAW,IACX,aACA,cACA,QACA,GAAG,QACmB;CACtB,IAAM,IAAa,EAAc,EAAQ;AAEzC,QACE,kBAAC,GAAD;EACE,GAAI;EACC;EACK;EACV,WAAW,EAAG,wBAAwB,EAAU;EAChD,wBAAqB;EACrB,GAAK,KAAW,EAAE,QAAQ,GAAY;EAErC;EACe,CAAA;;AAItB,EAAY,cAAc;;;ACxC1B,IAAa,KAAqB,EAKhC,aAAU,IACV,UACA,cAAW,IACX,aACA,cACA,QACA,GAAG,QACyB;CAC5B,IAAM,IAAa,EAAc,EAAQ;AAEzC,QACE,kBAAC,GAAD;EACE,wBAAqB;EAChB;EACL,WAAW,EACT,iCACA,sDACA,EACD;EACD,GAAK,KAAW,EAAE,QAAQ,GAAY;EAC5B;EACH;EACP,GAAI;EAEH;EACM,CAAA;;AAIb,EAAkB,cAAc;;;ACrDhC,IAAa,IAET,OAAO,OAAO,GAAM,EACtB,QAAA,GACD,CAAC;AAEF,EAAY,cAAc,eAC1B,EAAO,cAAc"}
@@ -0,0 +1 @@
1
+ export declare function useRenderSlot(asChild: boolean): (({ ...props }: object) => import("react/jsx-runtime").JSX.Element) | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spark-ui/components",
3
- "version": "17.11.3",
3
+ "version": "17.12.0",
4
4
  "license": "MIT",
5
5
  "description": "Spark (Leboncoin design system) components.",
6
6
  "exports": {
@@ -47,10 +47,10 @@
47
47
  "build": "NODE_OPTIONS='--max-old-space-size=8192' vite build"
48
48
  },
49
49
  "dependencies": {
50
- "@base-ui/react": "1.0.0",
51
- "@spark-ui/hooks": "17.11.3",
52
- "@spark-ui/icons": "17.11.3",
53
- "@spark-ui/internal-utils": "17.11.3",
50
+ "@base-ui/react": "^1.5.0",
51
+ "@spark-ui/hooks": "17.12.0",
52
+ "@spark-ui/icons": "17.12.0",
53
+ "@spark-ui/internal-utils": "17.12.0",
54
54
  "@zag-js/pagination": "1.30.0",
55
55
  "@zag-js/react": "1.30.0",
56
56
  "class-variance-authority": "0.7.1",
@@ -62,7 +62,7 @@
62
62
  "react-snap-carousel": "0.5.1"
63
63
  },
64
64
  "peerDependencies": {
65
- "@spark-ui/theme-utils": "17.11.3",
65
+ "@spark-ui/theme-utils": "17.12.0",
66
66
  "react": "19.2.4",
67
67
  "react-dom": "19.2.4",
68
68
  "tailwindcss": "4.1.18"