@vkzstudio/muza-ui 1.0.7 → 1.0.8
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.
- package/dist/components/Chip/Chip.d.ts +43 -0
- package/dist/components/Chip/Chip.d.ts.map +1 -0
- package/dist/components/Chip/Chip.js +98 -0
- package/dist/components/Chip/Chip.stories.d.ts +9 -0
- package/dist/components/Chip/Chip.stories.d.ts.map +1 -0
- package/dist/components/Chip/index.d.ts +2 -0
- package/dist/components/Chip/index.d.ts.map +1 -0
- package/dist/components/DataTable/DataTable.d.ts +10 -4
- package/dist/components/DataTable/DataTable.d.ts.map +1 -1
- package/dist/components/DataTable/DataTable.js +77 -49
- package/dist/components/DataTable/DataTable.stories.d.ts +4 -0
- package/dist/components/DataTable/DataTable.stories.d.ts.map +1 -1
- package/dist/components/DataTable/index.d.ts +1 -1
- package/dist/components/DataTable/index.d.ts.map +1 -1
- package/dist/components/Reorderable/Reorderable.d.ts +100 -0
- package/dist/components/Reorderable/Reorderable.d.ts.map +1 -0
- package/dist/components/Reorderable/Reorderable.js +197 -0
- package/dist/components/Reorderable/Reorderable.stories.d.ts +14 -0
- package/dist/components/Reorderable/Reorderable.stories.d.ts.map +1 -0
- package/dist/components/Reorderable/index.d.ts +2 -0
- package/dist/components/Reorderable/index.d.ts.map +1 -0
- package/dist/components/ReorderableTable/ReorderableTable.d.ts +40 -0
- package/dist/components/ReorderableTable/ReorderableTable.d.ts.map +1 -0
- package/dist/components/ReorderableTable/ReorderableTable.js +175 -0
- package/dist/components/ReorderableTable/ReorderableTable.stories.d.ts +18 -0
- package/dist/components/ReorderableTable/ReorderableTable.stories.d.ts.map +1 -0
- package/dist/components/ReorderableTable/index.d.ts +2 -0
- package/dist/components/ReorderableTable/index.d.ts.map +1 -0
- package/dist/components/SwipeButton/SwipeButton.js +8 -8
- package/dist/components/index.d.ts +3 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/index.js +196 -183
- package/dist/muza-ui.css +1 -1
- package/dist/node_modules/framer-motion/dist/es/components/Reorder/Group.js +38 -0
- package/dist/node_modules/framer-motion/dist/es/components/Reorder/Item.js +29 -0
- package/dist/node_modules/framer-motion/dist/es/components/Reorder/utils/check-reorder.js +17 -0
- package/dist/node_modules/framer-motion/dist/es/context/ReorderContext.js +5 -0
- package/dist/node_modules/motion-utils/dist/es/array.js +15 -6
- package/dist/translations/locales/cs.d.ts.map +1 -1
- package/dist/translations/locales/cs.js +4 -0
- package/dist/translations/locales/en.d.ts.map +1 -1
- package/dist/translations/locales/en.js +4 -0
- package/dist/translations/locales/sk.d.ts.map +1 -1
- package/dist/translations/locales/sk.js +4 -0
- package/dist/translations/types.d.ts +8 -0
- package/dist/translations/types.d.ts.map +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
import { jsx as u } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as y, useContext as P, useRef as _, useCallback as A, createContext as E } from "react";
|
|
3
|
+
import { useMuzaTranslations as K } from "../../translations/TranslationContext.js";
|
|
4
|
+
import { useDragControls as S } from "../../node_modules/framer-motion/dist/es/gestures/drag/use-drag-controls.js";
|
|
5
|
+
import { motion as O } from "../../node_modules/framer-motion/dist/es/render/components/motion/proxy.js";
|
|
6
|
+
import { cn as I } from "../../utils/cn.js";
|
|
7
|
+
import { ReorderGroup as U } from "../../node_modules/framer-motion/dist/es/components/Reorder/Group.js";
|
|
8
|
+
import { ReorderItem as Y } from "../../node_modules/framer-motion/dist/es/components/Reorder/Item.js";
|
|
9
|
+
const k = E({}), z = 50, N = 3, M = () => P(k), H = E(null), j = () => {
|
|
10
|
+
const r = P(H);
|
|
11
|
+
if (!r)
|
|
12
|
+
throw new Error("useReorderableItem must be used within a ReorderableItem");
|
|
13
|
+
return r;
|
|
14
|
+
}, V = ({
|
|
15
|
+
values: r,
|
|
16
|
+
onReorder: s,
|
|
17
|
+
axis: l = "y",
|
|
18
|
+
as: c = "ol",
|
|
19
|
+
disabled: o = !1,
|
|
20
|
+
layoutScroll: b = !1,
|
|
21
|
+
style: w,
|
|
22
|
+
className: D,
|
|
23
|
+
children: g
|
|
24
|
+
}, n) => {
|
|
25
|
+
const m = K(), f = {
|
|
26
|
+
disabled: o,
|
|
27
|
+
values: r,
|
|
28
|
+
onReorder: o ? void 0 : s,
|
|
29
|
+
axis: l
|
|
30
|
+
};
|
|
31
|
+
return /* @__PURE__ */ u(
|
|
32
|
+
k.Provider,
|
|
33
|
+
{
|
|
34
|
+
value: f,
|
|
35
|
+
children: /* @__PURE__ */ u(
|
|
36
|
+
U,
|
|
37
|
+
{
|
|
38
|
+
ref: n,
|
|
39
|
+
axis: l,
|
|
40
|
+
values: r,
|
|
41
|
+
onReorder: o ? () => {
|
|
42
|
+
} : s,
|
|
43
|
+
as: c,
|
|
44
|
+
layoutScroll: b,
|
|
45
|
+
style: w,
|
|
46
|
+
role: "list",
|
|
47
|
+
"aria-label": m.reorderableTable.listAriaLabel,
|
|
48
|
+
className: I(D),
|
|
49
|
+
children: g
|
|
50
|
+
}
|
|
51
|
+
)
|
|
52
|
+
}
|
|
53
|
+
);
|
|
54
|
+
}, Z = y(V);
|
|
55
|
+
Z.displayName = "ReorderableGroup";
|
|
56
|
+
const q = ({
|
|
57
|
+
value: r,
|
|
58
|
+
as: s = "li",
|
|
59
|
+
disabled: l = !1,
|
|
60
|
+
dragListenerDisabled: c = !1,
|
|
61
|
+
whileDrag: o,
|
|
62
|
+
className: b,
|
|
63
|
+
children: w
|
|
64
|
+
}, D) => {
|
|
65
|
+
const {
|
|
66
|
+
disabled: g,
|
|
67
|
+
values: n,
|
|
68
|
+
onReorder: m,
|
|
69
|
+
axis: f
|
|
70
|
+
} = M(), v = S(), t = l || g, a = !t && !c, R = A(
|
|
71
|
+
(d) => {
|
|
72
|
+
if (!n || !m) return;
|
|
73
|
+
const i = n.indexOf(r);
|
|
74
|
+
if (i === -1) return;
|
|
75
|
+
const e = i + d;
|
|
76
|
+
if (e < 0 || e >= n.length) return;
|
|
77
|
+
const p = [...n];
|
|
78
|
+
p.splice(i, 1), p.splice(e, 0, r), m(p);
|
|
79
|
+
},
|
|
80
|
+
[n, m, r]
|
|
81
|
+
), x = A(
|
|
82
|
+
(d) => {
|
|
83
|
+
if (!a) return;
|
|
84
|
+
const i = f === "y" ? "ArrowUp" : "ArrowLeft", e = f === "y" ? "ArrowDown" : "ArrowRight";
|
|
85
|
+
d.key === i ? (d.preventDefault(), R(-1)) : d.key === e && (d.preventDefault(), R(1));
|
|
86
|
+
},
|
|
87
|
+
[a, f, R]
|
|
88
|
+
);
|
|
89
|
+
return /* @__PURE__ */ u(
|
|
90
|
+
H.Provider,
|
|
91
|
+
{
|
|
92
|
+
value: { dragControls: v, dragListenerDisabled: c, moveItem: R },
|
|
93
|
+
children: /* @__PURE__ */ u(
|
|
94
|
+
Y,
|
|
95
|
+
{
|
|
96
|
+
ref: D,
|
|
97
|
+
value: r,
|
|
98
|
+
as: s,
|
|
99
|
+
dragControls: v,
|
|
100
|
+
dragListener: a,
|
|
101
|
+
tabIndex: a ? 0 : void 0,
|
|
102
|
+
role: "listitem",
|
|
103
|
+
"aria-disabled": t,
|
|
104
|
+
onKeyDown: x,
|
|
105
|
+
className: I(
|
|
106
|
+
a && "cursor-grab active:cursor-grabbing",
|
|
107
|
+
a && "focus-visible-default",
|
|
108
|
+
b
|
|
109
|
+
),
|
|
110
|
+
whileDrag: {
|
|
111
|
+
zIndex: z,
|
|
112
|
+
position: "relative",
|
|
113
|
+
...o
|
|
114
|
+
},
|
|
115
|
+
children: w
|
|
116
|
+
}
|
|
117
|
+
)
|
|
118
|
+
}
|
|
119
|
+
);
|
|
120
|
+
}, B = y(q);
|
|
121
|
+
B.displayName = "ReorderableItem";
|
|
122
|
+
const F = y(
|
|
123
|
+
({
|
|
124
|
+
as: r = "button",
|
|
125
|
+
disabled: s = !1,
|
|
126
|
+
"aria-label": l,
|
|
127
|
+
className: c,
|
|
128
|
+
children: o
|
|
129
|
+
}, b) => {
|
|
130
|
+
const w = K(), D = l ?? w.reorderableTable.dragHandleAriaLabel, { disabled: g, axis: n } = M(), { dragControls: m, dragListenerDisabled: f, moveItem: v } = j(), t = f && !g && !s, a = _(!1), R = (e) => {
|
|
131
|
+
if (!t) return;
|
|
132
|
+
a.current = !1;
|
|
133
|
+
const p = e.clientX, h = e.clientY, L = (G) => {
|
|
134
|
+
const T = Math.abs(G.clientX - p), X = Math.abs(G.clientY - h);
|
|
135
|
+
(T > N || X > N) && (a.current = !0);
|
|
136
|
+
}, C = () => {
|
|
137
|
+
document.removeEventListener("pointermove", L), document.removeEventListener("pointerup", C);
|
|
138
|
+
};
|
|
139
|
+
document.addEventListener("pointermove", L), document.addEventListener("pointerup", C), m.start(e);
|
|
140
|
+
}, x = (e) => {
|
|
141
|
+
a.current && (e.stopPropagation(), a.current = !1);
|
|
142
|
+
}, d = A(
|
|
143
|
+
(e) => {
|
|
144
|
+
if (!t) return;
|
|
145
|
+
const p = n === "y" ? "ArrowUp" : "ArrowLeft", h = n === "y" ? "ArrowDown" : "ArrowRight";
|
|
146
|
+
e.key === p ? (e.preventDefault(), v(-1)) : e.key === h && (e.preventDefault(), v(1));
|
|
147
|
+
},
|
|
148
|
+
[t, n, v]
|
|
149
|
+
), i = {
|
|
150
|
+
"aria-label": D,
|
|
151
|
+
"aria-roledescription": "sortable",
|
|
152
|
+
onPointerDown: R,
|
|
153
|
+
onKeyDown: d,
|
|
154
|
+
onClick: x,
|
|
155
|
+
className: I(
|
|
156
|
+
"touch-none select-none",
|
|
157
|
+
t && "cursor-grab active:cursor-grabbing",
|
|
158
|
+
!t && "cursor-default",
|
|
159
|
+
t && "focus-visible-default",
|
|
160
|
+
c
|
|
161
|
+
)
|
|
162
|
+
};
|
|
163
|
+
return r === "button" ? /* @__PURE__ */ u("button", { ref: b, type: "button", disabled: s, ...i, children: o }) : r === "div" ? /* @__PURE__ */ u(
|
|
164
|
+
"div",
|
|
165
|
+
{
|
|
166
|
+
ref: b,
|
|
167
|
+
tabIndex: t ? 0 : void 0,
|
|
168
|
+
role: t ? "button" : void 0,
|
|
169
|
+
...i,
|
|
170
|
+
children: o
|
|
171
|
+
}
|
|
172
|
+
) : /* @__PURE__ */ u(
|
|
173
|
+
"span",
|
|
174
|
+
{
|
|
175
|
+
ref: b,
|
|
176
|
+
tabIndex: t ? 0 : void 0,
|
|
177
|
+
role: t ? "button" : void 0,
|
|
178
|
+
...i,
|
|
179
|
+
children: o
|
|
180
|
+
}
|
|
181
|
+
);
|
|
182
|
+
}
|
|
183
|
+
);
|
|
184
|
+
F.displayName = "ReorderableHandle";
|
|
185
|
+
const J = ({ as: r = "li", className: s, children: l }, c) => {
|
|
186
|
+
const o = O[r];
|
|
187
|
+
return /* @__PURE__ */ u(o, { ref: c, layout: !0, role: "listitem", className: I(s), children: l });
|
|
188
|
+
}, Q = y(J);
|
|
189
|
+
Q.displayName = "ReorderableStaticItem";
|
|
190
|
+
export {
|
|
191
|
+
Z as ReorderableGroup,
|
|
192
|
+
F as ReorderableHandle,
|
|
193
|
+
B as ReorderableItem,
|
|
194
|
+
Q as ReorderableStaticItem,
|
|
195
|
+
M as useReorderableGroup,
|
|
196
|
+
j as useReorderableItem
|
|
197
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
+
import { ReorderableGroup } from './Reorderable';
|
|
3
|
+
declare const meta: Meta<typeof ReorderableGroup>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof ReorderableGroup>;
|
|
6
|
+
export declare const Default: Story;
|
|
7
|
+
export declare const WithHandle: Story;
|
|
8
|
+
export declare const Disabled: Story;
|
|
9
|
+
export declare const HorizontalAxis: Story;
|
|
10
|
+
export declare const TableRows: Story;
|
|
11
|
+
export declare const ScrollableList: Story;
|
|
12
|
+
export declare const ContentBlocks: Story;
|
|
13
|
+
export declare const StaticItem: Story;
|
|
14
|
+
//# sourceMappingURL=Reorderable.stories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Reorderable.stories.d.ts","sourceRoot":"","sources":["../../../src/components/Reorderable/Reorderable.stories.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AAW3D,OAAO,EACL,gBAAgB,EAIjB,MAAM,eAAe,CAAA;AAwFtB,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,gBAAgB,CA0FvC,CAAA;AAED,eAAe,IAAI,CAAA;AACnB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,gBAAgB,CAAC,CAAA;AAU9C,eAAO,MAAM,OAAO,EAAE,KAiCrB,CAAA;AAED,eAAO,MAAM,UAAU,EAAE,KAsCxB,CAAA;AAED,eAAO,MAAM,QAAQ,EAAE,KAuCtB,CAAA;AAED,eAAO,MAAM,cAAc,EAAE,KAmC5B,CAAA;AASD,eAAO,MAAM,SAAS,EAAE,KA2FvB,CAAA;AAgBD,eAAO,MAAM,cAAc,EAAE,KAsC5B,CAAA;AAmBD,eAAO,MAAM,aAAa,EAAE,KAgD3B,CAAA;AA4BD,eAAO,MAAM,UAAU,EAAE,KAkDxB,CAAA"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export { ReorderableGroup, ReorderableItem, ReorderableHandle, ReorderableStaticItem, useReorderableGroup, useReorderableItem, type ReorderableGroupProps, type ReorderableItemProps, type ReorderableHandleProps, type ReorderableStaticItemProps, } from './Reorderable';
|
|
2
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Reorderable/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,eAAe,EACf,iBAAiB,EACjB,qBAAqB,EACrB,mBAAmB,EACnB,kBAAkB,EAClB,KAAK,qBAAqB,EAC1B,KAAK,oBAAoB,EACzB,KAAK,sBAAsB,EAC3B,KAAK,0BAA0B,GAChC,MAAM,eAAe,CAAA"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { ForwardedRef, ReactNode } from 'react';
|
|
2
|
+
export interface ReorderableTableColumn<T> {
|
|
3
|
+
/** Key from data object */
|
|
4
|
+
dataKey: keyof T;
|
|
5
|
+
/** Column header text */
|
|
6
|
+
title: ReactNode;
|
|
7
|
+
/** CSS classes for cells in this column */
|
|
8
|
+
className?: string;
|
|
9
|
+
/** Text truncation: true/1 = line-clamp-1, 2 = line-clamp-2 */
|
|
10
|
+
lineClamp?: boolean | 1 | 2;
|
|
11
|
+
/** Custom cell rendering */
|
|
12
|
+
render?: (value: T[keyof T], rowData: T, rowIndex: number) => ReactNode;
|
|
13
|
+
}
|
|
14
|
+
export interface ReorderableTableProps<T extends {
|
|
15
|
+
id: string | number;
|
|
16
|
+
}> extends Omit<React.HTMLAttributes<HTMLTableElement>, 'children'> {
|
|
17
|
+
/** Array of data objects - each must have an `id` field */
|
|
18
|
+
data: T[];
|
|
19
|
+
/** Callback when rows are reordered */
|
|
20
|
+
onReorder: (newOrder: T[]) => void;
|
|
21
|
+
/** Column definitions */
|
|
22
|
+
columns: ReorderableTableColumn<T>[];
|
|
23
|
+
/** Show table header - defaults to false */
|
|
24
|
+
showHeader?: boolean;
|
|
25
|
+
/** Disable all reordering */
|
|
26
|
+
disabled?: boolean;
|
|
27
|
+
/** Function to determine if a specific row is disabled */
|
|
28
|
+
isRowDisabled?: (rowData: T, rowIndex: number) => boolean;
|
|
29
|
+
/** Custom CSS classes for table container */
|
|
30
|
+
className?: string;
|
|
31
|
+
/** Show/hide drag handle column with animation - defaults to true */
|
|
32
|
+
isMovable?: boolean;
|
|
33
|
+
}
|
|
34
|
+
declare const ReorderableTable: <T extends {
|
|
35
|
+
id: string | number;
|
|
36
|
+
}>(props: ReorderableTableProps<T> & {
|
|
37
|
+
ref?: ForwardedRef<HTMLTableElement>;
|
|
38
|
+
}) => React.ReactElement;
|
|
39
|
+
export { ReorderableTable };
|
|
40
|
+
//# sourceMappingURL=ReorderableTable.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ReorderableTable.d.ts","sourceRoot":"","sources":["../../../src/components/ReorderableTable/ReorderableTable.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,YAAY,EAAE,KAAK,SAAS,EAAc,MAAM,OAAO,CAAA;AAWrE,MAAM,WAAW,sBAAsB,CAAC,CAAC;IACvC,2BAA2B;IAC3B,OAAO,EAAE,MAAM,CAAC,CAAA;IAChB,yBAAyB;IACzB,KAAK,EAAE,SAAS,CAAA;IAChB,2CAA2C;IAC3C,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,+DAA+D;IAC/D,SAAS,CAAC,EAAE,OAAO,GAAG,CAAC,GAAG,CAAC,CAAA;IAC3B,4BAA4B;IAC5B,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,QAAQ,EAAE,MAAM,KAAK,SAAS,CAAA;CACxE;AAED,MAAM,WAAW,qBAAqB,CAAC,CAAC,SAAS;IAAE,EAAE,EAAE,MAAM,GAAG,MAAM,CAAA;CAAE,CACtE,SAAQ,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,gBAAgB,CAAC,EAAE,UAAU,CAAC;IAChE,2DAA2D;IAC3D,IAAI,EAAE,CAAC,EAAE,CAAA;IACT,uCAAuC;IACvC,SAAS,EAAE,CAAC,QAAQ,EAAE,CAAC,EAAE,KAAK,IAAI,CAAA;IAClC,yBAAyB;IACzB,OAAO,EAAE,sBAAsB,CAAC,CAAC,CAAC,EAAE,CAAA;IACpC,4CAA4C;IAC5C,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,6BAA6B;IAC7B,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,0DAA0D;IAC1D,aAAa,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,EAAE,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAA;IACzD,6CAA6C;IAC7C,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,qEAAqE;IACrE,SAAS,CAAC,EAAE,OAAO,CAAA;CACpB;AAkND,QAAA,MAAM,gBAAgB,EAAwC,CAC5D,CAAC,SAAS;IAAE,EAAE,EAAE,MAAM,GAAG,MAAM,CAAA;CAAE,EAEjC,KAAK,EAAE,qBAAqB,CAAC,CAAC,CAAC,GAAG;IAAE,GAAG,CAAC,EAAE,YAAY,CAAC,gBAAgB,CAAC,CAAA;CAAE,KACvE,KAAK,CAAC,YAAY,CACtB;AAED,OAAO,EAAE,gBAAgB,EAAE,CAAA"}
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
import { jsx as e, jsxs as m } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as I } from "react";
|
|
3
|
+
import { typographyVariants as T, Typography as w } from "../Typography/Typography.js";
|
|
4
|
+
import { ReorderableGroup as A, ReorderableItem as C, ReorderableHandle as H } from "../Reorderable/Reorderable.js";
|
|
5
|
+
import { Reorder as O } from "../Icons/CustomIcons.js";
|
|
6
|
+
import { cn as s } from "../../utils/cn.js";
|
|
7
|
+
import { motion as n } from "../../node_modules/framer-motion/dist/es/render/components/motion/proxy.js";
|
|
8
|
+
const p = 72, u = 20, k = 24, E = 4, D = ({
|
|
9
|
+
data: b,
|
|
10
|
+
onReorder: N,
|
|
11
|
+
columns: o,
|
|
12
|
+
showHeader: x = !1,
|
|
13
|
+
disabled: h = !1,
|
|
14
|
+
isRowDisabled: l,
|
|
15
|
+
className: y,
|
|
16
|
+
isMovable: i = !0,
|
|
17
|
+
...g
|
|
18
|
+
}, L) => /* @__PURE__ */ e("div", { className: "w-full", children: /* @__PURE__ */ m(
|
|
19
|
+
"table",
|
|
20
|
+
{
|
|
21
|
+
ref: L,
|
|
22
|
+
className: s(
|
|
23
|
+
"-my-sm w-full border-separate border-spacing-y-sm",
|
|
24
|
+
y
|
|
25
|
+
),
|
|
26
|
+
...g,
|
|
27
|
+
children: [
|
|
28
|
+
x && /* @__PURE__ */ e("thead", { children: /* @__PURE__ */ m("tr", { children: [
|
|
29
|
+
o.map((r, d) => /* @__PURE__ */ e(
|
|
30
|
+
"th",
|
|
31
|
+
{
|
|
32
|
+
className: s(
|
|
33
|
+
T({
|
|
34
|
+
size: "sm",
|
|
35
|
+
uppercase: !0,
|
|
36
|
+
variant: "body",
|
|
37
|
+
weight: "medium"
|
|
38
|
+
}),
|
|
39
|
+
"px-comp-table-p text-left text-text-dark-secondary",
|
|
40
|
+
r.className
|
|
41
|
+
),
|
|
42
|
+
children: r.title
|
|
43
|
+
},
|
|
44
|
+
d
|
|
45
|
+
)),
|
|
46
|
+
/* @__PURE__ */ e(
|
|
47
|
+
n.th,
|
|
48
|
+
{
|
|
49
|
+
initial: !1,
|
|
50
|
+
animate: {
|
|
51
|
+
width: i ? p : u
|
|
52
|
+
},
|
|
53
|
+
transition: { duration: 0.3, ease: "easeInOut" },
|
|
54
|
+
className: "overflow-hidden"
|
|
55
|
+
}
|
|
56
|
+
)
|
|
57
|
+
] }) }),
|
|
58
|
+
/* @__PURE__ */ e(
|
|
59
|
+
A,
|
|
60
|
+
{
|
|
61
|
+
values: b,
|
|
62
|
+
onReorder: N,
|
|
63
|
+
disabled: h,
|
|
64
|
+
as: "div",
|
|
65
|
+
className: "contents",
|
|
66
|
+
children: b.map((r, d) => {
|
|
67
|
+
const _ = (l == null ? void 0 : l(r, d)) ?? !1, t = h || _;
|
|
68
|
+
return /* @__PURE__ */ m(
|
|
69
|
+
C,
|
|
70
|
+
{
|
|
71
|
+
value: r,
|
|
72
|
+
as: "tr",
|
|
73
|
+
disabled: t,
|
|
74
|
+
dragListenerDisabled: !0,
|
|
75
|
+
whileDrag: t ? void 0 : { boxShadow: "0 8px 32px 0 rgba(59, 18, 107, 0.2)" },
|
|
76
|
+
className: "group rounded-2xl",
|
|
77
|
+
children: [
|
|
78
|
+
o.map((a, c) => {
|
|
79
|
+
const v = c === 0, f = c === o.length - 1;
|
|
80
|
+
return /* @__PURE__ */ e(
|
|
81
|
+
n.td,
|
|
82
|
+
{
|
|
83
|
+
initial: !1,
|
|
84
|
+
animate: f ? {
|
|
85
|
+
paddingRight: i ? k : E
|
|
86
|
+
} : void 0,
|
|
87
|
+
transition: { duration: 0.3, ease: "easeInOut" },
|
|
88
|
+
className: s(
|
|
89
|
+
"h-comp-table-h border-y border-stroke-base-secondary bg-surface-base-primary align-middle",
|
|
90
|
+
f ? "pl-2xl" : "px-2xl",
|
|
91
|
+
{
|
|
92
|
+
"rounded-l-xl border-l": v,
|
|
93
|
+
"group-focus-within:border-icon-brand-focus group-hover:border-icon-brand-hover": !t
|
|
94
|
+
},
|
|
95
|
+
a.className
|
|
96
|
+
),
|
|
97
|
+
children: a.render ? a.render(
|
|
98
|
+
r[a.dataKey],
|
|
99
|
+
r,
|
|
100
|
+
d
|
|
101
|
+
) : /* @__PURE__ */ e(
|
|
102
|
+
w,
|
|
103
|
+
{
|
|
104
|
+
variant: "body",
|
|
105
|
+
size: "base",
|
|
106
|
+
weight: "regular",
|
|
107
|
+
component: "span",
|
|
108
|
+
className: s(
|
|
109
|
+
t && "text-text-dark-disabled",
|
|
110
|
+
{
|
|
111
|
+
"line-clamp-1": a.lineClamp === !0 || a.lineClamp === 1,
|
|
112
|
+
"line-clamp-2": a.lineClamp === 2
|
|
113
|
+
}
|
|
114
|
+
),
|
|
115
|
+
children: r[a.dataKey]
|
|
116
|
+
}
|
|
117
|
+
)
|
|
118
|
+
},
|
|
119
|
+
c
|
|
120
|
+
);
|
|
121
|
+
}),
|
|
122
|
+
/* @__PURE__ */ e(
|
|
123
|
+
n.td,
|
|
124
|
+
{
|
|
125
|
+
initial: !1,
|
|
126
|
+
animate: {
|
|
127
|
+
width: i ? p : u
|
|
128
|
+
},
|
|
129
|
+
transition: { duration: 0.3, ease: "easeInOut" },
|
|
130
|
+
className: s(
|
|
131
|
+
// min-w-[20px] matches HANDLE_COLUMN_MIN_WIDTH constant (Figma design)
|
|
132
|
+
"h-comp-table-h min-w-[20px] rounded-r-xl border-y border-r border-stroke-base-secondary bg-surface-base-primary align-middle",
|
|
133
|
+
{
|
|
134
|
+
"group-focus-within:border-icon-brand-focus group-hover:border-icon-brand-hover": !t
|
|
135
|
+
}
|
|
136
|
+
),
|
|
137
|
+
children: /* @__PURE__ */ e(
|
|
138
|
+
n.div,
|
|
139
|
+
{
|
|
140
|
+
initial: !1,
|
|
141
|
+
animate: {
|
|
142
|
+
opacity: i ? 1 : 0,
|
|
143
|
+
width: i ? p : 0
|
|
144
|
+
},
|
|
145
|
+
transition: { duration: 0.3, ease: "easeInOut" },
|
|
146
|
+
className: "flex h-full items-center justify-center overflow-hidden border-l border-stroke-base-secondary",
|
|
147
|
+
children: /* @__PURE__ */ e(
|
|
148
|
+
H,
|
|
149
|
+
{
|
|
150
|
+
disabled: !i || t,
|
|
151
|
+
className: s(
|
|
152
|
+
"flex h-comp-button-h-sm w-comp-button-w-sm items-center justify-center focus-visible-default",
|
|
153
|
+
t ? "text-text-dark-disabled" : "text-text-brand-def"
|
|
154
|
+
),
|
|
155
|
+
children: /* @__PURE__ */ e(O, { className: "size-icon-default" })
|
|
156
|
+
}
|
|
157
|
+
)
|
|
158
|
+
}
|
|
159
|
+
)
|
|
160
|
+
}
|
|
161
|
+
)
|
|
162
|
+
]
|
|
163
|
+
},
|
|
164
|
+
r.id
|
|
165
|
+
);
|
|
166
|
+
})
|
|
167
|
+
}
|
|
168
|
+
)
|
|
169
|
+
]
|
|
170
|
+
}
|
|
171
|
+
) }), R = I(D);
|
|
172
|
+
R.displayName = "ReorderableTable";
|
|
173
|
+
export {
|
|
174
|
+
R as ReorderableTable
|
|
175
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
+
import { ReorderableTable } from './ReorderableTable';
|
|
3
|
+
interface IBenefit {
|
|
4
|
+
id: string;
|
|
5
|
+
name: string;
|
|
6
|
+
image: string;
|
|
7
|
+
lastEdited: string;
|
|
8
|
+
text: string;
|
|
9
|
+
status: 'active' | 'inactive';
|
|
10
|
+
}
|
|
11
|
+
declare const meta: Meta<typeof ReorderableTable>;
|
|
12
|
+
export default meta;
|
|
13
|
+
type Story = StoryObj<typeof ReorderableTable<IBenefit>>;
|
|
14
|
+
export declare const Default: Story;
|
|
15
|
+
export declare const WithoutHeader: Story;
|
|
16
|
+
export declare const WithDisabledRow: Story;
|
|
17
|
+
export declare const FullyDisabled: Story;
|
|
18
|
+
//# sourceMappingURL=ReorderableTable.stories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ReorderableTable.stories.d.ts","sourceRoot":"","sources":["../../../src/components/ReorderableTable/ReorderableTable.stories.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AAM3D,OAAO,EACL,gBAAgB,EAEjB,MAAM,oBAAoB,CAAA;AAE3B,UAAU,QAAQ;IAChB,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,CAAA;IACb,UAAU,EAAE,MAAM,CAAA;IAClB,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,QAAQ,GAAG,UAAU,CAAA;CAC9B;AAyCD,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,gBAAgB,CA6DvC,CAAA;AAED,eAAe,IAAI,CAAA;AACnB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,gBAAgB,CAAC,QAAQ,CAAC,CAAC,CAAA;AAExD,eAAO,MAAM,OAAO,EAAE,KAkHrB,CAAA;AAED,eAAO,MAAM,aAAa,EAAE,KAsG3B,CAAA;AAED,eAAO,MAAM,eAAe,EAAE,KA2G7B,CAAA;AAED,eAAO,MAAM,aAAa,EAAE,KAkG3B,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/ReorderableTable/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,KAAK,sBAAsB,EAC3B,KAAK,qBAAqB,GAC3B,MAAM,oBAAoB,CAAA"}
|
|
@@ -5,15 +5,15 @@ import { swipeButtonProgressVariants as _ } from "./swipeButtonProgressVariants.
|
|
|
5
5
|
import { swipeButtonSliderVariants as q } from "./swipeButtonSliderVariants.js";
|
|
6
6
|
import { swipeButtonVariants as G } from "./swipeButtonVariants.js";
|
|
7
7
|
import { useMuzaTranslations as H } from "../../translations/TranslationContext.js";
|
|
8
|
-
import {
|
|
9
|
-
import { useMotionValue as Q } from "../../node_modules/framer-motion/dist/es/value/use-motion-value.js";
|
|
8
|
+
import { useMotionValue as J } from "../../node_modules/framer-motion/dist/es/value/use-motion-value.js";
|
|
10
9
|
import { useTransform as T } from "../../node_modules/framer-motion/dist/es/value/use-transform.js";
|
|
11
|
-
import { useMotionValueEvent as
|
|
10
|
+
import { useMotionValueEvent as Q } from "../../node_modules/framer-motion/dist/es/utils/use-motion-value-event.js";
|
|
12
11
|
import { animate as u } from "../../node_modules/framer-motion/dist/es/animation/animate/index.js";
|
|
13
|
-
import { motion as E } from "../../node_modules/framer-motion/dist/es/render/components/motion/proxy.js";
|
|
14
12
|
import { Typography as V } from "../Typography/Typography.js";
|
|
15
|
-
import { DoubleArrowRight as
|
|
13
|
+
import { DoubleArrowRight as X } from "../Icons/CustomIcons.js";
|
|
14
|
+
import { useDragControls as Z } from "../../node_modules/framer-motion/dist/es/gestures/drag/use-drag-controls.js";
|
|
16
15
|
import { cn as y } from "../../utils/cn.js";
|
|
16
|
+
import { motion as E } from "../../node_modules/framer-motion/dist/es/render/components/motion/proxy.js";
|
|
17
17
|
import { UnreadOutline as ee } from "@solar-icons/react-perf";
|
|
18
18
|
const ve = ({
|
|
19
19
|
text: z,
|
|
@@ -31,7 +31,7 @@ const ve = ({
|
|
|
31
31
|
onResetComplete: I,
|
|
32
32
|
className: C
|
|
33
33
|
}) => {
|
|
34
|
-
const v = H(), O = L ?? v.swipeButton.successText, R = M ?? v.swipeButton.loadingText, j = v.swipeButton.processingAriaLabel, K = D(null), m = D(null), d = D(null), [a, W] = B(0), [x, l] = B(!1), g =
|
|
34
|
+
const v = H(), O = L ?? v.swipeButton.successText, R = M ?? v.swipeButton.loadingText, j = v.swipeButton.processingAriaLabel, K = D(null), m = D(null), d = D(null), [a, W] = B(0), [x, l] = B(!1), g = Z(), r = J(0), Y = T(r, [0, a], [0, 1]), k = T(r, [0, a * 0.5], [1, 0]), P = T(
|
|
35
35
|
Y,
|
|
36
36
|
(e) => `calc(${e}*(100% - var(--slider-size) - 2px) + var(--slider-size))`
|
|
37
37
|
), c = !t && !n && !p || i;
|
|
@@ -42,7 +42,7 @@ const ve = ({
|
|
|
42
42
|
);
|
|
43
43
|
};
|
|
44
44
|
return e(), window.addEventListener("resize", e), () => window.removeEventListener("resize", e);
|
|
45
|
-
}, [d, m, o]),
|
|
45
|
+
}, [d, m, o]), Q(r, "change", (e) => {
|
|
46
46
|
if (c)
|
|
47
47
|
e / a >= 0.9 && !p ? l(!0) : l(!1);
|
|
48
48
|
else return;
|
|
@@ -164,7 +164,7 @@ const ve = ({
|
|
|
164
164
|
children: [
|
|
165
165
|
n && /* @__PURE__ */ s(ee, { className: "size-icon-small" }),
|
|
166
166
|
t && !n && /* @__PURE__ */ s(U, { className: "size-icon-small" }),
|
|
167
|
-
!t && !n && /* @__PURE__ */ s(
|
|
167
|
+
!t && !n && /* @__PURE__ */ s(X, { className: "size-icon-small" })
|
|
168
168
|
]
|
|
169
169
|
}
|
|
170
170
|
)
|
|
@@ -6,6 +6,7 @@ export * from './Breadcrumb';
|
|
|
6
6
|
export * from './Button';
|
|
7
7
|
export * from './Calendar';
|
|
8
8
|
export * from './Checkbox';
|
|
9
|
+
export * from './Chip';
|
|
9
10
|
export * from './DatePicker';
|
|
10
11
|
export * from './Dialog';
|
|
11
12
|
export * from './DropdownMenu';
|
|
@@ -25,6 +26,8 @@ export * from './PasswordInput';
|
|
|
25
26
|
export * from './PinIndicator';
|
|
26
27
|
export * from './Popover';
|
|
27
28
|
export * from './Radio';
|
|
29
|
+
export * from './Reorderable';
|
|
30
|
+
export * from './ReorderableTable';
|
|
28
31
|
export * from './Searchbar';
|
|
29
32
|
export * from './Select';
|
|
30
33
|
export * from './SegmentedControl';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AACA,cAAc,iBAAiB,CAAA;AAG/B,cAAc,aAAa,CAAA;AAC3B,cAAc,SAAS,CAAA;AACvB,cAAc,UAAU,CAAA;AACxB,cAAc,cAAc,CAAA;AAC5B,cAAc,UAAU,CAAA;AACxB,cAAc,YAAY,CAAA;AAC1B,cAAc,YAAY,CAAA;AAC1B,cAAc,cAAc,CAAA;AAC5B,cAAc,UAAU,CAAA;AACxB,cAAc,gBAAgB,CAAA;AAC9B,cAAc,cAAc,CAAA;AAC5B,cAAc,cAAc,CAAA;AAC5B,cAAc,cAAc,CAAA;AAC5B,cAAc,QAAQ,CAAA;AACtB,cAAc,SAAS,CAAA;AACvB,cAAc,SAAS,CAAA;AACvB,cAAc,YAAY,CAAA;AAC1B,cAAc,oBAAoB,CAAA;AAClC,cAAc,UAAU,CAAA;AACxB,cAAc,eAAe,CAAA;AAC7B,cAAc,eAAe,CAAA;AAC7B,cAAc,kBAAkB,CAAA;AAChC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,WAAW,CAAA;AACzB,cAAc,SAAS,CAAA;AACvB,cAAc,aAAa,CAAA;AAC3B,cAAc,UAAU,CAAA;AACxB,cAAc,oBAAoB,CAAA;AAClC,cAAc,wBAAwB,CAAA;AACtC,cAAc,oBAAoB,CAAA;AAClC,cAAc,SAAS,CAAA;AACvB,cAAc,WAAW,CAAA;AACzB,cAAc,eAAe,CAAA;AAC7B,cAAc,UAAU,CAAA;AACxB,cAAc,OAAO,CAAA;AACrB,cAAc,YAAY,CAAA;AAC1B,cAAc,cAAc,CAAA;AAC5B,cAAc,UAAU,CAAA;AACxB,cAAc,eAAe,CAAA;AAC7B,cAAc,WAAW,CAAA;AACzB,cAAc,cAAc,CAAA;AAC5B,cAAc,aAAa,CAAA;AAC3B,cAAc,mBAAmB,CAAA;AACjC,cAAc,YAAY,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AACA,cAAc,iBAAiB,CAAA;AAG/B,cAAc,aAAa,CAAA;AAC3B,cAAc,SAAS,CAAA;AACvB,cAAc,UAAU,CAAA;AACxB,cAAc,cAAc,CAAA;AAC5B,cAAc,UAAU,CAAA;AACxB,cAAc,YAAY,CAAA;AAC1B,cAAc,YAAY,CAAA;AAC1B,cAAc,QAAQ,CAAA;AACtB,cAAc,cAAc,CAAA;AAC5B,cAAc,UAAU,CAAA;AACxB,cAAc,gBAAgB,CAAA;AAC9B,cAAc,cAAc,CAAA;AAC5B,cAAc,cAAc,CAAA;AAC5B,cAAc,cAAc,CAAA;AAC5B,cAAc,QAAQ,CAAA;AACtB,cAAc,SAAS,CAAA;AACvB,cAAc,SAAS,CAAA;AACvB,cAAc,YAAY,CAAA;AAC1B,cAAc,oBAAoB,CAAA;AAClC,cAAc,UAAU,CAAA;AACxB,cAAc,eAAe,CAAA;AAC7B,cAAc,eAAe,CAAA;AAC7B,cAAc,kBAAkB,CAAA;AAChC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,WAAW,CAAA;AACzB,cAAc,SAAS,CAAA;AACvB,cAAc,eAAe,CAAA;AAC7B,cAAc,oBAAoB,CAAA;AAClC,cAAc,aAAa,CAAA;AAC3B,cAAc,UAAU,CAAA;AACxB,cAAc,oBAAoB,CAAA;AAClC,cAAc,wBAAwB,CAAA;AACtC,cAAc,oBAAoB,CAAA;AAClC,cAAc,SAAS,CAAA;AACvB,cAAc,WAAW,CAAA;AACzB,cAAc,eAAe,CAAA;AAC7B,cAAc,UAAU,CAAA;AACxB,cAAc,OAAO,CAAA;AACrB,cAAc,YAAY,CAAA;AAC1B,cAAc,cAAc,CAAA;AAC5B,cAAc,UAAU,CAAA;AACxB,cAAc,eAAe,CAAA;AAC7B,cAAc,WAAW,CAAA;AACzB,cAAc,cAAc,CAAA;AAC5B,cAAc,aAAa,CAAA;AAC3B,cAAc,mBAAmB,CAAA;AACjC,cAAc,YAAY,CAAA"}
|