impact-nova 1.7.4 → 1.7.6
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/ui/ag-grid-react/headers/components/truncated-text.d.ts +15 -0
- package/dist/components/ui/ag-grid-react/headers/components/truncated-text.js +27 -0
- package/dist/components/ui/ag-grid-react/headers/custom-header-group.js +22 -15
- package/dist/components/ui/ag-grid-react/headers/custom-header.js +47 -43
- package/dist/components/ui/breadcrumb.js +1 -1
- package/dist/components/ui/button-group.d.ts +3 -0
- package/dist/components/ui/button-group.js +129 -78
- package/dist/components/ui/checkbox.d.ts +3 -0
- package/dist/components/ui/checkbox.js +64 -53
- package/dist/components/ui/data-table/data-table-saved-views.d.ts +2 -0
- package/dist/components/ui/data-table/data-table-saved-views.js +348 -0
- package/dist/components/ui/data-table/data-table-view-options.d.ts +8 -0
- package/dist/components/ui/data-table/index.d.ts +2 -0
- package/dist/components/ui/data-table/index.js +16 -14
- package/dist/components/ui/date-picker/date-range-picker.js +239 -196
- package/dist/components/ui/date-picker/month-range-picker.js +226 -183
- package/dist/components/ui/date-picker/week-range-picker.js +265 -222
- package/dist/components/ui/dialog.js +6 -6
- package/dist/components/ui/filter-panel/filter-panel.js +15 -8
- package/dist/components/ui/filter-strip/filter-strip.js +8 -9
- package/dist/components/ui/input.d.ts +3 -0
- package/dist/components/ui/input.js +107 -43
- package/dist/components/ui/notification-panel/notification-panel.d.ts +4 -4
- package/dist/components/ui/notification-panel/notification-panel.js +78 -16
- package/dist/components/ui/radio-group.d.ts +3 -0
- package/dist/components/ui/radio-group.js +101 -52
- package/dist/components/ui/select/select.js +579 -554
- package/dist/components/ui/sidebar.js +5 -5
- package/dist/components/ui/textarea.d.ts +3 -0
- package/dist/components/ui/textarea.js +104 -58
- package/dist/components/ui/types/data-table-saved-views.types.d.ts +71 -0
- package/dist/components/ui/types/helper-text.types.d.ts +5 -0
- package/dist/components/ui/types/select.types.d.ts +6 -0
- package/dist/i18n/defaultMessages.d.ts +19 -0
- package/dist/i18n/defaultMessages.js +33 -15
- package/dist/i18n/locales/de.js +19 -1
- package/dist/i18n/locales/es.js +19 -1
- package/dist/i18n/locales/hi.js +19 -1
- package/dist/i18n/locales/kn.js +19 -1
- package/dist/icons/assets/blocks.svg.js +1 -1
- package/dist/icons/assets/drawBrush.svg.js +5 -0
- package/dist/icons/assets/info-badge.svg.js +5 -0
- package/dist/icons/assets/priority-alert.svg.js +5 -0
- package/dist/icons/assets/settings.svg.js +1 -1
- package/dist/icons/assets/webp/sales.webp.js +4 -0
- package/dist/icons/index.d.ts +4 -0
- package/dist/icons/index.js +253 -245
- package/dist/impact-nova.css +1 -1
- package/dist/index.js +91 -89
- package/package.json +1 -1
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
interface TruncatedTextProps {
|
|
2
|
+
text: string;
|
|
3
|
+
className?: string;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* TruncatedText - Wraps text to 2 lines, shows tooltip when clamped
|
|
7
|
+
*
|
|
8
|
+
* Performance note: This component uses useState/useRef but is only instantiated
|
|
9
|
+
* once per visible header (not per column). With column virtualization, only ~20-30
|
|
10
|
+
* headers are rendered at a time, so the hook overhead is minimal.
|
|
11
|
+
*
|
|
12
|
+
* The tooltip is lazily mounted - only after user hovers AND text is clamped.
|
|
13
|
+
*/
|
|
14
|
+
export declare const TruncatedText: ({ text, className }: TruncatedTextProps) => import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
export default TruncatedText;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { jsx as e, jsxs as h } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as f, useState as s } from "react";
|
|
3
|
+
import { cn as p } from "../../../../../lib/utils.js";
|
|
4
|
+
import { TooltipProvider as m, Tooltip as T, TooltipTrigger as g, TooltipContent as C } from "../../../tooltip.js";
|
|
5
|
+
const b = ({ text: t, className: o }) => {
|
|
6
|
+
const r = f(null), [c, i] = s(!1), [l, a] = s(!1), d = () => {
|
|
7
|
+
if (r.current) {
|
|
8
|
+
const u = r.current.scrollHeight > r.current.clientHeight;
|
|
9
|
+
i(u), a(!0);
|
|
10
|
+
}
|
|
11
|
+
}, n = p("line-clamp-2 break-words", o);
|
|
12
|
+
return l && c ? /* @__PURE__ */ e(m, { children: /* @__PURE__ */ h(T, { children: [
|
|
13
|
+
/* @__PURE__ */ e(g, { asChild: !0, children: /* @__PURE__ */ e("span", { ref: r, className: n, children: t }) }),
|
|
14
|
+
/* @__PURE__ */ e(C, { side: "bottom", variant: "tertiary", children: /* @__PURE__ */ e("p", { children: t }) })
|
|
15
|
+
] }) }) : /* @__PURE__ */ e(
|
|
16
|
+
"span",
|
|
17
|
+
{
|
|
18
|
+
ref: r,
|
|
19
|
+
className: n,
|
|
20
|
+
onMouseEnter: d,
|
|
21
|
+
children: t
|
|
22
|
+
}
|
|
23
|
+
);
|
|
24
|
+
};
|
|
25
|
+
export {
|
|
26
|
+
b as TruncatedText
|
|
27
|
+
};
|
|
@@ -1,26 +1,33 @@
|
|
|
1
1
|
import { jsxs as p, jsx as a } from "react/jsx-runtime";
|
|
2
2
|
import { ChevronRight as m } from "../../../../icons/index.js";
|
|
3
|
-
import { cn as
|
|
4
|
-
import { HeaderInfo as
|
|
5
|
-
|
|
3
|
+
import { cn as x } from "../../../../lib/utils.js";
|
|
4
|
+
import { HeaderInfo as f } from "./components/header-info.js";
|
|
5
|
+
import { TruncatedText as u } from "./components/truncated-text.js";
|
|
6
|
+
const y = (t) => {
|
|
6
7
|
const {
|
|
7
|
-
displayName:
|
|
8
|
-
showInfoIcon:
|
|
8
|
+
displayName: l,
|
|
9
|
+
showInfoIcon: c = !1,
|
|
9
10
|
columnGroup: e,
|
|
10
|
-
setExpanded:
|
|
11
|
-
} =
|
|
12
|
-
|
|
13
|
-
}, s =
|
|
14
|
-
return !s &&
|
|
11
|
+
setExpanded: n
|
|
12
|
+
} = t, o = e ? e.isExpanded() : !1, r = e ? e.isExpandable() : !1, d = (i) => {
|
|
13
|
+
i && i.stopPropagation(), n && e && n(!o);
|
|
14
|
+
}, s = l || "";
|
|
15
|
+
return !s && c === !1 ? null : /* @__PURE__ */ p(
|
|
15
16
|
"div",
|
|
16
17
|
{
|
|
17
18
|
className: "ag-header-group-cell-label ag-sticky-label flex items-center h-full cursor-pointer select-none",
|
|
18
|
-
onClick: r ?
|
|
19
|
+
onClick: r ? d : void 0,
|
|
19
20
|
role: "presentation",
|
|
20
21
|
children: [
|
|
21
|
-
/* @__PURE__ */ a(
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
/* @__PURE__ */ a(
|
|
23
|
+
u,
|
|
24
|
+
{
|
|
25
|
+
text: s,
|
|
26
|
+
className: "ag-header-group-text font-semibold text-content"
|
|
27
|
+
}
|
|
28
|
+
),
|
|
29
|
+
/* @__PURE__ */ a(f, { ...t, className: "ml-1" }),
|
|
30
|
+
r && /* @__PURE__ */ a("span", { className: x(
|
|
24
31
|
"ag-header-icon ag-header-expand-icon ml-[6px] flex items-center justify-center transition-transform duration-200",
|
|
25
32
|
o ? "ag-header-expand-icon-expanded rotate-180" : "ag-header-expand-icon-collapsed"
|
|
26
33
|
), children: /* @__PURE__ */ a(m, { size: 16, className: "text-content-tertiary" }) })
|
|
@@ -29,5 +36,5 @@ const b = (n) => {
|
|
|
29
36
|
);
|
|
30
37
|
};
|
|
31
38
|
export {
|
|
32
|
-
|
|
39
|
+
y as CustomHeaderGroup
|
|
33
40
|
};
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import { jsx as e, jsxs as h, Fragment as
|
|
1
|
+
import { jsx as e, jsxs as h, Fragment as T } from "react/jsx-runtime";
|
|
2
2
|
import { useState as A, useEffect as J } from "react";
|
|
3
3
|
import { cn as g } from "../../../../lib/utils.js";
|
|
4
4
|
import { useGridHeader as Q } from "./context/grid-header-context.js";
|
|
5
5
|
import { HeaderInfo as W } from "./components/header-info.js";
|
|
6
6
|
import { Checkbox as X } from "../../checkbox.js";
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
|
|
7
|
+
import { TruncatedText as Y } from "./components/truncated-text.js";
|
|
8
|
+
import { HeaderSearchInput as $ } from "./header-search-input.js";
|
|
9
|
+
import { useImpactNovaI18n as V } from "../../../../i18n/ImpactNovaI18nContext.js";
|
|
10
|
+
const ee = () => /* @__PURE__ */ h(T, { children: [
|
|
10
11
|
/* @__PURE__ */ e("span", { className: "sort-asc-icon inline-flex transition-colors text-content-tertiary hover:text-brand-variant-hover", children: /* @__PURE__ */ h(
|
|
11
12
|
"svg",
|
|
12
13
|
{
|
|
@@ -49,17 +50,17 @@ const $ = () => /* @__PURE__ */ h(V, { children: [
|
|
|
49
50
|
children: /* @__PURE__ */ e("path", { d: "M7.85714 10.8967V5.44444H6.42857V10.8967H4.28571L7.14286 14L10 10.8967H7.85714ZM2.85714 0L0 3.10333H2.14286V8.55556H3.57143V3.10333H5.71429L2.85714 0ZM7.85714 10.8967V5.44444H6.42857V10.8967H4.28571L7.14286 14L10 10.8967H7.85714ZM2.85714 0L0 3.10333H2.14286V8.55556H3.57143V3.10333H5.71429L2.85714 0Z", fill: "currentColor" })
|
|
50
51
|
}
|
|
51
52
|
) })
|
|
52
|
-
] }),
|
|
53
|
-
const { t } =
|
|
53
|
+
] }), te = ({ api: r }) => {
|
|
54
|
+
const { t } = V(), [C, H] = A(!1), [S, s] = A(!1);
|
|
54
55
|
J(() => {
|
|
55
56
|
if (!r) return;
|
|
56
|
-
const
|
|
57
|
+
const m = r.getGridOption?.("rowModelType") === "serverSide", x = () => {
|
|
57
58
|
let l = !1, i = !1;
|
|
58
|
-
if (
|
|
59
|
+
if (m) {
|
|
59
60
|
const f = r.getServerSideSelectionState?.();
|
|
60
61
|
if (f) {
|
|
61
|
-
const { selectAll: c, toggledNodes: b } = f,
|
|
62
|
-
c && !
|
|
62
|
+
const { selectAll: c, toggledNodes: b } = f, w = b && b.length > 0;
|
|
63
|
+
c && !w ? (l = !0, i = !1) : c && w || !c && w ? (l = !1, i = !0) : (l = !1, i = !1);
|
|
63
64
|
}
|
|
64
65
|
} else {
|
|
65
66
|
const f = r.getSelectedRows().length, c = r.getDisplayedRowCount();
|
|
@@ -67,29 +68,29 @@ const $ = () => /* @__PURE__ */ h(V, { children: [
|
|
|
67
68
|
}
|
|
68
69
|
H(l), s(i);
|
|
69
70
|
};
|
|
70
|
-
|
|
71
|
-
const
|
|
72
|
-
|
|
71
|
+
x();
|
|
72
|
+
const u = () => {
|
|
73
|
+
x();
|
|
73
74
|
};
|
|
74
|
-
return r.addEventListener("selectionChanged",
|
|
75
|
-
r.removeEventListener("selectionChanged",
|
|
75
|
+
return r.addEventListener("selectionChanged", u), r.addEventListener("modelUpdated", u), () => {
|
|
76
|
+
r.removeEventListener("selectionChanged", u), r.removeEventListener("modelUpdated", u);
|
|
76
77
|
};
|
|
77
78
|
}, [r]);
|
|
78
|
-
const a = (
|
|
79
|
-
|
|
79
|
+
const a = (m) => {
|
|
80
|
+
m === !0 ? r.selectAll() : r.deselectAll();
|
|
80
81
|
};
|
|
81
|
-
return /* @__PURE__ */ e(
|
|
82
|
+
return /* @__PURE__ */ e(T, { children: /* @__PURE__ */ e(
|
|
82
83
|
X,
|
|
83
84
|
{
|
|
84
85
|
checked: S ? "indeterminate" : C,
|
|
85
|
-
onCheckedChange: (
|
|
86
|
-
a(
|
|
86
|
+
onCheckedChange: (m) => {
|
|
87
|
+
a(m);
|
|
87
88
|
},
|
|
88
89
|
"aria-label": t("aria.toggleSelection"),
|
|
89
90
|
className: "m-0"
|
|
90
91
|
}
|
|
91
92
|
) });
|
|
92
|
-
},
|
|
93
|
+
}, me = (r) => {
|
|
93
94
|
const {
|
|
94
95
|
displayName: t,
|
|
95
96
|
enableSorting: C,
|
|
@@ -97,16 +98,16 @@ const $ = () => /* @__PURE__ */ h(V, { children: [
|
|
|
97
98
|
progressSort: S,
|
|
98
99
|
column: s,
|
|
99
100
|
api: a,
|
|
100
|
-
handleInlineSearch:
|
|
101
|
-
handleClearSearchInline:
|
|
102
|
-
onColumnSearchClick:
|
|
101
|
+
handleInlineSearch: m,
|
|
102
|
+
handleClearSearchInline: x,
|
|
103
|
+
onColumnSearchClick: u,
|
|
103
104
|
onAdvanceSearchClick: l,
|
|
104
105
|
toggleAdvanceSearch: i,
|
|
105
106
|
isSearchable: f = !1,
|
|
106
107
|
advanceSearchEnabled: c = !1,
|
|
107
108
|
// Select params
|
|
108
109
|
selectOptions: b,
|
|
109
|
-
isMultiSelect:
|
|
110
|
+
isMultiSelect: w,
|
|
110
111
|
onSelectScrollToBottom: D,
|
|
111
112
|
onSelectSearchChange: P,
|
|
112
113
|
onSelectOpen: _,
|
|
@@ -115,7 +116,7 @@ const $ = () => /* @__PURE__ */ h(V, { children: [
|
|
|
115
116
|
enableSpaceSplitting: B,
|
|
116
117
|
enableBooleanParsing: E,
|
|
117
118
|
enableDateParsing: R
|
|
118
|
-
} = r, d = Q(), { t: N } =
|
|
119
|
+
} = r, d = Q(), { t: N } = V(), n = s.getColDef(), v = s.getColId(), k = s.isFilterActive(), j = s.getSort(), y = s.getSortIndex(), O = !!j, z = y != null && (y > 0 || a.getColumnState().filter((o) => o.sort).length > 1), G = O && z, I = n?.filter || "agTextColumnFilter", p = I === "agNumberColumnFilter" || (Array.isArray(n?.type) ? n.type.some((o) => o === "number" || o === "numericColumn") : n?.type === "number" || n?.type === "numericColumn");
|
|
119
120
|
I === "agDateColumnFilter" || (Array.isArray(n?.type) ? n.type.includes("dateColumn") : n?.type);
|
|
120
121
|
const L = a.getGridOption("context")?.activeSearchColumnId === v, M = ![
|
|
121
122
|
"agTextColumnFilter",
|
|
@@ -130,7 +131,7 @@ const $ = () => /* @__PURE__ */ h(V, { children: [
|
|
|
130
131
|
].includes(n?.filter), F = (o) => {
|
|
131
132
|
o.stopPropagation(), C && S && S(o.shiftKey);
|
|
132
133
|
}, U = (o) => {
|
|
133
|
-
if (o.stopPropagation(),
|
|
134
|
+
if (o.stopPropagation(), u && u(r), M) {
|
|
134
135
|
a.showColumnFilter ? a.showColumnFilter(v) : a.showColumnMenu(v);
|
|
135
136
|
return;
|
|
136
137
|
}
|
|
@@ -143,18 +144,18 @@ const $ = () => /* @__PURE__ */ h(V, { children: [
|
|
|
143
144
|
}
|
|
144
145
|
) });
|
|
145
146
|
return L && d && !M ? /* @__PURE__ */ e(
|
|
146
|
-
|
|
147
|
+
$,
|
|
147
148
|
{
|
|
148
149
|
column: s,
|
|
149
150
|
api: a,
|
|
150
151
|
onClose: () => d.closeSearch(),
|
|
151
|
-
handleInlineSearch:
|
|
152
|
-
handleClearSearchInline:
|
|
152
|
+
handleInlineSearch: m,
|
|
153
|
+
handleClearSearchInline: x ? () => x(r) : void 0,
|
|
153
154
|
onAdvanceSearchClick: l,
|
|
154
155
|
toggleAdvanceSearch: i,
|
|
155
156
|
advanceSearchEnabled: c,
|
|
156
157
|
selectOptions: b,
|
|
157
|
-
isMultiSelect:
|
|
158
|
+
isMultiSelect: w,
|
|
158
159
|
onSelectScrollToBottom: D,
|
|
159
160
|
onSelectSearchChange: P,
|
|
160
161
|
onSelectOpen: _,
|
|
@@ -168,7 +169,7 @@ const $ = () => /* @__PURE__ */ h(V, { children: [
|
|
|
168
169
|
{
|
|
169
170
|
className: g(
|
|
170
171
|
"ag-header-cell-label flex items-center w-full group min-w-0 h-full",
|
|
171
|
-
|
|
172
|
+
p ? "flex-row-reverse" : "flex-row",
|
|
172
173
|
// Center the content area if it's a selection column
|
|
173
174
|
n?.headerCheckboxSelection && (!t || t.trim() === "") ? "justify-center" : ""
|
|
174
175
|
),
|
|
@@ -178,24 +179,27 @@ const $ = () => /* @__PURE__ */ h(V, { children: [
|
|
|
178
179
|
"div",
|
|
179
180
|
{
|
|
180
181
|
className: g(
|
|
181
|
-
"ag-header-cell-text relative group flex
|
|
182
|
+
"ag-header-cell-text relative group flex min-w-0",
|
|
183
|
+
// Use items-start for non-numeric to allow 2-line text expansion
|
|
184
|
+
p ? "items-center" : "items-start",
|
|
182
185
|
// Remove flex-1 if we are centering via parent's justify-center
|
|
183
186
|
!(n?.headerCheckboxSelection && (!t || t.trim() === "")) && "flex-1",
|
|
184
|
-
|
|
187
|
+
p ? "flex-row-reverse" : "flex-row",
|
|
185
188
|
C ? "sortable cursor-pointer" : ""
|
|
186
189
|
),
|
|
187
190
|
onClick: C ? F : void 0,
|
|
188
191
|
children: /* @__PURE__ */ h("div", { className: g(
|
|
189
|
-
"flex
|
|
190
|
-
|
|
192
|
+
"flex min-w-0",
|
|
193
|
+
// Use items-start for non-numeric to allow 2-line text expansion
|
|
194
|
+
p ? "flex-row-reverse items-center" : "flex-row items-start",
|
|
191
195
|
// If it's a checkbox-only header, ensure it shrinks to content for centering
|
|
192
|
-
n?.headerCheckboxSelection && (!t || t.trim() === "") ? "justify-center" : "gap-1 flex-1"
|
|
196
|
+
n?.headerCheckboxSelection && (!t || t.trim() === "") ? "justify-center items-center" : "gap-1 flex-1"
|
|
193
197
|
), children: [
|
|
194
|
-
n?.headerCheckboxSelection && /* @__PURE__ */ e(
|
|
195
|
-
t && t.trim() !== "" && /* @__PURE__ */ e(
|
|
198
|
+
n?.headerCheckboxSelection && /* @__PURE__ */ e(te, { api: a }),
|
|
199
|
+
t && t.trim() !== "" && t !== N("gridHeader.selection") && /* @__PURE__ */ e(Y, { text: t }),
|
|
196
200
|
t && t.trim() !== "" && K(g(
|
|
197
201
|
"text-content-tertiary hover:text-brand-variant-hover transition-colors",
|
|
198
|
-
|
|
202
|
+
p ? "mr-1" : "ml-1"
|
|
199
203
|
))
|
|
200
204
|
] })
|
|
201
205
|
}
|
|
@@ -205,7 +209,7 @@ const $ = () => /* @__PURE__ */ h(V, { children: [
|
|
|
205
209
|
{
|
|
206
210
|
className: g(
|
|
207
211
|
"flex items-center shrink-0 group gap-1",
|
|
208
|
-
|
|
212
|
+
p ? "flex-row-reverse" : "flex-row"
|
|
209
213
|
),
|
|
210
214
|
children: [
|
|
211
215
|
C && /* @__PURE__ */ h(
|
|
@@ -215,7 +219,7 @@ const $ = () => /* @__PURE__ */ h(V, { children: [
|
|
|
215
219
|
onClick: F,
|
|
216
220
|
children: [
|
|
217
221
|
G && /* @__PURE__ */ e("span", { className: "ag-sort-order text-[10px] font-bold text-content-tertiary mr-0.5", children: y + 1 }),
|
|
218
|
-
/* @__PURE__ */ e("span", { className: "ag-sort-indicator-icon", children: /* @__PURE__ */ e(
|
|
222
|
+
/* @__PURE__ */ e("span", { className: "ag-sort-indicator-icon", children: /* @__PURE__ */ e(ee, {}) })
|
|
219
223
|
]
|
|
220
224
|
}
|
|
221
225
|
),
|
|
@@ -255,5 +259,5 @@ const $ = () => /* @__PURE__ */ h(V, { children: [
|
|
|
255
259
|
);
|
|
256
260
|
};
|
|
257
261
|
export {
|
|
258
|
-
|
|
262
|
+
me as CustomHeader
|
|
259
263
|
};
|
|
@@ -36,7 +36,7 @@ const W = s.forwardRef(({ className: e, maxWords: t, ...r }, o) => /* @__PURE__
|
|
|
36
36
|
{
|
|
37
37
|
ref: o,
|
|
38
38
|
className: n(
|
|
39
|
-
"flex flex-wrap items-center
|
|
39
|
+
"flex flex-wrap items-center text-[14px] font-medium text-secondary-foreground",
|
|
40
40
|
e
|
|
41
41
|
),
|
|
42
42
|
...r
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { VariantProps } from 'class-variance-authority';
|
|
2
|
+
import { HelperTextPosition } from './types/helper-text.types';
|
|
2
3
|
import * as React from "react";
|
|
3
4
|
/**
|
|
4
5
|
* Button group — IA Design System v3.1 (Figma: Button group).
|
|
@@ -15,6 +16,8 @@ export interface ButtonGroupProps extends React.HTMLAttributes<HTMLDivElement>,
|
|
|
15
16
|
isDisabled?: boolean;
|
|
16
17
|
label?: string;
|
|
17
18
|
helperText?: React.ReactNode;
|
|
19
|
+
/** @default "absolute" */
|
|
20
|
+
helperTextPosition?: HelperTextPosition;
|
|
18
21
|
isError?: boolean;
|
|
19
22
|
required?: boolean;
|
|
20
23
|
/** Accessible name when no visible `label` is passed */
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import * as
|
|
3
|
-
import { cva as
|
|
4
|
-
import { cn as
|
|
5
|
-
import { Info as
|
|
6
|
-
const
|
|
1
|
+
import { jsxs as i, jsx as n } from "react/jsx-runtime";
|
|
2
|
+
import * as r from "react";
|
|
3
|
+
import { cva as A } from "class-variance-authority";
|
|
4
|
+
import { cn as t } from "../../lib/utils.js";
|
|
5
|
+
import { Info as N } from "../../icons/index.js";
|
|
6
|
+
const H = A("inline-flex", {
|
|
7
7
|
variants: {
|
|
8
8
|
orientation: {
|
|
9
9
|
horizontal: "flex-row",
|
|
@@ -20,101 +20,152 @@ const A = O("inline-flex", {
|
|
|
20
20
|
orientation: "horizontal",
|
|
21
21
|
spacing: "none"
|
|
22
22
|
}
|
|
23
|
-
}),
|
|
23
|
+
}), M = r.forwardRef(
|
|
24
24
|
({
|
|
25
|
-
className:
|
|
26
|
-
orientation:
|
|
25
|
+
className: w,
|
|
26
|
+
orientation: u = "horizontal",
|
|
27
27
|
spacing: p = "none",
|
|
28
|
-
value:
|
|
29
|
-
onValueChange:
|
|
30
|
-
isDisabled:
|
|
31
|
-
children:
|
|
28
|
+
value: v,
|
|
29
|
+
onValueChange: b,
|
|
30
|
+
isDisabled: h,
|
|
31
|
+
children: y,
|
|
32
32
|
label: o,
|
|
33
|
-
helperText:
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
33
|
+
helperText: s,
|
|
34
|
+
helperTextPosition: x = "absolute",
|
|
35
|
+
isError: a,
|
|
36
|
+
required: S,
|
|
37
|
+
"aria-label": _,
|
|
38
|
+
...k
|
|
39
|
+
}, B) => {
|
|
40
|
+
const l = p === "none", I = u === "horizontal", V = r.useId(), z = o ? `${V}-label` : void 0;
|
|
41
|
+
return /* @__PURE__ */ i("div", { className: t("grid gap-1.5", w), children: [
|
|
42
|
+
o && /* @__PURE__ */ i(
|
|
42
43
|
"label",
|
|
43
44
|
{
|
|
44
|
-
id:
|
|
45
|
-
className:
|
|
45
|
+
id: z,
|
|
46
|
+
className: t(
|
|
46
47
|
"text-xs font-medium leading-[18px] text-content-tertiary",
|
|
47
|
-
|
|
48
|
-
|
|
48
|
+
h && "opacity-70",
|
|
49
|
+
a && "text-destructive"
|
|
49
50
|
),
|
|
50
51
|
children: [
|
|
51
52
|
o,
|
|
52
53
|
" ",
|
|
53
|
-
|
|
54
|
+
S && /* @__PURE__ */ n("span", { className: "text-destructive", children: "*" })
|
|
54
55
|
]
|
|
55
56
|
}
|
|
56
57
|
),
|
|
57
|
-
/* @__PURE__ */
|
|
58
|
+
/* @__PURE__ */ i(
|
|
58
59
|
"div",
|
|
59
60
|
{
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
61
|
+
className: t(
|
|
62
|
+
s && x === "absolute" && "relative"
|
|
63
|
+
),
|
|
64
|
+
children: [
|
|
65
|
+
/* @__PURE__ */ n(
|
|
66
|
+
"div",
|
|
67
|
+
{
|
|
68
|
+
ref: B,
|
|
69
|
+
className: t(H({ orientation: u, spacing: p })),
|
|
70
|
+
role: "group",
|
|
71
|
+
"data-component": "button-group",
|
|
72
|
+
"data-orientation": u,
|
|
73
|
+
"data-spacing": p,
|
|
74
|
+
"data-fused": l ? "true" : "false",
|
|
75
|
+
"aria-label": o ? void 0 : _,
|
|
76
|
+
"aria-labelledby": o ? z : void 0,
|
|
77
|
+
...k,
|
|
78
|
+
children: r.Children.map(y, (f) => {
|
|
79
|
+
if (!r.isValidElement(f)) return f;
|
|
80
|
+
const e = f, g = e.props.value ?? e.props.children?.toString?.() ?? "", c = typeof g == "string" ? g : String(g), d = v !== void 0 && v === c, m = !!(e.props.disabled || h), G = e.props.size === "icon" || e.props.size === "iconMd" || e.props.size === "iconSm", j = t(
|
|
81
|
+
"!shadow-none relative border transition-colors",
|
|
82
|
+
l && !G && "min-w-14",
|
|
83
|
+
l ? I ? "!rounded-none first:!rounded-l-md last:!rounded-r-md -ml-px first:ml-0" : "!rounded-none first:!rounded-t-md last:!rounded-b-md -mt-px first:mt-0" : "!rounded-md",
|
|
84
|
+
l && (d ? "z-10" : "z-[1]")
|
|
85
|
+
), C = m ? "!bg-disabled-surface !border-disabled-border !text-disabled-foreground opacity-100 [&_svg]:!text-disabled-foreground" : d ? "!bg-accent !border-brand !text-brand [&_svg]:!text-brand" : t(
|
|
86
|
+
"!bg-canvas-elevated !border-button-primary-disabled !text-[#60697d]",
|
|
87
|
+
"[&_svg]:text-content-icon",
|
|
88
|
+
"hover:!text-brand hover:[&_svg]:!text-brand"
|
|
89
|
+
), O = a && !d && !m && "!border-destructive !text-destructive [&_svg]:!text-destructive";
|
|
90
|
+
return r.cloneElement(e, {
|
|
91
|
+
disabled: m,
|
|
92
|
+
variant: "ghost",
|
|
93
|
+
"aria-pressed": v !== void 0 && c !== "" ? d : void 0,
|
|
94
|
+
"data-button-group": "item",
|
|
95
|
+
"data-active": d ? "true" : "false",
|
|
96
|
+
className: t(
|
|
97
|
+
j,
|
|
98
|
+
C,
|
|
99
|
+
O,
|
|
100
|
+
e.props.className
|
|
101
|
+
),
|
|
102
|
+
onClick: (R) => {
|
|
103
|
+
e.props.onClick?.(R), c && b && !m && b(c);
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
})
|
|
107
|
+
}
|
|
108
|
+
),
|
|
109
|
+
s && x === "absolute" && /* @__PURE__ */ i(
|
|
110
|
+
"div",
|
|
111
|
+
{
|
|
112
|
+
className: t(
|
|
113
|
+
"absolute left-0 top-full z-10 mt-1 flex min-w-0 max-w-full items-center gap-1",
|
|
114
|
+
a && "text-destructive"
|
|
115
|
+
),
|
|
116
|
+
children: [
|
|
117
|
+
/* @__PURE__ */ n(
|
|
118
|
+
N,
|
|
119
|
+
{
|
|
120
|
+
size: "xs",
|
|
121
|
+
className: t(
|
|
122
|
+
"shrink-0",
|
|
123
|
+
a ? "text-destructive" : "text-content-muted"
|
|
124
|
+
)
|
|
125
|
+
}
|
|
126
|
+
),
|
|
127
|
+
/* @__PURE__ */ n(
|
|
128
|
+
"p",
|
|
129
|
+
{
|
|
130
|
+
className: t(
|
|
131
|
+
"min-w-0 text-[12px] font-medium leading-[18px] text-navigation-muted",
|
|
132
|
+
a && "text-destructive"
|
|
133
|
+
),
|
|
134
|
+
children: s
|
|
135
|
+
}
|
|
136
|
+
)
|
|
137
|
+
]
|
|
96
138
|
}
|
|
97
|
-
|
|
98
|
-
|
|
139
|
+
)
|
|
140
|
+
]
|
|
99
141
|
}
|
|
100
142
|
),
|
|
101
|
-
|
|
143
|
+
s && x === "flow" && /* @__PURE__ */ i(
|
|
102
144
|
"div",
|
|
103
145
|
{
|
|
104
|
-
className:
|
|
146
|
+
className: t(
|
|
105
147
|
"flex items-center gap-1",
|
|
106
|
-
|
|
148
|
+
a && "text-destructive"
|
|
107
149
|
),
|
|
108
150
|
children: [
|
|
109
|
-
|
|
110
|
-
|
|
151
|
+
/* @__PURE__ */ n(
|
|
152
|
+
N,
|
|
153
|
+
{
|
|
154
|
+
size: "xs",
|
|
155
|
+
className: t(
|
|
156
|
+
"shrink-0",
|
|
157
|
+
a ? "text-destructive" : "text-content-muted"
|
|
158
|
+
)
|
|
159
|
+
}
|
|
160
|
+
),
|
|
161
|
+
/* @__PURE__ */ n(
|
|
111
162
|
"p",
|
|
112
163
|
{
|
|
113
|
-
className:
|
|
114
|
-
"text-
|
|
115
|
-
|
|
164
|
+
className: t(
|
|
165
|
+
"text-[12px] font-medium leading-[18px] text-navigation-muted",
|
|
166
|
+
a && "text-destructive"
|
|
116
167
|
),
|
|
117
|
-
children:
|
|
168
|
+
children: s
|
|
118
169
|
}
|
|
119
170
|
)
|
|
120
171
|
]
|
|
@@ -123,8 +174,8 @@ const A = O("inline-flex", {
|
|
|
123
174
|
] });
|
|
124
175
|
}
|
|
125
176
|
);
|
|
126
|
-
|
|
177
|
+
M.displayName = "ButtonGroup";
|
|
127
178
|
export {
|
|
128
|
-
|
|
129
|
-
|
|
179
|
+
M as ButtonGroup,
|
|
180
|
+
H as buttonGroupVariants
|
|
130
181
|
};
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
+
import { HelperTextPosition } from './types/helper-text.types';
|
|
1
2
|
import * as React from "react";
|
|
2
3
|
import * as CheckboxPrimitive from "@radix-ui/react-checkbox";
|
|
3
4
|
declare const Checkbox: React.ForwardRefExoticComponent<Omit<CheckboxPrimitive.CheckboxProps & React.RefAttributes<HTMLButtonElement>, "ref"> & {
|
|
4
5
|
label?: string;
|
|
5
6
|
helperText?: React.ReactNode;
|
|
7
|
+
/** @default "absolute" */
|
|
8
|
+
helperTextPosition?: HelperTextPosition;
|
|
6
9
|
isError?: boolean;
|
|
7
10
|
} & React.RefAttributes<HTMLButtonElement>>;
|
|
8
11
|
export { Checkbox };
|