@cognite/aura 1.46768.0 → 1.46870.0

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 (25) hide show
  1. package/DESIGN.md +12 -0
  2. package/dist/components/ui/core/alert/alert.gallery.d.ts +2 -0
  3. package/dist/components/ui/core/alert/alert.gallery.js +54 -0
  4. package/dist/components/ui/core/alert/alert.gallery.js.map +1 -0
  5. package/dist/components/ui/core/avatar/avatar.gallery.d.ts +2 -0
  6. package/dist/components/ui/core/avatar/avatar.gallery.js +67 -0
  7. package/dist/components/ui/core/avatar/avatar.gallery.js.map +1 -0
  8. package/dist/components/ui/core/badge/badge.gallery.d.ts +2 -0
  9. package/dist/components/ui/core/badge/badge.gallery.js +64 -0
  10. package/dist/components/ui/core/badge/badge.gallery.js.map +1 -0
  11. package/dist/components/ui/core/checkbox/checkbox.gallery.d.ts +2 -0
  12. package/dist/components/ui/core/checkbox/checkbox.gallery.js +36 -0
  13. package/dist/components/ui/core/checkbox/checkbox.gallery.js.map +1 -0
  14. package/dist/components/ui/core/data-grid/data-grid.utils.js +27 -0
  15. package/dist/components/ui/core/data-grid/data-grid.utils.js.map +1 -1
  16. package/dist/components/ui/core/switch/switch.gallery.d.ts +2 -0
  17. package/dist/components/ui/core/switch/switch.gallery.js +67 -0
  18. package/dist/components/ui/core/switch/switch.gallery.js.map +1 -0
  19. package/dist/styles.css +1 -1
  20. package/package.json +1 -1
  21. package/src/components/ui/core/alert/alert.md +46 -0
  22. package/src/components/ui/core/avatar/avatar.md +30 -0
  23. package/src/components/ui/core/badge/badge.md +32 -0
  24. package/src/components/ui/core/checkbox/checkbox.md +37 -0
  25. package/src/components/ui/core/switch/switch.md +26 -0
package/DESIGN.md CHANGED
@@ -991,6 +991,12 @@ Anytime you need to reference a component in Storybook, use the following URL an
991
991
 
992
992
  Anytime you need to reference a component in docs, use the following URL and replace the slug with the component's doc slug: https://docs.cognite.com/aura-design-system/primitives/{docs-slug}
993
993
 
994
+ #### Component guidance files
995
+
996
+ Some components have full usage guidance in a Markdown file next to their source, linked from their section below as **Full guidance**.
997
+ These files ship in the npm package and are importable as `@cognite/aura/docs/{component}`, with a matching example gallery at `@cognite/aura/examples/{component}`.
998
+ When a component has a guidance file, treat it as the primary reference and its section below as a summary.
999
+
994
1000
  #### Accordion
995
1001
 
996
1002
  **Storybook-slug:** accordion
@@ -1068,6 +1074,7 @@ Action toolbar is a transient bottom-aligned action row that appears when users
1068
1074
 
1069
1075
  **Storybook-slug:** alert
1070
1076
  **Docs-slug:** alert
1077
+ **Full guidance:** [alert.md](./src/components/ui/core/alert/alert.md)
1071
1078
 
1072
1079
  **Definition**
1073
1080
  Alert communicates contextual, medium-emphasis information inside page/task flow. It is not a blocking modal.
@@ -1126,6 +1133,7 @@ Short, focused confirmation or acknowledgment that interrupts the user for a cle
1126
1133
 
1127
1134
  **Storybook-slug:** avatar
1128
1135
  **Docs-slug:** avatar
1136
+ **Full guidance:** [avatar.md](./src/components/ui/core/avatar/avatar.md)
1129
1137
 
1130
1138
  **Definition**
1131
1139
  Avatar visually represents a user, team, or concept and helps recognition in collaborative UI.
@@ -1151,6 +1159,7 @@ Avatar visually represents a user, team, or concept and helps recognition in col
1151
1159
 
1152
1160
  **Storybook-slug:** badge
1153
1161
  **Docs-slug:** badge
1162
+ **Full guidance:** [badge.md](./src/components/ui/core/badge/badge.md)
1154
1163
 
1155
1164
  **Definition**
1156
1165
  Compact label for status, category, or metadata.
@@ -1227,6 +1236,7 @@ Hierarchical navigation aid that shows users their current location within the p
1227
1236
 
1228
1237
  **Storybook-slug:** button
1229
1238
  **Docs-slug:** button
1239
+ **Full guidance:** [button.md](./src/components/ui/core/button/button.md)
1230
1240
 
1231
1241
  **Definition**
1232
1242
  Primary control for discrete actions.
@@ -1299,6 +1309,7 @@ A structural container with optional header, body, and footer slots for displayi
1299
1309
 
1300
1310
  **Storybook-slug:** checkbox
1301
1311
  **Docs-slug:** checkbox
1312
+ **Full guidance:** [checkbox.md](./src/components/ui/core/checkbox/checkbox.md)
1302
1313
 
1303
1314
  **Definition**
1304
1315
  Enables users to independently select one or multiple options. Can appear standalone or within menus, tree views, tables, or cards.
@@ -2074,6 +2085,7 @@ Lightweight, auto-dismiss feedback for outcomes that do not need a blocking surf
2074
2085
 
2075
2086
  **Storybook-slug:** switch
2076
2087
  **Docs-slug:** switch
2088
+ **Full guidance:** [switch.md](./src/components/ui/core/switch/switch.md)
2077
2089
 
2078
2090
  **Definition**
