@workday/canvas-kit-react 8.0.0-alpha.245-next.15 → 8.0.0-alpha.247-next.17
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/common/index.ts +1 -0
- package/common/lib/responsive/useResponsiveContainerStyles.ts +128 -0
- package/common/lib/utils/isWithinBreakpoint.ts +6 -0
- package/common/lib/utils/models.ts +2 -2
- package/dist/commonjs/common/index.d.ts +1 -0
- package/dist/commonjs/common/index.d.ts.map +1 -1
- package/dist/commonjs/common/index.js +1 -0
- package/dist/commonjs/common/lib/responsive/useResponsiveContainerStyles.d.ts +78 -0
- package/dist/commonjs/common/lib/responsive/useResponsiveContainerStyles.d.ts.map +1 -0
- package/dist/commonjs/common/lib/responsive/useResponsiveContainerStyles.js +139 -0
- package/dist/commonjs/common/lib/utils/isWithinBreakpoint.d.ts +5 -0
- package/dist/commonjs/common/lib/utils/isWithinBreakpoint.d.ts.map +1 -0
- package/dist/commonjs/common/lib/utils/isWithinBreakpoint.js +10 -0
- package/dist/commonjs/common/lib/utils/models.d.ts +2 -2
- package/dist/commonjs/common/lib/utils/models.d.ts.map +1 -1
- package/dist/commonjs/layout/lib/Flex.d.ts +2 -2
- package/dist/commonjs/layout/lib/Flex.d.ts.map +1 -1
- package/dist/commonjs/layout/lib/Grid.d.ts +2 -2
- package/dist/commonjs/layout/lib/Grid.d.ts.map +1 -1
- package/dist/commonjs/layout/lib/Stack.d.ts +1 -1
- package/dist/commonjs/layout/lib/utils/flex.d.ts +2 -2
- package/dist/commonjs/layout/lib/utils/flex.d.ts.map +1 -1
- package/dist/commonjs/layout/lib/utils/grid.d.ts +2 -2
- package/dist/commonjs/layout/lib/utils/grid.d.ts.map +1 -1
- package/dist/commonjs/tabs/lib/Tabs.d.ts +1149 -1
- package/dist/commonjs/tabs/lib/Tabs.d.ts.map +1 -1
- package/dist/commonjs/tabs/lib/useTabsModel.d.ts +2773 -469
- package/dist/commonjs/tabs/lib/useTabsModel.d.ts.map +1 -1
- package/dist/es6/common/index.d.ts +1 -0
- package/dist/es6/common/index.d.ts.map +1 -1
- package/dist/es6/common/index.js +1 -0
- package/dist/es6/common/lib/responsive/useResponsiveContainerStyles.d.ts +78 -0
- package/dist/es6/common/lib/responsive/useResponsiveContainerStyles.d.ts.map +1 -0
- package/dist/es6/common/lib/responsive/useResponsiveContainerStyles.js +135 -0
- package/dist/es6/common/lib/utils/isWithinBreakpoint.d.ts +5 -0
- package/dist/es6/common/lib/utils/isWithinBreakpoint.d.ts.map +1 -0
- package/dist/es6/common/lib/utils/isWithinBreakpoint.js +6 -0
- package/dist/es6/common/lib/utils/models.d.ts +2 -2
- package/dist/es6/common/lib/utils/models.d.ts.map +1 -1
- package/dist/es6/layout/lib/Flex.d.ts +2 -2
- package/dist/es6/layout/lib/Flex.d.ts.map +1 -1
- package/dist/es6/layout/lib/Grid.d.ts +2 -2
- package/dist/es6/layout/lib/Grid.d.ts.map +1 -1
- package/dist/es6/layout/lib/Stack.d.ts +1 -1
- package/dist/es6/layout/lib/utils/flex.d.ts +2 -2
- package/dist/es6/layout/lib/utils/flex.d.ts.map +1 -1
- package/dist/es6/layout/lib/utils/grid.d.ts +2 -2
- package/dist/es6/layout/lib/utils/grid.d.ts.map +1 -1
- package/dist/es6/tabs/lib/Tabs.d.ts +1149 -1
- package/dist/es6/tabs/lib/Tabs.d.ts.map +1 -1
- package/dist/es6/tabs/lib/useTabsModel.d.ts +2773 -469
- package/dist/es6/tabs/lib/useTabsModel.d.ts.map +1 -1
- package/layout/lib/Flex.tsx +1 -1
- package/layout/lib/Grid.tsx +1 -1
- package/layout/lib/utils/flex.ts +2 -2
- package/layout/lib/utils/grid.ts +2 -2
- package/package.json +3 -3
- package/tabs/lib/useTabsModel.tsx +2 -2
package/common/index.ts
CHANGED
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { useTheme, breakpointKeys, CanvasBreakpoints } from "@workday/canvas-kit-react/common";
|
|
2
|
+
import type {AllStyleProps} from "@workday/canvas-kit-react/layout";
|
|
3
|
+
import {isWithinBreakpoint} from '../utils/isWithinBreakpoint'
|
|
4
|
+
|
|
5
|
+
export type BreakpointKeys = typeof breakpointKeys[number];
|
|
6
|
+
|
|
7
|
+
type ResponsiveCSSObject<T> = {
|
|
8
|
+
[P in keyof T]: Partial<Record<BreakpointKeys, AllStyleProps>> &
|
|
9
|
+
AllStyleProps;
|
|
10
|
+
};
|
|
11
|
+
type CSSObject<T> = {
|
|
12
|
+
[P in keyof T]: AllStyleProps;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
// Takes in CanvasBreakpoint keys and returns current breakpoint key. Current breakpoint key is determined by the `width` of the container
|
|
16
|
+
|
|
17
|
+
const getSize = (width: number, breakpoints: CanvasBreakpoints) => {
|
|
18
|
+
const ranges: {[key: string ]: [number, number?]} = {
|
|
19
|
+
'zero': [0, breakpoints.s],
|
|
20
|
+
's': [breakpoints.s, breakpoints.m],
|
|
21
|
+
'm': [breakpoints.m, breakpoints.l],
|
|
22
|
+
'l': [breakpoints.l, breakpoints.xl],
|
|
23
|
+
'xl': [breakpoints.xl]
|
|
24
|
+
};
|
|
25
|
+
return breakpointKeys.find((size: BreakpointKeys) => isWithinBreakpoint(width, ...ranges[size])) || 'zero';
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
// Returns responsive style objects that are within the current CanvasBreakpoint size
|
|
29
|
+
|
|
30
|
+
function getStyles<T>(key: BreakpointKeys, styles: ResponsiveCSSObject<T>) {
|
|
31
|
+
const responsiveStyles = {} as CSSObject<T>;
|
|
32
|
+
const breakpointSize = breakpointKeys.indexOf(key);
|
|
33
|
+
for (let i = 0; i <= breakpointSize; i++) {
|
|
34
|
+
const breakpointName = breakpointKeys[i];
|
|
35
|
+
// property is key of the style object
|
|
36
|
+
Object.keys(styles).forEach((property) => {
|
|
37
|
+
const { zero, s, m, l, xl, ...base } = styles[property as keyof T];
|
|
38
|
+
const currentBreakpointStyles =
|
|
39
|
+
styles[property as keyof T][breakpointName] ?? {};
|
|
40
|
+
const previousBreakpointStyles = responsiveStyles[property as keyof T] ?? {};
|
|
41
|
+
responsiveStyles[property as keyof T] = {
|
|
42
|
+
...base,
|
|
43
|
+
...previousBreakpointStyles,
|
|
44
|
+
...currentBreakpointStyles
|
|
45
|
+
};
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
return responsiveStyles;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* useResponsiveContainerStyles
|
|
53
|
+
*
|
|
54
|
+
* ---
|
|
55
|
+
*
|
|
56
|
+
* This hook allows you to create container-based responsive styles with objects.
|
|
57
|
+
* It accepts two or three arguments: the responsive style object, the container width, and (optionally) the theme object.
|
|
58
|
+
* Each style object accepts five breakpoint keys: "zero", "s", "m", "l", and "xl".
|
|
59
|
+
* The sizes will act like `min-width`. For example, if you want to apply styles from `medium` and up, then you would write those styles under `m`.
|
|
60
|
+
*
|
|
61
|
+
* @example
|
|
62
|
+
* ```tsx
|
|
63
|
+
import {Flex, Box} from '@workday/canvas-kit-react/layout';
|
|
64
|
+
import {
|
|
65
|
+
useResponsiveStyles,
|
|
66
|
+
} from '@workday/canvas-kit-react/common';
|
|
67
|
+
|
|
68
|
+
const ref = React.useRef(null);
|
|
69
|
+
const [containerWidth, setContainerWidth] = React.useState(0);
|
|
70
|
+
|
|
71
|
+
useResizeObserver({
|
|
72
|
+
ref: ref,
|
|
73
|
+
onResize: data => {
|
|
74
|
+
setWidth(data.width || 0);
|
|
75
|
+
},
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
const containerResponsiveStyles = useResponsiveStyles(
|
|
79
|
+
{
|
|
80
|
+
flex: {
|
|
81
|
+
flexDirection: 'column',
|
|
82
|
+
padding: 'm',
|
|
83
|
+
depth: 1,
|
|
84
|
+
borderRadius: 'l',
|
|
85
|
+
zero: {
|
|
86
|
+
backgroundColor: 'Red',
|
|
87
|
+
},
|
|
88
|
+
s: {
|
|
89
|
+
backgroundColor: 'Orange',
|
|
90
|
+
},
|
|
91
|
+
m: {
|
|
92
|
+
backgroundColor: 'Yellow',
|
|
93
|
+
},
|
|
94
|
+
l: {
|
|
95
|
+
backgroundColor: 'Green',
|
|
96
|
+
},
|
|
97
|
+
xl: {
|
|
98
|
+
backgroundColor: 'Blue',
|
|
99
|
+
},
|
|
100
|
+
},
|
|
101
|
+
box: {
|
|
102
|
+
padding: 's',
|
|
103
|
+
},
|
|
104
|
+
},
|
|
105
|
+
containerWidth
|
|
106
|
+
);
|
|
107
|
+
|
|
108
|
+
return (
|
|
109
|
+
<Box ref={ref}>
|
|
110
|
+
<Flex {...containerResponsiveStyles.flex}>
|
|
111
|
+
<Box {...containerResponsiveStyles.box}>Hello World</Box>
|
|
112
|
+
</Flex>
|
|
113
|
+
</Box>
|
|
114
|
+
);
|
|
115
|
+
```
|
|
116
|
+
*/
|
|
117
|
+
|
|
118
|
+
export function useResponsiveContainerStyles<T extends ResponsiveCSSObject<T>>(
|
|
119
|
+
styles: ResponsiveCSSObject<T>,
|
|
120
|
+
width: number,
|
|
121
|
+
theme = {}
|
|
122
|
+
) {
|
|
123
|
+
const canvasTheme = useTheme(theme);
|
|
124
|
+
const breakpoints = canvasTheme.canvas.breakpoints.values;
|
|
125
|
+
|
|
126
|
+
const size = getSize(width, breakpoints);
|
|
127
|
+
return getStyles(size, styles);
|
|
128
|
+
}
|
|
@@ -225,7 +225,7 @@ export type ModelExtras<TDefaultConfig, TRequiredConfig, TState, TEvents, TModel
|
|
|
225
225
|
/**
|
|
226
226
|
* This is only a type and not a value. If you want to
|
|
227
227
|
*/
|
|
228
|
-
TConfig: TDefaultConfig & TRequiredConfig
|
|
228
|
+
TConfig: Partial<TDefaultConfig> & TRequiredConfig & ToEventConfig<TState, TEvents>;
|
|
229
229
|
/**
|
|
230
230
|
* The context of the model. This can be used directly, but is mostly used internally by
|
|
231
231
|
* `createContainer` or `createSubcomponent` to handle model context automatically.
|
|
@@ -268,7 +268,7 @@ export type ModelExtras<TDefaultConfig, TRequiredConfig, TState, TEvents, TModel
|
|
|
268
268
|
* ```
|
|
269
269
|
*/
|
|
270
270
|
mergeConfig: (
|
|
271
|
-
source: TDefaultConfig & TRequiredConfig,
|
|
271
|
+
source: Partial<TDefaultConfig> & TRequiredConfig,
|
|
272
272
|
target: Partial<
|
|
273
273
|
TDefaultConfig & TRequiredConfig & ToEventConfig<TState, TEvents>
|
|
274
274
|
>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../common/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,qBAAqB,CAAC;AACpC,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../common/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,qBAAqB,CAAC;AACpC,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,+CAA+C,CAAC"}
|
|
@@ -19,3 +19,4 @@ __exportStar(require("./lib/utils"), exports);
|
|
|
19
19
|
__exportStar(require("./lib/CanvasProvider"), exports);
|
|
20
20
|
__exportStar(require("./lib/InputProvider"), exports);
|
|
21
21
|
__exportStar(require("./lib/EllipsisText"), exports);
|
|
22
|
+
__exportStar(require("./lib/responsive/useResponsiveContainerStyles"), exports);
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { breakpointKeys } from "@workday/canvas-kit-react/common";
|
|
2
|
+
import type { AllStyleProps } from "@workday/canvas-kit-react/layout";
|
|
3
|
+
export declare type BreakpointKeys = typeof breakpointKeys[number];
|
|
4
|
+
declare type ResponsiveCSSObject<T> = {
|
|
5
|
+
[P in keyof T]: Partial<Record<BreakpointKeys, AllStyleProps>> & AllStyleProps;
|
|
6
|
+
};
|
|
7
|
+
declare type CSSObject<T> = {
|
|
8
|
+
[P in keyof T]: AllStyleProps;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* useResponsiveContainerStyles
|
|
12
|
+
*
|
|
13
|
+
* ---
|
|
14
|
+
*
|
|
15
|
+
* This hook allows you to create container-based responsive styles with objects.
|
|
16
|
+
* It accepts two or three arguments: the responsive style object, the container width, and (optionally) the theme object.
|
|
17
|
+
* Each style object accepts five breakpoint keys: "zero", "s", "m", "l", and "xl".
|
|
18
|
+
* The sizes will act like `min-width`. For example, if you want to apply styles from `medium` and up, then you would write those styles under `m`.
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```tsx
|
|
22
|
+
import {Flex, Box} from '@workday/canvas-kit-react/layout';
|
|
23
|
+
import {
|
|
24
|
+
useResponsiveStyles,
|
|
25
|
+
} from '@workday/canvas-kit-react/common';
|
|
26
|
+
|
|
27
|
+
const ref = React.useRef(null);
|
|
28
|
+
const [containerWidth, setContainerWidth] = React.useState(0);
|
|
29
|
+
|
|
30
|
+
useResizeObserver({
|
|
31
|
+
ref: ref,
|
|
32
|
+
onResize: data => {
|
|
33
|
+
setWidth(data.width || 0);
|
|
34
|
+
},
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
const containerResponsiveStyles = useResponsiveStyles(
|
|
38
|
+
{
|
|
39
|
+
flex: {
|
|
40
|
+
flexDirection: 'column',
|
|
41
|
+
padding: 'm',
|
|
42
|
+
depth: 1,
|
|
43
|
+
borderRadius: 'l',
|
|
44
|
+
zero: {
|
|
45
|
+
backgroundColor: 'Red',
|
|
46
|
+
},
|
|
47
|
+
s: {
|
|
48
|
+
backgroundColor: 'Orange',
|
|
49
|
+
},
|
|
50
|
+
m: {
|
|
51
|
+
backgroundColor: 'Yellow',
|
|
52
|
+
},
|
|
53
|
+
l: {
|
|
54
|
+
backgroundColor: 'Green',
|
|
55
|
+
},
|
|
56
|
+
xl: {
|
|
57
|
+
backgroundColor: 'Blue',
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
box: {
|
|
61
|
+
padding: 's',
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
containerWidth
|
|
65
|
+
);
|
|
66
|
+
|
|
67
|
+
return (
|
|
68
|
+
<Box ref={ref}>
|
|
69
|
+
<Flex {...containerResponsiveStyles.flex}>
|
|
70
|
+
<Box {...containerResponsiveStyles.box}>Hello World</Box>
|
|
71
|
+
</Flex>
|
|
72
|
+
</Box>
|
|
73
|
+
);
|
|
74
|
+
```
|
|
75
|
+
*/
|
|
76
|
+
export declare function useResponsiveContainerStyles<T extends ResponsiveCSSObject<T>>(styles: ResponsiveCSSObject<T>, width: number, theme?: {}): CSSObject<T>;
|
|
77
|
+
export {};
|
|
78
|
+
//# sourceMappingURL=useResponsiveContainerStyles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useResponsiveContainerStyles.d.ts","sourceRoot":"","sources":["../../../../../common/lib/responsive/useResponsiveContainerStyles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,cAAc,EAAqB,MAAM,kCAAkC,CAAC;AAC/F,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,kCAAkC,CAAC;AAGpE,oBAAY,cAAc,GAAG,OAAO,cAAc,CAAC,MAAM,CAAC,CAAC;AAE3D,aAAK,mBAAmB,CAAC,CAAC,IAAI;KAC3B,CAAC,IAAI,MAAM,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,cAAc,EAAE,aAAa,CAAC,CAAC,GAC5D,aAAa;CAChB,CAAC;AACF,aAAK,SAAS,CAAC,CAAC,IAAI;KACjB,CAAC,IAAI,MAAM,CAAC,GAAG,aAAa;CAC9B,CAAC;AAsCF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiEG;AAEH,wBAAgB,4BAA4B,CAAC,CAAC,SAAS,mBAAmB,CAAC,CAAC,CAAC,EAC3E,MAAM,EAAE,mBAAmB,CAAC,CAAC,CAAC,EAC9B,KAAK,EAAE,MAAM,EACb,KAAK,KAAK,gBAOX"}
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
14
|
+
var t = {};
|
|
15
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
16
|
+
t[p] = s[p];
|
|
17
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
18
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
19
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
20
|
+
t[p[i]] = s[p[i]];
|
|
21
|
+
}
|
|
22
|
+
return t;
|
|
23
|
+
};
|
|
24
|
+
var __spreadArrays = (this && this.__spreadArrays) || function () {
|
|
25
|
+
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
|
|
26
|
+
for (var r = Array(s), k = 0, i = 0; i < il; i++)
|
|
27
|
+
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
|
|
28
|
+
r[k] = a[j];
|
|
29
|
+
return r;
|
|
30
|
+
};
|
|
31
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
32
|
+
exports.useResponsiveContainerStyles = void 0;
|
|
33
|
+
var common_1 = require("@workday/canvas-kit-react/common");
|
|
34
|
+
var isWithinBreakpoint_1 = require("../utils/isWithinBreakpoint");
|
|
35
|
+
// Takes in CanvasBreakpoint keys and returns current breakpoint key. Current breakpoint key is determined by the `width` of the container
|
|
36
|
+
var getSize = function (width, breakpoints) {
|
|
37
|
+
var ranges = {
|
|
38
|
+
'zero': [0, breakpoints.s],
|
|
39
|
+
's': [breakpoints.s, breakpoints.m],
|
|
40
|
+
'm': [breakpoints.m, breakpoints.l],
|
|
41
|
+
'l': [breakpoints.l, breakpoints.xl],
|
|
42
|
+
'xl': [breakpoints.xl]
|
|
43
|
+
};
|
|
44
|
+
return common_1.breakpointKeys.find(function (size) { return isWithinBreakpoint_1.isWithinBreakpoint.apply(void 0, __spreadArrays([width], ranges[size])); }) || 'zero';
|
|
45
|
+
};
|
|
46
|
+
// Returns responsive style objects that are within the current CanvasBreakpoint size
|
|
47
|
+
function getStyles(key, styles) {
|
|
48
|
+
var responsiveStyles = {};
|
|
49
|
+
var breakpointSize = common_1.breakpointKeys.indexOf(key);
|
|
50
|
+
var _loop_1 = function (i) {
|
|
51
|
+
var breakpointName = common_1.breakpointKeys[i];
|
|
52
|
+
// property is key of the style object
|
|
53
|
+
Object.keys(styles).forEach(function (property) {
|
|
54
|
+
var _a, _b;
|
|
55
|
+
var _c = styles[property], zero = _c.zero, s = _c.s, m = _c.m, l = _c.l, xl = _c.xl, base = __rest(_c, ["zero", "s", "m", "l", "xl"]);
|
|
56
|
+
var currentBreakpointStyles = (_a = styles[property][breakpointName]) !== null && _a !== void 0 ? _a : {};
|
|
57
|
+
var previousBreakpointStyles = (_b = responsiveStyles[property]) !== null && _b !== void 0 ? _b : {};
|
|
58
|
+
responsiveStyles[property] = __assign(__assign(__assign({}, base), previousBreakpointStyles), currentBreakpointStyles);
|
|
59
|
+
});
|
|
60
|
+
};
|
|
61
|
+
for (var i = 0; i <= breakpointSize; i++) {
|
|
62
|
+
_loop_1(i);
|
|
63
|
+
}
|
|
64
|
+
return responsiveStyles;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* useResponsiveContainerStyles
|
|
68
|
+
*
|
|
69
|
+
* ---
|
|
70
|
+
*
|
|
71
|
+
* This hook allows you to create container-based responsive styles with objects.
|
|
72
|
+
* It accepts two or three arguments: the responsive style object, the container width, and (optionally) the theme object.
|
|
73
|
+
* Each style object accepts five breakpoint keys: "zero", "s", "m", "l", and "xl".
|
|
74
|
+
* The sizes will act like `min-width`. For example, if you want to apply styles from `medium` and up, then you would write those styles under `m`.
|
|
75
|
+
*
|
|
76
|
+
* @example
|
|
77
|
+
* ```tsx
|
|
78
|
+
import {Flex, Box} from '@workday/canvas-kit-react/layout';
|
|
79
|
+
import {
|
|
80
|
+
useResponsiveStyles,
|
|
81
|
+
} from '@workday/canvas-kit-react/common';
|
|
82
|
+
|
|
83
|
+
const ref = React.useRef(null);
|
|
84
|
+
const [containerWidth, setContainerWidth] = React.useState(0);
|
|
85
|
+
|
|
86
|
+
useResizeObserver({
|
|
87
|
+
ref: ref,
|
|
88
|
+
onResize: data => {
|
|
89
|
+
setWidth(data.width || 0);
|
|
90
|
+
},
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
const containerResponsiveStyles = useResponsiveStyles(
|
|
94
|
+
{
|
|
95
|
+
flex: {
|
|
96
|
+
flexDirection: 'column',
|
|
97
|
+
padding: 'm',
|
|
98
|
+
depth: 1,
|
|
99
|
+
borderRadius: 'l',
|
|
100
|
+
zero: {
|
|
101
|
+
backgroundColor: 'Red',
|
|
102
|
+
},
|
|
103
|
+
s: {
|
|
104
|
+
backgroundColor: 'Orange',
|
|
105
|
+
},
|
|
106
|
+
m: {
|
|
107
|
+
backgroundColor: 'Yellow',
|
|
108
|
+
},
|
|
109
|
+
l: {
|
|
110
|
+
backgroundColor: 'Green',
|
|
111
|
+
},
|
|
112
|
+
xl: {
|
|
113
|
+
backgroundColor: 'Blue',
|
|
114
|
+
},
|
|
115
|
+
},
|
|
116
|
+
box: {
|
|
117
|
+
padding: 's',
|
|
118
|
+
},
|
|
119
|
+
},
|
|
120
|
+
containerWidth
|
|
121
|
+
);
|
|
122
|
+
|
|
123
|
+
return (
|
|
124
|
+
<Box ref={ref}>
|
|
125
|
+
<Flex {...containerResponsiveStyles.flex}>
|
|
126
|
+
<Box {...containerResponsiveStyles.box}>Hello World</Box>
|
|
127
|
+
</Flex>
|
|
128
|
+
</Box>
|
|
129
|
+
);
|
|
130
|
+
```
|
|
131
|
+
*/
|
|
132
|
+
function useResponsiveContainerStyles(styles, width, theme) {
|
|
133
|
+
if (theme === void 0) { theme = {}; }
|
|
134
|
+
var canvasTheme = common_1.useTheme(theme);
|
|
135
|
+
var breakpoints = canvasTheme.canvas.breakpoints.values;
|
|
136
|
+
var size = getSize(width, breakpoints);
|
|
137
|
+
return getStyles(size, styles);
|
|
138
|
+
}
|
|
139
|
+
exports.useResponsiveContainerStyles = useResponsiveContainerStyles;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isWithinBreakpoint.d.ts","sourceRoot":"","sources":["../../../../../common/lib/utils/isWithinBreakpoint.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,eAAO,MAAM,kBAAkB,UAAW,MAAM,OAAO,MAAM,0CAE5D,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isWithinBreakpoint = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* This function determines whether or not a container's width is within two values.
|
|
6
|
+
*/
|
|
7
|
+
var isWithinBreakpoint = function (width, min, max) {
|
|
8
|
+
return width >= min && (!max || (max && width <= max - 0.5));
|
|
9
|
+
};
|
|
10
|
+
exports.isWithinBreakpoint = isWithinBreakpoint;
|
|
@@ -119,7 +119,7 @@ export declare type ModelExtras<TDefaultConfig, TRequiredConfig, TState, TEvents
|
|
|
119
119
|
/**
|
|
120
120
|
* This is only a type and not a value. If you want to
|
|
121
121
|
*/
|
|
122
|
-
TConfig: TDefaultConfig & TRequiredConfig
|
|
122
|
+
TConfig: Partial<TDefaultConfig> & TRequiredConfig & ToEventConfig<TState, TEvents>;
|
|
123
123
|
/**
|
|
124
124
|
* The context of the model. This can be used directly, but is mostly used internally by
|
|
125
125
|
* `createContainer` or `createSubcomponent` to handle model context automatically.
|
|
@@ -154,7 +154,7 @@ export declare type ModelExtras<TDefaultConfig, TRequiredConfig, TState, TEvents
|
|
|
154
154
|
* })
|
|
155
155
|
* ```
|
|
156
156
|
*/
|
|
157
|
-
mergeConfig: (source: TDefaultConfig & TRequiredConfig, target: Partial<TDefaultConfig & TRequiredConfig & ToEventConfig<TState, TEvents>>) => TDefaultConfig & TRequiredConfig & ToEventConfig<TState, TEvents>;
|
|
157
|
+
mergeConfig: (source: Partial<TDefaultConfig> & TRequiredConfig, target: Partial<TDefaultConfig & TRequiredConfig & ToEventConfig<TState, TEvents>>) => TDefaultConfig & TRequiredConfig & ToEventConfig<TState, TEvents>;
|
|
158
158
|
};
|
|
159
159
|
/**
|
|
160
160
|
* Generic type for all models. It makes `defaultConfig` have optional keys and adds `getElemProps`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"models.d.ts","sourceRoot":"","sources":["../../../../../common/lib/utils/models.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,oBAAY,KAAK,CAAC,KAAK,EAAE,MAAM,SAAS,MAAM,IAAI;IAChD,KAAK,EAAE,KAAK,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAGF,aAAK,MAAM,GAAG;IAAC,CAAC,GAAG,EAAE,MAAM,GAAG;QAAC,cAA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I,EAAE,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAC/B,SAAS,EAAE,MAAM,KACd,IAAI;CACV,GAAG;KACD,CAAC,IAAI,MAAM,OAAO,IAAI,SAAS,UAAU,CAAC,MAAM,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAC1D,IAAI,EAAE,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAC/B,KAAK,EAAE,MAAM,KACV,OAAO;CACb,CAAC;AAuDF,oBAAY,kBAAkB,CAAC,CAAC,SAAS,CAAC,MAAM,EAAE,GAAG,KAAK,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,KAAK,GAAG,GAAG,QAAQ,CAAC,CAAC,CAAC,GAAG,EAAE,CAAA;AAEtH,oBAAY,WAAW,CAAC,cAAc,EAAE,eAAe,IAAI;IACzD;;;;;;;;;;;;;;;OAeG;IACH,aAAa,CAAC,EAAE,cAAc,CAAC;IAC/B;;;;;;;;;;;;OAYG;IACH,cAAc,CAAC,EAAE,eAAe,CAAC;IACjC;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IACrC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAyCG;IACH,eAAe,CAAC,EAAE,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAA;CACrC,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,eAAO,MAAM,eAAe;WA4Gf,EAAE;qCACwB,GAAG,KAAK,IAAI;kFASlD,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BoxProps } from './Box';
|
|
2
2
|
import { FlexStyleProps } from './utils/flex';
|
|
3
|
-
export declare type FlexProps = BoxProps & FlexStyleProps;
|
|
3
|
+
export declare type FlexProps = Omit<BoxProps, 'display'> & FlexStyleProps;
|
|
4
4
|
/**
|
|
5
5
|
* `Flex` is a low-level layout component that provides a common, ergonomic API for applying CSS flexbox styles.
|
|
6
6
|
* It is highly flexible, and can be used on its own or to build other components.
|
|
@@ -23,7 +23,7 @@ export declare type FlexProps = BoxProps & FlexStyleProps;
|
|
|
23
23
|
* );
|
|
24
24
|
* ```
|
|
25
25
|
*/
|
|
26
|
-
export declare const Flex: import("../../common").ElementComponent<"div",
|
|
26
|
+
export declare const Flex: import("../../common").ElementComponent<"div", FlexProps> & {
|
|
27
27
|
Item: import("../../common").ElementComponent<"div", import("..").CommonStyleProps>;
|
|
28
28
|
};
|
|
29
29
|
//# sourceMappingURL=Flex.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Flex.d.ts","sourceRoot":"","sources":["../../../../layout/lib/Flex.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAM,QAAQ,EAAC,MAAM,OAAO,CAAC;AAEpC,OAAO,EAAO,cAAc,EAAC,MAAM,cAAc,CAAC;AAElD,oBAAY,SAAS,GAAG,QAAQ,GAAG,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"Flex.d.ts","sourceRoot":"","sources":["../../../../layout/lib/Flex.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAM,QAAQ,EAAC,MAAM,OAAO,CAAC;AAEpC,OAAO,EAAO,cAAc,EAAC,MAAM,cAAc,CAAC;AAElD,oBAAY,SAAS,GAAG,IAAI,CAAC,QAAQ,EAAE,SAAS,CAAC,GAAG,cAAc,CAAC;AASnE;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,eAAO,MAAM,IAAI;;CAYf,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BoxProps } from './Box';
|
|
2
2
|
import { GridStyleProps } from './utils/grid';
|
|
3
|
-
export declare type GridProps = BoxProps & GridStyleProps;
|
|
3
|
+
export declare type GridProps = Omit<BoxProps, 'display'> & GridStyleProps;
|
|
4
4
|
export declare type GridItemProps = BoxProps;
|
|
5
5
|
/**
|
|
6
6
|
* `Grid` is a two-dimensional layout system for the web. It lets you lay content out in rows and columns.
|
|
@@ -24,7 +24,7 @@ export declare type GridItemProps = BoxProps;
|
|
|
24
24
|
* );
|
|
25
25
|
*```
|
|
26
26
|
*/
|
|
27
|
-
export declare const Grid: import("../../common").ElementComponent<"div",
|
|
27
|
+
export declare const Grid: import("../../common").ElementComponent<"div", GridProps> & {
|
|
28
28
|
/**
|
|
29
29
|
* `<Grid.Item />` is the child specific sub-component to `<Grid/>`. `<Grid.Item />` gets child specific props, whereas `<Grid./>` gets parent container props.
|
|
30
30
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Grid.d.ts","sourceRoot":"","sources":["../../../../layout/lib/Grid.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAM,QAAQ,EAAC,MAAM,OAAO,CAAC;AAEpC,OAAO,EAAO,cAAc,EAAC,MAAM,cAAc,CAAC;AAElD,oBAAY,SAAS,GAAG,QAAQ,GAAG,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"Grid.d.ts","sourceRoot":"","sources":["../../../../layout/lib/Grid.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAM,QAAQ,EAAC,MAAM,OAAO,CAAC;AAEpC,OAAO,EAAO,cAAc,EAAC,MAAM,cAAc,CAAC;AAElD,oBAAY,SAAS,GAAG,IAAI,CAAC,QAAQ,EAAE,SAAS,CAAC,GAAG,cAAc,CAAC;AACnE,oBAAY,aAAa,GAAG,QAAQ,CAAC;AAoBrC;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,eAAO,MAAM,IAAI;IAUb;;;;;;;;;;;;;;;;;;;;OAoBG;;CAIL,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { FlexProps } from './Flex';
|
|
2
2
|
import { StackStyleProps } from './utils/stack';
|
|
3
3
|
export declare type StackProps = FlexProps & StackStyleProps;
|
|
4
|
-
export declare const Stack: import("../../common").ElementComponent<"div",
|
|
4
|
+
export declare const Stack: import("../../common").ElementComponent<"div", StackProps> & {
|
|
5
5
|
Item: import("../../common").ElementComponent<"div", import("..").CommonStyleProps>;
|
|
6
6
|
};
|
|
7
7
|
export interface HStackProps extends StackProps {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Property } from 'csstype';
|
|
1
|
+
import { Property, Globals } from 'csstype';
|
|
2
2
|
import { StyleFnConfig } from './buildStyleFns';
|
|
3
3
|
import { SystemPropValues } from './systemProps';
|
|
4
4
|
/** style props to for CSS flexbox container properties */
|
|
@@ -11,7 +11,7 @@ export declare type FlexStyleProps = {
|
|
|
11
11
|
* - sets [CSS display property](https://developer.mozilla.org/en-US/docs/Web/CSS/display)
|
|
12
12
|
* - @default 'flex'
|
|
13
13
|
* */
|
|
14
|
-
display?: 'flex' | 'inline-flex';
|
|
14
|
+
display?: 'flex' | 'inline-flex' | 'none' | Globals | (string & {});
|
|
15
15
|
/** sets [CSS justify-items property](https://developer.mozilla.org/en-US/docs/Web/CSS/justify-items) */
|
|
16
16
|
justifyItems?: Property.JustifyItems;
|
|
17
17
|
/** sets [CSS justify-content property](https://developer.mozilla.org/en-US/docs/Web/CSS/justify-content) */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flex.d.ts","sourceRoot":"","sources":["../../../../../layout/lib/utils/flex.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,EAAC,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"flex.d.ts","sourceRoot":"","sources":["../../../../../layout/lib/utils/flex.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,EAAE,OAAO,EAAC,MAAM,SAAS,CAAC;AAE1C,OAAO,EAAkC,aAAa,EAAC,MAAM,iBAAiB,CAAC;AAC/E,OAAO,EAAC,gBAAgB,EAAC,MAAM,eAAe,CAAC;AAE/C,0DAA0D;AAC1D,oBAAY,cAAc,GAAG;IAC3B,oGAAoG;IACpG,UAAU,CAAC,EAAE,QAAQ,CAAC,UAAU,CAAC;IACjC,wGAAwG;IACxG,YAAY,CAAC,EAAE,QAAQ,CAAC,YAAY,CAAC;IACrC;;;SAGK;IACL,OAAO,CAAC,EAAE,MAAM,GAAG,aAAa,GAAG,MAAM,GAAG,OAAO,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC;IACpE,wGAAwG;IACxG,YAAY,CAAC,EAAE,QAAQ,CAAC,YAAY,CAAC;IACrC,4GAA4G;IAC5G,cAAc,CAAC,EAAE,QAAQ,CAAC,cAAc,CAAC;IACzC,gGAAgG;IAChG,QAAQ,CAAC,EAAE,QAAQ,CAAC,QAAQ,CAAC;IAC7B,0GAA0G;IAC1G,aAAa,CAAC,EAAE,QAAQ,CAAC,aAAa,CAAC;IACvC;;;SAGK;IACL,GAAG,CAAC,EAAE,gBAAgB,CAAC,OAAO,CAAC,CAAC;IAChC;;;SAGK;IACL,SAAS,CAAC,EAAE,gBAAgB,CAAC,OAAO,CAAC,CAAC;IACtC;;;SAGK;IACL,MAAM,CAAC,EAAE,gBAAgB,CAAC,OAAO,CAAC,CAAC;CACpC,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE,aAAa,EAmD7C,CAAC;AAEF,eAAO,MAAM,YAAY,oCAAoC,CAAC;AAC9D;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,IAAI,+BAAiD,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Property } from 'csstype';
|
|
1
|
+
import { Property, Globals } from 'csstype';
|
|
2
2
|
import { StyleFnConfig } from './buildStyleFns';
|
|
3
3
|
import { SystemPropValues } from './systemProps';
|
|
4
4
|
/** style props to for CSS grid container properties */
|
|
@@ -11,7 +11,7 @@ export declare type GridStyleProps = {
|
|
|
11
11
|
* - sets [CSS display property](https://developer.mozilla.org/en-US/docs/Web/CSS/display)
|
|
12
12
|
* - @default 'grid'
|
|
13
13
|
* */
|
|
14
|
-
display?: 'grid' | 'inline-grid';
|
|
14
|
+
display?: 'grid' | 'inline-grid' | 'none' | Globals | (string & {});
|
|
15
15
|
/** sets [CSS justify-items property](https://developer.mozilla.org/en-US/docs/Web/CSS/justify-items) */
|
|
16
16
|
justifyItems?: Property.JustifyItems;
|
|
17
17
|
/** sets [CSS justify-content property](https://developer.mozilla.org/en-US/docs/Web/CSS/justify-content) */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"grid.d.ts","sourceRoot":"","sources":["../../../../../layout/lib/utils/grid.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,EAAC,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"grid.d.ts","sourceRoot":"","sources":["../../../../../layout/lib/utils/grid.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,EAAE,OAAO,EAAC,MAAM,SAAS,CAAC;AAE1C,OAAO,EAAkC,aAAa,EAAC,MAAM,iBAAiB,CAAC;AAC/E,OAAO,EAAC,gBAAgB,EAAC,MAAM,eAAe,CAAC;AAE/C,uDAAuD;AACvD,oBAAY,cAAc,GAAG;IAC3B,oGAAoG;IACpG,UAAU,CAAC,EAAE,QAAQ,CAAC,UAAU,CAAC;IACjC,wGAAwG;IACxG,YAAY,CAAC,EAAE,QAAQ,CAAC,YAAY,CAAC;IACrC;;;SAGK;IACL,OAAO,CAAC,EAAE,MAAM,GAAG,aAAa,GAAG,MAAM,GAAG,OAAO,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC;IACpE,wGAAwG;IACxG,YAAY,CAAC,EAAE,QAAQ,CAAC,YAAY,CAAC;IACrC,4GAA4G;IAC5G,cAAc,CAAC,EAAE,QAAQ,CAAC,cAAc,CAAC;IACzC,wGAAwG;IACxG,YAAY,CAAC,EAAE,QAAQ,CAAC,YAAY,CAAC;IACrC,oHAAoH;IACpH,iBAAiB,CAAC,EAAE,QAAQ,CAAC,iBAAiB,CAAC;IAC/C,wHAAwH;IACxH,mBAAmB,CAAC,EAAE,QAA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