prometeo-design-system 2.4.2 → 2.4.4
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/SegmentedButton.es.js +23 -27
- package/dist/Select.es.js +283 -274
- package/dist/exports/DrawerDesktop.d.ts +2 -0
- package/dist/exports/DrawerMobile.d.ts +2 -0
- package/dist/exports/Select.d.ts +3 -0
- package/dist/index.d.ts +7 -0
- package/dist/prometeo-design-system.css +1 -1
- package/package.json +1 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { j as u } from "./jsx-runtime-ByW6EXIE.js";
|
|
2
|
-
import { c as
|
|
2
|
+
import { c as s } from "./cn-B6yFEsav.js";
|
|
3
3
|
import z, { useState as M, useMemo as C, useEffect as L } from "react";
|
|
4
4
|
import { motion as E } from "framer-motion";
|
|
5
5
|
const X = (T) => {
|
|
6
|
-
const [c, _] = M({}), { size: t = "medium", color: R = "default", options: l, value: p, name: x, onChange: j, icon: y, allowExpand: n = !1, disabled:
|
|
6
|
+
const [c, _] = M({}), { size: t = "medium", color: R = "default", options: l, value: p, name: x, onChange: j, icon: y, allowExpand: n = !1, disabled: d = !1 } = T, m = Math.max(l.findIndex((e) => e.value === p), 0), w = l.length, N = 9, b = 26, o = {
|
|
7
7
|
small: 120,
|
|
8
8
|
medium: 120,
|
|
9
9
|
large: 120
|
|
@@ -46,10 +46,10 @@ const X = (T) => {
|
|
|
46
46
|
icon: "text-neutral-strong-disabled",
|
|
47
47
|
option: "text-neutral-strong-disabled"
|
|
48
48
|
}
|
|
49
|
-
}, I = l.find((e) => e.value === p) ?? l[0], g = I.label.length * N + k * 2 +
|
|
50
|
-
small: n ? W() : (
|
|
51
|
-
medium: n ? W() : (
|
|
52
|
-
large: n ? W() : (
|
|
49
|
+
}, I = l.find((e) => e.value === p) ?? l[0], g = I.label.length * N + k * 2 + b, W = () => C(() => Object.values(c).reduce((i, r) => i + r, 0) + b, [c]), v = {
|
|
50
|
+
small: n ? W() : (w - 1) * a.small + o.small,
|
|
51
|
+
medium: n ? W() : (w - 1) * a.medium + o.medium,
|
|
52
|
+
large: n ? W() : (w - 1) * a.large + o.large
|
|
53
53
|
};
|
|
54
54
|
L(() => {
|
|
55
55
|
if (!n) return;
|
|
@@ -59,33 +59,31 @@ const X = (T) => {
|
|
|
59
59
|
}), _(e);
|
|
60
60
|
}, []);
|
|
61
61
|
const H = C(() => n ? Object.values(c).reduce((e, i, r) => r < m ? e + i : e, 0) : Math.max(m * a[t] - 2, 0), [m]), D = () => {
|
|
62
|
-
if (
|
|
62
|
+
if (d) return;
|
|
63
63
|
const e = m === l.length - 1 ? l[0] : l[m + 1];
|
|
64
64
|
j?.(x, e.value);
|
|
65
|
-
}, h =
|
|
65
|
+
}, h = d ? "disabled" : R;
|
|
66
66
|
return /* @__PURE__ */ u.jsxs(
|
|
67
67
|
"button",
|
|
68
68
|
{
|
|
69
69
|
name: x,
|
|
70
70
|
type: "button",
|
|
71
|
-
id: "segmented-button-container",
|
|
72
71
|
style: {
|
|
73
72
|
width: v[t],
|
|
74
73
|
minWidth: v[t],
|
|
75
74
|
maxWidth: v[t]
|
|
76
75
|
},
|
|
77
|
-
className:
|
|
76
|
+
className: s(
|
|
78
77
|
S[t].container,
|
|
79
78
|
f[h].container,
|
|
80
79
|
"border-[1px]",
|
|
81
|
-
!
|
|
80
|
+
!d && "cursor-pointer",
|
|
82
81
|
"relative"
|
|
83
82
|
),
|
|
84
83
|
children: [
|
|
85
84
|
/* @__PURE__ */ u.jsxs(
|
|
86
85
|
E.div,
|
|
87
86
|
{
|
|
88
|
-
id: "segmented-button-switcher",
|
|
89
87
|
animate: {
|
|
90
88
|
left: `${H}px`,
|
|
91
89
|
width: n ? g : o[t],
|
|
@@ -97,25 +95,25 @@ const X = (T) => {
|
|
|
97
95
|
stiffness: 260,
|
|
98
96
|
damping: 30
|
|
99
97
|
},
|
|
100
|
-
className:
|
|
98
|
+
className: s(
|
|
101
99
|
"absolute top-0 left-0 h-full rounded-[6px] z-30",
|
|
102
100
|
"flex items-center justify-center gap-[2px] p-4",
|
|
103
101
|
f[h].switch
|
|
104
102
|
),
|
|
105
103
|
onClick: () => {
|
|
106
|
-
!
|
|
104
|
+
!d && D();
|
|
107
105
|
},
|
|
108
106
|
children: [
|
|
109
|
-
y && z.cloneElement(y, { className:
|
|
107
|
+
y && z.cloneElement(y, { className: s(
|
|
110
108
|
"w-6 h-6 text-neutral-weak-default min-w-6 min-h-6",
|
|
111
109
|
f[h].icon
|
|
112
110
|
) }),
|
|
113
111
|
/* @__PURE__ */ u.jsx(
|
|
114
112
|
"p",
|
|
115
113
|
{
|
|
116
|
-
className:
|
|
114
|
+
className: s(
|
|
117
115
|
"prometeo-fonts-label-large ",
|
|
118
|
-
" overflow-hidden overflow-ellipsis text-nowrap ",
|
|
116
|
+
" overflow-hidden overflow-ellipsis text-nowrap select-none ",
|
|
119
117
|
f[h].switch
|
|
120
118
|
),
|
|
121
119
|
children: I.label
|
|
@@ -127,19 +125,17 @@ const X = (T) => {
|
|
|
127
125
|
/* @__PURE__ */ u.jsx(
|
|
128
126
|
"div",
|
|
129
127
|
{
|
|
130
|
-
|
|
131
|
-
className: d(
|
|
128
|
+
className: s(
|
|
132
129
|
"absolute top-0 left-0 w-full h-full overflow-hidden",
|
|
133
130
|
"flex justify-center"
|
|
134
131
|
),
|
|
135
132
|
children: l?.map((e, i) => {
|
|
136
|
-
const r = e.value === (p || l[0].value), A = n ? c[i] +
|
|
133
|
+
const r = e.value === (p || l[0].value), A = n ? c[i] + b : o[t], P = n ? c[i] : a[t], O = r ? A : P;
|
|
137
134
|
return /* @__PURE__ */ u.jsx(
|
|
138
135
|
E.span,
|
|
139
136
|
{
|
|
140
|
-
id: "segmented-button-option",
|
|
141
137
|
onClick: () => {
|
|
142
|
-
!
|
|
138
|
+
!d && j?.(x, e.value);
|
|
143
139
|
},
|
|
144
140
|
animate: {
|
|
145
141
|
width: O,
|
|
@@ -150,12 +146,12 @@ const X = (T) => {
|
|
|
150
146
|
duration: 0.3,
|
|
151
147
|
delay: 0
|
|
152
148
|
},
|
|
153
|
-
className:
|
|
149
|
+
className: s(
|
|
154
150
|
"z-20 h-full ",
|
|
155
151
|
"flex items-center justify-center px-3 py-[6px]",
|
|
156
152
|
"prometeo-fonts-label-large text-neutral-medium-default",
|
|
157
|
-
" overflow-hidden ",
|
|
158
|
-
!
|
|
153
|
+
" overflow-hidden select-none ",
|
|
154
|
+
!d && "cursor-pointer"
|
|
159
155
|
),
|
|
160
156
|
"aria-label": e.label,
|
|
161
157
|
children: /* @__PURE__ */ u.jsx(
|
|
@@ -166,8 +162,8 @@ const X = (T) => {
|
|
|
166
162
|
minWidth: n ? "max-content" : a[t],
|
|
167
163
|
maxWidth: n ? "max-content" : a[t]
|
|
168
164
|
},
|
|
169
|
-
className:
|
|
170
|
-
"px-3 place-content-center overflow-hidden text-ellipsis text-wrap prometeo-fonts-label-large h-full",
|
|
165
|
+
className: s(
|
|
166
|
+
"px-3 place-content-center overflow-hidden text-ellipsis text-wrap prometeo-fonts-label-large h-full select-none",
|
|
171
167
|
f[h].option
|
|
172
168
|
),
|
|
173
169
|
children: e.label
|