@skeletonlabs/skeleton-react 1.0.0-next.11 → 1.0.0-next.12

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.
@@ -17,7 +17,8 @@ labelFirst = '\u00AB', labelPrevious = '\u2190', labelEllipsis = '\u22EF', label
17
17
  // Zag
18
18
  const [state, send] = useMachine(pagination.machine({
19
19
  id: useId(),
20
- count: data.length
20
+ // Use 'count' if specified; required for server-side pagination.
21
+ count: zagProps.count ?? data.length
21
22
  }), { context: zagProps });
22
23
  const api = pagination.connect(state, send, normalizeProps);
23
24
  // Reactive
@@ -1,7 +1,11 @@
1
1
  import { ReactNode } from 'react';
2
2
  import * as pagination from '@zag-js/pagination';
3
- export interface PaginationProps extends Omit<pagination.Context, 'id'> {
3
+ export interface PaginationProps extends Omit<pagination.Context, 'id' | 'count'> {
4
+ /** Provide source data as an array. */
4
5
  data: unknown[];
6
+ /** Total number of data items. Required for server-side pagination. */
7
+ count?: number;
8
+ /** Enables alternative display with stats and first/last buttons. */
5
9
  alternative?: boolean;
6
10
  /** Set the separator text or character, such as "of" in "X of Y". */
7
11
  textSeparator?: string;
@@ -1,5 +1,5 @@
1
1
  'use client';
2
- import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import * as rating from '@zag-js/rating-group';
4
4
  import { useMachine, normalizeProps } from '@zag-js/react';
5
5
  import { useId } from 'react';
@@ -11,7 +11,7 @@ base = '', classes = '',
11
11
  // Control
12
12
  controlBase = 'flex', controlGap = 'gap-2', controlClasses,
13
13
  // Label
14
- labelBase = '', labelClasses = '',
14
+ labelBase = 'label-text', labelClasses = '',
15
15
  // Item
16
16
  itemBase = '', itemClasses = '',
17
17
  // State
@@ -47,6 +47,6 @@ onValueChange = noop,
47
47
  return iconFull;
48
48
  }
49
49
  })();
50
- return (_jsx(_Fragment, { children: _jsx("span", { ...api.getItemProps({ index: item }), className: `${itemBase} ${itemClasses}`, "data-testid": "rating-item", children: icon }, item) }));
50
+ return (_jsx("span", { ...api.getItemProps({ index: item }), className: `${itemBase} ${itemClasses}`, "data-testid": "rating-item", children: icon }, item));
51
51
  }) }), _jsx("input", { ...api.getHiddenInputProps(), "data-testid": "rating-input" })] }));
52
52
  };
@@ -19,6 +19,8 @@ orientVertical = 'flex-col', orientHorizontal = 'flex-row', stateDisabled = 'dis
19
19
  indicatorBase = 'top-[var(--top)] left-[var(--left)] w-[var(--width)] h-[var(--height)]', indicatorBg = 'preset-filled', indicatorText = 'text-surface-contrast-950 dark:text-surface-contrast-50', indicatorRounded = 'rounded', indicatorClasses = '',
20
20
  // Events
21
21
  onValueChange = noop,
22
+ // Label
23
+ labelledby = '',
22
24
  // Children
23
25
  children,
24
26
  // Zag
@@ -36,7 +38,7 @@ children,
36
38
  const rxOrientation = state.context.orientation === 'vertical' ? orientVertical : orientHorizontal;
37
39
  const rxDisabled = state.context.disabled ? stateDisabled : '';
38
40
  const rxReadOnly = state.context.readOnly ? stateReadOnly : '';
39
- return (_jsxs("div", { ...api.getRootProps(), className: `${base} ${rxOrientation} ${background} ${border} ${padding} ${gap} ${rounded} ${width} ${rxDisabled} ${rxReadOnly} ${classes}`, "data-testid": "segment", children: [_jsx("div", { ...api.getIndicatorProps(), className: `${indicatorBase} ${indicatorBg} ${indicatorRounded} ${indicatorClasses}`, "data-testid": "segment-indicator" }), _jsx(SegmentContext.Provider, { value: ctx, children: children })] }));
41
+ return (_jsxs("div", { ...api.getRootProps(), className: `${base} ${rxOrientation} ${background} ${border} ${padding} ${gap} ${rounded} ${width} ${rxDisabled} ${rxReadOnly} ${classes}`, "data-testid": "segment", "aria-labelledby": labelledby, children: [_jsx("div", { ...api.getIndicatorProps(), className: `${indicatorBase} ${indicatorBg} ${indicatorRounded} ${indicatorClasses}`, "data-testid": "segment-indicator" }), _jsx(SegmentContext.Provider, { value: ctx, children: children })] }));
40
42
  };
