@cognite/aura 0.3.2 → 0.3.3
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/DESIGN.md +134 -5
- package/README.md +24 -3
- package/dist/components/index.d.ts +2 -0
- package/dist/components/index.js +58 -327
- package/dist/components/ui/core/accordion/accordion.js +79 -114
- package/dist/components/ui/core/action-toolbar/action-toolbar.js +108 -176
- package/dist/components/ui/core/alert/alert.js +158 -206
- package/dist/components/ui/core/avatar/avatar.js +64 -90
- package/dist/components/ui/core/badge/badge.js +73 -108
- package/dist/components/ui/core/banner/banner.js +146 -215
- package/dist/components/ui/core/breadcrumb/breadcrumb.js +105 -200
- package/dist/components/ui/core/button/button.js +47 -52
- package/dist/components/ui/core/button-group/button-group.js +40 -79
- package/dist/components/ui/core/card/card.js +102 -185
- package/dist/components/ui/core/chart/chart.js +116 -206
- package/dist/components/ui/core/chart/index.js +2 -8
- package/dist/components/ui/core/checkbox/checkbox.js +67 -132
- package/dist/components/ui/core/checkbox/checkbox.metadata.js +7 -7
- package/dist/components/ui/core/code-block/code-block.d.ts +1 -1
- package/dist/components/ui/core/code-block/code-block.js +179 -267
- package/dist/components/ui/core/collapsible/collapsible.js +29 -49
- package/dist/components/ui/core/combobox/combobox.js +41 -0
- package/dist/components/ui/core/command/command.js +85 -150
- package/dist/components/ui/core/count/count.js +21 -32
- package/dist/components/ui/core/date-time-pickers/date-picker/date-picker.js +60 -72
- package/dist/components/ui/core/date-time-pickers/date-picker/use-date-picker.js +36 -51
- package/dist/components/ui/core/date-time-pickers/date-range-picker/date-range-picker.js +63 -87
- package/dist/components/ui/core/date-time-pickers/date-range-picker/use-date-range-picker.js +60 -68
- package/dist/components/ui/core/date-time-pickers/date-time-range-picker/date-time-range-picker.js +118 -174
- package/dist/components/ui/core/date-time-pickers/date-time-range-picker/use-date-time-range-picker.js +104 -145
- package/dist/components/ui/core/date-time-pickers/index.js +5 -10
- package/dist/components/ui/core/date-time-pickers/shared/am-pm-scroll/am-pm-scroll.js +42 -56
- package/dist/components/ui/core/date-time-pickers/shared/calendar/calendar.js +66 -117
- package/dist/components/ui/core/date-time-pickers/shared/calendar-header/calendar-header.js +63 -93
- package/dist/components/ui/core/date-time-pickers/shared/date-time-input/date-time-input.js +64 -98
- package/dist/components/ui/core/date-time-pickers/shared/date-time-input/range-input-display.js +38 -67
- package/dist/components/ui/core/date-time-pickers/shared/hooks/use-popover-state.js +23 -23
- package/dist/components/ui/core/date-time-pickers/shared/hooks/use-range-date-state.js +52 -62
- package/dist/components/ui/core/date-time-pickers/shared/hooks/use-range-step-manager.js +18 -18
- package/dist/components/ui/core/date-time-pickers/shared/hooks/use-single-date-state.js +24 -31
- package/dist/components/ui/core/date-time-pickers/shared/hooks/use-time-state.js +24 -33
- package/dist/components/ui/core/date-time-pickers/shared/scroll-cell-classes.js +4 -7
- package/dist/components/ui/core/date-time-pickers/shared/shortcuts-panel/shortcuts-panel.js +17 -31
- package/dist/components/ui/core/date-time-pickers/shared/time-picker-panel/time-picker-panel.js +40 -40
- package/dist/components/ui/core/date-time-pickers/shared/time-picker-scroll/time-picker-scroll.js +33 -50
- package/dist/components/ui/core/date-time-pickers/time-picker/time-picker.js +78 -99
- package/dist/components/ui/core/date-time-pickers/time-picker/use-time-picker.js +41 -63
- package/dist/components/ui/core/date-time-pickers/utils/calendar-utils.js +39 -52
- package/dist/components/ui/core/date-time-pickers/utils/time-utils.js +7 -15
- package/dist/components/ui/core/dialog/dialog.js +82 -155
- package/dist/components/ui/core/dropdown-menu/dropdown-menu.d.ts +2 -2
- package/dist/components/ui/core/dropdown-menu/dropdown-menu.js +150 -248
- package/dist/components/ui/core/empty-state/empty-state.context.js +5 -8
- package/dist/components/ui/core/empty-state/empty-state.js +86 -138
- package/dist/components/ui/core/helper-text/helper-text.js +37 -65
- package/dist/components/ui/core/hover-card/hover-card.js +54 -80
- package/dist/components/ui/core/inline-citation/inline-citation.js +98 -181
- package/dist/components/ui/core/input/input.js +12 -27
- package/dist/components/ui/core/input-group/input-group.js +76 -173
- package/dist/components/ui/core/kbd/kbd.js +20 -36
- package/dist/components/ui/core/label/label.js +26 -43
- package/dist/components/ui/core/loader/loader.js +80 -117
- package/dist/components/ui/core/message/message-response-default-streamdown-controls.js +12 -12
- package/dist/components/ui/core/message/message.d.ts +2 -2
- package/dist/components/ui/core/message/message.js +316 -542
- package/dist/components/ui/core/pagination/pagination-size-context.js +5 -6
- package/dist/components/ui/core/pagination/pagination-teleport.js +86 -106
- package/dist/components/ui/core/pagination/pagination-teleport.utils.js +6 -6
- package/dist/components/ui/core/pagination/pagination.js +231 -334
- package/dist/components/ui/core/popover/popover.js +90 -157
- package/dist/components/ui/core/progress/progress.js +36 -61
- package/dist/components/ui/core/prompt-input/prompt-input.js +274 -413
- package/dist/components/ui/core/radio-group/radio-group.js +58 -113
- package/dist/components/ui/core/reasoning/reasoning.js +55 -86
- package/dist/components/ui/core/scroll-area/scroll-area.js +41 -71
- package/dist/components/ui/core/search/search.js +77 -99
- package/dist/components/ui/core/segmented-control/segmented-control.js +110 -167
- package/dist/components/ui/core/select/select.js +168 -293
- package/dist/components/ui/core/separator/separator.js +13 -23
- package/dist/components/ui/core/shimmer/shimmer.d.ts +2 -4
- package/dist/components/ui/core/shimmer/shimmer.js +40 -107
- package/dist/components/ui/core/skeleton/skeleton.js +13 -18
- package/dist/components/ui/core/sonner-toast/sonner-toast.js +54 -47
- package/dist/components/ui/core/sources/sources.d.ts +5 -1
- package/dist/components/ui/core/sources/sources.js +58 -79
- package/dist/components/ui/core/switch/switch.js +62 -0
- package/dist/components/ui/core/tabs/tabs.js +149 -223
- package/dist/components/ui/core/tabs/tabs.utils.js +6 -8
- package/dist/components/ui/core/textarea/textarea.js +13 -27
- package/dist/components/ui/core/toggle/toggle.js +55 -74
- package/dist/components/ui/core/tool/tool.js +127 -163
- package/dist/components/ui/core/tooltip/tooltip.js +47 -86
- package/dist/components/ui/core/topbar/topbar.js +106 -190
- package/dist/eslint/index.js +5 -10
- package/dist/eslint/no-overriding-styles.js +178 -237
- package/dist/icons/index.d.ts +1 -0
- package/dist/icons/index.js +1 -0
- package/dist/lib/highlight-code.d.ts +9 -0
- package/dist/lib/highlight-code.js +42 -0
- package/dist/lib/portal-container-context.js +8 -9
- package/dist/lib/style-scope.js +6 -6
- package/dist/lib/use-controllable-state.js +21 -30
- package/dist/lib/utils.d.ts +0 -2
- package/dist/lib/utils.js +32 -112
- package/dist/styles.css +1 -1
- package/dist/styles.source.css +23 -0
- package/package.json +23 -7
- package/dist/components/ui/core/date-time-pickers/shared/constants.js +0 -14
package/dist/lib/utils.js
CHANGED
|
@@ -1,117 +1,37 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import { twMerge as
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
function
|
|
7
|
-
|
|
1
|
+
import e from "./style-scope.js";
|
|
2
|
+
import { clsx as t } from "clsx";
|
|
3
|
+
import { twMerge as n } from "tailwind-merge";
|
|
4
|
+
//#region libs/aura/src/lib/utils.ts
|
|
5
|
+
var r = null, i = !1;
|
|
6
|
+
function a(...e) {
|
|
7
|
+
return n(t(e));
|
|
8
8
|
}
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}
|
|
14
|
-
}, p = {
|
|
15
|
-
name: "line-numbers",
|
|
16
|
-
line(e, t) {
|
|
17
|
-
e.children.unshift({
|
|
18
|
-
type: "element",
|
|
19
|
-
tagName: "span",
|
|
20
|
-
properties: {
|
|
21
|
-
className: [
|
|
22
|
-
"inline-block",
|
|
23
|
-
"min-w-10",
|
|
24
|
-
"mr-4",
|
|
25
|
-
"text-right",
|
|
26
|
-
"select-none",
|
|
27
|
-
"text-muted-foreground"
|
|
28
|
-
]
|
|
29
|
-
},
|
|
30
|
-
children: [{ type: "text", value: String(t) }]
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
};
|
|
34
|
-
async function x(e, t, r = !1) {
|
|
35
|
-
const o = [
|
|
36
|
-
g,
|
|
37
|
-
...r ? [p] : []
|
|
38
|
-
];
|
|
39
|
-
return await Promise.all([
|
|
40
|
-
i(e, {
|
|
41
|
-
lang: t,
|
|
42
|
-
theme: "one-light",
|
|
43
|
-
transformers: o
|
|
44
|
-
}),
|
|
45
|
-
i(e, {
|
|
46
|
-
lang: t,
|
|
47
|
-
theme: "one-dark-pro",
|
|
48
|
-
transformers: o
|
|
49
|
-
})
|
|
50
|
-
]);
|
|
51
|
-
}
|
|
52
|
-
function k(e) {
|
|
53
|
-
const t = e.trim().split(/\s+/);
|
|
54
|
-
if (t.length === 0 || !t[0])
|
|
55
|
-
return "";
|
|
56
|
-
if (t.length === 1)
|
|
57
|
-
return t[0].slice(0, 2).toUpperCase();
|
|
58
|
-
const r = t[0].charAt(0).toUpperCase(), o = t[t.length - 1].charAt(0).toUpperCase();
|
|
59
|
-
return r + o;
|
|
9
|
+
var o = typeof window < "u" && window.__STORYBOOK_TEST__ === !0;
|
|
10
|
+
function s(e) {
|
|
11
|
+
let t = e.trim().split(/\s+/);
|
|
12
|
+
return t.length === 0 || !t[0] ? "" : t.length === 1 ? t[0].slice(0, 2).toUpperCase() : t[0].charAt(0).toUpperCase() + t[t.length - 1].charAt(0).toUpperCase();
|
|
60
13
|
}
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
"hover:border-border-emphasized hover:bg-accent-background",
|
|
65
|
-
"has-[[data-disabled]]:border-border has-[[data-disabled]]:bg-transparent",
|
|
66
|
-
"has-[[data-disabled]]:hover:border-border has-[[data-disabled]]:hover:bg-transparent"
|
|
67
|
-
), A = "col-start-2 text-sm font-medium leading-4.5 tracking-normal text-secondary-foreground dark:text-secondary-foreground", R = "col-start-2 text-xs font-normal leading-3.5 tracking-tightest text-muted-foreground";
|
|
68
|
-
function j(e) {
|
|
69
|
-
return e.split("-").map((t) => t.charAt(0).toUpperCase() + t.slice(1)).join("");
|
|
14
|
+
var c = "focus-visible:shadow-focus-ring outline-none", l = "focus-visible:shadow-focus-ring-destructive outline-none", u = "border border-transparent rounded-lg bg-muted-background py-1.75 pl-2 pr-1 text-sm leading-5 tracking-tight text-muted-foreground placeholder:text-muted-foreground", d = "hover:bg-accent-background hover:border hover:border-border-emphasized", f = "[&:not(:placeholder-shown):not(:focus)]:bg-muted-background [&:not(:placeholder-shown)]:text-foreground", p = "focus-visible:shadow-focus-ring focus-visible:bg-background focus-visible:border-transparent focus-visible:text-foreground outline-none", m = "aria-invalid:border-destructive-foreground aria-invalid:shadow-focus-ring-destructive aria-invalid:border-transparent aria-invalid:text-foreground aria-invalid:focus-visible:shadow-focus-ring aria-invalid:focus-visible:bg-background aria-invalid:focus-visible:border-transparent aria-invalid:focus-visible:text-foreground outline-none", h = "disabled:bg-disabled-background disabled:border-transparent disabled:text-disabled-foreground disabled:placeholder:text-disabled-foreground disabled:pointer-events-none disabled:cursor-not-allowed", g = "read-only:border-transparent read-only:text-muted-foreground read-only:cursor-default read-only:hover:border-transparent read-only:focus-visible:shadow-none read-only:focus-visible:border-transparent read-only:focus-visible:bg-muted-background [&:read-only:not(:placeholder-shown)]:text-muted-foreground", _ = "grid max-w-150 cursor-pointer grid-cols-[auto_1fr] items-start gap-x-2 gap-y-1 has-[[data-disabled]]:cursor-not-allowed", v = "min-h-9 py-2", y = a("w-64 rounded-md border border-transparent p-3 bg-card-background", "has-[[data-checked]]:bg-active-muted-background", "hover:border-border-emphasized hover:bg-accent-background", "has-[[data-disabled]]:border-border has-[[data-disabled]]:bg-transparent", "has-[[data-disabled]]:hover:border-border has-[[data-disabled]]:hover:bg-transparent"), b = "col-start-2 text-sm font-medium leading-4.5 tracking-normal text-secondary-foreground dark:text-secondary-foreground", x = "col-start-2 text-xs font-normal leading-3.5 tracking-tightest text-muted-foreground";
|
|
15
|
+
function S(e) {
|
|
16
|
+
return e.split("-").map((e) => e.charAt(0).toUpperCase() + e.slice(1)).join("");
|
|
70
17
|
}
|
|
71
|
-
function
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
18
|
+
function C(e) {
|
|
19
|
+
if (!e) return "unknown";
|
|
20
|
+
try {
|
|
21
|
+
return new URL(e).hostname;
|
|
22
|
+
} catch {
|
|
23
|
+
return e;
|
|
24
|
+
}
|
|
78
25
|
}
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
return;
|
|
89
|
-
t && !l && (console.warn(
|
|
90
|
-
"Custom portal container props can lead to unintended behavior. Use with caution."
|
|
91
|
-
), l = !0);
|
|
92
|
-
let n = document?.getElementById(r);
|
|
93
|
-
return n || (n = document.createElement("div"), document.body.appendChild(n)), c(n), a = n, n;
|
|
94
|
-
};
|
|
95
|
-
export {
|
|
96
|
-
f as cn,
|
|
97
|
-
U as disabledState,
|
|
98
|
-
T as filledState,
|
|
99
|
-
C as focusRing,
|
|
100
|
-
S as focusRingDestructive,
|
|
101
|
-
O as focusState,
|
|
102
|
-
I as formElementBase,
|
|
103
|
-
D as getHostname,
|
|
104
|
-
k as getInitials,
|
|
105
|
-
H as getPortalContainer,
|
|
106
|
-
x as highlightCode,
|
|
107
|
-
P as hoverState,
|
|
108
|
-
N as invalidState,
|
|
109
|
-
w as isStorybookTestEnv,
|
|
110
|
-
_ as readOnlyState,
|
|
111
|
-
B as selectionItemBase,
|
|
112
|
-
z as selectionItemCard,
|
|
113
|
-
E as selectionItemDefault,
|
|
114
|
-
R as selectionItemDescription,
|
|
115
|
-
A as selectionItemLabel,
|
|
116
|
-
j as slugToPascalCase
|
|
26
|
+
var w = (t) => {
|
|
27
|
+
let n = !!(t && Object.keys(t).length > 0), a = t?.id ?? e.portalContainer, o = t?.className ?? e.styleScope, s = (e) => {
|
|
28
|
+
e.id = a, e.className = o, e.style.position = t?.style?.position ?? "fixed", e.style.zIndex = t?.style?.zIndex ?? "1000", t?.style && Object.assign(e.style, t.style);
|
|
29
|
+
};
|
|
30
|
+
if (r && !document.body?.contains(r) && (r = null), r) return n && console.warn("getPortalContainer: Portal container already exists. Custom options will be ignored to prevent side effects."), r;
|
|
31
|
+
if (typeof window > "u") return;
|
|
32
|
+
n && !i && (console.warn("Custom portal container props can lead to unintended behavior. Use with caution."), i = !0);
|
|
33
|
+
let c = document?.getElementById(a);
|
|
34
|
+
return c || (c = document.createElement("div"), document.body.appendChild(c)), s(c), r = c, c;
|
|
117
35
|
};
|
|
36
|
+
//#endregion
|
|
37
|
+
export { a as cn, h as disabledState, f as filledState, c as focusRing, l as focusRingDestructive, p as focusState, u as formElementBase, C as getHostname, s as getInitials, w as getPortalContainer, d as hoverState, m as invalidState, o as isStorybookTestEnv, g as readOnlyState, _ as selectionItemBase, y as selectionItemCard, v as selectionItemDefault, x as selectionItemDescription, b as selectionItemLabel, S as slugToPascalCase };
|