2079
2091
  A binary toggle control that turns a setting on or off, with changes taking effect immediately.
@@ -0,0 +1,2 @@
1
+ import type { ReactElement } from "react";
2
+ export declare function AlertGallery(): ReactElement;
@@ -0,0 +1,54 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Alert, AlertDescription, AlertTitle } from "./alert.js";
3
+ export function AlertGallery() {
4
+ return /*#__PURE__*/ _jsxs("div", {
5
+ className: "w-100 space-y-4",
6
+ children: [
7
+ /*#__PURE__*/ _jsxs(Alert, {
8
+ children: [
9
+ /*#__PURE__*/ _jsx(AlertTitle, {
10
+ children: "Default Alert"
11
+ }),
12
+ /*#__PURE__*/ _jsx(AlertDescription, {
13
+ children: "This is the default alert style."
14
+ })
15
+ ]
16
+ }),
17
+ /*#__PURE__*/ _jsxs(Alert, {
18
+ variant: "info",
19
+ children: [
20
+ /*#__PURE__*/ _jsx(AlertTitle, {
21
+ children: "Info Alert"
22
+ }),
23
+ /*#__PURE__*/ _jsx(AlertDescription, {
24
+ children: "This is the info alert style."
25
+ })
26
+ ]
27
+ }),
28
+ /*#__PURE__*/ _jsxs(Alert, {
29
+ variant: "warning",
30
+ children: [
31
+ /*#__PURE__*/ _jsx(AlertTitle, {
32
+ children: "Warning Alert"
33
+ }),
34
+ /*#__PURE__*/ _jsx(AlertDescription, {
35
+ children: "This is the warning alert style."
36
+ })
37
+ ]
38
+ }),
39
+ /*#__PURE__*/ _jsxs(Alert, {
40
+ variant: "error",
41
+ children: [
42
+ /*#__PURE__*/ _jsx(AlertTitle, {
43
+ children: "Error Alert"
44
+ }),
45
+ /*#__PURE__*/ _jsx(AlertDescription, {
46
+ children: "This is the error alert style."
47
+ })
48
+ ]
49
+ })
50
+ ]
51
+ });
52
+ }
53
+
54
+ //# sourceMappingURL=alert.gallery.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../src/components/ui/core/alert/alert.gallery.tsx"],"sourcesContent":["import type { ReactElement } from 'react';\n\nimport { Alert, AlertDescription, AlertTitle } from './alert';\n\nexport function AlertGallery(): ReactElement {\n return (\n <div className=\"w-100 space-y-4\">\n <Alert>\n <AlertTitle>Default Alert</AlertTitle>\n <AlertDescription>This is the default alert style.</AlertDescription>\n </Alert>\n <Alert variant=\"info\">\n <AlertTitle>Info Alert</AlertTitle>\n <AlertDescription>This is the info alert style.</AlertDescription>\n </Alert>\n <Alert variant=\"warning\">\n <AlertTitle>Warning Alert</AlertTitle>\n <AlertDescription>This is the warning alert style.</AlertDescription>\n </Alert>\n <Alert variant=\"error\">\n <AlertTitle>Error Alert</AlertTitle>\n <AlertDescription>This is the error alert style.</AlertDescription>\n </Alert>\n </div>\n );\n}\n"],"names":["Alert","AlertDescription","AlertTitle","AlertGallery","div","className","variant"],"mappings":";AAEA,SAASA,KAAK,EAAEC,gBAAgB,EAAEC,UAAU,QAAQ,aAAU;AAE9D,OAAO,SAASC;IACd,qBACE,MAACC;QAAIC,WAAU;;0BACb,MAACL;;kCACC,KAACE;kCAAW;;kCACZ,KAACD;kCAAiB;;;;0BAEpB,MAACD;gBAAMM,SAAQ;;kCACb,KAACJ;kCAAW;;kCACZ,KAACD;kCAAiB;;;;0BAEpB,MAACD;gBAAMM,SAAQ;;kCACb,KAACJ;kCAAW;;kCACZ,KAACD;kCAAiB;;;;0BAEpB,MAACD;gBAAMM,SAAQ;;kCACb,KAACJ;kCAAW;;kCACZ,KAACD;kCAAiB;;;;;;AAI1B"}
@@ -0,0 +1,2 @@
1
+ import type { ReactElement } from "react";
2
+ export declare function AvatarGallery(): ReactElement;
@@ -0,0 +1,67 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Avatar, AvatarFallback } from "./avatar.js";
3
+ export function AvatarGallery() {
4
+ return /*#__PURE__*/ _jsxs("div", {
5
+ className: "flex flex-wrap gap-4",
6
+ children: [
7
+ /*#__PURE__*/ _jsx(Avatar, {
8
+ variant: "decorative-1",
9
+ "aria-label": "Mountain decorative avatar",
10
+ children: /*#__PURE__*/ _jsx(AvatarFallback, {
11
+ children: "PJ"
12
+ })
13
+ }),
14
+ /*#__PURE__*/ _jsx(Avatar, {
15
+ variant: "decorative-2",
16
+ "aria-label": "Fjord decorative avatar",
17
+ children: /*#__PURE__*/ _jsx(AvatarFallback, {
18
+ children: "PJ"
19
+ })
20
+ }),
21
+ /*#__PURE__*/ _jsx(Avatar, {
22
+ variant: "decorative-3",
23
+ "aria-label": "Nordic decorative avatar",
24
+ children: /*#__PURE__*/ _jsx(AvatarFallback, {
25
+ children: "PJ"
26
+ })
27
+ }),
28
+ /*#__PURE__*/ _jsx(Avatar, {
29
+ variant: "decorative-4",
30
+ "aria-label": "Aurora decorative avatar",
31
+ children: /*#__PURE__*/ _jsx(AvatarFallback, {
32
+ children: "PJ"
33
+ })
34
+ }),
35
+ /*#__PURE__*/ _jsx(Avatar, {
36
+ variant: "decorative-5",
37
+ "aria-label": "Dusk decorative avatar",
38
+ children: /*#__PURE__*/ _jsx(AvatarFallback, {
39
+ children: "PJ"
40
+ })
41
+ }),
42
+ /*#__PURE__*/ _jsx(Avatar, {
43
+ variant: "decorative-6",
44
+ "aria-label": "Amber decorative avatar",
45
+ children: /*#__PURE__*/ _jsx(AvatarFallback, {
46
+ children: "PJ"
47
+ })
48
+ }),
49
+ /*#__PURE__*/ _jsx(Avatar, {
50
+ variant: "decorative-7",
51
+ "aria-label": "Pink decorative avatar",
52
+ children: /*#__PURE__*/ _jsx(AvatarFallback, {
53
+ children: "PJ"
54
+ })
55
+ }),
56
+ /*#__PURE__*/ _jsx(Avatar, {
57
+ variant: "overflow",
58
+ "aria-label": "Overflow colorway avatar",
59
+ children: /*#__PURE__*/ _jsx(AvatarFallback, {
60
+ children: "+4"
61
+ })
62
+ })
63
+ ]
64
+ });
65
+ }
66
+
67
+ //# sourceMappingURL=avatar.gallery.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../src/components/ui/core/avatar/avatar.gallery.tsx"],"sourcesContent":["import type { ReactElement } from 'react';\n\nimport { Avatar, AvatarFallback } from './avatar';\n\nexport function AvatarGallery(): ReactElement {\n return (\n <div className=\"flex flex-wrap gap-4\">\n <Avatar variant=\"decorative-1\" aria-label=\"Mountain decorative avatar\">\n <AvatarFallback>PJ</AvatarFallback>\n </Avatar>\n <Avatar variant=\"decorative-2\" aria-label=\"Fjord decorative avatar\">\n <AvatarFallback>PJ</AvatarFallback>\n </Avatar>\n <Avatar variant=\"decorative-3\" aria-label=\"Nordic decorative avatar\">\n <AvatarFallback>PJ</AvatarFallback>\n </Avatar>\n <Avatar variant=\"decorative-4\" aria-label=\"Aurora decorative avatar\">\n <AvatarFallback>PJ</AvatarFallback>\n </Avatar>\n <Avatar variant=\"decorative-5\" aria-label=\"Dusk decorative avatar\">\n <AvatarFallback>PJ</AvatarFallback>\n </Avatar>\n <Avatar variant=\"decorative-6\" aria-label=\"Amber decorative avatar\">\n <AvatarFallback>PJ</AvatarFallback>\n </Avatar>\n <Avatar variant=\"decorative-7\" aria-label=\"Pink decorative avatar\">\n <AvatarFallback>PJ</AvatarFallback>\n </Avatar>\n <Avatar variant=\"overflow\" aria-label=\"Overflow colorway avatar\">\n <AvatarFallback>+4</AvatarFallback>\n </Avatar>\n </div>\n );\n}\n"],"names":["Avatar","AvatarFallback","AvatarGallery","div","className","variant","aria-label"],"mappings":";AAEA,SAASA,MAAM,EAAEC,cAAc,QAAQ,cAAW;AAElD,OAAO,SAASC;IACd,qBACE,MAACC;QAAIC,WAAU;;0BACb,KAACJ;gBAAOK,SAAQ;gBAAeC,cAAW;0BACxC,cAAA,KAACL;8BAAe;;;0BAElB,KAACD;gBAAOK,SAAQ;gBAAeC,cAAW;0BACxC,cAAA,KAACL;8BAAe;;;0BAElB,KAACD;gBAAOK,SAAQ;gBAAeC,cAAW;0BACxC,cAAA,KAACL;8BAAe;;;0BAElB,KAACD;gBAAOK,SAAQ;gBAAeC,cAAW;0BACxC,cAAA,KAACL;8BAAe;;;0BAElB,KAACD;gBAAOK,SAAQ;gBAAeC,cAAW;0BACxC,cAAA,KAACL;8BAAe;;;0BAElB,KAACD;gBAAOK,SAAQ;gBAAeC,cAAW;0BACxC,cAAA,KAACL;8BAAe;;;0BAElB,KAACD;gBAAOK,SAAQ;gBAAeC,cAAW;0BACxC,cAAA,KAACL;8BAAe;;;0BAElB,KAACD;gBAAOK,SAAQ;gBAAWC,cAAW;0BACpC,cAAA,KAACL;8BAAe;;;;;AAIxB"}
@@ -0,0 +1,2 @@
1
+ import type { ReactElement } from "react";
2
+ export declare function BadgeGallery(): ReactElement;
@@ -0,0 +1,64 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { IconAlertTriangle, IconArchive, IconCircleCheck, IconHexagon, IconInnerShadowTopLeft } from "@tabler/icons-react";
3
+ import { Badge } from "./badge.js";
4
+ export function BadgeGallery() {
5
+ return /*#__PURE__*/ _jsxs("div", {
6
+ className: "flex max-w-120 flex-wrap justify-center gap-2",
7
+ children: [
8
+ /*#__PURE__*/ _jsx(Badge, {
9
+ variant: "decorative-1",
10
+ children: "Decorative 1"
11
+ }),
12
+ /*#__PURE__*/ _jsx(Badge, {
13
+ variant: "decorative-3",
14
+ children: "Decorative 3"
15
+ }),
16
+ /*#__PURE__*/ _jsx(Badge, {
17
+ variant: "decorative-5",
18
+ children: "Decorative 5"
19
+ }),
20
+ /*#__PURE__*/ _jsxs(Badge, {
21
+ variant: "inProgress",
22
+ children: [
23
+ /*#__PURE__*/ _jsx(IconInnerShadowTopLeft, {}),
24
+ "In progress"
25
+ ]
26
+ }),
27
+ /*#__PURE__*/ _jsxs(Badge, {
28
+ variant: "success",
29
+ children: [
30
+ /*#__PURE__*/ _jsx(IconCircleCheck, {}),
31
+ "Success"
32
+ ]
33
+ }),
34
+ /*#__PURE__*/ _jsxs(Badge, {
35
+ variant: "warning",
36
+ children: [
37
+ /*#__PURE__*/ _jsx(IconAlertTriangle, {}),
38
+ "Warning"
39
+ ]
40
+ }),
41
+ /*#__PURE__*/ _jsxs(Badge, {
42
+ variant: "error",
43
+ children: [
44
+ /*#__PURE__*/ _jsx(IconHexagon, {}),
45
+ "Error"
46
+ ]
47
+ }),
48
+ /*#__PURE__*/ _jsxs(Badge, {
49
+ variant: "archived",
50
+ children: [
51
+ /*#__PURE__*/ _jsx(IconArchive, {}),
52
+ "Archived"
53
+ ]
54
+ }),
55
+ /*#__PURE__*/ _jsx(Badge, {
56
+ variant: "secondary",
57
+ dot: true,
58
+ children: "12"
59
+ })
60
+ ]
61
+ });
62
+ }
63
+
64
+ //# sourceMappingURL=badge.gallery.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../src/components/ui/core/badge/badge.gallery.tsx"],"sourcesContent":["import type { ReactElement } from 'react';\n\nimport {\n IconAlertTriangle,\n IconArchive,\n IconCircleCheck,\n IconHexagon,\n IconInnerShadowTopLeft,\n} from '@tabler/icons-react';\n\nimport { Badge } from './badge';\n\nexport function BadgeGallery(): ReactElement {\n return (\n <div className=\"flex max-w-120 flex-wrap justify-center gap-2\">\n <Badge variant=\"decorative-1\">Decorative 1</Badge>\n <Badge variant=\"decorative-3\">Decorative 3</Badge>\n <Badge variant=\"decorative-5\">Decorative 5</Badge>\n <Badge variant=\"inProgress\">\n <IconInnerShadowTopLeft />\n In progress\n </Badge>\n <Badge variant=\"success\">\n <IconCircleCheck />\n Success\n </Badge>\n <Badge variant=\"warning\">\n <IconAlertTriangle />\n Warning\n </Badge>\n <Badge variant=\"error\">\n <IconHexagon />\n Error\n </Badge>\n <Badge variant=\"archived\">\n <IconArchive />\n Archived\n </Badge>\n <Badge variant=\"secondary\" dot>\n 12\n </Badge>\n </div>\n );\n}\n"],"names":["IconAlertTriangle","IconArchive","IconCircleCheck","IconHexagon","IconInnerShadowTopLeft","Badge","BadgeGallery","div","className","variant","dot"],"mappings":";AAEA,SACEA,iBAAiB,EACjBC,WAAW,EACXC,eAAe,EACfC,WAAW,EACXC,sBAAsB,QACjB,sBAAsB;AAE7B,SAASC,KAAK,QAAQ,aAAU;AAEhC,OAAO,SAASC;IACd,qBACE,MAACC;QAAIC,WAAU;;0BACb,KAACH;gBAAMI,SAAQ;0BAAe;;0BAC9B,KAACJ;gBAAMI,SAAQ;0BAAe;;0BAC9B,KAACJ;gBAAMI,SAAQ;0BAAe;;0BAC9B,MAACJ;gBAAMI,SAAQ;;kCACb,KAACL;oBAAyB;;;0BAG5B,MAACC;gBAAMI,SAAQ;;kCACb,KAACP;oBAAkB;;;0BAGrB,MAACG;gBAAMI,SAAQ;;kCACb,KAACT;oBAAoB;;;0BAGvB,MAACK;gBAAMI,SAAQ;;kCACb,KAACN;oBAAc;;;0BAGjB,MAACE;gBAAMI,SAAQ;;kCACb,KAACR;oBAAc;;;0BAGjB,KAACI;gBAAMI,SAAQ;gBAAYC,GAAG;0BAAC;;;;AAKrC"}
@@ -0,0 +1,2 @@
1
+ import type { ReactElement } from "react";
2
+ export declare function CheckboxGallery(): ReactElement;
@@ -0,0 +1,36 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { CheckboxGroup, CheckboxItem, CheckboxItemControl, CheckboxItemLabel } from "./checkbox.js";
3
+ export function CheckboxGallery() {
4
+ return /*#__PURE__*/ _jsxs(CheckboxGroup, {
5
+ children: [
6
+ /*#__PURE__*/ _jsxs(CheckboxItem, {
7
+ children: [
8
+ /*#__PURE__*/ _jsx(CheckboxItemControl, {
9
+ defaultChecked: true
10
+ }),
11
+ /*#__PURE__*/ _jsx(CheckboxItemLabel, {
12
+ children: "Option 1"
13
+ })
14
+ ]
15
+ }),
16
+ /*#__PURE__*/ _jsxs(CheckboxItem, {
17
+ children: [
18
+ /*#__PURE__*/ _jsx(CheckboxItemControl, {}),
19
+ /*#__PURE__*/ _jsx(CheckboxItemLabel, {
20
+ children: "Option 2"
21
+ })
22
+ ]
23
+ }),
24
+ /*#__PURE__*/ _jsxs(CheckboxItem, {
25
+ children: [
26
+ /*#__PURE__*/ _jsx(CheckboxItemControl, {}),
27
+ /*#__PURE__*/ _jsx(CheckboxItemLabel, {
28
+ children: "Option 3"
29
+ })
30
+ ]
31
+ })
32
+ ]
33
+ });
34
+ }
35
+
36
+ //# sourceMappingURL=checkbox.gallery.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../src/components/ui/core/checkbox/checkbox.gallery.tsx"],"sourcesContent":["import type { ReactElement } from 'react';\n\nimport {\n CheckboxGroup,\n CheckboxItem,\n CheckboxItemControl,\n CheckboxItemLabel,\n} from './checkbox';\n\nexport function CheckboxGallery(): ReactElement {\n return (\n <CheckboxGroup>\n <CheckboxItem>\n <CheckboxItemControl defaultChecked />\n <CheckboxItemLabel>Option 1</CheckboxItemLabel>\n </CheckboxItem>\n <CheckboxItem>\n <CheckboxItemControl />\n <CheckboxItemLabel>Option 2</CheckboxItemLabel>\n </CheckboxItem>\n <CheckboxItem>\n <CheckboxItemControl />\n <CheckboxItemLabel>Option 3</CheckboxItemLabel>\n </CheckboxItem>\n </CheckboxGroup>\n );\n}\n"],"names":["CheckboxGroup","CheckboxItem","CheckboxItemControl","CheckboxItemLabel","CheckboxGallery","defaultChecked"],"mappings":";AAEA,SACEA,aAAa,EACbC,YAAY,EACZC,mBAAmB,EACnBC,iBAAiB,QACZ,gBAAa;AAEpB,OAAO,SAASC;IACd,qBACE,MAACJ;;0BACC,MAACC;;kCACC,KAACC;wBAAoBG,cAAc;;kCACnC,KAACF;kCAAkB;;;;0BAErB,MAACF;;kCACC,KAACC;kCACD,KAACC;kCAAkB;;;;0BAErB,MAACF;;kCACC,KAACC;kCACD,KAACC;kCAAkB;;;;;;AAI3B"}
@@ -1,4 +1,30 @@
1
+ import dayjs from "dayjs";
2
+ import { getDateTimeDisplayFormat } from "../date-time-pickers/utils/format-utils.js";
1
3
  const PINNED_COLUMN_Z_INDEX = 10;
