@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
|
@@ -1,262 +1,203 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
/^(inset|inset-x|inset-y|top|right|bottom|left|start|end|z)-.+$/,
|
|
29
|
-
/^(visible|invisible|isolate)$/
|
|
1
|
+
//#region libs/aura/src/eslint/no-overriding-styles.ts
|
|
2
|
+
var e = /* @__PURE__ */ new Set(["@cognite/aura/components", "@cognite/aura-labs/components"]), t = [
|
|
3
|
+
/^(block|inline|inline-block|flex|inline-flex|grid|inline-grid|contents|hidden)$/,
|
|
4
|
+
/^(w|h|min-w|max-w|min-h|max-h|size|aspect)-.+$/,
|
|
5
|
+
/^(m|mx|my|mt|mr|mb|ml|ms|me)-.+$/,
|
|
6
|
+
/^space-[xy]-.+$/,
|
|
7
|
+
/^gap(?:-[xy])?-.+$/,
|
|
8
|
+
/^(grow|grow-0|shrink|shrink-0)$/,
|
|
9
|
+
/^flex-(1|auto|initial|none|row|row-reverse|col|col-reverse|wrap|wrap-reverse|nowrap)$/,
|
|
10
|
+
/^basis-.+$/,
|
|
11
|
+
/^order-.+$/,
|
|
12
|
+
/^grid-(cols|rows)-.+$/,
|
|
13
|
+
/^auto-(cols|rows)-.+$/,
|
|
14
|
+
/^(col|row)-(auto|span-.+|start-.+|end-.+)$/,
|
|
15
|
+
/^justify-(start|end|center|between|around|evenly|stretch|normal)$/,
|
|
16
|
+
/^items-(start|end|center|baseline|stretch)$/,
|
|
17
|
+
/^content-(start|end|center|between|around|evenly|stretch|baseline)$/,
|
|
18
|
+
/^self-(auto|start|end|center|stretch|baseline)$/,
|
|
19
|
+
/^place-(items|content|self)-.+$/,
|
|
20
|
+
/^justify-self-.+$/,
|
|
21
|
+
/^(overflow|overflow-x|overflow-y|overscroll|overscroll-x|overscroll-y)-.+$/,
|
|
22
|
+
/^(whitespace|break)-.+$/,
|
|
23
|
+
/^(text-(left|center|right|justify|wrap|nowrap|balance|pretty))$/,
|
|
24
|
+
/^(truncate|line-clamp-.+)$/,
|
|
25
|
+
/^(static|fixed|absolute|relative|sticky)$/,
|
|
26
|
+
/^(inset|inset-x|inset-y|top|right|bottom|left|start|end|z)-.+$/,
|
|
27
|
+
/^(visible|invisible|isolate)$/
|
|
30
28
|
];
|
|
31
|
-
function
|
|
32
|
-
|
|
33
|
-
}
|
|
34
|
-
function h(e) {
|
|
35
|
-
return l(e) && typeof e.type == "string";
|
|
36
|
-
}
|
|
37
|
-
function u(e, n) {
|
|
38
|
-
return h(e) && e.type === n;
|
|
39
|
-
}
|
|
40
|
-
function p(e) {
|
|
41
|
-
return u(e, "Literal");
|
|
42
|
-
}
|
|
43
|
-
function y(e) {
|
|
44
|
-
if (!l(e))
|
|
45
|
-
return !1;
|
|
46
|
-
const n = e, r = Array.isArray(n.expressions) && Array.isArray(n.quasis);
|
|
47
|
-
return u(n, "TemplateLiteral") && r;
|
|
29
|
+
function n(e) {
|
|
30
|
+
return typeof e == "object" && !!e;
|
|
48
31
|
}
|
|
49
|
-
function
|
|
50
|
-
|
|
32
|
+
function r(e) {
|
|
33
|
+
return n(e) && typeof e.type == "string";
|
|
51
34
|
}
|
|
52
|
-
function
|
|
53
|
-
|
|
54
|
-
return !1;
|
|
55
|
-
const n = e, r = Array.isArray(n.arguments) && "callee" in n;
|
|
56
|
-
return u(n, "CallExpression") && r;
|
|
35
|
+
function i(e, t) {
|
|
36
|
+
return r(e) && e.type === t;
|
|
57
37
|
}
|
|
58
|
-
function
|
|
59
|
-
|
|
38
|
+
function a(e) {
|
|
39
|
+
return i(e, "Literal");
|
|
60
40
|
}
|
|
61
|
-
function
|
|
62
|
-
|
|
41
|
+
function o(e) {
|
|
42
|
+
if (!n(e)) return !1;
|
|
43
|
+
let t = e, r = Array.isArray(t.expressions) && Array.isArray(t.quasis);
|
|
44
|
+
return i(t, "TemplateLiteral") && r;
|
|
63
45
|
}
|
|
64
|
-
function
|
|
65
|
-
|
|
66
|
-
return !1;
|
|
67
|
-
const n = e, r = Array.isArray(n.elements);
|
|
68
|
-
return u(n, "ArrayExpression") && r;
|
|
46
|
+
function s(e) {
|
|
47
|
+
return i(e, "JSXExpressionContainer") && "expression" in e;
|
|
69
48
|
}
|
|
70
|
-
function
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
return u(n, "JSXIdentifier") && r;
|
|
49
|
+
function c(e) {
|
|
50
|
+
if (!n(e)) return !1;
|
|
51
|
+
let t = e, r = Array.isArray(t.arguments) && "callee" in t;
|
|
52
|
+
return i(t, "CallExpression") && r;
|
|
75
53
|
}
|
|
76
|
-
function
|
|
77
|
-
|
|
54
|
+
function l(e) {
|
|
55
|
+
return i(e, "ConditionalExpression") && "consequent" in e && "alternate" in e;
|
|
78
56
|
}
|
|
79
|
-
function
|
|
80
|
-
|
|
81
|
-
return !1;
|
|
82
|
-
const n = e, r = Array.isArray(n.attributes) && "name" in n;
|
|
83
|
-
return u(n, "JSXOpeningElement") && r;
|
|
57
|
+
function u(e) {
|
|
58
|
+
return i(e, "LogicalExpression") && "left" in e && "right" in e;
|
|
84
59
|
}
|
|
85
|
-
function
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
return u(n, "ImportDeclaration") && r;
|
|
60
|
+
function d(e) {
|
|
61
|
+
if (!n(e)) return !1;
|
|
62
|
+
let t = e, r = Array.isArray(t.elements);
|
|
63
|
+
return i(t, "ArrayExpression") && r;
|
|
90
64
|
}
|
|
91
|
-
function
|
|
92
|
-
|
|
65
|
+
function f(e) {
|
|
66
|
+
if (!n(e)) return !1;
|
|
67
|
+
let t = e, r = typeof t.name == "string";
|
|
68
|
+
return i(t, "JSXIdentifier") && r;
|
|
93
69
|
}
|
|
94
|
-
function
|
|
95
|
-
|
|
96
|
-
return null;
|
|
97
|
-
const n = e.local;
|
|
98
|
-
return l(n) && typeof n.name == "string" ? n.name : null;
|
|
70
|
+
function p(e) {
|
|
71
|
+
return i(e, "JSXAttribute") && "name" in e;
|
|
99
72
|
}
|
|
100
|
-
function
|
|
101
|
-
|
|
73
|
+
function m(e) {
|
|
74
|
+
if (!n(e)) return !1;
|
|
75
|
+
let t = e, r = Array.isArray(t.attributes) && "name" in t;
|
|
76
|
+
return i(t, "JSXOpeningElement") && r;
|
|
102
77
|
}
|
|
103
|
-
function
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
) : !1;
|
|
78
|
+
function h(e) {
|
|
79
|
+
if (!n(e)) return !1;
|
|
80
|
+
let t = e, r = Array.isArray(t.specifiers) && "source" in t;
|
|
81
|
+
return i(t, "ImportDeclaration") && r;
|
|
108
82
|
}
|
|
109
83
|
function g(e) {
|
|
110
|
-
|
|
84
|
+
return n(e.source) && typeof e.source.value == "string" ? e.source.value : null;
|
|
111
85
|
}
|
|
112
|
-
function
|
|
113
|
-
|
|
86
|
+
function _(e) {
|
|
87
|
+
if (!n(e) || !("local" in e)) return null;
|
|
88
|
+
let t = e.local;
|
|
89
|
+
return n(t) && typeof t.name == "string" ? t.name : null;
|
|
114
90
|
}
|
|
115
|
-
function
|
|
116
|
-
|
|
117
|
-
(n) => g(S(n))
|
|
118
|
-
) : x(e) ? m(e.expression) : $(e) ? e.arguments.flatMap((n) => m(n)) : C(e) ? [
|
|
119
|
-
...m(e.consequent),
|
|
120
|
-
...m(e.alternate)
|
|
121
|
-
] : k(e) ? [
|
|
122
|
-
...m(e.left),
|
|
123
|
-
...m(e.right)
|
|
124
|
-
] : E(e) ? e.elements.flatMap((n) => m(n)) : [] : [];
|
|
91
|
+
function v(e) {
|
|
92
|
+
return e.trim().split(":").at(-1)?.replace(/!$/, "").replace(/^-/, "");
|
|
125
93
|
}
|
|
126
|
-
function
|
|
127
|
-
|
|
94
|
+
function y(e) {
|
|
95
|
+
let n = v(e);
|
|
96
|
+
return n ? t.some((e) => e.test(n)) : !1;
|
|
128
97
|
}
|
|
129
|
-
function
|
|
130
|
-
|
|
98
|
+
function b(e) {
|
|
99
|
+
return e.split(/\s+/).map((e) => e.trim()).filter(Boolean);
|
|
131
100
|
}
|
|
132
|
-
function
|
|
133
|
-
|
|
101
|
+
function x(e) {
|
|
102
|
+
return e.value?.cooked ?? "";
|
|
134
103
|
}
|
|
135
|
-
function
|
|
136
|
-
|
|
137
|
-
sourceCode: n,
|
|
138
|
-
sanitizedTokens: r,
|
|
139
|
-
valueNode: o
|
|
140
|
-
}) {
|
|
141
|
-
const t = r.join(" ");
|
|
142
|
-
if (p(o))
|
|
143
|
-
return t === "" ? null : `"${t}"`;
|
|
144
|
-
if (!x(o) || !e)
|
|
145
|
-
return null;
|
|
146
|
-
if (p(e))
|
|
147
|
-
return t === "" ? null : `{${JSON.stringify(t)}}`;
|
|
148
|
-
if (y(e) && e.expressions.length === 0)
|
|
149
|
-
return t === "" ? null : `{${JSON.stringify(t)}}`;
|
|
150
|
-
if (!$(e) || !l(e.callee) || (typeof e.callee.name == "string" ? e.callee.name : null) !== "cn")
|
|
151
|
-
return null;
|
|
152
|
-
const i = [];
|
|
153
|
-
for (const s of e.arguments) {
|
|
154
|
-
if (p(s) && typeof s.value == "string") {
|
|
155
|
-
const a = d(
|
|
156
|
-
g(s.value)
|
|
157
|
-
).join(" ");
|
|
158
|
-
a && i.push(JSON.stringify(a));
|
|
159
|
-
continue;
|
|
160
|
-
}
|
|
161
|
-
if (y(s) && s.expressions.length === 0) {
|
|
162
|
-
const a = S(s.quasis[0] ?? {}), A = d(
|
|
163
|
-
g(a)
|
|
164
|
-
).join(" ");
|
|
165
|
-
A && i.push(JSON.stringify(A));
|
|
166
|
-
continue;
|
|
167
|
-
}
|
|
168
|
-
if (!h(s))
|
|
169
|
-
return null;
|
|
170
|
-
const c = z(n, s);
|
|
171
|
-
if (c === null)
|
|
172
|
-
return null;
|
|
173
|
-
i.push(c);
|
|
174
|
-
}
|
|
175
|
-
return i.length === 0 ? null : `{cn(${i.join(", ")})}`;
|
|
104
|
+
function S(e) {
|
|
105
|
+
return e ? a(e) ? typeof e.value == "string" ? b(e.value) : [] : o(e) ? e.quasis.flatMap((e) => b(x(e))) : s(e) ? S(e.expression) : c(e) ? e.arguments.flatMap((e) => S(e)) : l(e) ? [...S(e.consequent), ...S(e.alternate)] : u(e) ? [...S(e.left), ...S(e.right)] : d(e) ? e.elements.flatMap((e) => S(e)) : [] : [];
|
|
176
106
|
}
|
|
177
|
-
function
|
|
178
|
-
|
|
179
|
-
disallowedTokens: n,
|
|
180
|
-
sourceCode: r,
|
|
181
|
-
tokens: o
|
|
182
|
-
}) {
|
|
183
|
-
if (n.length === 0)
|
|
184
|
-
return null;
|
|
185
|
-
const t = e.value;
|
|
186
|
-
if (!t)
|
|
187
|
-
return null;
|
|
188
|
-
const f = x(t) ? t.expression : null, i = d(o), s = R({
|
|
189
|
-
expressionNode: f,
|
|
190
|
-
sanitizedTokens: i,
|
|
191
|
-
sourceCode: r,
|
|
192
|
-
valueNode: t
|
|
193
|
-
}), c = e.range;
|
|
194
|
-
return c ? (a) => s === null ? a.removeRange([c[0] - 1, c[1]]) : !h(t) || !t.range ? null : a.replaceTextRange(t.range, s) : null;
|
|
107
|
+
function C(e) {
|
|
108
|
+
return f(e.name) ? e.name.name : null;
|
|
195
109
|
}
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
110
|
+
function w(e) {
|
|
111
|
+
return e.filter(y);
|
|
112
|
+
}
|
|
113
|
+
function T(e, t) {
|
|
114
|
+
return t.range ? e.text.slice(t.range[0], t.range[1]) : null;
|
|
115
|
+
}
|
|
116
|
+
function E({ expressionNode: e, sourceCode: t, sanitizedTokens: i, valueNode: l }) {
|
|
117
|
+
let u = i.join(" ");
|
|
118
|
+
if (a(l)) return u === "" ? null : `"${u}"`;
|
|
119
|
+
if (!s(l) || !e) return null;
|
|
120
|
+
if (a(e) || o(e) && e.expressions.length === 0) return u === "" ? null : `{${JSON.stringify(u)}}`;
|
|
121
|
+
if (!c(e) || !n(e.callee) || (typeof e.callee.name == "string" ? e.callee.name : null) !== "cn") return null;
|
|
122
|
+
let d = [];
|
|
123
|
+
for (let n of e.arguments) {
|
|
124
|
+
if (a(n) && typeof n.value == "string") {
|
|
125
|
+
let e = w(b(n.value)).join(" ");
|
|
126
|
+
e && d.push(JSON.stringify(e));
|
|
127
|
+
continue;
|
|
128
|
+
}
|
|
129
|
+
if (o(n) && n.expressions.length === 0) {
|
|
130
|
+
let e = w(b(x(n.quasis[0] ?? {}))).join(" ");
|
|
131
|
+
e && d.push(JSON.stringify(e));
|
|
132
|
+
continue;
|
|
133
|
+
}
|
|
134
|
+
if (!r(n)) return null;
|
|
135
|
+
let e = T(t, n);
|
|
136
|
+
if (e === null) return null;
|
|
137
|
+
d.push(e);
|
|
138
|
+
}
|
|
139
|
+
return d.length === 0 ? null : `{cn(${d.join(", ")})}`;
|
|
140
|
+
}
|
|
141
|
+
function D({ classNameAttribute: e, disallowedTokens: t, sourceCode: n, tokens: i }) {
|
|
142
|
+
if (t.length === 0) return null;
|
|
143
|
+
let a = e.value;
|
|
144
|
+
if (!a) return null;
|
|
145
|
+
let o = E({
|
|
146
|
+
expressionNode: s(a) ? a.expression : null,
|
|
147
|
+
sanitizedTokens: w(i),
|
|
148
|
+
sourceCode: n,
|
|
149
|
+
valueNode: a
|
|
150
|
+
}), c = e.range;
|
|
151
|
+
return c ? (e) => o === null ? e.removeRange([c[0] - 1, c[1]]) : !r(a) || !a.range ? null : e.replaceTextRange(a.range, o) : null;
|
|
152
|
+
}
|
|
153
|
+
var O = {
|
|
154
|
+
meta: {
|
|
155
|
+
type: "suggestion",
|
|
156
|
+
fixable: "code",
|
|
157
|
+
hasSuggestions: !0,
|
|
158
|
+
docs: { description: "Warn when consumers visually override Aura component styles via className" },
|
|
159
|
+
schema: [],
|
|
160
|
+
messages: {
|
|
161
|
+
overridingAuraStyles: "Overriding Aura styles: only layout and sizing utilities should be passed via className. Move visual styling into Aura variants, props, or composition instead. Offending classes: {{classes}}.",
|
|
162
|
+
removeOverridingAuraStyles: "Remove disallowed Aura styling classes and keep only layout-safe utilities."
|
|
163
|
+
}
|
|
164
|
+
},
|
|
165
|
+
create(t) {
|
|
166
|
+
let n = /* @__PURE__ */ new Set(), r = t.sourceCode;
|
|
167
|
+
return {
|
|
168
|
+
ImportDeclaration(t) {
|
|
169
|
+
if (!h(t)) return;
|
|
170
|
+
let r = g(t);
|
|
171
|
+
if (!(!r || !e.has(r))) for (let e of t.specifiers) {
|
|
172
|
+
let t = _(e);
|
|
173
|
+
t && n.add(t);
|
|
174
|
+
}
|
|
175
|
+
},
|
|
176
|
+
JSXOpeningElement(e) {
|
|
177
|
+
if (!m(e)) return;
|
|
178
|
+
let i = C(e);
|
|
179
|
+
if (!i || !n.has(i)) return;
|
|
180
|
+
let a = e.attributes.find((e) => p(e) && f(e.name) && e.name.name === "className");
|
|
181
|
+
if (!a?.value) return;
|
|
182
|
+
let o = S(a.value), s = [...new Set(o)].filter((e) => !y(e)), c = D({
|
|
183
|
+
classNameAttribute: a,
|
|
184
|
+
disallowedTokens: s,
|
|
185
|
+
sourceCode: r,
|
|
186
|
+
tokens: o
|
|
187
|
+
});
|
|
188
|
+
s.length !== 0 && t.report({
|
|
189
|
+
node: a,
|
|
190
|
+
messageId: "overridingAuraStyles",
|
|
191
|
+
data: { classes: s.join(", ") },
|
|
192
|
+
fix: c,
|
|
193
|
+
suggest: c ? [{
|
|
194
|
+
messageId: "removeOverridingAuraStyles",
|
|
195
|
+
fix: c
|
|
196
|
+
}] : void 0
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
};
|
|
200
|
+
}
|
|
262
201
|
};
|
|
202
|
+
//#endregion
|
|
203
|
+
export { O as auraNoOverridingStylesRule };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@tabler/icons-react';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "@tabler/icons-react";
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { BundledLanguage } from 'shiki/bundle/web';
|
|
2
|
+
/**
|
|
3
|
+
* Syntax-highlights a snippet for both the light and dark themes.
|
|
4
|
+
*
|
|
5
|
+
* Keeping Shiki in this dedicated module ensures the shared `cn` helper —
|
|
6
|
+
* imported by every component — never drags it into the build graph. See
|
|
7
|
+
* README.md "Package imports".
|
|
8
|
+
*/
|
|
9
|
+
export declare function highlightCode(code: string, language: BundledLanguage, showLineNumbers?: boolean): Promise<[string, string]>;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { codeToHtml as e } from "shiki/bundle/web";
|
|
2
|
+
//#region libs/aura/src/lib/highlight-code.ts
|
|
3
|
+
var t = {
|
|
4
|
+
name: "strip-pre-styles",
|
|
5
|
+
pre(e) {
|
|
6
|
+
e.properties.style = void 0;
|
|
7
|
+
}
|
|
8
|
+
}, n = {
|
|
9
|
+
name: "line-numbers",
|
|
10
|
+
line(e, t) {
|
|
11
|
+
e.children.unshift({
|
|
12
|
+
type: "element",
|
|
13
|
+
tagName: "span",
|
|
14
|
+
properties: { className: [
|
|
15
|
+
"inline-block",
|
|
16
|
+
"min-w-10",
|
|
17
|
+
"mr-4",
|
|
18
|
+
"text-right",
|
|
19
|
+
"select-none",
|
|
20
|
+
"text-muted-foreground"
|
|
21
|
+
] },
|
|
22
|
+
children: [{
|
|
23
|
+
type: "text",
|
|
24
|
+
value: String(t)
|
|
25
|
+
}]
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
async function r(r, i, a = !1) {
|
|
30
|
+
let o = [t, ...a ? [n] : []];
|
|
31
|
+
return await Promise.all([e(r, {
|
|
32
|
+
lang: i,
|
|
33
|
+
theme: "one-light",
|
|
34
|
+
transformers: o
|
|
35
|
+
}), e(r, {
|
|
36
|
+
lang: i,
|
|
37
|
+
theme: "one-dark-pro",
|
|
38
|
+
transformers: o
|
|
39
|
+
})]);
|
|
40
|
+
}
|
|
41
|
+
//#endregion
|
|
42
|
+
export { r as highlightCode };
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { getPortalContainer as e } from "./utils.js";
|
|
2
|
+
import { createContext as t, useContext as n } from "react";
|
|
3
|
+
//#region libs/aura/src/lib/portal-container-context.ts
|
|
4
|
+
var r = t(void 0);
|
|
5
|
+
function i() {
|
|
6
|
+
return n(r) ?? e();
|
|
6
7
|
}
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
C as usePortalContainer
|
|
10
|
-
};
|
|
8
|
+
//#endregion
|
|
9
|
+
export { r as PortalContainerContext, i as usePortalContainer };
|
package/dist/lib/style-scope.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
export {
|
|
6
|
-
a as default
|
|
1
|
+
//#region libs/aura/src/lib/style-scope.ts
|
|
2
|
+
var e = {
|
|
3
|
+
styleScope: "aura-style-scope",
|
|
4
|
+
portalContainer: "aura-portal-container"
|
|
7
5
|
};
|
|
6
|
+
//#endregion
|
|
7
|
+
export { e as default };
|
|
@@ -1,32 +1,23 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { useCallback as e, useEffect as t, useRef as n, useState as r } from "react";
|
|
2
|
+
//#region libs/aura/src/lib/use-controllable-state.ts
|
|
3
|
+
function i(e) {
|
|
4
|
+
return typeof e == "function";
|
|
4
5
|
}
|
|
5
|
-
function
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}) {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
}
|
|
21
|
-
a((n) => {
|
|
22
|
-
const s = c(t) ? t(n) : t;
|
|
23
|
-
return u.current?.(s), s;
|
|
24
|
-
});
|
|
25
|
-
},
|
|
26
|
-
[r, e]
|
|
27
|
-
);
|
|
28
|
-
return [i, d];
|
|
6
|
+
function a({ prop: a, defaultProp: o, onChange: s }) {
|
|
7
|
+
let [c, l] = r(o), u = a !== void 0, d = u ? a : c, f = n(s);
|
|
8
|
+
return t(() => {
|
|
9
|
+
f.current = s;
|
|
10
|
+
}, [s]), [d, e((e) => {
|
|
11
|
+
if (u) {
|
|
12
|
+
let t = i(e) ? e(a) : e;
|
|
13
|
+
f.current?.(t);
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
l((t) => {
|
|
17
|
+
let n = i(e) ? e(t) : e;
|
|
18
|
+
return f.current?.(n), n;
|
|
19
|
+
});
|
|
20
|
+
}, [u, a])];
|
|
29
21
|
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
};
|
|
22
|
+
//#endregion
|
|
23
|
+
export { a as useControllableState };
|
package/dist/lib/utils.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { ClassValue } from 'clsx';
|
|
2
|
-
import { BundledLanguage } from 'shiki';
|
|
3
2
|
type PortalContainerOptions = {
|
|
4
3
|
id?: string;
|
|
5
4
|
className?: string;
|
|
@@ -7,7 +6,6 @@ type PortalContainerOptions = {
|
|
|
7
6
|
};
|
|
8
7
|
export declare function cn(...inputs: ClassValue[]): string;
|
|
9
8
|
export declare const isStorybookTestEnv: boolean;
|
|
10
|
-
export declare function highlightCode(code: string, language: BundledLanguage, showLineNumbers?: boolean): Promise<[string, string]>;
|
|
11
9
|
export declare function getInitials(name: string): string;
|
|
12
10
|
/**
|
|
13
11
|
* Focus rings for non-form interactive elements (buttons, etc.).
|