41
43
  const SegmentItem = ({
42
44
  // Root
@@ -26,11 +26,11 @@ export interface SegmentProps extends React.PropsWithChildren, Omit<radio.Contex
26
26
  classes?: string;
27
27
  /** Set classes to provide a vertical layout. */
28
28
  orientVertical?: string;
29
- /** Set classes to provide a horizintal layout. */
29
+ /** Set classes to provide a horizontal layout. */
30
30
  orientHorizontal?: string;
31
- /** Set claseses for the disabled state. */
31
+ /** Set classes for the disabled state. */
32
32
  stateDisabled?: string;
33
- /** Set claseses for the read-only state. */
33
+ /** Set classes for the read-only state. */
34
34
  stateReadOnly?: string;
35
35
  /** Sets base classes to the indicator. */
36
36
  indicatorBase?: string;
@@ -42,6 +42,8 @@ export interface SegmentProps extends React.PropsWithChildren, Omit<radio.Contex
42
42
  indicatorRounded?: string;
43
43
  /** Provide arbitrary CSS classes to the indicator. */
44
44
  indicatorClasses?: string;
45
+ /** Set aria-labelledby for element */
46
+ labelledby?: string;
45
47
  /** Triggers when the value state is changed. */
46
48
  onValueChange?: (value: string) => void;
47
49
  }
@@ -14,7 +14,7 @@ trackBase = 'overflow-hidden', trackBg = 'bg-surface-200-800', trackRounded = 'r
14
14
  // Meter ---
15
15
  meterBase = '', meterBg = 'bg-surface-950-50', materRounded = 'rounded-container', meterClasses = '',
16
16
  // Thumb ---
17
- thumbBase = 'ring-inset transition-scale duration-100 ease-in-out', thumbSize = 'size-8 md:size-5', thumbBg = 'bg-surface-50-950', thumbRingSize = 'ring-2', thumbRingColor = 'ring-surface-950-50', thumbRounded = 'rounded-full', thumbScale = 'hover:scale-125', thumbCursor = 'hover:cursor-pointer', thumbClasses = '',
17
+ thumbBase = 'ring-inset transition-scale duration-100 ease-in-out', thumbSize = 'size-8 md:size-5', thumbBg = 'bg-surface-50-950', thumbRingSize = 'ring-2', thumbRingColor = 'ring-surface-950-50', thumbRounded = 'rounded-full', thumbCursor = 'hover:cursor-pointer', thumbClasses = '',
18
18
  // Markers ---
19
19
  markersBase = '', markerslasses = '',
20
20
  // Mark ---
@@ -36,7 +36,7 @@ mark,
36
36
  const api = slider.connect(state, send, normalizeProps);
37
37
  // Reactive
38
38
  const rxDisabled = state.context.disabled ? stateDisabled : '';
39
- const rxReadOnly = state.context.readOnly ? stateReadOnly : `${thumbScale} ${thumbCursor}`;
39
+ const rxReadOnly = state.context.readOnly ? stateReadOnly : thumbCursor;
40
40
  return (_jsxs("div", { ...api.getRootProps(), className: `${base} ${height} ${rxDisabled} ${classes}`, "data-testid": "slider", children: [_jsxs("div", { ...api.getControlProps(), className: `${controlBase} ${controlClasses}`, "data-testid": "slider-control", children: [_jsx("div", { ...api.getTrackProps(), className: `${trackBase} ${trackBg} ${height} ${trackRounded} ${trackClasses}`, "data-testid": "slider-track", children: _jsx("div", { ...api.getRangeProps(), className: `${meterBase} ${height} ${meterBg} ${materRounded} ${meterClasses}`, "data-testid": "slider-meter" }) }), _jsx("div", { className: `${height}`, style: { display: 'flex', alignItems: 'center', transform: 'translateY(-100%)' }, "data-testid": "slider-thumb-wrapper", children: api.value.map((_, index) => (_jsxs("div", { ...api.getThumbProps({ index }), children: [_jsx("div", { className: `${thumbBase} ${thumbSize} ${thumbBg} ${thumbRingSize} ${thumbRingColor} ${thumbRounded} ${rxReadOnly} ${thumbClasses}`, "data-testid": "slider-thumb" }), _jsx("input", { ...api.getHiddenInputProps({ index }), "data-testid": "slider-input" })] }, index))) })] }), markers.length > 0 && (_jsx("div", { ...api.getMarkerGroupProps(), className: `${markersBase} ${markerslasses}`, "data-testid": "slider-markers", children: markers.map((value) => (
41
41
  // Mark
42
42
  _jsx("span", { ...api.getMarkerProps({ value }), className: `${markBase} ${markText} ${markOpacity} ${markClasses}`, "data-testid": "slider-mark", children: mark ? mark : value }, value))) }))] }));
@@ -41,8 +41,6 @@ export interface SliderProps extends Omit<slider.Context, 'id' | 'onValueChange'
41
41
  thumbRingColor?: string;
42
42
  /** Set border-radius classes for the thumb. */
43
43
  thumbRounded?: string;
44
- /** Set scale classes for the thumb. */
45
- thumbScale?: string;
46
44
  /** Set cursor classes for the thumb. */
47
45
  thumbCursor?: string;
48
46
  /** Provide arbitrary classes for the thumb. */
@@ -8,7 +8,7 @@ export const Switch = ({ name = '', checked = false, disabled = false, compact =
8
8
  // Root (Track)
9
9
  base = 'inline-flex items-center gap-4',
10
10
  // State
11
- stateFocused = '[&>span]:focused', classes = '',
11
+ stateFocused = 'data-[focus-visible]:focused', classes = '',
12
12
  // Control
13
13
  controlBase = 'cursor-pointer transition duration-200', controlInactive = 'preset-filled-surface-200-800', controlActive = 'preset-filled-primary-500', controlDisabled = 'opacity-50 cursor-not-allowed', controlWidth = 'w-10', controlHeight = 'h-6', controlPadding = 'p-0.5', controlRounded = 'rounded-full', controlHover = 'hover:brightness-90 dark:hover:brightness-110', controlClasses = '',
14
14
  // Thumb
@@ -47,5 +47,5 @@ children, inactiveChild, activeChild }) => {
47
47
  const rxThumbState = api.checked ? `${thumbActive} ${thumbTranslateX}` : thumbInactive;
48
48
  const rxDisabled = api.disabled ? controlDisabled : '';
49
49
  const rxFocused = api.focused ? stateFocused : '';
50
- return (_jsxs("label", { ...api.getRootProps(), className: `${base} ${rxFocused} ${classes}`, "data-testid": "switch", children: [_jsx("input", { ...api.getHiddenInputProps(), "data-testid": "switch-input" }), _jsx("span", { ...api.getControlProps(), className: `${controlBase} ${rxTrackState} ${controlWidth} ${controlHeight} ${controlPadding} ${controlRounded} ${controlHover} ${rxDisabled} ${controlClasses}`, "data-testid": "switch-control", children: _jsxs("span", { ...api.getThumbProps(), className: `${thumbBase} ${rxThumbState} ${thumbRounded} ${thumbTransition} ${thumbEase} ${thumbDuration} ${thumbClasses}`, "data-testid": "switch-thumb", children: [!checked && inactiveChild ? (_jsx("span", { className: iconInactiveBase, "data-testid": "switch-icon-inactive", children: inactiveChild })) : null, checked && activeChild ? (_jsx("span", { className: iconActiveBase, "data-testid": "switch-icon-active", children: activeChild })) : null] }) }), _jsx("span", { ...api.getLabelProps(), className: `${labelBase} ${labelClasses}`, "data-testid": "switch-label", children: children })] }));
50
+ return (_jsxs("label", { ...api.getRootProps(), className: `${base} ${classes}`, "data-testid": "switch", children: [_jsx("input", { ...api.getHiddenInputProps(), "data-testid": "switch-input" }), _jsx("span", { ...api.getControlProps(), className: `${controlBase} ${rxTrackState} ${rxFocused} ${controlWidth} ${controlHeight} ${controlPadding} ${controlRounded} ${controlHover} ${rxDisabled} ${controlClasses}`, "data-testid": "switch-control", children: _jsxs("span", { ...api.getThumbProps(), className: `${thumbBase} ${rxThumbState} ${thumbRounded} ${thumbTransition} ${thumbEase} ${thumbDuration} ${thumbClasses}`, "data-testid": "switch-thumb", children: [!checked && inactiveChild ? (_jsx("span", { className: iconInactiveBase, "data-testid": "switch-icon-inactive", children: inactiveChild })) : null, checked && activeChild ? (_jsx("span", { className: iconActiveBase, "data-testid": "switch-icon-active", children: activeChild })) : null] }) }), children ? (_jsx("span", { ...api.getLabelProps(), className: `${labelBase} ${labelClasses}`, "data-testid": "switch-label", children: children })) : null] }));
51
51
  };
@@ -1,4 +1,4 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  export const starEmpty = (_jsx("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", strokeWidth: "1.5", stroke: "currentColor", height: "24", width: "24", children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M11.48 3.499a.562.562 0 0 1 1.04 0l2.125 5.111a.563.563 0 0 0 .475.345l5.518.442c.499.04.701.663.321.988l-4.204 3.602a.563.563 0 0 0-.182.557l1.285 5.385a.562.562 0 0 1-.84.61l-4.725-2.885a.562.562 0 0 0-.586 0L6.982 20.54a.562.562 0 0 1-.84-.61l1.285-5.386a.562.562 0 0 0-.182-.557l-4.204-3.602a.562.562 0 0 1 .321-.988l5.518-.442a.563.563 0 0 0 .475-.345L11.48 3.5Z" }) }));
3
- export const starHalf = (_jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", height: "24", width: "24", children: [_jsx("defs", { children: _jsxs("linearGradient", { id: "half-fill", children: [_jsx("stop", { offset: "50%", stopColor: "currentColor" }), _jsx("stop", { offset: "50%", stopColor: "transparent" })] }) }), _jsx("path", { fill: "url(#half-fill)", d: "M10.788 3.21c.448-1.077 1.976-1.077 2.424 0l2.082 5.006 5.404.434c1.164.093 1.636 1.545.749 2.305l-4.117 3.527 1.257 5.273c.271 1.136-.964 2.033-1.96 1.425L12 18.354 7.373 21.18c-.996.608-2.231-.29-1.96-1.425l1.257-5.273-4.117-3.527c-.887-.76-.415-2.212.749-2.305l5.404-.434 2.082-5.005Z" })] }));
3
+ export const starHalf = (_jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", strokeWidth: "1.5", stroke: "currentColor", height: "24", width: "24", children: [_jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M11.48 3.499a.562.562 0 0 1 1.04 0l2.125 5.111a.563.563 0 0 0 .475.345l5.518.442c.499.04.701.663.321.988l-4.204 3.602a.563.563 0 0 0-.182.557l1.285 5.385a.562.562 0 0 1-.84.61l-4.725-2.885a.562.562 0 0 0-.586 0L6.982 20.54a.562.562 0 0 1-.84-.61l1.285-5.386a.562.562 0 0 0-.182-.557l-4.204-3.602a.562.562 0 0 1 .321-.988l5.518-.442a.563.563 0 0 0 .475-.345L11.48 3.5Z" }), _jsx("defs", { children: _jsxs("linearGradient", { id: "half-fill", children: [_jsx("stop", { offset: "50%", stopColor: "currentColor" }), _jsx("stop", { offset: "50%", stopColor: "transparent" })] }) }), _jsx("path", { fill: "url(#half-fill)", d: "M10.788 3.21c.448-1.077 1.976-1.077 2.424 0l2.082 5.006 5.404.434c1.164.093 1.636 1.545.749 2.305l-4.117 3.527 1.257 5.273c.271 1.136-.964 2.033-1.96 1.425L12 18.354 7.373 21.18c-.996.608-2.231-.29-1.96-1.425l1.257-5.273-4.117-3.527c-.887-.76-.415-2.212.749-2.305l5.404-.434 2.082-5.005Z" })] }));
4
4
  export const starFull = (_jsx("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", height: "24", width: "24", children: _jsx("path", { fillRule: "evenodd", d: "M10.788 3.21c.448-1.077 1.976-1.077 2.424 0l2.082 5.006 5.404.434c1.164.093 1.636 1.545.749 2.305l-4.117 3.527 1.257 5.273c.271 1.136-.964 2.033-1.96 1.425L12 18.354 7.373 21.18c-.996.608-2.231-.29-1.96-1.425l1.257-5.273-4.117-3.527c-.887-.76-.415-2.212.749-2.305l5.404-.434 2.082-5.005Z", clipRule: "evenodd" }) }));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@skeletonlabs/skeleton-react",
