@pallasoft/ps-core-components 2.22.1 → 2.24.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.
Files changed (69) hide show
  1. package/dist/components/ps-active-filter-chip.js +1 -1
  2. package/dist/components/ps-badge.js +1 -1
  3. package/dist/components/ps-drag-grip.d.ts +1 -0
  4. package/dist/components/ps-drag-grip.js +6 -0
  5. package/dist/components/ps-drag-overlay.d.ts +7 -0
  6. package/dist/components/ps-drag-overlay.js +34 -0
  7. package/dist/components/ps-draggable-grid.js +16 -39
  8. package/dist/components/ps-empty-state.js +1 -1
  9. package/dist/components/ps-fab.js +1 -1
  10. package/dist/components/ps-form-fields-skeleton.js +1 -1
  11. package/dist/components/ps-icon-button.d.ts +3 -1
  12. package/dist/components/ps-icon-button.js +1 -1
  13. package/dist/components/ps-icon-link.d.ts +3 -1
  14. package/dist/components/ps-icon-link.js +2 -2
  15. package/dist/components/ps-pill.js +1 -1
  16. package/dist/components/ps-section-header.js +1 -1
  17. package/dist/components/ps-site-header.js +1 -1
  18. package/dist/components/ps-sortable-list.d.ts +22 -0
  19. package/dist/components/ps-sortable-list.js +79 -0
  20. package/dist/components/ps-start-preview.js +1 -1
  21. package/dist/components/ps-theme-controller.js +1 -1
  22. package/dist/components/ps-theme-toggle.js +1 -1
  23. package/dist/constants/ps-button-classes.d.ts +1 -1
  24. package/dist/constants/ps-button-classes.js +4 -4
  25. package/dist/constants/ps-drag-config.d.ts +18 -0
  26. package/dist/constants/ps-drag-config.js +30 -0
  27. package/dist/constants/ps-draggable-grid.d.ts +1 -1
  28. package/dist/constants/ps-draggable-grid.js +4 -18
  29. package/dist/constants/ps-icon-action-config.d.ts +5 -0
  30. package/dist/constants/ps-icon-action-config.js +7 -2
  31. package/dist/constants/ps-pallasoft-sign-in-classes.d.ts +5 -5
  32. package/dist/constants/ps-pallasoft-sign-in-classes.js +5 -5
  33. package/dist/constants/ps-skeleton-config.js +1 -1
  34. package/dist/esm/components/ps-active-filter-chip.js +1 -1
  35. package/dist/esm/components/ps-badge.js +1 -1
  36. package/dist/esm/components/ps-drag-grip.js +2 -0
  37. package/dist/esm/components/ps-drag-overlay.js +30 -0
  38. package/dist/esm/components/ps-draggable-grid.js +20 -43
  39. package/dist/esm/components/ps-empty-state.js +1 -1
  40. package/dist/esm/components/ps-fab.js +1 -1
  41. package/dist/esm/components/ps-form-fields-skeleton.js +1 -1
  42. package/dist/esm/components/ps-icon-button.js +1 -1
  43. package/dist/esm/components/ps-icon-link.js +2 -2
  44. package/dist/esm/components/ps-pill.js +1 -1
  45. package/dist/esm/components/ps-section-header.js +1 -1
  46. package/dist/esm/components/ps-site-header.js +1 -1
  47. package/dist/esm/components/ps-sortable-list.js +75 -0
  48. package/dist/esm/components/ps-start-preview.js +1 -1
  49. package/dist/esm/components/ps-theme-controller.js +1 -1
  50. package/dist/esm/components/ps-theme-toggle.js +1 -1
  51. package/dist/esm/constants/ps-button-classes.js +4 -4
  52. package/dist/esm/constants/ps-drag-config.js +27 -0
  53. package/dist/esm/constants/ps-draggable-grid.js +4 -18
  54. package/dist/esm/constants/ps-icon-action-config.js +7 -2
  55. package/dist/esm/constants/ps-pallasoft-sign-in-classes.js +5 -5
  56. package/dist/esm/constants/ps-skeleton-config.js +1 -1
  57. package/dist/esm/hooks/use-ps-drag-sensors.js +11 -0
  58. package/dist/esm/hooks/use-ps-reduced-motion.js +14 -0
  59. package/dist/esm/index.js +7 -0
  60. package/dist/esm/models/ps-sortable-list.js +1 -0
  61. package/dist/hooks/use-ps-drag-sensors.d.ts +2 -0
  62. package/dist/hooks/use-ps-drag-sensors.js +15 -0
  63. package/dist/hooks/use-ps-reduced-motion.d.ts +1 -0
  64. package/dist/hooks/use-ps-reduced-motion.js +18 -0
  65. package/dist/index.d.ts +7 -0
  66. package/dist/index.js +7 -0
  67. package/dist/models/ps-sortable-list.d.ts +32 -0
  68. package/dist/models/ps-sortable-list.js +2 -0
  69. package/package.json +2 -2
@@ -2,13 +2,13 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.PsPallasoftSignInClasses = void 0;
4
4
  exports.PsPallasoftSignInClasses = {
5
- base: 'ps-focus-ring ps-liquid ps-liquid-control group relative inline-flex max-w-full items-center justify-center gap-3 rounded-full border border-line bg-white font-semibold text-ink shadow-sm transition duration-200 hover:-translate-y-px hover:border-primary/40 hover:shadow-md active:translate-y-0 motion-reduce:transition-none motion-reduce:hover:translate-y-0 dark:border-white/15 dark:bg-white/10 dark:text-white dark:hover:border-white/30',
5
+ base: 'ps-focus-ring ps-liquid ps-liquid-control group relative inline-flex max-w-full items-center justify-center gap-3 rounded-ps-control border border-line bg-white font-semibold text-ink shadow-sm transition duration-200 hover:-translate-y-px hover:border-primary/40 hover:shadow-md active:translate-y-0 motion-reduce:transition-none motion-reduce:hover:translate-y-0 dark:border-white/15 dark:bg-white/10 dark:text-white dark:hover:border-white/30',
6
6
  sizes: {
7
- default: 'ps-control px-5 text-sm',
8
- large: 'ps-control-large px-6 py-3 text-base',
7
+ default: 'ps-control ps-control-padding text-sm',
8
+ large: 'ps-control-large ps-control-padding-large text-sm',
9
9
  },
10
10
  markSizes: {
11
- default: 'h-5 w-5',
12
- large: 'h-6 w-6',
11
+ default: 'size-ps-control-icon-standalone',
12
+ large: 'size-ps-control-icon-standalone',
13
13
  },
14
14
  };
@@ -19,7 +19,7 @@ exports.PsSkeletonConfig = {
19
19
  [ps_skeleton_shape_1.PsSkeletonShape.Text]: 'rounded-full',
20
20
  },
