@navikt/ds-react 5.7.3 → 5.7.5
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 +17 -17
- package/cjs/popover/Popover.js +3 -1
- package/esm/loader/Loader.d.ts +7 -1
- package/esm/loader/Loader.js.map +1 -1
- package/esm/popover/Popover.js +3 -1
- package/esm/popover/Popover.js.map +1 -1
- package/package.json +3 -3
- package/src/date/datepicker/datepicker.stories.tsx +42 -2
- package/src/loader/Loader.tsx +7 -1
- package/src/loader/loader.stories.tsx +3 -3
- package/src/popover/Popover.tsx +3 -1
package/_docs.json
CHANGED
|
@@ -5656,46 +5656,46 @@
|
|
|
5656
5656
|
"name": "\"neutral\" | \"interaction\" | \"inverted\""
|
|
5657
5657
|
}
|
|
5658
5658
|
},
|
|
5659
|
-
"
|
|
5659
|
+
"ref": {
|
|
5660
5660
|
"defaultValue": null,
|
|
5661
|
-
"description": "",
|
|
5662
|
-
"name": "
|
|
5661
|
+
"description": "Allows getting a ref to the component instance.\nOnce the component unmounts, React will set `ref.current` to `null` (or call the ref with `null` if you passed a callback ref).\n@see https://react.dev/learn/referencing-values-with-refs#refs-and-the-dom\n@see https://react.dev/learn/referencing-values-with-refs#refs-and-the-dom",
|
|
5662
|
+
"name": "ref",
|
|
5663
5663
|
"parent": {
|
|
5664
|
-
"fileName": "
|
|
5665
|
-
"name": "
|
|
5664
|
+
"fileName": "src/loader/Loader.tsx",
|
|
5665
|
+
"name": "LoaderProps"
|
|
5666
5666
|
},
|
|
5667
5667
|
"declarations": [
|
|
5668
|
+
{
|
|
5669
|
+
"fileName": "src/loader/Loader.tsx",
|
|
5670
|
+
"name": "LoaderProps"
|
|
5671
|
+
},
|
|
5668
5672
|
{
|
|
5669
5673
|
"fileName": "aksel/node_modules/@types/react/index.d.ts",
|
|
5670
|
-
"name": "
|
|
5674
|
+
"name": "RefAttributes"
|
|
5671
5675
|
}
|
|
5672
5676
|
],
|
|
5673
5677
|
"required": false,
|
|
5674
5678
|
"type": {
|
|
5675
|
-
"name": "
|
|
5679
|
+
"name": "Ref<SVGSVGElement>"
|
|
5676
5680
|
}
|
|
5677
5681
|
},
|
|
5678
|
-
"
|
|
5682
|
+
"className": {
|
|
5679
5683
|
"defaultValue": null,
|
|
5680
|
-
"description": "
|
|
5681
|
-
"name": "
|
|
5684
|
+
"description": "",
|
|
5685
|
+
"name": "className",
|
|
5682
5686
|
"parent": {
|
|
5683
5687
|
"fileName": "aksel/node_modules/@types/react/index.d.ts",
|
|
5684
|
-
"name": "
|
|
5688
|
+
"name": "SVGAttributes"
|
|
5685
5689
|
},
|
|
5686
5690
|
"declarations": [
|
|
5687
5691
|
{
|
|
5688
5692
|
"fileName": "aksel/node_modules/@types/react/index.d.ts",
|
|
5689
|
-
"name": "
|
|
5690
|
-
},
|
|
5691
|
-
{
|
|
5692
|
-
"fileName": "aksel/node_modules/@types/react/index.d.ts",
|
|
5693
|
-
"name": "RefAttributes"
|
|
5693
|
+
"name": "SVGAttributes"
|
|
5694
5694
|
}
|
|
5695
5695
|
],
|
|
5696
5696
|
"required": false,
|
|
5697
5697
|
"type": {
|
|
5698
|
-
"name": "
|
|
5698
|
+
"name": "string"
|
|
5699
5699
|
}
|
|
5700
5700
|
}
|
|
5701
5701
|
}
|
package/cjs/popover/Popover.js
CHANGED
|
@@ -69,6 +69,7 @@ exports.Popover = (0, react_2.forwardRef)((_a, ref) => {
|
|
|
69
69
|
const arrowRef = (0, react_2.useRef)(null);
|
|
70
70
|
const isInModal = (0, react_2.useContext)(ModalContext_1.ModalContext) !== null;
|
|
71
71
|
const chosenStrategy = userStrategy !== null && userStrategy !== void 0 ? userStrategy : (isInModal ? "fixed" : "absolute");
|
|
72
|
+
const chosenFlip = isInModal ? true : _flip;
|
|
72
73
|
const { x, y, strategy, context, update, refs, placement: flPlacement, middlewareData: { arrow: { x: arrowX, y: arrowY } = {} }, } = (0, react_1.useFloating)({
|
|
73
74
|
strategy: chosenStrategy,
|
|
74
75
|
placement,
|
|
@@ -76,7 +77,8 @@ exports.Popover = (0, react_2.forwardRef)((_a, ref) => {
|
|
|
76
77
|
onOpenChange: () => onClose(),
|
|
77
78
|
middleware: [
|
|
78
79
|
(0, react_1.offset)(offset !== null && offset !== void 0 ? offset : (arrow ? 16 : 4)),
|
|
79
|
-
|
|
80
|
+
chosenFlip &&
|
|
81
|
+
(0, react_1.flip)({ padding: 5, fallbackPlacements: ["bottom", "top"] }),
|
|
80
82
|
(0, react_1.shift)({ padding: 12 }),
|
|
81
83
|
(0, react_1.arrow)({ element: arrowRef, padding: 8 }),
|
|
82
84
|
],
|
package/esm/loader/Loader.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { SVGProps } from "react";
|
|
2
|
-
export interface LoaderProps extends SVGProps<SVGSVGElement> {
|
|
2
|
+
export interface LoaderProps extends Omit<SVGProps<SVGSVGElement>, "ref"> {
|
|
3
3
|
/**
|
|
4
4
|
* Changes Loader width/height
|
|
5
5
|
* 88px | 64px | 40px | 32px | 24px | 20px | 16px
|
|
@@ -21,6 +21,12 @@ export interface LoaderProps extends SVGProps<SVGSVGElement> {
|
|
|
21
21
|
* @default "neutral"
|
|
22
22
|
*/
|
|
23
23
|
variant?: "neutral" | "interaction" | "inverted";
|
|
24
|
+
/**
|
|
25
|
+
* Allows getting a ref to the component instance.
|
|
26
|
+
* Once the component unmounts, React will set `ref.current` to `null` (or call the ref with `null` if you passed a callback ref).
|
|
27
|
+
* @see https://react.dev/learn/referencing-values-with-refs#refs-and-the-dom
|
|
28
|
+
*/
|
|
29
|
+
ref?: React.Ref<SVGSVGElement>;
|
|
24
30
|
}
|
|
25
31
|
export type LoaderType = React.ForwardRefExoticComponent<LoaderProps & React.RefAttributes<SVGSVGElement>>;
|
|
26
32
|
/**
|
package/esm/loader/Loader.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Loader.js","sourceRoot":"","sources":["../../src/loader/Loader.t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,EAAC,0BAA0B,EACpC,KAAK,EAAC,4BAA4B,EAClC,EAAE,EAAC,IAAI,EACP,EAAE,EAAC,IAAI,EACP,CAAC,EAAC,IAAI,EACN,IAAI,EAAC,MAAM,GACX;QACF,gCACE,SAAS,EAAC,0BAA0B,EACpC,EAAE,EAAC,IAAI,EACP,EAAE,EAAC,IAAI,EACP,CAAC,EAAC,IAAI,EACN,IAAI,EAAC,MAAM,EACX,eAAe,EAAC,QAAQ,GACxB,CACE,CACP,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
package/esm/popover/Popover.js
CHANGED
|
@@ -40,6 +40,7 @@ export const Popover = forwardRef((_a, ref) => {
|
|
|
40
40
|
const arrowRef = useRef(null);
|
|
41
41
|
const isInModal = useContext(ModalContext) !== null;
|
|
42
42
|
const chosenStrategy = userStrategy !== null && userStrategy !== void 0 ? userStrategy : (isInModal ? "fixed" : "absolute");
|
|
43
|
+
const chosenFlip = isInModal ? true : _flip;
|
|
43
44
|
const { x, y, strategy, context, update, refs, placement: flPlacement, middlewareData: { arrow: { x: arrowX, y: arrowY } = {} }, } = useFloating({
|
|
44
45
|
strategy: chosenStrategy,
|
|
45
46
|
placement,
|
|
@@ -47,7 +48,8 @@ export const Popover = forwardRef((_a, ref) => {
|
|
|
47
48
|
onOpenChange: () => onClose(),
|
|
48
49
|
middleware: [
|
|
49
50
|
flOffset(offset !== null && offset !== void 0 ? offset : (arrow ? 16 : 4)),
|
|
50
|
-
|
|
51
|
+
chosenFlip &&
|
|
52
|
+
flip({ padding: 5, fallbackPlacements: ["bottom", "top"] }),
|
|
51
53
|
shift({ padding: 12 }),
|
|
52
54
|
flArrow({ element: arrowRef, padding: 8 }),
|
|
53
55
|
],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Popover.js","sourceRoot":"","sources":["../../src/popover/Popover.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,EACL,UAAU,EACV,KAAK,IAAI,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QAChB,KAAK,EAAE;YACL,QAAQ,EAAE,QAAQ;YAClB,GAAG,EAAE,CAAC,aAAD,CAAC,cAAD,CAAC,GAAI,CAAC;YACX,IAAI,EAAE,CAAC,aAAD,CAAC,cAAD,CAAC,GAAI,CAAC;SACb;QACD,QAAQ,EAAE,SAAS;KACpB,CAAC,EACE,IAAI;QAEP,QAAQ;QACR,KAAK,IAAI,CACR,6BACE,GAAG,EAAE,CAAC,IAAI,EAAE,EAAE;gBACZ,QAAQ,CAAC,OAAO,GAAG,IAAI,CAAC;YAC1B,CAAC,EACD,KAAK,gDACA,CAAC,MAAM,IAAI,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,GACxC,CAAC,MAAM,IAAI,IAAI,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,GACvC,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,CAAC,UAAU,CAAC,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,GAEpD,SAAS,EAAC,sBAAsB,GAChC,CACH,CACG,CACP,CAAC;AACJ,CAAC,CACkB,CAAC;AAEtB,OAAO,CAAC,OAAO,GAAG,cAAc,CAAC;AAEjC,eAAe,OAAO,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@navikt/ds-react",
|
|
3
|
-
"version": "5.7.
|
|
3
|
+
"version": "5.7.5",
|
|
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.7.
|
|
42
|
-
"@navikt/ds-tokens": "^5.7.
|
|
41
|
+
"@navikt/aksel-icons": "^5.7.5",
|
|
42
|
+
"@navikt/ds-tokens": "^5.7.5",
|
|
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",
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
/* eslint-disable react-hooks/rules-of-hooks */
|
|
2
2
|
import { Meta, StoryObj } from "@storybook/react";
|
|
3
|
+
import isSameDay from "date-fns/isSameDay";
|
|
3
4
|
import React, { useId, useState } from "react";
|
|
4
5
|
import { useDatepicker, useRangeDatepicker } from "..";
|
|
5
|
-
import { Button, HGrid, VStack } from "../..";
|
|
6
|
+
import { BodyLong, Button, HGrid, HStack, Modal, VStack } from "../..";
|
|
7
|
+
|
|
6
8
|
import DatePicker, { DatePickerProps } from "./DatePicker";
|
|
7
|
-
import isSameDay from "date-fns/isSameDay";
|
|
8
9
|
|
|
9
10
|
const disabledDays = [
|
|
10
11
|
new Date("Oct 10 2022"),
|
|
@@ -432,3 +433,42 @@ export const WeekDayClick = () => {
|
|
|
432
433
|
</VStack>
|
|
433
434
|
);
|
|
434
435
|
};
|
|
436
|
+
|
|
437
|
+
export const ModalDemo = () => {
|
|
438
|
+
const { datepickerProps, inputProps } = useDatepicker({
|
|
439
|
+
fromDate: new Date("Aug 23 2019"),
|
|
440
|
+
toDate: new Date("Feb 23 2024"),
|
|
441
|
+
onDateChange: console.log,
|
|
442
|
+
});
|
|
443
|
+
|
|
444
|
+
return (
|
|
445
|
+
<Modal open header={{ heading: "Modal-demo" }} width="1024px">
|
|
446
|
+
<Modal.Body style={{ position: "relative" }}>
|
|
447
|
+
<BodyLong>
|
|
448
|
+
Lorem ipsum dolor sit, amet consectetur adipisicing elit. Maiores nisi
|
|
449
|
+
incidunt ipsum cupiditate nostrum nesciunt, corrupti nihil at atque
|
|
450
|
+
animi ab aut. Quam iusto harum eligendi magnam nulla repudiandae
|
|
451
|
+
molestias.
|
|
452
|
+
</BodyLong>
|
|
453
|
+
|
|
454
|
+
<HGrid gap="6" columns={{ xs: 1, lg: 2 }}>
|
|
455
|
+
<HStack justify="center" align="start">
|
|
456
|
+
<DatePicker.Standalone
|
|
457
|
+
fromDate={new Date("Aug 23 2019")}
|
|
458
|
+
toDate={new Date("Feb 23 2024")}
|
|
459
|
+
/>
|
|
460
|
+
</HStack>
|
|
461
|
+
<DatePicker {...datepickerProps} dropdownCaption>
|
|
462
|
+
<DatePicker.Input {...inputProps} label="Velg dato" />
|
|
463
|
+
</DatePicker>
|
|
464
|
+
<HStack justify="center">
|
|
465
|
+
<DatePicker.Standalone
|
|
466
|
+
fromDate={new Date("Aug 23 2019")}
|
|
467
|
+
toDate={new Date("Feb 23 2024")}
|
|
468
|
+
/>
|
|
469
|
+
</HStack>
|
|
470
|
+
</HGrid>
|
|
471
|
+
</Modal.Body>
|
|
472
|
+
</Modal>
|
|
473
|
+
);
|
|
474
|
+
};
|
package/src/loader/Loader.tsx
CHANGED
|
@@ -2,7 +2,7 @@ import cl from "clsx";
|
|
|
2
2
|
import React, { forwardRef, SVGProps } from "react";
|
|
3
3
|
import { omit, useId } from "../util";
|
|
4
4
|
|
|
5
|
-
export interface LoaderProps extends SVGProps<SVGSVGElement> {
|
|
5
|
+
export interface LoaderProps extends Omit<SVGProps<SVGSVGElement>, "ref"> {
|
|
6
6
|
/**
|
|
7
7
|
* Changes Loader width/height
|
|
8
8
|
* 88px | 64px | 40px | 32px | 24px | 20px | 16px
|
|
@@ -31,6 +31,12 @@ export interface LoaderProps extends SVGProps<SVGSVGElement> {
|
|
|
31
31
|
* @default "neutral"
|
|
32
32
|
*/
|
|
33
33
|
variant?: "neutral" | "interaction" | "inverted";
|
|
34
|
+
/**
|
|
35
|
+
* Allows getting a ref to the component instance.
|
|
36
|
+
* Once the component unmounts, React will set `ref.current` to `null` (or call the ref with `null` if you passed a callback ref).
|
|
37
|
+
* @see https://react.dev/learn/referencing-values-with-refs#refs-and-the-dom
|
|
38
|
+
*/
|
|
39
|
+
ref?: React.Ref<SVGSVGElement>;
|
|
34
40
|
}
|
|
35
41
|
|
|
36
42
|
/* Workaround for @types/react v17/v18 feil */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { Loader } from "..";
|
|
3
1
|
import { Meta } from "@storybook/react";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { Loader, LoaderProps } from "..";
|
|
4
4
|
export default {
|
|
5
5
|
title: "ds-react/Loader",
|
|
6
6
|
component: Loader,
|
|
@@ -29,7 +29,7 @@ export default {
|
|
|
29
29
|
} as Meta;
|
|
30
30
|
|
|
31
31
|
export const Default = {
|
|
32
|
-
render: (props:
|
|
32
|
+
render: (props: LoaderProps) => {
|
|
33
33
|
return <Loader {...props} />;
|
|
34
34
|
},
|
|
35
35
|
|
package/src/popover/Popover.tsx
CHANGED
|
@@ -133,6 +133,7 @@ export const Popover = forwardRef<HTMLDivElement, PopoverProps>(
|
|
|
133
133
|
const arrowRef = useRef<HTMLDivElement | null>(null);
|
|
134
134
|
const isInModal = useContext(ModalContext) !== null;
|
|
135
135
|
const chosenStrategy = userStrategy ?? (isInModal ? "fixed" : "absolute");
|
|
136
|
+
const chosenFlip = isInModal ? true : _flip;
|
|
136
137
|
|
|
137
138
|
const {
|
|
138
139
|
x,
|
|
@@ -150,7 +151,8 @@ export const Popover = forwardRef<HTMLDivElement, PopoverProps>(
|
|
|
150
151
|
onOpenChange: () => onClose(),
|
|
151
152
|
middleware: [
|
|
152
153
|
flOffset(offset ?? (arrow ? 16 : 4)),
|
|
153
|
-
|
|
154
|
+
chosenFlip &&
|
|
155
|
+
flip({ padding: 5, fallbackPlacements: ["bottom", "top"] }),
|
|
154
156
|
shift({ padding: 12 }),
|
|
155
157
|
flArrow({ element: arrowRef, padding: 8 }),
|
|
156
158
|
],
|