impact-nova 1.3.0 → 1.5.2
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/README.md +49 -0
- package/dist/components/layout/dashboard-layout.d.ts +15 -1
- package/dist/components/ui/accordion-nested-list/accordion-nested-list.js +65 -64
- package/dist/components/ui/accordion.js +38 -34
- package/dist/components/ui/ag-grid-react/cell-renderers/badge-cell-renderer.js +1 -1
- package/dist/components/ui/ag-grid-react/cell-renderers/cell-renderer-utils.d.ts +58 -0
- package/dist/components/ui/ag-grid-react/cell-renderers/cell-renderer-utils.js +104 -0
- package/dist/components/ui/ag-grid-react/cell-renderers/editors/input-cell-editor.js +62 -54
- package/dist/components/ui/ag-grid-react/cell-renderers/editors/split-cell-editor.d.ts +4 -6
- package/dist/components/ui/ag-grid-react/cell-renderers/editors/split-cell-editor.js +54 -68
- package/dist/components/ui/ag-grid-react/cell-renderers/index.d.ts +3 -1
- package/dist/components/ui/ag-grid-react/cell-renderers/index.js +33 -27
- package/dist/components/ui/ag-grid-react/cell-renderers/input-display-renderer.d.ts +3 -0
- package/dist/components/ui/ag-grid-react/cell-renderers/input-display-renderer.js +28 -12
- package/dist/components/ui/ag-grid-react/cell-renderers/link-with-batch-cell-renderer.d.ts +2 -0
- package/dist/components/ui/ag-grid-react/cell-renderers/link-with-batch-cell-renderer.js +45 -44
- package/dist/components/ui/ag-grid-react/cell-renderers/split-cell-renderer.d.ts +4 -6
- package/dist/components/ui/ag-grid-react/cell-renderers/split-cell-renderer.js +23 -37
- package/dist/components/ui/ag-grid-react/cell-renderers/types.d.ts +33 -17
- package/dist/components/ui/ag-grid-react/editable-utils.d.ts +27 -0
- package/dist/components/ui/ag-grid-react/editable-utils.js +62 -0
- package/dist/components/ui/ag-grid-react/headers/advanced-filter/advanced-filter-dialog.js +99 -98
- package/dist/components/ui/ag-grid-react/headers/advanced-filter/column-filter-section.js +110 -143
- package/dist/components/ui/ag-grid-react/headers/column-menu/column-settings-menu.js +72 -69
- package/dist/components/ui/ag-grid-react/headers/components/header-info.js +36 -35
- package/dist/components/ui/ag-grid-react/headers/components/info-modal.js +14 -12
- package/dist/components/ui/ag-grid-react/headers/custom-header.js +111 -110
- package/dist/components/ui/ag-grid-react/headers/header-search-input.js +204 -203
- package/dist/components/ui/alert.js +62 -58
- package/dist/components/ui/breadcrumb.js +81 -74
- package/dist/components/ui/calendar.js +354 -354
- package/dist/components/ui/chart/chart.js +63 -62
- package/dist/components/ui/chips.js +42 -38
- package/dist/components/ui/command-palette/command-palette-context.d.ts +52 -0
- package/dist/components/ui/command-palette/command-palette-context.js +110 -0
- package/dist/components/ui/command-palette/command-palette.d.ts +67 -0
- package/dist/components/ui/command-palette/command-palette.js +402 -0
- package/dist/components/ui/command-palette/index.d.ts +23 -0
- package/dist/components/ui/command-palette/index.js +44 -0
- package/dist/components/ui/command-palette/kbd.d.ts +28 -0
- package/dist/components/ui/command-palette/kbd.js +52 -0
- package/dist/components/ui/command-palette/shortcut-registry.d.ts +68 -0
- package/dist/components/ui/command-palette/shortcut-registry.js +183 -0
- package/dist/components/ui/command-palette/shortcut-scope-provider.d.ts +55 -0
- package/dist/components/ui/command-palette/shortcut-scope-provider.js +55 -0
- package/dist/components/ui/command-palette/shortcut-settings.d.ts +27 -0
- package/dist/components/ui/command-palette/shortcut-settings.js +266 -0
- package/dist/components/ui/command-palette/use-browser-shortcuts.d.ts +32 -0
- package/dist/components/ui/command-palette/use-browser-shortcuts.js +48 -0
- package/dist/components/ui/command-palette/use-global-shortcut.d.ts +3 -0
- package/dist/components/ui/command-palette/use-global-shortcut.js +7 -0
- package/dist/components/ui/command-palette/use-shortcut.d.ts +47 -0
- package/dist/components/ui/command-palette/use-shortcut.js +49 -0
- package/dist/components/ui/command-palette/utils.d.ts +119 -0
- package/dist/components/ui/command-palette/utils.js +248 -0
- package/dist/components/ui/data-table/data-table-column-list.js +87 -86
- package/dist/components/ui/data-table/data-table-format-options.js +45 -44
- package/dist/components/ui/data-table/data-table-view-options.js +39 -38
- package/dist/components/ui/date-picker/date-picker.js +89 -87
- package/dist/components/ui/date-picker/date-range-picker.js +140 -138
- package/dist/components/ui/date-picker/month-picker.js +82 -81
- package/dist/components/ui/date-picker/month-range-picker.js +108 -105
- package/dist/components/ui/date-picker/multi-date-picker.js +68 -66
- package/dist/components/ui/date-picker/multi-month-picker.js +59 -58
- package/dist/components/ui/date-picker/multi-week-picker.js +80 -78
- package/dist/components/ui/date-picker/week-picker.js +117 -115
- package/dist/components/ui/date-picker/week-range-picker.js +166 -164
- package/dist/components/ui/dialog.js +78 -73
- package/dist/components/ui/drawer.js +71 -66
- package/dist/components/ui/file-upload.js +131 -127
- package/dist/components/ui/filter-panel/filter-panel.js +98 -94
- package/dist/components/ui/filter-strip/filter-strip.js +95 -91
- package/dist/components/ui/filter-strip/filter-summary.js +91 -90
- package/dist/components/ui/header.js +57 -53
- package/dist/components/ui/horizontal-scroller/horizontal-scroller.js +78 -76
- package/dist/components/ui/loader.js +17 -16
- package/dist/components/ui/nested-list/components/NestedListHeader.d.ts +1 -0
- package/dist/components/ui/nested-list/components/NestedListHeader.js +51 -48
- package/dist/components/ui/nested-list/components/SortableItem.js +60 -59
- package/dist/components/ui/nested-list/nested-list.js +184 -182
- package/dist/components/ui/notification-panel/notification-panel.js +60 -53
- package/dist/components/ui/popover.js +45 -40
- package/dist/components/ui/prompt.js +90 -86
- package/dist/components/ui/select/select.js +206 -209
- package/dist/components/ui/sheet.d.ts +1 -0
- package/dist/components/ui/sheet.js +50 -48
- package/dist/components/ui/sidebar.js +273 -267
- package/dist/components/ui/stepper.js +75 -63
- package/dist/components/ui/tag.js +48 -44
- package/dist/components/ui/toast.js +46 -41
- package/dist/i18n/ImpactNovaI18nContext.d.ts +21 -0
- package/dist/i18n/ImpactNovaI18nContext.js +76 -0
- package/dist/i18n/defaultMessages.d.ts +231 -0
- package/dist/i18n/defaultMessages.js +206 -0
- package/dist/i18n/getDateFnsLocale.d.ts +11 -0
- package/dist/i18n/getDateFnsLocale.js +21 -0
- package/dist/i18n/index.d.ts +5 -0
- package/dist/i18n/locales/de.d.ts +2 -0
- package/dist/i18n/locales/de.js +206 -0
- package/dist/i18n/locales/es.d.ts +2 -0
- package/dist/i18n/locales/es.js +206 -0
- package/dist/i18n/locales/hi.d.ts +2 -0
- package/dist/i18n/locales/hi.js +206 -0
- package/dist/i18n/locales/index.d.ts +4 -0
- package/dist/i18n/locales/kn.d.ts +2 -0
- package/dist/i18n/locales/kn.js +206 -0
- package/dist/icons/assets/boxAdd.svg.js +5 -0
- package/dist/icons/assets/boxed.svg.js +5 -0
- package/dist/icons/assets/trolley.svg.js +5 -0
- package/dist/icons/assets/unlocked.svg.js +5 -0
- package/dist/icons/index.d.ts +4 -0
- package/dist/icons/index.js +179 -171
- package/dist/impact-nova.css +1 -1
- package/dist/index.d.ts +4 -0
- package/dist/index.js +232 -172
- package/package.json +36 -4
- package/dist/components/ui/ag-grid-react/cell-renderers/types.js +0 -74
package/README.md
CHANGED
|
@@ -150,6 +150,55 @@ export const CustomAction = ({ analyticsId, ...props }: CustomActionProps) => {
|
|
|
150
150
|
};
|
|
151
151
|
```
|
|
152
152
|
|
|
153
|
+
### Internationalization (i18n)
|
|
154
|
+
|
|
155
|
+
Impact Nova supports multiple languages via a provider and message overrides. Wrap your app (or subtree) with `ImpactNovaI18nProvider` and set `locale` and optionally `messages`.
|
|
156
|
+
|
|
157
|
+
**Locale packs** (German, Spanish, Hindi, Kannada) are exported so you can use them as-is or override only the strings you need:
|
|
158
|
+
|
|
159
|
+
```tsx
|
|
160
|
+
import { ImpactNovaI18nProvider, de, defaultMessages } from 'impact-nova';
|
|
161
|
+
|
|
162
|
+
// Use a full locale pack as-is
|
|
163
|
+
function App() {
|
|
164
|
+
return (
|
|
165
|
+
<ImpactNovaI18nProvider locale="de" messages={de}>
|
|
166
|
+
<MyApp />
|
|
167
|
+
</ImpactNovaI18nProvider>
|
|
168
|
+
);
|
|
169
|
+
}
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
**Override only a few keys** by spreading a locale pack and then overriding specific sections or keys. The provider merges your `messages` over the built-in English defaults (or over the pack you pass), so you only need to provide the keys you want to change:
|
|
173
|
+
|
|
174
|
+
```tsx
|
|
175
|
+
import { ImpactNovaI18nProvider, de } from 'impact-nova';
|
|
176
|
+
|
|
177
|
+
// German with custom labels for calendar only
|
|
178
|
+
const messages = {
|
|
179
|
+
...de,
|
|
180
|
+
calendar: { ...de.calendar, apply: 'Übernehmen', cancel: 'Schließen' },
|
|
181
|
+
};
|
|
182
|
+
|
|
183
|
+
<ImpactNovaI18nProvider locale="de" messages={messages}>
|
|
184
|
+
<MyApp />
|
|
185
|
+
</ImpactNovaI18nProvider>
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
**Tree-shakeable locale imports** (if you only need one language and want to avoid pulling others into your bundle):
|
|
189
|
+
|
|
190
|
+
```tsx
|
|
191
|
+
import { de } from 'impact-nova/locale/de';
|
|
192
|
+
// or
|
|
193
|
+
import { de, es, hi, kn } from 'impact-nova/locale';
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
- **`locale`**: BCP 47 code (e.g. `'en'`, `'de'`) used for date/number formatting. Supported: `en`, `en-US`, `en-GB`, `de`, `es`, `hi`, `kn`.
|
|
197
|
+
- **`messages`**: Optional `Partial<ImpactNovaMessages>`. Merged over the built-in English defaults; only provided keys are overridden. Use a locale pack (`de`, `es`, `hi`, `kn`) or spread one and override specific keys.
|
|
198
|
+
- **Per-component overrides**: Components that accept props like `placeholder`, `submitButtonLabel`, or `cancelLabel` use those when provided; otherwise they use values from the provider.
|
|
199
|
+
|
|
200
|
+
Calendar, date pickers, Select, NestedList, DataTableColumnList, and aria labels (e.g. Alert close, Breadcrumb, Chips remove) use the context. See `docs/I18N_PLAN.md` for the full list of message keys and components.
|
|
201
|
+
|
|
153
202
|
---
|
|
154
203
|
|
|
155
204
|
## 🏗️ Architecture
|
|
@@ -31,10 +31,24 @@ interface DashboardLayoutProps extends React.ComponentProps<"div"> {
|
|
|
31
31
|
* When true, the filter strip is shown by default. Defaults to `true`.
|
|
32
32
|
*/
|
|
33
33
|
defaultFiltersVisible?: boolean;
|
|
34
|
+
/**
|
|
35
|
+
* Controlled sidebar open state. When provided, the sidebar becomes fully controlled.
|
|
36
|
+
* Use together with `onSidebarOpenChange` for two-way binding.
|
|
37
|
+
*/
|
|
38
|
+
sidebarOpen?: boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Callback fired when the sidebar open state changes.
|
|
41
|
+
* Use together with `sidebarOpen` for controlled mode, or standalone for listening.
|
|
42
|
+
*/
|
|
43
|
+
onSidebarOpenChange?: (open: boolean) => void;
|
|
44
|
+
/**
|
|
45
|
+
* Default open state for the sidebar (uncontrolled mode). Defaults to `false`.
|
|
46
|
+
*/
|
|
47
|
+
sidebarDefaultOpen?: boolean;
|
|
34
48
|
/**
|
|
35
49
|
* Main content (e.g. <Outlet /> or page-level content).
|
|
36
50
|
*/
|
|
37
51
|
children: React.ReactNode;
|
|
38
52
|
}
|
|
39
|
-
export declare function DashboardLayout({ sidebar, header, breadcrumb, breadcrumbRightContent, filterStrip, defaultFiltersVisible, children, className, ...props }: DashboardLayoutProps): import("react/jsx-runtime").JSX.Element;
|
|
53
|
+
export declare function DashboardLayout({ sidebar, header, breadcrumb, breadcrumbRightContent, filterStrip, defaultFiltersVisible, sidebarOpen, onSidebarOpenChange, sidebarDefaultOpen, children, className, ...props }: DashboardLayoutProps): import("react/jsx-runtime").JSX.Element;
|
|
40
54
|
export {};
|
|
@@ -1,97 +1,98 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useState as
|
|
3
|
-
import { Accordion as
|
|
4
|
-
import { Button as
|
|
5
|
-
import { NestedList as
|
|
6
|
-
import { useAccordionNestedListState as
|
|
7
|
-
import { SelectionMode as
|
|
8
|
-
import { cn as
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
import { jsxs as i, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { useState as F, useCallback as d, useMemo as G } from "react";
|
|
3
|
+
import { Accordion as H, AccordionItem as J, AccordionTrigger as K, AccordionContent as Q } from "../accordion.js";
|
|
4
|
+
import { Button as N } from "../button.js";
|
|
5
|
+
import { NestedList as R } from "../nested-list/nested-list.js";
|
|
6
|
+
import { useAccordionNestedListState as U } from "./hooks/useAccordionNestedListState.js";
|
|
7
|
+
import { SelectionMode as X } from "../types/nested-list.types.js";
|
|
8
|
+
import { cn as Y } from "../../../lib/utils.js";
|
|
9
|
+
import { useImpactNovaI18n as Z } from "../../../i18n/ImpactNovaI18nContext.js";
|
|
10
|
+
const ce = ({
|
|
11
|
+
sections: r,
|
|
12
|
+
onChange: u,
|
|
12
13
|
onSubmit: h,
|
|
13
14
|
onCancel: m,
|
|
14
|
-
enableApplyDiscard:
|
|
15
|
-
submitButtonLabel:
|
|
16
|
-
cancelButtonLabel:
|
|
15
|
+
enableApplyDiscard: v = !0,
|
|
16
|
+
submitButtonLabel: A,
|
|
17
|
+
cancelButtonLabel: g,
|
|
17
18
|
className: C = "",
|
|
18
|
-
enableSearch:
|
|
19
|
-
enableDragDrop:
|
|
19
|
+
enableSearch: L = !0,
|
|
20
|
+
enableDragDrop: S = !0,
|
|
20
21
|
enableSelectAll: y = !0,
|
|
21
|
-
selectionMode: x =
|
|
22
|
-
searchPlaceholder:
|
|
23
|
-
value:
|
|
24
|
-
onValueChange:
|
|
25
|
-
isMultiExpanded:
|
|
26
|
-
defaultCollapseAll:
|
|
27
|
-
validateApply:
|
|
22
|
+
selectionMode: x = X.CASCADE_DOWN,
|
|
23
|
+
searchPlaceholder: B,
|
|
24
|
+
value: k,
|
|
25
|
+
onValueChange: D,
|
|
26
|
+
isMultiExpanded: n = !0,
|
|
27
|
+
defaultCollapseAll: V = !1,
|
|
28
|
+
validateApply: c
|
|
28
29
|
}) => {
|
|
29
|
-
const {
|
|
30
|
-
currentSections:
|
|
30
|
+
const { t: s } = Z(), j = A ?? s("nestedList.apply"), I = g ?? s("nestedList.reset"), P = B ?? s("nestedList.searchPlaceholder"), {
|
|
31
|
+
currentSections: l,
|
|
31
32
|
hasChanges: a,
|
|
32
|
-
setCurrentSection:
|
|
33
|
-
saveAllSections:
|
|
34
|
-
discardAllSections:
|
|
35
|
-
} =
|
|
36
|
-
(e,
|
|
37
|
-
|
|
33
|
+
setCurrentSection: f,
|
|
34
|
+
saveAllSections: p,
|
|
35
|
+
discardAllSections: b
|
|
36
|
+
} = U({ sections: r }), [w, M] = F(() => V ? n ? [] : "" : r.length > 0 ? n ? [r[0].id] : r[0].id : n ? [] : ""), O = k ?? w, T = D ?? M, W = d(
|
|
37
|
+
(e, o) => {
|
|
38
|
+
f(e, o), u?.(e, o);
|
|
38
39
|
},
|
|
39
|
-
[
|
|
40
|
-
),
|
|
41
|
-
|
|
42
|
-
}, [
|
|
43
|
-
|
|
44
|
-
}, [
|
|
45
|
-
return /* @__PURE__ */
|
|
40
|
+
[u, f]
|
|
41
|
+
), _ = d(() => {
|
|
42
|
+
p(), h?.(l);
|
|
43
|
+
}, [l, h, p]), q = d(() => {
|
|
44
|
+
b(), m?.();
|
|
45
|
+
}, [b, m]), z = G(() => a ? c ? c(l) : !0 : !1, [a, c, l]);
|
|
46
|
+
return /* @__PURE__ */ i(
|
|
46
47
|
"div",
|
|
47
48
|
{
|
|
48
|
-
className:
|
|
49
|
+
className: Y("flex flex-col h-full", C),
|
|
49
50
|
"data-component": "accordion-nested-list",
|
|
50
51
|
"data-has-changes": a ? "" : void 0,
|
|
51
52
|
children: [
|
|
52
|
-
/* @__PURE__ */
|
|
53
|
-
|
|
53
|
+
/* @__PURE__ */ t("div", { className: "flex-1 min-h-0 overflow-hidden", children: /* @__PURE__ */ t(
|
|
54
|
+
H,
|
|
54
55
|
{
|
|
55
|
-
type:
|
|
56
|
-
value:
|
|
57
|
-
onValueChange:
|
|
56
|
+
type: n ? "multiple" : "single",
|
|
57
|
+
value: O,
|
|
58
|
+
onValueChange: T,
|
|
58
59
|
className: "space-y-4",
|
|
59
|
-
children:
|
|
60
|
-
/* @__PURE__ */
|
|
61
|
-
/* @__PURE__ */
|
|
62
|
-
|
|
60
|
+
children: r.map((e) => /* @__PURE__ */ i(J, { value: e.id, children: [
|
|
61
|
+
/* @__PURE__ */ t(K, { children: e.label }),
|
|
62
|
+
/* @__PURE__ */ t(Q, { className: "min-h-0 h-full", children: /* @__PURE__ */ t("div", { className: "h-full min-h-0 pb-2", children: /* @__PURE__ */ t(
|
|
63
|
+
R,
|
|
63
64
|
{
|
|
64
|
-
items:
|
|
65
|
-
onChange: (
|
|
65
|
+
items: l[e.id] || [],
|
|
66
|
+
onChange: (o) => W(e.id, o),
|
|
66
67
|
enableApplyDiscard: !1,
|
|
67
|
-
enableSearch:
|
|
68
|
-
enableDragDrop:
|
|
68
|
+
enableSearch: L,
|
|
69
|
+
enableDragDrop: S,
|
|
69
70
|
enableSelectAll: y,
|
|
70
71
|
selectionMode: e.selectionMode ?? x,
|
|
71
|
-
searchPlaceholder:
|
|
72
|
+
searchPlaceholder: P,
|
|
72
73
|
className: "h-full"
|
|
73
74
|
}
|
|
74
75
|
) }) })
|
|
75
76
|
] }, e.id))
|
|
76
77
|
}
|
|
77
78
|
) }),
|
|
78
|
-
|
|
79
|
-
/* @__PURE__ */
|
|
80
|
-
|
|
79
|
+
v && /* @__PURE__ */ i("div", { className: "flex-shrink-0 flex justify-end gap-2 pt-4 border-t mt-4", children: [
|
|
80
|
+
/* @__PURE__ */ t(
|
|
81
|
+
N,
|
|
81
82
|
{
|
|
82
83
|
variant: "tertiary",
|
|
83
|
-
onClick:
|
|
84
|
+
onClick: q,
|
|
84
85
|
disabled: !a,
|
|
85
|
-
children:
|
|
86
|
+
children: I
|
|
86
87
|
}
|
|
87
88
|
),
|
|
88
|
-
/* @__PURE__ */
|
|
89
|
-
|
|
89
|
+
/* @__PURE__ */ t(
|
|
90
|
+
N,
|
|
90
91
|
{
|
|
91
92
|
variant: "default",
|
|
92
|
-
onClick:
|
|
93
|
-
disabled: !
|
|
94
|
-
children:
|
|
93
|
+
onClick: _,
|
|
94
|
+
disabled: !z,
|
|
95
|
+
children: j
|
|
95
96
|
}
|
|
96
97
|
)
|
|
97
98
|
] })
|
|
@@ -100,5 +101,5 @@ const re = ({
|
|
|
100
101
|
);
|
|
101
102
|
};
|
|
102
103
|
export {
|
|
103
|
-
|
|
104
|
+
ce as AccordionNestedList
|
|
104
105
|
};
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { jsx as e, jsxs as i } from "react/jsx-runtime";
|
|
2
2
|
import * as d from "react";
|
|
3
3
|
import * as r from "@radix-ui/react-accordion";
|
|
4
|
-
import { ChevronRight as
|
|
4
|
+
import { ChevronRight as f } from "lucide-react";
|
|
5
5
|
import { cn as s } from "../../lib/utils.js";
|
|
6
|
-
import { Tooltip as
|
|
7
|
-
|
|
6
|
+
import { Tooltip as p, TooltipTrigger as g, TooltipContent as h } from "./tooltip.js";
|
|
7
|
+
import { useImpactNovaI18n as x } from "../../i18n/ImpactNovaI18nContext.js";
|
|
8
|
+
const C = r.Root, N = d.forwardRef(({ className: o, ...t }, a) => /* @__PURE__ */ e(
|
|
8
9
|
r.Item,
|
|
9
10
|
{
|
|
10
11
|
ref: a,
|
|
@@ -14,33 +15,36 @@ const w = r.Root, h = d.forwardRef(({ className: o, ...t }, a) => /* @__PURE__ *
|
|
|
14
15
|
...t
|
|
15
16
|
}
|
|
16
17
|
));
|
|
17
|
-
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
{
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
/* @__PURE__ */
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
/* @__PURE__ */ i("div", { className: "flex items-center gap-3", children: [
|
|
34
|
-
t,
|
|
35
|
-
a
|
|
18
|
+
N.displayName = "AccordionItem";
|
|
19
|
+
const v = d.forwardRef(({ className: o, children: t, badge: a, rightActions: n, ...c }, l) => {
|
|
20
|
+
const { t: m } = x();
|
|
21
|
+
return /* @__PURE__ */ e(r.Header, { className: "flex", children: /* @__PURE__ */ i(
|
|
22
|
+
r.Trigger,
|
|
23
|
+
{
|
|
24
|
+
ref: l,
|
|
25
|
+
className: s(
|
|
26
|
+
"flex flex-1 items-center gap-3 px-4 py-2 text-sm font-semibold transition-all text-left [&[data-state=open]>div>svg]:-rotate-90",
|
|
27
|
+
o
|
|
28
|
+
),
|
|
29
|
+
...c,
|
|
30
|
+
children: [
|
|
31
|
+
/* @__PURE__ */ i(p, { children: [
|
|
32
|
+
/* @__PURE__ */ e(g, { asChild: !0, children: /* @__PURE__ */ e("div", { className: "flex items-center justify-center h-8 w-8 shrink-0 rounded-lg bg-secondary text-secondary-foreground transition-transform duration-200", children: /* @__PURE__ */ e(f, { className: "h-4 w-4 transition-transform duration-200" }) }) }),
|
|
33
|
+
/* @__PURE__ */ e(h, { side: "top", variant: "tertiary", children: m("aria.toggle") })
|
|
36
34
|
] }),
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
35
|
+
/* @__PURE__ */ i("div", { className: "flex flex-1 items-center justify-between", children: [
|
|
36
|
+
/* @__PURE__ */ i("div", { className: "flex items-center gap-3", children: [
|
|
37
|
+
t,
|
|
38
|
+
a
|
|
39
|
+
] }),
|
|
40
|
+
n
|
|
41
|
+
] })
|
|
42
|
+
]
|
|
43
|
+
}
|
|
44
|
+
) });
|
|
45
|
+
});
|
|
46
|
+
v.displayName = r.Trigger.displayName;
|
|
47
|
+
const u = d.forwardRef(({ className: o, children: t, ...a }, n) => /* @__PURE__ */ e(
|
|
44
48
|
r.Content,
|
|
45
49
|
{
|
|
46
50
|
ref: n,
|
|
@@ -49,10 +53,10 @@ const N = d.forwardRef(({ className: o, children: t, ...a }, n) => /* @__PURE__
|
|
|
49
53
|
children: /* @__PURE__ */ e("div", { className: s("px-4 pb-4 pt-2", o), children: t })
|
|
50
54
|
}
|
|
51
55
|
));
|
|
52
|
-
|
|
56
|
+
u.displayName = r.Content.displayName;
|
|
53
57
|
export {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
+
C as Accordion,
|
|
59
|
+
u as AccordionContent,
|
|
60
|
+
N as AccordionItem,
|
|
61
|
+
v as AccordionTrigger
|
|
58
62
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as d, jsxs as s } from "react/jsx-runtime";
|
|
2
2
|
import { Badge as f } from "../../badge.js";
|
|
3
|
-
import { getFieldValue as a, mapBadgeColor as g, mapBadgeVariant as u } from "./
|
|
3
|
+
import { getFieldValue as a, mapBadgeColor as g, mapBadgeVariant as u } from "./cell-renderer-utils.js";
|
|
4
4
|
const x = (e) => {
|
|
5
5
|
const { data: l, value: n } = e, i = a(e.badgeLabelField, e.badgeLabel, l) ?? (n != null ? String(n) : void 0), c = a(e.variantField, e.variant, l) ?? "filled", o = a(e.colorField, e.color, l) ?? "default", r = a(e.isIconField, e.isIcon, l), t = a(e.iconField, e.icon, l), m = a(e.sizeField, e.size, l);
|
|
6
6
|
return i ? /* @__PURE__ */ d("div", { className: "w-full h-full flex items-center justify-start ag-cell-inner-padding", children: /* @__PURE__ */ d(
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { BadgeVariant, BadgeColor, ValidationRules, ValueFormatter, SplitCellValueEntry } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Maps legacy variant names (from backend/config) to impact-nova Badge variants.
|
|
4
|
+
*/
|
|
5
|
+
export declare const mapBadgeVariant: (v: string | undefined) => BadgeVariant;
|
|
6
|
+
/**
|
|
7
|
+
* Maps legacy color names (from backend/config) to impact-nova Badge colors.
|
|
8
|
+
*/
|
|
9
|
+
export declare const mapBadgeColor: (c: string | undefined) => BadgeColor;
|
|
10
|
+
/**
|
|
11
|
+
* Resolves a value from either a static prop or a field in row data.
|
|
12
|
+
* Used by renderers that support both static and dynamic (field-driven) configuration.
|
|
13
|
+
*/
|
|
14
|
+
export declare const getFieldValue: <T>(fieldName: string | undefined, staticValue: T | undefined, rowData: Record<string, unknown> | null | undefined) => T | undefined;
|
|
15
|
+
/**
|
|
16
|
+
* Evaluates validation rules against row data
|
|
17
|
+
*/
|
|
18
|
+
export declare const evaluateValidationRules: (rules: ValidationRules | undefined, rowData: Record<string, unknown> | null | undefined) => boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Resolves the effective value formatter for a cell considering all 4 levels.
|
|
21
|
+
*
|
|
22
|
+
* Priority (highest wins): cell > row > split > column
|
|
23
|
+
*
|
|
24
|
+
* @param cellValueObj - The specific cell value object (may contain `cellMetadata.valueFormatter`).
|
|
25
|
+
* @param rowData - The full row data object (may contain `rowMetadata.valueFormatter`).
|
|
26
|
+
* @param splitFormatter - The split config's `valueFormatter`.
|
|
27
|
+
* @param columnFormatter - Column-level formatter (e.g. from `data?.valueFormatter`).
|
|
28
|
+
* @returns The resolved `ValueFormatter` or `null` if none found.
|
|
29
|
+
*/
|
|
30
|
+
export declare const resolveValueFormatter: (cellValueObj: SplitCellValueEntry | null | undefined, rowData: Record<string, unknown> | null | undefined, splitFormatter: ValueFormatter | null | undefined, columnFormatter: ValueFormatter | null | undefined) => ValueFormatter | null;
|
|
31
|
+
/**
|
|
32
|
+
* Applies a `ValueFormatter` to a raw value, producing a formatted string.
|
|
33
|
+
*
|
|
34
|
+
* Shared by `SplitCellRenderer` and `InputDisplayRenderer` to avoid
|
|
35
|
+
* duplicating the same currency / percentage / decimal formatting logic.
|
|
36
|
+
*
|
|
37
|
+
* @param formatter - The resolved `ValueFormatter` describing how to format.
|
|
38
|
+
* @param val - The raw value to format.
|
|
39
|
+
* @returns The formatted string, or `null` if `val` is nullish.
|
|
40
|
+
*/
|
|
41
|
+
export declare const applyValueFormatter: (formatter: ValueFormatter, val: unknown) => string | null;
|
|
42
|
+
/**
|
|
43
|
+
* Resolves the effective editability for a split sub-cell considering all 4 levels.
|
|
44
|
+
*
|
|
45
|
+
* Priority (highest wins): cell > row > split > column
|
|
46
|
+
*
|
|
47
|
+
* - **Column level** (`columnEditable`): colDef.editable — baseline for the whole column.
|
|
48
|
+
* - **Split level** (`splitEditable`): split config's `editable` — per sub-cell override within a split column.
|
|
49
|
+
* - **Row level** (`rowData.rowMetadata._isDisabled`): disables all cells in the row.
|
|
50
|
+
* - **Cell level** (`cellValueObj.cellMetadata._isDisabled`): per-cell override — highest priority.
|
|
51
|
+
*
|
|
52
|
+
* @param columnEditable - Whether the parent column is editable (boolean or undefined).
|
|
53
|
+
* @param splitEditable - Whether this specific split is marked editable (boolean or undefined).
|
|
54
|
+
* @param rowData - The full row data object (may contain `rowMetadata._isDisabled`).
|
|
55
|
+
* @param cellValueObj - The specific cell value object (may contain `cellMetadata._isDisabled`).
|
|
56
|
+
* @returns `true` if the sub-cell should be editable, `false` otherwise.
|
|
57
|
+
*/
|
|
58
|
+
export declare const resolveCellEditable: (columnEditable: boolean | undefined, splitEditable: boolean | undefined, rowData: Record<string, unknown> | null | undefined, cellValueObj: SplitCellValueEntry | null | undefined) => boolean;
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
const a = (r) => {
|
|
2
|
+
switch (r) {
|
|
3
|
+
case "filled":
|
|
4
|
+
return "solid";
|
|
5
|
+
case "stroke":
|
|
6
|
+
return "outline";
|
|
7
|
+
case "subtle":
|
|
8
|
+
return "subtle";
|
|
9
|
+
case "solid":
|
|
10
|
+
return "solid";
|
|
11
|
+
case "outline":
|
|
12
|
+
return "outline";
|
|
13
|
+
default:
|
|
14
|
+
return "solid";
|
|
15
|
+
}
|
|
16
|
+
}, i = (r) => {
|
|
17
|
+
switch (r) {
|
|
18
|
+
case "default":
|
|
19
|
+
return "primary";
|
|
20
|
+
case "info":
|
|
21
|
+
return "primary";
|
|
22
|
+
case "success":
|
|
23
|
+
return "success";
|
|
24
|
+
case "warning":
|
|
25
|
+
return "warning";
|
|
26
|
+
case "error":
|
|
27
|
+
return "destructive";
|
|
28
|
+
case "primary":
|
|
29
|
+
return "primary";
|
|
30
|
+
case "destructive":
|
|
31
|
+
return "destructive";
|
|
32
|
+
case "neutral":
|
|
33
|
+
return "neutral";
|
|
34
|
+
default:
|
|
35
|
+
return "primary";
|
|
36
|
+
}
|
|
37
|
+
}, c = (r, u, e) => {
|
|
38
|
+
if (r && e && r in e) {
|
|
39
|
+
const n = e[r];
|
|
40
|
+
return n != null && n !== "" ? n : void 0;
|
|
41
|
+
}
|
|
42
|
+
return u;
|
|
43
|
+
}, o = (r, u) => {
|
|
44
|
+
if (!r?.disabled || !u) return !1;
|
|
45
|
+
const { operator: e, conditions: n } = r.disabled, l = n.map((t) => {
|
|
46
|
+
const s = u[t.field];
|
|
47
|
+
if (s == null) return !1;
|
|
48
|
+
switch (t.condition) {
|
|
49
|
+
case ">":
|
|
50
|
+
return Number(s) > Number(t.value);
|
|
51
|
+
case "<":
|
|
52
|
+
return Number(s) < Number(t.value);
|
|
53
|
+
case ">=":
|
|
54
|
+
return Number(s) >= Number(t.value);
|
|
55
|
+
case "<=":
|
|
56
|
+
return Number(s) <= Number(t.value);
|
|
57
|
+
case "==":
|
|
58
|
+
return s == t.value;
|
|
59
|
+
case "!=":
|
|
60
|
+
return s != t.value;
|
|
61
|
+
case "contains":
|
|
62
|
+
return String(s).includes(String(t.value));
|
|
63
|
+
default:
|
|
64
|
+
return !1;
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
return e === "AND" ? l.every((t) => t === !0) : e === "OR" ? l.some((t) => t === !0) : !1;
|
|
68
|
+
}, f = (r, u, e, n) => {
|
|
69
|
+
const l = r?.cellMetadata?.valueFormatter;
|
|
70
|
+
if (l) return l;
|
|
71
|
+
const t = u != null && typeof u == "object" ? u.rowMetadata : void 0;
|
|
72
|
+
return t?.valueFormatter ? t.valueFormatter : e || n || null;
|
|
73
|
+
}, d = (r, u) => {
|
|
74
|
+
if (u == null) return null;
|
|
75
|
+
let e = String(u);
|
|
76
|
+
if (!e) return "--";
|
|
77
|
+
switch (r.decimals != null && !isNaN(Number(u)) && (e = Number(u).toFixed(r.decimals)), r.type) {
|
|
78
|
+
case "currencySymbol": {
|
|
79
|
+
const n = r.symbol ?? "$";
|
|
80
|
+
return r.position === "suffix" ? `${e} ${n}` : `${n} ${e}`;
|
|
81
|
+
}
|
|
82
|
+
case "percentage":
|
|
83
|
+
return `${e} %`;
|
|
84
|
+
case "number":
|
|
85
|
+
return e;
|
|
86
|
+
default:
|
|
87
|
+
return e;
|
|
88
|
+
}
|
|
89
|
+
}, b = (r, u, e, n) => {
|
|
90
|
+
const l = n?.cellMetadata?._isDisabled;
|
|
91
|
+
if (l === !0) return !1;
|
|
92
|
+
if (l === !1) return !0;
|
|
93
|
+
const s = (e != null && typeof e == "object" ? e.rowMetadata : void 0)?._isDisabled;
|
|
94
|
+
return s === !0 ? !1 : s === !1 ? !0 : u === !1 ? !1 : u === !0 ? !0 : r === !0;
|
|
95
|
+
};
|
|
96
|
+
export {
|
|
97
|
+
d as applyValueFormatter,
|
|
98
|
+
o as evaluateValidationRules,
|
|
99
|
+
c as getFieldValue,
|
|
100
|
+
i as mapBadgeColor,
|
|
101
|
+
a as mapBadgeVariant,
|
|
102
|
+
b as resolveCellEditable,
|
|
103
|
+
f as resolveValueFormatter
|
|
104
|
+
};
|