@norges-domstoler/dds-components 5.1.0 → 5.2.0-beta.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/README.md +6 -0
- package/dist/assets/svg/calendar_today.svg.js +1 -1
- package/dist/cjs/components/Drawer/DrawerGroup.d.ts +1 -1
- package/dist/cjs/components/OverflowMenu/OverflowMenuGroup.d.ts +1 -1
- package/dist/cjs/components/Popover/PopoverGroup.d.ts +1 -1
- package/dist/cjs/components/RadioButton/RadioButton.d.ts +2 -0
- package/dist/cjs/components/RadioButton/RadioButton.stories.d.ts +2 -0
- package/dist/cjs/components/RadioButton/RadioButton.types.d.ts +2 -2
- package/dist/cjs/components/Stepper/Step.d.ts +20 -0
- package/dist/cjs/components/Stepper/Stepper.context.d.ts +6 -0
- package/dist/cjs/components/Stepper/Stepper.d.ts +11 -0
- package/dist/cjs/components/Stepper/Stepper.stories.d.ts +25 -0
- package/dist/cjs/components/Stepper/Stepper.tokens.d.ts +39 -0
- package/dist/cjs/components/Stepper/index.d.ts +2 -0
- package/dist/cjs/helpers/Chevron/AnimatedChevronUpDown.d.ts +1 -1
- package/dist/cjs/hooks/useRoveFocus.d.ts +2 -1
- package/dist/cjs/index.d.ts +1 -0
- package/dist/cjs/index.js +274 -53
- package/dist/components/Datepicker/Datepicker.js +1 -1
- package/dist/components/Drawer/DrawerGroup.d.ts +1 -1
- package/dist/components/List/List.js +1 -1
- package/dist/components/OverflowMenu/OverflowMenuGroup.d.ts +1 -1
- package/dist/components/Popover/PopoverGroup.d.ts +1 -1
- package/dist/components/RadioButton/RadioButton.d.ts +2 -0
- package/dist/components/RadioButton/RadioButton.stories.d.ts +2 -0
- package/dist/components/RadioButton/RadioButton.types.d.ts +2 -2
- package/dist/components/Stepper/Step.d.ts +20 -0
- package/dist/components/Stepper/Step.js +114 -0
- package/dist/components/Stepper/Stepper.context.d.ts +6 -0
- package/dist/components/Stepper/Stepper.context.js +10 -0
- package/dist/components/Stepper/Stepper.d.ts +11 -0
- package/dist/components/Stepper/Stepper.js +66 -0
- package/dist/components/Stepper/Stepper.stories.d.ts +25 -0
- package/dist/components/Stepper/Stepper.tokens.d.ts +39 -0
- package/dist/components/Stepper/Stepper.tokens.js +49 -0
- package/dist/components/Stepper/index.d.ts +2 -0
- package/dist/components/VisuallyHidden/VisuallyHidden.js +1 -1
- package/dist/helpers/Chevron/AnimatedChevronUpDown.d.ts +1 -1
- package/dist/hooks/useRoveFocus.d.ts +2 -1
- package/dist/hooks/useRoveFocus.js +9 -6
- package/dist/index.d.ts +1 -0
- package/dist/index.js +2 -0
- package/package.json +51 -44
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
|
+
import styled, { css } from 'styled-components';
|
|
3
|
+
import { useStepperContext } from './Stepper.context.js';
|
|
4
|
+
import { stepperTokens } from './Stepper.tokens.js';
|
|
5
|
+
import { VisuallyHidden } from '../VisuallyHidden/VisuallyHidden.js';
|
|
6
|
+
import { focusVisibleTransitionValue, focusVisible } from '../../helpers/styling/focusVisible.js';
|
|
7
|
+
|
|
8
|
+
var toStepState = function toStepState(active, completed) {
|
|
9
|
+
return active ? completed ? 'activeCompleted' : 'activeIncomplete' : completed ? 'inactiveCompleted' : 'inactiveIncomplete';
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
var stepNumber = stepperTokens.stepNumber,
|
|
13
|
+
connector = stepperTokens.connector,
|
|
14
|
+
stepButton = stepperTokens.stepButton;
|
|
15
|
+
var stepSize = '40px';
|
|
16
|
+
var StepWrapper = styled.li.withConfig({
|
|
17
|
+
displayName: "Step__StepWrapper",
|
|
18
|
+
componentId: "sc-5n6xpp-0"
|
|
19
|
+
})(["flex:1;position:relative;display:flex;justify-content:center;:not(:last-child):after{content:'';display:block;border-top:1px solid ", ";position:absolute;width:100%;left:50%;top:calc(", " / 2);}"], connector.color, stepSize);
|
|
20
|
+
var StepContentWrapper = styled.div.withConfig({
|
|
21
|
+
displayName: "Step__StepContentWrapper",
|
|
22
|
+
componentId: "sc-5n6xpp-1"
|
|
23
|
+
})(["background:none;border:none;margin:0;padding:0;display:flex;flex-direction:column;align-items:center;transition:", ";:focus-visible{", "}", ""], focusVisibleTransitionValue, focusVisible, function (_ref) {
|
|
24
|
+
var clickable = _ref.clickable;
|
|
25
|
+
return clickable && css(["cursor:pointer;"]);
|
|
26
|
+
});
|
|
27
|
+
var StepNumber = styled.div.withConfig({
|
|
28
|
+
displayName: "Step__StepNumber",
|
|
29
|
+
componentId: "sc-5n6xpp-2"
|
|
30
|
+
})(["border-radius:50%;border:1px solid;padding:5px;width:", ";height:", ";display:flex;align-items:center;justify-content:center;z-index:2;", ""], stepSize, stepSize, function (_ref2) {
|
|
31
|
+
var state = _ref2.state;
|
|
32
|
+
|
|
33
|
+
switch (state) {
|
|
34
|
+
case 'activeIncomplete':
|
|
35
|
+
return css(["border-color:", ";color:", ";background-color:", ";"], stepNumber.active.borderColor, stepNumber.active.color, stepNumber.active.backgroundColor);
|
|
36
|
+
|
|
37
|
+
case 'activeCompleted':
|
|
38
|
+
case 'inactiveCompleted':
|
|
39
|
+
return css(["border-color:", ";color:", ";background-color:", ";"], stepNumber.completed.borderColor, stepNumber.completed.color, stepNumber.completed.backgroundColor);
|
|
40
|
+
|
|
41
|
+
case 'inactiveIncomplete':
|
|
42
|
+
return css(["border-color:", ";color:", ";background-color:", ";"], stepNumber.inactive.borderColor, stepNumber.inactive.color, stepNumber.inactive.backgroundColor);
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
var StepCompletedCheck = styled.div.withConfig({
|
|
46
|
+
displayName: "Step__StepCompletedCheck",
|
|
47
|
+
componentId: "sc-5n6xpp-3"
|
|
48
|
+
})(["border:solid ", ";border-width:0 2px 2px 0;transform:rotate(45deg);width:27.5%;height:55%;margin-top:-2px;"], stepNumber.completed.color);
|
|
49
|
+
var StepText = styled.div.withConfig({
|
|
50
|
+
displayName: "Step__StepText",
|
|
51
|
+
componentId: "sc-5n6xpp-4"
|
|
52
|
+
})(["font-family:", ";font-size:", ";margin-top:", ";", ""], stepButton.fontFamily, stepButton.fontSize, stepButton.marginTop, function (_ref3) {
|
|
53
|
+
var state = _ref3.state,
|
|
54
|
+
clickable = _ref3.clickable;
|
|
55
|
+
|
|
56
|
+
switch (state) {
|
|
57
|
+
case 'activeCompleted':
|
|
58
|
+
case 'activeIncomplete':
|
|
59
|
+
return css(["color:", ";text-decoration ", ";"], stepButton.active.color, clickable ? stepButton.active.textDecoration : 'none');
|
|
60
|
+
|
|
61
|
+
case 'inactiveCompleted':
|
|
62
|
+
return css(["color:", ";text-decoration ", ";"], stepButton.completed.color, clickable ? stepButton.completed.textDecoration : 'none');
|
|
63
|
+
|
|
64
|
+
case 'inactiveIncomplete':
|
|
65
|
+
return css(["color:", ";text-decoration ", ";"], stepButton.inactive.color, clickable ? stepButton.inactive.textDecoration : 'none');
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
var getVisuallyHiddenText = function getVisuallyHiddenText(active, completed) {
|
|
70
|
+
return "".concat(active ? '' : 'Trinn, ').concat(completed ? 'Ferdig, ' : 'Ikke ferdig, ');
|
|
71
|
+
};
|
|
72
|
+
/**
|
|
73
|
+
* @beta Denne komponenten er ikke ferdig og endringer kan gjøres utenfor semver.
|
|
74
|
+
*/
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
var Step = function Step(props) {
|
|
78
|
+
var _props$index = props.index,
|
|
79
|
+
index = _props$index === void 0 ? 0 : _props$index,
|
|
80
|
+
_props$completed = props.completed,
|
|
81
|
+
completed = _props$completed === void 0 ? false : _props$completed,
|
|
82
|
+
children = props.children;
|
|
83
|
+
|
|
84
|
+
var _useStepperContext = useStepperContext(),
|
|
85
|
+
activeStep = _useStepperContext.activeStep;
|
|
86
|
+
|
|
87
|
+
var active = activeStep === index;
|
|
88
|
+
var styleProps = {
|
|
89
|
+
state: toStepState(active, completed),
|
|
90
|
+
clickable: props.onClick !== undefined
|
|
91
|
+
};
|
|
92
|
+
return jsx(StepWrapper, Object.assign({
|
|
93
|
+
"aria-current": active ? 'step' : undefined
|
|
94
|
+
}, {
|
|
95
|
+
children: jsxs(StepContentWrapper, Object.assign({}, styleProps, {
|
|
96
|
+
as: props.onClick ? 'button' : 'div',
|
|
97
|
+
onClick: props.onClick ? function () {
|
|
98
|
+
return props.onClick(index);
|
|
99
|
+
} : undefined
|
|
100
|
+
}, {
|
|
101
|
+
children: [jsx(StepNumber, Object.assign({}, styleProps, {
|
|
102
|
+
children: completed ? jsx(StepCompletedCheck, {}) : index + 1
|
|
103
|
+
})), jsxs(StepText, Object.assign({}, styleProps, {
|
|
104
|
+
children: [jsx(VisuallyHidden, Object.assign({
|
|
105
|
+
as: "span"
|
|
106
|
+
}, {
|
|
107
|
+
children: getVisuallyHiddenText(active, completed)
|
|
108
|
+
})), children]
|
|
109
|
+
}))]
|
|
110
|
+
}))
|
|
111
|
+
}));
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
export { Step };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { createContext, useContext } from 'react';
|
|
2
|
+
|
|
3
|
+
var StepperContext = /*#__PURE__*/createContext({
|
|
4
|
+
activeStep: 0
|
|
5
|
+
});
|
|
6
|
+
var useStepperContext = function useStepperContext() {
|
|
7
|
+
return useContext(StepperContext);
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export { StepperContext, useStepperContext };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @beta Denne komponenten er ikke ferdig og endringer kan gjøres utenfor semver.
|
|
3
|
+
*/
|
|
4
|
+
export declare const Stepper: import("react").ForwardRefExoticComponent<{
|
|
5
|
+
htmlProps?: import("react").HTMLAttributes<HTMLDivElement> | undefined;
|
|
6
|
+
} & Pick<import("react").HTMLAttributes<HTMLDivElement>, "id" | "className"> & {
|
|
7
|
+
/** Indeksen til det aktive steget. */
|
|
8
|
+
activeStep?: number | undefined;
|
|
9
|
+
} & {
|
|
10
|
+
children?: import("react").ReactNode;
|
|
11
|
+
} & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { slicedToArray as _slicedToArray } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
|
2
|
+
import { __rest } from 'tslib';
|
|
3
|
+
import { jsx } from 'react/jsx-runtime';
|
|
4
|
+
import { forwardRef, useState, useEffect, Children, isValidElement, cloneElement } from 'react';
|
|
5
|
+
import styled from 'styled-components';
|
|
6
|
+
import { StepperContext } from './Stepper.context.js';
|
|
7
|
+
import { getBaseHTMLProps } from '../../types/BaseComponentProps.js';
|
|
8
|
+
|
|
9
|
+
var StepsWrapper = styled.ol.withConfig({
|
|
10
|
+
displayName: "Stepper__StepsWrapper",
|
|
11
|
+
componentId: "sc-4w2c73-0"
|
|
12
|
+
})(["display:flex;margin:0;padding:0;"]);
|
|
13
|
+
/**
|
|
14
|
+
* @beta Denne komponenten er ikke ferdig og endringer kan gjøres utenfor semver.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
var Stepper = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
18
|
+
var _a;
|
|
19
|
+
|
|
20
|
+
var id = props.id,
|
|
21
|
+
_props$activeStep = props.activeStep,
|
|
22
|
+
activeStep = _props$activeStep === void 0 ? 0 : _props$activeStep,
|
|
23
|
+
children = props.children,
|
|
24
|
+
className = props.className,
|
|
25
|
+
htmlProps = props.htmlProps,
|
|
26
|
+
rest = __rest(props, ["id", "activeStep", "children", "className", "htmlProps"]);
|
|
27
|
+
|
|
28
|
+
var _useState = useState(activeStep),
|
|
29
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
30
|
+
thisActiveStep = _useState2[0],
|
|
31
|
+
setActiveStep = _useState2[1];
|
|
32
|
+
|
|
33
|
+
useEffect(function () {
|
|
34
|
+
if (activeStep !== undefined && activeStep != thisActiveStep) {
|
|
35
|
+
setActiveStep(activeStep);
|
|
36
|
+
}
|
|
37
|
+
}, [activeStep, thisActiveStep]);
|
|
38
|
+
var containerProps = Object.assign(Object.assign({}, getBaseHTMLProps(id, className, htmlProps, rest)), {
|
|
39
|
+
ref: ref
|
|
40
|
+
});
|
|
41
|
+
var steps = (_a = Children.map(children, function (step, index) {
|
|
42
|
+
if (! /*#__PURE__*/isValidElement(step)) {
|
|
43
|
+
return false;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
return /*#__PURE__*/cloneElement(step, Object.assign(Object.assign({}, step.props), {
|
|
47
|
+
index: index
|
|
48
|
+
}));
|
|
49
|
+
})) === null || _a === void 0 ? void 0 : _a.filter(Boolean);
|
|
50
|
+
return jsx(StepperContext.Provider, Object.assign({
|
|
51
|
+
value: {
|
|
52
|
+
activeStep: thisActiveStep
|
|
53
|
+
}
|
|
54
|
+
}, {
|
|
55
|
+
children: jsx("div", Object.assign({
|
|
56
|
+
role: "group",
|
|
57
|
+
"aria-label": "progress"
|
|
58
|
+
}, containerProps, {
|
|
59
|
+
children: jsx(StepsWrapper, {
|
|
60
|
+
children: steps
|
|
61
|
+
})
|
|
62
|
+
}))
|
|
63
|
+
}));
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
export { Stepper };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
title: string;
|
|
3
|
+
component: import("react").ForwardRefExoticComponent<{
|
|
4
|
+
htmlProps?: import("react").HTMLAttributes<HTMLDivElement> | undefined;
|
|
5
|
+
} & Pick<import("react").HTMLAttributes<HTMLDivElement>, "id" | "className"> & {
|
|
6
|
+
activeStep?: number | undefined;
|
|
7
|
+
} & {
|
|
8
|
+
children?: import("react").ReactNode;
|
|
9
|
+
} & import("react").RefAttributes<HTMLDivElement>>;
|
|
10
|
+
argTypes: {
|
|
11
|
+
color: {
|
|
12
|
+
control: {
|
|
13
|
+
type: string;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
size: {
|
|
17
|
+
control: {
|
|
18
|
+
type: string;
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
export default _default;
|
|
24
|
+
export declare const Overview: () => JSX.Element;
|
|
25
|
+
export declare const NonClickable: () => JSX.Element;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
export declare const stepperTokens: {
|
|
2
|
+
connector: {
|
|
3
|
+
color: string;
|
|
4
|
+
};
|
|
5
|
+
stepNumber: {
|
|
6
|
+
active: {
|
|
7
|
+
borderColor: string;
|
|
8
|
+
color: string;
|
|
9
|
+
backgroundColor: string;
|
|
10
|
+
};
|
|
11
|
+
completed: {
|
|
12
|
+
borderColor: string;
|
|
13
|
+
color: string;
|
|
14
|
+
backgroundColor: string;
|
|
15
|
+
};
|
|
16
|
+
inactive: {
|
|
17
|
+
borderColor: string;
|
|
18
|
+
color: string;
|
|
19
|
+
backgroundColor: string;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
stepButton: {
|
|
23
|
+
marginTop: string;
|
|
24
|
+
fontFamily: string;
|
|
25
|
+
fontSize: string;
|
|
26
|
+
active: {
|
|
27
|
+
color: string;
|
|
28
|
+
textDecoration: string;
|
|
29
|
+
};
|
|
30
|
+
completed: {
|
|
31
|
+
color: string;
|
|
32
|
+
textDecoration: string;
|
|
33
|
+
};
|
|
34
|
+
inactive: {
|
|
35
|
+
color: string;
|
|
36
|
+
textDecoration: string;
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { ddsBaseTokens } from '@norges-domstoler/dds-design-tokens';
|
|
2
|
+
|
|
3
|
+
var colors = ddsBaseTokens.colors,
|
|
4
|
+
spacing = ddsBaseTokens.spacing,
|
|
5
|
+
font = ddsBaseTokens.font;
|
|
6
|
+
var connector = {
|
|
7
|
+
color: colors.DdsColorInteractiveBase
|
|
8
|
+
};
|
|
9
|
+
var stepNumber = {
|
|
10
|
+
active: {
|
|
11
|
+
borderColor: colors.DdsColorInteractiveBase,
|
|
12
|
+
color: colors.DdsColorNeutralsWhite,
|
|
13
|
+
backgroundColor: colors.DdsColorInteractiveBase
|
|
14
|
+
},
|
|
15
|
+
completed: {
|
|
16
|
+
borderColor: colors.DdsColorSuccessLighter,
|
|
17
|
+
color: colors.DdsColorNeutralsGray9,
|
|
18
|
+
backgroundColor: colors.DdsColorSuccessLighter
|
|
19
|
+
},
|
|
20
|
+
inactive: {
|
|
21
|
+
borderColor: colors.DdsColorInteractiveBase,
|
|
22
|
+
color: colors.DdsColorInteractiveBase,
|
|
23
|
+
backgroundColor: colors.DdsColorNeutralsWhite
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
var stepButton = {
|
|
27
|
+
marginTop: spacing.SizesDdsSpacingLayoutX1,
|
|
28
|
+
fontFamily: font.DdsFontSupportingStyleLabel01FontFamily,
|
|
29
|
+
fontSize: font.DdsFontSupportingStyleLabel01FontSize,
|
|
30
|
+
active: {
|
|
31
|
+
color: colors.DdsColorNeutralsGray9,
|
|
32
|
+
textDecoration: 'none'
|
|
33
|
+
},
|
|
34
|
+
completed: {
|
|
35
|
+
color: colors.DdsColorInteractiveBase,
|
|
36
|
+
textDecoration: 'underline'
|
|
37
|
+
},
|
|
38
|
+
inactive: {
|
|
39
|
+
color: colors.DdsColorInteractiveBase,
|
|
40
|
+
textDecoration: 'underline'
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
var stepperTokens = {
|
|
44
|
+
connector: connector,
|
|
45
|
+
stepNumber: stepNumber,
|
|
46
|
+
stepButton: stepButton
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
export { stepperTokens };
|
|
@@ -6,7 +6,7 @@ import { getBaseHTMLProps } from '../../types/BaseComponentProps.js';
|
|
|
6
6
|
var Wrapper = styled.span.withConfig({
|
|
7
7
|
displayName: "VisuallyHidden__Wrapper",
|
|
8
8
|
componentId: "sc-ciubxt-0"
|
|
9
|
-
})(["width:1px;height:1px;margin:0px;padding:0px;top:0px;inset-inline-start:0px;overflow:hidden;clip:rect(
|
|
9
|
+
})(["position:absolute;width:1px;height:1px;margin:0px;padding:0px;top:0px;inset-inline-start:0px;overflow:hidden;clip:rect(0,0,0,0);clip-path:inset(50%);border:0px;"]);
|
|
10
10
|
var VisuallyHidden = function VisuallyHidden(props) {
|
|
11
11
|
var children = props.children,
|
|
12
12
|
id = props.id,
|
|
@@ -4,5 +4,5 @@ declare type SvgChevronProps = {
|
|
|
4
4
|
height?: Property.Height<string>;
|
|
5
5
|
width?: Property.Width<string>;
|
|
6
6
|
};
|
|
7
|
-
export declare const AnimatedChevronUpDown: ({ isUp, height, width }: SvgChevronProps) => JSX.Element;
|
|
7
|
+
export declare const AnimatedChevronUpDown: ({ isUp, height, width, }: SvgChevronProps) => JSX.Element;
|
|
8
8
|
export {};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
import { Dispatch, SetStateAction } from 'react';
|
|
1
|
+
import { Dispatch, SetStateAction, KeyboardEvent } from 'react';
|
|
2
2
|
import { Direction } from '../types';
|
|
3
|
+
export declare const isKeyboardEvent: (e: Event | KeyboardEvent<Element>) => e is KeyboardEvent<Element>;
|
|
3
4
|
export declare function useRoveFocus(size: number | undefined, reset?: boolean, direction?: Direction): [number, Dispatch<SetStateAction<number>>];
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { slicedToArray as _slicedToArray } from '../_virtual/_rollupPluginBabelHelpers.js';
|
|
2
2
|
import { useState, useCallback, useEffect } from 'react';
|
|
3
3
|
|
|
4
|
+
var isKeyboardEvent = function isKeyboardEvent(e) {
|
|
5
|
+
return e.key !== undefined;
|
|
6
|
+
};
|
|
4
7
|
function useRoveFocus(size, reset) {
|
|
5
8
|
var direction = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'column';
|
|
6
9
|
|
|
@@ -9,17 +12,17 @@ function useRoveFocus(size, reset) {
|
|
|
9
12
|
currentFocus = _useState2[0],
|
|
10
13
|
setCurrentFocus = _useState2[1];
|
|
11
14
|
|
|
12
|
-
var nextKey = direction === 'row' ?
|
|
13
|
-
var previousKey = direction === 'row' ?
|
|
15
|
+
var nextKey = direction === 'row' ? 'ArrowRight' : 'ArrowDown';
|
|
16
|
+
var previousKey = direction === 'row' ? 'ArrowLeft' : 'ArrowUp';
|
|
14
17
|
var handleKeyDown = useCallback(function (e) {
|
|
15
|
-
if (!size) return;
|
|
18
|
+
if (!size || !isKeyboardEvent(e)) return;
|
|
16
19
|
if (reset) setCurrentFocus(-1);
|
|
17
20
|
|
|
18
|
-
if (e.
|
|
21
|
+
if (e.key === nextKey) {
|
|
19
22
|
// Down arrow
|
|
20
23
|
e.preventDefault();
|
|
21
24
|
setCurrentFocus(currentFocus === size - 1 ? 0 : currentFocus + 1);
|
|
22
|
-
} else if (e.
|
|
25
|
+
} else if (e.key === previousKey) {
|
|
23
26
|
// Up arrow
|
|
24
27
|
e.preventDefault();
|
|
25
28
|
|
|
@@ -37,4 +40,4 @@ function useRoveFocus(size, reset) {
|
|
|
37
40
|
return [currentFocus, setCurrentFocus];
|
|
38
41
|
}
|
|
39
42
|
|
|
40
|
-
export { useRoveFocus };
|
|
43
|
+
export { isKeyboardEvent, useRoveFocus };
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -186,3 +186,5 @@ export { VisibilityOnIcon } from './icons/tsx/visibilityOn.js';
|
|
|
186
186
|
export { WarningIcon } from './icons/tsx/warning.js';
|
|
187
187
|
export { ZoomInIcon } from './icons/tsx/zoomIn.js';
|
|
188
188
|
export { ZoomOutIcon } from './icons/tsx/zoomOut.js';
|
|
189
|
+
export { Stepper } from './components/Stepper/Stepper.js';
|
|
190
|
+
export { Step } from './components/Stepper/Step.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@norges-domstoler/dds-components",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.2.0-beta.2",
|
|
4
4
|
"description": "React components used in Elsa - domstolenes designsystem",
|
|
5
5
|
"author": "Elsa team",
|
|
6
6
|
"license": "MIT",
|
|
@@ -20,16 +20,21 @@
|
|
|
20
20
|
"homepage": "https://design.domstol.no",
|
|
21
21
|
"scripts": {
|
|
22
22
|
"clean": "rm -r dist || :",
|
|
23
|
-
"test": "jest
|
|
24
|
-
"test:watch": "jest --
|
|
23
|
+
"test": "jest",
|
|
24
|
+
"test:watch": "jest --watch",
|
|
25
25
|
"build": "rollup -c",
|
|
26
26
|
"build:watch": "rollup -c -w",
|
|
27
27
|
"storybook": "start-storybook -p 6006 -s ./.storybook/images",
|
|
28
28
|
"build-storybook": "build-storybook -o docs",
|
|
29
29
|
"lint": "eslint --ext=jsx,ts,tsx src",
|
|
30
|
-
"prettier": "prettier --write
|
|
31
|
-
"check
|
|
32
|
-
"build:clean": "npm run clean && npm run build"
|
|
30
|
+
"prettier": "prettier --write .",
|
|
31
|
+
"prettier:check": "prettier --check .",
|
|
32
|
+
"build:clean": "npm run clean && npm run build",
|
|
33
|
+
"verify:types": "tsc --noEmit",
|
|
34
|
+
"verify:lint": "npm run lint",
|
|
35
|
+
"verify:test": "npm test",
|
|
36
|
+
"verify:prettier": "npm run prettier:check",
|
|
37
|
+
"verify": "concurrently 'npm:verify:*'"
|
|
33
38
|
},
|
|
34
39
|
"keywords": [
|
|
35
40
|
"dds",
|
|
@@ -42,53 +47,55 @@
|
|
|
42
47
|
"elsa"
|
|
43
48
|
],
|
|
44
49
|
"devDependencies": {
|
|
45
|
-
"@babel/core": "^7.
|
|
46
|
-
"@babel/preset-env": "^7.
|
|
47
|
-
"@babel/preset-react": "^7.
|
|
48
|
-
"@mdx-js/react": "^2.1.
|
|
50
|
+
"@babel/core": "^7.18.10",
|
|
51
|
+
"@babel/preset-env": "^7.18.10",
|
|
52
|
+
"@babel/preset-react": "^7.18.6",
|
|
53
|
+
"@mdx-js/react": "^2.1.3",
|
|
49
54
|
"@rollup/plugin-babel": "^5.3.1",
|
|
50
55
|
"@rollup/plugin-commonjs": "^22.0.2",
|
|
51
56
|
"@rollup/plugin-image": "^2.1.1",
|
|
52
|
-
"@rollup/plugin-node-resolve": "^13.
|
|
53
|
-
"@storybook/addon-actions": "^6.5.
|
|
54
|
-
"@storybook/addon-essentials": "^6.5.
|
|
55
|
-
"@storybook/addon-links": "^6.5.
|
|
56
|
-
"@storybook/addons": "^6.5.
|
|
57
|
+
"@rollup/plugin-node-resolve": "^13.3.0",
|
|
58
|
+
"@storybook/addon-actions": "^6.5.10",
|
|
59
|
+
"@storybook/addon-essentials": "^6.5.10",
|
|
60
|
+
"@storybook/addon-links": "^6.5.10",
|
|
61
|
+
"@storybook/addons": "^6.5.10",
|
|
57
62
|
"@storybook/mdx2-csf": "^0.0.3",
|
|
58
|
-
"@storybook/react": "^6.5.
|
|
59
|
-
"@storybook/theming": "^6.5.
|
|
60
|
-
"@testing-library/jest-dom": "^5.16.
|
|
61
|
-
"@testing-library/react": "^13.
|
|
62
|
-
"@testing-library/user-event": "^14.
|
|
63
|
-
"@types/jest": "^
|
|
64
|
-
"@types/react": "^
|
|
63
|
+
"@storybook/react": "^6.5.10",
|
|
64
|
+
"@storybook/theming": "^6.5.10",
|
|
65
|
+
"@testing-library/jest-dom": "^5.16.5",
|
|
66
|
+
"@testing-library/react": "^13.3.0",
|
|
67
|
+
"@testing-library/user-event": "^14.4.3",
|
|
68
|
+
"@types/jest": "^28.1.7",
|
|
69
|
+
"@types/react": "^18.0.17",
|
|
65
70
|
"@types/react-dom": "^18.0.6",
|
|
66
|
-
"@types/styled-components": "^5.1.
|
|
67
|
-
"@typescript-eslint/eslint-plugin": "^5.
|
|
68
|
-
"@typescript-eslint/parser": "^5.
|
|
69
|
-
"babel-loader": "^8.2.
|
|
71
|
+
"@types/styled-components": "^5.1.26",
|
|
72
|
+
"@typescript-eslint/eslint-plugin": "^5.33.1",
|
|
73
|
+
"@typescript-eslint/parser": "^5.33.1",
|
|
74
|
+
"babel-loader": "^8.2.5",
|
|
70
75
|
"babel-plugin-styled-components": "^2.0.7",
|
|
71
|
-
"
|
|
76
|
+
"concurrently": "^7.3.0",
|
|
77
|
+
"eslint": "^8.22.0",
|
|
72
78
|
"eslint-config-prettier": "^8.5.0",
|
|
73
|
-
"eslint-plugin-prettier": "^4.
|
|
74
|
-
"eslint-plugin-react": "^7.
|
|
75
|
-
"eslint-plugin-storybook": "^0.6.
|
|
76
|
-
"jest": "^
|
|
77
|
-
"
|
|
78
|
-
"react
|
|
79
|
-
"
|
|
79
|
+
"eslint-plugin-prettier": "^4.2.1",
|
|
80
|
+
"eslint-plugin-react": "^7.30.1",
|
|
81
|
+
"eslint-plugin-storybook": "^0.6.4",
|
|
82
|
+
"jest": "^28.1.3",
|
|
83
|
+
"jest-environment-jsdom": "^28.1.3",
|
|
84
|
+
"react": "^18.2.0",
|
|
85
|
+
"react-dom": "^18.2.0",
|
|
86
|
+
"rollup": "^2.78.1",
|
|
80
87
|
"rollup-plugin-copy": "^3.4.0",
|
|
81
88
|
"rollup-plugin-import-css": "^3.0.3",
|
|
82
|
-
"rollup-plugin-sass": "^1.2.
|
|
83
|
-
"rollup-plugin-typescript2": "^0.
|
|
84
|
-
"ts-jest": "^
|
|
85
|
-
"typescript": "^4.
|
|
89
|
+
"rollup-plugin-sass": "^1.2.13",
|
|
90
|
+
"rollup-plugin-typescript2": "^0.33.0",
|
|
91
|
+
"ts-jest": "^28.0.8",
|
|
92
|
+
"typescript": "^4.7.4"
|
|
86
93
|
},
|
|
87
94
|
"peerDependencies": {
|
|
95
|
+
"@norges-domstoler/dds-design-tokens": "^1.3.0",
|
|
88
96
|
"react": "^16 || ^17 || ^18",
|
|
89
97
|
"react-dom": "^16 || ^17 || ^18",
|
|
90
|
-
"styled-components": "^5"
|
|
91
|
-
"@norges-domstoler/dds-design-tokens": "^1"
|
|
98
|
+
"styled-components": "^5"
|
|
92
99
|
},
|
|
93
100
|
"jest": {
|
|
94
101
|
"preset": "ts-jest",
|
|
@@ -109,11 +116,11 @@
|
|
|
109
116
|
}
|
|
110
117
|
},
|
|
111
118
|
"dependencies": {
|
|
112
|
-
"@emotion/react": "^11.
|
|
113
|
-
"@emotion/styled": "^11.
|
|
114
|
-
"@floating-ui/react-dom": "^0.
|
|
119
|
+
"@emotion/react": "^11.10.0",
|
|
120
|
+
"@emotion/styled": "^11.10.0",
|
|
121
|
+
"@floating-ui/react-dom": "^1.0.0",
|
|
115
122
|
"focus-visible": "^5.2.0",
|
|
116
|
-
"react-select": "^5.
|
|
123
|
+
"react-select": "^5.4.0",
|
|
117
124
|
"tslib": "^2.4.0"
|
|
118
125
|
}
|
|
119
126
|
}
|