3
- "version": "1.0.0-next.11",
3
+ "version": "1.0.0-next.12",
4
4
  "type": "module",
5
5
  "types": "./dist/index.d.ts",
6
6
  "exports": {
@@ -29,45 +29,45 @@
29
29
  "!./dist/schemas.d.ts"
30
30
  ],
31
31
  "dependencies": {
32
- "@zag-js/accordion": "^0.75.0",
33
- "@zag-js/avatar": "^0.75.0",
34
- "@zag-js/file-upload": "^0.75.0",
35
- "@zag-js/pagination": "^0.75.0",
36
- "@zag-js/progress": "^0.75.0",
37
- "@zag-js/radio-group": "^0.75.0",
38
- "@zag-js/rating-group": "^0.75.0",
39
- "@zag-js/react": "^0.75.0",
40
- "@zag-js/slider": "^0.75.0",
41
- "@zag-js/switch": "^0.75.0",
42
- "@zag-js/tabs": "^0.75.0",
43
- "@zag-js/tags-input": "^0.75.0"
32
+ "@zag-js/accordion": "^0.78.3",
33
+ "@zag-js/avatar": "^0.78.3",
34
+ "@zag-js/file-upload": "^0.78.3",
35
+ "@zag-js/pagination": "^0.78.3",
36
+ "@zag-js/progress": "^0.78.3",
37
+ "@zag-js/radio-group": "^0.78.3",
38
+ "@zag-js/rating-group": "^0.78.3",
39
+ "@zag-js/react": "^0.78.3",
40
+ "@zag-js/slider": "^0.78.3",
41
+ "@zag-js/switch": "^0.78.3",
42
+ "@zag-js/tabs": "^0.78.3",
43
+ "@zag-js/tags-input": "^0.78.3"
44
44
  },