21
21
  shapeSizes: {
22
- [ps_skeleton_shape_1.PsSkeletonShape.Block]: { height: 'h-11', width: 'w-full' },
22
+ [ps_skeleton_shape_1.PsSkeletonShape.Block]: { height: 'h-ps-control', width: 'w-full' },
23
23
  [ps_skeleton_shape_1.PsSkeletonShape.Circle]: { height: 'h-9', width: 'w-9' },
24
24
  [ps_skeleton_shape_1.PsSkeletonShape.Line]: { height: 'h-3', width: 'w-full' },
25
25
  [ps_skeleton_shape_1.PsSkeletonShape.Text]: { height: 'h-3', width: 'w-full' },
@@ -1,4 +1,4 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { PsIcon, PsIconKey } from '@pallasoft/ps-icons';
3
3
  import { PsPill } from './ps-pill';
4
- export const PsActiveFilterChip = ({ id, label, onRemove, removeLabel, }) => (_jsx("button", { "aria-label": removeLabel, className: 'ps-focus-ring shrink-0 rounded-full', id: id, onClick: onRemove, type: 'button', children: _jsx(PsPill, { className: 'pr-2', tone: 'primary', children: _jsxs("span", { className: 'flex items-center gap-1.5', children: [label, _jsx(PsIcon, { className: 'h-3 w-3', iconKey: PsIconKey.Close })] }) }) }));
4
+ export const PsActiveFilterChip = ({ id, label, onRemove, removeLabel, }) => (_jsx("button", { "aria-label": removeLabel, className: 'ps-focus-ring shrink-0 rounded-ps-control', id: id, onClick: onRemove, type: 'button', children: _jsx(PsPill, { className: 'pr-2', tone: 'primary', children: _jsxs("span", { className: 'flex items-center gap-1.5', children: [label, _jsx(PsIcon, { className: 'h-3 w-3', iconKey: PsIconKey.Close })] }) }) }));
@@ -9,4 +9,4 @@ const toneClassNames = {
9
9
  success: 'bg-success-soft text-emerald-700 dark:bg-emerald-400/18 dark:text-emerald-50',
10
10
  warning: 'bg-warning-soft text-amber-800 dark:bg-amber-400/18 dark:text-amber-50',
11
11
  };
12
- export const PsBadge = ({ children, className, isLoading = false, tone = 'neutral', }) => isLoading ? (_jsx(PsSkeleton, { className: PallasoftClassNameService.merge('h-7 w-20', className), shape: PsSkeletonShape.Block })) : (_jsx("span", { className: PallasoftClassNameService.merge('inline-flex min-h-7 w-fit items-center justify-center whitespace-nowrap rounded-full px-3 py-0.5 text-center text-xs font-semibold capitalize', toneClassNames[tone], className), children: children }));
12
+ export const PsBadge = ({ children, className, isLoading = false, tone = 'neutral', }) => isLoading ? (_jsx(PsSkeleton, { className: PallasoftClassNameService.merge('h-7 w-20', className), shape: PsSkeletonShape.Block })) : (_jsx("span", { className: PallasoftClassNameService.merge('inline-flex min-h-7 w-fit items-center justify-center whitespace-nowrap rounded-ps-control px-3 py-0.5 text-center text-xs font-semibold capitalize', toneClassNames[tone], className), children: children }));
@@ -0,0 +1,2 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ export const PsDragGrip = () => (_jsx("span", { "aria-hidden": 'true', className: 'grid grid-cols-2 gap-[0.1875rem]', children: Array.from({ length: 6 }).map((_, index) => (_jsx("span", { className: 'h-[3px] w-[3px] rounded-full bg-current' }, index))) }));
@@ -0,0 +1,30 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { useEffect, useState } from 'react';
3
+ import { DragOverlay, defaultDropAnimationSideEffects } from '@dnd-kit/core';
4
+ import { createPortal } from 'react-dom';
5
+ import { PsDragConfig } from '../constants/ps-drag-config';
6
+ import { usePsReducedMotion } from '../hooks/use-ps-reduced-motion';
7
+ const dropAnimation = {
8
+ duration: PsDragConfig.dropDuration,
9
+ easing: PsDragConfig.dropEasing,
10
+ sideEffects: defaultDropAnimationSideEffects({
11
+ styles: { active: { opacity: PsDragConfig.placeholderOpacity } },
12
+ }),
13
+ };
14
+ export const PsDragOverlay = ({ children, className, frames }) => {
15
+ const [isMounted, setIsMounted] = useState(false);
16
+ const isReduced = usePsReducedMotion();
17
+ useEffect(() => setIsMounted(true), []);
18
+ if (!isMounted)
19
+ return null;
20
+ const lift = (element) => {
21
+ if (element === null || isReduced || typeof element.animate !== 'function')
22
+ return;
23
+ element.animate(frames, {
24
+ duration: PsDragConfig.liftDuration,
25
+ easing: PsDragConfig.liftEasing,
26
+ fill: 'forwards',
27
+ });
28
+ };
29
+ return createPortal(_jsx(DragOverlay, { dropAnimation: isReduced ? null : dropAnimation, children: children === null ? null : (_jsx("div", { className: className, ref: lift, children: children })) }), document.body);
30
+ };
@@ -1,28 +1,14 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useEffect, useState } from 'react';
3
- import { DndContext, DragOverlay, KeyboardSensor, MouseSensor, TouchSensor, closestCenter, defaultDropAnimationSideEffects, useSensor, useSensors, } from '@dnd-kit/core';
4
- import { SortableContext, arrayMove, rectSortingStrategy, sortableKeyboardCoordinates, useSortable, } from '@dnd-kit/sortable';
2
+ import { useState } from 'react';
3
+ import { DndContext, closestCenter } from '@dnd-kit/core';
4
+ import { SortableContext, arrayMove, rectSortingStrategy, useSortable } from '@dnd-kit/sortable';
5
5
  import { CSS } from '@dnd-kit/utilities';
