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

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.
@@ -4,7 +4,7 @@ export declare const NavContext: React.Context<NavContextState>;
4
4
  export declare const NavRail: React.FC<NavRailProps>;
5
5
  export declare const NavBar: React.FC<NavBarProps>;
6
6
  export declare const NavTile: React.FC<NavTileProps>;
7
- export declare const Nav: (() => null) & {
7
+ export declare const Navigation: (() => null) & {
8
8
  Rail: React.FC<NavRailProps>;
9
9
  Bar: React.FC<NavBarProps>;
10
10
  Tile: React.FC<NavTileProps>;
@@ -96,7 +96,7 @@ children }) => {
96
96
  return (_jsxs(TileElement, { className: `${base} ${width} ${rounded} ${rxBackground} ${rxMode}`, href: href, target: target, type: TileElement === 'button' ? type : undefined, title: title, role: role, onClick: onClickHandler, "data-parent": ctx.parent, "data-expanded": ctx.expanded, "data-testid": "nav-tile", children: [children && _jsx("div", { children: children }), label && !ctx.expanded && (_jsx("div", { className: `${labelBase} ${labelClasses}`, "data-testid": "nav-tile-label", children: label })), labelExpanded && ctx.expanded && (_jsx("div", { className: `${labelExpandedBase} ${labelExpandedClasses}`, "data-testid": "nav-tile-label-expanded", children: labelExpanded }))] }));
97
97
  };
98
98
  // Exports ---
