@workday/canvas-kit-react 10.0.0-alpha.444-next.0 → 10.0.0-alpha.447-next.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/button/lib/BaseButton.tsx +4 -4
- package/checkbox/lib/Checkbox.tsx +18 -12
- package/dist/commonjs/button/lib/BaseButton.d.ts +1 -1
- package/dist/commonjs/button/lib/BaseButton.d.ts.map +1 -1
- package/dist/commonjs/button/lib/BaseButton.js +4 -4
- package/dist/commonjs/checkbox/lib/Checkbox.d.ts.map +1 -1
- package/dist/commonjs/checkbox/lib/Checkbox.js +11 -11
- package/dist/commonjs/popup/lib/Popper.d.ts +8 -0
- package/dist/commonjs/popup/lib/Popper.d.ts.map +1 -1
- package/dist/commonjs/popup/lib/Popper.js +32 -8
- package/dist/commonjs/popup/lib/PopupPopper.d.ts +7 -0
- package/dist/commonjs/popup/lib/PopupPopper.d.ts.map +1 -1
- package/dist/commonjs/popup/lib/fallbackPlacements.d.ts +9 -0
- package/dist/commonjs/popup/lib/fallbackPlacements.d.ts.map +1 -0
- package/dist/commonjs/popup/lib/fallbackPlacements.js +94 -0
- package/dist/commonjs/popup/lib/hooks/usePopupPopper.d.ts.map +1 -1
- package/dist/commonjs/popup/lib/hooks/usePopupPopper.js +5 -2
- package/dist/commonjs/radio/lib/Radio.d.ts.map +1 -1
- package/dist/commonjs/radio/lib/Radio.js +13 -13
- package/dist/commonjs/select/lib/Select.d.ts.map +1 -1
- package/dist/commonjs/select/lib/Select.js +1 -1
- package/dist/commonjs/table/lib/TableRow.js +1 -1
- package/dist/commonjs/text-area/lib/TextArea.d.ts.map +1 -1
- package/dist/commonjs/text-area/lib/TextArea.js +3 -3
- package/dist/commonjs/text-input/lib/TextInput.js +1 -1
- package/dist/commonjs/tokens/index.d.ts.map +1 -1
- package/dist/commonjs/tokens/lib/depth.d.ts +6 -6
- package/dist/commonjs/tokens/lib/depth.d.ts.map +1 -1
- package/dist/commonjs/tokens/lib/depth.js +6 -6
- package/dist/commonjs/tokens/lib/space.d.ts +65 -27
- package/dist/commonjs/tokens/lib/space.d.ts.map +1 -1
- package/dist/commonjs/tokens/lib/space.js +61 -23
- package/dist/commonjs/tooltip/lib/OverflowTooltip.d.ts +8 -1
- package/dist/commonjs/tooltip/lib/OverflowTooltip.d.ts.map +1 -1
- package/dist/commonjs/tooltip/lib/OverflowTooltip.js +2 -2
- package/dist/commonjs/tooltip/lib/Tooltip.d.ts +7 -0
- package/dist/commonjs/tooltip/lib/Tooltip.d.ts.map +1 -1
- package/dist/commonjs/tooltip/lib/Tooltip.js +2 -2
- package/dist/commonjs/tooltip/lib/TooltipContainer.js +8 -8
- package/dist/es6/button/lib/BaseButton.d.ts +1 -1
- package/dist/es6/button/lib/BaseButton.d.ts.map +1 -1
- package/dist/es6/button/lib/BaseButton.js +4 -4
- package/dist/es6/checkbox/lib/Checkbox.d.ts.map +1 -1
- package/dist/es6/checkbox/lib/Checkbox.js +12 -12
- package/dist/es6/popup/lib/Popper.d.ts +8 -0
- package/dist/es6/popup/lib/Popper.d.ts.map +1 -1
- package/dist/es6/popup/lib/Popper.js +31 -7
- package/dist/es6/popup/lib/PopupPopper.d.ts +7 -0
- package/dist/es6/popup/lib/PopupPopper.d.ts.map +1 -1
- package/dist/es6/popup/lib/fallbackPlacements.d.ts +9 -0
- package/dist/es6/popup/lib/fallbackPlacements.d.ts.map +1 -0
- package/dist/es6/popup/lib/fallbackPlacements.js +72 -0
- package/dist/es6/popup/lib/hooks/usePopupPopper.d.ts.map +1 -1
- package/dist/es6/popup/lib/hooks/usePopupPopper.js +5 -2
- package/dist/es6/radio/lib/Radio.d.ts.map +1 -1
- package/dist/es6/radio/lib/Radio.js +14 -14
- package/dist/es6/select/lib/Select.d.ts.map +1 -1
- package/dist/es6/select/lib/Select.js +2 -2
- package/dist/es6/table/lib/TableRow.js +1 -1
- package/dist/es6/text-area/lib/TextArea.d.ts.map +1 -1
- package/dist/es6/text-area/lib/TextArea.js +4 -4
- package/dist/es6/text-input/lib/TextInput.js +1 -1
- package/dist/es6/tokens/index.d.ts.map +1 -1
- package/dist/es6/tokens/index.js +1 -1
- package/dist/es6/tokens/lib/depth.d.ts +6 -6
- package/dist/es6/tokens/lib/depth.d.ts.map +1 -1
- package/dist/es6/tokens/lib/depth.js +6 -6
- package/dist/es6/tokens/lib/space.d.ts +65 -27
- package/dist/es6/tokens/lib/space.d.ts.map +1 -1
- package/dist/es6/tokens/lib/space.js +61 -23
- package/dist/es6/tooltip/lib/OverflowTooltip.d.ts +8 -1
- package/dist/es6/tooltip/lib/OverflowTooltip.d.ts.map +1 -1
- package/dist/es6/tooltip/lib/OverflowTooltip.js +3 -3
- package/dist/es6/tooltip/lib/Tooltip.d.ts +7 -0
- package/dist/es6/tooltip/lib/Tooltip.d.ts.map +1 -1
- package/dist/es6/tooltip/lib/Tooltip.js +3 -3
- package/dist/es6/tooltip/lib/TooltipContainer.js +8 -8
- package/package.json +3 -3
- package/popup/lib/Popper.tsx +39 -6
- package/popup/lib/PopupPopper.tsx +7 -0
- package/popup/lib/fallbackPlacements.ts +90 -0
- package/popup/lib/hooks/usePopupPopper.ts +6 -2
- package/radio/lib/Radio.tsx +20 -14
- package/select/lib/Select.tsx +2 -9
- package/table/lib/TableRow.tsx +1 -1
- package/text-area/lib/TextArea.tsx +10 -4
- package/text-input/lib/TextInput.tsx +1 -1
- package/tokens/README.md +19 -19
- package/tokens/index.ts +1 -2
- package/tokens/lib/depth.ts +16 -12
- package/tokens/lib/space.ts +84 -46
- package/tooltip/lib/OverflowTooltip.tsx +15 -2
- package/tooltip/lib/Tooltip.tsx +15 -2
- package/tooltip/lib/TooltipContainer.tsx +8 -8
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import * as ReactDOM from 'react-dom';
|
|
3
3
|
import * as PopperJS from '@popperjs/core';
|
|
4
|
+
export const defaultFallbackPlacements = ['top', 'right', 'bottom', 'left'];
|
|
4
5
|
import { usePopupStack } from './hooks';
|
|
5
6
|
import { useLocalRef } from '@workday/canvas-kit-react/common';
|
|
7
|
+
import { fallbackPlacementsModifier } from './fallbackPlacements';
|
|
6
8
|
/**
|
|
7
9
|
* A thin wrapper component around the Popper.js positioning engine. For reference:
|
|
8
10
|
* https://popper.js.org/. `Popper` also automatically works with the {@link PopupStack} system.
|
|
@@ -39,19 +41,23 @@ const getElementFromRefOrElement = (input) => {
|
|
|
39
41
|
const defaultPopperOptions = {};
|
|
40
42
|
// Popper bails early if `open` is false and React hooks cannot be called conditionally,
|
|
41
43
|
// so we're breaking out the open version into another component.
|
|
42
|
-
const OpenPopper = React.forwardRef(({ anchorElement, getAnchorClientRect, popperOptions = defaultPopperOptions, placement: popperPlacement = 'bottom', onPlacementChange, children, portal, popperInstanceRef, }, ref) => {
|
|
44
|
+
const OpenPopper = React.forwardRef(({ anchorElement, getAnchorClientRect, popperOptions = defaultPopperOptions, placement: popperPlacement = 'bottom', fallbackPlacements = defaultFallbackPlacements, onPlacementChange, children, portal, popperInstanceRef, }, ref) => {
|
|
43
45
|
const firstRender = React.useRef(true);
|
|
44
46
|
const { localRef, elementRef } = useLocalRef(popperInstanceRef);
|
|
45
47
|
const [placement, setPlacement] = React.useState(popperPlacement);
|
|
46
48
|
const stackRef = usePopupStack(ref, anchorElement);
|
|
49
|
+
const placementRef = React.useRef(popperPlacement);
|
|
50
|
+
placementRef.current = placement;
|
|
47
51
|
const placementModifier = React.useMemo(() => {
|
|
48
52
|
return {
|
|
49
53
|
name: 'setPlacement',
|
|
50
54
|
enabled: true,
|
|
51
|
-
phase: '
|
|
55
|
+
phase: 'afterWrite',
|
|
52
56
|
fn({ state }) {
|
|
53
|
-
|
|
54
|
-
|
|
57
|
+
if (placementRef.current !== state.placement) {
|
|
58
|
+
setPlacement(state.placement);
|
|
59
|
+
onPlacementChange === null || onPlacementChange === void 0 ? void 0 : onPlacementChange(state.placement);
|
|
60
|
+
}
|
|
55
61
|
},
|
|
56
62
|
};
|
|
57
63
|
}, [setPlacement, onPlacementChange]);
|
|
@@ -68,7 +74,16 @@ const OpenPopper = React.forwardRef(({ anchorElement, getAnchorClientRect, poppe
|
|
|
68
74
|
const instance = PopperJS.createPopper(anchorEl, stackRef.current, {
|
|
69
75
|
placement: popperPlacement,
|
|
70
76
|
...popperOptions,
|
|
71
|
-
modifiers: [
|
|
77
|
+
modifiers: [
|
|
78
|
+
placementModifier,
|
|
79
|
+
{
|
|
80
|
+
...fallbackPlacementsModifier,
|
|
81
|
+
options: {
|
|
82
|
+
fallbackPlacements,
|
|
83
|
+
},
|
|
84
|
+
},
|
|
85
|
+
...(popperOptions.modifiers || []),
|
|
86
|
+
],
|
|
72
87
|
});
|
|
73
88
|
elementRef(instance); // update the ref with the instance
|
|
74
89
|
return () => {
|
|
@@ -88,11 +103,20 @@ const OpenPopper = React.forwardRef(({ anchorElement, getAnchorClientRect, poppe
|
|
|
88
103
|
(_a = localRef.current) === null || _a === void 0 ? void 0 : _a.setOptions({
|
|
89
104
|
placement: popperPlacement,
|
|
90
105
|
...popperOptions,
|
|
91
|
-
modifiers: [
|
|
106
|
+
modifiers: [
|
|
107
|
+
placementModifier,
|
|
108
|
+
{
|
|
109
|
+
...fallbackPlacementsModifier,
|
|
110
|
+
options: {
|
|
111
|
+
fallbackPlacements,
|
|
112
|
+
},
|
|
113
|
+
},
|
|
114
|
+
...(popperOptions.modifiers || []),
|
|
115
|
+
],
|
|
92
116
|
});
|
|
93
117
|
}
|
|
94
118
|
firstRender.current = false;
|
|
95
|
-
}, [popperOptions, popperPlacement, placementModifier, localRef]);
|
|
119
|
+
}, [popperOptions, popperPlacement, fallbackPlacements, placementModifier, localRef]);
|
|
96
120
|
const contents = React.createElement(React.Fragment, null, isRenderProp(children) ? children({ placement }) : children);
|
|
97
121
|
if (!portal) {
|
|
98
122
|
return contents;
|
|
@@ -8,6 +8,13 @@ export interface PopupPopperProps extends PopperProps {
|
|
|
8
8
|
* @default bottom
|
|
9
9
|
*/
|
|
10
10
|
placement?: Placement;
|
|
11
|
+
/**
|
|
12
|
+
* Define fallback placements by providing a list of {@link Placement} in array (in order of preference).
|
|
13
|
+
* The default preference is following the order of `top`, `right`, `bottom`, and `left`. Once the initial
|
|
14
|
+
* and opposite placements are not available, the fallback placements will be in use. Use an empty array to
|
|
15
|
+
* disable the fallback placements.
|
|
16
|
+
*/
|
|
17
|
+
fallbackPlacements?: Placement[];
|
|
11
18
|
/**
|
|
12
19
|
* The additional options passed to the Popper's `popper.js` instance.
|
|
13
20
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PopupPopper.d.ts","sourceRoot":"","sources":["../../../../popup/lib/PopupPopper.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAK/B,OAAO,EAAC,SAAS,EAAE,aAAa,EAAU,WAAW,EAAC,MAAM,UAAU,CAAC;AAEvE,MAAM,WAAW,gBAAiB,SAAQ,WAAW;IACnD;;;;;OAKG;IACH,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB;;OAEG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC,aAAa,CAAC,CAAC;CACxC;AAED,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;EAMtB,CAAC"}
|
|
1
|
+
{"version":3,"file":"PopupPopper.d.ts","sourceRoot":"","sources":["../../../../popup/lib/PopupPopper.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAK/B,OAAO,EAAC,SAAS,EAAE,aAAa,EAAU,WAAW,EAAC,MAAM,UAAU,CAAC;AAEvE,MAAM,WAAW,gBAAiB,SAAQ,WAAW;IACnD;;;;;OAKG;IACH,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB;;;;;OAKG;IACH,kBAAkB,CAAC,EAAE,SAAS,EAAE,CAAC;IACjC;;OAEG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC,aAAa,CAAC,CAAC;CACxC;AAED,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;EAMtB,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as PopperJS from '@popperjs/core';
|
|
2
|
+
export declare type Placement = PopperJS.Placement;
|
|
3
|
+
export declare type Options = {
|
|
4
|
+
fallbackPlacements: Placement[];
|
|
5
|
+
};
|
|
6
|
+
declare const name = "fallbackModifier";
|
|
7
|
+
export declare const fallbackPlacementsModifier: PopperJS.Modifier<typeof name, Options>;
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=fallbackPlacements.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fallbackPlacements.d.ts","sourceRoot":"","sources":["../../../../popup/lib/fallbackPlacements.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,QAAQ,MAAM,gBAAgB,CAAC;AAE3C,oBAAY,SAAS,GAAG,QAAQ,CAAC,SAAS,CAAC;AAyD3C,oBAAY,OAAO,GAAG;IACpB,kBAAkB,EAAE,SAAS,EAAE,CAAC;CACjC,CAAC;AAEF,QAAA,MAAM,IAAI,qBAAqB,CAAC;AAEhC,eAAO,MAAM,0BAA0B,EAAE,QAAQ,CAAC,QAAQ,CAAC,OAAO,IAAI,EAAE,OAAO,CAwB9E,CAAC"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import * as PopperJS from '@popperjs/core';
|
|
2
|
+
const getOppositePlacement = (popperPlacement) => {
|
|
3
|
+
var _a;
|
|
4
|
+
const [first, second] = popperPlacement.split('-');
|
|
5
|
+
let oppositePlacement;
|
|
6
|
+
switch (first) {
|
|
7
|
+
case 'top':
|
|
8
|
+
oppositePlacement = 'bottom';
|
|
9
|
+
break;
|
|
10
|
+
case 'bottom':
|
|
11
|
+
oppositePlacement = 'top';
|
|
12
|
+
break;
|
|
13
|
+
case 'left':
|
|
14
|
+
oppositePlacement = 'right';
|
|
15
|
+
break;
|
|
16
|
+
case 'right':
|
|
17
|
+
oppositePlacement = 'left';
|
|
18
|
+
break;
|
|
19
|
+
default:
|
|
20
|
+
oppositePlacement = 'auto';
|
|
21
|
+
}
|
|
22
|
+
if (second) {
|
|
23
|
+
oppositePlacement =
|
|
24
|
+
(_a = PopperJS.placements.find(placement => placement.includes(`${oppositePlacement}-${second}`))) !== null && _a !== void 0 ? _a : oppositePlacement;
|
|
25
|
+
}
|
|
26
|
+
return oppositePlacement;
|
|
27
|
+
};
|
|
28
|
+
const choseAvailablePlacement = (placements, state, preferredPlacement) => {
|
|
29
|
+
if (placements.length === 0 || placements[0].split('-')[0] === 'auto') {
|
|
30
|
+
return preferredPlacement;
|
|
31
|
+
}
|
|
32
|
+
const { reference, popper } = state.rects;
|
|
33
|
+
const overflow = PopperJS.detectOverflow({ ...state, placement: placements[0] });
|
|
34
|
+
const direction = /left|right/.test(placements[0].split('-')[0]) ? 'horizontal' : 'vertical';
|
|
35
|
+
const isOverflowed = (overflow.top > 0 || overflow.bottom > 0 || overflow.left > 0 || overflow.right > 0) &&
|
|
36
|
+
(direction === 'horizontal'
|
|
37
|
+
? popper.height / 2 - overflow.top < reference.height ||
|
|
38
|
+
popper.height / 2 - overflow.bottom < reference.height
|
|
39
|
+
: popper.width - overflow.left < reference.width ||
|
|
40
|
+
popper.width - overflow.right < reference.width);
|
|
41
|
+
const key = placements[0].split('-')[0];
|
|
42
|
+
if (!isOverflowed && overflow[key] <= 0) {
|
|
43
|
+
return placements[0];
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
return choseAvailablePlacement(placements.slice(1), state, preferredPlacement);
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
const name = 'fallbackModifier';
|
|
50
|
+
export const fallbackPlacementsModifier = {
|
|
51
|
+
name: name,
|
|
52
|
+
enabled: true,
|
|
53
|
+
phase: 'main',
|
|
54
|
+
data: {
|
|
55
|
+
_skip: false,
|
|
56
|
+
},
|
|
57
|
+
fn({ state, options }) {
|
|
58
|
+
const preferredPlacement = state.options.placement;
|
|
59
|
+
const { fallbackPlacements } = options;
|
|
60
|
+
const placements = [
|
|
61
|
+
preferredPlacement,
|
|
62
|
+
getOppositePlacement(preferredPlacement),
|
|
63
|
+
...(fallbackPlacements || []),
|
|
64
|
+
];
|
|
65
|
+
const placementOverride = choseAvailablePlacement(placements, state, preferredPlacement);
|
|
66
|
+
if (state.placement !== placementOverride) {
|
|
67
|
+
state.modifiersData[name]._skip = true;
|
|
68
|
+
state.placement = placementOverride;
|
|
69
|
+
state.reset = true;
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usePopupPopper.d.ts","sourceRoot":"","sources":["../../../../../popup/lib/hooks/usePopupPopper.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAC,SAAS,EAAC,MAAM,WAAW,CAAC;AAEpC;;;GAGG;AACH,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"usePopupPopper.d.ts","sourceRoot":"","sources":["../../../../../popup/lib/hooks/usePopupPopper.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAC,SAAS,EAAC,MAAM,WAAW,CAAC;AAEpC;;;GAGG;AACH,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;mCAOX,SAAS;EAevB,CAAC"}
|
|
@@ -7,12 +7,15 @@ import React from 'react';
|
|
|
7
7
|
*/
|
|
8
8
|
export const usePopupPopper = createElemPropsHook(usePopupModel)(({ state, events }, ref) => {
|
|
9
9
|
const elementRef = useForkRef(ref, state.stackRef);
|
|
10
|
+
// Create a mutable ref of the placement to keep a stable `onPlacementChange` reference.
|
|
11
|
+
const placementRef = React.useRef(state.placement);
|
|
12
|
+
placementRef.current = state.placement;
|
|
10
13
|
const onPlacementChange = React.useCallback((placement) => {
|
|
11
|
-
if (placement !==
|
|
14
|
+
if (placement !== placementRef.current) {
|
|
12
15
|
// only update if the placement has changed
|
|
13
16
|
events.updatePlacement({ placement });
|
|
14
17
|
}
|
|
15
|
-
}, [events
|
|
18
|
+
}, [events]);
|
|
16
19
|
return {
|
|
17
20
|
open: state.visibility !== 'hidden',
|
|
18
21
|
anchorElement: state.targetRef,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Radio.d.ts","sourceRoot":"","sources":["../../../../radio/lib/Radio.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAML,SAAS,EAEV,MAAM,kCAAkC,CAAC;
|
|
1
|
+
{"version":3,"file":"Radio.d.ts","sourceRoot":"","sources":["../../../../radio/lib/Radio.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAML,SAAS,EAEV,MAAM,kCAAkC,CAAC;AAU1C,MAAM,WAAW,UAAW,SAAQ,SAAS;IAC3C;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;OAGG;IACH,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,QAAQ,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,WAAW,CAAC,gBAAgB,CAAC,KAAK,IAAI,CAAC;IAC5D;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,SAAS,GAAG,SAAS,CAAC;CACjC;AAmOD,eAAO,MAAM,KAAK,kFAqDhB,CAAC"}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { createComponent, focusRing, mouseFocusBehavior, styled, useUniqueId, } from '@workday/canvas-kit-react/common';
|
|
3
|
-
import { borderRadius, colors, inputColors, spaceNumbers } from '@workday/canvas-kit-react/tokens';
|
|
3
|
+
import { borderRadius, colors, inputColors, space, spaceNumbers, } from '@workday/canvas-kit-react/tokens';
|
|
4
4
|
import { LabelText } from '@workday/canvas-kit-react/text';
|
|
5
|
-
const radioBorderRadius =
|
|
6
|
-
const radioDot =
|
|
7
|
-
const radioHeight =
|
|
8
|
-
const radioTapArea =
|
|
5
|
+
const radioBorderRadius = `${spaceNumbers.xxs + 0.0625}rem`;
|
|
6
|
+
const radioDot = space.xxs;
|
|
7
|
+
const radioHeight = (spaceNumbers.xl - spaceNumbers.xxxs) / 2;
|
|
8
|
+
const radioTapArea = space.m;
|
|
9
9
|
const radioContainerHeight = radioTapArea;
|
|
10
|
-
const radioLabelDistance =
|
|
11
|
-
const radioWidth =
|
|
10
|
+
const radioLabelDistance = space.xs;
|
|
11
|
+
const radioWidth = radioHeight;
|
|
12
12
|
const rippleRadius = (spaceNumbers.l - radioWidth) / 2;
|
|
13
13
|
const RadioContainer = styled('div')({
|
|
14
14
|
display: 'flex',
|
|
@@ -23,15 +23,15 @@ const RadioContainer = styled('div')({
|
|
|
23
23
|
*/
|
|
24
24
|
const RadioInputWrapper = styled('div')({
|
|
25
25
|
display: 'flex',
|
|
26
|
-
height: radioHeight
|
|
27
|
-
width: radioWidth
|
|
26
|
+
height: `${radioHeight}rem`,
|
|
27
|
+
width: `${radioWidth}rem`,
|
|
28
28
|
});
|
|
29
29
|
const RadioRipple = styled('span')({
|
|
30
30
|
borderRadius: borderRadius.circle,
|
|
31
31
|
boxShadow: `0 0 0 0 ${colors.soap200}`,
|
|
32
|
-
height: radioHeight
|
|
32
|
+
height: `${radioHeight}rem`,
|
|
33
33
|
transition: 'box-shadow 150ms ease-out',
|
|
34
|
-
width: radioWidth
|
|
34
|
+
width: `${radioWidth}rem`,
|
|
35
35
|
position: 'absolute',
|
|
36
36
|
pointerEvents: 'none', // This is a decorative element we don't want it to block clicks to input
|
|
37
37
|
}, ({ variant }) => ({
|
|
@@ -62,7 +62,7 @@ const RadioInput = styled('input')({
|
|
|
62
62
|
// `span:first-of-type` refers to `RadioRipple`, the light grey
|
|
63
63
|
// element that animates around the component on hover
|
|
64
64
|
'&:hover ~ span:first-of-type': {
|
|
65
|
-
boxShadow: disabled ? undefined : `0 0 0 ${rippleRadius}
|
|
65
|
+
boxShadow: disabled ? undefined : `0 0 0 ${rippleRadius}rem ${colors.soap200}`,
|
|
66
66
|
},
|
|
67
67
|
// `div:first-of-type` refers to the `RadioBackground`, the visual facade of the
|
|
68
68
|
// input (which is visually hidden)
|
|
@@ -141,13 +141,13 @@ const RadioBackground = styled('div')({
|
|
|
141
141
|
borderWidth: '1px',
|
|
142
142
|
boxSizing: 'border-box',
|
|
143
143
|
display: 'flex',
|
|
144
|
-
height: radioHeight
|
|
144
|
+
height: `${radioHeight}rem`,
|
|
145
145
|
justifyContent: 'center',
|
|
146
146
|
padding: '0px 2px',
|
|
147
147
|
pointerEvents: 'none',
|
|
148
148
|
position: 'absolute',
|
|
149
149
|
transition: 'border 200ms ease, background 200ms',
|
|
150
|
-
width: radioWidth
|
|
150
|
+
width: `${radioWidth}rem`,
|
|
151
151
|
}, ({ checked, disabled, variant, theme: { canvas: { palette: { primary: themePrimary }, }, }, }) => ({
|
|
152
152
|
borderColor: checked
|
|
153
153
|
? variant === 'inverse'
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Select.d.ts","sourceRoot":"","sources":["../../../../select/lib/Select.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAGL,cAAc,EACd,SAAS,EAGT,SAAS,EACV,MAAM,kCAAkC,CAAC;
|
|
1
|
+
{"version":3,"file":"Select.d.ts","sourceRoot":"","sources":["../../../../select/lib/Select.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAGL,cAAc,EACd,SAAS,EAGT,SAAS,EACV,MAAM,kCAAkC,CAAC;AAI1C,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAC;AAE5C,MAAM,WAAW,WAAY,SAAQ,SAAS,EAAE,cAAc;IAC5D;;OAEG;IACH,QAAQ,EAAE,KAAK,CAAC,YAAY,CAAC,YAAY,CAAC,GAAG,KAAK,CAAC,YAAY,CAAC,YAAY,CAAC,EAAE,CAAC;IAChF;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;OAEG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB;;OAEG;IACH,QAAQ,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,WAAW,CAAC,iBAAiB,CAAC,KAAK,IAAI,CAAC;IAC7D;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AA0ED,eAAO,MAAM,MAAM;;CAiBjB,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { createComponent, ErrorType, errorRing, styled, } from '@workday/canvas-kit-react/common';
|
|
3
|
-
import { colors, borderRadius, inputColors,
|
|
3
|
+
import { colors, borderRadius, inputColors, type, space } from '@workday/canvas-kit-react/tokens';
|
|
4
4
|
import { caretDownSmallIcon } from '@workday/canvas-system-icons-web';
|
|
5
5
|
import { SystemIcon } from '@workday/canvas-kit-react/icon';
|
|
6
6
|
const StyledSelect = styled('select')({
|
|
@@ -13,7 +13,7 @@ const StyledSelect = styled('select')({
|
|
|
13
13
|
height: space.xl,
|
|
14
14
|
minWidth: 280,
|
|
15
15
|
transition: '0.2s box-shadow, 0.2s border-color',
|
|
16
|
-
padding:
|
|
16
|
+
padding: space.xxs,
|
|
17
17
|
margin: 0,
|
|
18
18
|
MozAppearance: 'none',
|
|
19
19
|
WebkitAppearance: 'none',
|
|
@@ -77,7 +77,7 @@ const StyledTableRow = styled('tr')({
|
|
|
77
77
|
fontSize: 13,
|
|
78
78
|
borderRight: cellBorder,
|
|
79
79
|
borderBottom: cellBorder,
|
|
80
|
-
height: spaceNumbers.xl + spaceNumbers.xxs
|
|
80
|
+
height: `${spaceNumbers.xl + spaceNumbers.xxs}rem`,
|
|
81
81
|
boxSizing: 'border-box',
|
|
82
82
|
transition: 'background-color 0.2s',
|
|
83
83
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextArea.d.ts","sourceRoot":"","sources":["../../../../text-area/lib/TextArea.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAGL,cAAc,EACd,SAAS,EAGT,SAAS,EACV,MAAM,kCAAkC,CAAC;
|
|
1
|
+
{"version":3,"file":"TextArea.d.ts","sourceRoot":"","sources":["../../../../text-area/lib/TextArea.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAGL,cAAc,EACd,SAAS,EAGT,SAAS,EACV,MAAM,kCAAkC,CAAC;AAS1C,MAAM,WAAW,aAAc,SAAQ,SAAS,EAAE,cAAc;IAC9D;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;OAEG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB;;OAEG;IACH,QAAQ,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,WAAW,CAAC,mBAAmB,CAAC,KAAK,IAAI,CAAC;IAC/D;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;OAGG;IACH,MAAM,CAAC,EAAE,uBAAuB,CAAC;IACjC;;OAEG;IACH,KAAK,CAAC,EAAE,GAAG,CAAC;CACb;AAED,oBAAY,uBAAuB;IACjC,IAAI,SAAS;IACb,IAAI,SAAS;IACb,UAAU,eAAe;IACzB,QAAQ,aAAa;CACtB;AA8CD,eAAO,MAAM,QAAQ;;;CAWnB,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { createComponent, ErrorType, errorRing, styled, } from '@workday/canvas-kit-react/common';
|
|
3
|
-
import { borderRadius, inputColors, spaceNumbers, type } from '@workday/canvas-kit-react/tokens';
|
|
3
|
+
import { borderRadius, inputColors, space, spaceNumbers, type, } from '@workday/canvas-kit-react/tokens';
|
|
4
4
|
export var TextAreaResizeDirection;
|
|
5
5
|
(function (TextAreaResizeDirection) {
|
|
6
6
|
TextAreaResizeDirection["None"] = "none";
|
|
@@ -15,10 +15,10 @@ const StyledTextArea = styled('textarea')(({ theme, error }) => ({
|
|
|
15
15
|
backgroundColor: inputColors.background,
|
|
16
16
|
borderRadius: borderRadius.m,
|
|
17
17
|
boxSizing: 'border-box',
|
|
18
|
-
minHeight:
|
|
19
|
-
minWidth:
|
|
18
|
+
minHeight: space.xxl,
|
|
19
|
+
minWidth: `${spaceNumbers.xxxl * 3 + spaceNumbers.xl}rem`,
|
|
20
20
|
transition: '0.2s box-shadow, 0.2s border-color',
|
|
21
|
-
padding:
|
|
21
|
+
padding: space.xxs,
|
|
22
22
|
margin: 0,
|
|
23
23
|
'&::webkit-resizer': {
|
|
24
24
|
display: 'none',
|
|
@@ -10,7 +10,7 @@ const StyledTextInput = styled('input')({
|
|
|
10
10
|
boxSizing: 'border-box',
|
|
11
11
|
height: 40,
|
|
12
12
|
transition: '0.2s box-shadow, 0.2s border-color',
|
|
13
|
-
padding: spaceNumbers.xxs
|
|
13
|
+
padding: `${spaceNumbers.xxs}rem`,
|
|
14
14
|
margin: 0,
|
|
15
15
|
'&::placeholder': {
|
|
16
16
|
color: inputColors.placeholder,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../tokens/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,MAAM,EAEN,SAAS,EAKV,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EAAC,YAAY,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,wBAAwB,EAAC,MAAM,cAAc,CAAC;AAChH,OAAO,EAAC,aAAa,EAAE,WAAW,EAAC,MAAM,oBAAoB,CAAC;AAC9D,OAAO,EAAC,KAAK,EAAE,WAAW,EAAE,iBAAiB,EAAC,MAAM,aAAa,CAAC;AAClE,OAAO,EACL,KAAK,EACL,WAAW,EACX,eAAe,EACf,iBAAiB,EACjB,uBAAuB,EACvB,kBAAkB,EAClB,YAAY,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../tokens/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,MAAM,EAEN,SAAS,EAKV,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EAAC,YAAY,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,wBAAwB,EAAC,MAAM,cAAc,CAAC;AAChH,OAAO,EAAC,aAAa,EAAE,WAAW,EAAC,MAAM,oBAAoB,CAAC;AAC9D,OAAO,EAAC,KAAK,EAAE,WAAW,EAAE,iBAAiB,EAAC,MAAM,aAAa,CAAC;AAClE,OAAO,EACL,KAAK,EACL,WAAW,EACX,eAAe,EACf,iBAAiB,EACjB,uBAAuB,EACvB,kBAAkB,EAClB,YAAY,EAAC,MAAM,aAAa,CAAC;AACnC,OAAO,EAAC,IAAI,EACV,UAAU,EACV,cAAc,EACd,UAAU,EACV,oBAAoB,EACpB,kBAAkB,EAClB,mBAAmB,EACpB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAC,aAAa,EAAC,MAAM,aAAa,CAAC;AAE1C,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgBlB,CAAC;AAEF,cAAc,4BAA4B,CAAC;AAC3C,OAAO,EACL,YAAY,EACZ,MAAM,EACN,SAAS,EACT,KAAK,EACL,KAAK,EACL,YAAY,EACZ,IAAI,EACJ,UAAU,EACV,cAAc,EACd,aAAa,GACd,CAAC;AAEF,YAAY,EACV,kBAAkB,EAClB,sBAAsB,EACtB,wBAAwB,EACxB,WAAW,EACX,WAAW,EACX,iBAAiB,EACjB,WAAW,EACX,eAAe,EACf,iBAAiB,EACjB,uBAAuB,EACvB,kBAAkB,EAClB,UAAU,EACV,oBAAoB,EACpB,kBAAkB,EAClB,mBAAmB,EACnB,aAAa,GACd,CAAA"}
|
package/dist/es6/tokens/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import { buttonColors, chartingColorOffsets, chartingColors, colors, commonColor
|
|
|
2
2
|
import { borderRadius } from './lib/radius';
|
|
3
3
|
import { BrandingColor } from './lib/colors.types';
|
|
4
4
|
import { depth } from './lib/depth';
|
|
5
|
-
import { space, spaceNumbers
|
|
5
|
+
import { space, spaceNumbers } from './lib/space';
|
|
6
6
|
import { type, fontFamily, monoFontFamily, } from './lib/type';
|
|
7
7
|
export const canvas = {
|
|
8
8
|
buttonColors,
|
|
@@ -29,7 +29,7 @@ export declare type CanvasDepth = {
|
|
|
29
29
|
* ```
|
|
30
30
|
*/
|
|
31
31
|
1: {
|
|
32
|
-
boxShadow: '
|
|
32
|
+
boxShadow: '0 0.0625rem 0.25rem rgba(31, 38, 46, 0.12), 0 0.125rem 0.5rem rgba(31, 38, 46, 0.08)';
|
|
33
33
|
};
|
|
34
34
|
/**
|
|
35
35
|
* ### Depth 2
|
|
@@ -45,7 +45,7 @@ export declare type CanvasDepth = {
|
|
|
45
45
|
* ```
|
|
46
46
|
*/
|
|
47
47
|
2: {
|
|
48
|
-
boxShadow: '
|
|
48
|
+
boxShadow: '0 0.125rem 0.5rem rgba(31, 38, 46, 0.12), 0 0.25rem 1rem rgba(31, 38, 46, 0.08)';
|
|
49
49
|
};
|
|
50
50
|
/**
|
|
51
51
|
* ### Depth 3
|
|
@@ -61,7 +61,7 @@ export declare type CanvasDepth = {
|
|
|
61
61
|
* ```
|
|
62
62
|
*/
|
|
63
63
|
3: {
|
|
64
|
-
boxShadow: '
|
|
64
|
+
boxShadow: '0 0.1875rem 0.75rem rgba(31, 38, 46, 0.12), 0 0.375rem 1.5rem rgba(31, 38, 46, 0.08)';
|
|
65
65
|
};
|
|
66
66
|
/**
|
|
67
67
|
* ### Depth 4
|
|
@@ -76,7 +76,7 @@ export declare type CanvasDepth = {
|
|
|
76
76
|
* ```
|
|
77
77
|
*/
|
|
78
78
|
4: {
|
|
79
|
-
boxShadow: '
|
|
79
|
+
boxShadow: '0 0.25rem 1rem rgba(31, 38, 46, 0.12), 0 0.5rem 2rem rgba(31, 38, 46, 0.08)';
|
|
80
80
|
};
|
|
81
81
|
/**
|
|
82
82
|
* ### Depth 5
|
|
@@ -92,7 +92,7 @@ export declare type CanvasDepth = {
|
|
|
92
92
|
* ```
|
|
93
93
|
*/
|
|
94
94
|
5: {
|
|
95
|
-
boxShadow: '
|
|
95
|
+
boxShadow: '0 0.3125rem 1.25rem rgba(31, 38, 46, 0.12), 0 0.625rem 2.5rem rgba(31, 38, 46, 0.08)';
|
|
96
96
|
};
|
|
97
97
|
/**
|
|
98
98
|
* ### Depth 6
|
|
@@ -108,7 +108,7 @@ export declare type CanvasDepth = {
|
|
|
108
108
|
* ```
|
|
109
109
|
*/
|
|
110
110
|
6: {
|
|
111
|
-
boxShadow: '
|
|
111
|
+
boxShadow: '0 0.375rem 1.5rem rgba(31, 38, 46, 0.12), 0 0.75rem 3rem rgba(31, 38, 46, 0.08)';
|
|
112
112
|
};
|
|
113
113
|
};
|
|
114
114
|
declare type ValueOf<T> = T[keyof T];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"depth.d.ts","sourceRoot":"","sources":["../../../../tokens/lib/depth.ts"],"names":[],"mappings":"AAAA,oBAAY,WAAW,GAAG;IACxB;;;;;;;;;;;;OAYG;IACH,IAAI,EAAE;QACJ,SAAS,EAAE,MAAM,CAAC;KACnB,CAAC;IACF;;;;;;;;;;;;OAYG;IACH,CAAC,EAAE;QACD,SAAS,EAAE,
|
|
1
|
+
{"version":3,"file":"depth.d.ts","sourceRoot":"","sources":["../../../../tokens/lib/depth.ts"],"names":[],"mappings":"AAAA,oBAAY,WAAW,GAAG;IACxB;;;;;;;;;;;;OAYG;IACH,IAAI,EAAE;QACJ,SAAS,EAAE,MAAM,CAAC;KACnB,CAAC;IACF;;;;;;;;;;;;OAYG;IACH,CAAC,EAAE;QACD,SAAS,EAAE,sFAAsF,CAAC;KACnG,CAAC;IACF;;;;;;;;;;;;OAYG;IACH,CAAC,EAAE;QACD,SAAS,EAAE,iFAAiF,CAAC;KAC9F,CAAC;IACF;;;;;;;;;;;;OAYG;IACH,CAAC,EAAE;QACD,SAAS,EAAE,sFAAsF,CAAC;KACnG,CAAC;IACF;;;;;;;;;;;OAWG;IACH,CAAC,EAAE;QACD,SAAS,EAAE,6EAA6E,CAAC;KAC1F,CAAC;IACF;;;;;;;;;;;;OAYG;IACH,CAAC,EAAE;QACD,SAAS,EAAE,sFAAsF,CAAC;KACnG,CAAC;IACF;;;;;;;;;;;;OAYG;IACH,CAAC,EAAE;QACD,SAAS,EAAE,iFAAiF,CAAC;KAC9F,CAAC;CACH,CAAC;AAEF,aAAK,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;AAC7B,oBAAY,iBAAiB,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;AAErD;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,eAAO,MAAM,KAAK,EAAE,WAyBnB,CAAC"}
|
|
@@ -25,21 +25,21 @@ export const depth = {
|
|
|
25
25
|
boxShadow: 'none',
|
|
26
26
|
},
|
|
27
27
|
1: {
|
|
28
|
-
boxShadow: '
|
|
28
|
+
boxShadow: '0 0.0625rem 0.25rem rgba(31, 38, 46, 0.12), 0 0.125rem 0.5rem rgba(31, 38, 46, 0.08)',
|
|
29
29
|
},
|
|
30
30
|
2: {
|
|
31
|
-
boxShadow: '
|
|
31
|
+
boxShadow: '0 0.125rem 0.5rem rgba(31, 38, 46, 0.12), 0 0.25rem 1rem rgba(31, 38, 46, 0.08)',
|
|
32
32
|
},
|
|
33
33
|
3: {
|
|
34
|
-
boxShadow: '
|
|
34
|
+
boxShadow: '0 0.1875rem 0.75rem rgba(31, 38, 46, 0.12), 0 0.375rem 1.5rem rgba(31, 38, 46, 0.08)',
|
|
35
35
|
},
|
|
36
36
|
4: {
|
|
37
|
-
boxShadow: '
|
|
37
|
+
boxShadow: '0 0.25rem 1rem rgba(31, 38, 46, 0.12), 0 0.5rem 2rem rgba(31, 38, 46, 0.08)',
|
|
38
38
|
},
|
|
39
39
|
5: {
|
|
40
|
-
boxShadow: '
|
|
40
|
+
boxShadow: '0 0.3125rem 1.25rem rgba(31, 38, 46, 0.12), 0 0.625rem 2.5rem rgba(31, 38, 46, 0.08)',
|
|
41
41
|
},
|
|
42
42
|
6: {
|
|
43
|
-
boxShadow: '
|
|
43
|
+
boxShadow: '0 0.375rem 1.5rem rgba(31, 38, 46, 0.12), 0 0.75rem 3rem rgba(31, 38, 46, 0.08)',
|
|
44
44
|
},
|
|
45
45
|
};
|
|
@@ -1,44 +1,82 @@
|
|
|
1
1
|
declare type ValueOf<T> = T[keyof T];
|
|
2
|
-
/** Type for the `space` object with keys and
|
|
2
|
+
/** Type for the `space` object with keys and rem values (strings) */
|
|
3
3
|
export declare type CanvasSpace = {
|
|
4
|
-
zero: '
|
|
5
|
-
xxxs: '
|
|
6
|
-
xxs: '
|
|
7
|
-
xs: '
|
|
8
|
-
s: '
|
|
9
|
-
m: '
|
|
10
|
-
l: '
|
|
11
|
-
xl: '
|
|
12
|
-
xxl: '
|
|
13
|
-
xxxl: '
|
|
4
|
+
zero: '0';
|
|
5
|
+
xxxs: '0.25rem';
|
|
6
|
+
xxs: '0.5rem';
|
|
7
|
+
xs: '0.75rem';
|
|
8
|
+
s: '1rem';
|
|
9
|
+
m: '1.5rem';
|
|
10
|
+
l: '2rem';
|
|
11
|
+
xl: '2.5rem';
|
|
12
|
+
xxl: '4rem';
|
|
13
|
+
xxxl: '5rem';
|
|
14
14
|
};
|
|
15
15
|
/** Type for `CanvasSpace` keys */
|
|
16
16
|
export declare type CanvasSpaceKeys = keyof CanvasSpace;
|
|
17
|
-
/** The
|
|
17
|
+
/** The rem values for CanvasSpace (strings) */
|
|
18
18
|
export declare type CanvasSpaceValues = ValueOf<CanvasSpace>;
|
|
19
|
-
/**
|
|
19
|
+
/**
|
|
20
|
+
* An object of space keys and rem values (strings)
|
|
21
|
+
*
|
|
22
|
+
* Below is a table to show the equivalent values from `px` to `rem`.
|
|
23
|
+
* This is based on the default browser font size which is `16px`.
|
|
24
|
+
*
|
|
25
|
+
* | px Value | rem Value | space token |
|
|
26
|
+
* | --------- | --------- | ----------- |
|
|
27
|
+
* | 0 | 0 | zero |
|
|
28
|
+
* | 4px | 0.25rem | xxxs |
|
|
29
|
+
* | 8px | 0.5rem | xxs |
|
|
30
|
+
* | 12px | 0.75rem | xs |
|
|
31
|
+
* | 16px | 1rem | s |
|
|
32
|
+
* | 24px | 1.5rem | m |
|
|
33
|
+
* | 32px | 2rem | l |
|
|
34
|
+
* | 40px | 2.5rem | xl |
|
|
35
|
+
* | 64px | 4rem | xxl |
|
|
36
|
+
* | 80px | 5rem | xxxl |
|
|
37
|
+
*
|
|
38
|
+
* */
|
|
20
39
|
export declare const space: CanvasSpace;
|
|
21
|
-
/** Type for the `spaceNumbers` object with keys and numeric
|
|
40
|
+
/** Type for the `spaceNumbers` object with keys and numeric rem values (numbers) */
|
|
22
41
|
export declare type CanvasSpaceNumbers = {
|
|
23
42
|
zero: 0;
|
|
24
|
-
xxxs:
|
|
25
|
-
xxs:
|
|
26
|
-
xs:
|
|
27
|
-
s:
|
|
28
|
-
m:
|
|
29
|
-
l:
|
|
30
|
-
xl:
|
|
31
|
-
xxl:
|
|
32
|
-
xxxl:
|
|
43
|
+
xxxs: 0.25;
|
|
44
|
+
xxs: 0.5;
|
|
45
|
+
xs: 0.75;
|
|
46
|
+
s: 1;
|
|
47
|
+
m: 1.5;
|
|
48
|
+
l: 2;
|
|
49
|
+
xl: 2.5;
|
|
50
|
+
xxl: 4;
|
|
51
|
+
xxxl: 5;
|
|
33
52
|
};
|
|
34
|
-
/** The numeric
|
|
53
|
+
/** The numeric rem values for CanvasSpaceNumbers (numbers) */
|
|
35
54
|
export declare type CanvasSpaceNumberValues = ValueOf<CanvasSpaceNumbers>;
|
|
36
55
|
/**
|
|
37
|
-
* An object of space keys and their numeric
|
|
38
|
-
* - These are helpful when you need a raw numeric
|
|
56
|
+
* An object of space keys and their numeric rem values (numbers)
|
|
57
|
+
* - These are helpful when you need a raw numeric rem value.
|
|
39
58
|
* - Here's an example usage to perform calculations:
|
|
40
59
|
* @example
|
|
41
|
-
*
|
|
60
|
+
* ```tsx
|
|
61
|
+
* const buttonPaddingLeft = `${spaceNumbers.s + iconSize}rem`;
|
|
62
|
+
* ```
|
|
63
|
+
*
|
|
64
|
+
* Below is a table to show the equivalent values from `px` to `rem`.
|
|
65
|
+
* This is based on the default browser font size which is `16px`.
|
|
66
|
+
*
|
|
67
|
+
* | px Value | rem Value | space token |
|
|
68
|
+
* | --------- | --------- | ----------- |
|
|
69
|
+
* | 0 | 0 | zero |
|
|
70
|
+
* | 4px | 0.25rem | xxxs |
|
|
71
|
+
* | 8px | 0.5rem | xxs |
|
|
72
|
+
* | 12px | 0.75rem | xs |
|
|
73
|
+
* | 16px | 1rem | s |
|
|
74
|
+
* | 24px | 1.5rem | m |
|
|
75
|
+
* | 32px | 2rem | l |
|
|
76
|
+
* | 40px | 2.5rem | xl |
|
|
77
|
+
* | 64px | 4rem | xxl |
|
|
78
|
+
* | 80px | 5rem | xxxl |
|
|
79
|
+
*
|
|
42
80
|
*/
|
|
43
81
|
export declare const spaceNumbers: CanvasSpaceNumbers;
|
|
44
82
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"space.d.ts","sourceRoot":"","sources":["../../../../tokens/lib/space.ts"],"names":[],"mappings":"AAAA,aAAK,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;AAO7B,
|
|
1
|
+
{"version":3,"file":"space.d.ts","sourceRoot":"","sources":["../../../../tokens/lib/space.ts"],"names":[],"mappings":"AAAA,aAAK,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;AAO7B,qEAAqE;AACrE,oBAAY,WAAW,GAAG;IACxB,IAAI,EAAE,GAAG,CAAC;IACV,IAAI,EAAE,SAAS,CAAC;IAChB,GAAG,EAAE,QAAQ,CAAC;IACd,EAAE,EAAE,SAAS,CAAC;IACd,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,QAAQ,CAAC;IACZ,CAAC,EAAE,MAAM,CAAC;IACV,EAAE,EAAE,QAAQ,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,kCAAkC;AAClC,oBAAY,eAAe,GAAG,MAAM,WAAW,CAAC;AAEhD,+CAA+C;AAC/C,oBAAY,iBAAiB,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;AAErD;;;;;;;;;;;;;;;;;;;KAmBK;AACL,eAAO,MAAM,KAAK,EAAE,WAWnB,CAAC;AAEF,oFAAoF;AACpF,oBAAY,kBAAkB,GAAG;IAC/B,IAAI,EAAE,CAAC,CAAC;IACR,IAAI,EAAE,IAAI,CAAC;IACX,GAAG,EAAE,GAAG,CAAC;IACT,EAAE,EAAE,IAAI,CAAC;IACT,CAAC,EAAE,CAAC,CAAC;IACL,CAAC,EAAE,GAAG,CAAC;IACP,CAAC,EAAE,CAAC,CAAC;IACL,EAAE,EAAE,GAAG,CAAC;IACR,GAAG,EAAE,CAAC,CAAC;IACP,IAAI,EAAE,CAAC,CAAC;CACT,CAAC;AAEF,8DAA8D;AAC9D,oBAAY,uBAAuB,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAC;AAElE;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,eAAO,MAAM,YAAY,EAAE,kBAW1B,CAAC"}
|