6
- import { createPortal } from 'react-dom';
7
- import { PsDraggableGridClasses, PsDraggableGridConfig, PsDraggableGridLiftFrames, } from '../constants/ps-draggable-grid';
8
- const liftCard = (element) => {
9
- if (element === null)
10
- return;
11
- element.animate(PsDraggableGridLiftFrames, {
12
- duration: PsDraggableGridConfig.liftDuration,
13
- easing: PsDraggableGridConfig.liftEasing,
14
- fill: 'forwards',
15
- });
16
- };
17
- const dropAnimation = {
18
- duration: PsDraggableGridConfig.dropDuration,
19
- easing: PsDraggableGridConfig.dropEasing,
20
- sideEffects: defaultDropAnimationSideEffects({
21
- styles: { active: { opacity: PsDraggableGridConfig.placeholderOpacity } },
22
- }),
23
- };
24
- const DragHandleIcon = () => (_jsx("span", { "aria-hidden": 'true', className: 'grid grid-cols-2 gap-[0.1875rem]', children: Array.from({ length: 6 }).map((_, index) => (_jsx("span", { className: 'h-[3px] w-[3px] rounded-full bg-current' }, index))) }));
25
- const PsDraggableGridHandle = ({ attributes, label, listeners, setActivatorNodeRef, }) => (_jsx("button", { ...attributes, ...listeners, "aria-label": `Move ${label}`, className: PsDraggableGridClasses.handle, ref: setActivatorNodeRef, title: `Move ${label}`, type: 'button', children: _jsx(DragHandleIcon, {}) }));
6
+ import { PsDragConfig } from '../constants/ps-drag-config';
7
+ import { PsDraggableGridClasses, PsDraggableGridLiftFrames } from '../constants/ps-draggable-grid';
8
+ import { usePsDragSensors } from '../hooks/use-ps-drag-sensors';
9
+ import { PsDragGrip } from './ps-drag-grip';
10
+ import { PsDragOverlay } from './ps-drag-overlay';
11
+ const PsDraggableGridHandle = ({ attributes, label, listeners, setActivatorNodeRef, }) => (_jsx("button", { ...attributes, ...listeners, "aria-label": `Move ${label}`, className: PsDraggableGridClasses.handle, ref: setActivatorNodeRef, title: `Move ${label}`, type: 'button', children: _jsx(PsDragGrip, {}) }));
26
12
  const PsSortableGridItem = ({ className, index, item, renderItem, }) => {
27
13
  const { attributes, isDragging, listeners, setActivatorNodeRef, setNodeRef, transform, transition, } = useSortable({ id: item.id });
28
14
  const rendered = renderItem({
@@ -35,23 +21,14 @@ const PsSortableGridItem = ({ className, index, item, renderItem, }) => {
35
21
  if (!rendered)
36
22
  return null;
37
23
  return (_jsx("div", { className: `${PsDraggableGridClasses.item} ${className} ${isDragging ? PsDraggableGridClasses.placeholder : ''}`, ref: setNodeRef, style: {
38
- opacity: isDragging ? PsDraggableGridConfig.placeholderOpacity : undefined,
24
+ opacity: isDragging ? PsDragConfig.placeholderOpacity : undefined,
39
25
  transform: CSS.Translate.toString(transform),
40
26
  transition,
41
27
  }, children: rendered }));
42
28
  };
43
29
  export const PsDraggableGrid = ({ getItemClassName, items, onReorder, onReorderEnd, renderItem, }) => {
44
30
  const [activeId, setActiveId] = useState(null);
45
- const [isMounted, setIsMounted] = useState(false);
46
- useEffect(() => setIsMounted(true), []);
47
- const sensors = useSensors(useSensor(MouseSensor, {
48
- activationConstraint: { distance: PsDraggableGridConfig.activationDistance },
49
- }), useSensor(TouchSensor, {
50
- activationConstraint: {
51
- delay: PsDraggableGridConfig.touchDelay,
52
- tolerance: PsDraggableGridConfig.touchTolerance,
53
- },
54
- }), useSensor(KeyboardSensor, { coordinateGetter: sortableKeyboardCoordinates }));
31
+ const sensors = usePsDragSensors();
55
32
  const className = (item) => getItemClassName !== undefined ? getItemClassName(item) : '';
56
33
  const activeIndex = items.findIndex((item) => item.id === activeId);
57
34
  const activeItem = activeIndex >= 0 ? items[activeIndex] : null;
@@ -68,13 +45,13 @@ export const PsDraggableGrid = ({ getItemClassName, items, onReorder, onReorderE
68
45
  if (onReorderEnd !== undefined)
69
46
  onReorderEnd(nextItems);
70
47
  };
71
- return (_jsxs(DndContext, { collisionDetection: closestCenter, onDragCancel: () => setActiveId(null), onDragEnd: handleDragEnd, onDragStart: (event) => setActiveId(String(event.active.id)), sensors: sensors, children: [_jsx(SortableContext, { items: items.map((item) => item.id), strategy: rectSortingStrategy, children: items.map((item, index) => (_jsx(PsSortableGridItem, { className: className(item), index: index, item: item, renderItem: renderItem }, item.id))) }), isMounted
72
- ? createPortal(_jsx(DragOverlay, { dropAnimation: dropAnimation, children: activeItem !== null ? (_jsx("div", { className: PsDraggableGridClasses.lifted, ref: liftCard, children: renderItem({
73
- handle: _jsx(PsDraggableGridHandle, { label: activeItem.label }),
74
- index: activeIndex,
75
- isDragging: true,
76
- isOverlay: true,
77
- item: activeItem,
78
- }) })) : null }), document.body)
79
- : null] }));
48
+ return (_jsxs(DndContext, { collisionDetection: closestCenter, onDragCancel: () => setActiveId(null), onDragEnd: handleDragEnd, onDragStart: (event) => setActiveId(String(event.active.id)), sensors: sensors, children: [_jsx(SortableContext, { items: items.map((item) => item.id), strategy: rectSortingStrategy, children: items.map((item, index) => (_jsx(PsSortableGridItem, { className: className(item), index: index, item: item, renderItem: renderItem }, item.id))) }), _jsx(PsDragOverlay, { className: PsDraggableGridClasses.lifted, frames: PsDraggableGridLiftFrames, children: activeItem !== null
49
+ ? renderItem({
50
+ handle: _jsx(PsDraggableGridHandle, { label: activeItem.label }),
51
+ index: activeIndex,
52
+ isDragging: true,
53
+ isOverlay: true,
54
+ item: activeItem,
55
+ })
56
+ : null })] }));
80
57
  };
@@ -24,5 +24,5 @@ export const PsEmptyState = ({ actions = [], badge, children, className, detail,
24
24
  ? 'mt-1.5 text-sm leading-6 text-ink/60'
25
25
  : 'mt-3 text-sm leading-6 text-ink/60', children: description })) : null, detail ? (_jsx("p", { className: 'mt-4 rounded-2xl border border-line bg-mist px-4 py-3 text-left text-xs leading-5 text-ink/60', children: detail })) : null, children ? _jsx("div", { className: 'mt-5 flex justify-center', children: children }) : null, actions.length > 0 ? (_jsx("div", { className: isInline
26
26
  ? 'mt-5 flex flex-col justify-center gap-2 sm:flex-row'
27
- : 'mt-6 flex flex-col gap-2 sm:flex-row', children: actions.map((action) => (_jsx("a", { className: PallasoftClassNameService.merge('ps-focus-ring ps-pressable inline-flex items-center justify-center rounded-ps-control border px-4 py-3 text-sm font-semibold', getActionClassName(action.variant)), href: action.href, rel: action.rel, target: action.target, children: action.label }, `${action.href}-${action.label}`))) })) : null] })] }) }) }));
27
+ : 'mt-6 flex flex-col gap-2 sm:flex-row', children: actions.map((action) => (_jsx("a", { className: PallasoftClassNameService.merge('ps-focus-ring ps-pressable ps-control ps-control-padding inline-flex items-center justify-center rounded-ps-control border border-ps-control text-sm font-semibold', getActionClassName(action.variant)), href: action.href, rel: action.rel, target: action.target, children: action.label }, `${action.href}-${action.label}`))) })) : null] })] }) }) }));
28
28
  };
@@ -6,4 +6,4 @@ const positionClassNames = {
6
6
  'bottom-left': 'bottom-6 left-6',
7
7
  'bottom-center': 'bottom-6 left-1/2 -translate-x-1/2',
8
8
  };
9
- export const PsFab = ({ className, position = 'bottom-right', ...props }) => (_jsx(PsButton, { size: 'large', variant: 'primary', className: PallasoftClassNameService.merge('!fixed z-docked h-14 w-14 shrink-0 !px-0 shadow-lg', positionClassNames[position], className), ...props }));
9
+ export const PsFab = ({ className, position = 'bottom-right', ...props }) => (_jsx(PsButton, { size: 'large', variant: 'primary', className: PallasoftClassNameService.merge('!fixed z-docked h-14 w-14 shrink-0 !rounded-full !px-0 shadow-lg', positionClassNames[position], className), ...props }));
@@ -3,4 +3,4 @@ import { PallasoftClassNameService } from '@pallasoft/ps-design-system';
3
3
  import { PsPageSkeletonConfig } from '../constants/ps-page-skeleton-config';
