@cognite/aura 0.3.0 → 0.3.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.
Files changed (70) hide show
  1. package/DESIGN.md +2243 -729
  2. package/README.md +133 -11
  3. package/dist/components/index.d.ts +3 -2
  4. package/dist/components/index.js +183 -176
  5. package/dist/components/ui/core/action-toolbar/action-toolbar.js +4 -4
  6. package/dist/components/ui/core/alert/alert.js +3 -3
  7. package/dist/components/ui/core/banner/banner.js +6 -6
  8. package/dist/components/ui/core/button/button.js +4 -4
  9. package/dist/components/ui/core/checkbox/checkbox.js +8 -8
  10. package/dist/components/ui/core/code-block/code-block.js +6 -6
  11. package/dist/components/ui/core/date-time-pickers/date-picker/date-picker.d.ts +15 -0
  12. package/dist/components/ui/core/date-time-pickers/date-picker/date-picker.js +73 -0
  13. package/dist/components/ui/core/date-time-pickers/date-picker/index.d.ts +3 -0
  14. package/dist/components/ui/core/date-time-pickers/date-picker/types.d.ts +17 -0
  15. package/dist/components/ui/core/date-time-pickers/date-picker/use-date-picker.d.ts +3 -0
  16. package/dist/components/ui/core/date-time-pickers/date-picker/use-date-picker.js +52 -0
  17. package/dist/components/ui/core/date-time-pickers/date-range-picker/date-range-picker.js +64 -75
  18. package/dist/components/ui/core/date-time-pickers/date-range-picker/types.d.ts +1 -2
  19. package/dist/components/ui/core/date-time-pickers/date-range-picker/use-date-range-picker.js +51 -64
  20. package/dist/components/ui/core/date-time-pickers/date-time-range-picker/date-time-range-picker.js +146 -161
  21. package/dist/components/ui/core/date-time-pickers/date-time-range-picker/types.d.ts +1 -2
  22. package/dist/components/ui/core/date-time-pickers/date-time-range-picker/use-date-time-range-picker.js +124 -137
  23. package/dist/components/ui/core/date-time-pickers/index.d.ts +4 -0
  24. package/dist/components/ui/core/date-time-pickers/index.js +10 -0
  25. package/dist/components/ui/core/date-time-pickers/shared/calendar/calendar.js +8 -8
  26. package/dist/components/ui/core/date-time-pickers/shared/date-time-input/date-time-input.d.ts +1 -1
  27. package/dist/components/ui/core/date-time-pickers/shared/date-time-input/date-time-input.js +1 -1
  28. package/dist/components/ui/core/date-time-pickers/shared/hooks/use-popover-state.d.ts +0 -2
  29. package/dist/components/ui/core/date-time-pickers/shared/hooks/use-popover-state.js +18 -34
  30. package/dist/components/ui/core/date-time-pickers/shared/hooks/use-single-date-state.d.ts +23 -0
  31. package/dist/components/ui/core/date-time-pickers/shared/hooks/use-single-date-state.js +32 -0
  32. package/dist/components/ui/core/date-time-pickers/shared/time-picker-panel/index.d.ts +2 -0
  33. package/dist/components/ui/core/date-time-pickers/shared/time-picker-panel/time-picker-panel.d.ts +19 -0
  34. package/dist/components/ui/core/date-time-pickers/shared/time-picker-panel/time-picker-panel.js +41 -0
  35. package/dist/components/ui/core/date-time-pickers/time-picker/index.d.ts +3 -0
  36. package/dist/components/ui/core/date-time-pickers/time-picker/time-picker.d.ts +16 -0
  37. package/dist/components/ui/core/date-time-pickers/time-picker/time-picker.js +100 -0
  38. package/dist/components/ui/core/date-time-pickers/time-picker/types.d.ts +23 -0
  39. package/dist/components/ui/core/date-time-pickers/time-picker/use-time-picker.d.ts +3 -0
  40. package/dist/components/ui/core/date-time-pickers/time-picker/use-time-picker.js +64 -0
  41. package/dist/components/ui/core/date-time-pickers/utils/calendar-utils.js +3 -3
  42. package/dist/components/ui/core/date-time-pickers/utils/time-utils.js +1 -1
  43. package/dist/components/ui/core/dropdown-menu/dropdown-menu.d.ts +17 -15
  44. package/dist/components/ui/core/dropdown-menu/dropdown-menu.js +83 -85
  45. package/dist/components/ui/core/hover-card/hover-card.js +3 -3
  46. package/dist/components/ui/core/input/input.js +1 -1
  47. package/dist/components/ui/core/message/message.js +387 -101
  48. package/dist/components/ui/core/pagination/pagination.js +9 -7
  49. package/dist/components/ui/core/prompt-input/prompt-input.js +16 -16
  50. package/dist/components/ui/core/radio-group/radio-group.js +7 -7
  51. package/dist/components/ui/core/reasoning/reasoning.js +1 -1
  52. package/dist/components/ui/core/segmented-control/segmented-control.js +3 -3
  53. package/dist/components/ui/core/select/select.d.ts +2 -1
  54. package/dist/components/ui/core/select/select.js +134 -110
  55. package/dist/components/ui/core/shimmer/shimmer.d.ts +3 -1
  56. package/dist/components/ui/core/shimmer/shimmer.js +89 -49
  57. package/dist/components/ui/core/tabs/tabs.js +3 -3
  58. package/dist/components/ui/core/textarea/textarea.js +1 -1
  59. package/dist/components/ui/core/toggle/toggle.d.ts +15 -0
  60. package/dist/components/ui/core/toggle/toggle.js +74 -0
  61. package/dist/components/ui/core/tool/tool.js +3 -3
  62. package/dist/index.d.ts +1 -1
  63. package/dist/lib/portal-container-context.js +3 -3
  64. package/dist/lib/use-controllable-state.js +17 -17
  65. package/dist/lib/utils.d.ts +1 -1
  66. package/dist/lib/utils.js +7 -7
  67. package/dist/styles.css +1 -1
  68. package/dist/styles.source.css +3 -0
  69. package/package.json +200 -18
  70. package/dist/index.js +0 -308
