@navikt/ds-react 1.2.5 → 1.3.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.
package/_docs.json CHANGED
@@ -4479,6 +4479,48 @@
4479
4479
  "name": "number"
4480
4480
  }
4481
4481
  },
4482
+ "completed": {
4483
+ "defaultValue": {
4484
+ "value": "false"
4485
+ },
4486
+ "description": "Makes step-indicator a checkmark",
4487
+ "name": "completed",
4488
+ "parent": {
4489
+ "fileName": "src/stepper/Step.tsx",
4490
+ "name": "StepperStepProps"
4491
+ },
4492
+ "declarations": [
4493
+ {
4494
+ "fileName": "src/stepper/Step.tsx",
4495
+ "name": "StepperStepProps"
4496
+ }
4497
+ ],
4498
+ "required": false,
4499
+ "type": {
4500
+ "name": "boolean"
4501
+ }
4502
+ },
4503
+ "interactive": {
4504
+ "defaultValue": {
4505
+ "value": "true"
4506
+ },
4507
+ "description": "Makes step non-interactive if false. Step will be set to a <div>, overriding `as`-prop",
4508
+ "name": "interactive",
4509
+ "parent": {
4510
+ "fileName": "src/stepper/Step.tsx",
4511
+ "name": "StepperStepProps"
4512
+ },
4513
+ "declarations": [
4514
+ {
4515
+ "fileName": "src/stepper/Step.tsx",
4516
+ "name": "StepperStepProps"
4517
+ }
4518
+ ],
4519
+ "required": false,
4520
+ "type": {
4521
+ "name": "boolean"
4522
+ }
4523
+ },
4482
4524
  "className": {
4483
4525
  "defaultValue": null,
4484
4526
  "description": "",
@@ -4601,6 +4643,27 @@
4601
4643
  "name": "((step: number) => void)"
4602
4644
  }
4603
4645
  },
4646
+ "interactive": {
4647
+ "defaultValue": {
4648
+ "value": "true"
4649
+ },
4650
+ "description": "Makes stepper non-interactive if false",
4651
+ "name": "interactive",
4652
+ "parent": {
4653
+ "fileName": "src/stepper/Stepper.tsx",
4654
+ "name": "StepperProps"
4655
+ },
4656
+ "declarations": [
4657
+ {
4658
+ "fileName": "src/stepper/Stepper.tsx",
4659
+ "name": "StepperProps"
4660
+ }
4661
+ ],
4662
+ "required": false,
4663
+ "type": {
4664
+ "name": "boolean"
4665
+ }
4666
+ },
4604
4667
  "className": {
4605
4668
  "defaultValue": null,
4606
4669
  "description": "",
@@ -38,26 +38,32 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
38
38
  };
39
39
  Object.defineProperty(exports, "__esModule", { value: true });
40
40
  exports.StepComponent = void 0;
41
+ const ds_icons_1 = require("@navikt/ds-icons");
41
42
  const clsx_1 = __importDefault(require("clsx"));
42
43
  const react_1 = __importStar(require("react"));
43
- const Stepper_1 = require("./Stepper");
44
44
  const __1 = require("..");