4
4
  import { PsSkeletonShape } from '../constants/ps-skeleton-shape';
5
5
  import { PsSkeleton } from './ps-skeleton';
6
- export const PsFormFieldsSkeleton = ({ columnsClassName = PsPageSkeletonConfig.formColumnsClassName, fields = PsPageSkeletonConfig.formFields, }) => (_jsx("div", { className: PallasoftClassNameService.merge('grid gap-4', columnsClassName), children: fields.map((field) => (_jsxs("div", { className: 'flex flex-col gap-2', children: [_jsx(PsSkeleton, { className: PsPageSkeletonConfig.formLabelClassName }), _jsx(PsSkeleton, { className: 'h-10 w-full', shape: PsSkeletonShape.Block })] }, field))) }));
6
+ export const PsFormFieldsSkeleton = ({ columnsClassName = PsPageSkeletonConfig.formColumnsClassName, fields = PsPageSkeletonConfig.formFields, }) => (_jsx("div", { className: PallasoftClassNameService.merge('grid gap-4', columnsClassName), children: fields.map((field) => (_jsxs("div", { className: 'flex flex-col gap-2', children: [_jsx(PsSkeleton, { className: PsPageSkeletonConfig.formLabelClassName }), _jsx(PsSkeleton, { className: 'h-ps-control w-full', shape: PsSkeletonShape.Block })] }, field))) }));
@@ -2,4 +2,4 @@ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { PallasoftClassNameService } from '@pallasoft/ps-design-system';
3
3
  import { PsIcon } from '@pallasoft/ps-icons';
4
4
  import { PsIconActionConfig } from '../constants/ps-icon-action-config';
5
- export const PsIconButton = ({ className, iconKey, label, type, ...props }) => (_jsx("button", { ...props, "aria-label": label, className: PallasoftClassNameService.merge(PsIconActionConfig.className, PsIconActionConfig.disabledClassName, className), title: label, type: type === 'submit' || type === 'reset' ? type : 'button', children: _jsx(PsIcon, { "aria-hidden": 'true', className: PsIconActionConfig.iconClassName, iconKey: iconKey }) }));
5
+ export const PsIconButton = ({ className, iconKey, label, size = 'default', type, ...props }) => (_jsx("button", { ...props, "aria-label": label, className: PallasoftClassNameService.merge(PsIconActionConfig.className, PsIconActionConfig.sizeClassNames[size], PsIconActionConfig.disabledClassName, className), title: label, type: type === 'submit' || type === 'reset' ? type : 'button', children: _jsx(PsIcon, { "aria-hidden": 'true', className: PsIconActionConfig.iconClassName, iconKey: iconKey }) }));
@@ -2,8 +2,8 @@ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { PallasoftClassNameService } from '@pallasoft/ps-design-system';
3
3
  import { PsIcon } from '@pallasoft/ps-icons';
4
4
  import { PsIconActionConfig } from '../constants/ps-icon-action-config';
