@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.
Files changed (97) hide show
  1. package/dist/commonjs/color-picker/lib/ColorPicker.js +24 -47
  2. package/dist/commonjs/color-picker/lib/parts/ColorReset.js +32 -23
  3. package/dist/commonjs/color-picker/lib/parts/SwatchBook.js +26 -39
  4. package/dist/commonjs/form-field/lib/FormField.js +10 -33
  5. package/dist/commonjs/form-field/lib/FormFieldHint.js +8 -31
  6. package/dist/commonjs/form-field/lib/FormFieldInput.js +6 -17
  7. package/dist/commonjs/form-field/lib/FormFieldLabel.js +8 -31
  8. package/dist/commonjs/form-field/lib/hooks/useFormFieldHint.js +4 -5
  9. package/dist/commonjs/form-field/lib/hooks/useFormFieldInput.js +5 -6
  10. package/dist/commonjs/form-field/lib/hooks/useFormFieldLabel.js +4 -5
  11. package/dist/commonjs/form-field/lib/hooks/useFormFieldModel.js +8 -16
  12. package/dist/commonjs/form-field/lib/hooks/useFormFieldOrientation.js +3 -3
  13. package/dist/commonjs/menu/lib/Menu.js +96 -129
  14. package/dist/commonjs/menu/lib/MenuItem.js +94 -109
  15. package/dist/commonjs/pill/lib/Pill.js +55 -60
  16. package/dist/commonjs/pill/lib/PillAvatar.js +6 -17
  17. package/dist/commonjs/pill/lib/PillCount.js +7 -30
  18. package/dist/commonjs/pill/lib/PillIcon.js +8 -31
  19. package/dist/commonjs/pill/lib/PillIconButton.js +13 -36
  20. package/dist/commonjs/pill/lib/PillLabel.js +10 -33
  21. package/dist/commonjs/pill/lib/usePillModel.js +8 -16
  22. package/dist/commonjs/segmented-control/lib/SegmentedControl.js +6 -7
  23. package/dist/commonjs/segmented-control/lib/SegmentedControlItem.js +24 -49
  24. package/dist/commonjs/segmented-control/lib/SegmentedControlList.js +13 -38
  25. package/dist/commonjs/segmented-control/lib/hooks/useSegmentedControlItem.js +8 -10
  26. package/dist/commonjs/segmented-control/lib/hooks/useSegmentedControlModel.js +31 -31
  27. package/dist/commonjs/select/lib/Select.js +147 -189
  28. package/dist/commonjs/select/lib/SelectBase.js +106 -101
  29. package/dist/commonjs/select/lib/SelectMenu.js +53 -84
  30. package/dist/commonjs/select/lib/SelectOption.js +33 -47
  31. package/dist/commonjs/select/lib/scrolling.js +6 -7
  32. package/dist/commonjs/select/lib/utils.js +4 -4
  33. package/dist/commonjs/side-panel/lib/SidePanel.js +36 -51
  34. package/dist/commonjs/side-panel/lib/SidePanelToggleButton.js +17 -40
  35. package/dist/commonjs/side-panel/lib/hooks.js +20 -20
  36. package/dist/commonjs/status-indicator/lib/StatusIndicator.js +10 -34
  37. package/dist/commonjs/status-indicator/lib/StatusIndicatorIcon.js +9 -21
  38. package/dist/commonjs/status-indicator/lib/StatusIndicatorLabel.js +5 -28
  39. package/dist/commonjs/status-indicator/lib/hooks/useStatusIndicatorModel.js +6 -15
  40. package/dist/commonjs/text-area/lib/TextArea.js +8 -31
  41. package/dist/commonjs/text-area/lib/TextAreaField.d.ts.map +1 -1
  42. package/dist/commonjs/text-area/lib/TextAreaField.js +12 -36
  43. package/dist/commonjs/text-input/lib/TextInput.js +8 -31
  44. package/dist/commonjs/text-input/lib/TextInputField.d.ts.map +1 -1
  45. package/dist/commonjs/text-input/lib/TextInputField.js +12 -24
  46. package/dist/commonjs/text-input/lib/hooks/useTextInputField.js +3 -3
  47. package/dist/commonjs/text-input/lib/hooks/useTextInputModel.js +1 -1
  48. package/dist/es6/color-picker/lib/ColorPicker.js +15 -38
  49. package/dist/es6/color-picker/lib/parts/ColorReset.js +27 -18
  50. package/dist/es6/color-picker/lib/parts/SwatchBook.js +21 -34
  51. package/dist/es6/form-field/lib/FormField.js +4 -27
  52. package/dist/es6/form-field/lib/FormFieldHint.js +4 -27
  53. package/dist/es6/form-field/lib/FormFieldInput.js +3 -14
  54. package/dist/es6/form-field/lib/FormFieldLabel.js +4 -27
  55. package/dist/es6/form-field/lib/hooks/useFormFieldHint.js +2 -3
  56. package/dist/es6/form-field/lib/hooks/useFormFieldInput.js +3 -4
  57. package/dist/es6/form-field/lib/hooks/useFormFieldLabel.js +2 -3
  58. package/dist/es6/form-field/lib/hooks/useFormFieldModel.js +8 -16
  59. package/dist/es6/form-field/lib/hooks/useFormFieldOrientation.js +2 -2
  60. package/dist/es6/menu/lib/Menu.js +91 -125
  61. package/dist/es6/menu/lib/MenuItem.js +90 -106
  62. package/dist/es6/pill/lib/Pill.js +45 -50
  63. package/dist/es6/pill/lib/PillAvatar.js +3 -14
  64. package/dist/es6/pill/lib/PillCount.js +4 -27
  65. package/dist/es6/pill/lib/PillIcon.js +3 -26
  66. package/dist/es6/pill/lib/PillIconButton.js +7 -30
  67. package/dist/es6/pill/lib/PillLabel.js +5 -28
  68. package/dist/es6/pill/lib/usePillModel.js +8 -16
  69. package/dist/es6/segmented-control/lib/SegmentedControl.js +2 -3
  70. package/dist/es6/segmented-control/lib/SegmentedControlItem.js +17 -42
  71. package/dist/es6/segmented-control/lib/SegmentedControlList.js +9 -34
  72. package/dist/es6/segmented-control/lib/hooks/useSegmentedControlItem.js +5 -7
  73. package/dist/es6/segmented-control/lib/hooks/useSegmentedControlModel.js +29 -29
  74. package/dist/es6/select/lib/Select.js +144 -186
  75. package/dist/es6/select/lib/SelectBase.js +99 -94
  76. package/dist/es6/select/lib/SelectMenu.js +49 -80
  77. package/dist/es6/select/lib/SelectOption.js +30 -44
  78. package/dist/es6/select/lib/scrolling.js +6 -7
  79. package/dist/es6/select/lib/utils.js +4 -4
  80. package/dist/es6/side-panel/lib/SidePanel.js +31 -46
  81. package/dist/es6/side-panel/lib/SidePanelToggleButton.js +10 -33
  82. package/dist/es6/side-panel/lib/hooks.js +19 -19
  83. package/dist/es6/status-indicator/lib/StatusIndicator.js +5 -29
  84. package/dist/es6/status-indicator/lib/StatusIndicatorIcon.js +6 -18
  85. package/dist/es6/status-indicator/lib/StatusIndicatorLabel.js +3 -26
  86. package/dist/es6/status-indicator/lib/hooks/useStatusIndicatorModel.js +6 -15
  87. package/dist/es6/text-area/lib/TextArea.js +4 -27
  88. package/dist/es6/text-area/lib/TextAreaField.d.ts.map +1 -1
  89. package/dist/es6/text-area/lib/TextAreaField.js +9 -33
  90. package/dist/es6/text-input/lib/TextInput.js +4 -27
  91. package/dist/es6/text-input/lib/TextInputField.d.ts.map +1 -1
  92. package/dist/es6/text-input/lib/TextInputField.js +9 -21
  93. package/dist/es6/text-input/lib/hooks/useTextInputField.js +1 -1
  94. package/dist/es6/text-input/lib/hooks/useTextInputModel.js +1 -1
  95. package/package.json +3 -4
  96. package/text-area/lib/TextAreaField.tsx +6 -2
  97. 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
