@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,14 +1,13 @@
1
1
  // Modified from https://gist.github.com/hsablonniere/2581101
2
- export var scrollIntoViewIfNeeded = function (elem, centerIfNeeded) {
3
- if (centerIfNeeded === void 0) { centerIfNeeded = true; }
4
- var parent = elem.parentElement;
2
+ export const scrollIntoViewIfNeeded = (elem, centerIfNeeded = true) => {
3
+ const parent = elem.parentElement;
5
4
  if (elem && parent) {
6
- var parentComputedStyle = window.getComputedStyle(parent, null);
7
- var parentBorderTopWidth = parseInt(parentComputedStyle.getPropertyValue('border-top-width'), 10);
5
+ const parentComputedStyle = window.getComputedStyle(parent, null);
6
+ const parentBorderTopWidth = parseInt(parentComputedStyle.getPropertyValue('border-top-width'), 10);
8
7
  // Check if elem is out of view at the top edge of the parent's viewport
9
- var overTop = elem.offsetTop < parent.scrollTop + parentBorderTopWidth;
8
+ const overTop = elem.offsetTop < parent.scrollTop + parentBorderTopWidth;
10
9
  // Check if elem is out of view at the bottom edge of the parent's viewport
11
- var overBottom = elem.offsetTop + elem.offsetHeight >
10
+ const overBottom = elem.offsetTop + elem.offsetHeight >
12
11
  parent.scrollTop + parentBorderTopWidth + parent.clientHeight;
13
12
  if ((overTop || overBottom) && centerIfNeeded) {
14
13
  parent.scrollTop = Math.floor(elem.offsetTop - parent.clientHeight / 2 - parentBorderTopWidth + elem.clientHeight / 2);
@@ -1,8 +1,8 @@
1
- export var getIndexByValue = function (options, value) {
1
+ export const getIndexByValue = (options, value) => {
2
2
  if (!options || value === undefined) {
3
3
  return -1;
4
4
  }
5
- for (var i = 0; i < options.length; i++) {
5
+ for (let i = 0; i < options.length; i++) {
6
6
  if (options[i].value === value) {
7
7
  return i;
8
8
  }
@@ -10,7 +10,7 @@ export var getIndexByValue = function (options, value) {
10
10
  return -1;
11
11
  };
12
12
  // If the value doesn't exist in the options, return index 0
13
- export var getCorrectedIndexByValue = function (options, value) {
14
- var indexByValue = getIndexByValue(options, value);
13
+ export const getCorrectedIndexByValue = (options, value) => {
14
+ const indexByValue = getIndexByValue(options, value);
15
15
  return indexByValue === -1 ? 0 : indexByValue;
16
16
  };
@@ -1,29 +1,3 @@
1
- var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
2
- if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
3
- return cooked;
4
- };
5
- var __assign = (this && this.__assign) || function () {
6
- __assign = Object.assign || function(t) {
7
- for (var s, i = 1, n = arguments.length; i < n; i++) {
8
- s = arguments[i];
9
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
10
- t[p] = s[p];
11
- }
12
- return t;
13
- };
14
- return __assign.apply(this, arguments);
15
- };
16
- var __rest = (this && this.__rest) || function (s, e) {
17
- var t = {};
18
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
19
- t[p] = s[p];
20
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
21
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
22
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
23
- t[p[i]] = s[p[i]];
24
- }
25
- return t;
26
- };
27
1
  /** @jsxRuntime classic */
28
2
  /** @jsx jsx */
29
3
  import * as React from 'react';
@@ -32,45 +6,57 @@ import { jsx, keyframes } from '@emotion/react';
32
6
  import { colors, depth } from '@workday/canvas-kit-react/tokens';
33
7
  import { SidePanelContext } from './hooks';
34
8
  import { SidePanelToggleButton } from './SidePanelToggleButton';
35
- var createKeyframes = function (from, to) {
36
- var normalized = {
9
+ const createKeyframes = (from, to) => {
10
+ const normalized = {
37
11
  from: typeof from === 'number' ? from + 'px' : from,
38
12
  to: typeof to === 'number' ? to + 'px' : to,
39
13
  };
40
- return keyframes(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n from {\n width: ", ";\n min-width: ", ";\n max-width: ", ";\n } to {\n width: ", ";\n min-width: ", ";\n max-width: ", ";\n }\n "], ["\n from {\n width: ", ";\n min-width: ", ";\n max-width: ", ";\n } to {\n width: ", ";\n min-width: ", ";\n max-width: ", ";\n }\n "])), normalized.from, normalized.from, normalized.from, normalized.to, normalized.to, normalized.to);
14
+ return keyframes `
15
+ from {
16
+ width: ${normalized.from};
17
+ min-width: ${normalized.from};
18
+ max-width: ${normalized.from};
19
+ } to {
20
+ width: ${normalized.to};
21
+ min-width: ${normalized.to};
22
+ max-width: ${normalized.to};
23
+ }
24
+ `;
41
25
  };
42
- var containerVariantStyle = {
43
- alternate: __assign({ backgroundColor: colors.frenchVanilla100 }, depth[5]),
26
+ const containerVariantStyle = {
27
+ alternate: {
28
+ backgroundColor: colors.frenchVanilla100,
29
+ ...depth[5],
30
+ },
44
31
  standard: {
45
32
  backgroundColor: colors.soap100,
46
33
  },
47
34
  };
48
- var Panel = styled('section')({
35
+ const Panel = styled('section')({
49
36
  overflow: 'hidden',
50
37
  position: 'relative',
51
38
  boxSizing: 'border-box',
52
39
  height: '100%',
53
40
  });
54
- export var SidePanel = createComponent('section')({
41
+ export const SidePanel = createComponent('section')({
55
42
  displayName: 'SidePanel',
56
- Component: function (_a, ref, Element) {
57
- var children = _a.children, _b = _a.collapsedWidth, collapsedWidth = _b === void 0 ? 64 : _b, _c = _a.expanded, expanded = _c === void 0 ? true : _c, _d = _a.expandedWidth, expandedWidth = _d === void 0 ? 320 : _d, onAnimationEnd = _a.onAnimationEnd, onAnimationStart = _a.onAnimationStart, onExpandedChange = _a.onExpandedChange, onStateTransition = _a.onStateTransition, _e = _a.origin, origin = _e === void 0 ? 'left' : _e, _f = _a.variant, variant = _f === void 0 ? 'standard' : _f, touched = _a.touched, elemProps = __rest(_a, ["children", "collapsedWidth", "expanded", "expandedWidth", "onAnimationEnd", "onAnimationStart", "onExpandedChange", "onStateTransition", "origin", "variant", "touched"]);
58
- var _g = React.useState(expanded ? 'expanded' : 'collapsed'), state = _g[0], setState = _g[1];
59
- React.useEffect(function () {
43
+ Component({ children, collapsedWidth = 64, expanded = true, expandedWidth = 320, onAnimationEnd, onAnimationStart, onExpandedChange, onStateTransition, origin = 'left', variant = 'standard', touched, ...elemProps }, ref, Element) {
44
+ const [state, setState] = React.useState(expanded ? 'expanded' : 'collapsed');
45
+ React.useEffect(() => {
60
46
  if (typeof onExpandedChange !== 'undefined') {
61
47
  onExpandedChange(expanded);
62
48
  }
63
49
  }, [expanded, onExpandedChange]);
64
- React.useEffect(function () {
50
+ React.useEffect(() => {
65
51
  if (typeof onStateTransition !== 'undefined') {
66
52
  onStateTransition(state);
67
53
  }
68
54
  }, [state, onStateTransition]);
69
- var motion = {
55
+ const motion = {
70
56
  collapse: createKeyframes(expandedWidth, collapsedWidth),
71
57
  expand: createKeyframes(collapsedWidth, expandedWidth),
72
58
  };
73
- var handleAnimationEnd = function (event) {
59
+ const handleAnimationEnd = (event) => {
74
60
  if (event.currentTarget === event.target) {
75
61
  if (event.animationName === motion.collapse.name) {
76
62
  setState('collapsed');
@@ -83,7 +69,7 @@ export var SidePanel = createComponent('section')({
83
69
  onAnimationEnd(event);
84
70
  }
85
71
  };
86
- var handleAnimationStart = function (event) {
72
+ const handleAnimationStart = (event) => {
87
73
  if (event.currentTarget === event.target) {
88
74
  if (event.animationName === motion.collapse.name ||
89
75
  event.animationName === motion.expand.name) {
@@ -94,21 +80,21 @@ export var SidePanel = createComponent('section')({
94
80
  onAnimationStart(event);
95
81
  }
96
82
  };
97
- return (jsx(Panel, __assign({ ref: ref, as: Element, css: [
83
+ return (jsx(Panel, Object.assign({ ref: ref, as: Element, css: [
98
84
  {
99
85
  width: expanded ? expandedWidth : collapsedWidth,
100
86
  maxWidth: expanded ? expandedWidth : collapsedWidth,
101
87
  // mounted.current will be false on the first render, thus you won't get an unwanted animation here
102
88
  // Will animate again if you force a re-render (like in Storybook)
103
89
  animation: touched
104
- ? (expanded ? motion.expand : motion.collapse) + " 200ms ease-out"
90
+ ? `${expanded ? motion.expand : motion.collapse} 200ms ease-out`
105
91
  : undefined,
106
92
  },
107
93
  containerVariantStyle[variant],
108
94
  ], onAnimationEnd: handleAnimationEnd, onAnimationStart: handleAnimationStart }, elemProps),
109
95
  jsx(SidePanelContext.Provider, { value: {
110
- state: state,
111
- origin: origin,
96
+ state,
97
+ origin,
112
98
  } }, children)));
113
99
  },
114
100
  subComponents: {
@@ -124,4 +110,3 @@ export var SidePanel = createComponent('section')({
124
110
  ToggleButton: SidePanelToggleButton,
125
111
  },
126
112
  });
127
- var templateObject_1;
@@ -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
  /** @jsxRuntime classic */
24
2
  /** @jsx jsx */
25
3
  import * as React from 'react';
@@ -33,13 +11,12 @@ import { SidePanelContext } from './hooks';
33
11
  /**
34
12
  * A toggle button styled specifically for the side panel container.
35
13
  */
36
- export var SidePanelToggleButton = createComponent('button')({
14
+ export const SidePanelToggleButton = createComponent('button')({
37
15
  displayName: 'SidePanel.ToggleButton',
38
- Component: function (_a) {
39
- var _b = _a.variant, variant = _b === void 0 ? undefined : _b, _c = _a.icon, icon = _c === void 0 ? transformationImportIcon : _c, _d = _a.tooltipTextExpand, tooltipTextExpand = _d === void 0 ? 'Expand' : _d, _e = _a.tooltipTextCollapse, tooltipTextCollapse = _e === void 0 ? 'Collapse' : _e, elemProps = __rest(_a, ["variant", "icon", "tooltipTextExpand", "tooltipTextCollapse"]);
40
- var context = React.useContext(SidePanelContext);
41
- var useRTLOrigin = function () {
42
- var isRTL = useIsRTL();
16
+ Component({ variant = undefined, icon = transformationImportIcon, tooltipTextExpand = 'Expand', tooltipTextCollapse = 'Collapse', ...elemProps }) {
17
+ const context = React.useContext(SidePanelContext);
18
+ const useRTLOrigin = () => {
19
+ const isRTL = useIsRTL();
43
20
  // if the direction is set to RTl, flip the origin
44
21
  if (isRTL) {
45
22
  return context.origin === 'left' ? 'right' : 'left';
@@ -47,9 +24,9 @@ export var SidePanelToggleButton = createComponent('button')({
47
24
  // Otherwise, default to returning the origin
48
25
  return context.origin;
49
26
  };
50
- var rtlOrigin = useRTLOrigin();
27
+ const rtlOrigin = useRTLOrigin();
51
28
  // Note: Depending on the collapsed width, the button could "jump" to it's final position.
52
- var buttonStyle = css({
29
+ const buttonStyle = css({
53
30
  position: 'absolute',
54
31
  top: space.m,
55
32
  width: space.l,
@@ -57,10 +34,10 @@ export var SidePanelToggleButton = createComponent('button')({
57
34
  left: context.state === 'collapsed' ? 0 : rtlOrigin === 'right' ? space.s : undefined,
58
35
  margin: context.state === 'collapsed' ? 'auto' : 0,
59
36
  transform: context.state === 'collapsed' || context.state === 'collapsing'
60
- ? "scaleX(" + (rtlOrigin === 'left' ? '1' : '-1') + ")"
61
- : "scaleX(" + (rtlOrigin === 'left' ? '-1' : '1') + ")",
37
+ ? `scaleX(${rtlOrigin === 'left' ? '1' : '-1'})`
38
+ : `scaleX(${rtlOrigin === 'left' ? '-1' : '1'})`,
62
39
  });
63
40
  return (jsx(Tooltip, { title: context.state === 'collapsed' ? tooltipTextExpand : tooltipTextCollapse, type: "muted" },
64
- jsx(TertiaryButton, __assign({ type: "button", css: buttonStyle, icon: icon, variant: variant }, elemProps))));
41
+ jsx(TertiaryButton, Object.assign({ type: "button", css: buttonStyle, icon: icon, variant: variant }, elemProps))));
65
42
  },
66
43
  });
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- export var SidePanelContext = React.createContext({
2
+ export const SidePanelContext = React.createContext({
3
3
  state: 'expanded',
4
4
  origin: 'left',
5
5
  });
@@ -19,52 +19,52 @@ import { useUniqueId } from '@workday/canvas-kit-react/common';
19
19
  * });
20
20
  * ```
21
21
  */
22
- export var useSidePanel = function (config) {
23
- var _a = React.useState(false), touched = _a[0], setTouched = _a[1];
24
- var configParams = config
22
+ export const useSidePanel = (config) => {
23
+ const [touched, setTouched] = React.useState(false);
24
+ const configParams = config
25
25
  ? config
26
26
  : {
27
27
  initialExpanded: true,
28
28
  panelId: undefined,
29
29
  labelId: undefined,
30
30
  };
31
- var _b = configParams.initialExpanded, initialExpanded = _b === void 0 ? true : _b, panelIdParam = configParams.panelId, labelIdParam = configParams.labelId;
32
- var _c = React.useState(initialExpanded), expanded = _c[0], setExpanded = _c[1];
33
- var panelId = useUniqueId(panelIdParam);
34
- var labelId = useUniqueId(labelIdParam);
31
+ const { initialExpanded = true, panelId: panelIdParam, labelId: labelIdParam } = configParams;
32
+ const [expanded, setExpanded] = React.useState(initialExpanded);
33
+ const panelId = useUniqueId(panelIdParam);
34
+ const labelId = useUniqueId(labelIdParam);
35
35
  // This prevents keyframes animations from rendering prematurely
36
- var handleSetTouched = function () {
36
+ const handleSetTouched = () => {
37
37
  if (touched === false) {
38
38
  setTouched(true);
39
39
  }
40
40
  };
41
- var handleClick = function () {
41
+ const handleClick = () => {
42
42
  handleSetExpanded(!expanded);
43
43
  };
44
- var handleSetExpanded = function (newExpandedState) {
44
+ const handleSetExpanded = (newExpandedState) => {
45
45
  handleSetTouched();
46
46
  setExpanded(newExpandedState);
47
47
  };
48
- var panelProps = {
48
+ const panelProps = {
49
49
  expanded: expanded,
50
50
  id: panelId,
51
51
  'aria-labelledby': labelId,
52
- touched: touched,
52
+ touched,
53
53
  };
54
- var labelProps = {
54
+ const labelProps = {
55
55
  id: labelId,
56
56
  };
57
- var controlProps = {
57
+ const controlProps = {
58
58
  'aria-controls': panelId,
59
59
  'aria-expanded': expanded,
60
60
  'aria-labelledby': labelId,
61
61
  onClick: handleClick,
62
62
  };
63
63
  return {
64
- expanded: expanded,
64
+ expanded,
65
65
  setExpanded: handleSetExpanded,
66
- panelProps: panelProps,
67
- labelProps: labelProps,
68
- controlProps: controlProps,
66
+ panelProps,
67
+ labelProps,
68
+ controlProps,
69
69
  };
70
70
  };
@@ -1,34 +1,11 @@
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, createElemPropsHook } from '@workday/canvas-kit-react/common';
25
3
  import { Flex } from '@workday/canvas-kit-react/layout';
26
4
  import { StatusIndicatorIcon, statusIndicatorColors } from './StatusIndicatorIcon';
27
5
  import { StatusIndicatorLabel } from './StatusIndicatorLabel';
28
6
  import { useStatusIndicatorModel } from './hooks';
29
- export var useStatusIndicator = createElemPropsHook(useStatusIndicatorModel)(function (_a) {
30
- var state = _a.state;
31
- var colors = statusIndicatorColors[state.variant][state.emphasis];
7
+ export const useStatusIndicator = createElemPropsHook(useStatusIndicatorModel)(({ state }) => {
8
+ const colors = statusIndicatorColors[state.variant][state.emphasis];
32
9
  return {
33
10
  opacity: state.variant === 'transparent' ? '0.85' : undefined,
34
11
  color: colors.text,
@@ -45,7 +22,7 @@ export var useStatusIndicator = createElemPropsHook(useStatusIndicatorModel)(fun
45
22
  * </StatusIndicator>
46
23
  * ```
47
24
  */
48
- export var StatusIndicator = createContainer('div')({
25
+ export const StatusIndicator = createContainer('div')({
49
26
  displayName: 'StatusIndicator',
50
27
  modelHook: useStatusIndicatorModel,
51
28
  elemPropsHook: useStatusIndicator,
@@ -69,7 +46,6 @@ export var StatusIndicator = createContainer('div')({
69
46
  */
70
47
  Icon: StatusIndicatorIcon,
71
48
  },
72
- })(function (_a, Element, model) {
73
- var children = _a.children, elemProps = __rest(_a, ["children"]);
74
- return (React.createElement(Flex, __assign({ gap: "xxxs", as: Element, maxWidth: 200, paddingX: "xxxs", display: "inline-flex", alignItems: "center", height: 20, borderRadius: "s" }, elemProps), children));
49
+ })(({ children, ...elemProps }, Element, model) => {
50
+ return (React.createElement(Flex, Object.assign({ gap: "xxxs", as: Element, maxWidth: 200, paddingX: "xxxs", display: "inline-flex", alignItems: "center", height: 20, borderRadius: "s" }, elemProps), children));
75
51
  });
@@ -1,20 +1,9 @@
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 React from 'react';
13
2
  import { createElemPropsHook, createSubcomponent } from '@workday/canvas-kit-react/common';
14
3
  import { SystemIcon } from '@workday/canvas-kit-react/icon';
15
4
  import { useStatusIndicatorModel } from './hooks';
16
5
  import { colors } from '@workday/canvas-kit-react/tokens';
17
- export var statusIndicatorColors = {
6
+ export const statusIndicatorColors = {
18
7
  gray: {
19
8
  high: {
20
9
  text: colors.frenchVanilla100,
@@ -76,17 +65,16 @@ export var statusIndicatorColors = {
76
65
  },
77
66
  },
78
67
  };
79
- export var useStatusIndicatorIcon = createElemPropsHook(useStatusIndicatorModel)(function (_a) {
80
- var state = _a.state;
81
- var colors = statusIndicatorColors[state.variant][state.emphasis];
68
+ export const useStatusIndicatorIcon = createElemPropsHook(useStatusIndicatorModel)(({ state }) => {
69
+ const colors = statusIndicatorColors[state.variant][state.emphasis];
82
70
  return {
83
71
  color: colors.text,
84
72
  colorHover: colors.background,
85
73
  };
86
74
  });
87
- export var StatusIndicatorIcon = createSubcomponent('span')({
75
+ export const StatusIndicatorIcon = createSubcomponent('span')({
88
76
  modelHook: useStatusIndicatorModel,
89
77
  elemPropsHook: useStatusIndicatorIcon,
90
- })(function (elemProps, Element, model) {
91
- return React.createElement(SystemIcon, __assign({ as: Element, size: 20, role: "img" }, elemProps));
78
+ })((elemProps, Element, model) => {
79
+ return React.createElement(SystemIcon, Object.assign({ as: Element, size: 20, role: "img" }, elemProps));
92
80
  });
@@ -1,32 +1,9 @@
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 { createComponent } from '@workday/canvas-kit-react/common';
25
3
  import { Text } from '@workday/canvas-kit-react/text';
26
- export var StatusIndicatorLabel = createComponent('span')({
4
+ export const StatusIndicatorLabel = createComponent('span')({
27
5
  displayName: 'StatusIndicator.Label',
28
- Component: function (_a, ref, Element) {
29
- var children = _a.children, elemProps = __rest(_a, ["children"]);
30
- return (React.createElement(Text, __assign({ whiteSpace: "nowrap", overflow: "hidden", textOverflow: "ellipsis", typeLevel: "subtext.large", fontWeight: "bold", textTransform: "capitalize", ref: ref, color: "inherit", as: Element }, elemProps), children));
6
+ Component: ({ children, ...elemProps }, ref, Element) => {
7
+ return (React.createElement(Text, Object.assign({ whiteSpace: "nowrap", overflow: "hidden", textOverflow: "ellipsis", typeLevel: "subtext.large", fontWeight: "bold", textTransform: "capitalize", ref: ref, color: "inherit", as: Element }, elemProps), children));
31
8
  },
32
9
  });
@@ -1,16 +1,5 @@
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 { createModelHook } from '@workday/canvas-kit-react/common';
13
- export var useStatusIndicatorModel = createModelHook({
2
+ export const useStatusIndicatorModel = createModelHook({
14
3
  defaultConfig: {
15
4
  /**
16
5
  * Defines the emphasis of the `StatusIndicator`.
@@ -25,7 +14,9 @@ export var useStatusIndicatorModel = createModelHook({
25
14
  */
26
15
  variant: 'gray',
27
16
  },
28
- })(function (config) {
29
- var state = __assign({}, config);
30
- return { state: state, events: {} };
17
+ })(config => {
18
+ const state = {
19
+ ...config,
20
+ };
21
+ return { state, events: {} };
31
22
  });
@@ -1,31 +1,9 @@
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 { FormField, useFormFieldModel, useFormFieldOrientation, } from '@workday/canvas-kit-preview-react/form-field';
26
4
  import { Flex } from '@workday/canvas-kit-react/layout';
27
5
  import { TextAreaField } from './TextAreaField';
28
- export var TextArea = createContainer('div')({
6
+ export const TextArea = createContainer('div')({
29
7
  displayName: 'TextArea',
30
8
  modelHook: useFormFieldModel,
31
9
  subComponents: {
@@ -33,8 +11,7 @@ export var TextArea = createContainer('div')({
33
11
  Label: FormField.Label,
34
12
  Hint: FormField.Hint,
35
13
  },
36
- })(function (_a, Element) {
37
- var children = _a.children, orientation = _a.orientation, elemProps = __rest(_a, ["children", "orientation"]);
38
- var layoutProps = useFormFieldOrientation(orientation);
39
- return (React.createElement(Flex, __assign({ as: Element }, layoutProps, elemProps), children));
14
+ })(({ children, orientation, ...elemProps }, Element) => {
15
+ const layoutProps = useFormFieldOrientation(orientation);
16
+ return (React.createElement(Flex, Object.assign({ as: Element }, layoutProps, elemProps), children));
40
17
  });
@@ -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,34 +1,11 @@
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
  /** @jsxRuntime classic */
24
2
  /** @jsx jsx */
25
3
  import { jsx } from '@emotion/react';
26
4
  import { borderRadius, inputColors, spaceNumbers, type, } from '@workday/canvas-kit-react/tokens';
27
- import { createSubcomponent, useTheme } from '@workday/canvas-kit-react/common';
28
- import { useThemedRing } from '@workday/canvas-kit-labs-react/common';
5
+ import { createSubcomponent, useTheme, useThemedRing, } from '@workday/canvas-kit-react/common';
29
6
  import { FormField } from '@workday/canvas-kit-preview-react/form-field';
30
7
  import { useTextInputModel } from '@workday/canvas-kit-preview-react/text-input';
31
- var baseStyles = {
8
+ const baseStyles = {
32
9
  transition: '0.2s box-shadow, 0.2s border-color',
33
10
  resize: 'both',
34
11
  '&::webkit-resizer': {
@@ -52,20 +29,19 @@ var baseStyles = {
52
29
  },
53
30
  },
54
31
  };
55
- export var TextAreaField = createSubcomponent('textarea')({
32
+ export const TextAreaField = createSubcomponent('textarea')({
56
33
  displayName: 'TextArea.Field',
57
34
  modelHook: useTextInputModel,
58
- })(function (_a, Element, model) {
59
- var elemProps = __rest(_a, []);
60
- var theme = useTheme();
61
- var errorRing = useThemedRing('error');
62
- var focusStyles = model.state.hasError
35
+ })(({ ...elemProps }, Element, model) => {
36
+ const theme = useTheme();
37
+ const errorRing = useThemedRing('error');
38
+ const focusStyles = model.state.hasError
63
39
  ? errorRing
64
40
  : {
65
41
  '&:focus:not([disabled])': {
66
42
  borderColor: theme.canvas.palette.common.focusOutline,
67
- boxShadow: "inset 0 0 0 1px " + theme.canvas.palette.common.focusOutline,
43
+ boxShadow: `inset 0 0 0 1px ${theme.canvas.palette.common.focusOutline}`,
68
44
  },
69
45
  };
70
- return (jsx(FormField.Input, __assign({ as: Element }, type.levels.subtext.large, { css: [baseStyles, focusStyles] }, elemProps, { border: "1px solid " + inputColors.border, display: "block", backgroundColor: inputColors.background, borderRadius: borderRadius.m, minHeight: 64, minWidth: 280, padding: spaceNumbers.xxs, margin: 0 })));
46
+ return (jsx(FormField.Input, Object.assign({ as: Element }, type.levels.subtext.large, { css: [baseStyles, focusStyles] }, elemProps, { border: `1px solid ${inputColors.border}`, display: "block", backgroundColor: inputColors.background, borderRadius: borderRadius.m, minHeight: 64, minWidth: 280, padding: spaceNumbers.xxs, margin: 0 })));
71
47
  });