@norges-domstoler/dds-components 5.5.0 → 7.0.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/dist/_virtual/_rollupPluginBabelHelpers.js +58 -1
- package/dist/cjs/components/Card/Card.stories.d.ts +1 -0
- package/dist/cjs/components/Card/CardAccordion/CardAccordion.d.ts +4 -0
- package/dist/cjs/components/Checkbox/Checkbox.stories.d.ts +1 -0
- package/dist/cjs/components/Checkbox/CheckboxGroup.d.ts +1 -1
- package/dist/cjs/components/Checkbox/CheckboxGroup.stories.d.ts +1 -1
- package/dist/cjs/components/Checkbox/CheckboxGroup.tokens.d.ts +7 -13
- package/dist/cjs/components/Datepicker/Datepicker.stories.d.ts +1 -0
- package/dist/cjs/components/Datepicker/Datepicker.tokens.d.ts +21 -3
- package/dist/cjs/components/InputMessage/InputMessage.tokens.d.ts +12 -9
- package/dist/cjs/components/InternalHeader/InternalHeader.styles.d.ts +1 -1
- package/dist/cjs/components/List/List.tokens.d.ts +0 -4
- package/dist/cjs/components/OverflowMenu/OverflowMenu.stories.d.ts +1 -1
- package/dist/cjs/components/RadioButton/RadioButtonGroup.d.ts +31 -2
- package/dist/cjs/components/RadioButton/RadioButtonGroup.stories.d.ts +19 -1
- package/dist/cjs/components/ScrollableContainer/scrollbarStyling.d.ts +1 -1
- package/dist/cjs/components/Search/Search.tokens.d.ts +51 -21
- package/dist/cjs/components/Select/CustomSelect.stories.d.ts +2 -2
- package/dist/cjs/components/Select/MultiSelect.stories.d.ts +2 -1
- package/dist/cjs/components/Select/Select.d.ts +9 -3
- package/dist/cjs/components/Select/Select.stories.d.ts +3 -1
- package/dist/cjs/components/Select/Select.styles.d.ts +6 -5
- package/dist/cjs/components/Select/Select.tokens.d.ts +211 -91
- package/dist/cjs/components/Tabs/Tab.d.ts +0 -5
- package/dist/cjs/components/Tabs/Tabs.context.d.ts +0 -2
- package/dist/cjs/components/Tabs/Tabs.d.ts +4 -4
- package/dist/cjs/components/Tabs/Tabs.stories.d.ts +2 -1
- package/dist/cjs/components/Tabs/Tabs.tokens.d.ts +1 -6
- package/dist/cjs/components/TextInput/TextInput.d.ts +5 -1
- package/dist/cjs/components/TextInput/TextInput.stories.d.ts +3 -0
- package/dist/cjs/components/TextInput/TextInput.styles.d.ts +14 -6
- package/dist/cjs/components/TextInput/TextInput.tokens.d.ts +25 -44
- package/dist/cjs/components/TextInput/TextInput.types.d.ts +3 -0
- package/dist/cjs/components/Tooltip/Tooltip.stories.d.ts +1 -1
- package/dist/cjs/components/Typography/Link/Link.d.ts +1 -1
- package/dist/cjs/components/Typography/Link/Link.stories.d.ts +1 -1
- package/dist/cjs/components/Typography/Paragraph/Paragraph.d.ts +1 -1
- package/dist/cjs/components/Typography/Paragraph/Paragraph.stories.d.ts +1 -1
- package/dist/cjs/components/Typography/Typography/Typography.types.d.ts +2 -3
- package/dist/cjs/components/Typography/Typography.tokens.d.ts +3 -89
- package/dist/cjs/helpers/Input/Input.styles.d.ts +3 -5
- package/dist/cjs/helpers/Input/Input.tokens.d.ts +52 -29
- package/dist/cjs/helpers/Input/Input.types.d.ts +4 -6
- package/dist/cjs/helpers/Input/Input.utils.d.ts +3 -0
- package/dist/cjs/helpers/Input/index.d.ts +1 -0
- package/dist/cjs/helpers/SelectionControl/SelectionControl.styles.d.ts +15 -0
- package/dist/cjs/helpers/SelectionControl/SelectionControl.tokens.d.ts +83 -0
- package/dist/cjs/helpers/SelectionControl/SelectionControl.utils.d.ts +2 -0
- package/dist/cjs/helpers/SelectionControl/index.d.ts +3 -0
- package/dist/cjs/helpers/styling/hover.d.ts +0 -2
- package/dist/cjs/hooks/index.d.ts +0 -1
- package/dist/cjs/hooks/useCombinedRefs.d.ts +18 -0
- package/dist/cjs/hooks/useFloatPosition.d.ts +22 -1
- package/dist/cjs/hooks/useFocusTrap.d.ts +16 -1
- package/dist/cjs/hooks/useIsMounted.d.ts +2 -0
- package/dist/cjs/hooks/useMountTransition.d.ts +32 -0
- package/dist/cjs/hooks/useOnClickOutside.d.ts +13 -0
- package/dist/cjs/hooks/useOnKeyDown.d.ts +13 -0
- package/dist/cjs/hooks/useRoveFocus.d.ts +25 -1
- package/dist/cjs/hooks/useScreenSize.d.ts +12 -0
- package/dist/cjs/index.d.ts +1 -0
- package/dist/cjs/index.js +1683 -1595
- package/dist/cjs/test/mocks/ResizeObserver.d.ts +6 -0
- package/dist/components/Card/Card.stories.d.ts +1 -0
- package/dist/components/Card/CardAccordion/CardAccordion.d.ts +4 -0
- package/dist/components/Card/CardAccordion/CardAccordion.js +10 -6
- package/dist/components/Card/CardAccordion/CardAccordionBody.js +41 -15
- package/dist/components/Checkbox/Checkbox.js +13 -6
- package/dist/components/Checkbox/Checkbox.stories.d.ts +1 -0
- package/dist/components/Checkbox/CheckboxGroup.d.ts +1 -1
- package/dist/components/Checkbox/CheckboxGroup.js +26 -23
- package/dist/components/Checkbox/CheckboxGroup.stories.d.ts +1 -1
- package/dist/components/Checkbox/CheckboxGroup.tokens.d.ts +7 -13
- package/dist/components/Checkbox/CheckboxGroup.tokens.js +12 -24
- package/dist/components/Datepicker/Datepicker.js +37 -29
- package/dist/components/Datepicker/Datepicker.stories.d.ts +1 -0
- package/dist/components/Datepicker/Datepicker.tokens.d.ts +21 -3
- package/dist/components/Datepicker/Datepicker.tokens.js +28 -18
- package/dist/components/InputMessage/InputMessage.js +4 -4
- package/dist/components/InputMessage/InputMessage.tokens.d.ts +12 -9
- package/dist/components/InputMessage/InputMessage.tokens.js +16 -21
- package/dist/components/InternalHeader/InternalHeader.styles.d.ts +1 -1
- package/dist/components/List/List.tokens.d.ts +0 -4
- package/dist/components/List/List.tokens.js +0 -8
- package/dist/components/OverflowMenu/OverflowMenu.js +7 -4
- package/dist/components/OverflowMenu/OverflowMenu.stories.d.ts +1 -1
- package/dist/components/Popover/Popover.js +4 -1
- package/dist/components/RadioButton/RadioButton.js +12 -4
- package/dist/components/RadioButton/RadioButtonGroup.d.ts +31 -2
- package/dist/components/RadioButton/RadioButtonGroup.js +34 -27
- package/dist/components/RadioButton/RadioButtonGroup.stories.d.ts +19 -1
- package/dist/components/ScrollableContainer/scrollbarStyling.d.ts +1 -1
- package/dist/components/ScrollableContainer/scrollbarStyling.js +2 -1
- package/dist/components/Search/Search.js +32 -11
- package/dist/components/Search/Search.tokens.d.ts +51 -21
- package/dist/components/Search/Search.tokens.js +41 -49
- package/dist/components/Select/CustomSelect.stories.d.ts +2 -2
- package/dist/components/Select/MultiSelect.stories.d.ts +2 -1
- package/dist/components/Select/Select.d.ts +9 -3
- package/dist/components/Select/Select.js +88 -62
- package/dist/components/Select/Select.stories.d.ts +3 -1
- package/dist/components/Select/Select.styles.d.ts +6 -5
- package/dist/components/Select/Select.styles.js +145 -72
- package/dist/components/Select/Select.tokens.d.ts +211 -91
- package/dist/components/Select/Select.tokens.js +167 -279
- package/dist/components/Tabs/Tab.d.ts +0 -5
- package/dist/components/Tabs/Tab.js +6 -12
- package/dist/components/Tabs/TabList.js +7 -1
- package/dist/components/Tabs/Tabs.context.d.ts +0 -2
- package/dist/components/Tabs/Tabs.context.js +1 -2
- package/dist/components/Tabs/Tabs.d.ts +4 -4
- package/dist/components/Tabs/Tabs.js +13 -11
- package/dist/components/Tabs/Tabs.stories.d.ts +2 -1
- package/dist/components/Tabs/Tabs.tokens.d.ts +1 -6
- package/dist/components/Tabs/Tabs.tokens.js +4 -15
- package/dist/components/TextInput/TextInput.d.ts +5 -1
- package/dist/components/TextInput/TextInput.js +53 -32
- package/dist/components/TextInput/TextInput.stories.d.ts +3 -0
- package/dist/components/TextInput/TextInput.styles.d.ts +14 -6
- package/dist/components/TextInput/TextInput.styles.js +22 -19
- package/dist/components/TextInput/TextInput.tokens.d.ts +25 -44
- package/dist/components/TextInput/TextInput.tokens.js +35 -41
- package/dist/components/TextInput/TextInput.types.d.ts +3 -0
- package/dist/components/ToggleButton/ToggleButton.tokens.js +5 -4
- package/dist/components/Tooltip/Tooltip.js +3 -1
- package/dist/components/Tooltip/Tooltip.stories.d.ts +1 -1
- package/dist/components/Typography/Link/Link.d.ts +1 -1
- package/dist/components/Typography/Link/Link.stories.d.ts +1 -1
- package/dist/components/Typography/Paragraph/Paragraph.d.ts +1 -1
- package/dist/components/Typography/Paragraph/Paragraph.stories.d.ts +1 -1
- package/dist/components/Typography/Typography/Typography.types.d.ts +2 -3
- package/dist/components/Typography/Typography.tokens.d.ts +3 -89
- package/dist/components/Typography/Typography.tokens.js +16 -72
- package/dist/components/Typography/Typography.utils.js +2 -7
- package/dist/helpers/Input/Input.styles.d.ts +3 -5
- package/dist/helpers/Input/Input.styles.js +20 -28
- package/dist/helpers/Input/Input.tokens.d.ts +52 -29
- package/dist/helpers/Input/Input.tokens.js +36 -54
- package/dist/helpers/Input/Input.types.d.ts +4 -6
- package/dist/helpers/Input/Input.utils.d.ts +3 -0
- package/dist/helpers/Input/Input.utils.js +14 -0
- package/dist/helpers/Input/index.d.ts +1 -0
- package/dist/helpers/SelectionControl/SelectionControl.styles.d.ts +15 -0
- package/dist/helpers/SelectionControl/SelectionControl.styles.js +36 -0
- package/dist/helpers/SelectionControl/SelectionControl.tokens.d.ts +83 -0
- package/dist/helpers/SelectionControl/SelectionControl.tokens.js +100 -0
- package/dist/helpers/SelectionControl/SelectionControl.utils.d.ts +2 -0
- package/dist/helpers/SelectionControl/SelectionControl.utils.js +4 -0
- package/dist/helpers/SelectionControl/index.d.ts +3 -0
- package/dist/helpers/styling/danger.js +1 -1
- package/dist/helpers/styling/focus.js +5 -6
- package/dist/helpers/styling/hover.d.ts +0 -2
- package/dist/helpers/styling/hover.js +2 -4
- package/dist/hooks/index.d.ts +0 -1
- package/dist/hooks/useCombinedRefs.d.ts +18 -0
- package/dist/hooks/useCombinedRefs.js +19 -0
- package/dist/hooks/useFloatPosition.d.ts +22 -1
- package/dist/hooks/useFloatPosition.js +13 -13
- package/dist/hooks/useFocusTrap.d.ts +16 -1
- package/dist/hooks/useFocusTrap.js +15 -0
- package/dist/hooks/useIsMounted.d.ts +2 -0
- package/dist/hooks/useIsMounted.js +16 -0
- package/dist/hooks/useMountTransition.d.ts +32 -0
- package/dist/hooks/useMountTransition.js +33 -0
- package/dist/hooks/useOnClickOutside.d.ts +13 -0
- package/dist/hooks/useOnClickOutside.js +14 -0
- package/dist/hooks/useOnKeyDown.d.ts +13 -0
- package/dist/hooks/useOnKeyDown.js +14 -0
- package/dist/hooks/useRoveFocus.d.ts +25 -1
- package/dist/hooks/useRoveFocus.js +25 -0
- package/dist/hooks/useScreenSize.d.ts +12 -0
- package/dist/hooks/useScreenSize.js +53 -3
- package/dist/index.d.ts +1 -0
- package/dist/index.js +8 -0
- package/dist/test/mocks/ResizeObserver.d.ts +6 -0
- package/package.json +2 -2
- package/dist/cjs/components/Checkbox/Checkbox.styles.d.ts +0 -5
- package/dist/cjs/components/Checkbox/Checkbox.tokens.d.ts +0 -65
- package/dist/cjs/components/RadioButton/RadioButton.styles.d.ts +0 -5
- package/dist/cjs/components/RadioButton/RadioButton.tokens.d.ts +0 -43
- package/dist/cjs/hooks/useId.d.ts +0 -1
- package/dist/components/Checkbox/Checkbox.styles.d.ts +0 -5
- package/dist/components/Checkbox/Checkbox.styles.js +0 -38
- package/dist/components/Checkbox/Checkbox.tokens.d.ts +0 -65
- package/dist/components/Checkbox/Checkbox.tokens.js +0 -132
- package/dist/components/RadioButton/RadioButton.styles.d.ts +0 -5
- package/dist/components/RadioButton/RadioButton.styles.js +0 -27
- package/dist/components/RadioButton/RadioButton.tokens.d.ts +0 -43
- package/dist/components/RadioButton/RadioButton.tokens.js +0 -100
- package/dist/hooks/useId.d.ts +0 -1
- package/dist/hooks/useId.js +0 -15
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
import { useEffect } from 'react';
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* Kjører logikk når en spesifisert tast blir trykt ned.
|
|
5
|
+
* Typisk bruk:
|
|
6
|
+
* ```
|
|
7
|
+
* const [isOpen, setOpen] = useState(true);
|
|
8
|
+
* const ref = useRef<HTMLElement>(null);
|
|
9
|
+
* useOnKeyDown(['Escape', 'Esc'], () => setOpen(false));
|
|
10
|
+
*
|
|
11
|
+
* return isOpen ? <div>innhold</div> : null;
|
|
12
|
+
* ```
|
|
13
|
+
* @param key tasten som trykkes.
|
|
14
|
+
* @param handler funksjonen som skal kjøres.
|
|
15
|
+
*/
|
|
16
|
+
|
|
3
17
|
var useOnKeyDown = function useOnKeyDown(key, handler) {
|
|
4
18
|
useEffect(function () {
|
|
5
19
|
var listener = function listener(event) {
|
|
@@ -1,4 +1,28 @@
|
|
|
1
1
|
import { Dispatch, SetStateAction, KeyboardEvent } from 'react';
|
|
2
2
|
import { Direction } from '../types';
|
|
3
3
|
export declare const isKeyboardEvent: (e: Event | KeyboardEvent<Element>) => e is KeyboardEvent<Element>;
|
|
4
|
-
|
|
4
|
+
/**
|
|
5
|
+
* Bytter fokus mellom elementer i en gruppe med piltaster og ikke Tab, og looper fokus i gruppen. Typisk bruk:
|
|
6
|
+
* ```
|
|
7
|
+
* import elements from './elements';
|
|
8
|
+
* import RoveItem from './RoveItem';
|
|
9
|
+
*
|
|
10
|
+
* const MyComponent = () => {
|
|
11
|
+
* const [focus, setFocus] = useRoveFocus(elements.length);
|
|
12
|
+
*
|
|
13
|
+
* return (
|
|
14
|
+
* <ul>
|
|
15
|
+
* {elements.map((element, index) => (
|
|
16
|
+
* <li key={element}>
|
|
17
|
+
* <RoveItem index={index} focus={focus === index} setFocus={setFocus}>{element.name}</RoveItem>
|
|
18
|
+
* </li>
|
|
19
|
+
* ))}
|
|
20
|
+
* </ul>)
|
|
21
|
+
* }
|
|
22
|
+
* ```
|
|
23
|
+
* @param size antall elementer i gruppen.
|
|
24
|
+
* @param reset om fokus i gruppen skal nullstilles; når man tabber seg inn i gruppen skal focus være nullstilt.
|
|
25
|
+
* @param direction retning elementene blas i.
|
|
26
|
+
* @returns hook par: indeksen til fokuserte elemenentet og funksjonen som håndterer fokus.
|
|
27
|
+
*/
|
|
28
|
+
export declare function useRoveFocus(size?: number, reset?: boolean, direction?: Direction): [number, Dispatch<SetStateAction<number>>];
|
|
@@ -4,6 +4,31 @@ import { useState, useCallback, useEffect } from 'react';
|
|
|
4
4
|
var isKeyboardEvent = function isKeyboardEvent(e) {
|
|
5
5
|
return e.key !== undefined;
|
|
6
6
|
};
|
|
7
|
+
/**
|
|
8
|
+
* Bytter fokus mellom elementer i en gruppe med piltaster og ikke Tab, og looper fokus i gruppen. Typisk bruk:
|
|
9
|
+
* ```
|
|
10
|
+
* import elements from './elements';
|
|
11
|
+
* import RoveItem from './RoveItem';
|
|
12
|
+
*
|
|
13
|
+
* const MyComponent = () => {
|
|
14
|
+
* const [focus, setFocus] = useRoveFocus(elements.length);
|
|
15
|
+
*
|
|
16
|
+
* return (
|
|
17
|
+
* <ul>
|
|
18
|
+
* {elements.map((element, index) => (
|
|
19
|
+
* <li key={element}>
|
|
20
|
+
* <RoveItem index={index} focus={focus === index} setFocus={setFocus}>{element.name}</RoveItem>
|
|
21
|
+
* </li>
|
|
22
|
+
* ))}
|
|
23
|
+
* </ul>)
|
|
24
|
+
* }
|
|
25
|
+
* ```
|
|
26
|
+
* @param size antall elementer i gruppen.
|
|
27
|
+
* @param reset om fokus i gruppen skal nullstilles; når man tabber seg inn i gruppen skal focus være nullstilt.
|
|
28
|
+
* @param direction retning elementene blas i.
|
|
29
|
+
* @returns hook par: indeksen til fokuserte elemenentet og funksjonen som håndterer fokus.
|
|
30
|
+
*/
|
|
31
|
+
|
|
7
32
|
function useRoveFocus(size, reset) {
|
|
8
33
|
var direction = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'column';
|
|
9
34
|
|
|
@@ -5,4 +5,16 @@ export declare enum ScreenSize {
|
|
|
5
5
|
Large = 3,
|
|
6
6
|
XLarge = 4
|
|
7
7
|
}
|
|
8
|
+
/**
|
|
9
|
+
* Sjekker skjermstørrelsen basert på brekkpunkter definerte i designsystemet. Eksempel på bruk:
|
|
10
|
+
* ```
|
|
11
|
+
* const MyComponent = () => {
|
|
12
|
+
* const screenSize = useScreenSize();
|
|
13
|
+
* const isSmallScreen = screenSize === ScreenSize.Small;
|
|
14
|
+
*
|
|
15
|
+
* return <div className={isSmallScreen && 'smallDiv'} >innhold</div>
|
|
16
|
+
* }
|
|
17
|
+
* ```
|
|
18
|
+
* @returns den aktuelle skjermstørrelsen basert på {@link ScreenSize}.
|
|
19
|
+
*/
|
|
8
20
|
export declare const useScreenSize: () => ScreenSize;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import '
|
|
1
|
+
import { slicedToArray as _slicedToArray, createForOfIteratorHelper as _createForOfIteratorHelper } from '../_virtual/_rollupPluginBabelHelpers.js';
|
|
2
|
+
import { useState, useEffect } from 'react';
|
|
2
3
|
import { ddsBaseTokens } from '@norges-domstoler/dds-design-tokens';
|
|
3
4
|
|
|
4
5
|
var breakpoints = ddsBaseTokens.breakpoints;
|
|
@@ -12,6 +13,55 @@ var ScreenSize;
|
|
|
12
13
|
ScreenSize[ScreenSize["XLarge"] = 4] = "XLarge";
|
|
13
14
|
})(ScreenSize || (ScreenSize = {}));
|
|
14
15
|
|
|
15
|
-
[[ScreenSize.XLarge, "only screen and (min-width: ".concat(breakpoints.DdsBreakpointXl, ")")], [ScreenSize.Large, "only screen and (min-width: ".concat(breakpoints.DdsBreakpointLg, ")")], [ScreenSize.Medium, "only screen and (min-width: ".concat(breakpoints.DdsBreakpointMd, ")")], [ScreenSize.Small, "only screen and (min-width: ".concat(breakpoints.DdsBreakpointSm, ")")], [ScreenSize.XSmall, "only screen and (min-width: ".concat(breakpoints.DdsBreakpointXs, ")")]];
|
|
16
|
+
var screenSizesAndMediaQueries = [[ScreenSize.XLarge, "only screen and (min-width: ".concat(breakpoints.DdsBreakpointXl, ")")], [ScreenSize.Large, "only screen and (min-width: ".concat(breakpoints.DdsBreakpointLg, ")")], [ScreenSize.Medium, "only screen and (min-width: ".concat(breakpoints.DdsBreakpointMd, ")")], [ScreenSize.Small, "only screen and (min-width: ".concat(breakpoints.DdsBreakpointSm, ")")], [ScreenSize.XSmall, "only screen and (min-width: ".concat(breakpoints.DdsBreakpointXs, ")")]];
|
|
17
|
+
/**
|
|
18
|
+
* Sjekker skjermstørrelsen basert på brekkpunkter definerte i designsystemet. Eksempel på bruk:
|
|
19
|
+
* ```
|
|
20
|
+
* const MyComponent = () => {
|
|
21
|
+
* const screenSize = useScreenSize();
|
|
22
|
+
* const isSmallScreen = screenSize === ScreenSize.Small;
|
|
23
|
+
*
|
|
24
|
+
* return <div className={isSmallScreen && 'smallDiv'} >innhold</div>
|
|
25
|
+
* }
|
|
26
|
+
* ```
|
|
27
|
+
* @returns den aktuelle skjermstørrelsen basert på {@link ScreenSize}.
|
|
28
|
+
*/
|
|
16
29
|
|
|
17
|
-
|
|
30
|
+
var useScreenSize = function useScreenSize() {
|
|
31
|
+
var _useState = useState(ScreenSize.Large),
|
|
32
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
33
|
+
screenSize = _useState2[0],
|
|
34
|
+
setScreenSize = _useState2[1];
|
|
35
|
+
|
|
36
|
+
useEffect(function () {
|
|
37
|
+
function listener() {
|
|
38
|
+
var _iterator = _createForOfIteratorHelper(screenSizesAndMediaQueries),
|
|
39
|
+
_step;
|
|
40
|
+
|
|
41
|
+
try {
|
|
42
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
43
|
+
var _step$value = _slicedToArray(_step.value, 2),
|
|
44
|
+
_screenSize = _step$value[0],
|
|
45
|
+
mediaQuery = _step$value[1];
|
|
46
|
+
|
|
47
|
+
if (window.matchMedia(mediaQuery).matches) {
|
|
48
|
+
setScreenSize(_screenSize);
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
} catch (err) {
|
|
53
|
+
_iterator.e(err);
|
|
54
|
+
} finally {
|
|
55
|
+
_iterator.f();
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
window.addEventListener('resize', listener);
|
|
60
|
+
return function () {
|
|
61
|
+
return window.removeEventListener('resize', listener);
|
|
62
|
+
};
|
|
63
|
+
}, []);
|
|
64
|
+
return screenSize;
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
export { ScreenSize, useScreenSize };
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -200,3 +200,11 @@ export { ToggleBar } from './components/ToggleBar/ToggleBar.js';
|
|
|
200
200
|
export { ToggleRadio } from './components/ToggleBar/ToggleRadio.js';
|
|
201
201
|
export { Stepper } from './components/Stepper/Stepper.js';
|
|
202
202
|
export { Step } from './components/Stepper/Step.js';
|
|
203
|
+
export { useCombinedRef } from './hooks/useCombinedRefs.js';
|
|
204
|
+
export { useOnClickOutside } from './hooks/useOnClickOutside.js';
|
|
205
|
+
export { useOnKeyDown } from './hooks/useOnKeyDown.js';
|
|
206
|
+
export { useFloatPosition } from './hooks/useFloatPosition.js';
|
|
207
|
+
export { isKeyboardEvent, useRoveFocus } from './hooks/useRoveFocus.js';
|
|
208
|
+
export { useFocusTrap } from './hooks/useFocusTrap.js';
|
|
209
|
+
export { useMountTransition } from './hooks/useMountTransition.js';
|
|
210
|
+
export { ScreenSize, useScreenSize } from './hooks/useScreenSize.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@norges-domstoler/dds-components",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "7.0.0",
|
|
4
4
|
"description": "React components used in Elsa - domstolenes designsystem",
|
|
5
5
|
"author": "Elsa team",
|
|
6
6
|
"license": "MIT",
|
|
@@ -92,7 +92,7 @@
|
|
|
92
92
|
"typescript": "^4.7.4"
|
|
93
93
|
},
|
|
94
94
|
"peerDependencies": {
|
|
95
|
-
"@norges-domstoler/dds-design-tokens": "^
|
|
95
|
+
"@norges-domstoler/dds-design-tokens": "^3.0.0",
|
|
96
96
|
"react": "^16 || ^17 || ^18",
|
|
97
97
|
"react-dom": "^16 || ^17 || ^18",
|
|
98
98
|
"styled-components": "^5"
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { CheckboxProps } from './Checkbox.types';
|
|
2
|
-
export declare const CustomCheckbox: import("styled-components").StyledComponent<"span", any, {}, never>;
|
|
3
|
-
declare type ContainerProps = Pick<CheckboxProps, 'disabled' | 'readOnly' | 'error' | 'indeterminate' | 'label'>;
|
|
4
|
-
export declare const Container: import("styled-components").StyledComponent<"label", any, ContainerProps, never>;
|
|
5
|
-
export {};
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import { CSSObject } from 'styled-components';
|
|
2
|
-
export declare const checkboxTokens: {
|
|
3
|
-
checkbox: {
|
|
4
|
-
base: CSSObject;
|
|
5
|
-
spaceLeft: string;
|
|
6
|
-
hover: {
|
|
7
|
-
base: CSSObject;
|
|
8
|
-
};
|
|
9
|
-
disabled: {
|
|
10
|
-
base: CSSObject;
|
|
11
|
-
};
|
|
12
|
-
readOnly: {
|
|
13
|
-
base: CSSObject;
|
|
14
|
-
};
|
|
15
|
-
checked: {
|
|
16
|
-
base: CSSObject;
|
|
17
|
-
hover: {
|
|
18
|
-
base: CSSObject;
|
|
19
|
-
};
|
|
20
|
-
disabled: {
|
|
21
|
-
base: CSSObject;
|
|
22
|
-
};
|
|
23
|
-
readOnly: {
|
|
24
|
-
base: CSSObject;
|
|
25
|
-
};
|
|
26
|
-
};
|
|
27
|
-
indeterminate: {
|
|
28
|
-
base: CSSObject;
|
|
29
|
-
hover: {
|
|
30
|
-
base: CSSObject;
|
|
31
|
-
};
|
|
32
|
-
disabled: {
|
|
33
|
-
base: CSSObject;
|
|
34
|
-
};
|
|
35
|
-
readOnly: {
|
|
36
|
-
base: CSSObject;
|
|
37
|
-
};
|
|
38
|
-
};
|
|
39
|
-
danger: {
|
|
40
|
-
base: CSSObject;
|
|
41
|
-
hover: {
|
|
42
|
-
base: CSSObject;
|
|
43
|
-
};
|
|
44
|
-
};
|
|
45
|
-
};
|
|
46
|
-
checkmark: {
|
|
47
|
-
base: CSSObject;
|
|
48
|
-
color: string;
|
|
49
|
-
indeterminate: {
|
|
50
|
-
base: CSSObject;
|
|
51
|
-
};
|
|
52
|
-
};
|
|
53
|
-
container: {
|
|
54
|
-
base: CSSObject;
|
|
55
|
-
focus: {
|
|
56
|
-
base: CSSObject;
|
|
57
|
-
};
|
|
58
|
-
withLabel: {
|
|
59
|
-
base: CSSObject;
|
|
60
|
-
};
|
|
61
|
-
noLabel: {
|
|
62
|
-
base: CSSObject;
|
|
63
|
-
};
|
|
64
|
-
};
|
|
65
|
-
};
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { RadioButtonProps } from './RadioButton.types';
|
|
2
|
-
export declare const CustomRadioButton: import("styled-components").StyledComponent<"span", any, {}, never>;
|
|
3
|
-
declare type ContainerProps = Pick<RadioButtonProps, 'error' | 'disabled' | 'readOnly'>;
|
|
4
|
-
export declare const Container: import("styled-components").StyledComponent<"label", any, ContainerProps, never>;
|
|
5
|
-
export {};
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { CSSObject } from 'styled-components';
|
|
2
|
-
export declare const radioButtonTokens: {
|
|
3
|
-
radioButton: {
|
|
4
|
-
base: CSSObject;
|
|
5
|
-
spaceLeft: string;
|
|
6
|
-
hover: {
|
|
7
|
-
base: CSSObject;
|
|
8
|
-
};
|
|
9
|
-
disabled: {
|
|
10
|
-
base: CSSObject;
|
|
11
|
-
};
|
|
12
|
-
readOnly: {
|
|
13
|
-
base: CSSObject;
|
|
14
|
-
};
|
|
15
|
-
checked: {
|
|
16
|
-
base: CSSObject;
|
|
17
|
-
hover: {
|
|
18
|
-
base: CSSObject;
|
|
19
|
-
};
|
|
20
|
-
disabled: {
|
|
21
|
-
base: CSSObject;
|
|
22
|
-
};
|
|
23
|
-
readOnly: {
|
|
24
|
-
base: CSSObject;
|
|
25
|
-
};
|
|
26
|
-
};
|
|
27
|
-
danger: {
|
|
28
|
-
base: CSSObject;
|
|
29
|
-
hover: {
|
|
30
|
-
base: CSSObject;
|
|
31
|
-
};
|
|
32
|
-
};
|
|
33
|
-
};
|
|
34
|
-
checkmark: {
|
|
35
|
-
base: CSSObject;
|
|
36
|
-
};
|
|
37
|
-
container: {
|
|
38
|
-
base: CSSObject;
|
|
39
|
-
focus: {
|
|
40
|
-
base: CSSObject;
|
|
41
|
-
};
|
|
42
|
-
};
|
|
43
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function useId(prefix: string, suffix?: string): string;
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { CheckboxProps } from './Checkbox.types';
|
|
2
|
-
export declare const CustomCheckbox: import("styled-components").StyledComponent<"span", any, {}, never>;
|
|
3
|
-
declare type ContainerProps = Pick<CheckboxProps, 'disabled' | 'readOnly' | 'error' | 'indeterminate' | 'label'>;
|
|
4
|
-
export declare const Container: import("styled-components").StyledComponent<"label", any, ContainerProps, never>;
|
|
5
|
-
export {};
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import styled, { css } from 'styled-components';
|
|
2
|
-
import { focusVisibleTransitionValue } from '../../helpers/styling/focusVisible.js';
|
|
3
|
-
import '../../helpers/styling/hover.js';
|
|
4
|
-
import '../../helpers/styling/focus.js';
|
|
5
|
-
import '../../helpers/styling/danger.js';
|
|
6
|
-
import '../../helpers/styling/selection.js';
|
|
7
|
-
import { checkboxTokens } from './Checkbox.tokens.js';
|
|
8
|
-
|
|
9
|
-
var CustomCheckbox = styled.span.withConfig({
|
|
10
|
-
displayName: "Checkboxstyles__CustomCheckbox",
|
|
11
|
-
componentId: "sc-17q1ubf-0"
|
|
12
|
-
})(["position:absolute;", " left:", ";box-sizing:border-box;&:after{content:'';position:absolute;display:none;}"], checkboxTokens.checkbox.base, checkboxTokens.checkbox.spaceLeft);
|
|
13
|
-
var Container = styled.label.withConfig({
|
|
14
|
-
displayName: "Checkboxstyles__Container",
|
|
15
|
-
componentId: "sc-17q1ubf-1"
|
|
16
|
-
})(["position:relative;display:flex;align-items:center;cursor:pointer;user-select:none;width:fit-content;", " ", " input ~ ", "{@media (prefers-reduced-motion:no-preference){transition:box-shadow 0.2s,background-color 0.2s,border 0.2s;}}input:checked ~ ", ":after{display:block;}input:checked ~ ", "{", "}&:hover input:enabled ~ ", "{", "}&:hover input:checked:enabled ~ ", "{", "}&:focus-within{", " @media (prefers-reduced-motion:no-preference){transition:", ";}}", " ", " ", " ", " ", ":after{border:solid ", ";", "}"], checkboxTokens.container.base, function (_ref) {
|
|
17
|
-
var label = _ref.label;
|
|
18
|
-
return label ? css(["", ""], checkboxTokens.container.withLabel.base) : css(["", ""], checkboxTokens.container.noLabel.base);
|
|
19
|
-
}, CustomCheckbox, CustomCheckbox, CustomCheckbox, checkboxTokens.checkbox.checked.base, CustomCheckbox, checkboxTokens.checkbox.hover.base, CustomCheckbox, checkboxTokens.checkbox.checked.hover.base, checkboxTokens.container.focus.base, focusVisibleTransitionValue, function (_ref2) {
|
|
20
|
-
var error = _ref2.error;
|
|
21
|
-
return error && css(["input ~ ", "{", "}&:hover input:enabled ~ ", "{", "}"], CustomCheckbox, checkboxTokens.checkbox.danger.base, CustomCheckbox, checkboxTokens.checkbox.danger.hover.base);
|
|
22
|
-
}, function (_ref3) {
|
|
23
|
-
var indeterminate = _ref3.indeterminate;
|
|
24
|
-
return indeterminate && css(["input:enabled ~ ", "{", "}input ~ ", ":after{display:block;}&:hover input:enabled ~ ", "{", "}"], CustomCheckbox, checkboxTokens.checkbox.indeterminate.base, CustomCheckbox, CustomCheckbox, checkboxTokens.checkbox.indeterminate.hover.base);
|
|
25
|
-
}, function (_ref4) {
|
|
26
|
-
var disabled = _ref4.disabled,
|
|
27
|
-
indeterminate = _ref4.indeterminate;
|
|
28
|
-
return disabled && css(["cursor:not-allowed;input ~ ", "{", "}input:checked ~ ", "{", "}", ""], CustomCheckbox, checkboxTokens.checkbox.disabled.base, CustomCheckbox, checkboxTokens.checkbox.checked.disabled.base, indeterminate && css(["input ~ ", "{", "}"], CustomCheckbox, checkboxTokens.checkbox.indeterminate.disabled.base));
|
|
29
|
-
}, function (_ref5) {
|
|
30
|
-
var readOnly = _ref5.readOnly,
|
|
31
|
-
indeterminate = _ref5.indeterminate;
|
|
32
|
-
return readOnly && css(["cursor:default;input ~ ", "{", "}input:checked ~ ", "{", "}", ""], CustomCheckbox, checkboxTokens.checkbox.readOnly.base, CustomCheckbox, checkboxTokens.checkbox.checked.readOnly.base, indeterminate && css(["input ~ ", "{", "}"], CustomCheckbox, checkboxTokens.checkbox.indeterminate.readOnly.base));
|
|
33
|
-
}, CustomCheckbox, checkboxTokens.checkmark.color, function (_ref6) {
|
|
34
|
-
var indeterminate = _ref6.indeterminate;
|
|
35
|
-
return indeterminate ? css(["left:25%;top:50%;width:50%;height:1px;", ""], checkboxTokens.checkmark.indeterminate.base) : css(["", ""], checkboxTokens.checkmark.base);
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
export { Container, CustomCheckbox };
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import { CSSObject } from 'styled-components';
|
|
2
|
-
export declare const checkboxTokens: {
|
|
3
|
-
checkbox: {
|
|
4
|
-
base: CSSObject;
|
|
5
|
-
spaceLeft: string;
|
|
6
|
-
hover: {
|
|
7
|
-
base: CSSObject;
|
|
8
|
-
};
|
|
9
|
-
disabled: {
|
|
10
|
-
base: CSSObject;
|
|
11
|
-
};
|
|
12
|
-
readOnly: {
|
|
13
|
-
base: CSSObject;
|
|
14
|
-
};
|
|
15
|
-
checked: {
|
|
16
|
-
base: CSSObject;
|
|
17
|
-
hover: {
|
|
18
|
-
base: CSSObject;
|
|
19
|
-
};
|
|
20
|
-
disabled: {
|
|
21
|
-
base: CSSObject;
|
|
22
|
-
};
|
|
23
|
-
readOnly: {
|
|
24
|
-
base: CSSObject;
|
|
25
|
-
};
|
|
26
|
-
};
|
|
27
|
-
indeterminate: {
|
|
28
|
-
base: CSSObject;
|
|
29
|
-
hover: {
|
|
30
|
-
base: CSSObject;
|
|
31
|
-
};
|
|
32
|
-
disabled: {
|
|
33
|
-
base: CSSObject;
|
|
34
|
-
};
|
|
35
|
-
readOnly: {
|
|
36
|
-
base: CSSObject;
|
|
37
|
-
};
|
|
38
|
-
};
|
|
39
|
-
danger: {
|
|
40
|
-
base: CSSObject;
|
|
41
|
-
hover: {
|
|
42
|
-
base: CSSObject;
|
|
43
|
-
};
|
|
44
|
-
};
|
|
45
|
-
};
|
|
46
|
-
checkmark: {
|
|
47
|
-
base: CSSObject;
|
|
48
|
-
color: string;
|
|
49
|
-
indeterminate: {
|
|
50
|
-
base: CSSObject;
|
|
51
|
-
};
|
|
52
|
-
};
|
|
53
|
-
container: {
|
|
54
|
-
base: CSSObject;
|
|
55
|
-
focus: {
|
|
56
|
-
base: CSSObject;
|
|
57
|
-
};
|
|
58
|
-
withLabel: {
|
|
59
|
-
base: CSSObject;
|
|
60
|
-
};
|
|
61
|
-
noLabel: {
|
|
62
|
-
base: CSSObject;
|
|
63
|
-
};
|
|
64
|
-
};
|
|
65
|
-
};
|
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
import { ddsBaseTokens } from '@norges-domstoler/dds-design-tokens';
|
|
2
|
-
import 'styled-components';
|
|
3
|
-
import { focusVisible } from '../../helpers/styling/focusVisible.js';
|
|
4
|
-
import { hoverInputfield, hoverDangerInputfield } from '../../helpers/styling/hover.js';
|
|
5
|
-
import '../../helpers/styling/focus.js';
|
|
6
|
-
import { dangerInputfield } from '../../helpers/styling/danger.js';
|
|
7
|
-
import '../../helpers/styling/selection.js';
|
|
8
|
-
|
|
9
|
-
var Colors = ddsBaseTokens.colors,
|
|
10
|
-
Spacing = ddsBaseTokens.spacing,
|
|
11
|
-
FontPackages = ddsBaseTokens.fontPackages,
|
|
12
|
-
BorderRadius = ddsBaseTokens.borderRadius;
|
|
13
|
-
var checkboxBase = {
|
|
14
|
-
border: '1px solid',
|
|
15
|
-
backgroundColor: Colors.DdsColorNeutralsWhite,
|
|
16
|
-
borderColor: Colors.DdsColorNeutralsGray5,
|
|
17
|
-
borderRadius: BorderRadius.RadiiDdsBorderRadius1Radius,
|
|
18
|
-
height: FontPackages.supportingStyle_inputtext_02.base.fontSize,
|
|
19
|
-
width: FontPackages.supportingStyle_inputtext_02.base.fontSize
|
|
20
|
-
};
|
|
21
|
-
var checkboxCheckedBase = {
|
|
22
|
-
borderColor: Colors.DdsColorInteractiveBase,
|
|
23
|
-
backgroundColor: Colors.DdsColorInteractiveBase
|
|
24
|
-
};
|
|
25
|
-
var checkboxDisabledBase = {
|
|
26
|
-
borderColor: Colors.DdsColorNeutralsGray5,
|
|
27
|
-
color: Colors.DdsColorNeutralsGray6
|
|
28
|
-
};
|
|
29
|
-
var checkboxCheckedDisabledBase = {
|
|
30
|
-
borderColor: Colors.DdsColorNeutralsGray6,
|
|
31
|
-
backgroundColor: Colors.DdsColorNeutralsGray6
|
|
32
|
-
};
|
|
33
|
-
var checkboxReadOnlyBase = {
|
|
34
|
-
backgroundColor: 'transparent'
|
|
35
|
-
};
|
|
36
|
-
var checkboxCheckedReadOnlyBase = {
|
|
37
|
-
borderColor: Colors.DdsColorNeutralsGray6,
|
|
38
|
-
backgroundColor: Colors.DdsColorNeutralsGray6
|
|
39
|
-
};
|
|
40
|
-
var checkboxHoverBase = Object.assign({}, hoverInputfield);
|
|
41
|
-
var checkboxCheckedHoverBase = {
|
|
42
|
-
backgroundColor: Colors.DdsColorInteractiveDark,
|
|
43
|
-
boxShadow: "inset 0 0 0 1px ".concat(Colors.DdsColorInteractiveDark),
|
|
44
|
-
borderColor: Colors.DdsColorInteractiveDark
|
|
45
|
-
};
|
|
46
|
-
var checkboxDangerBase = Object.assign({}, dangerInputfield);
|
|
47
|
-
var checkboxDangerHoverBase = Object.assign({}, hoverDangerInputfield);
|
|
48
|
-
var focusBase = Object.assign({}, focusVisible);
|
|
49
|
-
var checkmarkBase = {
|
|
50
|
-
borderWidth: '0 1px 1px 0',
|
|
51
|
-
transform: 'rotate(45deg)',
|
|
52
|
-
left: '35%',
|
|
53
|
-
top: '10%',
|
|
54
|
-
width: '30%',
|
|
55
|
-
height: '65%'
|
|
56
|
-
};
|
|
57
|
-
var checkmarkIndeterminateBase = {
|
|
58
|
-
borderWidth: '1px 0 0 0'
|
|
59
|
-
};
|
|
60
|
-
var containerBase = Object.assign({}, FontPackages.body_sans_02.base);
|
|
61
|
-
var containerWithLabelBase = Object.assign(Object.assign({}, FontPackages.body_sans_02.base), {
|
|
62
|
-
padding: "0 ".concat(Spacing.SizesDdsSpacingLocalX025, " 0 ").concat(FontPackages.supportingStyle_inputtext_02.numbers.fontSizeNumber + Spacing.SizesDdsSpacingLocalX075NumberPx, "px")
|
|
63
|
-
});
|
|
64
|
-
var containerNoLabelBase = {
|
|
65
|
-
padding: "".concat(Spacing.SizesDdsSpacingLocalX075, " ").concat(Spacing.SizesDdsSpacingLocalX0125, " ").concat(Spacing.SizesDdsSpacingLocalX075, " ").concat(Spacing.SizesDdsSpacingLocalX15)
|
|
66
|
-
};
|
|
67
|
-
var checkboxTokens = {
|
|
68
|
-
checkbox: {
|
|
69
|
-
base: checkboxBase,
|
|
70
|
-
spaceLeft: Spacing.SizesDdsSpacingLocalX025,
|
|
71
|
-
hover: {
|
|
72
|
-
base: checkboxHoverBase
|
|
73
|
-
},
|
|
74
|
-
disabled: {
|
|
75
|
-
base: checkboxDisabledBase
|
|
76
|
-
},
|
|
77
|
-
readOnly: {
|
|
78
|
-
base: checkboxReadOnlyBase
|
|
79
|
-
},
|
|
80
|
-
checked: {
|
|
81
|
-
base: checkboxCheckedBase,
|
|
82
|
-
hover: {
|
|
83
|
-
base: checkboxCheckedHoverBase
|
|
84
|
-
},
|
|
85
|
-
disabled: {
|
|
86
|
-
base: checkboxCheckedDisabledBase
|
|
87
|
-
},
|
|
88
|
-
readOnly: {
|
|
89
|
-
base: checkboxCheckedReadOnlyBase
|
|
90
|
-
}
|
|
91
|
-
},
|
|
92
|
-
indeterminate: {
|
|
93
|
-
base: checkboxCheckedBase,
|
|
94
|
-
hover: {
|
|
95
|
-
base: checkboxCheckedHoverBase
|
|
96
|
-
},
|
|
97
|
-
disabled: {
|
|
98
|
-
base: checkboxCheckedDisabledBase
|
|
99
|
-
},
|
|
100
|
-
readOnly: {
|
|
101
|
-
base: checkboxCheckedReadOnlyBase
|
|
102
|
-
}
|
|
103
|
-
},
|
|
104
|
-
danger: {
|
|
105
|
-
base: checkboxDangerBase,
|
|
106
|
-
hover: {
|
|
107
|
-
base: checkboxDangerHoverBase
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
},
|
|
111
|
-
checkmark: {
|
|
112
|
-
base: checkmarkBase,
|
|
113
|
-
color: Colors.DdsColorNeutralsWhite,
|
|
114
|
-
indeterminate: {
|
|
115
|
-
base: checkmarkIndeterminateBase
|
|
116
|
-
}
|
|
117
|
-
},
|
|
118
|
-
container: {
|
|
119
|
-
base: containerBase,
|
|
120
|
-
focus: {
|
|
121
|
-
base: focusBase
|
|
122
|
-
},
|
|
123
|
-
withLabel: {
|
|
124
|
-
base: containerWithLabelBase
|
|
125
|
-
},
|
|
126
|
-
noLabel: {
|
|
127
|
-
base: containerNoLabelBase
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
};
|
|
131
|
-
|
|
132
|
-
export { checkboxTokens };
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { RadioButtonProps } from './RadioButton.types';
|
|
2
|
-
export declare const CustomRadioButton: import("styled-components").StyledComponent<"span", any, {}, never>;
|
|
3
|
-
declare type ContainerProps = Pick<RadioButtonProps, 'error' | 'disabled' | 'readOnly'>;
|
|
4
|
-
export declare const Container: import("styled-components").StyledComponent<"label", any, ContainerProps, never>;
|
|
5
|
-
export {};
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import styled, { css } from 'styled-components';
|
|
2
|
-
import { radioButtonTokens } from './RadioButton.tokens.js';
|
|
3
|
-
import { focusVisibleTransitionValue } from '../../helpers/styling/focusVisible.js';
|
|
4
|
-
import '../../helpers/styling/hover.js';
|
|
5
|
-
import '../../helpers/styling/focus.js';
|
|
6
|
-
import '../../helpers/styling/danger.js';
|
|
7
|
-
import '../../helpers/styling/selection.js';
|
|
8
|
-
|
|
9
|
-
var CustomRadioButton = styled.span.withConfig({
|
|
10
|
-
displayName: "RadioButtonstyles__CustomRadioButton",
|
|
11
|
-
componentId: "sc-iwypha-0"
|
|
12
|
-
})(["position:absolute;box-sizing:border-box;border-radius:50%;vertical-align:middle;", " left:", ";&:after{content:'';position:absolute;display:none;}"], radioButtonTokens.radioButton.base, radioButtonTokens.radioButton.spaceLeft);
|
|
13
|
-
var Container = styled.label.withConfig({
|
|
14
|
-
displayName: "RadioButtonstyles__Container",
|
|
15
|
-
componentId: "sc-iwypha-1"
|
|
16
|
-
})(["position:relative;display:block;cursor:pointer;user-select:none;width:fit-content;display:flex;align-items:center;", " input:checked ~ ", ":after{display:block;}input ~ ", "{transition:box-shadow 0.2s,background-color 0.2s,border 0.2s;}input:checked ~ ", "{", "}&:hover input:enabled ~ ", "{", "}&:hover input:checked:enabled ~ ", "{", "}&:focus-within{", " transition:", ";}", " ", " ", " ", ":after{border-radius:50%;", "}"], radioButtonTokens.container.base, CustomRadioButton, CustomRadioButton, CustomRadioButton, radioButtonTokens.radioButton.checked.base, CustomRadioButton, radioButtonTokens.radioButton.hover.base, CustomRadioButton, radioButtonTokens.radioButton.checked.hover.base, radioButtonTokens.container.focus.base, focusVisibleTransitionValue, function (_ref) {
|
|
17
|
-
var error = _ref.error;
|
|
18
|
-
return error && css(["input ~ ", "{", "}&:hover input:enabled ~ ", "{", "}"], CustomRadioButton, radioButtonTokens.radioButton.danger.base, CustomRadioButton, radioButtonTokens.radioButton.danger.hover.base);
|
|
19
|
-
}, function (_ref2) {
|
|
20
|
-
var disabled = _ref2.disabled;
|
|
21
|
-
return disabled && css(["cursor:not-allowed;input ~ ", "{", "}input:checked ~ ", "{", "}"], CustomRadioButton, radioButtonTokens.radioButton.disabled.base, CustomRadioButton, radioButtonTokens.radioButton.checked.disabled.base);
|
|
22
|
-
}, function (_ref3) {
|
|
23
|
-
var readOnly = _ref3.readOnly;
|
|
24
|
-
return readOnly && css(["cursor:default;input ~ ", "{", "}input:checked ~ ", "{", "}"], CustomRadioButton, radioButtonTokens.radioButton.readOnly.base, CustomRadioButton, radioButtonTokens.radioButton.checked.readOnly.base);
|
|
25
|
-
}, CustomRadioButton, radioButtonTokens.checkmark.base);
|
|
26
|
-
|
|
27
|
-
export { Container, CustomRadioButton };
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { CSSObject } from 'styled-components';
|
|
2
|
-
export declare const radioButtonTokens: {
|
|
3
|
-
radioButton: {
|
|
4
|
-
base: CSSObject;
|
|
5
|
-
spaceLeft: string;
|
|
6
|
-
hover: {
|
|
7
|
-
base: CSSObject;
|
|
8
|
-
};
|
|
9
|
-
disabled: {
|
|
10
|
-
base: CSSObject;
|
|
11
|
-
};
|
|
12
|
-
readOnly: {
|
|
13
|
-
base: CSSObject;
|
|
14
|
-
};
|
|
15
|
-
checked: {
|
|
16
|
-
base: CSSObject;
|
|
17
|
-
hover: {
|
|
18
|
-
base: CSSObject;
|
|
19
|
-
};
|
|
20
|
-
disabled: {
|
|
21
|
-
base: CSSObject;
|
|
22
|
-
};
|
|
23
|
-
readOnly: {
|
|
24
|
-
base: CSSObject;
|
|
25
|
-
};
|
|
26
|
-
};
|
|
27
|
-
danger: {
|
|
28
|
-
base: CSSObject;
|
|
29
|
-
hover: {
|
|
30
|
-
base: CSSObject;
|
|
31
|
-
};
|
|
32
|
-
};
|
|
33
|
-
};
|
|
34
|
-
checkmark: {
|
|
35
|
-
base: CSSObject;
|
|
36
|
-
};
|
|
37
|
-
container: {
|
|
38
|
-
base: CSSObject;
|
|
39
|
-
focus: {
|
|
40
|
-
base: CSSObject;
|
|
41
|
-
};
|
|
42
|
-
};
|
|
43
|
-
};
|