45
45
  "peerDependencies": {
46
- "react": "^18.0.0",
47
- "react-dom": "^18.0.0"
46
+ "react": "^18.0.0 || ^19.0.0",
47
+ "react-dom": "^18.0.0 || ^19.0.0"
48
48
  },
49
49
  "devDependencies": {
50
50
  "@tailwindcss/forms": "^0.5.9",
51
- "@testing-library/jest-dom": "^6.6.2",
51
+ "@testing-library/jest-dom": "^6.6.3",
52
52
  "@testing-library/react": "^16.0.1",
53
53
  "@testing-library/user-event": "^14.5.2",
54
- "@types/react": "^18.3.12",
54
+ "@types/react": "^18.3.13",
55
55
  "@types/react-dom": "^18.3.1",
56
- "@vitejs/plugin-react": "^4.3.3",
56
+ "@vitejs/plugin-react": "^4.3.4",
57
57
  "autoprefixer": "^10.4.20",
58
58
  "jsdom": "^25.0.1",
59
- "lucide-react": "^0.453.0",
60
- "postcss": "^8.4.47",
59
+ "lucide-react": "^0.465.0",
60
+ "postcss": "^8.4.49",
61
61
  "react": "^18.3.1",
62
62
  "react-dom": "^18.3.1",
63
- "react-router-dom": "^6.27.0",
64
- "tailwindcss": "^3.4.14",
63
+ "react-router-dom": "^7.0.2",
64
+ "tailwindcss": "^3.4.16",
65
65
  "typescript": "^5.6.3",
66
- "vite": "^5.4.10",
66
+ "vite": "^6.0.2",
67
67
  "vite-plugin-remix-router": "^2.0.0",
68
- "vitest": "^2.1.3",
69
- "@skeletonlabs/skeleton": "3.0.0-next.9",
70
- "vite-plugin-tw-plugin-watcher": "0.0.1-next.0"
68
+ "vitest": "^2.1.8",
69
+ "vite-plugin-tw-plugin-watcher": "0.0.1-next.0",
70
+ "@skeletonlabs/skeleton": "3.0.0-next.10"
71
71
  },
72
72
  "scripts": {
73
73
  "dev": "vite",
@@ -75,6 +75,6 @@
75
75
  "preview": "vite preview",
76
76
  "package": "tsc --project tsconfig.package.json",
77
77
  "package:watch": "tsc --project tsconfig.package.json --watch --preserveWatchOutput",
78
- "test": "vitest"
78
+ "test": "vitest run"
79
79
  }
80
80
  }