@navikt/ds-react 5.12.0 → 5.12.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/_docs.json CHANGED
@@ -5365,7 +5365,7 @@
5365
5365
  },
5366
5366
  "onBeforeClose": {
5367
5367
  "defaultValue": null,
5368
- "description": "Called when the user wants to close the modal (clicked the close button or pressed Esc).\n@returns Whether to close the modal",
5368
+ "description": "Called when the user tries to close the modal by one of the built-in methods.\nUsed if you want to ask the user for confirmation before closing.\n@warning Will not always be called when pressing Esc. See `onCancel` for more info.\n@returns Whether to close the modal",
5369
5369
  "name": "onBeforeClose",
5370
5370
  "parent": {
5371
5371
  "fileName": "react/src/modal/types.ts",
@@ -5384,7 +5384,7 @@
5384
5384
  },
5385
5385
  "onCancel": {
5386
5386
  "defaultValue": null,
5387
- "description": "Called when the user presses the Esc key, unless `onBeforeClose()` returns `false`.",
5387
+ "description": "*Sometimes** called when the user presses the Esc key, unless you return `false` in `onBeforeClose()`.\n@warning *Some browsers does not always trigger this event. Chrome only triggers it if you have\ninteracted with the modal, and will not trigger it a second time if you press Esc twice in a row.",
5388
5388
  "name": "onCancel",
5389
5389
  "parent": {
5390
5390
  "fileName": "react/src/modal/types.ts",
@@ -5405,7 +5405,7 @@
5405
5405
  "defaultValue": {
5406
5406
  "value": "false"
5407
5407
  },
5408
- "description": "Whether to close when clicking on the backdrop.\n\n**WARNING:** Users may click outside by accident. Don't use if closing can cause data loss, or the modal contains important info.",
5408
+ "description": "Whether to close when clicking on the backdrop.\n@warning Users may click outside by accident. Don't use if closing can cause data loss, or the modal contains important info.",
5409
5409
  "name": "closeOnBackdropClick",
5410
5410
  "parent": {
5411
5411
  "fileName": "react/src/modal/types.ts",
@@ -53,6 +53,6 @@ const DateWrapper = ({ open, children, onClose, anchor, locale, variant, popover
53
53
  }), closeOnBackdropClick: true },
54
54
  react_1.default.createElement("div", { className: "navds-date__modal-body" },
55
55
  children,
56
- react_1.default.createElement(button_1.Button, { variant: "tertiary", onClick: () => { var _a; return (_a = modalRef === null || modalRef === void 0 ? void 0 : modalRef.current) === null || _a === void 0 ? void 0 : _a.close(); }, size: "small" }, (0, labels_1.modalCloseButtonLabel)(locale)))));
56
+ react_1.default.createElement(button_1.Button, { variant: "tertiary", onClick: () => { var _a; return (_a = modalRef === null || modalRef === void 0 ? void 0 : modalRef.current) === null || _a === void 0 ? void 0 : _a.close(); }, size: "small", type: "button" }, (0, labels_1.modalCloseButtonLabel)(locale)))));
57
57
  };
58
58
  exports.DateWrapper = DateWrapper;
@@ -63,7 +63,7 @@ exports.Checkbox = (0, react_1.forwardRef)((props, ref) => {
63
63
  } })),
64
64
  react_1.default.createElement("label", { htmlFor: inputProps.id, className: "navds-checkbox__label" },
65
65
  react_1.default.createElement("span", { className: "navds-checkbox__icon" },
66
- react_1.default.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: "13", height: "10", viewBox: "0 0 13 10", fill: "none", focusable: false, role: "img", "aria-hidden": true },
66
+ react_1.default.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: "0.8125rem", height: "0.625rem", viewBox: "0 0 13 10", fill: "none", focusable: false, role: "img", "aria-hidden": true },
67
67
  react_1.default.createElement("path", { d: "M4.03524 6.41478L10.4752 0.404669C11.0792 -0.160351 12.029 -0.130672 12.5955 0.47478C13.162 1.08027 13.1296 2.03007 12.5245 2.59621L5.02111 9.59934C4.74099 9.85904 4.37559 10 4.00025 10C3.60651 10 3.22717 9.84621 2.93914 9.56111L0.439143 7.06111C-0.146381 6.47558 -0.146381 5.52542 0.439143 4.93989C1.02467 4.35437 1.97483 4.35437 2.56036 4.93989L4.03524 6.41478Z", fill: "currentColor" }))),