99
- export const Nav = Object.assign(() => null, {
99
+ export const Navigation = Object.assign(() => null, {
100
100
  Rail: NavRail,
101
101
  Bar: NavBar,
102
102
  Tile: NavTile
@@ -3,7 +3,7 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
3
3
  import { useId } from 'react';
4
4
  import * as pagination from '@zag-js/pagination';
5
5
  import { useMachine, normalizeProps } from '@zag-js/react';
6
- export const Pagination = ({ data, alternative = false, textSeparator = 'of',
6
+ export const Pagination = ({ data, alternative = false, textSeparator = 'of', showFirstLastButtons = false,
7
7
  // Titles
8
8
  titleFirst, titlePrevious, titleNumeral, titleNext, titleLast,
9
9
  // Root
@@ -24,7 +24,7 @@ labelFirst = '\u00AB', labelPrevious = '\u2190', labelEllipsis = '\u22EF', label
24
24
  const rxButtonActive = (page) => {
25
25
  return state.context.page === page.value ? buttonActive : `${buttonInactive} ${buttonHover}`;
26
26
  };
27
- return (_jsx(_Fragment, { children: api.totalPages > 1 && (_jsxs("div", { ...api.getRootProps(), className: `${base} ${background} ${border} ${gap} ${padding} ${rounded} ${classes}`, "data-testid": "pagination", children: [alternative && (_jsx("button", { type: "button", onClick: api.goToFirstPage, className: `${buttonBase} ${buttonInactive} ${buttonHover} ${buttonClasses}`, title: titleFirst, disabled: api.page === 1, "data-testid": "pagination-button-previous", children: labelFirst })), _jsx("button", { type: "button", ...api.getPrevTriggerProps(), className: `${buttonBase} ${buttonInactive} ${buttonHover} ${buttonClasses}`, title: titlePrevious, disabled: api.page === 1, "data-testid": "pagination-button-previous", children: labelPrevious }), !alternative &&
27
+ return (_jsx(_Fragment, { children: api.totalPages > 1 && (_jsxs("div", { ...api.getRootProps(), className: `${base} ${background} ${border} ${gap} ${padding} ${rounded} ${classes}`, "data-testid": "pagination", children: [showFirstLastButtons && (_jsx("button", { type: "button", onClick: api.goToFirstPage, className: `${buttonBase} ${buttonInactive} ${buttonHover} ${buttonClasses}`, title: titleFirst, disabled: api.page === 1, "data-testid": "pagination-button-first", children: labelFirst })), _jsx("button", { type: "button", ...api.getPrevTriggerProps(), className: `${buttonBase} ${buttonInactive} ${buttonHover} ${buttonClasses}`, title: titlePrevious, disabled: api.page === 1, "data-testid": "pagination-button-previous", children: labelPrevious }), !alternative &&
28
28
  api.pages.map((page, i) => {
29
29
  if (page.type === 'page')
30
30
  return (
@@ -34,5 +34,5 @@ labelFirst = '\u00AB', labelPrevious = '\u2190', labelEllipsis = '\u22EF', label
34
34
  return (
35
35
  // Ellipsis
36
36
  _jsx("span", { ...api.getEllipsisProps({ index: i }), className: `${buttonBase} ${buttonInactive} ${buttonClasses}`, "data-testid": "pagination-ellipsis", children: labelEllipsis }, `ellipsis-${i}`));
37
- }), alternative && (_jsxs("span", { className: `${buttonBase} ${buttonInactive} ${buttonClasses}`, "data-testid": "pagination-alt-ui", children: [_jsxs("span", { children: [api.pageRange.start + 1, " - ", api.pageRange.end] }), _jsxs("span", { className: "opacity-60", children: [api.page, " ", textSeparator, " ", api.totalPages] })] })), _jsx("button", { type: "button", ...api.getNextTriggerProps(), className: `${buttonBase} ${buttonInactive} ${buttonHover} ${buttonClasses}`, title: titleNext, disabled: !api.nextPage, "data-testid": "pagination-button-next", children: labelNext }), alternative && (_jsx("button", { type: "button", onClick: api.goToLastPage, className: `${buttonBase} ${buttonInactive} ${buttonHover} ${buttonClasses}`, title: titleLast, disabled: !api.nextPage, "data-testid": "pagination-button-previous", children: labelLast }))] })) }));
37
+ }), alternative && (_jsxs("span", { className: `${buttonBase} ${buttonInactive} ${buttonClasses}`, "data-testid": "pagination-alt-ui", children: [_jsxs("span", { children: [api.pageRange.start + 1, " - ", api.pageRange.end] }), _jsxs("span", { className: "opacity-60", children: [api.page, " ", textSeparator, " ", api.totalPages] })] })), _jsx("button", { type: "button", ...api.getNextTriggerProps(), className: `${buttonBase} ${buttonInactive} ${buttonHover} ${buttonClasses}`, title: titleNext, disabled: !api.nextPage, "data-testid": "pagination-button-next", children: labelNext }), showFirstLastButtons && (_jsx("button", { type: "button", onClick: api.goToLastPage, className: `${buttonBase} ${buttonInactive} ${buttonHover} ${buttonClasses}`, title: titleLast, disabled: !api.nextPage, "data-testid": "pagination-button-last", children: labelLast }))] })) }));
38
38
  };
@@ -5,6 +5,8 @@ export interface PaginationProps extends Omit<pagination.Context, 'id'> {
5
5
  alternative?: boolean;
6
6
  /** Set the separator text or character, such as "of" in "X of Y". */
7
7
  textSeparator?: string;
8
+ /** Show first and last page button. */
9
+ showFirstLastButtons?: boolean;
8
10
  /** Set an optional title for the first button. */
9
11
  titleFirst?: string;
10
12
  /** Set an optional title for the previous button. */
@@ -3,7 +3,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import { useId } from 'react';
4
4
  import { normalizeProps, useMachine } from '@zag-js/react';
5
5
  import * as progress from '@zag-js/progress';
6
- export const ProgressRing = ({ label, strokeWidth = '10px', strokeLinecap = 'round',
6
+ export const ProgressRing = ({ label, showLabel = false, strokeWidth = '10px', strokeLinecap = 'round',
7
7
  // Root
8
8
  base = 'relative', size = 'size-32', classes = '',
9
9
  // Slot
@@ -27,5 +27,5 @@ children,
27
27
  // Reactive Classes
28
28
  const rxAnimCircle = api.indeterminate ? 'animate-spin' : '';
29
29
  const rxAnimMeter = api.indeterminate ? meterAnimate : '';
30
- return (_jsxs("figure", { ...api.getRootProps(), className: `${base} ${size} ${classes}`, "data-testid": "progress-ring", children: [_jsx("div", { ...api.getLabelProps(), className: `${childrenBase} ${size} ${childrenClasses}`, "data-testid": "progress-ring-children", children: children }), _jsxs("svg", { ...api.getCircleProps(), className: `${svgBase} ${svgClasses} ${rxAnimCircle}`, style: { '--size': '100%', '--thickness': strokeWidth }, "data-testid": "progress-ring-svg", children: [_jsx("circle", { ...api.getCircleTrackProps(), className: `${trackBase} ${trackStroke} ${trackClasses}`, "data-testid": "progress-ring-track" }), _jsx("circle", { ...api.getCircleRangeProps(), className: `${meterBase} ${meterStroke} ${meterTransition} ${meterDuration} ${meterClasses} ${rxAnimMeter}`, strokeLinecap: strokeLinecap, "data-testid": "progress-ring-meter" }), api.value !== null && !children && (_jsx("text", { className: `${labelBase} ${labelFill} ${labelClasses}`, x: "50%", y: "50%", fontSize: labelFontSize, fontWeight: labelFontWeight, textAnchor: "middle", dominantBaseline: "central", "data-testid": "progress-ring-label", children: label ?? `${api.value}%` }))] })] }));
30
+ return (_jsxs("figure", { ...api.getRootProps(), className: `${base} ${size} ${classes}`, "data-testid": "progress-ring", children: [_jsx("div", { ...api.getLabelProps(), className: `${childrenBase} ${size} ${childrenClasses}`, "data-testid": "progress-ring-children", children: children }), _jsxs("svg", { ...api.getCircleProps(), className: `${svgBase} ${svgClasses} ${rxAnimCircle}`, style: { '--size': '100%', '--thickness': strokeWidth }, "data-testid": "progress-ring-svg", children: [_jsx("circle", { ...api.getCircleTrackProps(), className: `${trackBase} ${trackStroke} ${trackClasses}`, "data-testid": "progress-ring-track" }), _jsx("circle", { ...api.getCircleRangeProps(), className: `${meterBase} ${meterStroke} ${meterTransition} ${meterDuration} ${meterClasses} ${rxAnimMeter}`, strokeLinecap: strokeLinecap, "data-testid": "progress-ring-meter" }), api.value !== null && !children && showLabel && (_jsx("text", { className: `${labelBase} ${labelFill} ${labelClasses}`, x: "50%", y: "50%", fontSize: labelFontSize, fontWeight: labelFontWeight, textAnchor: "middle", dominantBaseline: "central", "data-testid": "progress-ring-label", children: label ?? `${api.value}%` }))] })] }));
31
31
  };
@@ -2,6 +2,8 @@ import * as progress from '@zag-js/progress';
2
2
  export interface ProgressRingProps extends React.PropsWithChildren, Omit<progress.Context, 'id'> {
3
3
  /** Set the text for the scalable label */
4
4
  label?: string;
5
+ /** When enabled, show a text label with the percentage amount */
6
+ showLabel?: boolean;
5
7
  /** Set the stroke size (ex: 15px) */
6
8
  strokeWidth?: string;
7
9
  /** Defines the shape of the meter */
package/dist/index.d.ts CHANGED
@@ -2,7 +2,7 @@ export { Accordion } from './components/Accordion/Accordion.js';
2
2
  export { Avatar } from './components/Avatar/Avatar.js';
3
3
  export { AppBar } from './components/AppBar/AppBar.js';
4
4
  export { FileUpload } from './components/FileUpload/FileUpload.js';
5
- export { Nav } from './components/Navigation/Navigation.js';
5
+ export { Navigation } from './components/Navigation/Navigation.js';
6
6
  export { Pagination } from './components/Pagination/Pagination.js';
7
7
  export { Progress } from './components/Progress/Progress.js';
8
8
  export { ProgressRing } from './components/ProgressRing/ProgressRing.js';
package/dist/index.js CHANGED
@@ -3,7 +3,7 @@ export { Accordion } from './components/Accordion/Accordion.js';
3
3
  export { Avatar } from './components/Avatar/Avatar.js';
4
4
  export { AppBar } from './components/AppBar/AppBar.js';
5
5
  export { FileUpload } from './components/FileUpload/FileUpload.js';
6
- export { Nav } from './components/Navigation/Navigation.js';
6
+ export { Navigation } from './components/Navigation/Navigation.js';
7
7
  export { Pagination } from './components/Pagination/Pagination.js';
8
8
  export { Progress } from './components/Progress/Progress.js';
9
9
  export { ProgressRing } from './components/ProgressRing/ProgressRing.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@skeletonlabs/skeleton-react",
3
- "version": "1.0.0-next.10",
3
+ "version": "1.0.0-next.11",
4
4
  "type": "module",
5
5
  "types": "./dist/index.d.ts",
6
6
  "exports": {