@workday/canvas-kit-preview-react 9.0.0-alpha.364-next.3 → 9.0.0-alpha.382-next.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/dist/commonjs/color-picker/lib/ColorPicker.js +24 -47
- package/dist/commonjs/color-picker/lib/parts/ColorReset.js +32 -23
- package/dist/commonjs/color-picker/lib/parts/SwatchBook.js +26 -39
- package/dist/commonjs/form-field/lib/FormField.js +10 -33
- package/dist/commonjs/form-field/lib/FormFieldHint.js +8 -31
- package/dist/commonjs/form-field/lib/FormFieldInput.js +6 -17
- package/dist/commonjs/form-field/lib/FormFieldLabel.js +8 -31
- package/dist/commonjs/form-field/lib/hooks/useFormFieldHint.js +4 -5
- package/dist/commonjs/form-field/lib/hooks/useFormFieldInput.js +5 -6
- package/dist/commonjs/form-field/lib/hooks/useFormFieldLabel.js +4 -5
- package/dist/commonjs/form-field/lib/hooks/useFormFieldModel.js +8 -16
- package/dist/commonjs/form-field/lib/hooks/useFormFieldOrientation.js +3 -3
- package/dist/commonjs/menu/lib/Menu.js +96 -129
- package/dist/commonjs/menu/lib/MenuItem.js +94 -109
- package/dist/commonjs/pill/lib/Pill.js +55 -60
- package/dist/commonjs/pill/lib/PillAvatar.js +6 -17
- package/dist/commonjs/pill/lib/PillCount.js +7 -30
- package/dist/commonjs/pill/lib/PillIcon.js +8 -31
- package/dist/commonjs/pill/lib/PillIconButton.js +13 -36
- package/dist/commonjs/pill/lib/PillLabel.js +10 -33
- package/dist/commonjs/pill/lib/usePillModel.js +8 -16
- package/dist/commonjs/segmented-control/lib/SegmentedControl.js +6 -7
- package/dist/commonjs/segmented-control/lib/SegmentedControlItem.js +24 -49
- package/dist/commonjs/segmented-control/lib/SegmentedControlList.js +13 -38
- package/dist/commonjs/segmented-control/lib/hooks/useSegmentedControlItem.js +8 -10
- package/dist/commonjs/segmented-control/lib/hooks/useSegmentedControlModel.js +31 -31
- package/dist/commonjs/select/lib/Select.js +147 -189
- package/dist/commonjs/select/lib/SelectBase.js +106 -101
- package/dist/commonjs/select/lib/SelectMenu.js +53 -84
- package/dist/commonjs/select/lib/SelectOption.js +33 -47
- package/dist/commonjs/select/lib/scrolling.js +6 -7
- package/dist/commonjs/select/lib/utils.js +4 -4
- package/dist/commonjs/side-panel/lib/SidePanel.js +36 -51
- package/dist/commonjs/side-panel/lib/SidePanelToggleButton.js +17 -40
- package/dist/commonjs/side-panel/lib/hooks.js +20 -20
- package/dist/commonjs/status-indicator/lib/StatusIndicator.js +10 -34
- package/dist/commonjs/status-indicator/lib/StatusIndicatorIcon.js +9 -21
- package/dist/commonjs/status-indicator/lib/StatusIndicatorLabel.js +5 -28
- package/dist/commonjs/status-indicator/lib/hooks/useStatusIndicatorModel.js +6 -15
- package/dist/commonjs/text-area/lib/TextArea.js +8 -31
- package/dist/commonjs/text-area/lib/TextAreaField.d.ts.map +1 -1
- package/dist/commonjs/text-area/lib/TextAreaField.js +12 -36
- package/dist/commonjs/text-input/lib/TextInput.js +8 -31
- package/dist/commonjs/text-input/lib/TextInputField.d.ts.map +1 -1
- package/dist/commonjs/text-input/lib/TextInputField.js +12 -24
- package/dist/commonjs/text-input/lib/hooks/useTextInputField.js +3 -3
- package/dist/commonjs/text-input/lib/hooks/useTextInputModel.js +1 -1
- package/dist/es6/color-picker/lib/ColorPicker.js +15 -38
- package/dist/es6/color-picker/lib/parts/ColorReset.js +27 -18
- package/dist/es6/color-picker/lib/parts/SwatchBook.js +21 -34
- package/dist/es6/form-field/lib/FormField.js +4 -27
- package/dist/es6/form-field/lib/FormFieldHint.js +4 -27
- package/dist/es6/form-field/lib/FormFieldInput.js +3 -14
- package/dist/es6/form-field/lib/FormFieldLabel.js +4 -27
- package/dist/es6/form-field/lib/hooks/useFormFieldHint.js +2 -3
- package/dist/es6/form-field/lib/hooks/useFormFieldInput.js +3 -4
- package/dist/es6/form-field/lib/hooks/useFormFieldLabel.js +2 -3
- package/dist/es6/form-field/lib/hooks/useFormFieldModel.js +8 -16
- package/dist/es6/form-field/lib/hooks/useFormFieldOrientation.js +2 -2
- package/dist/es6/menu/lib/Menu.js +91 -125
- package/dist/es6/menu/lib/MenuItem.js +90 -106
- package/dist/es6/pill/lib/Pill.js +45 -50
- package/dist/es6/pill/lib/PillAvatar.js +3 -14
- package/dist/es6/pill/lib/PillCount.js +4 -27
- package/dist/es6/pill/lib/PillIcon.js +3 -26
- package/dist/es6/pill/lib/PillIconButton.js +7 -30
- package/dist/es6/pill/lib/PillLabel.js +5 -28
- package/dist/es6/pill/lib/usePillModel.js +8 -16
- package/dist/es6/segmented-control/lib/SegmentedControl.js +2 -3
- package/dist/es6/segmented-control/lib/SegmentedControlItem.js +17 -42
- package/dist/es6/segmented-control/lib/SegmentedControlList.js +9 -34
- package/dist/es6/segmented-control/lib/hooks/useSegmentedControlItem.js +5 -7
- package/dist/es6/segmented-control/lib/hooks/useSegmentedControlModel.js +29 -29
- package/dist/es6/select/lib/Select.js +144 -186
- package/dist/es6/select/lib/SelectBase.js +99 -94
- package/dist/es6/select/lib/SelectMenu.js +49 -80
- package/dist/es6/select/lib/SelectOption.js +30 -44
- package/dist/es6/select/lib/scrolling.js +6 -7
- package/dist/es6/select/lib/utils.js +4 -4
- package/dist/es6/side-panel/lib/SidePanel.js +31 -46
- package/dist/es6/side-panel/lib/SidePanelToggleButton.js +10 -33
- package/dist/es6/side-panel/lib/hooks.js +19 -19
- package/dist/es6/status-indicator/lib/StatusIndicator.js +5 -29
- package/dist/es6/status-indicator/lib/StatusIndicatorIcon.js +6 -18
- package/dist/es6/status-indicator/lib/StatusIndicatorLabel.js +3 -26
- package/dist/es6/status-indicator/lib/hooks/useStatusIndicatorModel.js +6 -15
- package/dist/es6/text-area/lib/TextArea.js +4 -27
- package/dist/es6/text-area/lib/TextAreaField.d.ts.map +1 -1
- package/dist/es6/text-area/lib/TextAreaField.js +9 -33
- package/dist/es6/text-input/lib/TextInput.js +4 -27
- package/dist/es6/text-input/lib/TextInputField.d.ts.map +1 -1
- package/dist/es6/text-input/lib/TextInputField.js +9 -21
- package/dist/es6/text-input/lib/hooks/useTextInputField.js +1 -1
- package/dist/es6/text-input/lib/hooks/useTextInputModel.js +1 -1
- package/package.json +3 -4
- package/text-area/lib/TextAreaField.tsx +6 -2
- package/text-input/lib/TextInputField.tsx +6 -2
|
@@ -1,38 +1,15 @@
|
|
|
1
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
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
25
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
26
4
|
};
|
|
27
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
28
6
|
exports.StatusIndicatorLabel = void 0;
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const common_1 = require("@workday/canvas-kit-react/common");
|
|
9
|
+
const text_1 = require("@workday/canvas-kit-react/text");
|
|
32
10
|
exports.StatusIndicatorLabel = common_1.createComponent('span')({
|
|
33
11
|
displayName: 'StatusIndicator.Label',
|
|
34
|
-
Component:
|
|
35
|
-
|
|
36
|
-
return (react_1.default.createElement(text_1.Text, __assign({ whiteSpace: "nowrap", overflow: "hidden", textOverflow: "ellipsis", typeLevel: "subtext.large", fontWeight: "bold", textTransform: "capitalize", ref: ref, color: "inherit", as: Element }, elemProps), children));
|
|
12
|
+
Component: ({ children, ...elemProps }, ref, Element) => {
|
|
13
|
+
return (react_1.default.createElement(text_1.Text, Object.assign({ whiteSpace: "nowrap", overflow: "hidden", textOverflow: "ellipsis", typeLevel: "subtext.large", fontWeight: "bold", textTransform: "capitalize", ref: ref, color: "inherit", as: Element }, elemProps), children));
|
|
37
14
|
},
|
|
38
15
|
});
|
|
@@ -1,18 +1,7 @@
|
|
|
1
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
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
3
|
exports.useStatusIndicatorModel = void 0;
|
|
15
|
-
|
|
4
|
+
const common_1 = require("@workday/canvas-kit-react/common");
|
|
16
5
|
exports.useStatusIndicatorModel = common_1.createModelHook({
|
|
17
6
|
defaultConfig: {
|
|
18
7
|
/**
|
|
@@ -28,7 +17,9 @@ exports.useStatusIndicatorModel = common_1.createModelHook({
|
|
|
28
17
|
*/
|
|
29
18
|
variant: 'gray',
|
|
30
19
|
},
|
|
31
|
-
})(
|
|
32
|
-
|
|
33
|
-
|
|
20
|
+
})(config => {
|
|
21
|
+
const state = {
|
|
22
|
+
...config,
|
|
23
|
+
};
|
|
24
|
+
return { state, events: {} };
|
|
34
25
|
});
|
|
@@ -1,36 +1,14 @@
|
|
|
1
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
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
25
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
26
4
|
};
|
|
27
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
28
6
|
exports.TextArea = void 0;
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const common_1 = require("@workday/canvas-kit-react/common");
|
|
9
|
+
const form_field_1 = require("@workday/canvas-kit-preview-react/form-field");
|
|
10
|
+
const layout_1 = require("@workday/canvas-kit-react/layout");
|
|
11
|
+
const TextAreaField_1 = require("./TextAreaField");
|
|
34
12
|
exports.TextArea = common_1.createContainer('div')({
|
|
35
13
|
displayName: 'TextArea',
|
|
36
14
|
modelHook: form_field_1.useFormFieldModel,
|
|
@@ -39,8 +17,7 @@ exports.TextArea = common_1.createContainer('div')({
|
|
|
39
17
|
Label: form_field_1.FormField.Label,
|
|
40
18
|
Hint: form_field_1.FormField.Hint,
|
|
41
19
|
},
|
|
42
|
-
})(
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
return (react_1.default.createElement(layout_1.Flex, __assign({ as: Element }, layoutProps, elemProps), children));
|
|
20
|
+
})(({ children, orientation, ...elemProps }, Element) => {
|
|
21
|
+
const layoutProps = form_field_1.useFormFieldOrientation(orientation);
|
|
22
|
+
return (react_1.default.createElement(layout_1.Flex, Object.assign({ as: Element }, layoutProps, elemProps), children));
|
|
46
23
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextAreaField.d.ts","sourceRoot":"","sources":["../../../../text-area/lib/TextAreaField.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"TextAreaField.d.ts","sourceRoot":"","sources":["../../../../text-area/lib/TextAreaField.tsx"],"names":[],"mappings":"AA6CA,eAAO,MAAM,aAAa;;;;;;;;;;;;;;EAgCxB,CAAC"}
|
|
@@ -1,37 +1,14 @@
|
|
|
1
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
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
3
|
exports.TextAreaField = void 0;
|
|
26
4
|
/** @jsxRuntime classic */
|
|
27
5
|
/** @jsx jsx */
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
var baseStyles = {
|
|
6
|
+
const react_1 = require("@emotion/react");
|
|
7
|
+
const tokens_1 = require("@workday/canvas-kit-react/tokens");
|
|
8
|
+
const common_1 = require("@workday/canvas-kit-react/common");
|
|
9
|
+
const form_field_1 = require("@workday/canvas-kit-preview-react/form-field");
|
|
10
|
+
const text_input_1 = require("@workday/canvas-kit-preview-react/text-input");
|
|
11
|
+
const baseStyles = {
|
|
35
12
|
transition: '0.2s box-shadow, 0.2s border-color',
|
|
36
13
|
resize: 'both',
|
|
37
14
|
'&::webkit-resizer': {
|
|
@@ -58,17 +35,16 @@ var baseStyles = {
|
|
|
58
35
|
exports.TextAreaField = common_1.createSubcomponent('textarea')({
|
|
59
36
|
displayName: 'TextArea.Field',
|
|
60
37
|
modelHook: text_input_1.useTextInputModel,
|
|
61
|
-
})(
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
var focusStyles = model.state.hasError
|
|
38
|
+
})(({ ...elemProps }, Element, model) => {
|
|
39
|
+
const theme = common_1.useTheme();
|
|
40
|
+
const errorRing = common_1.useThemedRing('error');
|
|
41
|
+
const focusStyles = model.state.hasError
|
|
66
42
|
? errorRing
|
|
67
43
|
: {
|
|
68
44
|
'&:focus:not([disabled])': {
|
|
69
45
|
borderColor: theme.canvas.palette.common.focusOutline,
|
|
70
|
-
boxShadow:
|
|
46
|
+
boxShadow: `inset 0 0 0 1px ${theme.canvas.palette.common.focusOutline}`,
|
|
71
47
|
},
|
|
72
48
|
};
|
|
73
|
-
return (react_1.jsx(form_field_1.FormField.Input,
|
|
49
|
+
return (react_1.jsx(form_field_1.FormField.Input, Object.assign({ as: Element }, tokens_1.type.levels.subtext.large, { css: [baseStyles, focusStyles] }, elemProps, { border: `1px solid ${tokens_1.inputColors.border}`, display: "block", backgroundColor: tokens_1.inputColors.background, borderRadius: tokens_1.borderRadius.m, minHeight: 64, minWidth: 280, padding: tokens_1.spaceNumbers.xxs, margin: 0 })));
|
|
74
50
|
});
|
|
@@ -1,36 +1,14 @@
|
|
|
1
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
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
25
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
26
4
|
};
|
|
27
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
28
6
|
exports.TextInput = void 0;
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const common_1 = require("@workday/canvas-kit-react/common");
|
|
9
|
+
const form_field_1 = require("@workday/canvas-kit-preview-react/form-field");
|
|
10
|
+
const layout_1 = require("@workday/canvas-kit-react/layout");
|
|
11
|
+
const TextInputField_1 = require("./TextInputField");
|
|
34
12
|
exports.TextInput = common_1.createContainer('div')({
|
|
35
13
|
displayName: 'TextInput',
|
|
36
14
|
modelHook: form_field_1.useFormFieldModel,
|
|
@@ -39,8 +17,7 @@ exports.TextInput = common_1.createContainer('div')({
|
|
|
39
17
|
Label: form_field_1.FormField.Label,
|
|
40
18
|
Hint: form_field_1.FormField.Hint,
|
|
41
19
|
},
|
|
42
|
-
})(
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
return (react_1.default.createElement(layout_1.Flex, __assign({ as: Element }, layoutProps, elemProps), children));
|
|
20
|
+
})(({ children, orientation, ...elemProps }, Element) => {
|
|
21
|
+
const layoutProps = form_field_1.useFormFieldOrientation(orientation);
|
|
22
|
+
return (react_1.default.createElement(layout_1.Flex, Object.assign({ as: Element }, layoutProps, elemProps), children));
|
|
46
23
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextInputField.d.ts","sourceRoot":"","sources":["../../../../text-input/lib/TextInputField.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"TextInputField.d.ts","sourceRoot":"","sources":["../../../../text-input/lib/TextInputField.tsx"],"names":[],"mappings":"AA6CA,eAAO,MAAM,cAAc;;;;;;;;;;;;;;EAiCzB,CAAC"}
|
|
@@ -1,26 +1,14 @@
|
|
|
1
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
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
3
|
exports.TextInputField = void 0;
|
|
15
4
|
/** @jsxRuntime classic */
|
|
16
5
|
/** @jsx jsx */
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
var baseStyles = {
|
|
6
|
+
const react_1 = require("@emotion/react");
|
|
7
|
+
const tokens_1 = require("@workday/canvas-kit-react/tokens");
|
|
8
|
+
const common_1 = require("@workday/canvas-kit-react/common");
|
|
9
|
+
const form_field_1 = require("@workday/canvas-kit-preview-react/form-field");
|
|
10
|
+
const hooks_1 = require("./hooks");
|
|
11
|
+
const baseStyles = {
|
|
24
12
|
transition: '0.2s box-shadow, 0.2s border-color',
|
|
25
13
|
'&::placeholder': {
|
|
26
14
|
color: tokens_1.inputColors.placeholder,
|
|
@@ -47,16 +35,16 @@ exports.TextInputField = common_1.createSubcomponent('input')({
|
|
|
47
35
|
displayName: 'TextInput.Field',
|
|
48
36
|
modelHook: form_field_1.useFormFieldModel,
|
|
49
37
|
elemPropsHook: hooks_1.useTextInputField,
|
|
50
|
-
})(
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
38
|
+
})((elemProps, Element, model) => {
|
|
39
|
+
const theme = common_1.useTheme();
|
|
40
|
+
const errorRing = common_1.useThemedRing('error');
|
|
41
|
+
const focusStyles = model.state.hasError
|
|
54
42
|
? errorRing
|
|
55
43
|
: {
|
|
56
44
|
'&:focus:not([disabled])': {
|
|
57
45
|
borderColor: theme.canvas.palette.common.focusOutline,
|
|
58
|
-
boxShadow:
|
|
46
|
+
boxShadow: `inset 0 0 0 1px ${theme.canvas.palette.common.focusOutline}`,
|
|
59
47
|
},
|
|
60
48
|
};
|
|
61
|
-
return (react_1.jsx(form_field_1.FormField.Input,
|
|
49
|
+
return (react_1.jsx(form_field_1.FormField.Input, Object.assign({ as: "input" }, tokens_1.type.levels.subtext.large, { css: [baseStyles, focusStyles], padding: tokens_1.space.xxs, margin: 0, display: "block", height: "40px", minWidth: "280px", border: `1px solid ${tokens_1.inputColors.border}`, backgroundColor: tokens_1.inputColors.background, borderRadius: tokens_1.borderRadius.m }, elemProps)));
|
|
62
50
|
});
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useTextInputField = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
const common_1 = require("@workday/canvas-kit-react/common");
|
|
5
|
+
const useTextInputModel_1 = require("./useTextInputModel");
|
|
6
6
|
/**
|
|
7
7
|
* Adds the necessary props to a `Field` component. Used by the TextInput.Field subcomponent.
|
|
8
8
|
*/
|
|
9
|
-
exports.useTextInputField = common_1.createElemPropsHook(useTextInputModel_1.useTextInputModel)(
|
|
9
|
+
exports.useTextInputField = common_1.createElemPropsHook(useTextInputModel_1.useTextInputModel)(() => {
|
|
10
10
|
return {
|
|
11
11
|
type: 'text',
|
|
12
12
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useTextInputModel = void 0;
|
|
4
|
-
|
|
4
|
+
const form_field_1 = require("@workday/canvas-kit-preview-react/form-field");
|
|
5
5
|
/** @deprecated Please use `useFormFieldModel` instead */
|
|
6
6
|
exports.useTextInputModel = form_field_1.useFormFieldModel;
|
|
@@ -1,25 +1,3 @@
|
|
|
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
1
|
import { colors, space } from '@workday/canvas-kit-react/tokens';
|
|
24
2
|
import { checkIcon } from '@workday/canvas-system-icons-web';
|
|
25
3
|
import { ColorInput } from '@workday/canvas-kit-react/color-picker';
|
|
@@ -29,7 +7,7 @@ import { FormField } from '@workday/canvas-kit-react/form-field';
|
|
|
29
7
|
import styled from '@emotion/styled';
|
|
30
8
|
import { ResetButton } from './parts/ColorReset';
|
|
31
9
|
import { SwatchBook } from './parts/SwatchBook';
|
|
32
|
-
|
|
10
|
+
const defaultColorSet = [
|
|
33
11
|
colors.blueberry600,
|
|
34
12
|
colors.grapeSoda600,
|
|
35
13
|
colors.pomegranate600,
|
|
@@ -87,51 +65,50 @@ var defaultColorSet = [
|
|
|
87
65
|
colors.frenchVanilla200,
|
|
88
66
|
colors.frenchVanilla100,
|
|
89
67
|
];
|
|
90
|
-
|
|
68
|
+
const ColorPickerContainer = styled('div')({
|
|
91
69
|
width: 216,
|
|
92
70
|
});
|
|
93
|
-
|
|
71
|
+
const ColorInputWrapper = styled('form')({
|
|
94
72
|
width: '100%',
|
|
95
73
|
marginTop: space.s,
|
|
96
74
|
display: 'flex',
|
|
97
75
|
flexDirection: 'row',
|
|
98
76
|
justifyContent: 'space-between',
|
|
99
77
|
});
|
|
100
|
-
|
|
78
|
+
const ColorInputAndLabel = styled(FormField)({
|
|
101
79
|
display: 'flex',
|
|
102
80
|
flexDirection: 'column',
|
|
103
81
|
margin: 0,
|
|
104
82
|
});
|
|
105
|
-
|
|
83
|
+
const CheckButton = styled(SecondaryButton)({
|
|
106
84
|
alignSelf: 'flex-end',
|
|
107
85
|
});
|
|
108
|
-
|
|
86
|
+
const HexColorInput = styled(ColorInput)({
|
|
109
87
|
width: '168px',
|
|
110
88
|
});
|
|
111
|
-
|
|
89
|
+
const isCustomColor = (colors, hexCode) => {
|
|
112
90
|
if (!hexCode) {
|
|
113
91
|
return false;
|
|
114
92
|
}
|
|
115
|
-
|
|
93
|
+
const lowercaseHex = hexCode.toLowerCase();
|
|
116
94
|
return !colors.includes(lowercaseHex);
|
|
117
95
|
};
|
|
118
|
-
export
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
var onCustomHexChange = function (event) {
|
|
96
|
+
export const ColorPicker = ({ colorSet = defaultColorSet, customHexInputLabel = 'Custom Hex Color', submitLabel = 'Submit', onColorChange, onColorReset, onSubmitClick, resetLabel = 'Reset', resetColor, value = '', showCustomHexInput = false, ...elemProps }) => {
|
|
97
|
+
const [validHexValue, setValidHexValue] = React.useState('');
|
|
98
|
+
const [customHexValue, setCustomHexValue] = React.useState(isCustomColor(colorSet, value) ? value : '');
|
|
99
|
+
const onCustomHexChange = (event) => {
|
|
123
100
|
setCustomHexValue(event.target.value);
|
|
124
101
|
setValidHexValue('');
|
|
125
102
|
};
|
|
126
|
-
|
|
127
|
-
|
|
103
|
+
const onValidCustomHexChange = (validHexValue) => setValidHexValue(validHexValue);
|
|
104
|
+
const onSubmit = (event) => {
|
|
128
105
|
if (onSubmitClick) {
|
|
129
106
|
onSubmitClick(event);
|
|
130
107
|
}
|
|
131
108
|
onColorChange(validHexValue);
|
|
132
109
|
event.preventDefault(); // don't submit the form - default action is to reload the page
|
|
133
110
|
};
|
|
134
|
-
return (React.createElement(ColorPickerContainer,
|
|
111
|
+
return (React.createElement(ColorPickerContainer, Object.assign({}, elemProps),
|
|
135
112
|
onColorReset && resetColor && (React.createElement(ResetButton, { onClick: onColorReset, resetColor: resetColor, label: resetLabel })),
|
|
136
113
|
React.createElement(SwatchBook, { colors: colorSet, onSelect: onColorChange, value: value }),
|
|
137
114
|
showCustomHexInput && (React.createElement(ColorInputWrapper, { onSubmit: onSubmit },
|
|
@@ -1,30 +1,39 @@
|
|
|
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
1
|
import * as React from 'react';
|
|
13
2
|
import styled from '@emotion/styled';
|
|
14
3
|
import { colors, space, type } from '@workday/canvas-kit-react/tokens';
|
|
15
4
|
import { focusRing, hideMouseFocus } from '@workday/canvas-kit-react/common';
|
|
16
5
|
import { ColorSwatch } from '@workday/canvas-kit-react/color-picker';
|
|
17
|
-
|
|
6
|
+
const Label = styled('div')({
|
|
18
7
|
marginLeft: space.xxs,
|
|
19
8
|
});
|
|
20
|
-
|
|
9
|
+
const Container = styled('button')({
|
|
10
|
+
display: 'flex',
|
|
11
|
+
alignItems: 'center',
|
|
12
|
+
justifyContent: 'flex-start',
|
|
13
|
+
width: `calc(100% + ${space.l})`,
|
|
14
|
+
height: space.l,
|
|
15
|
+
margin: `-${space.xxs} -${space.s} ${space.xxs}`,
|
|
16
|
+
padding: `0px ${space.s}`,
|
|
17
|
+
...type.levels.subtext.medium,
|
|
18
|
+
whiteSpace: 'nowrap',
|
|
19
|
+
border: 'none',
|
|
20
|
+
outline: 'none',
|
|
21
|
+
background: 'none',
|
|
22
|
+
cursor: 'pointer',
|
|
23
|
+
transition: 'color 120ms ease, background-color 120ms ease',
|
|
24
|
+
'&:hover': {
|
|
21
25
|
backgroundColor: colors.soap300,
|
|
22
|
-
},
|
|
26
|
+
},
|
|
27
|
+
'&:active': {
|
|
23
28
|
backgroundColor: colors.soap400,
|
|
24
|
-
},
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
29
|
+
},
|
|
30
|
+
'&:focus': {
|
|
31
|
+
...focusRing(),
|
|
32
|
+
},
|
|
33
|
+
...hideMouseFocus,
|
|
34
|
+
});
|
|
35
|
+
export const ResetButton = ({ onClick, resetColor, label }) => {
|
|
36
|
+
const handleResetColor = () => onClick(resetColor);
|
|
28
37
|
return (React.createElement(Container, { onClick: handleResetColor },
|
|
29
38
|
React.createElement(ColorSwatch, { color: resetColor }),
|
|
30
39
|
React.createElement(Label, null, label)));
|
|
@@ -1,35 +1,27 @@
|
|
|
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
1
|
import * as React from 'react';
|
|
13
2
|
import styled from '@emotion/styled';
|
|
14
3
|
import { borderRadius, colors, space } from '@workday/canvas-kit-react/tokens';
|
|
15
4
|
import { focusRing, mouseFocusBehavior } from '@workday/canvas-kit-react/common';
|
|
16
5
|
import { ColorSwatch } from '@workday/canvas-kit-react/color-picker';
|
|
17
|
-
|
|
18
|
-
|
|
6
|
+
const accessibilityBorder = `${colors.frenchVanilla100} 0px 0px 0px 2px, ${colors.licorice200} 0px 0px 0px 3px`;
|
|
7
|
+
const SwatchContainer = styled('div')({
|
|
19
8
|
display: 'flex',
|
|
20
9
|
width: 20,
|
|
21
10
|
height: 20,
|
|
22
11
|
cursor: 'pointer',
|
|
23
12
|
borderRadius: borderRadius.s,
|
|
24
13
|
transition: 'box-shadow 120ms ease',
|
|
25
|
-
margin:
|
|
14
|
+
margin: `0px ${space.xxs} ${space.xxs} 0px`,
|
|
26
15
|
'&:hover': {
|
|
27
16
|
boxShadow: accessibilityBorder,
|
|
28
17
|
},
|
|
29
|
-
'&:focus':
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
18
|
+
'&:focus': {
|
|
19
|
+
outline: 'none',
|
|
20
|
+
...focusRing({ separation: 2 }),
|
|
21
|
+
},
|
|
22
|
+
}, ({ isSelected }) => ({
|
|
23
|
+
boxShadow: isSelected ? accessibilityBorder : undefined,
|
|
24
|
+
...mouseFocusBehavior({
|
|
33
25
|
'&:focus': {
|
|
34
26
|
animation: 'none',
|
|
35
27
|
boxShadow: 'none',
|
|
@@ -40,22 +32,17 @@ var SwatchContainer = styled('div')({
|
|
|
40
32
|
'&': {
|
|
41
33
|
boxShadow: isSelected ? accessibilityBorder : undefined,
|
|
42
34
|
},
|
|
43
|
-
})
|
|
44
|
-
});
|
|
45
|
-
|
|
35
|
+
}),
|
|
36
|
+
}));
|
|
37
|
+
const Container = styled('div')({
|
|
46
38
|
display: 'flex',
|
|
47
39
|
flexWrap: 'wrap',
|
|
48
|
-
margin:
|
|
40
|
+
margin: `0px -${space.xxs} -${space.xxs} 0px`,
|
|
49
41
|
});
|
|
50
|
-
export
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
};
|
|
58
|
-
return (React.createElement(SwatchContainer, { key: index + '-' + color, onClick: handleClick, onKeyDown: handleKeyDown, tabIndex: 0, isSelected: isSelected },
|
|
59
|
-
React.createElement(ColorSwatch, { color: color, showCheck: isSelected })));
|
|
60
|
-
})));
|
|
61
|
-
};
|
|
42
|
+
export const SwatchBook = ({ colors, value, onSelect }) => (React.createElement(Container, null, colors.map((color, index) => {
|
|
43
|
+
const isSelected = value ? color.toLowerCase() === value.toLowerCase() : false;
|
|
44
|
+
const handleClick = () => onSelect(color);
|
|
45
|
+
const handleKeyDown = (event) => (event.key === 'Enter' || event.key === ' ') && onSelect(color);
|
|
46
|
+
return (React.createElement(SwatchContainer, { key: index + '-' + color, onClick: handleClick, onKeyDown: handleKeyDown, tabIndex: 0, isSelected: isSelected },
|
|
47
|
+
React.createElement(ColorSwatch, { color: color, showCheck: isSelected })));
|
|
48
|
+
})));
|
|
@@ -1,25 +1,3 @@
|
|
|
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
1
|
import React from 'react';
|
|
24
2
|
import { createContainer } from '@workday/canvas-kit-react/common';
|
|
25
3
|
import { Flex } from '@workday/canvas-kit-react/layout';
|
|
@@ -27,7 +5,7 @@ import { useFormFieldModel, useFormFieldOrientation } from './hooks';
|
|
|
27
5
|
import { FormFieldInput } from './FormFieldInput';
|
|
28
6
|
import { FormFieldLabel } from './FormFieldLabel';
|
|
29
7
|
import { FormFieldHint } from './FormFieldHint';
|
|
30
|
-
export
|
|
8
|
+
export const FormField = createContainer('div')({
|
|
31
9
|
displayName: 'FormField',
|
|
32
10
|
modelHook: useFormFieldModel,
|
|
33
11
|
subComponents: {
|
|
@@ -35,8 +13,7 @@ export var FormField = createContainer('div')({
|
|
|
35
13
|
Label: FormFieldLabel,
|
|
36
14
|
Hint: FormFieldHint,
|
|
37
15
|
},
|
|
38
|
-
})(
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
return (React.createElement(Flex, __assign({ as: Element }, layoutProps, elemProps), children));
|
|
16
|
+
})(({ children, orientation, ...elemProps }, Element) => {
|
|
17
|
+
const layoutProps = useFormFieldOrientation(orientation);
|
|
18
|
+
return (React.createElement(Flex, Object.assign({ as: Element }, layoutProps, elemProps), children));
|
|
42
19
|
});
|