68
68
  react_1.default.createElement("span", { className: (0, clsx_1.default)("navds-checkbox__content", {
69
69
  "navds-sr-only": props.hideLabel,
@@ -24,6 +24,6 @@ export const DateWrapper = ({ open, children, onClose, anchor, locale, variant,
24
24
  }), closeOnBackdropClick: true },
25
25
  React.createElement("div", { className: "navds-date__modal-body" },
26
26
  children,
27
- React.createElement(Button, { variant: "tertiary", onClick: () => { var _a; return (_a = modalRef === null || modalRef === void 0 ? void 0 : modalRef.current) === null || _a === void 0 ? void 0 : _a.close(); }, size: "small" }, modalCloseButtonLabel(locale)))));
27
+ React.createElement(Button, { variant: "tertiary", onClick: () => { var _a; return (_a = modalRef === null || modalRef === void 0 ? void 0 : modalRef.current) === null || _a === void 0 ? void 0 : _a.close(); }, size: "small", type: "button" }, modalCloseButtonLabel(locale)))));
28
28
  };
29
29
  //# sourceMappingURL=DateWrapper.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"DateWrapper.js","sourceRoot":"","sources":["../../../src/date/parts/DateWrapper.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,MAAM,CAAC;AACtB,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,EAAE,qBAAqB,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAepE,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,EAC1B,IAAI,EACJ,QAAQ,EACR,OAAO,EACP,MAAM,EACN,MAAM,EACN,OAAO,EACP,YAAY,GACK,EAAE,EAAE;IACrB,MAAM,QAAQ,GAAG,MAAM,CAAoB,IAAI,CAAC,CAAC;IACjD,MAAM,SAAS,GAAG,UAAU,CAAC,YAAY,CAAC,KAAK,IAAI,CAAC;IACpD,MAAM,SAAS,GACb,QAAQ,CAAC,+BAA+B,EAAE,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC;IAE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AAC,gBACW,UAAU,CAAC,MAAM,EAAE,OAAO,CAAC,EACvC,SAAS,EAAE,EAAE,CAAC,mBAAmB,EAAE;YACjC,0BAA0B,EAAE,SAAS;YACrC,YAAY,EAAE,OAAO,KAAK,OAAO;SAClC,CAAC,EACF,oBAAoB;QAEpB,6BAAK,SAAS,EAAC,wBAAwB;YACpC,QAAQ;YACT,oBAAC,MAAM,IACL,OAAO,EAAC,UAAU,EAClB,OAAO,EAAE,GAAG,EAAE,WAAC,OAAA,MAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,OAAO,0CAAE,KAAK,EAAE,CAAA,EAAA,EACzC,IAAI,EAAC,OAAO,EACZ,IAAI,EAAC,QAAQ,IAEZ,qBAAqB,CAAC,MAAM,CAAC,CACvB,CACL,CACA,CACT,CAAC;AACJ,CAAC,CAAC"}
@@ -34,7 +34,7 @@ export const Checkbox = forwardRef((props, ref) => {
34
34
  } })),
35
35
  React.createElement("label", { htmlFor: inputProps.id, className: "navds-checkbox__label" },
36
36
  React.createElement("span", { className: "navds-checkbox__icon" },
37
- React.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: "13", height: "10", viewBox: "0 0 13 10", fill: "none", focusable: false, role: "img", "aria-hidden": true },
37
+ React.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: "0.8125rem", height: "0.625rem", viewBox: "0 0 13 10", fill: "none", focusable: false, role: "img", "aria-hidden": true },
38
38
  React.createElement("path", { d: "M4.03524 6.41478L10.4752 0.404669C11.0792 -0.160351 12.029 -0.130672 12.5955 0.47478C13.162 1.08027 13.1296 2.03007 12.5245 2.59621L5.02111 9.59934C4.74099 9.85904 4.37559 10 4.00025 10C3.60651 10 3.22717 9.84621 2.93914 9.56111L0.439143 7.06111C-0.146381 6.47558 -0.146381 5.52542 0.439143 4.93989C1.02467 4.35437 1.97483 4.35437 2.56036 4.93989L4.03524 6.41478Z", fill: "currentColor" }))),