- var react_1 = __importDefault(require("react"));
30
- var common_1 = require("@workday/canvas-kit-react/common");
31
- var text_1 = require("@workday/canvas-kit-react/text");
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: function (_a, ref, Element) {
35
- var children = _a.children, elemProps = __rest(_a, ["children"]);
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
- var common_1 = require("@workday/canvas-kit-react/common");
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
- })(function (config) {
32
- var state = __assign({}, config);
33
- return { state: state, events: {} };
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
- var react_1 = __importDefault(require("react"));
30
- var common_1 = require("@workday/canvas-kit-react/common");
31
- var form_field_1 = require("@workday/canvas-kit-preview-react/form-field");
32
- var layout_1 = require("@workday/canvas-kit-react/layout");
33
- var TextAreaField_1 = require("./TextAreaField");
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
- })(function (_a, Element) {
43
- var children = _a.children, orientation = _a.orientation, elemProps = __rest(_a, ["children", "orientation"]);
44
- var layoutProps = form_field_1.useFormFieldOrientation(orientation);
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":"AAyCA,eAAO,MAAM,aAAa;;;;;;;;;;;;;;EAgCxB,CAAC"}
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
- var react_1 = require("@emotion/react");
29
- var tokens_1 = require("@workday/canvas-kit-react/tokens");
30
- var common_1 = require("@workday/canvas-kit-react/common");
31
- var common_2 = require("@workday/canvas-kit-labs-react/common");
32
- var form_field_1 = require("@workday/canvas-kit-preview-react/form-field");
33
- var text_input_1 = require("@workday/canvas-kit-preview-react/text-input");
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
- })(function (_a, Element, model) {
62
- var elemProps = __rest(_a, []);
63
- var theme = common_1.useTheme();
64
- var errorRing = common_2.useThemedRing('error');
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: "inset 0 0 0 1px " + theme.canvas.palette.common.focusOutline,
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, __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 })));
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
- var react_1 = __importDefault(require("react"));
30
- var common_1 = require("@workday/canvas-kit-react/common");
31
- var form_field_1 = require("@workday/canvas-kit-preview-react/form-field");
32
- var layout_1 = require("@workday/canvas-kit-react/layout");
33
- var TextInputField_1 = require("./TextInputField");
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
- })(function (_a, Element) {
43
- var children = _a.children, orientation = _a.orientation, elemProps = __rest(_a, ["children", "orientation"]);
44
- var layoutProps = form_field_1.useFormFieldOrientation(orientation);
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":"AAyCA,eAAO,MAAM,cAAc;;;;;;;;;;;;;;EAiCzB,CAAC"}
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
- var react_1 = require("@emotion/react");
18
- var tokens_1 = require("@workday/canvas-kit-react/tokens");
19
- var common_1 = require("@workday/canvas-kit-react/common");
20
- var common_2 = require("@workday/canvas-kit-labs-react/common");
21
- var form_field_1 = require("@workday/canvas-kit-preview-react/form-field");
22
- var hooks_1 = require("./hooks");
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
- })(function (elemProps, Element, model) {
51
- var theme = common_1.useTheme();
52
- var errorRing = common_2.useThemedRing('error');
53
- 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
54
42
  ? errorRing
55
43
  : {
56
44
  '&:focus:not([disabled])': {
57
45
  borderColor: theme.canvas.palette.common.focusOutline,
58
- boxShadow: "inset 0 0 0 1px " + theme.canvas.palette.common.focusOutline,
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, __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)));
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
- var common_1 = require("@workday/canvas-kit-react/common");
5
- var useTextInputModel_1 = require("./useTextInputModel");
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)(function () {
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
- var form_field_1 = require("@workday/canvas-kit-preview-react/form-field");
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
- var defaultColorSet = [
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
- var ColorPickerContainer = styled('div')({
68
+ const ColorPickerContainer = styled('div')({
91
69
  width: 216,
92
70
  });
93
- var ColorInputWrapper = styled('form')({
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
- var ColorInputAndLabel = styled(FormField)({
78
+ const ColorInputAndLabel = styled(FormField)({
101
79
  display: 'flex',
102
80
  flexDirection: 'column',
103
81
  margin: 0,
104
82
  });
105
- var CheckButton = styled(SecondaryButton)({
83
+ const CheckButton = styled(SecondaryButton)({
106
84
  alignSelf: 'flex-end',
107
85
  });
108
- var HexColorInput = styled(ColorInput)({
86
+ const HexColorInput = styled(ColorInput)({
109
87
  width: '168px',
110
88
  });
111
- var isCustomColor = function (colors, hexCode) {
89
+ const isCustomColor = (colors, hexCode) => {
112
90
  if (!hexCode) {
113
91
  return false;
114
92
  }
115
- var lowercaseHex = hexCode.toLowerCase();
93
+ const lowercaseHex = hexCode.toLowerCase();
116
94
  return !colors.includes(lowercaseHex);
117
95
  };
118
- export var ColorPicker = function (_a) {
119
- var _b = _a.colorSet, colorSet = _b === void 0 ? defaultColorSet : _b, _c = _a.customHexInputLabel, customHexInputLabel = _c === void 0 ? 'Custom Hex Color' : _c, _d = _a.submitLabel, submitLabel = _d === void 0 ? 'Submit' : _d, onColorChange = _a.onColorChange, onColorReset = _a.onColorReset, onSubmitClick = _a.onSubmitClick, _e = _a.resetLabel, resetLabel = _e === void 0 ? 'Reset' : _e, resetColor = _a.resetColor, _f = _a.value, value = _f === void 0 ? '' : _f, _g = _a.showCustomHexInput, showCustomHexInput = _g === void 0 ? false : _g, elemProps = __rest(_a, ["colorSet", "customHexInputLabel", "submitLabel", "onColorChange", "onColorReset", "onSubmitClick", "resetLabel", "resetColor", "value", "showCustomHexInput"]);
120
- var _h = React.useState(''), validHexValue = _h[0], setValidHexValue = _h[1];
121
- var _j = React.useState(isCustomColor(colorSet, value) ? value : ''), customHexValue = _j[0], setCustomHexValue = _j[1];
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
- var onValidCustomHexChange = function (validHexValue) { return setValidHexValue(validHexValue); };
127
- var onSubmit = function (event) {
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, __assign({}, elemProps),
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
- var Label = styled('div')({
6
+ const Label = styled('div')({
18
7
  marginLeft: space.xxs,
19
8
  });
20
- var Container = styled('button')(__assign(__assign(__assign({ display: 'flex', alignItems: 'center', justifyContent: 'flex-start', width: "calc(100% + " + space.l + ")", height: space.l, margin: "-" + space.xxs + " -" + space.s + " " + space.xxs, padding: "0px " + space.s }, type.levels.subtext.medium), { whiteSpace: 'nowrap', border: 'none', outline: 'none', background: 'none', cursor: 'pointer', transition: 'color 120ms ease, background-color 120ms ease', '&:hover': {
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
- }, '&:active': {
26
+ },
27
+ '&:active': {
23
28
  backgroundColor: colors.soap400,
24
- }, '&:focus': __assign({}, focusRing()) }), hideMouseFocus));
25
- export var ResetButton = function (_a) {
26
- var onClick = _a.onClick, resetColor = _a.resetColor, label = _a.label;
27
- var handleResetColor = function () { return onClick(resetColor); };
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
- var accessibilityBorder = colors.frenchVanilla100 + " 0px 0px 0px 2px, " + colors.licorice200 + " 0px 0px 0px 3px";
18
- var SwatchContainer = styled('div')({
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: "0px " + space.xxs + " " + space.xxs + " 0px",
14
+ margin: `0px ${space.xxs} ${space.xxs} 0px`,
26
15
  '&:hover': {
27
16
  boxShadow: accessibilityBorder,
28
17
  },
29
- '&:focus': __assign({ outline: 'none' }, focusRing({ separation: 2 })),
30
- }, function (_a) {
31
- var isSelected = _a.isSelected;
32
- return (__assign({ boxShadow: isSelected ? accessibilityBorder : undefined }, mouseFocusBehavior({
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
- var Container = styled('div')({
35
+ }),
36
+ }));
37
+ const Container = styled('div')({
46
38
  display: 'flex',
47
39
  flexWrap: 'wrap',
48
- margin: "0px -" + space.xxs + " -" + space.xxs + " 0px",
40
+ margin: `0px -${space.xxs} -${space.xxs} 0px`,
49
41
  });
50
- export var SwatchBook = function (_a) {
51
- var colors = _a.colors, value = _a.value, onSelect = _a.onSelect;
52
- return (React.createElement(Container, null, colors.map(function (color, index) {
53
- var isSelected = value ? color.toLowerCase() === value.toLowerCase() : false;
54
- var handleClick = function () { return onSelect(color); };
55
- var handleKeyDown = function (event) {
56
- return (event.key === 'Enter' || event.key === ' ') && onSelect(color);
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 var FormField = createContainer('div')({
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
- })(function (_a, Element) {
39
- var children = _a.children, orientation = _a.orientation, elemProps = __rest(_a, ["children", "orientation"]);
40
- var layoutProps = useFormFieldOrientation(orientation);
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
  });