@@ -1,17 +1,36 @@
1
- import { jsx as n, jsxs as c } from "react/jsx-runtime";
2
- import { forwardRef as i } from "react";
1
+ import { jsx as n, jsxs as m } from "react/jsx-runtime";
2
+ import { forwardRef as u } from "react";
3
3
  import { Menu as r } from "@base-ui/react/menu";
4
- import { IconCheck as l, IconChevronRight as m } from "@tabler/icons-react";
5
- import { usePortalContainer as g } from "../../../../lib/portal-container-context.js";
4
+ import { IconCheck as l, IconChevronRight as f } from "@tabler/icons-react";
5
+ import { cva as g } from "class-variance-authority";
6
+ import { usePortalContainer as b } from "../../../../lib/portal-container-context.js";
6
7
  import { cn as d } from "../../../../lib/utils.js";
7
- function G({ ...e }) {
8
+ const c = g(
9
+ "relative flex min-h-9 cursor-default items-center gap-2 rounded-md p-2 text-sm leading-4.5 font-medium outline-hidden select-none data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
10
+ {
11
+ variants: {
12
+ inset: {
13
+ true: "pl-8"
14
+ },
15
+ variant: {
16
+ default: "focus:bg-accent-background focus:text-foreground [&_svg:not([class*='text-'])]:text-foreground",
17
+ destructive: "text-destructive-foreground focus:bg-destructive-background-hover hover:bg-destructive-background-hover focus:text-destructive-foreground [&_svg]:text-destructive-foreground"
18
+ }
19
+ },
20
+ defaultVariants: {
21
+ inset: !1,
22
+ variant: "default"
23
+ }
24
+ }
25
+ );
26
+ function I({ ...e }) {
8
27
  return /* @__PURE__ */ n(r.Root, { "data-slot": "dropdown-menu", ...e });
9
28
  }
10
- function f({
29
+ function x({
11
30
  container: e,
12
31
  ...t
13
32
  }) {
14
- const o = g();
33
+ const o = b();
15
34
  return /* @__PURE__ */ n(
16
35
  r.Portal,
17
36
  {
@@ -21,22 +40,22 @@ function f({
21
40
  }
22
41
  );
23
42
  }
24
- function L({
43
+ function C({
25
44
  children: e,
26
45
  ...t
27
46
  }) {
28
47
  return /* @__PURE__ */ n(r.Trigger, { "data-slot": "dropdown-menu-trigger", ...t, children: e });
29
48
  }
30
- function b({
49
+ function w({
31
50
  align: e = "start",
32
51
  alignOffset: t = 0,
33
52
  side: o = "bottom",
34
53
  sideOffset: a = 4,
35
54
  className: s,
36
- container: u,
55
+ container: i,
37
56
  ...p
38
57
  }) {
39
- return /* @__PURE__ */ n(f, { container: u, children: /* @__PURE__ */ n(
58
+ return /* @__PURE__ */ n(x, { container: i, children: /* @__PURE__ */ n(
40
59
  r.Positioner,
41
60
  {
42
61
  className: "isolate z-50 outline-none",
@@ -49,7 +68,7 @@ function b({
49
68
  {
50
69
  "data-slot": "dropdown-menu-content",
51
70
  className: d(
52
- "bg-popover-background text-foreground p-1 data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 max-h-(--available-height) min-w-32 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-lg border shadow-md outline-none",
71
+ "bg-popover-background text-foreground p-1 data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 max-h-(--available-height) min-w-32 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-xl border border-border shadow-md outline-none",
53
72
  s
54
73
  ),
55
74
  ...p
@@ -58,34 +77,28 @@ function b({
58
77
  }
59
78
  ) });
60
79
  }
61
- function P({ ...e }) {
80
+ function R({ ...e }) {
62
81
  return /* @__PURE__ */ n(r.Group, { "data-slot": "dropdown-menu-group", ...e });
63
82
  }
64
- const v = i(({ className: e, inset: t, variant: o = "default", children: a, ...s }, u) => /* @__PURE__ */ n(
65
- r.Item,
66
- {
67
- ref: u,
68
- "data-slot": "dropdown-menu-item",
69
- "data-inset": t,
70
- "data-variant": o,
71
- className: d(
72
- "focus:bg-accent-background focus:text-foreground data-[variant=destructive]:text-destructive-foreground data-[variant=destructive]:focus:bg-destructive-background-hover dark:data-[variant=destructive]:focus:bg-destructive-background-hover data-[variant=destructive]:focus:text-destructive-foreground data-[variant=destructive]:*:[svg]:text-destructive-foreground data-[variant=destructive]:hover:bg-destructive-background-hover dark:data-[variant=destructive]:hover:bg-destructive-background-hover [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm p-2 text-base outline-hidden select-none data-disabled:pointer-events-none data-disabled:opacity-50 data-inset:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
73
- e
74
- ),
75
- ...s,
76
- children: a
77
- }
78
- ));
79
- v.displayName = "DropdownMenuItem";
80
- const x = i(({ className: e, children: t, checked: o, ...a }, s) => /* @__PURE__ */ c(
83
+ const S = u(
84
+ ({ className: e, inset: t, variant: o = "default", children: a, ...s }, i) => /* @__PURE__ */ n(
85
+ r.Item,
86
+ {
87
+ ref: i,
88
+ "data-slot": "dropdown-menu-item",
89
+ "data-inset": t,
90
+ "data-variant": o,
91
+ className: d(c({ inset: t, variant: o }), e),
92
+ ...s,
93
+ children: a
94
+ }
95
+ )
96
+ ), _ = u(({ className: e, children: t, checked: o, ...a }, s) => /* @__PURE__ */ m(
81
97
  r.CheckboxItem,
82
98
  {
83
99
  ref: s,
84
100
  "data-slot": "dropdown-menu-checkbox-item",
85
- className: d(
86
- "focus:bg-accent-background focus:text-foreground h-9 relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
87
- e
88
- ),
101
+ className: d(c({ inset: !0 }), e),
89
102
  checked: o,
90
103
  ...a,
91
104
  children: [
@@ -94,8 +107,7 @@ const x = i(({ className: e, children: t, checked: o, ...a }, s) => /* @__PURE__
94
107
  ]
95
108
  }
96
109
  ));
97
- x.displayName = "DropdownMenuCheckboxItem";
98
- function T({
110
+ function y({
99
111
  ...e
100
112
  }) {
101
113
  return /* @__PURE__ */ n(
@@ -106,53 +118,44 @@ function T({
106
118
  }
107
119
  );
108
120
  }
109
- const w = i(({ className: e, children: t, ...o }, a) => /* @__PURE__ */ c(
121
+ const G = u(({ className: e, children: t, ...o }, a) => /* @__PURE__ */ m(
110
122
  r.RadioItem,
111
123
  {
112
124
  ref: a,
113
125
  "data-slot": "dropdown-menu-radio-item",
114
- className: d(
115
- "focus:bg-accent-background focus:text-foreground h-9 relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
116
- e
117
- ),
126
+ className: d(c({ inset: !0 }), e),
118
127
  ...o,
119
128
  children: [
120
129
  /* @__PURE__ */ n("span", { className: "pointer-events-none absolute left-2 flex size-3.5 items-center justify-center", children: /* @__PURE__ */ n(r.RadioItemIndicator, { children: /* @__PURE__ */ n(l, { className: "size-4 text-foreground" }) }) }),
121
130
  t
122
131
  ]
123
132
  }
124
- ));
125
- w.displayName = "DropdownMenuRadioItem";
126
- const h = i(({ className: e, inset: t, ...o }, a) => /* @__PURE__ */ n(
133
+ )), P = u(({ className: e, inset: t, ...o }, a) => /* @__PURE__ */ n(
127
134
  r.GroupLabel,
128
135
  {
129
136
  ref: a,
130
137
  "data-slot": "dropdown-menu-label",
131
138
  "data-inset": t,
132
139
  className: d(
133
- "-mx-1 -mt-1 mb-1 px-2 py-1.5 text-sm border-b border-border font-medium data-inset:pl-8 text-foreground dark:text-foreground",
140
+ "-mx-1 -mt-1 mb-1 px-3 pt-2 text-sm leading-4.5 border-b border-border font-medium data-inset:pl-8 text-muted-foreground",
134
141
  e
135
142
  ),
136
143
  ...o
137
144
  }
138
- ));
139
- h.displayName = "DropdownMenuLabel";
140
- const M = i(
145
+ )), j = u(
141
146
  ({ className: e, ...t }, o) => /* @__PURE__ */ n(
142
147
  "div",
143
148
  {
144
149
  ref: o,
145
150
  "data-slot": "dropdown-menu-header",
146
151
  className: d(
147
- "-mx-1 -mt-1 mb-1 flex flex-row items-center gap-2 border-b border-border px-2 py-2 pointer-events-none",
152
+ "-mx-1 -mt-1 mb-1 flex flex-row items-center gap-2 border-b border-border p-3 pointer-events-none",
148
153
  e
149
154
  ),
150
155
  ...t
151
156
  }
152
157
  )
153
- );
154
- M.displayName = "DropdownMenuHeader";
155
- const D = i(({ className: e, ...t }, o) => /* @__PURE__ */ n(
158
+ ), T = u(({ className: e, ...t }, o) => /* @__PURE__ */ n(
156
159
  r.Separator,
157
160
  {
158
161
  ref: o,
@@ -160,9 +163,7 @@ const D = i(({ className: e, ...t }, o) => /* @__PURE__ */ n(
160
163
  className: d("bg-border -mx-1 my-1 h-px", e),
161
164
  ...t
162
165
  }
163
- ));
164
- D.displayName = "DropdownMenuSeparator";
165
- const N = i(
166
+ )), L = u(
166
167
  ({ className: e, ...t }, o) => /* @__PURE__ */ n(
167
168
  "span",
168
169
  {
@@ -176,40 +177,38 @@ const N = i(
176
177
  }
177
178
  )
178
179
  );
179
- N.displayName = "DropdownMenuShortcut";
180
- function j({
180
+ function V({
181
181
  ...e
182
182
  }) {
183
183
  return /* @__PURE__ */ n(r.SubmenuRoot, { "data-slot": "dropdown-menu-sub", ...e });
184
184
  }
185
- const k = i(({ className: e, inset: t, children: o, ...a }, s) => /* @__PURE__ */ c(
185
+ const H = u(({ className: e, inset: t, children: o, ...a }, s) => /* @__PURE__ */ m(
186
186
  r.SubmenuTrigger,
187
187
  {
188
188
  ref: s,
189
189
  "data-slot": "dropdown-menu-sub-trigger",
190
190
  "data-inset": t,
191
191
  className: d(
192
- "focus:bg-accent-background focus:text-foreground data-open:bg-accent-background data-open:text-foreground [&_svg:not([class*='text-'])]:text-muted-foreground flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-inset:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
192
+ "focus:bg-accent-background focus:text-foreground data-open:bg-accent-background data-open:text-foreground [&_svg:not([class*='text-'])]:text-muted-foreground flex min-h-9 cursor-default items-center gap-2 rounded-md px-2 text-sm leading-4.5 font-medium outline-hidden select-none data-inset:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
193
193
  e
194
194
  ),
195
195
  ...a,
196
196
  children: [
197
197
  o,
198
- /* @__PURE__ */ n(m, { className: "ml-auto size-4" })
198
+ /* @__PURE__ */ n(f, { className: "ml-auto size-4" })
199
199
  ]
200
200
  }
201
201
  ));
202
- k.displayName = "DropdownMenuSubTrigger";
203
- function H({
202
+ function q({
204
203
  align: e = "start",
205
204
  alignOffset: t = -3,
206
205
  side: o = "right",
207
206
  sideOffset: a = 0,
208
207
  className: s,
209
- ...u
208
+ ...i
210
209
  }) {
211
210
  return /* @__PURE__ */ n(
212
- b,
211
+ w,
213
212
  {
214
213
  "data-slot": "dropdown-menu-sub-content",
215
214
  className: d("min-w-32 w-auto", s),
@@ -217,41 +216,40 @@ function H({
217
216
  alignOffset: t,
218
217
  side: o,
219
218
  sideOffset: a,
220
- ...u
219
+ ...i
221
220
  }
222
221
  );
223
222
  }
224
- const y = i(
223
+ const A = u(
225
224
  ({ className: e, ...t }, o) => /* @__PURE__ */ n(
226
225
  "div",
227
226
  {
228
227
  ref: o,
229
228
  "data-slot": "dropdown-menu-section-label",
230
229
  className: d(
231
- "px-2 py-1 text-sm text-muted-foreground dark:text-muted-foreground",
230
+ "px-3 pt-2 pb-0 text-sm font-medium text-muted-foreground",
232
231
  e
233
232
  ),
234
233
  ...t
235
234
  }
236
235
  )
237
236
  );
238
- y.displayName = "DropdownMenuSectionLabel";
239
237
  export {
240
- G as DropdownMenu,
241
- x as DropdownMenuCheckboxItem,
242
- b as DropdownMenuContent,
243
- P as DropdownMenuGroup,
244
- M as DropdownMenuHeader,
245
- v as DropdownMenuItem,
246
- h as DropdownMenuLabel,
247
- f as DropdownMenuPortal,
248
- T as DropdownMenuRadioGroup,
249
- w as DropdownMenuRadioItem,
250
- y as DropdownMenuSectionLabel,
251
- D as DropdownMenuSeparator,
252
- N as DropdownMenuShortcut,
253
- j as DropdownMenuSub,
254
- H as DropdownMenuSubContent,
255
- k as DropdownMenuSubTrigger,
256
- L as DropdownMenuTrigger
238
+ I as DropdownMenu,
239
+ _ as DropdownMenuCheckboxItem,
240
+ w as DropdownMenuContent,
241
+ R as DropdownMenuGroup,
242
+ j as DropdownMenuHeader,
243
+ S as DropdownMenuItem,
244
+ P as DropdownMenuLabel,
245
+ x as DropdownMenuPortal,
246
+ y as DropdownMenuRadioGroup,
247
+ G as DropdownMenuRadioItem,
248
+ A as DropdownMenuSectionLabel,
249
+ T as DropdownMenuSeparator,
250
+ L as DropdownMenuShortcut,
251
+ V as DropdownMenuSub,
252
+ q as DropdownMenuSubContent,
253
+ H as DropdownMenuSubTrigger,
254
+ C as DropdownMenuTrigger
257
255
  };
@@ -1,15 +1,15 @@
1
1
  import { jsx as t } from "react/jsx-runtime";
2
- import { useMemo as p, forwardRef as l, useContext as f, createContext as u } from "react";
2
+ import { createContext as p, forwardRef as l, useContext as f, useMemo as u } from "react";
3
3
  import { PreviewCard as d } from "@base-ui/react/preview-card";
4
4
  import { usePortalContainer as g } from "../../../../lib/portal-container-context.js";
5
5
  import { cn as v } from "../../../../lib/utils.js";
6
- const m = u(null);
6
+ const m = p(null);
7
7
  function w({
8
8
  openDelay: o,
9
9
  closeDelay: e,
10
10
  ...a
11
11
  }) {
12
- const r = p(
12
+ const r = u(
13
13
  () => ({ openDelay: o, closeDelay: e }),
14
14
  [o, e]
15
15
  );
@@ -8,7 +8,7 @@ const u = o(
8
8
  ref: a,
9
9
  "data-slot": "input",
10
10
  className: l(
11
- "w-full",
11
+ "w-full h-9",
12
12
  d,
13
13
  s,
14
14
  p,