39
39
  React.createElement("span", { className: cl("navds-checkbox__content", {
40
40
  "navds-sr-only": props.hideLabel,
@@ -1 +1 @@
1
- {"version":3,"file":"Checkbox.js","sourceRoot":"","sources":["../../../src/form/checkbox/Checkbox.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,MAAM,CAAC;AACtB,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAC1C,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAClC,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,OAAO,WAAW,MAAM,eAAe,CAAC;AAExC,MAAM,CAAC,MAAM,QAAQ,GAAG,UAAU,CAChC,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE;IACb,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,WAAW,CAAC,KAAK,CAAC,CAAC;IAE5E,OAAO,CACL,6BACE,SAAS,EAAE,EAAE,CACX,KAAK,CAAC,SAAS,EACf,gBAAgB,EAChB,mBAAmB,IAAI,EAAE,EACzB;YACE,uBAAuB,EAAE,QAAQ;YACjC,0BAA0B,EAAE,UAAU,CAAC,QAAQ;YAC/C,0BAA0B,EAAE,QAAQ;SACrC,CACF;QAED,+CACM,IAAI,CAAC,KAAK,EAAE;YACd,UAAU;YACV,MAAM;YACN,OAAO;YACP,aAAa;YACb,WAAW;YACX,eAAe;YACf,SAAS;YACT,UAAU;SACX,CAAC,EACE,UAAU,IACd,IAAI,EAAC,UAAU,EACf,SAAS,EAAC,uBAAuB,kBACnB,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,UAAU,CAAC,OAAO,EAChE,GAAG,EAAE,CAAC,EAAE,EAAE,EAAE;;gBACV,IAAI,EAAE,EAAE,CAAC;oBACP,EAAE,CAAC,aAAa,GAAG,MAAA,KAAK,CAAC,aAAa,m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AC;gBACV,CAAC;qBAAM,IAAI,GAAG,IAAI,IAAI,EAAE,CAAC;oBACvB,GAAG,CAAC,OAAO,GAAG,EAAE,CAAC;gBACnB,CAAC;YACH,CAAC,IACD;QACF,+BAAO,OAAO,EAAE,UAAU,CAAC,EAAE,EAAE,SAAS,EAAC,uBAAuB;YAC9D,8BAAM,SAAS,EAAC,sBAAsB;gBACpC,6BACE,KAAK,EAAC,4BAA4B,EAClC,KAAK,EAAC,WAAW,EACjB,MAAM,EAAC,UAAU,EACjB,OAAO,EAAC,WAAW,EACnB,IAAI,EAAC,MAAM,EACX,SAAS,EAAE,KAAK,EAChB,IAAI,EAAC,KAAK;oBAGV,8BACE,CAAC,EAAC,6WAA6W,EAC/W,IAAI,EAAC,cAAc,GACnB,CACE,CACD;YACP,8BACE,SAAS,EAAE,EAAE,CAAC,yBAAyB,EAAE;oBACvC,eAAe,EAAE,KAAK,CAAC,SAAS;iBACjC,CAAC;gBAEF,oBAAC,SAAS,IACR,EAAE,EAAC,MAAM,EACT,IAAI,EAAE,IAAI,EACV,SAAS,EAAC,4BAA4B;oBAErC,CAAC,MAAM,IAAI,CACV,oBAAC,YAAY,IAAC,QAAQ,EAAE,QAAQ,EAAE,cAAc,EAAE,KAAK,GAAI,CAC5D;oBACA,KAAK,CAAC,QAAQ,CACL;gBACX,KAAK,CAAC,WAAW,IAAI,CACpB,oBAAC,SAAS,IACR,EAAE,EAAC,MAAM,EACT,IAAI,EAAE,IAAI,EACV,SAAS,EAAC,8DAA8D,IAEvE,KAAK,CAAC,WAAW,CACR,CACb,CACI,CACD,CACJ,CACP,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,QAAQ,CAAC"}
@@ -34,18 +34,21 @@ export interface ModalProps extends React.DialogHTMLAttributes<HTMLDialogElement
34
34
  */
35
35
  onClose?: React.ReactEventHandler<HTMLDialogElement>;
36
36
  /**
37
- * Called when the user wants to close the modal (clicked the close button or pressed Esc).
37
+ * Called when the user tries to close the modal by one of the built-in methods.
38
+ * Used if you want to ask the user for confirmation before closing.
39
+ * @warning Will not always be called when pressing Esc. See `onCancel` for more info.
38
40
  * @returns Whether to close the modal
39
41
  */
40
42
  onBeforeClose?: () => boolean | void;
41
43
  /**
42
- * Called when the user presses the Esc key, unless `onBeforeClose()` returns `false`.
44
+ * *Sometimes** called when the user presses the Esc key, unless you return `false` in `onBeforeClose()`.
45
+ * @warning *Some browsers does not always trigger this event. Chrome only triggers it if you have
46
+ * interacted with the modal, and will not trigger it a second time if you press Esc twice in a row.
43
47
  */
44
48
  onCancel?: React.ReactEventHandler<HTMLDialogElement>;
45
49
  /**
46
50
  * Whether to close when clicking on the backdrop.
47
- *
48
- * **WARNING:** Users may click outside by accident. Don't use if closing can cause data loss, or the modal contains important info.
51
+ * @warning Users may click outside by accident. Don't use if closing can cause data loss, or the modal contains important info.
49
52
  * @default false
50
53
  */
51
54
  closeOnBackdropClick?: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@navikt/ds-react",
3
- "version": "5.12.0",
3
+ "version": "5.12.2",
4
4
  "description": "Aksel react-components for NAV designsystem",
5
5
  "author": "Aksel | NAV designsystem team",
6
6
  "license": "MIT",
@@ -38,8 +38,8 @@
38
38
  },
39
39
  "dependencies": {
40
40
  "@floating-ui/react": "0.25.4",
41
- "@navikt/aksel-icons": "^5.12.0",
42
- "@navikt/ds-tokens": "^5.12.0",
41
+ "@navikt/aksel-icons": "^5.12.2",
42
+ "@navikt/ds-tokens": "^5.12.2",
43
43
  "@radix-ui/react-tabs": "1.0.0",
44
44
  "@radix-ui/react-toggle-group": "1.0.0",
45
45
  "clsx": "^1.2.1",
@@ -74,6 +74,7 @@ export const DateWrapper = ({
74
74
  variant="tertiary"
75
75
  onClick={() => modalRef?.current?.close()}
76
76
  size="small"
77
+ type="button"
77
78
  >
78
79
  {modalCloseButtonLabel(locale)}
79
80
  </Button>
@@ -54,8 +54,8 @@ export const Checkbox = forwardRef<HTMLInputElement, CheckboxProps>(
54
54
  <span className="navds-checkbox__icon">
55
55
  <svg
56
56
  xmlns="http://www.w3.org/2000/svg"
57
- width="13"
58
- height="10"
57
+ width="0.8125rem"
58
+ height="0.625rem"
59
59
  viewBox="0 0 13 10"
60
60
  fill="none"
61
61
  focusable={false}
@@ -34,18 +34,21 @@ export interface ModalProps
34
34
  */
35
35
  onClose?: React.ReactEventHandler<HTMLDialogElement>;
36
36
  /**
37
- * Called when the user wants to close the modal (clicked the close button or pressed Esc).
37
+ * Called when the user tries to close the modal by one of the built-in methods.
38
+ * Used if you want to ask the user for confirmation before closing.
39
+ * @warning Will not always be called when pressing Esc. See `onCancel` for more info.
38
40
  * @returns Whether to close the modal
39
41
  */
40
42
  onBeforeClose?: () => boolean | void;
41
43
  /**
42
- * Called when the user presses the Esc key, unless `onBeforeClose()` returns `false`.
44
+ * *Sometimes** called when the user presses the Esc key, unless you return `false` in `onBeforeClose()`.
45
+ * @warning *Some browsers does not always trigger this event. Chrome only triggers it if you have
46
+ * interacted with the modal, and will not trigger it a second time if you press Esc twice in a row.
43
47
  */
44
48
  onCancel?: React.ReactEventHandler<HTMLDialogElement>;
45
49
  /**
46
50
  * Whether to close when clicking on the backdrop.
47
- *
48
- * **WARNING:** Users may click outside by accident. Don't use if closing can cause data loss, or the modal contains important info.
51
+ * @warning Users may click outside by accident. Don't use if closing can cause data loss, or the modal contains important info.
49
52
  * @default false
50
53
  */
51
54
  closeOnBackdropClick?: boolean;