@navikt/ds-react 5.3.1 → 5.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/_docs.json CHANGED
@@ -5450,7 +5450,7 @@
5450
5450
  },
5451
5451
  {
5452
5452
  "filePath": "src/list/ListItem.tsx",
5453
- "displayName": "ListItem",
5453
+ "displayName": "List.Item",
5454
5454
  "props": {
5455
5455
  "children": {
5456
5456
  "defaultValue": null,
@@ -7112,6 +7112,27 @@
7112
7112
  "name": "string | number"
7113
7113
  }
7114
7114
  },
7115
+ "as": {
7116
+ "defaultValue": {
7117
+ "value": "\"div\""
7118
+ },
7119
+ "description": "Overrides html-tag",
7120
+ "name": "as",
7121
+ "parent": {
7122
+ "fileName": "src/skeleton/Skeleton.tsx",
7123
+ "name": "SkeletonProps"
7124
+ },
7125
+ "declarations": [
7126
+ {
7127
+ "fileName": "src/skeleton/Skeleton.tsx",
7128
+ "name": "SkeletonProps"
7129
+ }
7130
+ ],
7131
+ "required": false,
7132
+ "type": {
7133
+ "name": "\"div\" | \"span\""
7134
+ }
7135
+ },
7115
7136
  "className": {
7116
7137
  "defaultValue": null,
7117
7138
  "description": "",
@@ -16785,6 +16806,25 @@
16785
16806
  "name": "ResponsiveProp<SpacingScale>"
16786
16807
  }
16787
16808
  },
16809
+ "align": {
16810
+ "defaultValue": null,
16811
+ "description": "Vertical alignment of children. Elements will by default stretch to the height of parent-element.",
16812
+ "name": "align",
16813
+ "parent": {
16814
+ "fileName": "src/layout/grid/HGrid.tsx",
16815
+ "name": "HGridProps"
16816
+ },
16817
+ "declarations": [
16818
+ {
16819
+ "fileName": "src/layout/grid/HGrid.tsx",
16820
+ "name": "HGridProps"
16821
+ }
16822
+ ],
16823
+ "required": false,
16824
+ "type": {
16825
+ "name": "\"start\" | \"center\" | \"end\""
16826
+ }
16827
+ },
16788
16828
  "className": {
16789
16829
  "defaultValue": null,
16790
16830
  "description": "",
@@ -18000,7 +18040,7 @@
18000
18040
  },
