@navikt/ds-react 0.16.8 → 0.16.9

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.
@@ -37,9 +37,10 @@ const react_1 = __importStar(require("react"));
37
37
  const classnames_1 = __importDefault(require("classnames"));
38
38
  const __1 = require("..");
39
39
  const RadixToggleGroup = __importStar(require("@radix-ui/react-toggle-group"));
40
+ const ToggleGroup_1 = require("./ToggleGroup");
40
41
  const ToggleItem = (0, react_1.forwardRef)((_a, ref) => {
41
42
  var { className, children } = _a, rest = __rest(_a, ["className", "children"]);
42
- const context = (0, react_1.useContext)(__1.ToggleGroupContext);
43
+ const context = (0, react_1.useContext)(ToggleGroup_1.ToggleGroupContext);
43
44
  return (react_1.default.createElement(RadixToggleGroup.Item, Object.assign({}, rest, { ref: ref, className: (0, classnames_1.default)("navds-toggle-group__button", className) }),
44
45
  react_1.default.createElement(__1.Label, { as: "span", className: "navds-toggle-group__button-inner", size: context === null || context === void 0 ? void 0 : context.size }, children)));
45
46
  });
@@ -1,14 +1,4 @@
1
1
  "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
- }) : (function(o, m, k, k2) {
6
- if (k2 === undefined) k2 = k;
7
- o[k2] = m[k];
8
- }));
9
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
10
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
11
- };
12
2
  var __importDefault = (this && this.__importDefault) || function (mod) {
13
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
14
4
  };
@@ -16,4 +6,3 @@ Object.defineProperty(exports, "__esModule", { value: true });
16
6
  exports.ToggleGroup = void 0;
17
7
  var ToggleGroup_1 = require("./ToggleGroup");
18
8
  Object.defineProperty(exports, "ToggleGroup", { enumerable: true, get: function () { return __importDefault(ToggleGroup_1).default; } });
19
- __exportStar(require("./ToggleGroup"), exports);
@@ -11,8 +11,9 @@ var __rest = (this && this.__rest) || function (s, e) {
11
11
  };
12
12
  import React, { forwardRef, useContext } from "react";
13
13
  import cl from "classnames";
14
- import { Label, ToggleGroupContext } from "..";
14
+ import { Label } from "..";
15
15
  import * as RadixToggleGroup from "@radix-ui/react-toggle-group";