45
+ const Stepper_1 = require("./Stepper");
45
46
  exports.StepComponent = (0, react_1.forwardRef)((_a, ref) => {
46
- var { className, children, as: Component = "a", unsafe_index = 0 } = _a, rest = __rest(_a, ["className", "children", "as", "unsafe_index"]);
47
+ var { className, children, as: Component = "a", unsafe_index = 0, completed = false, interactive } = _a, rest = __rest(_a, ["className", "children", "as", "unsafe_index", "completed", "interactive"]);
47
48
  const context = (0, react_1.useContext)(Stepper_1.StepperContext);
48
49
  if (context === null) {
49
50
  console.error("<Stepper.Step> has to be used within <Stepper>");
50
51
  return null;
51
52
  }
52
53
  const { activeStep } = context;
53
- return (react_1.default.createElement(Component, Object.assign({}, rest, { "aria-current": activeStep === unsafe_index, ref: ref, className: (0, clsx_1.default)("navds-stepper__step", className, {
54
+ const isInteractive = interactive !== null && interactive !== void 0 ? interactive : context === null || context === void 0 ? void 0 : context.interactive;
55
+ const Comp = isInteractive ? Component : "div";
56
+ return (react_1.default.createElement(Comp, Object.assign({}, rest, { "aria-current": activeStep === unsafe_index, ref: ref, className: (0, clsx_1.default)("navds-stepper__step", className, {
54
57
  "navds-stepper__step--active": activeStep === unsafe_index,
58
+ "navds-stepper__step--behind": activeStep > unsafe_index,
59
+ "navds-stepper__step--non-interactive": !isInteractive,
60
+ "navds-stepper__step--completed": completed,
55
61
  }), onClick: (e) => {
56
62
  var _a;
57
- context.onStepChange(unsafe_index + 1);
63
+ isInteractive && context.onStepChange(unsafe_index + 1);
58
64
  (_a = rest === null || rest === void 0 ? void 0 : rest.onClick) === null || _a === void 0 ? void 0 : _a.call(rest, e);
59
65
  } }),
60
- react_1.default.createElement(__1.Label, { className: "navds-stepper__circle", as: "span", "aria-hidden": "true" }, unsafe_index + 1),
66
+ completed ? (react_1.default.createElement(ds_icons_1.SuccessFilled, { "aria-hidden": true, className: "navds-stepper__circle navds-stepper__circle--success" })) : (react_1.default.createElement(__1.Label, { className: "navds-stepper__circle", as: "span", "aria-hidden": "true" }, unsafe_index + 1)),
61
67
  react_1.default.createElement(__1.Label, { as: "span", className: "navds-stepper__content" }, children)));
62
68
  });
63
69
  const Step = exports.StepComponent;
@@ -43,7 +43,7 @@ const clsx_1 = __importDefault(require("clsx"));
43
43
  const Step_1 = __importDefault(require("./Step"));
44
44
  exports.StepperContext = (0, react_1.createContext)(null);
45
45
  exports.Stepper = (0, react_1.forwardRef)((_a, ref) => {
46
- var { children, className, activeStep, orientation = "vertical", onStepChange = () => { } } = _a, rest = __rest(_a, ["children", "className", "activeStep", "orientation", "onStepChange"]);
46
+ var { children, className, activeStep, orientation = "vertical", onStepChange = () => { }, interactive = true } = _a, rest = __rest(_a, ["children", "className", "activeStep", "orientation", "onStepChange", "interactive"]);
47
47
  activeStep = activeStep - 1;
48
48
  return (react_1.default.createElement("ol", Object.assign({}, rest, { ref: ref, className: (0, clsx_1.default)("navds-stepper", orientation === "horizontal" ? "navds-stepper--horizontal" : "", className) }),
49
49
  react_1.default.createElement(exports.StepperContext.Provider, { value: {
@@ -51,6 +51,7 @@ exports.Stepper = (0, react_1.forwardRef)((_a, ref) => {
51
51
  onStepChange,
52
52
  lastIndex: react_1.default.Children.count(children),
53
53
  orientation,
54
+ interactive,
54
55
  } }, react_1.default.Children.map(children, (step, index) => {
55
56
  var _a, _b;
56
57
  return (react_1.default.createElement("li", { className: (0, clsx_1.default)("navds-stepper__item"), key: index + ((_b = (_a = children === null || children === void 0 ? void 0 : children.toString) === null || _a === void 0 ? void 0 : _a.call(children)) !== null && _b !== void 0 ? _b : "") },
@@ -67,9 +67,9 @@ exports.ToggleGroup = (0, react_1.forwardRef)((_a, ref) => {
67
67
  return (react_1.default.createElement(exports.ToggleGroupContext.Provider, { value: {
68
68
  size,
69
69
  } },
70
- react_1.default.createElement("div", null,
70
+ react_1.default.createElement("div", { className: (0, clsx_1.default)("navds-toggle-group__wrapper", className) },
71
71
  label && (react_1.default.createElement(__1.Label, { size: size, className: "navds-toggle-group__label", id: labelId }, label)),
72
- react_1.default.createElement(RadixToggleGroup.Root, Object.assign({}, rest, { onValueChange: handleValueChange, value: value !== null && value !== void 0 ? value : groupValue, defaultValue: defaultValue, ref: ref, className: (0, clsx_1.default)("navds-toggle-group", className, `navds-toggle-group--${size}`) }, (describeBy && { "aria-describedby": describeBy }), { role: "radiogroup", type: "single" }), children))));
72
+ react_1.default.createElement(RadixToggleGroup.Root, Object.assign({}, rest, { onValueChange: handleValueChange, value: value !== null && value !== void 0 ? value : groupValue, defaultValue: defaultValue, ref: ref, className: (0, clsx_1.default)("navds-toggle-group", `navds-toggle-group--${size}`) }, (describeBy && { "aria-describedby": describeBy }), { role: "radiogroup", type: "single" }), children))));
73
73
  });
74
74
  exports.ToggleGroup.Item = ToggleItem_1.default;
75
75
  exports.default = exports.ToggleGroup;
@@ -10,6 +10,16 @@ export interface StepperStepProps extends React.AnchorHTMLAttributes<HTMLAnchorE
10
10
  * @private
11
11
  */
12
12
  unsafe_index?: number;
13
+ /**
14
+ * Makes step-indicator a checkmark
15
+ * @default false
16
+ */
17
+ completed?: boolean;
18
+ /**
19
+ * Makes step non-interactive if false. Step will be set to a <div>, overriding `as`-prop
20
+ * @default true
21
+ */
22
+ interactive?: boolean;
13
23
  }
14
24
  export interface StepperStepType extends OverridableComponent<StepperStepProps, HTMLAnchorElement> {
15
25
  }
@@ -9,26 +9,32 @@ var __rest = (this && this.__rest) || function (s, e) {
9
9
  }
10
10
  return t;
11
11
  };
12
+ import { SuccessFilled } from "@navikt/ds-icons";
12
13
  import cl from "clsx";
13
14
  import React, { forwardRef, useContext } from "react";
14
- import { StepperContext } from "./Stepper";
15
15
  import { Label } from "..";
16
+ import { StepperContext } from "./Stepper";
16
17
  export const StepComponent = forwardRef((_a, ref) => {
17
- var { className, children, as: Component = "a", unsafe_index = 0 } = _a, rest = __rest(_a, ["className", "children", "as", "unsafe_index"]);
18
+ var { className, children, as: Component = "a", unsafe_index = 0, completed = false, interactive } = _a, rest = __rest(_a, ["className", "children", "as", "unsafe_index", "completed", "interactive"]);
18
19
  const context = useContext(StepperContext);
19
20
  if (context === null) {
20
21
  console.error("<Stepper.Step> has to be used within <Stepper>");
21
22
  return null;
22
23
  }
23
24
  const { activeStep } = context;
24
- return (React.createElement(Component, Object.assign({}, rest, { "aria-current": activeStep === unsafe_index, ref: ref, className: cl("navds-stepper__step", className, {
25
+ const isInteractive = interactive !== null && interactive !== void 0 ? interactive : context === null || context === void 0 ? void 0 : context.interactive;
26
+ const Comp = isInteractive ? Component : "div";
27
+ return (React.createElement(Comp, Object.assign({}, rest, { "aria-current": activeStep === unsafe_index, ref: ref, className: cl("navds-stepper__step", className, {
25
28
  "navds-stepper__step--active": activeStep === unsafe_index,
29
+ "navds-stepper__step--behind": activeStep > unsafe_index,
30
+ "navds-stepper__step--non-interactive": !isInteractive,
31
+ "navds-stepper__step--completed": completed,
26
32
  }), onClick: (e) => {
27
33
  var _a;
28
- context.onStepChange(unsafe_index + 1);
34
+ isInteractive && context.onStepChange(unsafe_index + 1);
29
35
  (_a = rest === null || rest === void 0 ? void 0 : rest.onClick) === null || _a === void 0 ? void 0 : _a.call(rest, e);
30
36
  } }),
31
- React.createElement(Label, { className: "navds-stepper__circle", as: "span", "aria-hidden": "true" }, unsafe_index + 1),
37
+ completed ? (React.createElement(SuccessFilled, { "aria-hidden": true, className: "navds-stepper__circle navds-stepper__circle--success" })) : (React.createElement(Label, { className: "navds-stepper__circle", as: "span", "aria-hidden": "true" }, unsafe_index + 1)),
32
38
  React.createElement(Label, { as: "span", className: "navds-stepper__content" }, children)));
33
39
  });
34
40
  const Step = StepComponent;
@@ -1 +1 @@
1
- {"version":3,"file":"Step.js","sourceRoot":"","sources":["../../src/stepper/Step.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,EAAE,MAAM,MAAM,CAAC;AACtB,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EAAE,KAAK,EAAwB,MAAM,IAAI,CAAC;AAkBjD,MAAM,CAAC,MAAM,aAAa,GAGtB,UAAU,CACZ,CACE,EAAuE,EACvE,GAAG,EACH,EAAE;QAFF,EAAE,SAAS,EAAE,QAAQ,EAAE,EAAE,EAAE,SAAS,GAAG,GAAG,EAAE,YAAY,GAAG,CAAC,OAAW,EAAN,IAAI,cAArE,+CAAuE,CAAF;IAGrE,MAAM,OAAO,GAAG,UAAU,CAAC,cAAc,CAAC,CAAC;IAC3C,IAAI,OAAO,KAAK,IAAI,EAAE;QACpB,OAAO,CAAC,KAAK,CAAC,gDAAgD,CAAC,CAAC;QAChE,OAAO,IAAI,CAAC;KACb;IACD,MAAM,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC;IAE/B,OAAO,CACL,oBAAC,SAAS,oBACJ,IAAI,oBACM,UAAU,KAAK,YAAY,EACzC,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,EAAE,CAAC,qBAAqB,EAAE,SAAS,EAAE;YAC9C,6BAA6B,EAAE,UAAU,KAAK,YAAY;SAC3D,CAAC,EACF,OAAO,EAAE,CAAC,CAAC,EAAE,EAAE;;YACb,OAAO,CAAC,YAAY,CAAC,YAAY,GAAG,CAAC,CAAC,CAAC;YACvC,MAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,OAAO,qDAAG,CAAC,CAAC,CAAC;QACrB,CAAC;QAED,oBA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AAa,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC;IAE/C,OAAO,CACL,oBAAC,IAAI,oBACC,IAAI,oBACM,UAAU,KAAK,YAAY,EACzC,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,EAAE,CAAC,qBAAqB,EAAE,SAAS,EAAE;YAC9C,6BAA6B,EAAE,UAAU,KAAK,YAAY;YAC1D,6BAA6B,EAAE,UAAU,GAAG,YAAY;YACxD,sCAAsC,EAAE,CAAC,aAAa;YACtD,gCAAgC,EAAE,SAAS;SAC5C,CAAC,EACF,OAAO,EAAE,CAAC,CAAC,EAAE,EAAE;;YACb,aAAa,IAAI,OAAO,CAAC,YAAY,CAAC,YAAY,GAAG,CAAC,CAAC,CAAC;YACxD,MAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,OAAO,qDAAG,CAAC,CAAC,CAAC;QACrB,CAAC;QAEA,SAAS,CAAC,CAAC,CAAC,CACX,oBAAC,aAAa,yBAEZ,SAAS,EAAC,sDAAsD,GAChE,CACH,CAAC,CAAC,CAAC,CACF,oBAAC,KAAK,IAAC,SAAS,EAAC,uBAAuB,EAAC,EAAE,EAAC,MAAM,iBAAa,MAAM,IAClE,YAAY,GAAG,CAAC,CACX,CACT;QACD,oBAAC,KAAK,IAAC,EAAE,EAAC,MAAM,EAAC,SAAS,EAAC,wBAAwB,IAChD,QAAQ,CACH,CACH,CACR,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,MAAM,IAAI,GAAG,aAAgC,CAAC;AAE9C,eAAe,IAAI,CAAC"}
@@ -20,6 +20,11 @@ export interface StepperProps extends React.HTMLAttributes<HTMLOListElement> {
20
20
  * @note Stepper index starts at 1, not 0
21
21
  */
22
22
  onStepChange?: (step: number) => void;
23
+ /**
24
+ * Makes stepper non-interactive if false
25
+ * @default true
26
+ */
27
+ interactive?: boolean;
23
28
  }
24
29
  interface StepperComponent extends React.ForwardRefExoticComponent<StepperProps & React.RefAttributes<HTMLOListElement>> {
25
30
  Step: StepperStepType;
@@ -29,6 +34,7 @@ interface StepperContextProps {
29
34
  onStepChange: (step: number) => void;
30
35
  lastIndex: number;
31
36
  orientation: "horizontal" | "vertical";
37
+ interactive: boolean;
32
38
  }
33
39
  export declare const StepperContext: React.Context<StepperContextProps | null>;
34
40
  export declare const Stepper: StepperComponent;
@@ -14,7 +14,7 @@ import cl from "clsx";
14
14
  import Step from "./Step";
15
15
  export const StepperContext = createContext(null);
16
16
  export const Stepper = forwardRef((_a, ref) => {
17
- var { children, className, activeStep, orientation = "vertical", onStepChange = () => { } } = _a, rest = __rest(_a, ["children", "className", "activeStep", "orientation", "onStepChange"]);
17
+ var { children, className, activeStep, orientation = "vertical", onStepChange = () => { }, interactive = true } = _a, rest = __rest(_a, ["children", "className", "activeStep", "orientation", "onStepChange", "interactive"]);
18
18
  activeStep = activeStep - 1;
19
19
  return (React.createElement("ol", Object.assign({}, rest, { ref: ref, className: cl("navds-stepper", orientation === "horizontal" ? "navds-stepper--horizontal" : "", className) }),
20
20
  React.createElement(StepperContext.Provider, { value: {
@@ -22,6 +22,7 @@ export const Stepper = forwardRef((_a, ref) => {
22
22
  onStepChange,
23
23
  lastIndex: React.Children.count(children),
24
24
  orientation,
25
+ interactive,
25
26
  } }, React.Children.map(children, (step, index) => {
26
27
  var _a, _b;
27
28
  return (React.createElement("li", { className: cl("navds-stepper__item"), key: index + ((_b = (_a = children === null || children === void 0 ? void 0 : children.toString) === null || _a === void 0 ? void 0 : _a.call(children)) !== null && _b !== void 0 ? _b : "") },
@@ -1 +1 @@
1
- {"version":3,"file":"Stepper.js","sourceRoot":"","sources":["../../src/stepper/Stepper.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,KAAK,EAAE,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AACzD,OAAO,EAAE,MAAM,MAAM,CAAC;AACtB,OAAO,IAA2C,MAAM,QAAQ,CAAC;AAsCjE,MAAM,CAAC,MAAM,c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AK,GAAG,CAAC,MAAA,MAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,QAAQ,wDAAI,mCAAI,EAAE,CAAC;gBAE3C,8BAAM,SAAS,EAAC,4CAA4C,GAAG;gBAC9D,KAAK,CAAC,cAAc,CAAmB,IAAI,CAAC;oBAC3C,CAAC,CAAC,KAAK,CAAC,YAAY,CAAC,IAAI,kCAClB,IAAI,CAAC,KAAK,KACb,YAAY,EAAE,KAAK,IACnB;oBACJ,CAAC,CAAC,IAAI;gBACR,8BAAM,SAAS,EAAC,4CAA4C,GAAG,CAC5D,CACN,CAAC;QACJ,CAAC,CAAC,CACsB,CACvB,CACN,CAAC;AACJ,CAAC,CACkB,CAAC;AAEtB,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC;AAEpB,eAAe,OAAO,CAAC"}
@@ -38,9 +38,9 @@ export const ToggleGroup = forwardRef((_a, ref) => {
38
38
  return (React.createElement(ToggleGroupContext.Provider, { value: {
39
39
  size,
40
40
  } },
41
- React.createElement("div", null,
41
+ React.createElement("div", { className: cl("navds-toggle-group__wrapper", className) },
42
42
  label && (React.createElement(Label, { size: size, className: "navds-toggle-group__label", id: labelId }, label)),
43
- React.createElement(RadixToggleGroup.Root, Object.assign({}, rest, { onValueChange: handleValueChange, value: value !== null && value !== void 0 ? value : groupValue, defaultValue: defaultValue, ref: ref, className: cl("navds-toggle-group", className, `navds-toggle-group--${size}`) }, (describeBy && { "aria-describedby": describeBy }), { role: "radiogroup", type: "single" }), children))));
43
+ React.createElement(RadixToggleGroup.Root, Object.assign({}, rest, { onValueChange: handleValueChange, value: value !== null && value !== void 0 ? value : groupValue, defaultValue: defaultValue, ref: ref, className: cl("navds-toggle-group", `navds-toggle-group--${size}`) }, (describeBy && { "aria-describedby": describeBy }), { role: "radiogroup", type: "single" }), children))));
44
44
  });
45
45
  ToggleGroup.Item = ToggleItem;
46
46
  export default ToggleGroup;
@@ -1 +1 @@
1
- {"version":3,"file":"ToggleGroup.js","sourceR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AAE,EAAE,CAAC,6BAA6B,EAAE,SAAS,CAAC;YACzD,KAAK,IAAI,CACR,oBAAC,KAAK,IACJ,IAAI,EAAE,IAAI,EACV,SAAS,EAAC,2BAA2B,EACrC,EAAE,EAAE,OAAO,IAEV,KAAK,CACA,CACT;YACD,oBAAC,gBAAgB,CAAC,IAAI,oBAChB,IAAI,IACR,aAAa,EAAE,iBAAiB,EAChC,KAAK,EAAE,KAAK,aAAL,KAAK,cAAL,KAAK,GAAI,UAAU,EAC1B,YAAY,EAAE,YAAY,EAC1B,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,EAAE,CAAC,oBAAoB,EAAE,uBAAuB,IAAI,EAAE,CAAC,IAC9D,CAAC,UAAU,IAAI,EAAE,kBAAkB,EAAE,UAAU,EAAE,CAAC,IACtD,IAAI,EAAC,YAAY,EACjB,IAAI,EAAC,QAAQ,KAEZ,QAAQ,CACa,CACpB,CACsB,CAC/B,CAAC;AACJ,CAAC,CACsB,CAAC;AAE1B,WAAW,CAAC,IAAI,GAAG,UAAU,CAAC;AAE9B,eAAe,WAAW,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@navikt/ds-react",
3
- "version": "1.2.5",
3
+ "version": "1.3.0",
4
4
  "description": "NAV designsystem react components",
5
5
  "author": "NAV Designsystem team",
6
6
  "license": "MIT",
@@ -36,7 +36,7 @@
36
36
  },
37
37
  "dependencies": {
38
38
  "@floating-ui/react-dom-interactions": "0.9.2",
39
- "@navikt/ds-icons": "^1.2.5",
39
+ "@navikt/ds-icons": "^1.3.0",
40
40
  "@radix-ui/react-tabs": "1.0.0",
41
41
  "@radix-ui/react-toggle-group": "1.0.0",
42
42
  "clsx": "^1.1.1",
@@ -74,5 +74,5 @@
74
74
  "optional": true
75
75
  }
76
76
  },
77
- "gitHead": "f2eab3f636387ed025fd57f44178c41ae1ffbaff"
77
+ "gitHead": "01a6f250da8c41fc4338fcd951ae5bc148e39b46"
78
78
  }
@@ -1,7 +1,8 @@
1
+ import { SuccessFilled } from "@navikt/ds-icons";
1
2
  import cl from "clsx";
2
3
  import React, { forwardRef, useContext } from "react";
3
- import { StepperContext } from "./Stepper";
4
4
  import { Label, OverridableComponent } from "..";
5
+ import { StepperContext } from "./Stepper";
5
6
 
6
7
  export interface StepperStepProps
7
8
  extends React.AnchorHTMLAttributes<HTMLAnchorElement> {
@@ -14,6 +15,16 @@ export interface StepperStepProps
14
15
  * @private
15
16
  */
16
17
  unsafe_index?: number;
18
+ /**
19
+ * Makes step-indicator a checkmark
20
+ * @default false
21
+ */
22
+ completed?: boolean;
23
+ /**
24
+ * Makes step non-interactive if false. Step will be set to a <div>, overriding `as`-prop
25
+ * @default true
26
+ */
27
+ interactive?: boolean;
17
28
  }
18
29
 
19
30
  export interface StepperStepType
@@ -24,7 +35,15 @@ export const StepComponent: OverridableComponent<
24
35
  HTMLAnchorElement
25
36
  > = forwardRef(
26
37
  (
27
- { className, children, as: Component = "a", unsafe_index = 0, ...rest },
38
+ {
39
+ className,
40
+ children,
41
+ as: Component = "a",
42
+ unsafe_index = 0,
43
+ completed = false,
44
+ interactive,
45
+ ...rest
46
+ },
28
47
  ref
29
48
  ) => {
30
49
  const context = useContext(StepperContext);
@@ -34,26 +53,40 @@ export const StepComponent: OverridableComponent<
34
53
  }
35
54
  const { activeStep } = context;
36
55
 
56
+ const isInteractive = interactive ?? context?.interactive;
57
+
58
+ const Comp = isInteractive ? Component : "div";
59
+
37
60
  return (
38
- <Component
61
+ <Comp
39
62
  {...rest}
40
63
  aria-current={activeStep === unsafe_index}
41
64
  ref={ref}
42
65
  className={cl("navds-stepper__step", className, {
43
66
  "navds-stepper__step--active": activeStep === unsafe_index,
67
+ "navds-stepper__step--behind": activeStep > unsafe_index,
68
+ "navds-stepper__step--non-interactive": !isInteractive,
69
+ "navds-stepper__step--completed": completed,
44
70
  })}
45
71
  onClick={(e) => {
46
- context.onStepChange(unsafe_index + 1);
72
+ isInteractive && context.onStepChange(unsafe_index + 1);
47
73
  rest?.onClick?.(e);
48
74
  }}
49
75
  >
50
- <Label className="navds-stepper__circle" as="span" aria-hidden="true">
51
- {unsafe_index + 1}
52
- </Label>
76
+ {completed ? (
77
+ <SuccessFilled
78
+ aria-hidden
79
+ className="navds-stepper__circle navds-stepper__circle--success"
80
+ />
81
+ ) : (
82
+ <Label className="navds-stepper__circle" as="span" aria-hidden="true">
83
+ {unsafe_index + 1}
84
+ </Label>
85
+ )}
53
86
  <Label as="span" className="navds-stepper__content">
54
87
  {children}
55
88
  </Label>
56
- </Component>
89
+ </Comp>
57
90
  );
58
91
  }
59
92
  );
@@ -22,6 +22,11 @@ export interface StepperProps extends React.HTMLAttributes<HTMLOListElement> {
22
22
  * @note Stepper index starts at 1, not 0
23
23
  */
24
24
  onStepChange?: (step: number) => void;
25
+ /**
26
+ * Makes stepper non-interactive if false
27
+ * @default true
28
+ */
29
+ interactive?: boolean;
25
30
  }
26
31
 
27
32
  interface StepperComponent
@@ -36,6 +41,7 @@ interface StepperContextProps {
36
41
  onStepChange: (step: number) => void;
37
42
  lastIndex: number;
38
43
  orientation: "horizontal" | "vertical";
44
+ interactive: boolean;
39
45
  }
40
46
 
41
47
  export const StepperContext = createContext<StepperContextProps | null>(null);
@@ -51,6 +57,7 @@ export const Stepper: StepperComponent = forwardRef<
51
57
  activeStep,
52
58
  orientation = "vertical",
53
59
  onStepChange = () => {},
60
+ interactive = true,
54
61
  ...rest
55
62
  },
56
63
  ref
@@ -72,6 +79,7 @@ export const Stepper: StepperComponent = forwardRef<
72
79
  onStepChange,
73
80
  lastIndex: React.Children.count(children),
74
81
  orientation,
82
+ interactive,
75
83
  }}
76
84
  >
77
85
  {React.Children.map(children, (step, index) => {
@@ -1,7 +1,7 @@
1
1
  import { Meta } from "@storybook/react/types-6-0";
2
2
  import React, { useState } from "react";
3
- import Stepper from "./Stepper";
4
3
  import { BodyLong } from "..";
4
+ import Stepper from "./Stepper";
5
5
 
6
6
  export default {
7
7
  title: "ds-react/Stepper",
@@ -13,6 +13,11 @@ export default {
13
13
  options: ["horizontal", "vertical"],
14
14
  },
15
15
  },
16
+ activeStep: {
17
+ control: {
18
+ type: "number",
19
+ },
20
+ },
16
21
  },
17
22
  } as Meta;
18
23
 
@@ -40,13 +45,17 @@ export const Default = ({ asButton, ...props }) => {
40
45
  aria-labelledby="stepper-heading"
41
46
  activeStep={activeStep}
42
47
  onStepChange={setActiveStep}
43
- orientation="horizontal"
48
+ orientation="vertical"
44
49
  {...props}
45
50
  >
46
- <Stepper.Step {...newProps}>Start søknad</Stepper.Step>
51
+ <Stepper.Step {...newProps} completed={props.completed}>
52
+ Start søknad
53
+ </Stepper.Step>
47
54
  <Stepper.Step {...newProps}>Personopplysninger</Stepper.Step>
48
- <Stepper.Step {...newProps}>Saksopplysninger</Stepper.Step>
49
- <Stepper.Step {...newProps}>
55
+ <Stepper.Step {...newProps} completed={props.completed}>
56
+ Saksopplysninger
57
+ </Stepper.Step>
58
+ <Stepper.Step {...newProps} completed={props.completed}>
50
59
  Søknadstekst for en veldig spesifikk prosess i NAV som må beskrives og
51
60
  forklares i sitt fulle i denne labelen
52
61
  </Stepper.Step>
@@ -63,6 +72,8 @@ export const Default = ({ asButton, ...props }) => {
63
72
 
64
73
  Default.args = {
65
74
  asButton: false,
75
+ interactive: true,
76
+ completed: false,
66
77
  };
67
78
 
68
79
  export const Horizontal = () => {
@@ -112,22 +123,84 @@ export const Vertical = () => {
112
123
  };
113
124
 
114
125
  export const DisplayOnly = () => {
115
- const props = { as: "div" };
116
126
  return (
117
- <Stepper
118
- aria-labelledby="stepper-heading"
119
- activeStep={2}
120
- orientation="vertical"
121
- >
122
- <Stepper.Step {...props}>Start søknad</Stepper.Step>
123
- <Stepper.Step {...props}>Personopplysninger</Stepper.Step>
124
- <Stepper.Step {...props}>Saksopplysninger</Stepper.Step>
125
- <Stepper.Step {...props}>
126
- Søknadstekst for en veldig spesifikk prosess i NAV som har lang tekst
127
- </Stepper.Step>
128
- <Stepper.Step {...props}>Vedlegg</Stepper.Step>
129
- <Stepper.Step {...props}>Oppsummering</Stepper.Step>
130
- <Stepper.Step {...props}>Innsending</Stepper.Step>
131
- </Stepper>
127
+ <div className="colgap">
128
+ <Stepper
129
+ aria-labelledby="stepper-heading"
130
+ activeStep={2}
131
+ orientation="vertical"
132
+ interactive={false}
133
+ >
134
+ <Stepper.Step completed>Start søknad</Stepper.Step>
135
+ <Stepper.Step completed>Personopplysninger</Stepper.Step>
136
+ <Stepper.Step>Saksopplysninger</Stepper.Step>
137
+ <Stepper.Step>
138
+ Søknadstekst for en veldig spesifikk prosess i NAV som har lang tekst
139
+ </Stepper.Step>
140
+ <Stepper.Step>Vedlegg</Stepper.Step>
141
+ <Stepper.Step>Oppsummering</Stepper.Step>
142
+ <Stepper.Step>Innsending</Stepper.Step>
143
+ </Stepper>
144
+ <Stepper
145
+ aria-labelledby="stepper-heading"
146
+ activeStep={3}
147
+ orientation="vertical"
148
+ interactive={false}
149
+ >
150
+ <Stepper.Step completed>Start søknad</Stepper.Step>
151
+ <Stepper.Step completed>Personopplysninger</Stepper.Step>
152
+ <Stepper.Step>Saksopplysninger</Stepper.Step>
153
+ <Stepper.Step>
154
+ Søknadstekst for en veldig spesifikk prosess i NAV som har lang tekst
155
+ </Stepper.Step>
156
+ <Stepper.Step>Vedlegg</Stepper.Step>
157
+ <Stepper.Step>Oppsummering</Stepper.Step>
158
+ <Stepper.Step>Innsending</Stepper.Step>
159
+ </Stepper>
160
+ </div>
161
+ );
162
+ };
163
+
164
+ export const CompletedSteps = () => {
165
+ const [activeStep, setActiveStep] = useState(3);
166
+ return (
167
+ <div className="colgap">
168
+ <Stepper
169
+ aria-labelledby="stepper-heading"
170
+ activeStep={activeStep}
171
+ orientation="vertical"
172
+ onStepChange={(step) => setActiveStep(step)}
173
+ >
174
+ <Stepper.Step completed={activeStep > 1}>Start søknad</Stepper.Step>
175
+ <Stepper.Step completed={activeStep > 2}>
176
+ Personopplysninger
177
+ </Stepper.Step>
178
+ <Stepper.Step completed={activeStep > 3}>Saksopplysninger</Stepper.Step>
179
+ <Stepper.Step completed={activeStep >= 4}>
180
+ Søknadstekst for en veldig spesifikk prosess i NAV som har lang tekst
181
+ </Stepper.Step>
182
+ <Stepper.Step completed={activeStep > 5}>Vedlegg</Stepper.Step>
183
+ <Stepper.Step completed={activeStep > 6}>Oppsummering</Stepper.Step>
184
+ <Stepper.Step completed={activeStep > 7}>Innsending</Stepper.Step>
185
+ </Stepper>
186
+ <Stepper
187
+ aria-labelledby="stepper-heading"
188
+ activeStep={activeStep - 1}
189
+ orientation="vertical"
190
+ onStepChange={(step) => setActiveStep(step)}
191
+ >
192
+ <Stepper.Step completed={activeStep > 1}>Start søknad</Stepper.Step>
193
+ <Stepper.Step completed={activeStep > 2}>
194
+ Personopplysninger
195
+ </Stepper.Step>
196
+ <Stepper.Step completed={activeStep > 3}>Saksopplysninger</Stepper.Step>
197
+ <Stepper.Step completed={activeStep >= 4}>
198
+ Søknadstekst for en veldig spesifikk prosess i NAV som har lang tekst
199
+ </Stepper.Step>
200
+ <Stepper.Step completed={activeStep > 5}>Vedlegg</Stepper.Step>
201
+ <Stepper.Step completed={activeStep > 6}>Oppsummering</Stepper.Step>
202
+ <Stepper.Step completed={activeStep > 7}>Innsending</Stepper.Step>
203
+ </Stepper>
204
+ </div>
132
205
  );
133
206
  };
@@ -98,7 +98,7 @@ export const ToggleGroup = forwardRef<HTMLDivElement, ToggleGroupProps>(
98
98
  size,
99
99
  }}
100
100
  >
101
- <div>
101
+ <div className={cl("navds-toggle-group__wrapper", className)}>
102
102
  {label && (
103
103
  <Label
104
104
  size={size}
@@ -114,11 +114,7 @@ export const ToggleGroup = forwardRef<HTMLDivElement, ToggleGroupProps>(
114
114
  value={value ?? groupValue}
115
115
  defaultValue={defaultValue}
116
116
  ref={ref}
117
- className={cl(
118
- "navds-toggle-group",
119
- className,
120
- `navds-toggle-group--${size}`
121
- )}
117
+ className={cl("navds-toggle-group", `navds-toggle-group--${size}`)}
122
118
  {...(describeBy && { "aria-describedby": describeBy })}
123
119
  role="radiogroup"
124
120
  type="single"