4
+ // Only pulls the year/month/day for the calendar check below, plus whether a `T`
5
+ // time section is present at all — everything inside that section (seconds, offset,
6
+ // shape) is validated by `Date` itself instead of being re-modeled here.
7
+ const ISO_DATE_PATTERN = /^(\d{4})-(\d{2})-(\d{2})(T.*)?$/;
8
+ const DATE_DISPLAY_FORMAT = 'DD/MM/YYYY';
9
+ /** Built with a placeholder year (2000) then `setFullYear`, since `Date(year, ...)`
10
+ * remaps any year 0-99 into 1900-1999 (e.g. "0029" → 1929). */ function isRealCalendarDate(year, month, day) {
11
+ const date = new Date(2000, month - 1, day);
12
+ date.setFullYear(year);
13
+ return date.getMonth() === month - 1 && date.getDate() === day;
14
+ }
15
+ /**
16
+ * API responses serialize dates as ISO strings; without this, cells would show
17
+ * "2026-04-11T14:30:00Z" verbatim.
18
+ */ function formatIsoDateString(value) {
19
+ const match = ISO_DATE_PATTERN.exec(value);
20
+ if (match === null) return undefined;
21
+ const [, year, month, day, time] = match;
22
+ if (!isRealCalendarDate(Number(year), Number(month), Number(day))) return undefined;
23
+ // `Date`'s own ISO 8601 parser rejects a bad time, offset, or shape — the
24
+ // regex above only needs to isolate the date-only vs. datetime distinction.
25
+ if (Number.isNaN(new Date(value).getTime())) return undefined;
26
+ return dayjs(value).format(time ? getDateTimeDisplayFormat() : DATE_DISPLAY_FORMAT);
27
+ }
2
28
  function getAriaSort(sortDirection, canSort) {
3
29
  if (sortDirection === 'asc') return 'ascending';
4
30
  if (sortDirection === 'desc') return 'descending';
@@ -7,6 +33,7 @@ function getAriaSort(sortDirection, canSort) {
7
33
  function getTextValue(value) {
8
34
  if (value === null || value === undefined) return undefined;
9
35
  if (value instanceof Date) return value.toLocaleString();
36
+ if (typeof value === 'string') return formatIsoDateString(value) ?? value;
10
37
  if (typeof value === 'object' || typeof value === 'function') return undefined;
11
38
  return String(value);
12
39
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/components/ui/core/data-grid/data-grid.utils.ts"],"sourcesContent":["import type { ColumnDef } from '@tanstack/react-table';\n\nconst PINNED_COLUMN_Z_INDEX = 10;\n\nfunction getAriaSort(\n sortDirection: false | 'asc' | 'desc',\n canSort: boolean\n): 'ascending' | 'descending' | 'none' | undefined {\n if (sortDirection === 'asc') return 'ascending';\n if (sortDirection === 'desc') return 'descending';\n return canSort ? 'none' : undefined;\n}\n\nfunction getTextValue(value: unknown): string | undefined {\n if (value === null || value === undefined) return undefined;\n if (value instanceof Date) return value.toLocaleString();\n if (typeof value === 'object' || typeof value === 'function')\n return undefined;\n return String(value);\n}\n\nfunction isAccessorColumn<TData>(def: ColumnDef<TData>): boolean {\n const hasAccessorKey = 'accessorKey' in def && def.accessorKey !== undefined;\n const hasAccessorFn = 'accessorFn' in def && def.accessorFn !== undefined;\n return hasAccessorKey || hasAccessorFn;\n}\n\nfunction isFromIgnoredCellTarget(target?: EventTarget | null): boolean {\n return target instanceof Element\n ? Boolean(target.closest('[data-row-activation=\"ignore\"]'))\n : false;\n}\n\nfunction isFromExpandToggleTarget(target?: EventTarget | null): boolean {\n return target instanceof Element\n ? Boolean(target.closest('[data-row-expand-toggle=\"true\"]'))\n : false;\n}\n\nexport {\n PINNED_COLUMN_Z_INDEX,\n getAriaSort,\n getTextValue,\n isAccessorColumn,\n isFromExpandToggleTarget,\n isFromIgnoredCellTarget,\n};\n"],"names":["PINNED_COLUMN_Z_INDEX","getAriaSort","sortDirection","canSort","undefined","getTextValue","value","Date","toLocaleString","String","isAccessorColumn","def","hasAccessorKey","accessorKey","hasAccessorFn","accessorFn","isFromIgnoredCellTarget","target","Element","Boolean","closest","isFromExpandToggleTarget"],"mappings":"AAEA,MAAMA,wBAAwB;AAE9B,SAASC,YACPC,aAAqC,EACrCC,OAAgB;IAEhB,IAAID,kBAAkB,OAAO,OAAO;IACpC,IAAIA,kBAAkB,QAAQ,OAAO;IACrC,OAAOC,UAAU,SAASC;AAC5B;AAEA,SAASC,aAAaC,KAAc;IAClC,IAAIA,UAAU,QAAQA,UAAUF,WAAW,OAAOA;IAClD,IAAIE,iBAAiBC,MAAM,OAAOD,MAAME,cAAc;IACtD,IAAI,OAAOF,UAAU,YAAY,OAAOA,UAAU,YAChD,OAAOF;IACT,OAAOK,OAAOH;AAChB;AAEA,SAASI,iBAAwBC,GAAqB;IACpD,MAAMC,iBAAiB,iBAAiBD,OAAOA,IAAIE,WAAW,KAAKT;IACnE,MAAMU,gBAAgB,gBAAgBH,OAAOA,IAAII,UAAU,KAAKX;IAChE,OAAOQ,kBAAkBE;AAC3B;AAEA,SAASE,wBAAwBC,MAA2B;IAC1D,OAAOA,kBAAkBC,UACrBC,QAAQF,OAAOG,OAAO,CAAC,qCACvB;AACN;AAEA,SAASC,yBAAyBJ,MAA2B;IAC3D,OAAOA,kBAAkBC,UACrBC,QAAQF,OAAOG,OAAO,CAAC,sCACvB;AACN;AAEA,SACEpB,qBAAqB,EACrBC,WAAW,EACXI,YAAY,EACZK,gBAAgB,EAChBW,wBAAwB,EACxBL,uBAAuB,GACvB"}
1
+ {"version":3,"sources":["../../../../../src/components/ui/core/data-grid/data-grid.utils.ts"],"sourcesContent":["import type { ColumnDef } from '@tanstack/react-table';\nimport dayjs from 'dayjs';\n\nimport { getDateTimeDisplayFormat } from '../date-time-pickers/utils/format-utils';\n\nconst PINNED_COLUMN_Z_INDEX = 10;\n\n// Only pulls the year/month/day for the calendar check below, plus whether a `T`\n// time section is present at all — everything inside that section (seconds, offset,\n// shape) is validated by `Date` itself instead of being re-modeled here.\nconst ISO_DATE_PATTERN = /^(\\d{4})-(\\d{2})-(\\d{2})(T.*)?$/;\n\nconst DATE_DISPLAY_FORMAT = 'DD/MM/YYYY';\n\n/** Built with a placeholder year (2000) then `setFullYear`, since `Date(year, ...)`\n * remaps any year 0-99 into 1900-1999 (e.g. \"0029\" → 1929). */\nfunction isRealCalendarDate(year: number, month: number, day: number): boolean {\n const date = new Date(2000, month - 1, day);\n date.setFullYear(year);\n return date.getMonth() === month - 1 && date.getDate() === day;\n}\n\n/**\n * API responses serialize dates as ISO strings; without this, cells would show\n * \"2026-04-11T14:30:00Z\" verbatim.\n */\nfunction formatIsoDateString(value: string): string | undefined {\n const match = ISO_DATE_PATTERN.exec(value);\n if (match === null) return undefined;\n\n const [, year, month, day, time] = match;\n if (!isRealCalendarDate(Number(year), Number(month), Number(day)))\n return undefined;\n // `Date`'s own ISO 8601 parser rejects a bad time, offset, or shape — the\n // regex above only needs to isolate the date-only vs. datetime distinction.\n if (Number.isNaN(new Date(value).getTime())) return undefined;\n\n return dayjs(value).format(\n time ? getDateTimeDisplayFormat() : DATE_DISPLAY_FORMAT\n );\n}\n\nfunction getAriaSort(\n sortDirection: false | 'asc' | 'desc',\n canSort: boolean\n): 'ascending' | 'descending' | 'none' | undefined {\n if (sortDirection === 'asc') return 'ascending';\n if (sortDirection === 'desc') return 'descending';\n return canSort ? 'none' : undefined;\n}\n\nfunction getTextValue(value: unknown): string | undefined {\n if (value === null || value === undefined) return undefined;\n if (value instanceof Date) return value.toLocaleString();\n if (typeof value === 'string') return formatIsoDateString(value) ?? value;\n if (typeof value === 'object' || typeof value === 'function')\n return undefined;\n return String(value);\n}\n\nfunction isAccessorColumn<TData>(def: ColumnDef<TData>): boolean {\n const hasAccessorKey = 'accessorKey' in def && def.accessorKey !== undefined;\n const hasAccessorFn = 'accessorFn' in def && def.accessorFn !== undefined;\n return hasAccessorKey || hasAccessorFn;\n}\n\nfunction isFromIgnoredCellTarget(target?: EventTarget | null): boolean {\n return target instanceof Element\n ? Boolean(target.closest('[data-row-activation=\"ignore\"]'))\n : false;\n}\n\nfunction isFromExpandToggleTarget(target?: EventTarget | null): boolean {\n return target instanceof Element\n ? Boolean(target.closest('[data-row-expand-toggle=\"true\"]'))\n : false;\n}\n\nexport {\n PINNED_COLUMN_Z_INDEX,\n getAriaSort,\n getTextValue,\n isAccessorColumn,\n isFromExpandToggleTarget,\n isFromIgnoredCellTarget,\n};\n"],"names":["dayjs","getDateTimeDisplayFormat","PINNED_COLUMN_Z_INDEX","ISO_DATE_PATTERN","DATE_DISPLAY_FORMAT","isRealCalendarDate","year","month","day","date","Date","setFullYear","getMonth","getDate","formatIsoDateString","value","match","exec","undefined","time","Number","isNaN","getTime","format","getAriaSort","sortDirection","canSort","getTextValue","toLocaleString","String","isAccessorColumn","def","hasAccessorKey","accessorKey","hasAccessorFn","accessorFn","isFromIgnoredCellTarget","target","Element","Boolean","closest","isFromExpandToggleTarget"],"mappings":"AACA,OAAOA,WAAW,QAAQ;AAE1B,SAASC,wBAAwB,QAAQ,6CAA0C;AAEnF,MAAMC,wBAAwB;AAE9B,iFAAiF;AACjF,oFAAoF;AACpF,yEAAyE;AACzE,MAAMC,mBAAmB;AAEzB,MAAMC,sBAAsB;AAE5B;8DAC8D,GAC9D,SAASC,mBAAmBC,IAAY,EAAEC,KAAa,EAAEC,GAAW;IAClE,MAAMC,OAAO,IAAIC,KAAK,MAAMH,QAAQ,GAAGC;IACvCC,KAAKE,WAAW,CAACL;IACjB,OAAOG,KAAKG,QAAQ,OAAOL,QAAQ,KAAKE,KAAKI,OAAO,OAAOL;AAC7D;AAEA;;;CAGC,GACD,SAASM,oBAAoBC,KAAa;IACxC,MAAMC,QAAQb,iBAAiBc,IAAI,CAACF;IACpC,IAAIC,UAAU,MAAM,OAAOE;IAE3B,MAAM,GAAGZ,MAAMC,OAAOC,KAAKW,KAAK,GAAGH;IACnC,IAAI,CAACX,mBAAmBe,OAAOd,OAAOc,OAAOb,QAAQa,OAAOZ,OAC1D,OAAOU;IACT,0EAA0E;IAC1E,4EAA4E;IAC5E,IAAIE,OAAOC,KAAK,CAAC,IAAIX,KAAKK,OAAOO,OAAO,KAAK,OAAOJ;IAEpD,OAAOlB,MAAMe,OAAOQ,MAAM,CACxBJ,OAAOlB,6BAA6BG;AAExC;AAEA,SAASoB,YACPC,aAAqC,EACrCC,OAAgB;IAEhB,IAAID,kBAAkB,OAAO,OAAO;IACpC,IAAIA,kBAAkB,QAAQ,OAAO;IACrC,OAAOC,UAAU,SAASR;AAC5B;AAEA,SAASS,aAAaZ,KAAc;IAClC,IAAIA,UAAU,QAAQA,UAAUG,WAAW,OAAOA;IAClD,IAAIH,iBAAiBL,MAAM,OAAOK,MAAMa,cAAc;IACtD,IAAI,OAAOb,UAAU,UAAU,OAAOD,oBAAoBC,UAAUA;IACpE,IAAI,OAAOA,UAAU,YAAY,OAAOA,UAAU,YAChD,OAAOG;IACT,OAAOW,OAAOd;AAChB;AAEA,SAASe,iBAAwBC,GAAqB;IACpD,MAAMC,iBAAiB,iBAAiBD,OAAOA,IAAIE,WAAW,KAAKf;IACnE,MAAMgB,gBAAgB,gBAAgBH,OAAOA,IAAII,UAAU,KAAKjB;IAChE,OAAOc,kBAAkBE;AAC3B;AAEA,SAASE,wBAAwBC,MAA2B;IAC1D,OAAOA,kBAAkBC,UACrBC,QAAQF,OAAOG,OAAO,CAAC,qCACvB;AACN;AAEA,SAASC,yBAAyBJ,MAA2B;IAC3D,OAAOA,kBAAkBC,UACrBC,QAAQF,OAAOG,OAAO,CAAC,sCACvB;AACN;AAEA,SACEtC,qBAAqB,EACrBsB,WAAW,EACXG,YAAY,EACZG,gBAAgB,EAChBW,wBAAwB,EACxBL,uBAAuB,GACvB"}
@@ -0,0 +1,2 @@
1
+ import type { ReactElement } from "react";
2
+ export declare function SwitchGallery(): ReactElement;
@@ -0,0 +1,67 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Label } from "../label/label.js";
3
+ import { Switch } from "./switch.js";
4
+ export function SwitchGallery() {
5
+ return /*#__PURE__*/ _jsxs("div", {
6
+ className: "flex w-48 flex-col items-start",
7
+ children: [
8
+ /*#__PURE__*/ _jsxs("div", {
9
+ className: "flex h-9 w-full items-center gap-3",
10
+ children: [
11
+ /*#__PURE__*/ _jsx(Label, {
12
+ htmlFor: "default-email",
13
+ className: "flex-1 pb-0",
14
+ children: "Email"
15
+ }),
16
+ /*#__PURE__*/ _jsx(Switch, {
17
+ id: "default-email",
18
+ defaultChecked: true
19
+ })
20
+ ]
21
+ }),
22
+ /*#__PURE__*/ _jsxs("div", {
23
+ className: "flex h-9 w-full items-center gap-3",
24
+ children: [
25
+ /*#__PURE__*/ _jsx(Label, {
26
+ htmlFor: "default-slack",
27
+ className: "flex-1 pb-0",
28
+ children: "Slack"
29
+ }),
30
+ /*#__PURE__*/ _jsx(Switch, {
31
+ id: "default-slack"
32
+ })
33
+ ]
34
+ }),
35
+ /*#__PURE__*/ _jsxs("div", {
36
+ className: "flex h-9 w-full items-center gap-3",
37
+ children: [
38
+ /*#__PURE__*/ _jsx(Label, {
39
+ htmlFor: "default-in-app",
40
+ className: "flex-1 pb-0",
41
+ children: "In app"
42
+ }),
43
+ /*#__PURE__*/ _jsx(Switch, {
44
+ id: "default-in-app",
45
+ defaultChecked: true
46
+ })
47
+ ]
48
+ }),
49
+ /*#__PURE__*/ _jsxs("div", {
50
+ className: "flex h-9 w-full items-center gap-3",
51
+ children: [
52
+ /*#__PURE__*/ _jsx(Label, {
53
+ htmlFor: "default-sms",
54
+ className: "flex-1 pb-0",
55
+ children: "SMS"
56
+ }),
57
+ /*#__PURE__*/ _jsx(Switch, {
58
+ id: "default-sms",
59
+ disabled: true
60
+ })
61
+ ]
62
+ })
63
+ ]
64
+ });
65
+ }
66
+
67
+ //# sourceMappingURL=switch.gallery.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../src/components/ui/core/switch/switch.gallery.tsx"],"sourcesContent":["import type { ReactElement } from 'react';\n\nimport { Label } from '../label/label';\n\nimport { Switch } from './switch';\n\nexport function SwitchGallery(): ReactElement {\n return (\n <div className=\"flex w-48 flex-col items-start\">\n <div className=\"flex h-9 w-full items-center gap-3\">\n <Label htmlFor=\"default-email\" className=\"flex-1 pb-0\">\n Email\n </Label>\n <Switch id=\"default-email\" defaultChecked />\n </div>\n <div className=\"flex h-9 w-full items-center gap-3\">\n <Label htmlFor=\"default-slack\" className=\"flex-1 pb-0\">\n Slack\n </Label>\n <Switch id=\"default-slack\" />\n </div>\n <div className=\"flex h-9 w-full items-center gap-3\">\n <Label htmlFor=\"default-in-app\" className=\"flex-1 pb-0\">\n In app\n </Label>\n <Switch id=\"default-in-app\" defaultChecked />\n </div>\n <div className=\"flex h-9 w-full items-center gap-3\">\n <Label htmlFor=\"default-sms\" className=\"flex-1 pb-0\">\n SMS\n </Label>\n <Switch id=\"default-sms\" disabled />\n </div>\n </div>\n );\n}\n"],"names":["Label","Switch","SwitchGallery","div","className","htmlFor","id","defaultChecked","disabled"],"mappings":";AAEA,SAASA,KAAK,QAAQ,oBAAiB;AAEvC,SAASC,MAAM,QAAQ,cAAW;AAElC,OAAO,SAASC;IACd,qBACE,MAACC;QAAIC,WAAU;;0BACb,MAACD;gBAAIC,WAAU;;kCACb,KAACJ;wBAAMK,SAAQ;wBAAgBD,WAAU;kCAAc;;kCAGvD,KAACH;wBAAOK,IAAG;wBAAgBC,cAAc;;;;0BAE3C,MAACJ;gBAAIC,WAAU;;kCACb,KAACJ;wBAAMK,SAAQ;wBAAgBD,WAAU;kCAAc;;kCAGvD,KAACH;wBAAOK,IAAG;;;;0BAEb,MAACH;gBAAIC,WAAU;;kCACb,KAACJ;wBAAMK,SAAQ;wBAAiBD,WAAU;kCAAc;;kCAGxD,KAACH;wBAAOK,IAAG;wBAAiBC,cAAc;;;;0BAE5C,MAACJ;gBAAIC,WAAU;;kCACb,KAACJ;wBAAMK,SAAQ;wBAAcD,WAAU;kCAAc;;kCAGrD,KAACH;wBAAOK,IAAG;wBAAcE,QAAQ;;;;;;AAIzC"}