16
+ import { ToggleGroupContext } from "./ToggleGroup";
16
17
  const ToggleItem = forwardRef((_a, ref) => {
17
18
  var { className, children } = _a, rest = __rest(_a, ["className", "children"]);
18
19
  const context = useContext(ToggleGroupContext);
@@ -1 +1 @@
1
- {"version":3,"file":"ToggleItem.js","sourceRoot":"","sources":["../../src/toggle-group/ToggleItem.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AACtD,OAAO,EAAE,MAAM,YAAY,CAAC;AAC5B,OAAO,EAAE,KAAK,EAAE,kBAAkB,EAAE,MAAM,IAAI,CAAC;AAC/C,OAAO,KAAK,gBAAgB,MAAM,8BAA8B,CAAC;AAkBjE,MAAM,UAAU,GAAG,UAAU,CAC3B,CAAC,EAAgC,EAAE,GAAG,EAAE,EAAE;QAAzC,EAAE,SAAS,EAAE,QAAQ,OAAW,EAAN,IAAI,cAA9B,yBAAgC,CAAF;IAC7B,MAAM,OAAO,GAAG,UAAU,CAAC,kBAAkB,CAAC,CAAC;IAE/C,OAAO,CACL,oBAAC,gBAAgB,CAAC,IAAI,oBAChB,IAAI,IACR,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,EAAE,CAAC,4BAA4B,EAAE,SAAS,CAAC;QAEtD,oBAAC,KAAK,IACJ,EAAE,EAAC,MAAM,EACT,SAAS,EAAC,kCAAkC,EAC5C,IAAI,EAAE,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,IAAI,IAElB,QAAQ,CACH,CACc,CACzB,CAAC;AACJ,CAAC,CACgB,CAAC;AAEpB,eAAe,UAAU,CAAC"}
1
+ {"version":3,"file":"ToggleItem.js","sourceRoot":"","sources":["../../src/toggle-group/ToggleItem.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AACtD,OAAO,EAAE,MAAM,YAAY,CAAC;AAC5B,OAAO,EAAE,KAAK,EAAE,MAAM,IAAI,CAAC;AAC3B,OAAO,KAAK,gBAAgB,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAkBnD,MAAM,UAAU,GAAG,UAAU,CAC3B,CAAC,EAAgC,EAAE,GAAG,EAAE,EAAE;QAAzC,EAAE,SAAS,EAAE,QAAQ,OAAW,EAAN,IAAI,cAA9B,yBAAgC,CAAF;IAC7B,MAAM,OAAO,GAAG,UAAU,CAAC,kBAAkB,CAAC,CAAC;IAE/C,OAAO,CACL,oBAAC,gBAAgB,CAAC,IAAI,oBAChB,IAAI,IACR,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,EAAE,CAAC,4BAA4B,EAAE,SAAS,CAAC;QAEtD,oBAAC,KAAK,IACJ,EAAE,EAAC,MAAM,EACT,SAAS,EAAC,kCAAkC,EAC5C,IAAI,EAAE,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,IAAI,IAElB,QAAQ,CACH,CACc,CACzB,CAAC;AACJ,CAAC,CACgB,CAAC;AAEpB,eAAe,UAAU,CAAC"}
@@ -1,2 +1,2 @@
1
1
  export { default as ToggleGroup } from "./ToggleGroup";
2
- export * from "./ToggleGroup";
2
+ export { ToggleGroupProps } from "./ToggleGroup";
@@ -1,3 +1,2 @@
1
1
  export { default as ToggleGroup } from "./ToggleGroup";
2
- export * from "./ToggleGroup";
3
2
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/toggle-group/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,eAAe,CAAC;AACvD,cAAc,eAAe,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/toggle-group/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,eAAe,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@navikt/ds-react",
3
- "version": "0.16.8",
3
+ "version": "0.16.9",
4
4
  "private": false,
5
5
  "description": "NAV designsystem react components",
6
6
  "author": "NAV Designsystem team",
@@ -65,5 +65,5 @@
65
65
  "@types/react": "^17.0.30",
66
66
  "react": "^17.0.0"
67
67
  },
68
- "gitHead": "cb429868c15db40ba7d29a639de2de3cd6ba72ce"
68
+ "gitHead": "8a58d75efbbfd6ae78d9a352aeacefb10617cf70"
69
69
  }
@@ -10,19 +10,43 @@ export default {
10
10
  },
11
11
  } as Meta;
12
12
 
13
- const Items = (icon?: boolean) => (
13
+ const Items = (icon?: boolean, both?: boolean) => (
14
14
  <>
15
15
  <ToggleGroup.Item value="first">
16
- {icon ? <Hamburger /> : "First"}
16
+ {both ? (
17
+ <>
18
+ <Hamburger /> First
19
+ </>
20
+ ) : (
21
+ <>{icon ? <Hamburger /> : "First"}</>
22
+ )}
17
23
  </ToggleGroup.Item>
18
24
  <ToggleGroup.Item value="second">
19
- {icon ? <Star /> : "Second more txt"}
25
+ {both ? (
26
+ <>
27
+ <Star /> Second more txt
28
+ </>
29
+ ) : (
30
+ <>{icon ? <Star /> : "Second more txt"}</>
31
+ )}
20
32
  </ToggleGroup.Item>
21
33
  <ToggleGroup.Item value="third">
22
- {icon ? <Attachment /> : "Third"}
34
+ {both ? (
35
+ <>
36
+ <Attachment /> Thrid
37
+ </>
38
+ ) : (
39
+ <>{icon ? <Attachment /> : "Third"}</>
40
+ )}
23
41
  </ToggleGroup.Item>
24
42
  <ToggleGroup.Item value="fourth">
25
- {icon ? <System /> : "Fourth"}
43
+ {both ? (
44
+ <>
45
+ <System /> Fourth
46
+ </>
47
+ ) : (
48
+ <>{icon ? <System /> : "Fourth"}</>
49
+ )}
26
50
  </ToggleGroup.Item>
27
51
  </>
28
52
  );
@@ -41,6 +65,9 @@ export const All = () => {
41
65
  <ToggleGroup value={activeValue} onChange={setActiveValue}>
42
66
  {Items(true)}
43
67
  </ToggleGroup>
68
+ <ToggleGroup value={activeValue} onChange={setActiveValue}>
69
+ {Items(true, true)}
70
+ </ToggleGroup>
44
71
  </div>
45
72
  <h2>ToggleGroup Small</h2>
46
73
  <h3>{activeValue}</h3>
@@ -51,6 +78,9 @@ export const All = () => {
51
78
  <ToggleGroup size="small" value={activeValue} onChange={setActiveValue}>
52
79
  {Items(true)}
53
80
  </ToggleGroup>
81
+ <ToggleGroup size="small" value={activeValue} onChange={setActiveValue}>
82
+ {Items(true, true)}
83
+ </ToggleGroup>
54
84
  </div>
55
85
  <h2>ToggleGroup label</h2>
56
86
  <div style={{ display: "flex", flexDirection: "column", gap: "0.5rem" }}>
@@ -1,7 +1,8 @@
1
1
  import React, { forwardRef, useContext } from "react";
2
2
  import cl from "classnames";
3
- import { Label, ToggleGroupContext } from "..";
3
+ import { Label } from "..";
4
4
  import * as RadixToggleGroup from "@radix-ui/react-toggle-group";
5
+ import { ToggleGroupContext } from "./ToggleGroup";
5
6
 
6
7
  export interface ToggleItemProps
7
8
  extends React.HTMLAttributes<HTMLButtonElement> {
@@ -1,2 +1,2 @@
1
1
  export { default as ToggleGroup } from "./ToggleGroup";
2
- export * from "./ToggleGroup";
2
+ export { ToggleGroupProps } from "./ToggleGroup";