@workday/canvas-kit-labs-react 6.0.0-beta.0-next.15 → 6.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/combobox/lib/AutocompleteList.tsx +5 -2
- package/combobox/lib/Combobox.tsx +0 -1
- package/common/lib/theming/index.ts +1 -0
- package/common/lib/theming/useThemedRing.ts +84 -0
- package/dist/commonjs/combobox/lib/AutocompleteList.d.ts.map +1 -1
- package/dist/commonjs/combobox/lib/AutocompleteList.js +5 -2
- package/dist/commonjs/combobox/lib/Combobox.d.ts.map +1 -1
- package/dist/commonjs/combobox/lib/Combobox.js +0 -1
- package/dist/commonjs/common/lib/theming/index.d.ts +1 -0
- package/dist/commonjs/common/lib/theming/index.d.ts.map +1 -1
- package/dist/commonjs/common/lib/theming/index.js +1 -0
- package/dist/commonjs/common/lib/theming/useThemedRing.d.ts +11 -0
- package/dist/commonjs/common/lib/theming/useThemedRing.d.ts.map +1 -0
- package/dist/commonjs/common/lib/theming/useThemedRing.js +61 -0
- package/dist/commonjs/header/index.d.ts +5 -5
- package/dist/commonjs/header/index.d.ts.map +1 -1
- package/dist/commonjs/header/index.js +2 -2
- package/dist/commonjs/header/lib/GlobalHeader.d.ts +11 -2
- package/dist/commonjs/header/lib/GlobalHeader.d.ts.map +1 -1
- package/dist/commonjs/header/lib/GlobalHeader.js +19 -8
- package/dist/commonjs/header/lib/Header.d.ts +17 -8
- package/dist/commonjs/header/lib/Header.d.ts.map +1 -1
- package/dist/commonjs/header/lib/Header.js +27 -14
- package/dist/commonjs/header/lib/parts/DubLogoTitle.d.ts +13 -4
- package/dist/commonjs/header/lib/parts/DubLogoTitle.d.ts.map +1 -1
- package/dist/commonjs/header/lib/parts/DubLogoTitle.js +22 -11
- package/dist/commonjs/header/lib/parts/WorkdayLogoTitle.d.ts +14 -5
- package/dist/commonjs/header/lib/parts/WorkdayLogoTitle.d.ts.map +1 -1
- package/dist/commonjs/header/lib/parts/WorkdayLogoTitle.js +25 -12
- package/dist/commonjs/header/lib/parts/index.d.ts +2 -3
- package/dist/commonjs/header/lib/parts/index.d.ts.map +1 -1
- package/dist/commonjs/header/lib/parts/index.js +2 -4
- package/dist/commonjs/header/lib/shared/themes.d.ts +28 -19
- package/dist/commonjs/header/lib/shared/themes.d.ts.map +1 -1
- package/dist/commonjs/header/lib/shared/themes.js +13 -36
- package/dist/commonjs/header/lib/shared/types.d.ts +3 -8
- package/dist/commonjs/header/lib/shared/types.d.ts.map +1 -1
- package/dist/commonjs/header/lib/shared/types.js +17 -23
- package/dist/commonjs/index.d.ts +2 -0
- package/dist/commonjs/index.d.ts.map +1 -1
- package/dist/commonjs/index.js +2 -0
- package/dist/commonjs/layout/lib/utils/getValidChildren.d.ts +1 -1
- package/dist/commonjs/layout/lib/utils/getValidChildren.d.ts.map +1 -1
- package/dist/commonjs/search-form/index.d.ts +3 -0
- package/dist/commonjs/search-form/index.d.ts.map +1 -0
- package/dist/commonjs/search-form/index.js +7 -0
- package/dist/commonjs/{header/lib/parts/SearchBar.d.ts → search-form/lib/SearchForm.d.ts} +22 -23
- package/dist/commonjs/search-form/lib/SearchForm.d.ts.map +1 -0
- package/dist/commonjs/{header/lib/parts/SearchBar.js → search-form/lib/SearchForm.js} +13 -14
- package/dist/commonjs/search-form/lib/themes.d.ts +21 -0
- package/dist/commonjs/search-form/lib/themes.d.ts.map +1 -0
- package/dist/commonjs/search-form/lib/themes.js +41 -0
- package/dist/commonjs/text-input/index.d.ts +7 -0
- package/dist/commonjs/text-input/index.d.ts.map +1 -0
- package/dist/commonjs/text-input/index.js +11 -0
- package/dist/commonjs/text-input/lib/TextInput.d.ts +21 -0
- package/dist/commonjs/text-input/lib/TextInput.d.ts.map +1 -0
- package/dist/commonjs/text-input/lib/TextInput.js +36 -0
- package/dist/commonjs/text-input/lib/TextInputField.d.ts +8 -0
- package/dist/commonjs/text-input/lib/TextInputField.d.ts.map +1 -0
- package/dist/commonjs/text-input/lib/TextInputField.js +66 -0
- package/dist/commonjs/text-input/lib/TextInputHint.d.ts +13 -0
- package/dist/commonjs/text-input/lib/TextInputHint.d.ts.map +1 -0
- package/dist/commonjs/text-input/lib/TextInputHint.js +46 -0
- package/dist/commonjs/text-input/lib/TextInputLabel.d.ts +17 -0
- package/dist/commonjs/text-input/lib/TextInputLabel.d.ts.map +1 -0
- package/dist/commonjs/text-input/lib/TextInputLabel.js +54 -0
- package/dist/commonjs/text-input/lib/hooks/useTextInputField.d.ts +19 -0
- package/dist/commonjs/text-input/lib/hooks/useTextInputField.d.ts.map +1 -0
- package/dist/commonjs/text-input/lib/hooks/useTextInputField.js +16 -0
- package/dist/commonjs/text-input/lib/hooks/useTextInputHint.d.ts +15 -0
- package/dist/commonjs/text-input/lib/hooks/useTextInputHint.d.ts.map +1 -0
- package/dist/commonjs/text-input/lib/hooks/useTextInputHint.js +12 -0
- package/dist/commonjs/text-input/lib/hooks/useTextInputLabel.d.ts +15 -0
- package/dist/commonjs/text-input/lib/hooks/useTextInputLabel.d.ts.map +1 -0
- package/dist/commonjs/text-input/lib/hooks/useTextInputLabel.js +12 -0
- package/dist/commonjs/text-input/lib/hooks/useTextInputModel.d.ts +17 -0
- package/dist/commonjs/text-input/lib/hooks/useTextInputModel.d.ts.map +1 -0
- package/dist/commonjs/text-input/lib/hooks/useTextInputModel.js +23 -0
- package/dist/es6/combobox/lib/AutocompleteList.d.ts.map +1 -1
- package/dist/es6/combobox/lib/AutocompleteList.js +5 -2
- package/dist/es6/combobox/lib/Combobox.d.ts.map +1 -1
- package/dist/es6/combobox/lib/Combobox.js +0 -1
- package/dist/es6/common/lib/theming/index.d.ts +1 -0
- package/dist/es6/common/lib/theming/index.d.ts.map +1 -1
- package/dist/es6/common/lib/theming/index.js +1 -0
- package/dist/es6/common/lib/theming/useThemedRing.d.ts +11 -0
- package/dist/es6/common/lib/theming/useThemedRing.d.ts.map +1 -0
- package/dist/es6/common/lib/theming/useThemedRing.js +55 -0
- package/dist/es6/header/index.d.ts +5 -5
- package/dist/es6/header/index.d.ts.map +1 -1
- package/dist/es6/header/index.js +5 -5
- package/dist/es6/header/lib/GlobalHeader.d.ts +11 -2
- package/dist/es6/header/lib/GlobalHeader.d.ts.map +1 -1
- package/dist/es6/header/lib/GlobalHeader.js +22 -11
- package/dist/es6/header/lib/Header.d.ts +17 -8
- package/dist/es6/header/lib/Header.d.ts.map +1 -1
- package/dist/es6/header/lib/Header.js +30 -17
- package/dist/es6/header/lib/parts/DubLogoTitle.d.ts +13 -4
- package/dist/es6/header/lib/parts/DubLogoTitle.d.ts.map +1 -1
- package/dist/es6/header/lib/parts/DubLogoTitle.js +23 -12
- package/dist/es6/header/lib/parts/WorkdayLogoTitle.d.ts +14 -5
- package/dist/es6/header/lib/parts/WorkdayLogoTitle.d.ts.map +1 -1
- package/dist/es6/header/lib/parts/WorkdayLogoTitle.js +26 -13
- package/dist/es6/header/lib/parts/index.d.ts +2 -3
- package/dist/es6/header/lib/parts/index.d.ts.map +1 -1
- package/dist/es6/header/lib/parts/index.js +2 -3
- package/dist/es6/header/lib/shared/themes.d.ts +28 -19
- package/dist/es6/header/lib/shared/themes.d.ts.map +1 -1
- package/dist/es6/header/lib/shared/themes.js +14 -37
- package/dist/es6/header/lib/shared/types.d.ts +3 -8
- package/dist/es6/header/lib/shared/types.d.ts.map +1 -1
- package/dist/es6/header/lib/shared/types.js +17 -23
- package/dist/es6/index.d.ts +2 -0
- package/dist/es6/index.d.ts.map +1 -1
- package/dist/es6/index.js +2 -0
- package/dist/es6/layout/lib/utils/getValidChildren.d.ts +1 -1
- package/dist/es6/layout/lib/utils/getValidChildren.d.ts.map +1 -1
- package/dist/es6/search-form/index.d.ts +3 -0
- package/dist/es6/search-form/index.d.ts.map +1 -0
- package/dist/es6/search-form/index.js +2 -0
- package/dist/es6/{header/lib/parts/SearchBar.d.ts → search-form/lib/SearchForm.d.ts} +22 -23
- package/dist/es6/search-form/lib/SearchForm.d.ts.map +1 -0
- package/dist/es6/{header/lib/parts/SearchBar.js → search-form/lib/SearchForm.js} +11 -12
- package/dist/es6/search-form/lib/themes.d.ts +21 -0
- package/dist/es6/search-form/lib/themes.d.ts.map +1 -0
- package/dist/es6/search-form/lib/themes.js +39 -0
- package/dist/es6/text-input/index.d.ts +7 -0
- package/dist/es6/text-input/index.d.ts.map +1 -0
- package/dist/es6/text-input/index.js +6 -0
- package/dist/es6/text-input/lib/TextInput.d.ts +21 -0
- package/dist/es6/text-input/lib/TextInput.d.ts.map +1 -0
- package/dist/es6/text-input/lib/TextInput.js +31 -0
- package/dist/es6/text-input/lib/TextInputField.d.ts +8 -0
- package/dist/es6/text-input/lib/TextInputField.d.ts.map +1 -0
- package/dist/es6/text-input/lib/TextInputField.js +64 -0
- package/dist/es6/text-input/lib/TextInputHint.d.ts +13 -0
- package/dist/es6/text-input/lib/TextInputHint.d.ts.map +1 -0
- package/dist/es6/text-input/lib/TextInputHint.js +44 -0
- package/dist/es6/text-input/lib/TextInputLabel.d.ts +17 -0
- package/dist/es6/text-input/lib/TextInputLabel.d.ts.map +1 -0
- package/dist/es6/text-input/lib/TextInputLabel.js +52 -0
- package/dist/es6/text-input/lib/hooks/useTextInputField.d.ts +19 -0
- package/dist/es6/text-input/lib/hooks/useTextInputField.d.ts.map +1 -0
- package/dist/es6/text-input/lib/hooks/useTextInputField.js +14 -0
- package/dist/es6/text-input/lib/hooks/useTextInputHint.d.ts +15 -0
- package/dist/es6/text-input/lib/hooks/useTextInputHint.d.ts.map +1 -0
- package/dist/es6/text-input/lib/hooks/useTextInputHint.js +10 -0
- package/dist/es6/text-input/lib/hooks/useTextInputLabel.d.ts +15 -0
- package/dist/es6/text-input/lib/hooks/useTextInputLabel.d.ts.map +1 -0
- package/dist/es6/text-input/lib/hooks/useTextInputLabel.js +10 -0
- package/dist/es6/text-input/lib/hooks/useTextInputModel.d.ts +17 -0
- package/dist/es6/text-input/lib/hooks/useTextInputModel.d.ts.map +1 -0
- package/dist/es6/text-input/lib/hooks/useTextInputModel.js +21 -0
- package/header/README.md +37 -181
- package/header/index.ts +5 -5
- package/header/lib/GlobalHeader.tsx +26 -9
- package/header/lib/Header.tsx +58 -26
- package/header/lib/parts/DubLogoTitle.tsx +26 -9
- package/header/lib/parts/WorkdayLogoTitle.tsx +40 -11
- package/header/lib/parts/index.ts +2 -3
- package/header/lib/shared/themes.tsx +32 -56
- package/header/lib/shared/types.tsx +3 -9
- package/index.ts +2 -0
- package/package.json +7 -5
- package/search-form/LICENSE +52 -0
- package/search-form/README.md +6 -0
- package/search-form/index.ts +2 -0
- package/{header/lib/parts/SearchBar.tsx → search-form/lib/SearchForm.tsx} +30 -31
- package/search-form/lib/themes.ts +54 -0
- package/search-form/package.json +5 -0
- package/text-input/LICENSE +52 -0
- package/text-input/README.md +11 -0
- package/text-input/index.ts +6 -0
- package/text-input/lib/TextInput.tsx +34 -0
- package/text-input/lib/TextInputField.tsx +75 -0
- package/text-input/lib/TextInputHint.tsx +52 -0
- package/text-input/lib/TextInputLabel.tsx +74 -0
- package/text-input/lib/hooks/useTextInputField.tsx +15 -0
- package/text-input/lib/hooks/useTextInputHint.tsx +11 -0
- package/text-input/lib/hooks/useTextInputLabel.tsx +11 -0
- package/text-input/lib/hooks/useTextInputModel.tsx +45 -0
- package/text-input/package.json +5 -0
- package/ts3.5/dist/commonjs/common/lib/theming/index.d.ts +1 -0
- package/ts3.5/dist/commonjs/common/lib/theming/useThemedRing.d.ts +11 -0
- package/ts3.5/dist/commonjs/header/index.d.ts +5 -5
- package/ts3.5/dist/commonjs/header/lib/GlobalHeader.d.ts +11 -2
- package/ts3.5/dist/commonjs/header/lib/Header.d.ts +17 -8
- package/ts3.5/dist/commonjs/header/lib/parts/DubLogoTitle.d.ts +13 -4
- package/ts3.5/dist/commonjs/header/lib/parts/WorkdayLogoTitle.d.ts +14 -5
- package/ts3.5/dist/commonjs/header/lib/parts/index.d.ts +2 -3
- package/ts3.5/dist/commonjs/header/lib/shared/themes.d.ts +28 -19
- package/ts3.5/dist/commonjs/header/lib/shared/types.d.ts +3 -8
- package/ts3.5/dist/commonjs/index.d.ts +2 -0
- package/ts3.5/dist/commonjs/layout/lib/utils/getValidChildren.d.ts +1 -1
- package/ts3.5/dist/commonjs/search-form/index.d.ts +3 -0
- package/ts3.5/dist/commonjs/{header/lib/parts/SearchBar.d.ts → search-form/lib/SearchForm.d.ts} +22 -23
- package/ts3.5/dist/commonjs/search-form/lib/themes.d.ts +21 -0
- package/ts3.5/dist/commonjs/text-input/index.d.ts +7 -0
- package/ts3.5/dist/commonjs/text-input/lib/TextInput.d.ts +21 -0
- package/ts3.5/dist/commonjs/text-input/lib/TextInputField.d.ts +8 -0
- package/ts3.5/dist/commonjs/text-input/lib/TextInputHint.d.ts +13 -0
- package/ts3.5/dist/commonjs/text-input/lib/TextInputLabel.d.ts +17 -0
- package/ts3.5/dist/commonjs/text-input/lib/hooks/useTextInputField.d.ts +19 -0
- package/ts3.5/dist/commonjs/text-input/lib/hooks/useTextInputHint.d.ts +15 -0
- package/ts3.5/dist/commonjs/text-input/lib/hooks/useTextInputLabel.d.ts +15 -0
- package/ts3.5/dist/commonjs/text-input/lib/hooks/useTextInputModel.d.ts +17 -0
- package/ts3.5/dist/es6/common/lib/theming/index.d.ts +1 -0
- package/ts3.5/dist/es6/common/lib/theming/useThemedRing.d.ts +11 -0
- package/ts3.5/dist/es6/header/index.d.ts +5 -5
- package/ts3.5/dist/es6/header/lib/GlobalHeader.d.ts +11 -2
- package/ts3.5/dist/es6/header/lib/Header.d.ts +17 -8
- package/ts3.5/dist/es6/header/lib/parts/DubLogoTitle.d.ts +13 -4
- package/ts3.5/dist/es6/header/lib/parts/WorkdayLogoTitle.d.ts +14 -5
- package/ts3.5/dist/es6/header/lib/parts/index.d.ts +2 -3
- package/ts3.5/dist/es6/header/lib/shared/themes.d.ts +28 -19
- package/ts3.5/dist/es6/header/lib/shared/types.d.ts +3 -8
- package/ts3.5/dist/es6/index.d.ts +2 -0
- package/ts3.5/dist/es6/layout/lib/utils/getValidChildren.d.ts +1 -1
- package/ts3.5/dist/es6/search-form/index.d.ts +3 -0
- package/ts3.5/dist/es6/{header/lib/parts/SearchBar.d.ts → search-form/lib/SearchForm.d.ts} +22 -23
- package/ts3.5/dist/es6/search-form/lib/themes.d.ts +21 -0
- package/ts3.5/dist/es6/text-input/index.d.ts +7 -0
- package/ts3.5/dist/es6/text-input/lib/TextInput.d.ts +21 -0
- package/ts3.5/dist/es6/text-input/lib/TextInputField.d.ts +8 -0
- package/ts3.5/dist/es6/text-input/lib/TextInputHint.d.ts +13 -0
- package/ts3.5/dist/es6/text-input/lib/TextInputLabel.d.ts +17 -0
- package/ts3.5/dist/es6/text-input/lib/hooks/useTextInputField.d.ts +19 -0
- package/ts3.5/dist/es6/text-input/lib/hooks/useTextInputHint.d.ts +15 -0
- package/ts3.5/dist/es6/text-input/lib/hooks/useTextInputLabel.d.ts +15 -0
- package/ts3.5/dist/es6/text-input/lib/hooks/useTextInputModel.d.ts +17 -0
- package/dist/commonjs/header/lib/parts/SearchBar.d.ts.map +0 -1
- package/dist/es6/header/lib/parts/SearchBar.d.ts.map +0 -1
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
13
|
+
var t = {};
|
|
14
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
15
|
+
t[p] = s[p];
|
|
16
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
17
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
18
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
19
|
+
t[p[i]] = s[p[i]];
|
|
20
|
+
}
|
|
21
|
+
return t;
|
|
22
|
+
};
|
|
23
|
+
/** @jsx jsx */
|
|
24
|
+
import { jsx } from '@emotion/core';
|
|
25
|
+
import { borderRadius, inputColors, space, type, } from '@workday/canvas-kit-react/tokens';
|
|
26
|
+
import { createComponent, useModelContext } from '@workday/canvas-kit-react/common';
|
|
27
|
+
import { Box, useThemedRing, useThemeRTL } from '@workday/canvas-kit-labs-react/common';
|
|
28
|
+
import { TextInputModelContext } from './TextInput';
|
|
29
|
+
import { useTextInputField } from './hooks/useTextInputField';
|
|
30
|
+
var baseStyles = __assign(__assign({}, type.levels.subtext.large), { padding: space.xxs, margin: 0, minWidth: '280px', border: "1px solid " + inputColors.border, backgroundColor: inputColors.background, borderRadius: borderRadius.m, display: 'block', height: '40px', transition: '0.2s box-shadow, 0.2s border-color', '&::placeholder': {
|
|
31
|
+
color: inputColors.placeholder,
|
|
32
|
+
}, '&:hover': {
|
|
33
|
+
borderColor: inputColors.hoverBorder,
|
|
34
|
+
}, '&:focus:not([disabled])': {
|
|
35
|
+
outline: 'none',
|
|
36
|
+
}, '&:disabled': {
|
|
37
|
+
backgroundColor: inputColors.disabled.background,
|
|
38
|
+
borderColor: inputColors.disabled.border,
|
|
39
|
+
color: inputColors.disabled.text,
|
|
40
|
+
'&::placeholder': {
|
|
41
|
+
color: inputColors.disabled.text,
|
|
42
|
+
},
|
|
43
|
+
}, '::-ms-clear': {
|
|
44
|
+
display: 'none',
|
|
45
|
+
} });
|
|
46
|
+
export var TextInputField = createComponent('input')({
|
|
47
|
+
displayName: 'TextInput.Field',
|
|
48
|
+
Component: function (_a, ref) {
|
|
49
|
+
var model = _a.model, elemProps = __rest(_a, ["model"]);
|
|
50
|
+
var localModel = useModelContext(TextInputModelContext, model);
|
|
51
|
+
var props = useTextInputField(localModel, elemProps, ref);
|
|
52
|
+
var _b = useThemeRTL(), themeRTL = _b.themeRTL, theme = _b.theme;
|
|
53
|
+
var errorRing = useThemedRing('error');
|
|
54
|
+
var focusStyles = localModel.state.hasError
|
|
55
|
+
? errorRing
|
|
56
|
+
: themeRTL({
|
|
57
|
+
'&:focus:not([disabled])': {
|
|
58
|
+
borderColor: theme.canvas.palette.common.focusOutline,
|
|
59
|
+
boxShadow: "inset 0 0 0 1px " + theme.canvas.palette.common.focusOutline,
|
|
60
|
+
},
|
|
61
|
+
});
|
|
62
|
+
return jsx(Box, __assign({ as: "input", css: [themeRTL(baseStyles), focusStyles] }, props));
|
|
63
|
+
},
|
|
64
|
+
});
|
|
@@ -0,0 +1,13 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
13
|
+
var t = {};
|
|
14
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
15
|
+
t[p] = s[p];
|
|
16
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
17
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
18
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
19
|
+
t[p[i]] = s[p[i]];
|
|
20
|
+
}
|
|
21
|
+
return t;
|
|
22
|
+
};
|
|
23
|
+
/** @jsx jsx */
|
|
24
|
+
import { jsx } from '@emotion/core';
|
|
25
|
+
import { createComponent, useModelContext } from '@workday/canvas-kit-react/common';
|
|
26
|
+
import { space, type } from '@workday/canvas-kit-react/tokens';
|
|
27
|
+
import { Box, useThemeRTL } from '@workday/canvas-kit-labs-react/common';
|
|
28
|
+
import { TextInputModelContext } from './TextInput';
|
|
29
|
+
import { useTextInputHint } from './hooks/useTextInputHint';
|
|
30
|
+
var baseStyles = __assign(__assign({}, type.levels.subtext.medium), { margin: space.xxs + " 0 0", width: '100%' });
|
|
31
|
+
export var TextInputHint = createComponent('p')({
|
|
32
|
+
displayName: 'TextInput.Hint',
|
|
33
|
+
Component: function (_a, ref, Element) {
|
|
34
|
+
var model = _a.model, children = _a.children, elemProps = __rest(_a, ["model", "children"]);
|
|
35
|
+
var localModel = useModelContext(TextInputModelContext, model);
|
|
36
|
+
var props = useTextInputHint(localModel, elemProps, ref);
|
|
37
|
+
var _b = useThemeRTL(), themeRTL = _b.themeRTL, theme = _b.theme;
|
|
38
|
+
if (!children) {
|
|
39
|
+
// If there is no hint text just skip rendering
|
|
40
|
+
return null;
|
|
41
|
+
}
|
|
42
|
+
return (jsx(Box, __assign({ as: Element, css: themeRTL(baseStyles, localModel.state.hasError ? { color: theme.canvas.palette.error.main } : {}) }, props), children));
|
|
43
|
+
},
|
|
44
|
+
});
|
|
@@ -0,0 +1,17 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
13
|
+
var t = {};
|
|
14
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
15
|
+
t[p] = s[p];
|
|
16
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
17
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
18
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
19
|
+
t[p[i]] = s[p[i]];
|
|
20
|
+
}
|
|
21
|
+
return t;
|
|
22
|
+
};
|
|
23
|
+
/** @jsx jsx */
|
|
24
|
+
import { jsx } from '@emotion/core';
|
|
25
|
+
import { accessibleHide, createComponent, useModelContext, } from '@workday/canvas-kit-react/common';
|
|
26
|
+
import { Box, useThemeRTL } from '@workday/canvas-kit-labs-react/common';
|
|
27
|
+
import { type } from '@workday/canvas-kit-react/tokens';
|
|
28
|
+
import { HStack } from '@workday/canvas-kit-labs-react/layout';
|
|
29
|
+
import { TextInputModelContext } from './TextInput';
|
|
30
|
+
import { useTextInputLabel } from './hooks/useTextInputLabel';
|
|
31
|
+
var styles = {
|
|
32
|
+
label: __assign(__assign({}, type.levels.subtext.large), { fontWeight: type.properties.fontWeights.medium, minWidth: '180px' }),
|
|
33
|
+
label_visuallyHidden: __assign({}, accessibleHide),
|
|
34
|
+
asterisk: {
|
|
35
|
+
fontSize: type.properties.fontSizes[16],
|
|
36
|
+
fontWeight: type.properties.fontWeights.regular,
|
|
37
|
+
textDecoration: 'unset',
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
export var TextInputLabel = createComponent('label')({
|
|
41
|
+
displayName: 'TextInput.Label',
|
|
42
|
+
Component: function (_a, ref) {
|
|
43
|
+
var isVisuallyHidden = _a.isVisuallyHidden, model = _a.model, children = _a.children, elemProps = __rest(_a, ["isVisuallyHidden", "model", "children"]);
|
|
44
|
+
var localModel = useModelContext(TextInputModelContext, model);
|
|
45
|
+
var props = useTextInputLabel(localModel, elemProps, ref);
|
|
46
|
+
var _b = useThemeRTL(), themeRTL = _b.themeRTL, theme = _b.theme;
|
|
47
|
+
return (jsx(Box, __assign({ as: "label", css: themeRTL(styles.label, isVisuallyHidden ? styles.label_visuallyHidden : {}) }, props),
|
|
48
|
+
jsx(HStack, { spacing: "xxxs" },
|
|
49
|
+
jsx("span", null, children),
|
|
50
|
+
localModel.state.isRequired && (jsx("span", { css: themeRTL(styles.asterisk, { color: theme.canvas.palette.error.main }), "aria-hidden": "true" }, "*")))));
|
|
51
|
+
},
|
|
52
|
+
});
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/// <reference types="@emotion/core" />
|
|
2
|
+
/**
|
|
3
|
+
* Adds the necessary props to a `Field` component. Used by the TextInput.Field subcomponent.
|
|
4
|
+
*/
|
|
5
|
+
export declare const useTextInputField: <P extends {}, R>(model: import("@workday/canvas-kit-react/common").Model<{
|
|
6
|
+
hasError?: boolean | undefined;
|
|
7
|
+
inputId?: string | undefined;
|
|
8
|
+
hintId?: string | undefined;
|
|
9
|
+
isRequired?: boolean | undefined;
|
|
10
|
+
}, {}>, elemProps?: P | undefined, ref?: ((instance: R | null) => void) | import("react").RefObject<R> | null | undefined) => {
|
|
11
|
+
type: string;
|
|
12
|
+
required: boolean | undefined;
|
|
13
|
+
'aria-invalid': boolean | undefined;
|
|
14
|
+
'aria-describedby': string | undefined;
|
|
15
|
+
id: string | undefined;
|
|
16
|
+
} & P & (R extends HTMLOrSVGElement ? {
|
|
17
|
+
ref: import("react").Ref<R>;
|
|
18
|
+
} : {});
|
|
19
|
+
//# sourceMappingURL=useTextInputField.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useTextInputField.d.ts","sourceRoot":"","sources":["../../../../../text-input/lib/hooks/useTextInputField.tsx"],"names":[],"mappings":";AAGA;;GAEG;AACH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;OAQ5B,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { createHook } from '@workday/canvas-kit-react/common';
|
|
2
|
+
/**
|
|
3
|
+
* Adds the necessary props to a `Field` component. Used by the TextInput.Field subcomponent.
|
|
4
|
+
*/
|
|
5
|
+
export var useTextInputField = createHook(function (_a) {
|
|
6
|
+
var state = _a.state;
|
|
7
|
+
return {
|
|
8
|
+
type: 'text',
|
|
9
|
+
required: state.isRequired ? true : undefined,
|
|
10
|
+
'aria-invalid': state.hasError ? true : undefined,
|
|
11
|
+
'aria-describedby': state.hintId,
|
|
12
|
+
id: state.inputId,
|
|
13
|
+
};
|
|
14
|
+
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/// <reference types="@emotion/core" />
|
|
2
|
+
/**
|
|
3
|
+
* Adds the necessary props to a `Hint` component. Used by the TextInput.Hint subcomponent.
|
|
4
|
+
*/
|
|
5
|
+
export declare const useTextInputHint: <P extends {}, R>(model: import("@workday/canvas-kit-react/common").Model<{
|
|
6
|
+
hasError?: boolean | undefined;
|
|
7
|
+
inputId?: string | undefined;
|
|
8
|
+
hintId?: string | undefined;
|
|
9
|
+
isRequired?: boolean | undefined;
|
|
10
|
+
}, {}>, elemProps?: P | undefined, ref?: ((instance: R | null) => void) | import("react").RefObject<R> | null | undefined) => {
|
|
11
|
+
id: string | undefined;
|
|
12
|
+
} & P & (R extends HTMLOrSVGElement ? {
|
|
13
|
+
ref: import("react").Ref<R>;
|
|
14
|
+
} : {});
|
|
15
|
+
//# sourceMappingURL=useTextInputHint.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useTextInputHint.d.ts","sourceRoot":"","sources":["../../../../../text-input/lib/hooks/useTextInputHint.tsx"],"names":[],"mappings":";AAGA;;GAEG;AACH,eAAO,MAAM,gBAAgB;;;;;;;;;OAI3B,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { createHook } from '@workday/canvas-kit-react/common';
|
|
2
|
+
/**
|
|
3
|
+
* Adds the necessary props to a `Hint` component. Used by the TextInput.Hint subcomponent.
|
|
4
|
+
*/
|
|
5
|
+
export var useTextInputHint = createHook(function (_a) {
|
|
6
|
+
var state = _a.state;
|
|
7
|
+
return {
|
|
8
|
+
id: state.hintId,
|
|
9
|
+
};
|
|
10
|
+
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/// <reference types="@emotion/core" />
|
|
2
|
+
/**
|
|
3
|
+
* Adds the necessary props to a `Label` component. Used by the TextInput.Label subcomponent.
|
|
4
|
+
*/
|
|
5
|
+
export declare const useTextInputLabel: <P extends {}, R>(model: import("@workday/canvas-kit-react/common").Model<{
|
|
6
|
+
hasError?: boolean | undefined;
|
|
7
|
+
inputId?: string | undefined;
|
|
8
|
+
hintId?: string | undefined;
|
|
9
|
+
isRequired?: boolean | undefined;
|
|
10
|
+
}, {}>, elemProps?: P | undefined, ref?: ((instance: R | null) => void) | import("react").RefObject<R> | null | undefined) => {
|
|
11
|
+
htmlFor: string | undefined;
|
|
12
|
+
} & P & (R extends HTMLOrSVGElement ? {
|
|
13
|
+
ref: import("react").Ref<R>;
|
|
14
|
+
} : {});
|
|
15
|
+
//# sourceMappingURL=useTextInputLabel.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useTextInputLabel.d.ts","sourceRoot":"","sources":["../../../../../text-input/lib/hooks/useTextInputLabel.tsx"],"names":[],"mappings":";AAGA;;GAEG;AACH,eAAO,MAAM,iBAAiB;;;;;;;;;OAI5B,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { createHook } from '@workday/canvas-kit-react/common';
|
|
2
|
+
/**
|
|
3
|
+
* Adds the necessary props to a `Label` component. Used by the TextInput.Label subcomponent.
|
|
4
|
+
*/
|
|
5
|
+
export var useTextInputLabel = createHook(function (_a) {
|
|
6
|
+
var state = _a.state;
|
|
7
|
+
return {
|
|
8
|
+
htmlFor: state.inputId,
|
|
9
|
+
};
|
|
10
|
+
});
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Model, ToModelConfig } from '@workday/canvas-kit-react/common';
|
|
2
|
+
declare type TextInputState = {
|
|
3
|
+
hasError?: boolean;
|
|
4
|
+
inputId?: string;
|
|
5
|
+
hintId?: string;
|
|
6
|
+
isRequired?: boolean;
|
|
7
|
+
};
|
|
8
|
+
declare type TextInputEvents = {};
|
|
9
|
+
export declare type TextInputModel = Model<TextInputState, TextInputEvents>;
|
|
10
|
+
declare const textInputEventMap: {
|
|
11
|
+
guards: {};
|
|
12
|
+
callbacks: {};
|
|
13
|
+
};
|
|
14
|
+
export declare type TextInputModelConfig = TextInputState & Partial<ToModelConfig<TextInputState, TextInputEvents, typeof textInputEventMap>>;
|
|
15
|
+
export declare const useTextInputModel: (config?: TextInputModelConfig) => Model<TextInputState, TextInputEvents>;
|
|
16
|
+
export {};
|
|
17
|
+
//# sourceMappingURL=useTextInputModel.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useTextInputModel.d.ts","sourceRoot":"","sources":["../../../../../text-input/lib/hooks/useTextInputModel.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,EACL,aAAa,EAGd,MAAM,kCAAkC,CAAC;AAE1C,aAAK,cAAc,GAAG;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB,CAAC;AAEF,aAAK,eAAe,GAAG,EAAE,CAAC;AAE1B,oBAAY,cAAc,GAAG,KAAK,CAAC,cAAc,EAAE,eAAe,CAAC,CAAC;AAEpE,QAAA,MAAM,iBAAiB;;;CAGrB,CAAC;AAEH,oBAAY,oBAAoB,GAAG,cAAc,GAC/C,OAAO,CAAC,aAAa,CAAC,cAAc,EAAE,eAAe,EAAE,OAAO,iBAAiB,CAAC,CAAC,CAAC;AAEpF,eAAO,MAAM,iBAAiB,2EAiB7B,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { createEventMap, useEventMap, useUniqueId, } from '@workday/canvas-kit-react/common';
|
|
2
|
+
var textInputEventMap = createEventMap()({
|
|
3
|
+
guards: {},
|
|
4
|
+
callbacks: {},
|
|
5
|
+
});
|
|
6
|
+
export var useTextInputModel = function (config) {
|
|
7
|
+
if (config === void 0) { config = {}; }
|
|
8
|
+
var inputId = useUniqueId(config.inputId);
|
|
9
|
+
var hintId = useUniqueId(config.hintId);
|
|
10
|
+
var state = {
|
|
11
|
+
hasError: config.hasError,
|
|
12
|
+
isRequired: config.isRequired,
|
|
13
|
+
inputId: inputId,
|
|
14
|
+
hintId: hintId,
|
|
15
|
+
};
|
|
16
|
+
var events = useEventMap(textInputEventMap, state, config, {});
|
|
17
|
+
return {
|
|
18
|
+
state: state,
|
|
19
|
+
events: events,
|
|
20
|
+
};
|
|
21
|
+
};
|