@workday/canvas-kit-labs-react 6.0.5 → 6.1.1
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/README.md +32 -0
- package/common/lib/theming/useThemedRing.ts +20 -26
- package/dist/commonjs/common/lib/theming/useThemedRing.d.ts +1 -1
- package/dist/commonjs/common/lib/theming/useThemedRing.d.ts.map +1 -1
- package/dist/commonjs/common/lib/theming/useThemedRing.js +17 -17
- package/dist/commonjs/index.d.ts +0 -1
- package/dist/commonjs/index.d.ts.map +1 -1
- package/dist/commonjs/index.js +0 -1
- package/dist/es6/common/lib/theming/useThemedRing.d.ts +1 -1
- package/dist/es6/common/lib/theming/useThemedRing.d.ts.map +1 -1
- package/dist/es6/common/lib/theming/useThemedRing.js +18 -18
- package/dist/es6/index.d.ts +0 -1
- package/dist/es6/index.d.ts.map +1 -1
- package/dist/es6/index.js +0 -1
- package/index.ts +0 -1
- package/package.json +7 -8
- package/ts3.5/dist/commonjs/common/lib/theming/useThemedRing.d.ts +1 -1
- package/ts3.5/dist/commonjs/index.d.ts +0 -1
- package/ts3.5/dist/es6/common/lib/theming/useThemedRing.d.ts +1 -1
- package/ts3.5/dist/es6/index.d.ts +0 -1
- package/dist/commonjs/text-input/index.d.ts +0 -7
- package/dist/commonjs/text-input/index.d.ts.map +0 -1
- package/dist/commonjs/text-input/index.js +0 -11
- package/dist/commonjs/text-input/lib/TextInput.d.ts +0 -21
- package/dist/commonjs/text-input/lib/TextInput.d.ts.map +0 -1
- package/dist/commonjs/text-input/lib/TextInput.js +0 -36
- package/dist/commonjs/text-input/lib/TextInputField.d.ts +0 -8
- package/dist/commonjs/text-input/lib/TextInputField.d.ts.map +0 -1
- package/dist/commonjs/text-input/lib/TextInputField.js +0 -66
- package/dist/commonjs/text-input/lib/TextInputHint.d.ts +0 -13
- package/dist/commonjs/text-input/lib/TextInputHint.d.ts.map +0 -1
- package/dist/commonjs/text-input/lib/TextInputHint.js +0 -46
- package/dist/commonjs/text-input/lib/TextInputLabel.d.ts +0 -17
- package/dist/commonjs/text-input/lib/TextInputLabel.d.ts.map +0 -1
- package/dist/commonjs/text-input/lib/TextInputLabel.js +0 -54
- package/dist/commonjs/text-input/lib/hooks/useTextInputField.d.ts +0 -19
- package/dist/commonjs/text-input/lib/hooks/useTextInputField.d.ts.map +0 -1
- package/dist/commonjs/text-input/lib/hooks/useTextInputField.js +0 -16
- package/dist/commonjs/text-input/lib/hooks/useTextInputHint.d.ts +0 -15
- package/dist/commonjs/text-input/lib/hooks/useTextInputHint.d.ts.map +0 -1
- package/dist/commonjs/text-input/lib/hooks/useTextInputHint.js +0 -12
- package/dist/commonjs/text-input/lib/hooks/useTextInputLabel.d.ts +0 -15
- package/dist/commonjs/text-input/lib/hooks/useTextInputLabel.d.ts.map +0 -1
- package/dist/commonjs/text-input/lib/hooks/useTextInputLabel.js +0 -12
- package/dist/commonjs/text-input/lib/hooks/useTextInputModel.d.ts +0 -17
- package/dist/commonjs/text-input/lib/hooks/useTextInputModel.d.ts.map +0 -1
- package/dist/commonjs/text-input/lib/hooks/useTextInputModel.js +0 -23
- package/dist/es6/text-input/index.d.ts +0 -7
- package/dist/es6/text-input/index.d.ts.map +0 -1
- package/dist/es6/text-input/index.js +0 -6
- package/dist/es6/text-input/lib/TextInput.d.ts +0 -21
- package/dist/es6/text-input/lib/TextInput.d.ts.map +0 -1
- package/dist/es6/text-input/lib/TextInput.js +0 -31
- package/dist/es6/text-input/lib/TextInputField.d.ts +0 -8
- package/dist/es6/text-input/lib/TextInputField.d.ts.map +0 -1
- package/dist/es6/text-input/lib/TextInputField.js +0 -64
- package/dist/es6/text-input/lib/TextInputHint.d.ts +0 -13
- package/dist/es6/text-input/lib/TextInputHint.d.ts.map +0 -1
- package/dist/es6/text-input/lib/TextInputHint.js +0 -44
- package/dist/es6/text-input/lib/TextInputLabel.d.ts +0 -17
- package/dist/es6/text-input/lib/TextInputLabel.d.ts.map +0 -1
- package/dist/es6/text-input/lib/TextInputLabel.js +0 -52
- package/dist/es6/text-input/lib/hooks/useTextInputField.d.ts +0 -19
- package/dist/es6/text-input/lib/hooks/useTextInputField.d.ts.map +0 -1
- package/dist/es6/text-input/lib/hooks/useTextInputField.js +0 -14
- package/dist/es6/text-input/lib/hooks/useTextInputHint.d.ts +0 -15
- package/dist/es6/text-input/lib/hooks/useTextInputHint.d.ts.map +0 -1
- package/dist/es6/text-input/lib/hooks/useTextInputHint.js +0 -10
- package/dist/es6/text-input/lib/hooks/useTextInputLabel.d.ts +0 -15
- package/dist/es6/text-input/lib/hooks/useTextInputLabel.d.ts.map +0 -1
- package/dist/es6/text-input/lib/hooks/useTextInputLabel.js +0 -10
- package/dist/es6/text-input/lib/hooks/useTextInputModel.d.ts +0 -17
- package/dist/es6/text-input/lib/hooks/useTextInputModel.d.ts.map +0 -1
- package/dist/es6/text-input/lib/hooks/useTextInputModel.js +0 -21
- package/text-input/LICENSE +0 -52
- package/text-input/README.md +0 -11
- package/text-input/index.ts +0 -6
- package/text-input/lib/TextInput.tsx +0 -34
- package/text-input/lib/TextInputField.tsx +0 -75
- package/text-input/lib/TextInputHint.tsx +0 -52
- package/text-input/lib/TextInputLabel.tsx +0 -74
- package/text-input/lib/hooks/useTextInputField.tsx +0 -15
- package/text-input/lib/hooks/useTextInputHint.tsx +0 -11
- package/text-input/lib/hooks/useTextInputLabel.tsx +0 -11
- package/text-input/lib/hooks/useTextInputModel.tsx +0 -45
- package/text-input/package.json +0 -5
- package/ts3.5/dist/commonjs/text-input/index.d.ts +0 -7
- package/ts3.5/dist/commonjs/text-input/lib/TextInput.d.ts +0 -21
- package/ts3.5/dist/commonjs/text-input/lib/TextInputField.d.ts +0 -8
- package/ts3.5/dist/commonjs/text-input/lib/TextInputHint.d.ts +0 -13
- package/ts3.5/dist/commonjs/text-input/lib/TextInputLabel.d.ts +0 -17
- package/ts3.5/dist/commonjs/text-input/lib/hooks/useTextInputField.d.ts +0 -19
- package/ts3.5/dist/commonjs/text-input/lib/hooks/useTextInputHint.d.ts +0 -15
- package/ts3.5/dist/commonjs/text-input/lib/hooks/useTextInputLabel.d.ts +0 -15
- package/ts3.5/dist/commonjs/text-input/lib/hooks/useTextInputModel.d.ts +0 -17
- package/ts3.5/dist/es6/text-input/index.d.ts +0 -7
- package/ts3.5/dist/es6/text-input/lib/TextInput.d.ts +0 -21
- package/ts3.5/dist/es6/text-input/lib/TextInputField.d.ts +0 -8
- package/ts3.5/dist/es6/text-input/lib/TextInputHint.d.ts +0 -13
- package/ts3.5/dist/es6/text-input/lib/TextInputLabel.d.ts +0 -17
- package/ts3.5/dist/es6/text-input/lib/hooks/useTextInputField.d.ts +0 -19
- package/ts3.5/dist/es6/text-input/lib/hooks/useTextInputHint.d.ts +0 -15
- package/ts3.5/dist/es6/text-input/lib/hooks/useTextInputLabel.d.ts +0 -15
- package/ts3.5/dist/es6/text-input/lib/hooks/useTextInputModel.d.ts +0 -17
package/common/README.md
CHANGED
|
@@ -64,3 +64,35 @@ export const HelloWorld = ({backgroundImagePath}) => {
|
|
|
64
64
|
);
|
|
65
65
|
};
|
|
66
66
|
```
|
|
67
|
+
|
|
68
|
+
## useThemedRing
|
|
69
|
+
|
|
70
|
+
This is a way to automatically add themed colors to your inputs. This is helpful when showing alerts to users. It supports `error`, `alert`, and `success` states. It will try and use the corresponding `main` colors from your `CanvasThemePalette` unless they do not meet accessibility contrast, in which case the outer ring will use the `darkest` color. This hook will also show a `focusOutline` ring when the input is focused.
|
|
71
|
+
Note: You should not rely on these colors alone to differentiate alerts, but use them in combination with icons or hint text.
|
|
72
|
+
|
|
73
|
+
### Usage
|
|
74
|
+
|
|
75
|
+
```tsx
|
|
76
|
+
/** @jsx jsx */
|
|
77
|
+
import {jsx} from '@emotion/core';
|
|
78
|
+
import React from 'react';
|
|
79
|
+
import {TextInput} from '@workday/canvas-kit-preview-react/text-input';
|
|
80
|
+
import {useThemedRing} from '@workday/canvas-kit-labs-react/common';
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
export const MyInput = ({handleChange}) => {
|
|
84
|
+
const [value, setValue] = React.useState('invalid@email');
|
|
85
|
+
const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {
|
|
86
|
+
setValue(event.target.value);
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
const alertStyles = useThemedRing('alert');
|
|
90
|
+
|
|
91
|
+
return (
|
|
92
|
+
<TextInput>
|
|
93
|
+
<TextInput.Label>Email</TextInput.Label>
|
|
94
|
+
<TextInput.Field css={alertStyles} onChange={handleChange} value={value} />
|
|
95
|
+
<TextInput.Hint>Please enter a valid email.</TextInput.Hint>
|
|
96
|
+
</TextInput>
|
|
97
|
+
);
|
|
98
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {useThemeRTL} from './useThemeRTL';
|
|
2
2
|
import {CanvasThemePalette, EmotionCanvasTheme} from '@workday/canvas-kit-react/common';
|
|
3
|
-
import {colors, CSSProperties, inputColors} from '@workday/canvas-kit-react/tokens';
|
|
3
|
+
import {colors, CSSProperties, inputColors, statusColors} from '@workday/canvas-kit-react/tokens';
|
|
4
4
|
import chroma from 'chroma-js';
|
|
5
5
|
|
|
6
6
|
type paletteSelection = Exclude<keyof EmotionCanvasTheme['canvas']['palette'], 'common'>;
|
|
@@ -14,44 +14,38 @@ const isAccessible = (foreground: string, background: string = colors.frenchVani
|
|
|
14
14
|
};
|
|
15
15
|
|
|
16
16
|
const getPaletteColorsFromTheme = (
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
palette: CanvasThemePalette,
|
|
18
|
+
fallbackColors?: ContrastColors,
|
|
19
19
|
): ContrastColors => {
|
|
20
|
-
return
|
|
21
|
-
?
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}
|
|
25
|
-
: fallbackColors;
|
|
20
|
+
return {
|
|
21
|
+
outer: isAccessible(palette.main) ? palette.main : isAccessible(palette.darkest) ? palette.darkest : fallbackColors?.outer,
|
|
22
|
+
inner: fallbackColors?.inner ? fallbackColors.inner : palette.main,
|
|
23
|
+
}
|
|
26
24
|
};
|
|
27
25
|
|
|
28
26
|
export function getPaletteColors(
|
|
29
27
|
type: paletteSelection,
|
|
30
|
-
theme
|
|
28
|
+
theme: EmotionCanvasTheme
|
|
31
29
|
): ContrastColors {
|
|
32
|
-
const palette = theme
|
|
30
|
+
const palette = theme.canvas.palette[type];
|
|
33
31
|
|
|
34
32
|
switch (type) {
|
|
35
33
|
case 'error': {
|
|
36
|
-
return getPaletteColorsFromTheme(
|
|
37
|
-
{
|
|
38
|
-
outer: inputColors.error.border,
|
|
39
|
-
inner: inputColors.error.border,
|
|
40
|
-
},
|
|
41
|
-
palette
|
|
42
|
-
);
|
|
34
|
+
return getPaletteColorsFromTheme(palette, { outer: inputColors.error.border });
|
|
43
35
|
}
|
|
44
36
|
case 'alert': {
|
|
45
|
-
return getPaletteColorsFromTheme(
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
37
|
+
return getPaletteColorsFromTheme(palette, { outer: colors.cantaloupe600 });
|
|
38
|
+
}
|
|
39
|
+
case 'success': {
|
|
40
|
+
return getPaletteColorsFromTheme(palette, {
|
|
41
|
+
outer: colors.greenApple600,
|
|
42
|
+
// The theme default for success.main is set to the darkest GreenApple
|
|
43
|
+
// For our default ring, we need to override it so the inner ring is a bit lighter
|
|
44
|
+
inner: palette.main === colors.greenApple600 ? statusColors.success : palette.main,
|
|
45
|
+
});
|
|
52
46
|
}
|
|
53
47
|
default: {
|
|
54
|
-
return getPaletteColorsFromTheme(
|
|
48
|
+
return getPaletteColorsFromTheme(palette);
|
|
55
49
|
}
|
|
56
50
|
}
|
|
57
51
|
}
|
|
@@ -5,7 +5,7 @@ interface ContrastColors {
|
|
|
5
5
|
outer?: string;
|
|
6
6
|
inner?: string;
|
|
7
7
|
}
|
|
8
|
-
export declare function getPaletteColors(type: paletteSelection, theme
|
|
8
|
+
export declare function getPaletteColors(type: paletteSelection, theme: EmotionCanvasTheme): ContrastColors;
|
|
9
9
|
export declare const useThemedRing: (type: "alert" | "error" | "primary" | "success" | "neutral") => CSSProperties;
|
|
10
10
|
export {};
|
|
11
11
|
//# sourceMappingURL=useThemedRing.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useThemedRing.d.ts","sourceRoot":"","sources":["../../../../../common/lib/theming/useThemedRing.ts"],"names":[],"mappings":"AACA,OAAO,EAAqB,kBAAkB,EAAC,MAAM,kCAAkC,CAAC;AACxF,OAAO,EAAS,aAAa,
|
|
1
|
+
{"version":3,"file":"useThemedRing.d.ts","sourceRoot":"","sources":["../../../../../common/lib/theming/useThemedRing.ts"],"names":[],"mappings":"AACA,OAAO,EAAqB,kBAAkB,EAAC,MAAM,kCAAkC,CAAC;AACxF,OAAO,EAAS,aAAa,EAA4B,MAAM,kCAAkC,CAAC;AAGlG,aAAK,gBAAgB,GAAG,OAAO,CAAC,MAAM,kBAAkB,CAAC,QAAQ,CAAC,CAAC,SAAS,CAAC,EAAE,QAAQ,CAAC,CAAC;AACzF,UAAU,cAAc;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAgBD,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,gBAAgB,EACtB,KAAK,EAAE,kBAAkB,GACxB,cAAc,CAsBhB;AAED,eAAO,MAAM,aAAa,gFAyBzB,CAAC"}
|
|
@@ -10,31 +10,31 @@ var isAccessible = function (foreground, background) {
|
|
|
10
10
|
if (background === void 0) { background = tokens_1.colors.frenchVanilla100; }
|
|
11
11
|
return chroma_js_1.default.contrast(foreground, background) >= 3;
|
|
12
12
|
};
|
|
13
|
-
var getPaletteColorsFromTheme = function (
|
|
14
|
-
return
|
|
15
|
-
?
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}
|
|
19
|
-
: fallbackColors;
|
|
13
|
+
var getPaletteColorsFromTheme = function (palette, fallbackColors) {
|
|
14
|
+
return {
|
|
15
|
+
outer: isAccessible(palette.main) ? palette.main : isAccessible(palette.darkest) ? palette.darkest : fallbackColors === null || fallbackColors === void 0 ? void 0 : fallbackColors.outer,
|
|
16
|
+
inner: (fallbackColors === null || fallbackColors === void 0 ? void 0 : fallbackColors.inner) ? fallbackColors.inner : palette.main,
|
|
17
|
+
};
|
|
20
18
|
};
|
|
21
19
|
function getPaletteColors(type, theme) {
|
|
22
|
-
var palette = theme
|
|
20
|
+
var palette = theme.canvas.palette[type];
|
|
23
21
|
switch (type) {
|
|
24
22
|
case 'error': {
|
|
25
|
-
return getPaletteColorsFromTheme({
|
|
26
|
-
outer: tokens_1.inputColors.error.border,
|
|
27
|
-
inner: tokens_1.inputColors.error.border,
|
|
28
|
-
}, palette);
|
|
23
|
+
return getPaletteColorsFromTheme(palette, { outer: tokens_1.inputColors.error.border });
|
|
29
24
|
}
|
|
30
25
|
case 'alert': {
|
|
31
|
-
return getPaletteColorsFromTheme({
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
26
|
+
return getPaletteColorsFromTheme(palette, { outer: tokens_1.colors.cantaloupe600 });
|
|
27
|
+
}
|
|
28
|
+
case 'success': {
|
|
29
|
+
return getPaletteColorsFromTheme(palette, {
|
|
30
|
+
outer: tokens_1.colors.greenApple600,
|
|
31
|
+
// The theme default for success.main is set to the darkest GreenApple
|
|
32
|
+
// For our default ring, we need to override it so the inner ring is a bit lighter
|
|
33
|
+
inner: palette.main === tokens_1.colors.greenApple600 ? tokens_1.statusColors.success : palette.main,
|
|
34
|
+
});
|
|
35
35
|
}
|
|
36
36
|
default: {
|
|
37
|
-
return getPaletteColorsFromTheme(
|
|
37
|
+
return getPaletteColorsFromTheme(palette);
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
40
|
}
|
package/dist/commonjs/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,eAAe,CAAC"}
|
package/dist/commonjs/index.js
CHANGED
|
@@ -5,7 +5,7 @@ interface ContrastColors {
|
|
|
5
5
|
outer?: string;
|
|
6
6
|
inner?: string;
|
|
7
7
|
}
|
|
8
|
-
export declare function getPaletteColors(type: paletteSelection, theme
|
|
8
|
+
export declare function getPaletteColors(type: paletteSelection, theme: EmotionCanvasTheme): ContrastColors;
|
|
9
9
|
export declare const useThemedRing: (type: "alert" | "error" | "primary" | "success" | "neutral") => CSSProperties;
|
|
10
10
|
export {};
|
|
11
11
|
//# sourceMappingURL=useThemedRing.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useThemedRing.d.ts","sourceRoot":"","sources":["../../../../../common/lib/theming/useThemedRing.ts"],"names":[],"mappings":"AACA,OAAO,EAAqB,kBAAkB,EAAC,MAAM,kCAAkC,CAAC;AACxF,OAAO,EAAS,aAAa,
|
|
1
|
+
{"version":3,"file":"useThemedRing.d.ts","sourceRoot":"","sources":["../../../../../common/lib/theming/useThemedRing.ts"],"names":[],"mappings":"AACA,OAAO,EAAqB,kBAAkB,EAAC,MAAM,kCAAkC,CAAC;AACxF,OAAO,EAAS,aAAa,EAA4B,MAAM,kCAAkC,CAAC;AAGlG,aAAK,gBAAgB,GAAG,OAAO,CAAC,MAAM,kBAAkB,CAAC,QAAQ,CAAC,CAAC,SAAS,CAAC,EAAE,QAAQ,CAAC,CAAC;AACzF,UAAU,cAAc;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAgBD,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,gBAAgB,EACtB,KAAK,EAAE,kBAAkB,GACxB,cAAc,CAsBhB;AAED,eAAO,MAAM,aAAa,gFAyBzB,CAAC"}
|
|
@@ -1,35 +1,35 @@
|
|
|
1
1
|
import { useThemeRTL } from './useThemeRTL';
|
|
2
|
-
import { colors, inputColors } from '@workday/canvas-kit-react/tokens';
|
|
2
|
+
import { colors, inputColors, statusColors } from '@workday/canvas-kit-react/tokens';
|
|
3
3
|
import chroma from 'chroma-js';
|
|
4
4
|
var isAccessible = function (foreground, background) {
|
|
5
5
|
if (background === void 0) { background = colors.frenchVanilla100; }
|
|
6
6
|
return chroma.contrast(foreground, background) >= 3;
|
|
7
7
|
};
|
|
8
|
-
var getPaletteColorsFromTheme = function (
|
|
9
|
-
return
|
|
10
|
-
?
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}
|
|
14
|
-
: fallbackColors;
|
|
8
|
+
var getPaletteColorsFromTheme = function (palette, fallbackColors) {
|
|
9
|
+
return {
|
|
10
|
+
outer: isAccessible(palette.main) ? palette.main : isAccessible(palette.darkest) ? palette.darkest : fallbackColors === null || fallbackColors === void 0 ? void 0 : fallbackColors.outer,
|
|
11
|
+
inner: (fallbackColors === null || fallbackColors === void 0 ? void 0 : fallbackColors.inner) ? fallbackColors.inner : palette.main,
|
|
12
|
+
};
|
|
15
13
|
};
|
|
16
14
|
export function getPaletteColors(type, theme) {
|
|
17
|
-
var palette = theme
|
|
15
|
+
var palette = theme.canvas.palette[type];
|
|
18
16
|
switch (type) {
|
|
19
17
|
case 'error': {
|
|
20
|
-
return getPaletteColorsFromTheme({
|
|
21
|
-
outer: inputColors.error.border,
|
|
22
|
-
inner: inputColors.error.border,
|
|
23
|
-
}, palette);
|
|
18
|
+
return getPaletteColorsFromTheme(palette, { outer: inputColors.error.border });
|
|
24
19
|
}
|
|
25
20
|
case 'alert': {
|
|
26
|
-
return getPaletteColorsFromTheme({
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
21
|
+
return getPaletteColorsFromTheme(palette, { outer: colors.cantaloupe600 });
|
|
22
|
+
}
|
|
23
|
+
case 'success': {
|
|
24
|
+
return getPaletteColorsFromTheme(palette, {
|
|
25
|
+
outer: colors.greenApple600,
|
|
26
|
+
// The theme default for success.main is set to the darkest GreenApple
|
|
27
|
+
// For our default ring, we need to override it so the inner ring is a bit lighter
|
|
28
|
+
inner: palette.main === colors.greenApple600 ? statusColors.success : palette.main,
|
|
29
|
+
});
|
|
30
30
|
}
|
|
31
31
|
default: {
|
|
32
|
-
return getPaletteColorsFromTheme(
|
|
32
|
+
return getPaletteColorsFromTheme(palette);
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
35
|
}
|
package/dist/es6/index.d.ts
CHANGED
package/dist/es6/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,eAAe,CAAC"}
|
package/dist/es6/index.js
CHANGED
package/index.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@workday/canvas-kit-labs-react",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.1.1",
|
|
4
4
|
"description": "Canvas Kit Labs is an incubator for new and experimental components. Since we have a rather rigorous process for getting components in at a production level, it can be valuable to make them available earlier while we continuously iterate on the API/functionality. The Labs modules allow us to do that as needed.",
|
|
5
5
|
"author": "Workday, Inc. (https://www.workday.com)",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -38,7 +38,8 @@
|
|
|
38
38
|
"build": "npm-run-all --parallel build:cjs build:es6 --sequential build:downlevel-dts",
|
|
39
39
|
"prepack": "node ../../utils/publish.js pre labs-react",
|
|
40
40
|
"postpack": "node ../../utils/publish.js post labs-react",
|
|
41
|
-
"depcheck": "node ../../utils/check-dependencies-exist.js"
|
|
41
|
+
"depcheck": "node ../../utils/check-dependencies-exist.js",
|
|
42
|
+
"typecheck:src": "tsc -p . --noEmit --incremental false"
|
|
42
43
|
},
|
|
43
44
|
"keywords": [
|
|
44
45
|
"canvas",
|
|
@@ -55,8 +56,8 @@
|
|
|
55
56
|
"@emotion/is-prop-valid": "^0.8.2",
|
|
56
57
|
"@emotion/styled": "^10.0.27",
|
|
57
58
|
"@types/uuid": "^3.4.4",
|
|
58
|
-
"@workday/canvas-kit-preview-react": "^6.
|
|
59
|
-
"@workday/canvas-kit-react": "^6.
|
|
59
|
+
"@workday/canvas-kit-preview-react": "^6.1.1",
|
|
60
|
+
"@workday/canvas-kit-react": "^6.1.1",
|
|
60
61
|
"@workday/canvas-system-icons-web": "1.0.41",
|
|
61
62
|
"chroma-js": "^2.1.0",
|
|
62
63
|
"csstype": "^2.6.17",
|
|
@@ -65,9 +66,7 @@
|
|
|
65
66
|
"uuid": "^3.3.3"
|
|
66
67
|
},
|
|
67
68
|
"devDependencies": {
|
|
68
|
-
"@types/lodash.flatten": "^4.4.6"
|
|
69
|
-
"formik": "^2.2.9",
|
|
70
|
-
"yup": "^0.31.1"
|
|
69
|
+
"@types/lodash.flatten": "^4.4.6"
|
|
71
70
|
},
|
|
72
|
-
"gitHead": "
|
|
71
|
+
"gitHead": "265ecd66ee2244f8f6be4b6ac87bf56af815fcac"
|
|
73
72
|
}
|
|
@@ -5,7 +5,7 @@ interface ContrastColors {
|
|
|
5
5
|
outer?: string;
|
|
6
6
|
inner?: string;
|
|
7
7
|
}
|
|
8
|
-
export declare function getPaletteColors(type: paletteSelection, theme
|
|
8
|
+
export declare function getPaletteColors(type: paletteSelection, theme: EmotionCanvasTheme): ContrastColors;
|
|
9
9
|
export declare const useThemedRing: (type: "alert" | "error" | "primary" | "success" | "neutral") => CSSProperties;
|
|
10
10
|
export {};
|
|
11
11
|
//# sourceMappingURL=useThemedRing.d.ts.map
|
|
@@ -5,7 +5,7 @@ interface ContrastColors {
|
|
|
5
5
|
outer?: string;
|
|
6
6
|
inner?: string;
|
|
7
7
|
}
|
|
8
|
-
export declare function getPaletteColors(type: paletteSelection, theme
|
|
8
|
+
export declare function getPaletteColors(type: paletteSelection, theme: EmotionCanvasTheme): ContrastColors;
|
|
9
9
|
export declare const useThemedRing: (type: "alert" | "error" | "primary" | "success" | "neutral") => CSSProperties;
|
|
10
10
|
export {};
|
|
11
11
|
//# sourceMappingURL=useThemedRing.d.ts.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export * from './lib/TextInput';
|
|
2
|
-
export * from './lib/hooks/useTextInputModel';
|
|
3
|
-
export * from './lib/hooks/useTextInputHint';
|
|
4
|
-
export * from './lib/hooks/useTextInputField';
|
|
5
|
-
export * from './lib/hooks/useTextInputHint';
|
|
6
|
-
export * from './lib/hooks/useTextInputLabel';
|
|
7
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../text-input/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,+BAA+B,CAAC"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
function __export(m) {
|
|
3
|
-
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
|
|
4
|
-
}
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
__export(require("./lib/TextInput"));
|
|
7
|
-
__export(require("./lib/hooks/useTextInputModel"));
|
|
8
|
-
__export(require("./lib/hooks/useTextInputHint"));
|
|
9
|
-
__export(require("./lib/hooks/useTextInputField"));
|
|
10
|
-
__export(require("./lib/hooks/useTextInputHint"));
|
|
11
|
-
__export(require("./lib/hooks/useTextInputLabel"));
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { TextInputModel, TextInputModelConfig } from './hooks/useTextInputModel';
|
|
3
|
-
export declare const TextInputModelContext: React.Context<import("@workday/canvas-kit-react/common").Model<{
|
|
4
|
-
hasError?: boolean | undefined;
|
|
5
|
-
inputId?: string | undefined;
|
|
6
|
-
hintId?: string | undefined;
|
|
7
|
-
isRequired?: boolean | undefined;
|
|
8
|
-
}, {}>>;
|
|
9
|
-
export interface TextInputProps extends TextInputModelConfig {
|
|
10
|
-
model?: TextInputModel;
|
|
11
|
-
/**
|
|
12
|
-
* Children of the Text Input. Should contain a `<TextInput.Field>`, a `<TextInput.Label>` and an optional `<TextInput.Hint>`
|
|
13
|
-
*/
|
|
14
|
-
children: React.ReactNode;
|
|
15
|
-
}
|
|
16
|
-
export declare const TextInput: import("@workday/canvas-kit-react/common").Component<TextInputProps> & {
|
|
17
|
-
Field: import("@workday/canvas-kit-react/common").ElementComponent<"input", import("./TextInputField").TextInputFieldProps>;
|
|
18
|
-
Label: import("@workday/canvas-kit-react/common").ElementComponent<"label", import("./TextInputLabel").TextInputLabelProps>;
|
|
19
|
-
Hint: import("@workday/canvas-kit-react/common").ElementComponent<"p", import("./TextInputHint").TextInputHintProps>;
|
|
20
|
-
};
|
|
21
|
-
//# sourceMappingURL=TextInput.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"TextInput.d.ts","sourceRoot":"","sources":["../../../../text-input/lib/TextInput.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,OAAO,EAAoB,cAAc,EAAE,oBAAoB,EAAC,MAAM,2BAA2B,CAAC;AAKlG,eAAO,MAAM,qBAAqB;;;;;OAAiD,CAAC;AAEpF,MAAM,WAAW,cAAe,SAAQ,oBAAoB;IAC1D,KAAK,CAAC,EAAE,cAAc,CAAC;IACvB;;OAEG;IACH,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAED,eAAO,MAAM,SAAS;;;;CAcpB,CAAC"}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
-
var t = {};
|
|
4
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
-
t[p] = s[p];
|
|
6
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
-
t[p[i]] = s[p[i]];
|
|
10
|
-
}
|
|
11
|
-
return t;
|
|
12
|
-
};
|
|
13
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
var react_1 = __importDefault(require("react"));
|
|
18
|
-
var common_1 = require("@workday/canvas-kit-react/common");
|
|
19
|
-
var useTextInputModel_1 = require("./hooks/useTextInputModel");
|
|
20
|
-
var TextInputField_1 = require("./TextInputField");
|
|
21
|
-
var TextInputLabel_1 = require("./TextInputLabel");
|
|
22
|
-
var TextInputHint_1 = require("./TextInputHint");
|
|
23
|
-
exports.TextInputModelContext = react_1.default.createContext({});
|
|
24
|
-
exports.TextInput = common_1.createComponent()({
|
|
25
|
-
displayName: 'TextInput',
|
|
26
|
-
Component: function (_a) {
|
|
27
|
-
var children = _a.children, model = _a.model, config = __rest(_a, ["children", "model"]);
|
|
28
|
-
var value = common_1.useDefaultModel(model, config, useTextInputModel_1.useTextInputModel);
|
|
29
|
-
return (react_1.default.createElement(exports.TextInputModelContext.Provider, { value: value }, children));
|
|
30
|
-
},
|
|
31
|
-
subComponents: {
|
|
32
|
-
Field: TextInputField_1.TextInputField,
|
|
33
|
-
Label: TextInputLabel_1.TextInputLabel,
|
|
34
|
-
Hint: TextInputHint_1.TextInputHint,
|
|
35
|
-
},
|
|
36
|
-
});
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { ExtractProps } from '@workday/canvas-kit-react/common';
|
|
2
|
-
import { Box } from '@workday/canvas-kit-labs-react/common';
|
|
3
|
-
import { TextInputModel } from './hooks/useTextInputModel';
|
|
4
|
-
export interface TextInputFieldProps extends ExtractProps<typeof Box, never> {
|
|
5
|
-
model?: TextInputModel;
|
|
6
|
-
}
|
|
7
|
-
export declare const TextInputField: import("@workday/canvas-kit-react/common").ElementComponent<"input", TextInputFieldProps>;
|
|
8
|
-
//# sourceMappingURL=TextInputField.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"TextInputField.d.ts","sourceRoot":"","sources":["../../../../text-input/lib/TextInputField.tsx"],"names":[],"mappings":"AAUA,OAAO,EAAkB,YAAY,EAAkB,MAAM,kCAAkC,CAAC;AAChG,OAAO,EAAC,GAAG,EAA6B,MAAM,uCAAuC,CAAC;AAGtF,OAAO,EAAC,cAAc,EAAC,MAAM,2BAA2B,CAAC;AAGzD,MAAM,WAAW,mBAAoB,SAAQ,YAAY,CAAC,OAAO,GAAG,EAAE,KAAK,CAAC;IAC1E,KAAK,CAAC,EAAE,cAAc,CAAC;CACxB;AAmCD,eAAO,MAAM,cAAc,2FAoBzB,CAAC"}
|
|
@@ -1,66 +0,0 @@
|
|
|
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
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
-
/** @jsx jsx */
|
|
26
|
-
var core_1 = require("@emotion/core");
|
|
27
|
-
var tokens_1 = require("@workday/canvas-kit-react/tokens");
|
|
28
|
-
var common_1 = require("@workday/canvas-kit-react/common");
|
|
29
|
-
var common_2 = require("@workday/canvas-kit-labs-react/common");
|
|
30
|
-
var TextInput_1 = require("./TextInput");
|
|
31
|
-
var useTextInputField_1 = require("./hooks/useTextInputField");
|
|
32
|
-
var baseStyles = __assign(__assign({}, tokens_1.type.levels.subtext.large), { padding: tokens_1.space.xxs, margin: 0, minWidth: '280px', border: "1px solid " + tokens_1.inputColors.border, backgroundColor: tokens_1.inputColors.background, borderRadius: tokens_1.borderRadius.m, display: 'block', height: '40px', transition: '0.2s box-shadow, 0.2s border-color', '&::placeholder': {
|
|
33
|
-
color: tokens_1.inputColors.placeholder,
|
|
34
|
-
}, '&:hover': {
|
|
35
|
-
borderColor: tokens_1.inputColors.hoverBorder,
|
|
36
|
-
}, '&:focus:not([disabled])': {
|
|
37
|
-
outline: 'none',
|
|
38
|
-
}, '&:disabled': {
|
|
39
|
-
backgroundColor: tokens_1.inputColors.disabled.background,
|
|
40
|
-
borderColor: tokens_1.inputColors.disabled.border,
|
|
41
|
-
color: tokens_1.inputColors.disabled.text,
|
|
42
|
-
'&::placeholder': {
|
|
43
|
-
color: tokens_1.inputColors.disabled.text,
|
|
44
|
-
},
|
|
45
|
-
}, '::-ms-clear': {
|
|
46
|
-
display: 'none',
|
|
47
|
-
} });
|
|
48
|
-
exports.TextInputField = common_1.createComponent('input')({
|
|
49
|
-
displayName: 'TextInput.Field',
|
|
50
|
-
Component: function (_a, ref) {
|
|
51
|
-
var model = _a.model, elemProps = __rest(_a, ["model"]);
|
|
52
|
-
var localModel = common_1.useModelContext(TextInput_1.TextInputModelContext, model);
|
|
53
|
-
var props = useTextInputField_1.useTextInputField(localModel, elemProps, ref);
|
|
54
|
-
var _b = common_2.useThemeRTL(), themeRTL = _b.themeRTL, theme = _b.theme;
|
|
55
|
-
var errorRing = common_2.useThemedRing('error');
|
|
56
|
-
var focusStyles = localModel.state.hasError
|
|
57
|
-
? errorRing
|
|
58
|
-
: themeRTL({
|
|
59
|
-
'&:focus:not([disabled])': {
|
|
60
|
-
borderColor: theme.canvas.palette.common.focusOutline,
|
|
61
|
-
boxShadow: "inset 0 0 0 1px " + theme.canvas.palette.common.focusOutline,
|
|
62
|
-
},
|
|
63
|
-
});
|
|
64
|
-
return core_1.jsx(common_2.Box, __assign({ as: "input", css: [themeRTL(baseStyles), focusStyles] }, props));
|
|
65
|
-
},
|
|
66
|
-
});
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { ExtractProps } from '@workday/canvas-kit-react/common';
|
|
3
|
-
import { Box } from '@workday/canvas-kit-labs-react/common';
|
|
4
|
-
import { TextInputModel } from './hooks/useTextInputModel';
|
|
5
|
-
export interface TextInputHintProps extends ExtractProps<typeof Box, never> {
|
|
6
|
-
model?: TextInputModel;
|
|
7
|
-
/**
|
|
8
|
-
* Hint text to show to the user regarding the Error/Alert
|
|
9
|
-
*/
|
|
10
|
-
children?: React.ReactNode;
|
|
11
|
-
}
|
|
12
|
-
export declare const TextInputHint: import("@workday/canvas-kit-react/common").ElementComponent<"p", TextInputHintProps>;
|
|
13
|
-
//# sourceMappingURL=TextInputHint.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"TextInputHint.d.ts","sourceRoot":"","sources":["../../../../text-input/lib/TextInputHint.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAkB,YAAY,EAAkB,MAAM,kCAAkC,CAAC;AAEhG,OAAO,EAAC,GAAG,EAAc,MAAM,uCAAuC,CAAC;AAGvE,OAAO,EAAC,cAAc,EAAC,MAAM,2BAA2B,CAAC;AAGzD,MAAM,WAAW,kBAAmB,SAAQ,YAAY,CAAC,OAAO,GAAG,EAAE,KAAK,CAAC;IACzE,KAAK,CAAC,EAAE,cAAc,CAAC;IACvB;;OAEG;IACH,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B;AAQD,eAAO,MAAM,aAAa,sFAyBxB,CAAC"}
|
|
@@ -1,46 +0,0 @@
|
|
|
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
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
-
/** @jsx jsx */
|
|
26
|
-
var core_1 = require("@emotion/core");
|
|
27
|
-
var common_1 = require("@workday/canvas-kit-react/common");
|
|
28
|
-
var tokens_1 = require("@workday/canvas-kit-react/tokens");
|
|
29
|
-
var common_2 = require("@workday/canvas-kit-labs-react/common");
|
|
30
|
-
var TextInput_1 = require("./TextInput");
|
|
31
|
-
var useTextInputHint_1 = require("./hooks/useTextInputHint");
|
|
32
|
-
var baseStyles = __assign(__assign({}, tokens_1.type.levels.subtext.medium), { margin: tokens_1.space.xxs + " 0 0", width: '100%' });
|
|
33
|
-
exports.TextInputHint = common_1.createComponent('p')({
|
|
34
|
-
displayName: 'TextInput.Hint',
|
|
35
|
-
Component: function (_a, ref, Element) {
|
|
36
|
-
var model = _a.model, children = _a.children, elemProps = __rest(_a, ["model", "children"]);
|
|
37
|
-
var localModel = common_1.useModelContext(TextInput_1.TextInputModelContext, model);
|
|
38
|
-
var props = useTextInputHint_1.useTextInputHint(localModel, elemProps, ref);
|
|
39
|
-
var _b = common_2.useThemeRTL(), themeRTL = _b.themeRTL, theme = _b.theme;
|
|
40
|
-
if (!children) {
|
|
41
|
-
// If there is no hint text just skip rendering
|
|
42
|
-
return null;
|
|
43
|
-
}
|
|
44
|
-
return (core_1.jsx(common_2.Box, __assign({ as: Element, css: themeRTL(baseStyles, localModel.state.hasError ? { color: theme.canvas.palette.error.main } : {}) }, props), children));
|
|
45
|
-
},
|
|
46
|
-
});
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { ExtractProps } from '@workday/canvas-kit-react/common';
|
|
3
|
-
import { Box } from '@workday/canvas-kit-labs-react/common';
|
|
4
|
-
import { TextInputModel } from './hooks/useTextInputModel';
|
|
5
|
-
export interface TextInputLabelProps extends ExtractProps<typeof Box, never> {
|
|
6
|
-
model?: TextInputModel;
|
|
7
|
-
/**
|
|
8
|
-
* If true, apply the `accessibleHide` styles to the Label.
|
|
9
|
-
*/
|
|
10
|
-
isVisuallyHidden?: boolean;
|
|
11
|
-
/**
|
|
12
|
-
* The text of the label.
|
|
13
|
-
*/
|
|
14
|
-
children: React.ReactNode;
|
|
15
|
-
}
|
|
16
|
-
export declare const TextInputLabel: import("@workday/canvas-kit-react/common").ElementComponent<"label", TextInputLabelProps>;
|
|
17
|
-
//# sourceMappingURL=TextInputLabel.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"TextInputLabel.d.ts","sourceRoot":"","sources":["../../../../text-input/lib/TextInputLabel.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAGL,YAAY,EAEb,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAC,GAAG,EAA+B,MAAM,uCAAuC,CAAC;AAKxF,OAAO,EAAC,cAAc,EAAC,MAAM,2BAA2B,CAAC;AAGzD,MAAM,WAAW,mBAAoB,SAAQ,YAAY,CAAC,OAAO,GAAG,EAAE,KAAK,CAAC;IAC1E,KAAK,CAAC,EAAE,cAAc,CAAC;IACvB;;OAEG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B;;OAEG;IACH,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAkBD,eAAO,MAAM,cAAc,2FA2BzB,CAAC"}
|