5
- export const PsIconLink = ({ className, href, iconKey, label, LinkComponent }) => {
6
- const linkClassName = PallasoftClassNameService.merge(PsIconActionConfig.className, className);
5
+ export const PsIconLink = ({ className, href, iconKey, label, LinkComponent, size = 'default', }) => {
6
+ const linkClassName = PallasoftClassNameService.merge(PsIconActionConfig.className, PsIconActionConfig.sizeClassNames[size], className);
7
7
  const icon = (_jsx(PsIcon, { "aria-hidden": 'true', className: PsIconActionConfig.iconClassName, iconKey: iconKey }));
8
8
  return LinkComponent ? (_jsx(LinkComponent, { "aria-label": label, className: linkClassName, prefetch: 'intent', title: label, to: href, children: icon })) : (_jsx("a", { "aria-label": label, className: linkClassName, href: href, title: label, children: icon }));
9
9
  };
@@ -9,4 +9,4 @@ const toneClassNames = {
9
9
  success: 'bg-emerald-50 text-emerald-700 ring-emerald-100 dark:bg-emerald-400/18 dark:text-emerald-50 dark:ring-emerald-200/22',
10
10
  warning: 'bg-amber-50 text-amber-800 ring-amber-100 dark:bg-amber-400/18 dark:text-amber-50 dark:ring-amber-200/24',
11
11
  };
12
- export const PsPill = ({ children, className, isLoading = false, tone = 'neutral', }) => isLoading ? (_jsx(PsSkeleton, { className: PallasoftClassNameService.merge('h-8 w-24', className), shape: PsSkeletonShape.Block })) : (_jsx("span", { className: PallasoftClassNameService.merge('inline-flex min-h-8 min-w-[5.5rem] max-w-full items-center justify-center rounded-full px-5 py-1 text-center text-[0.72rem] font-black capitalize tracking-[0.01em] ring-1 ring-inset', toneClassNames[tone], className), children: _jsx("span", { className: 'min-w-0 break-words', children: children }) }));
12
+ export const PsPill = ({ children, className, isLoading = false, tone = 'neutral', }) => isLoading ? (_jsx(PsSkeleton, { className: PallasoftClassNameService.merge('h-8 w-24', className), shape: PsSkeletonShape.Block })) : (_jsx("span", { className: PallasoftClassNameService.merge('inline-flex min-h-8 min-w-[5.5rem] max-w-full items-center justify-center rounded-ps-control px-5 py-1 text-center text-[0.72rem] font-black capitalize tracking-[0.01em] ring-1 ring-inset', toneClassNames[tone], className), children: _jsx("span", { className: 'min-w-0 break-words', children: children }) }));
@@ -2,4 +2,4 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { PsSkeletonShape } from '../constants/ps-skeleton-shape';
3
3
  import { PsSkeleton } from './ps-skeleton';
4
4
  import { PsSkeletonGroup } from './ps-skeleton-group';
5
- export const PsSectionHeader = ({ description, eyebrow, isLoading = false, leading, title, trailing, }) => isLoading ? (_jsxs(PsSkeletonGroup, { className: 'flex flex-wrap items-end justify-between gap-x-4 gap-y-3', label: title, children: [_jsxs("div", { className: 'flex min-w-0 flex-1 basis-auto flex-col gap-2', children: [eyebrow ? _jsx(PsSkeleton, { className: 'h-2.5 w-24' }) : null, _jsx(PsSkeleton, { className: 'h-6 w-52' }), description ? _jsx(PsSkeleton, { className: 'h-3 w-72' }) : null] }), trailing ? _jsx(PsSkeleton, { className: 'h-10 w-32', shape: PsSkeletonShape.Block }) : null] })) : (_jsxs("div", { className: 'flex flex-wrap items-end justify-between gap-x-4 gap-y-3', children: [_jsxs("div", { className: 'flex min-w-0 flex-1 basis-auto flex-col gap-2', children: [leading, eyebrow ? (_jsx("p", { className: 'text-[0.68rem] font-semibold uppercase tracking-[0.22em] text-ink/50', children: eyebrow })) : null, _jsx("h1", { className: 'break-words text-xl font-extrabold text-ink sm:text-2xl', children: title }), description ? (_jsx("p", { className: 'max-w-3xl text-sm leading-6 text-ink/60', children: description })) : null] }), trailing ? (_jsx("div", { className: 'flex w-full shrink-0 items-center justify-end sm:ml-auto sm:w-auto', children: trailing })) : null] }));
5
+ export const PsSectionHeader = ({ description, eyebrow, isLoading = false, leading, title, trailing, }) => isLoading ? (_jsxs(PsSkeletonGroup, { className: 'flex flex-wrap items-end justify-between gap-x-4 gap-y-3', label: title, children: [_jsxs("div", { className: 'flex min-w-0 flex-1 basis-auto flex-col gap-2', children: [eyebrow ? _jsx(PsSkeleton, { className: 'h-2.5 w-24' }) : null, _jsx(PsSkeleton, { className: 'h-6 w-52' }), description ? _jsx(PsSkeleton, { className: 'h-3 w-72' }) : null] }), trailing ? _jsx(PsSkeleton, { className: 'h-ps-control w-32', shape: PsSkeletonShape.Block }) : null] })) : (_jsxs("div", { className: 'flex flex-wrap items-end justify-between gap-x-4 gap-y-3', children: [_jsxs("div", { className: 'flex min-w-0 flex-1 basis-auto flex-col gap-2', children: [leading, eyebrow ? (_jsx("p", { className: 'text-[0.68rem] font-semibold uppercase tracking-[0.22em] text-ink/50', children: eyebrow })) : null, _jsx("h1", { className: 'break-words text-xl font-extrabold text-ink sm:text-2xl', children: title }), description ? (_jsx("p", { className: 'max-w-3xl text-sm leading-6 text-ink/60', children: description })) : null] }), trailing ? (_jsx("div", { className: 'flex w-full shrink-0 items-center justify-end sm:ml-auto sm:w-auto', children: trailing })) : null] }));
@@ -10,5 +10,5 @@ export const PsSiteHeader = ({ centerContent, className, homeHref, label, LinkCo
10
10
  const renderLogo = (src, darkSrc, baseClassName) => darkSrc ? (_jsxs(_Fragment, { children: [_jsx("img", { alt: logoAlt !== null && logoAlt !== undefined ? logoAlt : label, className: PallasoftClassNameService.merge(baseClassName, 'dark:hidden', logoClassName), decoding: 'async', src: src }), _jsx("img", { alt: logoAlt !== null && logoAlt !== undefined ? logoAlt : label, className: PallasoftClassNameService.merge(baseClassName, 'hidden dark:block', logoClassName), decoding: 'async', src: darkSrc })] })) : (_jsx("img", { alt: logoAlt !== null && logoAlt !== undefined ? logoAlt : label, className: PallasoftClassNameService.merge(baseClassName, logoClassName), decoding: 'async', src: src }));
11
11
  const logoContent = logoSrcMobile ? (_jsxs(_Fragment, { children: [_jsx("span", { className: 'hidden sm:contents', children: renderLogo(logoSrc, logoSrcDark, 'h-8 w-auto') }), _jsx("span", { className: 'contents sm:hidden', children: renderLogo(logoSrcMobile, logoSrcMobileDark, 'h-8 w-auto') }), showLabel ? _jsx("span", { className: 'text-base font-bold text-ink', children: label }) : null] })) : (_jsxs(_Fragment, { children: [renderLogo(logoSrc, logoSrcDark, 'h-8 w-auto'), showLabel ? _jsx("span", { className: 'text-base font-bold text-ink', children: label }) : null] }));
12
12
  const logoLink = LinkComponent ? (_jsx(LinkComponent, { "aria-label": logoLabel, className: logoLinkClassName, prefetch: 'intent', to: homeHref, children: logoContent })) : (_jsx("a", { "aria-label": logoLabel, className: logoLinkClassName, href: homeHref, children: logoContent }));
13
- return (_jsx("header", { ref: headerRef, className: PallasoftClassNameService.merge('fixed inset-x-0 top-0 z-header px-6 pt-4', className), children: _jsxs("nav", { className: PallasoftClassNameService.merge('ps-glass mx-auto flex max-w-6xl items-center gap-3 rounded-ps-card px-5 py-3', navClassName), children: [onBack ? (_jsx("button", { "aria-label": 'Back', className: 'ps-focus-ring flex h-9 w-9 shrink-0 items-center justify-center rounded-full text-ink md:hidden', onClick: onBack, type: 'button', children: _jsx(PsIcon, { iconKey: PsIconKey.ChevronRight, width: 20, height: 20, className: 'rotate-180' }) })) : null, _jsx("div", { className: onBack ? 'hidden md:flex' : 'contents', children: logoLink }), _jsx("div", { className: 'flex min-w-0 flex-1 items-center justify-center gap-3', children: centerContent }), trailing ? _jsx("div", { className: 'flex shrink-0 items-center gap-2.5', children: trailing }) : null] }) }));
13
+ return (_jsx("header", { ref: headerRef, className: PallasoftClassNameService.merge('fixed inset-x-0 top-0 z-header px-6 pt-4', className), children: _jsxs("nav", { className: PallasoftClassNameService.merge('ps-glass mx-auto flex max-w-6xl items-center gap-3 rounded-ps-card px-5 py-3', navClassName), children: [onBack ? (_jsx("button", { "aria-label": 'Back', className: 'ps-focus-ring ps-control-square ps-control-compact flex shrink-0 items-center justify-center rounded-ps-control text-ink md:hidden', onClick: onBack, type: 'button', children: _jsx(PsIcon, { iconKey: PsIconKey.ChevronRight, width: 20, height: 20, className: 'rotate-180' }) })) : null, _jsx("div", { className: onBack ? 'hidden md:flex' : 'contents', children: logoLink }), _jsx("div", { className: 'flex min-w-0 flex-1 items-center justify-center gap-3', children: centerContent }), trailing ? _jsx("div", { className: 'flex shrink-0 items-center gap-2.5', children: trailing }) : null] }) }));
14
14
  };
@@ -0,0 +1,75 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useState } from 'react';
3
+ import { DndContext, closestCenter, } from '@dnd-kit/core';
4
+ import { SortableContext, useSortable, verticalListSortingStrategy } from '@dnd-kit/sortable';
5
+ import { CSS } from '@dnd-kit/utilities';
6
+ import { PsDragClasses, PsDragConfig, PsDragListLiftFrames } from '../constants/ps-drag-config';
7
+ import { usePsDragSensors } from '../hooks/use-ps-drag-sensors';
8
+ import { usePsReducedMotion } from '../hooks/use-ps-reduced-motion';
9
+ import { PsDragGrip } from './ps-drag-grip';
10
+ import { PsDragOverlay } from './ps-drag-overlay';
11
+ const PsSortableListHandle = ({ attributes, className, icon, label, listeners, setActivatorNodeRef, }) => (_jsx("button", { ...attributes, ...listeners, "aria-label": label, className: className === undefined ? PsDragClasses.handle : className, ref: setActivatorNodeRef, title: label, type: 'button', children: icon === undefined ? _jsx(PsDragGrip, {}) : icon }));
12
+ const PsSortableListRow = ({ className, handleClassName, handleIcon, getHandleLabel, index, isDisabled, item, renderItem, }) => {
13
+ const isReduced = usePsReducedMotion();
14
+ const { attributes, isDragging, listeners, setActivatorNodeRef, setNodeRef, transform, transition, } = useSortable({ disabled: isDisabled, id: item.id });
15
+ const rendered = renderItem({
16
+ handle: (_jsx(PsSortableListHandle, { attributes: attributes, className: handleClassName, icon: handleIcon, label: getHandleLabel(item.label), listeners: listeners, setActivatorNodeRef: setActivatorNodeRef })),
17
+ index,
18
+ isDragging,
19
+ isOverlay: false,
20
+ item,
21
+ });
22
+ if (!rendered)
23
+ return null;
24
+ return (_jsx("div", { className: `${PsDragClasses.listItem} ${className} ${isDragging ? PsDragClasses.placeholder : ''}`, ref: setNodeRef, style: {
25
+ opacity: isDragging ? PsDragConfig.placeholderOpacity : undefined,
26
+ transform: CSS.Translate.toString(transform),
27
+ transition: isReduced ? undefined : transition,
28
+ }, children: rendered }));
29
+ };
30
+ export const PsSortableList = ({ announcements: texts, className, getHandleLabel, getItemClassName, handleClassName, handleIcon, instructions, role, items, onMove, renderItem, }) => {
31
+ const [activeId, setActiveId] = useState(null);
32
+ const sensors = usePsDragSensors();
33
+ const activeIndex = items.findIndex((item) => item.id === activeId);
34
+ const activeItem = activeIndex >= 0 ? items[activeIndex] : null;
35
+ const itemClassName = (item) => getItemClassName === undefined ? '' : getItemClassName(item);
36
+ const groupOf = (id) => {
37
+ const found = items.find((item) => item.id === id);
38
+ return found === undefined ? undefined : found.groupKey;
39
+ };
40
+ const labelOf = (id) => {
41
+ const found = items.find((item) => item.id === id);
42
+ return found === undefined ? id : found.label;
43
+ };
44
+ const positionOf = (id) => items.findIndex((item) => item.id === id) + 1;
45
+ const announcements = {
46
+ onDragCancel: ({ active }) => texts.cancelled(labelOf(String(active.id))),
47
+ onDragEnd: ({ active, over }) => over === null
48
+ ? texts.cancelled(labelOf(String(active.id)))
49
+ : texts.dropped(labelOf(String(active.id)), positionOf(String(over.id)), items.length),
50
+ onDragOver: ({ active, over }) => over === null
51
+ ? undefined
52
+ : texts.moved(labelOf(String(active.id)), positionOf(String(over.id)), items.length),
53
+ onDragStart: ({ active }) => texts.lifted(labelOf(String(active.id)), positionOf(String(active.id)), items.length),
54
+ };
55
+ const handleDragEnd = ({ active, over }) => {
56
+ setActiveId(null);
57
+ if (over === null || active.id === over.id)
58
+ return;
59
+ const from = items.findIndex((item) => item.id === active.id);
60
+ const to = items.findIndex((item) => item.id === over.id);
61
+ if (from < 0 || to < 0 || groupOf(String(active.id)) !== groupOf(String(over.id)))
62
+ return;
63
+ onMove(String(active.id), from, to);
64
+ };
65
+ const activeGroup = activeItem === null ? undefined : activeItem.groupKey;
66
+ return (_jsxs(DndContext, { accessibility: { announcements, screenReaderInstructions: { draggable: instructions } }, collisionDetection: closestCenter, onDragCancel: () => setActiveId(null), onDragEnd: handleDragEnd, onDragStart: ({ active }) => setActiveId(String(active.id)), sensors: sensors, children: [_jsx(SortableContext, { items: items.map((item) => item.id), strategy: verticalListSortingStrategy, children: _jsx("div", { className: className, role: role, children: items.map((item, index) => (_jsx(PsSortableListRow, { className: itemClassName(item), getHandleLabel: getHandleLabel, handleClassName: handleClassName, handleIcon: handleIcon, index: index, isDisabled: activeItem !== null && item.groupKey !== activeGroup, item: item, renderItem: renderItem }, item.id))) }) }), _jsx(PsDragOverlay, { className: PsDragClasses.lifted, frames: PsDragListLiftFrames, children: activeItem !== null
67
+ ? renderItem({
68
+ handle: (_jsx(PsSortableListHandle, { className: handleClassName, icon: handleIcon, label: getHandleLabel(activeItem.label) })),
69
+ index: activeIndex,
70
+ isDragging: true,
71
+ isOverlay: true,
72
+ item: activeItem,
73
+ })
74
+ : null })] }));
75
+ };
@@ -1,2 +1,2 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- export const PsStartPreview = ({ badge, children, note, title }) => (_jsxs("div", { className: 'rounded-2xl border border-line/60 bg-surface/60 p-5', children: [_jsxs("div", { className: 'mb-4 flex items-center justify-between', children: [_jsx("span", { className: 'text-sm font-bold text-ink', children: title }), badge === undefined ? null : (_jsx("span", { className: 'rounded-full border border-warning/40 px-2.5 py-1 text-xs font-semibold text-warning', children: badge }))] }), _jsx("ul", { className: 'flex flex-col', children: children }), note === undefined ? null : (_jsx("p", { className: 'mt-4 border-t border-line/40 pt-4 text-xs leading-5 text-ink/45', children: note }))] }));
2
+ export const PsStartPreview = ({ badge, children, note, title }) => (_jsxs("div", { className: 'rounded-2xl border border-line/60 bg-surface/60 p-5', children: [_jsxs("div", { className: 'mb-4 flex items-center justify-between', children: [_jsx("span", { className: 'text-sm font-bold text-ink', children: title }), badge === undefined ? null : (_jsx("span", { className: 'rounded-ps-control border border-warning/40 px-2.5 py-1 text-xs font-semibold text-warning', children: badge }))] }), _jsx("ul", { className: 'flex flex-col', children: children }), note === undefined ? null : (_jsx("p", { className: 'mt-4 border-t border-line/40 pt-4 text-xs leading-5 text-ink/45', children: note }))] }));
@@ -4,6 +4,6 @@ import { PsThemeToggle } from './ps-theme-toggle';
4
4
  export const PsThemeController = () => {
5
5
  const { resolvedMode, toggle } = usePsThemeMode();
6
6
  if (resolvedMode === null)
7
- return _jsx("div", { className: 'h-11 w-11' });
7
+ return _jsx("div", { className: 'ps-control-square' });
8
8
  return _jsx(PsThemeToggle, { mode: resolvedMode, onClick: toggle });
9
9
  };
@@ -3,5 +3,5 @@ import { PallasoftClassNameService, PallasoftThemeMode, PallasoftThemeModeServic
3
3
  import { PsIcon } from '@pallasoft/ps-icons';
4
4
  export const PsThemeToggle = ({ className, mode, type = 'button', ...props }) => {
5
5
  const isDarkMode = mode === PallasoftThemeMode.Dark;
6
- return (_jsxs("button", { "aria-label": isDarkMode ? 'Switch to light mode' : 'Switch to dark mode', className: PallasoftClassNameService.merge('ps-focus-ring ps-glass flex h-11 items-center gap-2 rounded-2xl px-3 text-sm font-bold text-ink transition hover:border-primary/30 hover:text-primary', className), type: type, ...props, children: [_jsx(PsIcon, { className: 'h-5 w-5', iconKey: isDarkMode ? 'sun' : 'moon' }), _jsx("span", { className: 'hidden sm:inline', children: PallasoftThemeModeService.getNextMode(mode) === PallasoftThemeMode.Dark ? 'Dark' : 'Light' })] }));
6
+ return (_jsxs("button", { "aria-label": isDarkMode ? 'Switch to light mode' : 'Switch to dark mode', className: PallasoftClassNameService.merge('ps-focus-ring ps-glass ps-control ps-control-padding flex items-center gap-2 rounded-ps-control text-sm font-semibold text-ink transition hover:border-primary/30 hover:text-primary', className), type: type, ...props, children: [_jsx(PsIcon, { className: 'size-ps-control-icon-standalone', iconKey: isDarkMode ? 'sun' : 'moon' }), _jsx("span", { className: 'hidden sm:inline', children: PallasoftThemeModeService.getNextMode(mode) === PallasoftThemeMode.Dark ? 'Dark' : 'Light' })] }));
7
7
  };
@@ -1,8 +1,8 @@
1
- export const PsButtonBaseClassName = 'ps-focus-ring relative inline-flex max-w-full items-center justify-center gap-2 rounded-full border text-center font-semibold';
1
+ export const PsButtonBaseClassName = 'ps-focus-ring relative inline-flex max-w-full items-center justify-center gap-2 rounded-ps-control border border-ps-control text-center text-sm font-semibold leading-5';
2
2
  export const PsButtonSizeClassNames = {
3
- compact: 'ps-control-compact px-3 py-2 text-sm',
4
- default: 'ps-control ps-control-padding text-sm',
5
- large: 'ps-control-large px-5 py-3 text-sm',
3
+ compact: 'ps-control-compact ps-control-padding-compact',
4
+ default: 'ps-control ps-control-padding',
5
+ large: 'ps-control-large ps-control-padding-large',
6
6
  };
7
7
  export const PsButtonVariantClassNames = {
8
8
  danger: 'border-danger bg-danger text-white enabled:hover:opacity-90',
@@ -0,0 +1,27 @@
1
+ export const PsDragConfig = {
2
+ activationDistance: 6,
3
+ dropDuration: 220,
4
+ dropEasing: 'cubic-bezier(0.2, 0.8, 0.2, 1)',
5
+ liftDuration: 200,
6
+ liftEasing: 'cubic-bezier(0.2, 0.9, 0.3, 1.2)',
7
+ placeholderOpacity: '0.4',
8
+ touchDelay: 180,
9
+ touchTolerance: 6,
10
+ };
11
+ export const PsDragClasses = {
12
+ handle: 'ps-focus-ring inline-flex h-7 w-7 shrink-0 cursor-grab touch-none items-center justify-center rounded-ps-control text-slate-400/70 transition hover:bg-white/36 hover:text-slate-600 active:cursor-grabbing dark:text-slate-300/55 dark:hover:bg-white/8 dark:hover:text-slate-100',
13
+ listItem: 'min-w-0',
14
+ lifted: 'cursor-grabbing rounded-xl bg-surface ring-1 ring-primary/30',
15
+ placeholder: 'outline-dashed outline-2 outline-offset-[-2px] outline-primary/35',
16
+ };
17
+ export const PsDragLiftFrames = [
18
+ { boxShadow: '0 0 0 0 rgb(15 23 42 / 0)', transform: 'scale(1) rotate(0deg)' },
19
+ {
20
+ boxShadow: '0 28px 64px -18px rgb(15 23 42 / 0.5)',
21
+ transform: 'scale(1.035) rotate(-1.2deg)',
22
+ },
23
+ ];
24
+ export const PsDragListLiftFrames = [
25
+ { boxShadow: '0 0 0 0 rgb(15 23 42 / 0)', transform: 'scale(1)' },
26
+ { boxShadow: '0 18px 40px -16px rgb(15 23 42 / 0.45)', transform: 'scale(1.015)' },
27
+ ];
@@ -1,23 +1,9 @@
1
- export const PsDraggableGridConfig = {
2
- activationDistance: 6,
3
- dropDuration: 220,
4
- dropEasing: 'cubic-bezier(0.2, 0.8, 0.2, 1)',
5
- liftDuration: 200,
6
- liftEasing: 'cubic-bezier(0.2, 0.9, 0.3, 1.2)',
7
- placeholderOpacity: '0.4',
8
- touchDelay: 180,
9
- touchTolerance: 6,
10
- };
1
+ import { PsDragClasses, PsDragConfig, PsDragLiftFrames } from './ps-drag-config';
2
+ export const PsDraggableGridConfig = PsDragConfig;
11
3
  export const PsDraggableGridClasses = {
12
- handle: 'ps-focus-ring inline-flex h-7 w-7 shrink-0 cursor-grab touch-none items-center justify-center rounded-full text-slate-400/70 transition hover:bg-white/36 hover:text-slate-600 active:cursor-grabbing dark:text-slate-300/55 dark:hover:bg-white/8 dark:hover:text-slate-100',
4
+ handle: PsDragClasses.handle,
13
5
  item: 'min-w-0 rounded-[1.7rem]',
14
6
  lifted: 'cursor-grabbing rounded-[1.7rem] ring-1 ring-primary/30',
15
7
  placeholder: 'rounded-[1.7rem] outline-dashed outline-2 outline-offset-[-2px] outline-primary/35',
16
8
  };
17
- export const PsDraggableGridLiftFrames = [
18
- { boxShadow: '0 0 0 0 rgb(15 23 42 / 0)', transform: 'scale(1) rotate(0deg)' },
19
- {
20
- boxShadow: '0 28px 64px -18px rgb(15 23 42 / 0.5)',
21
- transform: 'scale(1.035) rotate(-1.2deg)',
22
- },
23
- ];
9
+ export const PsDraggableGridLiftFrames = PsDragLiftFrames;
@@ -1,5 +1,10 @@
1
1
  export const PsIconActionConfig = {
2
- className: 'ps-focus-ring relative inline-flex h-11 w-11 shrink-0 items-center justify-center rounded-2xl text-ink/65 transition-colors hover:bg-ink/5 hover:text-ink',
2
+ className: 'ps-focus-ring ps-control-square relative inline-flex shrink-0 items-center justify-center rounded-ps-control text-ink/65 transition-colors hover:bg-ink/5 hover:text-ink',
3
3
  disabledClassName: 'disabled:cursor-not-allowed disabled:opacity-40 disabled:hover:bg-transparent',
4
- iconClassName: 'block h-5 w-5 shrink-0',
4
+ iconClassName: 'block size-ps-control-icon-standalone shrink-0',
5
+ sizeClassNames: {
6
+ compact: 'ps-control-compact',
7
+ default: '',
8
+ large: 'ps-control-large',
9
+ },
5
10
  };
@@ -1,11 +1,11 @@
1
1
  export const PsPallasoftSignInClasses = {
2
- base: 'ps-focus-ring ps-liquid ps-liquid-control group relative inline-flex max-w-full items-center justify-center gap-3 rounded-full border border-line bg-white font-semibold text-ink shadow-sm transition duration-200 hover:-translate-y-px hover:border-primary/40 hover:shadow-md active:translate-y-0 motion-reduce:transition-none motion-reduce:hover:translate-y-0 dark:border-white/15 dark:bg-white/10 dark:text-white dark:hover:border-white/30',
2
+ base: 'ps-focus-ring ps-liquid ps-liquid-control group relative inline-flex max-w-full items-center justify-center gap-3 rounded-ps-control border border-line bg-white font-semibold text-ink shadow-sm transition duration-200 hover:-translate-y-px hover:border-primary/40 hover:shadow-md active:translate-y-0 motion-reduce:transition-none motion-reduce:hover:translate-y-0 dark:border-white/15 dark:bg-white/10 dark:text-white dark:hover:border-white/30',
3
3
  sizes: {
4
- default: 'ps-control px-5 text-sm',
5
- large: 'ps-control-large px-6 py-3 text-base',
4
+ default: 'ps-control ps-control-padding text-sm',
5
+ large: 'ps-control-large ps-control-padding-large text-sm',
6
6
  },
7
7
  markSizes: {
8
- default: 'h-5 w-5',
9
- large: 'h-6 w-6',
8
+ default: 'size-ps-control-icon-standalone',
9
+ large: 'size-ps-control-icon-standalone',
10
10
  },
11
11
  };
@@ -16,7 +16,7 @@ export const PsSkeletonConfig = {
16
16
  [PsSkeletonShape.Text]: 'rounded-full',
17
17
  },
18
18
  shapeSizes: {
19
- [PsSkeletonShape.Block]: { height: 'h-11', width: 'w-full' },
19
+ [PsSkeletonShape.Block]: { height: 'h-ps-control', width: 'w-full' },
20
20
  [PsSkeletonShape.Circle]: { height: 'h-9', width: 'w-9' },
21
21
  [PsSkeletonShape.Line]: { height: 'h-3', width: 'w-full' },
22
22
  [PsSkeletonShape.Text]: { height: 'h-3', width: 'w-full' },
@@ -0,0 +1,11 @@
1
+ import { KeyboardSensor, MouseSensor, TouchSensor, useSensor, useSensors, } from '@dnd-kit/core';
2
+ import { sortableKeyboardCoordinates } from '@dnd-kit/sortable';
3
+ import { PsDragConfig } from '../constants/ps-drag-config';
4
+ export const usePsDragSensors = () => useSensors(useSensor(MouseSensor, {
5
+ activationConstraint: { distance: PsDragConfig.activationDistance },
6
+ }), useSensor(TouchSensor, {
7
+ activationConstraint: {
8
+ delay: PsDragConfig.touchDelay,
9
+ tolerance: PsDragConfig.touchTolerance,
10
+ },
11
+ }), useSensor(KeyboardSensor, { coordinateGetter: sortableKeyboardCoordinates }));
@@ -0,0 +1,14 @@
1
+ import { useEffect, useState } from 'react';
2
+ export const usePsReducedMotion = () => {
3
+ const [isReduced, setIsReduced] = useState(false);
4
+ useEffect(() => {
5
+ if (typeof window.matchMedia !== 'function')
6
+ return;
7
+ const query = window.matchMedia('(prefers-reduced-motion: reduce)');
8
+ const update = () => setIsReduced(query.matches);
9
+ update();
10
+ query.addEventListener('change', update);
11
+ return () => query.removeEventListener('change', update);
12
+ }, []);
13
+ return isReduced;
14
+ };
package/dist/esm/index.js CHANGED
@@ -12,6 +12,9 @@ export * from './constants/ps-pallasoft-mark-config';
12
12
  export * from './components/ps-card';
13
13
  export * from './components/ps-client-only';
14
14
  export * from './components/ps-draggable-grid';
15
+ export * from './components/ps-sortable-list';
16
+ export * from './constants/ps-drag-config';
17
+ export * from './models/ps-sortable-list';
15
18
  export * from './components/ps-empty-state';
16
19
  export * from './components/ps-fab';
17
20
  export * from './components/ps-infinite-scroll';
@@ -126,3 +129,7 @@ export * from './models/ps-detail-list-item';
126
129
  export * from './models/ps-start-panel-step';
127
130
  export * from './models/ps-step-list-item';
128
131
  export * from './models/ps-summary-item';
132
+ export * from './components/ps-drag-grip';
133
+ export * from './components/ps-drag-overlay';
134
+ export * from './hooks/use-ps-drag-sensors';
135
+ export * from './hooks/use-ps-reduced-motion';
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,2 @@
1
+ import { type SensorDescriptor, type SensorOptions } from '@dnd-kit/core';
2
+ export declare const usePsDragSensors: () => SensorDescriptor<SensorOptions>[];
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.usePsDragSensors = void 0;
4
+ const core_1 = require("@dnd-kit/core");
5
+ const sortable_1 = require("@dnd-kit/sortable");
6
+ const ps_drag_config_1 = require("../constants/ps-drag-config");
7
+ const usePsDragSensors = () => (0, core_1.useSensors)((0, core_1.useSensor)(core_1.MouseSensor, {
8
+ activationConstraint: { distance: ps_drag_config_1.PsDragConfig.activationDistance },
9
+ }), (0, core_1.useSensor)(core_1.TouchSensor, {
10
+ activationConstraint: {
11
+ delay: ps_drag_config_1.PsDragConfig.touchDelay,
12
+ tolerance: ps_drag_config_1.PsDragConfig.touchTolerance,
13
+ },
14
+ }), (0, core_1.useSensor)(core_1.KeyboardSensor, { coordinateGetter: sortable_1.sortableKeyboardCoordinates }));
15
+ exports.usePsDragSensors = usePsDragSensors;
@@ -0,0 +1 @@
1
+ export declare const usePsReducedMotion: () => boolean;
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.usePsReducedMotion = void 0;
4
+ const react_1 = require("react");
5
+ const usePsReducedMotion = () => {
6
+ const [isReduced, setIsReduced] = (0, react_1.useState)(false);
7
+ (0, react_1.useEffect)(() => {
8
+ if (typeof window.matchMedia !== 'function')
9
+ return;
10
+ const query = window.matchMedia('(prefers-reduced-motion: reduce)');
11
+ const update = () => setIsReduced(query.matches);
12
+ update();
13
+ query.addEventListener('change', update);
14
+ return () => query.removeEventListener('change', update);
15
+ }, []);
16
+ return isReduced;
17
+ };
18
+ exports.usePsReducedMotion = usePsReducedMotion;
package/dist/index.d.ts CHANGED
@@ -12,6 +12,9 @@ export * from './constants/ps-pallasoft-mark-config';
12
12
  export * from './components/ps-card';
13
13
  export * from './components/ps-client-only';
14
14
  export * from './components/ps-draggable-grid';
15
+ export * from './components/ps-sortable-list';
16
+ export * from './constants/ps-drag-config';
17
+ export * from './models/ps-sortable-list';
15
18
  export * from './components/ps-empty-state';
16
19
  export * from './components/ps-fab';
17
20
  export * from './components/ps-infinite-scroll';
@@ -126,3 +129,7 @@ export * from './models/ps-detail-list-item';
126
129
  export * from './models/ps-start-panel-step';
127
130
  export * from './models/ps-step-list-item';
128
131
  export * from './models/ps-summary-item';
132
+ export * from './components/ps-drag-grip';
133
+ export * from './components/ps-drag-overlay';
134
+ export * from './hooks/use-ps-drag-sensors';
135
+ export * from './hooks/use-ps-reduced-motion';