18001
18041
  {
18002
18042
  "filePath": "src/dropdown/Menu/List/index.tsx",
18003
- "displayName": "List",
18043
+ "displayName": "Dropdown.Menu.List",
18004
18044
  "props": {
18005
18045
  "children": {
18006
18046
  "defaultValue": null,
@@ -38,8 +38,8 @@ const context_1 = require("../context");
38
38
  const utils_1 = require("../utils");
39
39
  const disableMonth = (month, fromDate, toDate) => {
40
40
  if (fromDate && toDate) {
41
- return ((0, isSameMonth_1.default)(month, fromDate) && (0, isSameYear_1.default)(month, fromDate))
42
- || ((0, isSameMonth_1.default)(month, toDate) && (0, isSameYear_1.default)(month, toDate));
41
+ return (((0, isSameMonth_1.default)(month, fromDate) && (0, isSameYear_1.default)(month, fromDate)) ||
42
+ ((0, isSameMonth_1.default)(month, toDate) && (0, isSameYear_1.default)(month, toDate)));
43
43
  }
44
44
  else if (fromDate) {
45
45
  return (0, isSameMonth_1.default)(month, fromDate) && (0, isSameYear_1.default)(month, fromDate);
@@ -46,4 +46,5 @@ exports.List = (0, react_1.forwardRef)((_a, ref) => {
46
46
  return (react_1.default.createElement("ul", Object.assign({}, rest, { ref: ref, className: (0, clsx_1.default)("navds-dropdown__list", className) }), children));
47
47
  });
48
48
  exports.List.Item = Item_1.default;
49
+ exports.List.displayName = "Dropdown.Menu.List";
49
50
  exports.default = exports.List;
@@ -67,8 +67,8 @@ const css_1 = require("../utilities/css");
67
67
  * </HGrid>
68
68
  */
69
69
  exports.HGrid = (0, react_1.forwardRef)((_a, ref) => {
70
- var { className, columns, gap, style } = _a, rest = __rest(_a, ["className", "columns", "gap", "style"]);
71
- const styles = Object.assign(Object.assign(Object.assign({}, style), (0, css_1.getResponsiveProps)(`hgrid`, "gap", "spacing", gap)), (0, css_1.getResponsiveValue)(`hgrid`, "columns", formatGrid(columns)));
70
+ var { className, columns, gap, style, align } = _a, rest = __rest(_a, ["className", "columns", "gap", "style", "align"]);
71
+ const styles = Object.assign(Object.assign(Object.assign(Object.assign({}, style), { "--__ac-hgrid-align": align }), (0, css_1.getResponsiveProps)(`hgrid`, "gap", "spacing", gap)), (0, css_1.getResponsiveValue)(`hgrid`, "columns", formatGrid(columns)));
72
72
  return (react_1.default.createElement("div", Object.assign({}, rest, { ref: ref, className: (0, clsx_1.default)("navds-hgrid", className), style: styles })));
73
73
  });
74
74
  function formatGrid(props) {
@@ -58,4 +58,5 @@ exports.ListItem = (0, react_1.forwardRef)((_a, ref) => {
58
58
  title && (react_1.default.createElement(typography_1.Label, { as: "p", size: size }, title)),
59
59
  children)));
60
60
  });
61
+ exports.ListItem.displayName = "List.Item";
61
62
  exports.default = exports.ListItem;
@@ -50,8 +50,8 @@ const clsx_1 = __importDefault(require("clsx"));
50
50
  * ```
51
51
  */
52
52
  exports.Skeleton = (0, react_1.forwardRef)((_a, ref) => {
53
- var { className, children, height, width, style, variant = "text" } = _a, rest = __rest(_a, ["className", "children", "height", "width", "style", "variant"]);
54
- return (react_1.default.createElement("div", Object.assign({}, rest, { ref: ref, className: (0, clsx_1.default)("navds-skeleton", className, `navds-skeleton--${variant}`, {
53
+ var { className, children, height, width, style, variant = "text", as: As = "div" } = _a, rest = __rest(_a, ["className", "children", "height", "width", "style", "variant", "as"]);
54
+ return (react_1.default.createElement(As, Object.assign({}, rest, { ref: ref, className: (0, clsx_1.default)("navds-skeleton", className, `navds-skeleton--${variant}`, {
55
55
  "navds-skeleton--has-children": Boolean(children),
56
56
  "navds-skeleton--no-height": !height,
57
57
  "navds-skeleton--no-width": !width,
@@ -9,8 +9,8 @@ import { useSharedMonthContext } from "../context";
9
9
  import { dateIsInCurrentMonth, isMatch, nextEnabled } from "../utils";
10
10
  const disableMonth = (month, fromDate, toDate) => {
11
11
  if (fromDate && toDate) {
12
- return (isSameMonth(month, fromDate) && isSameYear(month, fromDate))
13
- || (isSameMonth(month, toDate) && isSameYear(month, toDate));
12
+ return ((isSameMonth(month, fromDate) && isSameYear(month, fromDate)) ||
13
+ (isSameMonth(month, toDate) && isSameYear(month, toDate)));
14
14
  }
15
15
  else if (fromDate) {
16
16
  return isSameMonth(month, fromDate) && isSameYear(month, fromDate);
@@ -1 +1 @@
1
- {"version":3,"file":"MonthButton.js","sourceRoot":"","sources":["../../../src/date/monthpicker/MonthButton.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,MAAM,CAAC;AACtB,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,WAAW,MAAM,sBAAsB,CAAC;AAC/C,OAAO,UAAU,MAAO,qBAAqB,CAAC;AAC9C,OAAO,OAAO,MAAM,kBAAkB,CAAC;AACvC,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AACnD,OAAO,EAAE,oBAAoB,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAWtE,MAAM,YAAY,GAAG,CAAC,KAAW,EAAE,QAAe,EAAE,MAAa,EAAE,EAAE;IACnE,IAAI,QAAQ,IAAI,MAAM,EAAE;QACtB,OAAO,CAAC,WAAW,CAAC,KAAK,EAAE,QAAQ,CAAC,IAAI,UAAU,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;eACjE,CAAC,WAAW,CAAC,KAAK,EAAE,MAAM,CAAC,IAAI,UAAU,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,CAAA;KAC7D;SAAM,IAAI,QAAQ,EAAE;QACnB,OAAO,WAAW,CAAC,KAAK,EAAE,QAAQ,CAAC,IAAI,UAAU,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAA;KACnE;SAAM,IAAI,MAAM,EAAE;QACjB,OAAO,WAAW,CAAC,KAAK,EAAE,MAAM,CAAC,IAAI,UAAU,CAAC,KAAK,EAAE,MAAM,CAAC,CAAA;KAC/D;IACD,OAAO,KAAK,CAAC;AACf,CAAC,CAAC;AAEF,MAAM,CAAC,MA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,EACR,MAAM,CACP,CAAC;YACF,QAAQ,CAAC,IAAI,CAAC,CAAC;YACf,UAAU,CAAC,IAAI,CAAC,CAAC;QACnB,CAAC,EACD,OAAO,EAAE,GAAG,EAAE;YACZ,UAAU,CAAC,KAAK,CAAC,CAAC;QACpB,CAAC;QAED,6CAAkB,MAAM,IACrB,MAAM,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,EAAE,KAAK,EAAE,EAAE,MAAM,EAAE,CAAC;aACxC,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC;aAChB,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,CACb;QACP,8BAAM,SAAS,EAAC,eAAe,IAC5B,MAAM,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,EAAE,MAAM,EAAE,EAAE,MAAM,EAAE,CAAC,CACvC,CACA,CACV,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,WAAW,CAAC"}
@@ -17,5 +17,6 @@ export const List = forwardRef((_a, ref) => {
17
17
  return (React.createElement("ul", Object.assign({}, rest, { ref: ref, className: cl("navds-dropdown__list", className) }), children));
18
18
  });
19
19
  List.Item = ListItem;
20
+ List.displayName = "Dropdown.Menu.List";
20
21
  export default List;
21
22
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/dropdown/Menu/List/index.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,EAAE,MAAM,MAAM,CAAC;AACtB,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAE1C,OAAO,QAA2B,MAAM,QAAQ,CAAC;AAoBjD,MAAM,CAAC,MAAM,IAAI,GAAG,UAAU,CAAC,CAAC,EAAgC,EAAE,GAAG,EAAE,EAAE;QAAzC,EAAE,SAAS,EAAE,QAAQ,OAAW,EAAN,IAAI,cAA9B,yBAAgC,CAAF;IAAY,OAAA,CACxE,4CAAQ,IAAI,IAAE,GAAG,EAAE,GAAG,EAAE,SAAS,EAAE,EAAE,CAAC,sBAAsB,EAAE,SAAS,CAAC,KACrE,QAAQ,CACN,CACN,CAAA;CAAA,CAAa,CAAC;AAEf,IAAI,CAAC,IAAI,GAAG,QAAQ,CAAC;AAErB,eAAe,IAAI,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/dropdown/Menu/List/index.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,EAAE,MAAM,MAAM,CAAC;AACtB,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAE1C,OAAO,QAA2B,MAAM,QAAQ,CAAC;AAoBjD,MAAM,CAAC,MAAM,IAAI,GAAG,UAAU,CAAC,CAAC,EAAgC,EAAE,GAAG,EAAE,EAAE;QAAzC,EAAE,SAAS,EAAE,QAAQ,OAAW,EAAN,IAAI,cAA9B,yBAAgC,CAAF;IAAY,OAAA,CACxE,4CAAQ,IAAI,IAAE,GAAG,EAAE,GAAG,EAAE,SAAS,EAAE,EAAE,CAAC,sBAAsB,EAAE,SAAS,CAAC,KACrE,QAAQ,CACN,CACN,CAAA;CAAA,CAAa,CAAC;AAEf,IAAI,CAAC,IAAI,GAAG,QAAQ,CAAC;AACrB,IAAI,CAAC,WAAW,GAAG,oBAAoB,CAAC;AACxC,eAAe,IAAI,CAAC"}
@@ -19,6 +19,10 @@ export interface HGridProps extends HTMLAttributes<HTMLDivElement> {
19
19
  * gap={{ sm: "2", md: "2", lg: "6", xl: "6"}}
20
20
  */
21
21
  gap?: ResponsiveProp<SpacingScale>;
22
+ /**
23
+ * Vertical alignment of children. Elements will by default stretch to the height of parent-element.
24
+ */
25
+ align?: "start" | "center" | "end";
22
26
  }
23
27
  /**
24
28
  * Horizontal Grid Primitive with dynamic columns and gap based on breakpoints.
@@ -38,8 +38,8 @@ import { getResponsiveProps, getResponsiveValue, } from "../utilities/css";
38
38
  * </HGrid>
39
39
  */
40
40
  export const HGrid = forwardRef((_a, ref) => {
41
- var { className, columns, gap, style } = _a, rest = __rest(_a, ["className", "columns", "gap", "style"]);
42
- const styles = Object.assign(Object.assign(Object.assign({}, style), getResponsiveProps(`hgrid`, "gap", "spacing", gap)), getResponsiveValue(`hgrid`, "columns", formatGrid(columns)));
41
+ var { className, columns, gap, style, align } = _a, rest = __rest(_a, ["className", "columns", "gap", "style", "align"]);
42
+ const styles = Object.assign(Object.assign(Object.assign(Object.assign({}, style), { "--__ac-hgrid-align": align }), getResponsiveProps(`hgrid`, "gap", "spacing", gap)), getResponsiveValue(`hgrid`, "columns", formatGrid(columns)));
43
43
  return (React.createElement("div", Object.assign({}, rest, { ref: ref, className: cl("navds-hgrid", className), style: styles })));
44
44
  });
45
45
  function formatGrid(props) {
@@ -1 +1 @@
1
- {"version":3,"file":"HGrid.js","sourceRoot":"","sources":["../../../src/layout/grid/HGrid.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAkB,MAAM,OAAO,CAAC;AAC1D,OAAO,EAAE,MAAM,MAAM,CAAC;AACtB,OAAO,EACL,kBAAkB,EAClB,kBAAkB,GAGnB,MAAM,kBAAkB,CAAC;AAsB1B;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,CAAC,MAAM,KAAK,GAAG,UAAU,CAC7B,CAAC,EAA2C,EAAE,GAAG,EAAE,EAAE;QAApD,EAAE,SAAS,EAAE,OAAO,EAAE,GAAG,EAAE,KAAK,OAAW,EAAN,IAAI,cAAzC,wCAA2C,CAAF;IACxC,MAAM,MAAM,iDACP,KAAK,GACL,kBAAkB,CAAC,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,GAAG,CAAC,GAClD,kBAAkB,CAAC,OAAO,EAAE,SAAS,EAAE,UAAU,CAAC,OAAO,CAAC,CAAC,CAC/D,CAAC;IAEF,OAAO,CACL,6CACM,IAAI,IACR,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,EAAE,CAAC,aAAa,EAAE,SAAS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G,IAAI,EACX,GAAG,EACH,KAAK,EAAE,MAAM,EACb,SAAS,OAEV,EADI,IAAI,cATT,4EAUC,CADQ;IAIT,MAAM,KAAK,iDACN,MAAM,KACT,wBAAwB,EAAE,SAAS,EACnC,oBAAoB,EAAE,KAAK,EAC3B,sBAAsB,EAAE,OAAO,EAC/B,mBAAmB,EAAE,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,QAAQ,KAC1C,kBAAkB,CAAC,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,GAAG,CAAC,CACtD,CAAC;IAEF,OAAO,CACL,oBAAC,SAAS,oBACJ,IAAI,IACR,GAAG,EAAE,GAAG,EACR,KAAK,EAAE,KAAK,EACZ,SAAS,EAAE,EAAE,CAAC,aAAa,EAAE,SAAS,EAAE;YACtC,cAAc,EAAE,SAAS,KAAK,QAAQ;YACtC,cAAc,EAAE,SAAS,KAAK,KAAK;SACpC,CAAC,IACF,CACH,CAAC;AACJ,CAAC,CACF,CAAC"}
@@ -29,5 +29,6 @@ export const ListItem = forwardRef((_a, ref) => {
29
29
  title && (React.createElement(Label, { as: "p", size: size }, title)),
30
30
  children)));
31
31
  });
32
+ ListItem.displayName = "List.Item";
32
33
  export default ListItem;
33
34
  //# sourceMappingURL=ListItem.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ListItem.js","sourceRoot":"","sources":["../../src/list/ListItem.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,EAAE,MAAM,MAAM,CAAC;AACtB,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AAiBrC,MAAM,CAAC,MAAM,QAAQ,GAAG,UAAU,CAChC,CAAC,EAA6C,EAAE,GAAG,EAAE,EAAE;QAAtD,EAAE,SAAS,EAAE,QA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IAAC,EAAE,EAAC,KAAK,EAAC,IAAI,EAAE,IAAI,EAAE,SAAS,EAAC,0BAA0B;YACjE,KAAK,IAAI,CACR,oBAAC,KAAK,IAAC,EAAE,EAAC,GAAG,EAAC,IAAI,EAAE,IAAI,IACrB,KAAK,CACA,CACT;YACA,QAAQ,CACC,CACT,CACN,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,QAAQ,CAAC,WAAW,GAAG,WAAW,CAAC;AACnC,eAAe,QAAQ,CAAC"}
@@ -13,6 +13,11 @@ export interface SkeletonProps extends React.HTMLAttributes<HTMLDivElement> {
13
13
  * When not inferring width from children, you must specify width
14
14
  */
15
15
  width?: number | string;
16
+ /**
17
+ * Overrides html-tag
18
+ * @default "div"
19
+ */
20
+ as?: "div" | "span";
16
21
  }
17
22
  /**
18
23
  * Simple skeleton loader
@@ -21,8 +21,8 @@ import cl from "clsx";
21
21
  * ```
22
22
  */
23
23
  export const Skeleton = forwardRef((_a, ref) => {
24
- var { className, children, height, width, style, variant = "text" } = _a, rest = __rest(_a, ["className", "children", "height", "width", "style", "variant"]);
25
- return (React.createElement("div", Object.assign({}, rest, { ref: ref, className: cl("navds-skeleton", className, `navds-skeleton--${variant}`, {
24
+ var { className, children, height, width, style, variant = "text", as: As = "div" } = _a, rest = __rest(_a, ["className", "children", "height", "width", "style", "variant", "as"]);
25
+ return (React.createElement(As, Object.assign({}, rest, { ref: ref, className: cl("navds-skeleton", className, `navds-skeleton--${variant}`, {
26
26
  "navds-skeleton--has-children": Boolean(children),
27
27
  "navds-skeleton--no-height": !height,
28
28
  "navds-skeleton--no-width": !width,
@@ -1 +1 @@
1
- {"version":3,"file":"Skeleton.js","sourceRoot":"","sources":["../../src/skeleton/Skeleton.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAC1C,OAAO,EAAE,MAAM,MAAM,CAAC;AAkBtB;;;;;;;;GAQG;AACH,MAAM,CA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,EAAE,CAAC,MAAM;YACpC,0BAA0B,EAAE,CAAC,KAAK;SACnC,CACF,EACD,KAAK,kCAAO,KAAK,KAAE,KAAK,EAAE,MAAM,6BAG/B,QAAQ,CACN,CACN,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,QAAQ,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@navikt/ds-react",
3
- "version": "5.3.1",
3
+ "version": "5.3.3",
4
4
  "description": "Aksel react-components for NAV designsystem",
5
5
  "author": "Aksel | NAV designsystem team",
6
6
  "license": "MIT",
@@ -32,13 +32,13 @@
32
32
  "docgen": "yarn ts-node ../../../scripts/docgen.ts",
33
33
  "create-package-json-pointers-to-esm": "node ../../../scripts/createPackageJsonsWithESMPointers.js",
34
34
  "clean": "rimraf cjs esm",
35
- "build": "concurrently \"tsc\" \"tsc -p tsconfig.esm.json\" && yarn create-package-json-pointers-to-esm",
35
+ "build": "concurrently \"tsc -p tsconfig.build.json\" \"tsc -p tsconfig.esm.json\" && yarn create-package-json-pointers-to-esm",
36
36
  "watch": "tsc --watch -p tsconfig.esm.json",
37
37
  "test": "TZ=UTC jest"
38
38
  },
39
39
  "dependencies": {
40
40
  "@floating-ui/react": "0.24.1",
41
- "@navikt/aksel-icons": "^5.3.1",
41
+ "@navikt/aksel-icons": "^5.3.3",
42
42
  "@radix-ui/react-tabs": "1.0.0",
43
43
  "@radix-ui/react-toggle-group": "1.0.0",
44
44
  "clsx": "^1.2.1",
@@ -1,6 +1,6 @@
1
1
  import type { Meta, StoryObj } from "@storybook/react";
2
2
  import React from "react";
3
- import { Alert } from ".";
3
+ import { Alert, AlertProps } from ".";
4
4
  import { BodyLong, Heading as DsHeading, Link } from "..";
5
5
  import { within, userEvent } from "@storybook/testing-library";
6
6
  import { expect } from "@storybook/jest";
@@ -14,7 +14,7 @@ export default meta;
14
14
 
15
15
  type Story = StoryObj<typeof Alert>;
16
16
 
17
- const variants: Array<"error" | "warning" | "info" | "success"> = [
17
+ const variants: AlertProps["variant"][] = [
18
18
  "error",
19
19
  "warning",
20
20
  "info",
@@ -33,24 +33,17 @@ export const Default: Story = {
33
33
  },
34
34
  argTypes: {
35
35
  variant: {
36
- control: {
37
- type: "radio",
38
- },
36
+ control: { type: "radio" },
39
37
  options: ["info", "error", "warning", "success"],
40
38
  },
41
39
  size: {
42
- control: {
43
- type: "radio",
44
- },
40
+ control: { type: "radio" },
45
41
  options: ["medium", "small"],
46
42
  },
47
- closeButton: {
48
- type: "boolean",
49
- },
50
43
  },
51
44
  };
52
45
 
53
- export const Small = {
46
+ export const Small: Story = {
54
47
  render: (props) => {
55
48
  return (
56
49
  <div className="colgap">
@@ -69,14 +62,10 @@ export const Small = {
69
62
  </div>
70
63
  );
71
64
  },
65
+
72
66
  args: {
73
67
  closeButton: false,
74
68
  },
75
- argtypes: {
76
- closeButton: {
77
- type: "boolean",
78
- },
79
- },
80
69
  };
81
70
 
82
71
  export const FullWidth = () => {
@@ -163,13 +152,11 @@ export const Links = () => {
163
152
  const AlertWithCloseButton = ({ children }: { children?: React.ReactNode }) => {
164
153
  let [show, setShow] = React.useState(true);
165
154
 
166
- return (
167
- show && (
168
- <Alert variant="success" closeButton onClose={() => setShow(false)}>
169
- {children || "Content"}
170
- </Alert>
171
- )
172
- );
155
+ return show ? (
156
+ <Alert variant="success" closeButton onClose={() => setShow(false)}>
157
+ {children || "Content"}
158
+ </Alert>
159
+ ) : null;
173
160
  };
174
161
 
175
162
  export const WithCloseButton: Story = {
@@ -1,7 +1,7 @@
1
1
  import cl from "clsx";
2
2
  import format from "date-fns/format";
3
3
  import isSameMonth from "date-fns/isSameMonth";
4
- import isSameYear from "date-fns/isSameYear";
4
+ import isSameYear from "date-fns/isSameYear";
5
5
  import setYear from "date-fns/setYear";
6
6
  import React, { useEffect, useRef } from "react";
7
7
  import { useDayPicker } from "react-day-picker";
@@ -19,12 +19,14 @@ interface MonthType {
19
19
 
20
20
  const disableMonth = (month: Date, fromDate?: Date, toDate?: Date) => {
21
21
  if (fromDate && toDate) {
22
- return (isSameMonth(month, fromDate) && isSameYear(month, fromDate))
23
- || (isSameMonth(month, toDate) && isSameYear(month, toDate))
22
+ return (
23
+ (isSameMonth(month, fromDate) && isSameYear(month, fromDate)) ||
24
+ (isSameMonth(month, toDate) && isSameYear(month, toDate))
25
+ );
24
26
  } else if (fromDate) {
25
- return isSameMonth(month, fromDate) && isSameYear(month, fromDate)
27
+ return isSameMonth(month, fromDate) && isSameYear(month, fromDate);
26
28
  } else if (toDate) {
27
- return isSameMonth(month, toDate) && isSameYear(month, toDate)
29
+ return isSameMonth(month, toDate) && isSameYear(month, toDate);
28
30
  }
29
31
  return false;
30
32
  };
@@ -28,5 +28,5 @@ export const List = forwardRef(({ className, children, ...rest }, ref) => (
28
28
  )) as ListType;
29
29
 
30
30
  List.Item = ListItem;
31
-
31
+ List.displayName = "Dropdown.Menu.List";
32
32
  export default List;
@@ -1,26 +1,18 @@
1
1
  /* eslint-disable react-hooks/rules-of-hooks */
2
- import { Meta } from "@storybook/react";
2
+ import { Meta, StoryFn, StoryObj } from "@storybook/react";
3
3
  import React, { useState, useId, useMemo } from "react";
4
4
  import { userEvent, within } from "@storybook/testing-library";
5
- import { Chips, UNSAFE_Combobox, TextField } from "../../index";
5
+ import { Chips, UNSAFE_Combobox, ComboboxProps, TextField } from "../../index";
6
6
  import { expect, jest } from "@storybook/jest";
7
7
 
8
8
  export default {
9
9
  title: "ds-react/Combobox",
10
10
  component: UNSAFE_Combobox,
11
- argTypes: {
12
- isListOpen: {
13
- control: {
14
- type: "boolean",
15
- },
16
- },
17
- isLoading: {
18
- control: {
19
- type: "boolean",
20
- },
21
- },
22
- },
23
- } as Meta;
11
+ decorators: [(story) => <div style={{ width: "300px" }}>{story()}</div>],
12
+ } satisfies Meta<typeof UNSAFE_Combobox>;
13
+
14
+ type StoryObject = StoryObj<typeof UNSAFE_Combobox>;
15
+ type StoryFunction = StoryFn<typeof UNSAFE_Combobox>;
24
16
 
25
17
  const options = [
26
18
  "banana",
@@ -38,55 +30,39 @@ const options = [
38
30
  "grape fruit",
39
31
  ];
40
32
 
41
- const initialSelectedOptions = ["passion fruit", "grape fruit"];
42
-
43
- const DemoContainer = ({
44
- dataTheme,
45
- children,
46
- }: {
47
- children: any;
48
- dataTheme: "dark" | "light";
49
- }) => (
50
- <div data-theme={dataTheme} style={{ width: "300px" }}>
51
- {children}
52
- </div>
53
- );
54
-
55
- export const Default = (props) => {
33
+ export const Default: StoryFunction = (props) => {
56
34
  const id = useId();
57
- return (
58
- <DemoContainer dataTheme={props.darkMode}>
59
- <UNSAFE_Combobox
60
- options={props.options}
61
- label="Hva er dine favorittfrukter?"
62
- /* everything under here is optional? */
63
- shouldAutocomplete={props.shouldAutoComplete}
64
- size="medium"
65
- id={id}
66
- />
67
- </DemoContainer>
68
- );
35
+ return <UNSAFE_Combobox {...props} id={id} />;
69
36
  };
70
-
71
37
  Default.args = {
72
38
  options,
73
- shouldAutoComplete: true,
39
+ label: "Hva er dine favorittfrukter?",
40
+ shouldAutocomplete: true,
41
+ isLoading: false,
42
+ };
43
+ Default.argTypes = {
44
+ isListOpen: {
45
+ control: { type: "boolean" },
46
+ },
47
+ size: {
48
+ options: ["medium", "small"],
49
+ defaultValue: "medium",
50
+ control: { type: "radio" },
51
+ },
74
52
  };
75
53
 
76
- export function MultiSelect(props) {
54
+ export const MultiSelect: StoryFunction = (props) => {
77
55
  const id = useId();
78
56
  return (
79
- <DemoContainer dataTheme={props.darkMode}>
80
- <UNSAFE_Combobox
81
- id={id}
82
- label="Komboboks - velg flere"
83
- options={props.options}
84
- isMultiSelect={props.isMultiSelect}
85
- size={props.size}
86
- />
87
- </DemoContainer>
57
+ <UNSAFE_Combobox
58
+ id={id}
59
+ label="Komboboks - velg flere"
60
+ options={props.options}
61
+ isMultiSelect={props.isMultiSelect}
62
+ size={props.size}
63
+ />
88
64
  );
89
- }
65
+ };
90
66
 
91
67
  MultiSelect.args = {
92
68
  options,
@@ -94,41 +70,37 @@ MultiSelect.args = {
94
70
  size: "medium",
95
71
  };
96
72
 
97
- export function WithAddNewOptions(props) {
73
+ export const WithAddNewOptions: StoryFunction = (props) => {
98
74
  const id = useId();
99
75
  return (
100
- <DemoContainer dataTheme={props.darkMode}>
101
- <UNSAFE_Combobox
102
- id={id}
103
- label="Komboboks med mulighet for å legge til nye verdier"
104
- options={props.options}
105
- allowNewValues={props.allowNewValues}
106
- shouldAutocomplete={props.shouldAutoComplete}
107
- />
108
- </DemoContainer>
76
+ <UNSAFE_Combobox
77
+ id={id}
78
+ label="Komboboks med mulighet for å legge til nye verdier"
79
+ options={props.options}
80
+ allowNewValues={props.allowNewValues}
81
+ shouldAutocomplete={props.shouldAutocomplete}
82
+ />
109
83
  );
110
- }
84
+ };
111
85
 
112
86
  WithAddNewOptions.args = {
113
87
  options,
114
88
  allowNewValues: true,
115
- shouldAutoComplete: true,
89
+ shouldAutocomplete: true,
116
90
  };
117
91
 
118
- export function MultiSelectWithAddNewOptions(props) {
92
+ export const MultiSelectWithAddNewOptions: StoryFunction = (props) => {
119
93
  const id = useId();
120
94
  return (
121
- <DemoContainer dataTheme={props.darkMode}>
122
- <UNSAFE_Combobox
123
- id={id}
124
- isMultiSelect={props.isMultiSelect}
125
- label="Multiselect komboboks med mulighet for å legge til nye verdier"
126
- options={props.options}
127
- allowNewValues={props.allowNewValues}
128
- />
129
- </DemoContainer>
95
+ <UNSAFE_Combobox
96
+ id={id}
97
+ isMultiSelect={props.isMultiSelect}
98
+ label="Multiselect komboboks med mulighet for å legge til nye verdier"
99
+ options={props.options}
100
+ allowNewValues={props.allowNewValues}
101
+ />
130
102
  );
131
- }
103
+ };
132
104
 
133
105
  MultiSelectWithAddNewOptions.args = {
134
106
  allowNewValues: true,
@@ -137,19 +109,20 @@ MultiSelectWithAddNewOptions.args = {
137
109
  shouldAutocomplete: false,
138
110
  };
139
111
 
140
- export const MultiSelectWithExternalChips = (props) => {
141
- const [selectedOptions, setSelectedOptions] = useState<string[]>(
142
- props.selectedOptions
143
- );
112
+ export const MultiSelectWithExternalChips: StoryFn<{
113
+ controlled: boolean;
114
+ options: ComboboxProps["options"];
115
+ }> = (props) => {
116
+ const [selectedOptions, setSelectedOptions] = useState<string[]>([]);
144
117
  const [value, setValue] = useState("");
145
118
  const id = useId();
146
119
 
147
- const toggleSelected = (option) =>
120
+ const toggleSelected = (option: string) =>
148
121
  selectedOptions.includes(option)
149
122
  ? setSelectedOptions(selectedOptions.filter((opt) => opt !== option))
150
123
  : setSelectedOptions([...selectedOptions, option]);
151
124
  return (
152
- <DemoContainer dataTheme={props.darkMode}>
125
+ <>
153
126
  {selectedOptions && (
154
127
  <Chips>
155
128
  {selectedOptions.map((option) => (
@@ -164,84 +137,85 @@ export const MultiSelectWithExternalChips = (props) => {
164
137
  </Chips>
165
138
  )}
166
139
  <UNSAFE_Combobox
167
- options={options}
140
+ options={props.options}
168
141
  selectedOptions={selectedOptions}
169
- onToggleSelected={(option: string) => toggleSelected(option)}
170
- isListOpen={props.isListOpen}
142
+ onToggleSelected={(option) => toggleSelected(option)}
171
143
  isMultiSelect
172
144
  value={props.controlled ? value : undefined}
173
145
  onChange={(event) =>
174
- props.controlled ? setValue(event.currentTarget.value) : undefined
146
+ props.controlled
147
+ ? setValue(event?.currentTarget.value || "")
148
+ : undefined
175
149
  }
176
150
  label="Komboboks"
177
151
  size="medium"
178
- error={props.error && "error here"}
179
152
  id={id}
180
153
  shouldShowSelectedOptions={false}
181
154
  />
182
- </DemoContainer>
155
+ </>
183
156
  );
184
157
  };
185
158
 
186
159
  MultiSelectWithExternalChips.args = {
187
160
  controlled: false,
188
161
  options,
189
- selectedOptions: [],
190
162
  };
191
163
 
192
- export function Loading(props) {
164
+ export const Loading: StoryFunction = (props) => {
193
165
  const id = useId();
194
166
  return (
195
- <DemoContainer dataTheme={props.darkMode}>
196
- <UNSAFE_Combobox
197
- id={id}
198
- label="Komboboks (laster)"
199
- options={[]}
200
- selectedOptions={[]}
201
- isListOpen={props.isListOpen}
202
- isLoading={props.isLoading}
203
- />
204
- </DemoContainer>
167
+ <UNSAFE_Combobox
168
+ id={id}
169
+ label="Komboboks (laster)"
170
+ options={[]}
171
+ selectedOptions={[]}
172
+ isListOpen={props.isListOpen}
173
+ isLoading={props.isLoading}
174
+ />
205
175
  );
206
- }
176
+ };
207
177
 
208
178
  Loading.args = {
209
179
  isLoading: true,
210
180
  isListOpen: true,
211
181
  };
212
182
 
213
- export function ComboboxWithNoHits(props) {
183
+ export const ComboboxWithNoHits: StoryFunction = (props) => {
214
184
  const id = useId();
215
185
  const [value, setValue] = useState(props.value);
216
186
  return (
217
- <DemoContainer dataTheme={props.darkMode}>
218
- <UNSAFE_Combobox
219
- id={id}
220
- label="Komboboks (uten søketreff)"
221
- options={props.options}
222
- value={value}
223
- onChange={(event) => setValue(event.currentTarget.value)}
224
- isListOpen={true}
225
- />
226
- </DemoContainer>
187
+ <UNSAFE_Combobox
188
+ id={id}
189
+ label="Komboboks (uten søketreff)"
190
+ options={props.options}
191
+ value={value}
192
+ onChange={(event) => setValue(event?.currentTarget.value)}
193
+ isListOpen={true}
194
+ />
227
195
  );
228
- }
196
+ };
229
197
 
230
198
  ComboboxWithNoHits.args = {
231
199
  options,
232
200
  value: "Orange",
233
201
  };
234
202
 
235
- export const Controlled = (props) => {
203
+ export const Controlled: StoryFn<{
204
+ value: string;
205
+ options: string[];
206
+ initialSelectedOptions: string[];
207
+ }> = (props) => {
236
208
  const id = useId();
237
209
  const [value, setValue] = useState(props.value);
238
- const [selectedOptions, setSelectedOptions] = useState(props.selectedOptions);
210
+ const [selectedOptions, setSelectedOptions] = useState(
211
+ props.initialSelectedOptions
212
+ );
239
213
  const filteredOptions = useMemo(
240
214
  () => props.options.filter((option) => option.includes(value)),
241
215
  [props.options, value]
242
216
  );
243
217
 
244
- const onToggleSelected = (option, isSelected) => {
218
+ const onToggleSelected = (option: string, isSelected: boolean) => {
245
219
  if (isSelected) {
246
220
  setSelectedOptions([...selectedOptions, option]);
247
221
  } else {
@@ -250,7 +224,7 @@ export const Controlled = (props) => {
250
224
  };
251
225
 
252
226
  return (
253
- <DemoContainer dataTheme={props.darkMode}>
227
+ <>
254
228
  <TextField
255
229
  label="Overstyr value"
256
230
  onChange={(event) => setValue(event.target.value)}
@@ -263,23 +237,23 @@ export const Controlled = (props) => {
263
237
  filteredOptions={filteredOptions}
264
238
  isMultiSelect
265
239
  options={props.options}
266
- onChange={(event) => setValue(event.target.value)}
240
+ onChange={(event) => setValue(event?.target.value || "")}
267
241
  onToggleSelected={onToggleSelected}
268
242
  selectedOptions={selectedOptions}
269
243
  value={value}
270
244
  />
271
- </DemoContainer>
245
+ </>
272
246
  );
273
247
  };
274
248
 
275
249
  Controlled.args = {
276
250
  value: "apple",
277
251
  options,
278
- selectedOptions: initialSelectedOptions,
252
+ initialSelectedOptions: ["passion fruit", "grape fruit"],
279
253
  };
280
254
 
281
- export const ComboboxSizes = (props) => (
282
- <DemoContainer dataTheme={props.darkMode}>
255
+ export const ComboboxSizes = () => (
256
+ <>
283
257
  <UNSAFE_Combobox
284
258
  label="Hva er dine favorittfrukter?"
285
259
  description="Medium single-select"
@@ -309,36 +283,29 @@ export const ComboboxSizes = (props) => (
309
283
  size="small"
310
284
  allowNewValues
311
285
  />
312
- </DemoContainer>
286
+ </>
313
287
  );
314
288
 
315
- ComboboxSizes.args = {
316
- options,
317
- };
318
-
319
- export const WithError = {
289
+ export const WithError: StoryObject = {
320
290
  args: {
321
291
  error: "Du må velge en favorittfrukt.",
322
- isLoading: true,
323
292
  },
324
293
  render: (props) => {
325
294
  const [hasSelectedValue, setHasSelectedValue] = useState(false);
326
295
  const [isLoading, setIsLoading] = useState(false);
327
296
  return (
328
- <DemoContainer dataTheme={props.darkMode}>
329
- <UNSAFE_Combobox
330
- filteredOptions={isLoading ? [] : undefined}
331
- options={options}
332
- label="Hva er dine favorittfrukter?"
333
- error={!hasSelectedValue && props.error}
334
- isLoading={isLoading}
335
- onChange={() => {
336
- setIsLoading(true);
337
- setTimeout(() => setIsLoading(false), 2000);
338
- }}
339
- onToggleSelected={(_, isSelected) => setHasSelectedValue(isSelected)}
340
- />
341
- </DemoContainer>
297
+ <UNSAFE_Combobox
298
+ filteredOptions={isLoading ? [] : undefined}
299
+ options={options}
300
+ label="Hva er dine favorittfrukter?"
301
+ error={!hasSelectedValue && props.error}
302
+ isLoading={isLoading}
303
+ onChange={() => {
304
+ setIsLoading(true);
305
+ setTimeout(() => setIsLoading(false), 2000);
306
+ }}
307
+ onToggleSelected={(_, isSelected) => setHasSelectedValue(isSelected)}
308
+ />
342
309
  );
343
310
  },
344
311
  };
@@ -347,15 +314,10 @@ function sleep(ms: number) {
347
314
  return new Promise((resolve) => setTimeout(resolve, ms));
348
315
  }
349
316
 
350
- export const CancelInputTest = {
351
- render: (props) => {
317
+ export const CancelInputTest: StoryObject = {
318
+ render: () => {
352
319
  return (
353
- <DemoContainer dataTheme={props.darkMode}>
354
- <UNSAFE_Combobox
355
- options={options}
356
- label="Hva er dine favorittfrukter?"
357
- />
358
- </DemoContainer>
320
+ <UNSAFE_Combobox options={options} label="Hva er dine favorittfrukter?" />
359
321
  );
360
322
  },
361
323
  play: async ({ canvasElement }) => {
@@ -378,16 +340,14 @@ export const CancelInputTest = {
378
340
  },
379
341
  };
380
342
 
381
- export const RemoveSelectedMultiSelectTest = {
382
- render: (props) => {
343
+ export const RemoveSelectedMultiSelectTest: StoryObject = {
344
+ render: () => {
383
345
  return (
384
- <DemoContainer dataTheme={props.darkMode}>
385
- <UNSAFE_Combobox
386
- options={options}
387
- label="Hva er dine favorittfrukter?"
388
- isMultiSelect
389
- />
390
- </DemoContainer>
346
+ <UNSAFE_Combobox
347
+ options={options}
348
+ label="Hva er dine favorittfrukter?"
349
+ isMultiSelect
350
+ />
391
351
  );
392
352
  },
393
353
  play: async ({ canvasElement }) => {
@@ -436,16 +396,14 @@ export const RemoveSelectedMultiSelectTest = {
436
396
  },
437
397
  };
438
398
 
439
- export const AddWhenAddNewDisabledTest = {
440
- render: (props) => {
399
+ export const AddWhenAddNewDisabledTest: StoryObject = {
400
+ render: () => {
441
401
  return (
442
- <DemoContainer dataTheme={props.darkMode}>
443
- <UNSAFE_Combobox
444
- options={options}
445
- label="Hva er dine favorittfrukter?"
446
- isMultiSelect
447
- />
448
- </DemoContainer>
402
+ <UNSAFE_Combobox
403
+ options={options}
404
+ label="Hva er dine favorittfrukter?"
405
+ isMultiSelect
406
+ />
449
407
  );
450
408
  },
451
409
  play: async ({ canvasElement }) => {
@@ -471,7 +429,11 @@ export const AddWhenAddNewDisabledTest = {
471
429
  },
472
430
  };
473
431
 
474
- export const TestThatCallbacksOnlyFireWhenExpected = {
432
+ export const TestThatCallbacksOnlyFireWhenExpected: StoryObj<{
433
+ onChange: ReturnType<typeof jest.fn>;
434
+ onClear: ReturnType<typeof jest.fn>;
435
+ onToggleSelected: ReturnType<typeof jest.fn>;
436
+ }> = {
475
437
  args: {
476
438
  onChange: jest.fn(),
477
439
  onClear: jest.fn(),
@@ -479,13 +441,11 @@ export const TestThatCallbacksOnlyFireWhenExpected = {
479
441
  },
480
442
  render: (props) => {
481
443
  return (
482
- <DemoContainer dataTheme={props.darkMode}>
483
- <UNSAFE_Combobox
484
- options={options}
485
- label="Hva er dine favorittfrukter?"
486
- {...props}
487
- />
488
- </DemoContainer>
444
+ <UNSAFE_Combobox
445
+ options={options}
446
+ label="Hva er dine favorittfrukter?"
447
+ {...props}
448
+ />
489
449
  );
490
450
  },
491
451
  play: async ({ canvasElement, args }) => {
@@ -510,16 +470,10 @@ export const TestThatCallbacksOnlyFireWhenExpected = {
510
470
  },
511
471
  };
512
472
 
513
- export const TestHoverAndFocusSwitching = {
514
- render: (props) => {
473
+ export const TestHoverAndFocusSwitching: StoryObject = {
474
+ render: () => {
515
475
  return (
516
- <DemoContainer dataTheme={props.darkMode}>
517
- <UNSAFE_Combobox
518
- options={options}
519
- label="Hva er dine favorittfrukter?"
520
- {...props}
521
- />
522
- </DemoContainer>
476
+ <UNSAFE_Combobox options={options} label="Hva er dine favorittfrukter?" />
523
477
  );
524
478
  },
525
479
  play: async ({ canvasElement }) => {
@@ -16,10 +16,10 @@ enim id.`;
16
16
  export const Default = {
17
17
  render: (props: { poster: boolean; colorOverride: boolean }) => {
18
18
  const style = props.colorOverride
19
- ? ({
19
+ ? {
20
20
  "--ac-guide-panel-illustration-bg": "var(--a-purple-200)",
21
21
  "--ac-guide-panel-border": "var(--a-purple-400)",
22
- } as React.CSSProperties)
22
+ }
23
23
  : {};
24
24
 
25
25
  return (
@@ -26,6 +26,10 @@ export interface HGridProps extends HTMLAttributes<HTMLDivElement> {
26
26
  * gap={{ sm: "2", md: "2", lg: "6", xl: "6"}}
27
27
  */
28
28
  gap?: ResponsiveProp<SpacingScale>;
29
+ /**
30
+ * Vertical alignment of children. Elements will by default stretch to the height of parent-element.
31
+ */
32
+ align?: "start" | "center" | "end";
29
33
  }
30
34
  /**
31
35
  * Horizontal Grid Primitive with dynamic columns and gap based on breakpoints.
@@ -53,9 +57,10 @@ export interface HGridProps extends HTMLAttributes<HTMLDivElement> {
53
57
  * </HGrid>
54
58
  */
55
59
  export const HGrid = forwardRef<HTMLDivElement, HGridProps>(
56
- ({ className, columns, gap, style, ...rest }, ref) => {
60
+ ({ className, columns, gap, style, align, ...rest }, ref) => {
57
61
  const styles: React.CSSProperties = {
58
62
  ...style,
63
+ "--__ac-hgrid-align": align,
59
64
  ...getResponsiveProps(`hgrid`, "gap", "spacing", gap),
60
65
  ...getResponsiveValue(`hgrid`, "columns", formatGrid(columns)),
61
66
  };
@@ -1,5 +1,6 @@
1
1
  import React from "react";
2
2
  import { HGrid } from ".";
3
+ import { VStack } from "../stack";
3
4
 
4
5
  const columnsVariants = {
5
6
  Number: "columnNumber",
@@ -86,12 +87,31 @@ export const DynamicColumns = {
86
87
  ),
87
88
  };
88
89
 
89
- function Placeholder({ text }) {
90
+ export const AlignItems = {
91
+ render: () => (
92
+ <VStack gap="8">
93
+ <HGrid gap="4" columns={2} align="start">
94
+ <Placeholder text="start" height="8rem" />
95
+ <Placeholder text="auto" height="auto" />
96
+ </HGrid>
97
+ <HGrid gap="4" columns={2} align="center">
98
+ <Placeholder text="center" height="8rem" />
99
+ <Placeholder text="auto" height="auto" />
100
+ </HGrid>
101
+ <HGrid gap="4" columns={2} align="end">
102
+ <Placeholder text="end" height="8rem" />
103
+ <Placeholder text="auto" height="auto" />
104
+ </HGrid>
105
+ </VStack>
106
+ ),
107
+ };
108
+
109
+ function Placeholder({ text, height }: { text: string; height?: string }) {
90
110
  return (
91
111
  <div
92
112
  style={{
93
113
  background: "var(--a-deepblue-900)",
94
- height: "5rem",
114
+ height: height ?? "5rem",
95
115
  width: "auto",
96
116
  color: "white",
97
117
  }}
@@ -52,14 +52,14 @@ export const Stack: OverridableComponent<StackProps, HTMLDivElement> =
52
52
  },
53
53
  ref
54
54
  ) => {
55
- const style = {
55
+ const style: React.CSSProperties = {
56
56
  ..._style,
57
57
  "--__ac-stack-direction": direction,
58
58
  "--__ac-stack-align": align,
59
59
  "--__ac-stack-justify": justify,
60
60
  "--__ac-stack-wrap": wrap ? "wrap" : "nowrap",
61
61
  ...getResponsiveProps(`stack`, "gap", "spacing", gap),
62
- } as React.CSSProperties;
62
+ };
63
63
 
64
64
  return (
65
65
  <Component
@@ -69,4 +69,5 @@ export const ListItem = forwardRef<HTMLLIElement, ListItemProps>(
69
69
  }
70
70
  );
71
71
 
72
+ ListItem.displayName = "List.Item";
72
73
  export default ListItem;
@@ -0,0 +1,9 @@
1
+ // eslint-disable-next-line react/no-typos
2
+ import "react";
3
+
4
+ declare module "react" {
5
+ interface CSSProperties {
6
+ [key: `--ac-${string}`]: string | undefined;
7
+ [key: `--__ac-${string}`]: string | undefined;
8
+ }
9
+ }
@@ -15,6 +15,11 @@ export interface SkeletonProps extends React.HTMLAttributes<HTMLDivElement> {
15
15
  * When not inferring width from children, you must specify width
16
16
  */
17
17
  width?: number | string;
18
+ /**
19
+ * Overrides html-tag
20
+ * @default "div"
21
+ */
22
+ as?: "div" | "span";
18
23
  }
19
24
 
20
25
  /**
@@ -28,11 +33,20 @@ export interface SkeletonProps extends React.HTMLAttributes<HTMLDivElement> {
28
33
  */
29
34
  export const Skeleton = forwardRef<HTMLDivElement, SkeletonProps>(
30
35
  (
31
- { className, children, height, width, style, variant = "text", ...rest },
36
+ {
37
+ className,
38
+ children,
39
+ height,
40
+ width,
41
+ style,
42
+ variant = "text",
43
+ as: As = "div",
44
+ ...rest
45
+ },
32
46
  ref
33
47
  ) => {
34
48
  return (
35
- <div
49
+ <As
36
50
  {...rest}
37
51
  ref={ref}
38
52
  className={cl(
@@ -49,7 +63,7 @@ export const Skeleton = forwardRef<HTMLDivElement, SkeletonProps>(
49
63
  aria-hidden
50
64
  >
51
65
  {children}
52
- </div>
66
+ </As>
53
67
  );
54
68
  }
55
69
  );
@@ -102,7 +102,7 @@ export const NativeText = {
102
102
  Lorem ipsum dolor sit amet, consectetur adipisicing elit. Consequuntur
103
103
  voluptas sint dolore omnis quia consequatur beatae vero cum officia
104
104
  debitis. Quidem debitis omnis reprehenderit nobis rerum. Nulla,
105
- magnam? Saepe, eveniet? Test
105
+ magnam? Saepe, eveniet?
106
106
  </Skeleton>
107
107
  </h1>
108
108
  <Skeleton>
@@ -110,9 +110,20 @@ export const NativeText = {
110
110
  Lorem ipsum dolor sit amet, consectetur adipisicing elit. Consequuntur
111
111
  voluptas sint dolore omnis quia consequatur beatae vero cum officia
112
112
  debitis. Quidem debitis omnis reprehenderit nobis rerum. Nulla,
113
- magnam? Saepe, eveniet? Test
113
+ magnam? Saepe, eveniet?
114
114
  </p>
115
115
  </Skeleton>
116
116
  </div>
117
117
  ),
118
118
  };
119
+
120
+ export const InlineText = {
121
+ render: () => (
122
+ <BodyLong>
123
+ Lorem ipsum dolor sit amet, consectetur adipisicing elit. Consequuntur
124
+ voluptas sint dolore <Skeleton as="span">omnis quia consequatur</Skeleton>{" "}
125
+ beatae vero cum officia debitis. Quidem debitis omnis reprehenderit nobis
126
+ rerum. Nulla, magnam? Saepe, eveniet?
127
+ </BodyLong>
128
+ ),
129
+ };
@@ -14,7 +14,7 @@ export default {
14
14
 
15
15
  const rowsPerPage = 10;
16
16
 
17
- const queryString = (obj) =>
17
+ const queryString = (obj: Record<string, number | string | undefined>) =>
18
18
  Object.keys(obj)
19
19
  .filter((key) => obj[key] !== undefined)
20
20
  .map((key) => key + "=" + obj[key])
@@ -22,11 +22,15 @@ const queryString = (obj) =>
22
22
 
23
23
  const updateData = async (url: string) => {
24
24
  const newUrl = new URL(`https://www.example.com/${url}`);
25
- const comparator = (a, b, orderBy) => {
26
- if (b[orderBy] < a[orderBy]) {
25
+ const comparator = (
26
+ a: Record<string, string | number | null>,
27
+ b: Record<string, string | number | null>,
28
+ orderBy: string
29
+ ) => {
30
+ if ((b[orderBy] ?? "") < (a[orderBy] ?? "")) {
27
31
  return -1;
28
32
  }
29
- if (b[orderBy] > a[orderBy]) {
33
+ if ((b[orderBy] ?? "") > (a[orderBy] ?? "")) {
30
34
  return 1;
31
35
  }
32
36
  return 0;
@@ -74,7 +78,14 @@ export const Async = () => {
74
78
 
75
79
  const { results: people, count } = data;
76
80
 
77
- const columns = [
81
+ type ColumnsType = {
82
+ key: keyof (typeof people)[0];
83
+ name: string;
84
+ width: number;
85
+ sortable?: boolean;
86
+ value?: (person: (typeof people)[0]) => string | undefined;
87
+ };
88
+ const columns: ColumnsType[] = [
78
89
  { key: "name", name: "Name", width: 154 },
79
90
  { key: "height", name: "Height", width: 108 },
80
91
  { key: "mass", name: "Mass", width: 95 },
@@ -105,7 +116,8 @@ export const Async = () => {
105
116
  sort={sort}
106
117
  onSortChange={(sortKey) =>
107
118
  setSort(
108
- sort?.orderBy === sortKey && sort.direction === "descending"
119
+ !sortKey ||
120
+ (sort?.orderBy === sortKey && sort.direction === "descending")
109
121
  ? undefined
110
122
  : {
111
123
  orderBy: sortKey,
@@ -144,7 +156,7 @@ export const Async = () => {
144
156
  whiteSpace: "nowrap",
145
157
  textOverflow: "ellipsis",
146
158
  }}
147
- title={person[key]}
159
+ title={person[key]?.toString()}
148
160
  key={key}
149
161
  >
150
162
  {value ? value(person) : person[key]}