@sprinklrjs/spaceweb 14.11.0 → 14.11.4

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 (76) hide show
  1. package/asyncSelect/hooks/useAsyncSelect.d.ts +3 -3
  2. package/asyncSelect/hooks/useGroupedAsyncSelect.d.ts +3 -3
  3. package/baseui/datepicker/styled-components.js +2 -2
  4. package/checkbox/checkbox.d.ts +1 -1
  5. package/checkbox/checkbox.js +5 -4
  6. package/checkbox/types.d.ts +8 -6
  7. package/color-picker/CustomColorSelector.d.ts +1 -1
  8. package/color-picker/CustomColorSelector.js +25 -8
  9. package/date-picker/DatePickerInput.d.ts +2 -2
  10. package/date-picker/DatePickerInput.js +1 -0
  11. package/esm/asyncSelect/hooks/useAsyncSelect.d.ts +3 -3
  12. package/esm/asyncSelect/hooks/useGroupedAsyncSelect.d.ts +3 -3
  13. package/esm/baseui/datepicker/styled-components.js +2 -2
  14. package/esm/checkbox/checkbox.d.ts +1 -1
  15. package/esm/checkbox/checkbox.js +6 -5
  16. package/esm/checkbox/types.d.ts +8 -6
  17. package/esm/color-picker/CustomColorSelector.d.ts +1 -1
  18. package/esm/color-picker/CustomColorSelector.js +26 -9
  19. package/esm/date-picker/DatePickerInput.d.ts +2 -2
  20. package/esm/date-picker/DatePickerInput.js +1 -0
  21. package/esm/helpers/colors.d.ts +1 -0
  22. package/esm/helpers/colors.js +14 -5
  23. package/esm/list/list.d.ts +1 -0
  24. package/esm/list/list.js +5 -4
  25. package/esm/list/types.d.ts +8 -4
  26. package/esm/list/utils.d.ts +5 -1
  27. package/esm/list/utils.js +15 -0
  28. package/esm/menu/ActionsIconButton.d.ts +5 -2
  29. package/esm/menu/StatefulSubMenu.d.ts +2 -1
  30. package/esm/menu/SubMenu.d.ts +2 -1
  31. package/esm/menu/SubMenu.js +2 -1
  32. package/esm/menu/index.d.ts +1 -1
  33. package/esm/menu/menu-item.js +35 -23
  34. package/esm/menu/menu.d.ts +2 -1
  35. package/esm/menu/types.d.ts +10 -2
  36. package/esm/progress/circular/CircularProgress.d.ts +3 -3
  37. package/esm/progress/circular/CircularProgress.js +3 -3
  38. package/esm/progress/linear/LinearProgress.d.ts +3 -3
  39. package/esm/progress/linear/LinearProgress.js +3 -3
  40. package/esm/select/selectMenuAdapter/CollapsibleSelectMenu.d.ts +1 -1
  41. package/esm/select/selectMenuAdapter/CollapsibleSelectMenu.js +21 -6
  42. package/esm/select/selectMenuAdapter/SelectMenuItem.d.ts +2 -1
  43. package/esm/tag/tag.d.ts +1 -0
  44. package/esm/tag/tag.js +2 -2
  45. package/esm/tag/types.d.ts +5 -4
  46. package/esm/time-range-picker/RangeSelectorContainer.d.ts +2 -2
  47. package/esm/time-range-picker/RangeSelectorContainer.js +13 -3
  48. package/helpers/colors.d.ts +1 -0
  49. package/helpers/colors.js +16 -6
  50. package/list/list.d.ts +1 -0
  51. package/list/list.js +3 -2
  52. package/list/types.d.ts +8 -4
  53. package/list/utils.d.ts +5 -1
  54. package/list/utils.js +17 -1
  55. package/menu/ActionsIconButton.d.ts +5 -2
  56. package/menu/StatefulSubMenu.d.ts +2 -1
  57. package/menu/SubMenu.d.ts +2 -1
  58. package/menu/SubMenu.js +2 -1
  59. package/menu/index.d.ts +1 -1
  60. package/menu/menu-item.js +34 -22
  61. package/menu/menu.d.ts +2 -1
  62. package/menu/types.d.ts +10 -2
  63. package/package.json +5 -4
  64. package/progress/circular/CircularProgress.d.ts +3 -3
  65. package/progress/circular/CircularProgress.js +2 -2
  66. package/progress/linear/LinearProgress.d.ts +3 -3
  67. package/progress/linear/LinearProgress.js +2 -2
  68. package/select/selectMenuAdapter/CollapsibleSelectMenu.d.ts +1 -1
  69. package/select/selectMenuAdapter/CollapsibleSelectMenu.js +21 -6
  70. package/select/selectMenuAdapter/SelectMenuItem.d.ts +2 -1
  71. package/tag/tag.d.ts +1 -0
  72. package/tag/tag.js +2 -2
  73. package/tag/types.d.ts +5 -4
  74. package/time-range-picker/RangeSelectorContainer.d.ts +2 -2
  75. package/time-range-picker/RangeSelectorContainer.js +12 -2
  76. package/tsconfig.build.tsbuildinfo +1 -1
@@ -151,7 +151,7 @@ export declare const useAsyncSelect: ({ loadOptions, initialOptions, resolveSele
151
151
  endEnhancerButtonProps?: import("../../select").SelectEnhancerButtonConfig | undefined;
152
152
  virtual?: boolean | undefined;
153
153
  selectOnTab?: boolean | undefined;
154
- getActionsElement?: import("../../menu").MenuItemActions;
154
+ getActionsElement?: import("../../menu").MenuItemActions | undefined;
155
155
  captureScroll?: boolean | undefined;
156
156
  popoverMinWidth?: string | undefined;
157
157
  createOption?: ((label: string) => import("../../select").Options | Promise<import("../../select").Options>) | undefined;
@@ -329,7 +329,7 @@ export declare const useAsyncSelect: ({ loadOptions, initialOptions, resolveSele
329
329
  endEnhancerButtonProps?: import("../../select").SelectEnhancerButtonConfig | undefined;
330
330
  virtual?: boolean | undefined;
331
331
  selectOnTab?: boolean | undefined;
332
- getActionsElement?: import("../../menu").MenuItemActions;
332
+ getActionsElement?: import("../../menu").MenuItemActions | undefined;
333
333
  captureScroll?: boolean | undefined;
334
334
  overlayWidth?: string | undefined;
335
335
  scrollContainer?: "overlayContainer" | "menuContainer" | undefined;
@@ -510,7 +510,7 @@ export declare const useAsyncSelect: ({ loadOptions, initialOptions, resolveSele
510
510
  endEnhancerButtonProps?: import("../../select").SelectEnhancerButtonConfig | undefined;
511
511
  virtual?: boolean | undefined;
512
512
  selectOnTab?: boolean | undefined;
513
- getActionsElement?: import("../../menu").MenuItemActions;
513
+ getActionsElement?: import("../../menu").MenuItemActions | undefined;
514
514
  captureScroll?: boolean | undefined;
515
515
  overlayWidth?: string | undefined;
516
516
  scrollContainer?: "overlayContainer" | "menuContainer" | undefined;
@@ -119,7 +119,7 @@ export declare const useGroupedAsyncSelect: ({ onChange, showSelectAll, selectAl
119
119
  endEnhancerButtonProps?: import("../../select").SelectEnhancerButtonConfig | undefined;
120
120
  virtual?: boolean | undefined;
121
121
  selectOnTab?: boolean | undefined;
122
- getActionsElement?: import("../../menu").MenuItemActions;
122
+ getActionsElement?: import("../../menu").MenuItemActions | undefined;
123
123
  captureScroll?: boolean | undefined;
124
124
  popoverMinWidth?: string | undefined;
125
125
  createOption?: ((label: string) => import("../../select").Options | Promise<import("../../select").Options>) | undefined;
@@ -265,7 +265,7 @@ export declare const useGroupedAsyncSelect: ({ onChange, showSelectAll, selectAl
265
265
  endEnhancerButtonProps?: import("../../select").SelectEnhancerButtonConfig | undefined;
266
266
  virtual?: boolean | undefined;
267
267
  selectOnTab?: boolean | undefined;
268
- getActionsElement?: import("../../menu").MenuItemActions;
268
+ getActionsElement?: import("../../menu").MenuItemActions | undefined;
269
269
  captureScroll?: boolean | undefined;
270
270
  overlayWidth?: string | undefined;
271
271
  popoverMinWidth?: string | undefined;
@@ -413,7 +413,7 @@ export declare const useGroupedAsyncSelect: ({ onChange, showSelectAll, selectAl
413
413
  endEnhancerButtonProps?: import("../../select").SelectEnhancerButtonConfig | undefined;
414
414
  virtual?: boolean | undefined;
415
415
  selectOnTab?: boolean | undefined;
416
- getActionsElement?: import("../../menu").MenuItemActions;
416
+ getActionsElement?: import("../../menu").MenuItemActions | undefined;
417
417
  captureScroll?: boolean | undefined;
418
418
  overlayWidth?: string | undefined;
419
419
  popoverMinWidth?: string | undefined;
@@ -49,7 +49,7 @@ exports.StyledCalendarHeader = (0, style_1.styled)('div', 'box-border spr-text-p
49
49
  return ($density === constants_1.DENSITY.high ? 'min-h-6.5 w-full' : 'min-h-9 w-98');
50
50
  });
51
51
  exports.StyledCalendarHeader.displayName = 'StyledCalendarHeader';
52
- exports.StyledMonthHeader = (0, style_1.styled)('div', 'spr-text-01 spr-bg-primary px-1 whitespace-no-wrap border-0 border-b-1 spr-border-secondary border-b-solid spr-text-primary block text-center flex justify-center');
52
+ exports.StyledMonthHeader = (0, style_1.styled)('div', 'spr-text-01 spr-bg-primary px-1 whitespace-nowrap border-0 border-b-1 spr-border-secondary border-b-solid spr-text-primary block text-center flex justify-center');
53
53
  exports.StyledMonthHeader.displayName = 'StyledMonthHeader';
54
54
  exports.StyledMonthYearSelectButton = (0, style_1.styled)('button', 'px-2 gap-1 items-center justify-around flex cursor-pointer spr-bg-primary spr-text-01 h-8', 'border-1 spr-border-primary rounded-8 outline-none focus-visible:outline focus-visible:outline-2 focus-visible:outline-[--spr-focus-01]');
55
55
  exports.StyledMonthYearSelectButton.displayName = 'StyledMonthYearSelectButton';
@@ -57,7 +57,7 @@ exports.StyledMonthYearSelectIconContainer = (0, style_1.styled)('span', 'flex i
57
57
  exports.StyledMonthYearSelectIconContainer.displayName = 'StyledMonthYearSelectIconContainer';
58
58
  exports.StyledMonth = (0, style_1.styled)('div', 'inline-block w-full');
59
59
  exports.StyledMonth.displayName = 'StyledMonth';
60
- exports.StyledWeek = (0, style_1.styled)('div', 'mb-0.5 justify-center flex w-full whitespace-no-wrap');
60
+ exports.StyledWeek = (0, style_1.styled)('div', 'mb-0.5 justify-center flex w-full whitespace-nowrap');
61
61
  exports.StyledWeek.displayName = 'StyledWeek';
62
62
  // @ts-ignore
63
63
  function generateDayStyles(defaultCode, defaultStyle) {
@@ -1,6 +1,6 @@
1
1
  import type { CheckboxProps } from './types';
2
2
  declare const Checkbox: {
3
- ({ overrides, checked, containsInteractiveElement, disabled, autoFocus, isIndeterminate, error, checkmarkType, onChange, onMouseEnter, onMouseLeave, onMouseDown, onMouseUp, onFocus, onBlur, required, labelPlacement, value, id, name, children, title, "aria-label": _ariaLabel, "aria-describedby": ariaDescribedby, "aria-errormessage": ariaErrormessage, ariaLabel, inputRef, className, style, size, intent: _intent, $outlineStyle, $outlineColor, $outlineOffset, $outlineWidth, "data-spaceweb": dataSpaceweb, }: CheckboxProps): import("react/jsx-runtime").JSX.Element;
3
+ ({ overrides, checked, containsInteractiveElement, disabled, autoFocus, isIndeterminate, error, checkmarkType, onChange, onMouseEnter, onMouseLeave, onMouseDown, onMouseUp, onFocus, onBlur, required, labelPlacement, value, id, name, children, title, "aria-label": _ariaLabel, "aria-describedby": ariaDescribedby, "aria-errormessage": ariaErrormessage, ariaLabel, inputRef, className, style, size, intent: _intent, $outlineStyle, $outlineColor, $outlineOffset, $outlineWidth, "data-spaceweb": dataSpaceweb, ...restProps }: CheckboxProps): import("react/jsx-runtime").JSX.Element;
4
4
  displayName: string;
5
5
  __standard: string;
6
6
  };
@@ -13,9 +13,10 @@ var context_1 = require("../form-control/context");
13
13
  var style_1 = require("../style");
14
14
  var tick_1 = tslib_1.__importDefault(require("../icon/components/tick"));
15
15
  var subtract_1 = tslib_1.__importDefault(require("../icon/components/subtract"));
16
+ var box_1 = require("../box");
16
17
  var stopPropagation = function (e) { return e.stopPropagation(); };
17
18
  var Checkbox = function (_a) {
18
- var _b = _a.overrides, overrides = _b === void 0 ? {} : _b, _c = _a.checked, checked = _c === void 0 ? false : _c, _d = _a.containsInteractiveElement, containsInteractiveElement = _d === void 0 ? false : _d, _e = _a.disabled, disabled = _e === void 0 ? false : _e, _f = _a.autoFocus, autoFocus = _f === void 0 ? false : _f, _g = _a.isIndeterminate, isIndeterminate = _g === void 0 ? false : _g, _h = _a.error, error = _h === void 0 ? false : _h, _j = _a.checkmarkType, checkmarkType = _j === void 0 ? constants_1.STYLE_TYPE.default : _j, _k = _a.onChange, onChange = _k === void 0 ? noop_1.default : _k, _l = _a.onMouseEnter, onMouseEnter = _l === void 0 ? noop_1.default : _l, _m = _a.onMouseLeave, onMouseLeave = _m === void 0 ? noop_1.default : _m, _o = _a.onMouseDown, onMouseDown = _o === void 0 ? noop_1.default : _o, _p = _a.onMouseUp, onMouseUp = _p === void 0 ? noop_1.default : _p, _q = _a.onFocus, onFocus = _q === void 0 ? noop_1.default : _q, _r = _a.onBlur, onBlur = _r === void 0 ? noop_1.default : _r, required = _a.required, _s = _a.labelPlacement, labelPlacement = _s === void 0 ? 'right' : _s, value = _a.value, id = _a.id, name = _a.name, children = _a.children, title = _a.title, _ariaLabel = _a["aria-label"], ariaDescribedby = _a["aria-describedby"], ariaErrormessage = _a["aria-errormessage"], ariaLabel = _a.ariaLabel, inputRef = _a.inputRef, className = _a.className, style = _a.style, _t = _a.size, size = _t === void 0 ? 'md' : _t, _intent = _a.intent, $outlineStyle = _a.$outlineStyle, $outlineColor = _a.$outlineColor, $outlineOffset = _a.$outlineOffset, $outlineWidth = _a.$outlineWidth, dataSpaceweb = _a["data-spaceweb"];
19
+ var _b = _a.overrides, overrides = _b === void 0 ? {} : _b, _c = _a.checked, checked = _c === void 0 ? false : _c, _d = _a.containsInteractiveElement, containsInteractiveElement = _d === void 0 ? false : _d, _e = _a.disabled, disabled = _e === void 0 ? false : _e, _f = _a.autoFocus, autoFocus = _f === void 0 ? false : _f, _g = _a.isIndeterminate, isIndeterminate = _g === void 0 ? false : _g, _h = _a.error, error = _h === void 0 ? false : _h, _j = _a.checkmarkType, checkmarkType = _j === void 0 ? constants_1.STYLE_TYPE.default : _j, _k = _a.onChange, onChange = _k === void 0 ? noop_1.default : _k, _l = _a.onMouseEnter, onMouseEnter = _l === void 0 ? noop_1.default : _l, _m = _a.onMouseLeave, onMouseLeave = _m === void 0 ? noop_1.default : _m, _o = _a.onMouseDown, onMouseDown = _o === void 0 ? noop_1.default : _o, _p = _a.onMouseUp, onMouseUp = _p === void 0 ? noop_1.default : _p, _q = _a.onFocus, onFocus = _q === void 0 ? noop_1.default : _q, _r = _a.onBlur, onBlur = _r === void 0 ? noop_1.default : _r, required = _a.required, _s = _a.labelPlacement, labelPlacement = _s === void 0 ? 'right' : _s, value = _a.value, id = _a.id, name = _a.name, children = _a.children, title = _a.title, _ariaLabel = _a["aria-label"], ariaDescribedby = _a["aria-describedby"], ariaErrormessage = _a["aria-errormessage"], ariaLabel = _a.ariaLabel, inputRef = _a.inputRef, className = _a.className, style = _a.style, _t = _a.size, size = _t === void 0 ? 'md' : _t, _intent = _a.intent, $outlineStyle = _a.$outlineStyle, $outlineColor = _a.$outlineColor, $outlineOffset = _a.$outlineOffset, $outlineWidth = _a.$outlineWidth, dataSpaceweb = _a["data-spaceweb"], restProps = tslib_1.__rest(_a, ["overrides", "checked", "containsInteractiveElement", "disabled", "autoFocus", "isIndeterminate", "error", "checkmarkType", "onChange", "onMouseEnter", "onMouseLeave", "onMouseDown", "onMouseUp", "onFocus", "onBlur", "required", "labelPlacement", "value", "id", "name", "children", "title", 'aria-label', 'aria-describedby', 'aria-errormessage', "ariaLabel", "inputRef", "className", "style", "size", "intent", "$outlineStyle", "$outlineColor", "$outlineOffset", "$outlineWidth", 'data-spaceweb']);
19
20
  var intent = (0, context_1.useContextualFormProps)({
20
21
  intent: _intent,
21
22
  }).intent;
@@ -109,7 +110,7 @@ var Checkbox = function (_a) {
109
110
  };
110
111
  var labelComp = children && ((0, jsx_runtime_1.jsx)(Label, tslib_1.__assign({}, sharedProps, labelProps, { children: containsInteractiveElement ? (
111
112
  // eslint-disable-next-line jsx-a11y/click-events-have-key-events,jsx-a11y/no-static-element-interactions -- prevents the event from bubbling up to the label and moving focus to the radio button
112
- (0, jsx_runtime_1.jsx)("div", tslib_1.__assign({ onClick: function (e) { return e.preventDefault(); } }, { children: children }))) : (children) })));
113
+ (0, jsx_runtime_1.jsx)(box_1.Box, tslib_1.__assign({ onClick: function (e) { return e.preventDefault(); } }, { children: children }))) : (children) })));
113
114
  var getCheckmarkIcon = function () {
114
115
  if (isIndeterminate) {
115
116
  return (0, jsx_runtime_1.jsx)(subtract_1.default, { size: size === 'medium' || size === 'large' ? 10 : 8 });
@@ -133,10 +134,10 @@ var Checkbox = function (_a) {
133
134
  },
134
135
  style,
135
136
  rootProps === null || rootProps === void 0 ? void 0 : rootProps.style,
136
- ], className: [className, rootProps === null || rootProps === void 0 ? void 0 : rootProps.className] }, { children: [(labelPlacement === 'top' || labelPlacement === 'left') && labelComp, checkmarkType === constants_1.STYLE_TYPE.toggle ? ((0, jsx_runtime_1.jsx)(ToggleTrack, tslib_1.__assign({}, sharedProps, toggleTrackProps, { children: (0, jsx_runtime_1.jsx)(Toggle, tslib_1.__assign({}, sharedProps, toggleProps)) }))) : (checkmarkComp), (0, jsx_runtime_1.jsx)(Input, tslib_1.__assign({ value: value, id: id, name: name, checked: checked, required: required, "aria-label": ariaLabel || _ariaLabel, "aria-describedby": ariaDescribedby, "aria-checked": !!checked, "aria-errormessage": ariaErrormessage, "aria-invalid": error || null, "aria-required": required || null, disabled: disabled, type: "checkbox", ref: mergedRef,
137
+ ], className: [className, rootProps === null || rootProps === void 0 ? void 0 : rootProps.className] }, { children: [(labelPlacement === 'top' || labelPlacement === 'left') && labelComp, checkmarkType === constants_1.STYLE_TYPE.toggle ? ((0, jsx_runtime_1.jsx)(ToggleTrack, tslib_1.__assign({}, sharedProps, toggleTrackProps, { children: (0, jsx_runtime_1.jsx)(Toggle, tslib_1.__assign({}, sharedProps, toggleProps)) }))) : (checkmarkComp), (0, jsx_runtime_1.jsx)(Input, tslib_1.__assign({ value: value, id: id, name: name, checked: checked, required: required, disabled: disabled, type: "checkbox", ref: mergedRef,
137
138
  // Prevent a second click event from firing when label is clicked.
138
139
  // See https://github.com/uber/baseweb/issues/3847
139
- onClick: stopPropagation, role: checkmarkType === constants_1.STYLE_TYPE.toggle ? 'switch' : undefined }, sharedProps, inputEvents, inputProps)), (labelPlacement === 'bottom' || labelPlacement === 'right') && labelComp] })));
140
+ onClick: stopPropagation, role: checkmarkType === constants_1.STYLE_TYPE.toggle ? 'switch' : undefined }, restProps, { "aria-label": ariaLabel || _ariaLabel, "aria-describedby": ariaDescribedby, "aria-checked": !!checked, "aria-errormessage": ariaErrormessage, "aria-invalid": error || null, "aria-required": required || null }, sharedProps, inputEvents, inputProps)), (labelPlacement === 'bottom' || labelPlacement === 'right') && labelComp] })));
140
141
  };
141
142
  exports.default = Checkbox;
142
143
  Checkbox.displayName = 'Checkbox';
@@ -1,9 +1,9 @@
1
- import * as React from 'react';
2
- import { SharedProps as BaseSharedProps } from '../baseui/input';
3
- import { OutlineProps } from '../helpers/commonStyles';
4
- import { Override } from '../overrides';
5
- import { Intent, SpacewebComponentProps } from '../types';
6
- import { STYLE_TYPE } from './constants';
1
+ import type * as React from 'react';
2
+ import type { SharedProps as BaseSharedProps } from '../baseui/input';
3
+ import type { OutlineProps } from '../helpers/commonStyles';
4
+ import type { Override } from '../overrides';
5
+ import type { Intent, SpacewebComponentProps } from '../types';
6
+ import type { STYLE_TYPE } from './constants';
7
7
  export type StyleType = keyof typeof STYLE_TYPE;
8
8
  export type LabelPlacement = 'top' | 'right' | 'bottom' | 'left';
9
9
  /** @deprecated */
@@ -39,8 +39,10 @@ export type CheckboxOverrides = {
39
39
  type BaseCheckboxProps = {
40
40
  'aria-describedby'?: string;
41
41
  'aria-errormessage'?: string;
42
+ 'aria-hidden'?: boolean | 'true' | 'false';
42
43
  ariaLabel?: string;
43
44
  'aria-label'?: string;
45
+ tabIndex?: number;
44
46
  children?: React.ReactNode;
45
47
  containsInteractiveElement?: boolean;
46
48
  overrides?: CheckboxOverrides;
@@ -1,7 +1,7 @@
1
1
  import { type ReactElement } from 'react';
2
2
  import { type RGBColor } from 'react-color';
3
3
  import type { CustomColorSelectorProps } from './types';
4
- import { ClassName, Styles } from '../types';
4
+ import type { ClassName, Styles } from '../types';
5
5
  export declare const ColorPreview: ({ color, className, style, }: {
6
6
  color?: RGBColor | undefined;
7
7
  className?: ClassName;
@@ -52,6 +52,12 @@ var CustomEditableInput = function (_a) {
52
52
  var handleChange = (0, react_1.useCallback)(function (data) {
53
53
  typedValue.current = data;
54
54
  }, []);
55
+ (0, react_1.useEffect)(function () {
56
+ // Sync typedValue to value if value changes due to another input being edited
57
+ if (label in typedValue.current && typedValue.current[label] !== value) {
58
+ typedValue.current[label] = value;
59
+ }
60
+ }, [label, value]);
55
61
  (0, react_1.useEffect)(function () {
56
62
  if (!editableInput)
57
63
  return undefined;
@@ -86,21 +92,28 @@ var ColorPickerComponent = function (_props) {
86
92
  // but @types/react-color simply passes the types through CustomPicker as-is
87
93
  // We forward CustomColorSelectorProps to the component signature but internally use InternalCustomColorSelectorProps
88
94
  var props = _props;
89
- var hex = props.hex, rgb = props.rgb, enableAlphaSelector = props.enableAlphaSelector, onChange = props.onChange, onChangeComplete = props.onChangeComplete, renderColorSuggestionPanel = props.renderColorSuggestionPanel;
95
+ var _hex = props.hex, rgb = props.rgb, enableAlphaSelector = props.enableAlphaSelector, onChange = props.onChange, onChangeComplete = props.onChangeComplete, renderColorSuggestionPanel = props.renderColorSuggestionPanel;
90
96
  // Bug in the react-color lib
91
97
  // https://github.com/casesandberg/react-color/blob/bc9a0e1dc5d11b06c511a8e02a95bd85c7129f4b/src/helpers/hue.js#L33
92
98
  // when left === containerWidth it return 360 which return 0 in hsl value the pointer shifts to the left most
93
99
  // color which cause a flickering issue
94
100
  //https://github.com/casesandberg/react-color/blob/bc9a0e1dc5d11b06c511a8e02a95bd85c7129f4b/src/components/sketch/SketchFields.js#L51
95
101
  var _a = rgb !== null && rgb !== void 0 ? rgb : {}, r = _a.r, g = _a.g, b = _a.b, a = _a.a;
102
+ // react-color doesn't support alpha hexes, so we need to insert it ourselves
103
+ var hex = (0, colors_1.normalizeHexWithAlpha)(_hex, a);
104
+ var handleHueChange = (0, react_1.useCallback)(function (data) {
105
+ // If alpha was zero and the saturation/lightness is changed, reset alpha to full
106
+ if ('a' in data && data.a === 0) {
107
+ onChange(tslib_1.__assign(tslib_1.__assign({}, data), { a: 1 }));
108
+ }
109
+ else
110
+ onChange(data);
111
+ }, [onChange]);
96
112
  var handleChange = (0, react_1.useCallback)(function (data) {
97
- var _a;
98
113
  // react-color emitted data is very dynamic and uses properties from labels
99
114
  if ('Hex' in data) {
100
- var hexValue = data.Hex;
101
- var alpha = (_a = (data.A < 100 ? data.A / 100 : a)) !== null && _a !== void 0 ? _a : 1;
102
- var newHex = alpha !== undefined && alpha !== 1 ? hexValue + Math.floor(alpha * 255).toString(16) : hexValue;
103
- var parsedRgba = (0, colors_1.hexToRgb)(newHex);
115
+ var newHex = data.Hex;
116
+ var parsedRgba = (0, colors_1.hexToRgb)(data.Hex);
104
117
  var newRgba = enableAlphaSelector ? parsedRgba : tslib_1.__assign(tslib_1.__assign({}, parsedRgba), { a: 1 }); // No alpha values when enableAlphaSelector is disabled
105
118
  onChange(newRgba);
106
119
  // No need to invoke onChange based on isValidHex as onChange is standard handler for react-color
@@ -109,17 +122,21 @@ var ColorPickerComponent = function (_props) {
109
122
  onChangeComplete({ rgb: newRgba });
110
123
  }
111
124
  else if (data.R || data.G || data.B || data.A) {
125
+ var _a = tslib_1.__read(Object.keys(data), 1), changedKey = _a[0];
126
+ // Reset alpha IF:
127
+ // Changed value is R/G/B AND current alpha is 0 AND new value is different from old value
128
+ var resetAlpha = changedKey !== 'A' && a === 0 && data[changedKey] !== { R: r, G: g, B: b }[changedKey];
112
129
  var newRgba = {
113
130
  r: getNumberWithFallback(data.R, r),
114
131
  g: getNumberWithFallback(data.G, g),
115
132
  b: getNumberWithFallback(data.B, b),
116
- a: enableAlphaSelector ? getNumberWithFallback(data.A, (a !== null && a !== void 0 ? a : 1) * 100) / 100 : 1,
133
+ a: enableAlphaSelector && !resetAlpha ? getNumberWithFallback(data.A, (a !== null && a !== void 0 ? a : 1) * 100) / 100 : 1,
117
134
  };
118
135
  onChange(newRgba);
119
136
  onChangeComplete({ rgb: newRgba });
120
137
  }
121
138
  }, [onChange, onChangeComplete, enableAlphaSelector, r, g, b, a]);
122
- return ((0, jsx_runtime_1.jsxs)(stack_1.Stack, tslib_1.__assign({ direction: "vertical", gap: 4 }, { children: [renderColorSuggestionPanel ? renderColorSuggestionPanel(hex) : null, (0, jsx_runtime_1.jsx)(box_1.Box, tslib_1.__assign({ className: "relative w-full rounded-16 overflow-hidden", style: { height: '150px' } }, { children: (0, jsx_runtime_1.jsx)(common_1.Saturation, tslib_1.__assign({}, props)) })), (0, jsx_runtime_1.jsxs)(stack_1.Stack, tslib_1.__assign({ direction: "vertical", gap: 2 }, { children: [(0, jsx_runtime_1.jsx)(box_1.Box, tslib_1.__assign({ className: "flex gap-2 justify-between ml-2" }, { children: (0, jsx_runtime_1.jsxs)(box_1.Box, tslib_1.__assign({ className: "flex flex-col items-start gap-2" }, { children: [(0, jsx_runtime_1.jsxs)(box_1.Box, tslib_1.__assign({ className: "flex items-center gap-2" }, { children: [(0, jsx_runtime_1.jsx)(box_1.Box, tslib_1.__assign({ className: "relative h-3", style: { width: enableAlphaSelector ? '261px' : '228px' } }, { children: (0, jsx_runtime_1.jsx)(common_1.Hue, tslib_1.__assign({ pointer: CustomPointer, radius: "24px" }, props)) })), (0, jsx_runtime_1.jsx)(exports.ColorPreview, { color: rgb })] })), enableAlphaSelector ? ((0, jsx_runtime_1.jsx)(box_1.Box, tslib_1.__assign({ className: "relative h-3", style: { width: '261px' } }, { children: (0, jsx_runtime_1.jsx)(common_1.Alpha, tslib_1.__assign({ pointer: CustomPointer, radius: "24px", style: { container: { margin: 0 } } }, props)) }))) : null] })) })), (0, jsx_runtime_1.jsxs)(box_1.Box, tslib_1.__assign({ className: "grid w-full gap-2",
139
+ return ((0, jsx_runtime_1.jsxs)(stack_1.Stack, tslib_1.__assign({ direction: "vertical", gap: 4 }, { children: [renderColorSuggestionPanel ? renderColorSuggestionPanel(hex) : null, (0, jsx_runtime_1.jsx)(box_1.Box, tslib_1.__assign({ className: "relative w-full h-32 rounded-16 overflow-hidden", style: { height: '150px' } }, { children: (0, jsx_runtime_1.jsx)(common_1.Saturation, tslib_1.__assign({}, props, { onChange: handleHueChange })) })), (0, jsx_runtime_1.jsxs)(stack_1.Stack, tslib_1.__assign({ direction: "vertical", gap: 2 }, { children: [(0, jsx_runtime_1.jsx)(box_1.Box, tslib_1.__assign({ className: "flex gap-2 justify-between ml-2" }, { children: (0, jsx_runtime_1.jsxs)(box_1.Box, tslib_1.__assign({ className: "flex flex-col items-start gap-2" }, { children: [(0, jsx_runtime_1.jsxs)(box_1.Box, tslib_1.__assign({ className: "flex items-center gap-2" }, { children: [(0, jsx_runtime_1.jsx)(box_1.Box, tslib_1.__assign({ className: "relative h-3", style: { width: enableAlphaSelector ? '261px' : '228px' } }, { children: (0, jsx_runtime_1.jsx)(common_1.Hue, tslib_1.__assign({ pointer: CustomPointer, radius: "24px" }, props, { onChange: handleHueChange })) })), (0, jsx_runtime_1.jsx)(exports.ColorPreview, { color: rgb })] })), enableAlphaSelector ? ((0, jsx_runtime_1.jsx)(box_1.Box, tslib_1.__assign({ className: "relative h-3", style: { width: '261px' } }, { children: (0, jsx_runtime_1.jsx)(common_1.Alpha, tslib_1.__assign({ pointer: CustomPointer, radius: "24px", style: { container: { margin: 0 } } }, props)) }))) : null] })) })), (0, jsx_runtime_1.jsxs)(box_1.Box, tslib_1.__assign({ className: "grid w-full gap-2",
123
140
  // 5 columns with alpha, 4 columns without
124
141
  style: {
125
142
  gridTemplateColumns: "".concat(enableAlphaSelector ? '73' : '99', "fr").concat(' 51fr'.repeat(enableAlphaSelector ? 4 : 3)),
@@ -1,5 +1,5 @@
1
- import { ReactElement } from 'react';
2
- import { InputProps } from '../input';
1
+ import { type ReactElement } from 'react';
2
+ import { type InputProps } from '../input';
3
3
  type DatePickerInputProps = InputProps & {
4
4
  isOpen?: boolean;
5
5
  autoSizeInput?: boolean;
@@ -84,6 +84,7 @@ var DatePickerInput = function (_a) {
84
84
  var $intent = _a.$intent;
85
85
  return (0, classNames_1.default)({
86
86
  'spr-focus-01': isOpen && $intent === 'default',
87
+ 'focus-within:spr-focus-01': $intent === 'default',
87
88
  'w-auto': autoSizeInput,
88
89
  });
89
90
  },
@@ -151,7 +151,7 @@ export declare const useAsyncSelect: ({ loadOptions, initialOptions, resolveSele
151
151
  endEnhancerButtonProps?: import("../../select").SelectEnhancerButtonConfig | undefined;
152
152
  virtual?: boolean | undefined;
153
153
  selectOnTab?: boolean | undefined;
154
- getActionsElement?: import("../../menu").MenuItemActions;
154
+ getActionsElement?: import("../../menu").MenuItemActions | undefined;
155
155
  captureScroll?: boolean | undefined;
156
156
  popoverMinWidth?: string | undefined;
157
157
  createOption?: ((label: string) => import("../../select").Options | Promise<import("../../select").Options>) | undefined;
@@ -329,7 +329,7 @@ export declare const useAsyncSelect: ({ loadOptions, initialOptions, resolveSele
329
329
  endEnhancerButtonProps?: import("../../select").SelectEnhancerButtonConfig | undefined;
330
330
  virtual?: boolean | undefined;
331
331
  selectOnTab?: boolean | undefined;
332
- getActionsElement?: import("../../menu").MenuItemActions;
332
+ getActionsElement?: import("../../menu").MenuItemActions | undefined;
333
333
  captureScroll?: boolean | undefined;
334
334
  overlayWidth?: string | undefined;
335
335
  scrollContainer?: "overlayContainer" | "menuContainer" | undefined;
@@ -510,7 +510,7 @@ export declare const useAsyncSelect: ({ loadOptions, initialOptions, resolveSele
510
510
  endEnhancerButtonProps?: import("../../select").SelectEnhancerButtonConfig | undefined;
511
511
  virtual?: boolean | undefined;
512
512
  selectOnTab?: boolean | undefined;
513
- getActionsElement?: import("../../menu").MenuItemActions;
513
+ getActionsElement?: import("../../menu").MenuItemActions | undefined;
514
514
  captureScroll?: boolean | undefined;
515
515
  overlayWidth?: string | undefined;
516
516
  scrollContainer?: "overlayContainer" | "menuContainer" | undefined;
@@ -119,7 +119,7 @@ export declare const useGroupedAsyncSelect: ({ onChange, showSelectAll, selectAl
119
119
  endEnhancerButtonProps?: import("../../select").SelectEnhancerButtonConfig | undefined;
120
120
  virtual?: boolean | undefined;
121
121
  selectOnTab?: boolean | undefined;
122
- getActionsElement?: import("../../menu").MenuItemActions;
122
+ getActionsElement?: import("../../menu").MenuItemActions | undefined;
123
123
  captureScroll?: boolean | undefined;
124
124
  popoverMinWidth?: string | undefined;
125
125
  createOption?: ((label: string) => import("../../select").Options | Promise<import("../../select").Options>) | undefined;
@@ -265,7 +265,7 @@ export declare const useGroupedAsyncSelect: ({ onChange, showSelectAll, selectAl
265
265
  endEnhancerButtonProps?: import("../../select").SelectEnhancerButtonConfig | undefined;
266
266
  virtual?: boolean | undefined;
267
267
  selectOnTab?: boolean | undefined;
268
- getActionsElement?: import("../../menu").MenuItemActions;
268
+ getActionsElement?: import("../../menu").MenuItemActions | undefined;
269
269
  captureScroll?: boolean | undefined;
270
270
  overlayWidth?: string | undefined;
271
271
  popoverMinWidth?: string | undefined;
@@ -413,7 +413,7 @@ export declare const useGroupedAsyncSelect: ({ onChange, showSelectAll, selectAl
413
413
  endEnhancerButtonProps?: import("../../select").SelectEnhancerButtonConfig | undefined;
414
414
  virtual?: boolean | undefined;
415
415
  selectOnTab?: boolean | undefined;
416
- getActionsElement?: import("../../menu").MenuItemActions;
416
+ getActionsElement?: import("../../menu").MenuItemActions | undefined;
417
417
  captureScroll?: boolean | undefined;
418
418
  overlayWidth?: string | undefined;
419
419
  popoverMinWidth?: string | undefined;
@@ -46,7 +46,7 @@ export var StyledCalendarHeader = styled('div', 'box-border spr-text-primary ite
46
46
  return ($density === DENSITY.high ? 'min-h-6.5 w-full' : 'min-h-9 w-98');
47
47
  });
48
48
  StyledCalendarHeader.displayName = 'StyledCalendarHeader';
49
- export var StyledMonthHeader = styled('div', 'spr-text-01 spr-bg-primary px-1 whitespace-no-wrap border-0 border-b-1 spr-border-secondary border-b-solid spr-text-primary block text-center flex justify-center');
49
+ export var StyledMonthHeader = styled('div', 'spr-text-01 spr-bg-primary px-1 whitespace-nowrap border-0 border-b-1 spr-border-secondary border-b-solid spr-text-primary block text-center flex justify-center');
50
50
  StyledMonthHeader.displayName = 'StyledMonthHeader';
51
51
  export var StyledMonthYearSelectButton = styled('button', 'px-2 gap-1 items-center justify-around flex cursor-pointer spr-bg-primary spr-text-01 h-8', 'border-1 spr-border-primary rounded-8 outline-none focus-visible:outline focus-visible:outline-2 focus-visible:outline-[--spr-focus-01]');
52
52
  StyledMonthYearSelectButton.displayName = 'StyledMonthYearSelectButton';
@@ -54,7 +54,7 @@ export var StyledMonthYearSelectIconContainer = styled('span', 'flex items-cente
54
54
  StyledMonthYearSelectIconContainer.displayName = 'StyledMonthYearSelectIconContainer';
55
55
  export var StyledMonth = styled('div', 'inline-block w-full');
56
56
  StyledMonth.displayName = 'StyledMonth';
57
- export var StyledWeek = styled('div', 'mb-0.5 justify-center flex w-full whitespace-no-wrap');
57
+ export var StyledWeek = styled('div', 'mb-0.5 justify-center flex w-full whitespace-nowrap');
58
58
  StyledWeek.displayName = 'StyledWeek';
59
59
  // @ts-ignore
60
60
  function generateDayStyles(defaultCode, defaultStyle) {
@@ -1,6 +1,6 @@
1
1
  import type { CheckboxProps } from './types';
2
2
  declare const Checkbox: {
3
- ({ overrides, checked, containsInteractiveElement, disabled, autoFocus, isIndeterminate, error, checkmarkType, onChange, onMouseEnter, onMouseLeave, onMouseDown, onMouseUp, onFocus, onBlur, required, labelPlacement, value, id, name, children, title, "aria-label": _ariaLabel, "aria-describedby": ariaDescribedby, "aria-errormessage": ariaErrormessage, ariaLabel, inputRef, className, style, size, intent: _intent, $outlineStyle, $outlineColor, $outlineOffset, $outlineWidth, "data-spaceweb": dataSpaceweb, }: CheckboxProps): import("react/jsx-runtime").JSX.Element;
3
+ ({ overrides, checked, containsInteractiveElement, disabled, autoFocus, isIndeterminate, error, checkmarkType, onChange, onMouseEnter, onMouseLeave, onMouseDown, onMouseUp, onFocus, onBlur, required, labelPlacement, value, id, name, children, title, "aria-label": _ariaLabel, "aria-describedby": ariaDescribedby, "aria-errormessage": ariaErrormessage, ariaLabel, inputRef, className, style, size, intent: _intent, $outlineStyle, $outlineColor, $outlineOffset, $outlineWidth, "data-spaceweb": dataSpaceweb, ...restProps }: CheckboxProps): import("react/jsx-runtime").JSX.Element;
4
4
  displayName: string;
5
5
  __standard: string;
6
6
  };
@@ -1,4 +1,4 @@
1
- import { __assign, __read } from "tslib";
1
+ import { __assign, __read, __rest } from "tslib";
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import { getCheckmarkBackgroundColor, getCheckmarkBorderColor, getTrackBackgroundColor, getTrackBorderColor, StyledCheckmark, StyledInput, StyledLabel, StyledRoot, StyledToggle, StyledToggleTrack, } from './styled-components';
4
4
  import { STYLE_TYPE } from './constants';
@@ -11,9 +11,10 @@ import { useContextualFormProps } from '../form-control/context';
11
11
  import { useStyle } from '../style';
12
12
  import Tick from '../icon/components/tick';
13
13
  import Indeterminate from '../icon/components/subtract';
14
+ import { Box } from '../box';
14
15
  var stopPropagation = function (e) { return e.stopPropagation(); };
15
16
  var Checkbox = function (_a) {
16
- var _b = _a.overrides, overrides = _b === void 0 ? {} : _b, _c = _a.checked, checked = _c === void 0 ? false : _c, _d = _a.containsInteractiveElement, containsInteractiveElement = _d === void 0 ? false : _d, _e = _a.disabled, disabled = _e === void 0 ? false : _e, _f = _a.autoFocus, autoFocus = _f === void 0 ? false : _f, _g = _a.isIndeterminate, isIndeterminate = _g === void 0 ? false : _g, _h = _a.error, error = _h === void 0 ? false : _h, _j = _a.checkmarkType, checkmarkType = _j === void 0 ? STYLE_TYPE.default : _j, _k = _a.onChange, onChange = _k === void 0 ? _noop : _k, _l = _a.onMouseEnter, onMouseEnter = _l === void 0 ? _noop : _l, _m = _a.onMouseLeave, onMouseLeave = _m === void 0 ? _noop : _m, _o = _a.onMouseDown, onMouseDown = _o === void 0 ? _noop : _o, _p = _a.onMouseUp, onMouseUp = _p === void 0 ? _noop : _p, _q = _a.onFocus, onFocus = _q === void 0 ? _noop : _q, _r = _a.onBlur, onBlur = _r === void 0 ? _noop : _r, required = _a.required, _s = _a.labelPlacement, labelPlacement = _s === void 0 ? 'right' : _s, value = _a.value, id = _a.id, name = _a.name, children = _a.children, title = _a.title, _ariaLabel = _a["aria-label"], ariaDescribedby = _a["aria-describedby"], ariaErrormessage = _a["aria-errormessage"], ariaLabel = _a.ariaLabel, inputRef = _a.inputRef, className = _a.className, style = _a.style, _t = _a.size, size = _t === void 0 ? 'md' : _t, _intent = _a.intent, $outlineStyle = _a.$outlineStyle, $outlineColor = _a.$outlineColor, $outlineOffset = _a.$outlineOffset, $outlineWidth = _a.$outlineWidth, dataSpaceweb = _a["data-spaceweb"];
17
+ var _b = _a.overrides, overrides = _b === void 0 ? {} : _b, _c = _a.checked, checked = _c === void 0 ? false : _c, _d = _a.containsInteractiveElement, containsInteractiveElement = _d === void 0 ? false : _d, _e = _a.disabled, disabled = _e === void 0 ? false : _e, _f = _a.autoFocus, autoFocus = _f === void 0 ? false : _f, _g = _a.isIndeterminate, isIndeterminate = _g === void 0 ? false : _g, _h = _a.error, error = _h === void 0 ? false : _h, _j = _a.checkmarkType, checkmarkType = _j === void 0 ? STYLE_TYPE.default : _j, _k = _a.onChange, onChange = _k === void 0 ? _noop : _k, _l = _a.onMouseEnter, onMouseEnter = _l === void 0 ? _noop : _l, _m = _a.onMouseLeave, onMouseLeave = _m === void 0 ? _noop : _m, _o = _a.onMouseDown, onMouseDown = _o === void 0 ? _noop : _o, _p = _a.onMouseUp, onMouseUp = _p === void 0 ? _noop : _p, _q = _a.onFocus, onFocus = _q === void 0 ? _noop : _q, _r = _a.onBlur, onBlur = _r === void 0 ? _noop : _r, required = _a.required, _s = _a.labelPlacement, labelPlacement = _s === void 0 ? 'right' : _s, value = _a.value, id = _a.id, name = _a.name, children = _a.children, title = _a.title, _ariaLabel = _a["aria-label"], ariaDescribedby = _a["aria-describedby"], ariaErrormessage = _a["aria-errormessage"], ariaLabel = _a.ariaLabel, inputRef = _a.inputRef, className = _a.className, style = _a.style, _t = _a.size, size = _t === void 0 ? 'md' : _t, _intent = _a.intent, $outlineStyle = _a.$outlineStyle, $outlineColor = _a.$outlineColor, $outlineOffset = _a.$outlineOffset, $outlineWidth = _a.$outlineWidth, dataSpaceweb = _a["data-spaceweb"], restProps = __rest(_a, ["overrides", "checked", "containsInteractiveElement", "disabled", "autoFocus", "isIndeterminate", "error", "checkmarkType", "onChange", "onMouseEnter", "onMouseLeave", "onMouseDown", "onMouseUp", "onFocus", "onBlur", "required", "labelPlacement", "value", "id", "name", "children", "title", 'aria-label', 'aria-describedby', 'aria-errormessage', "ariaLabel", "inputRef", "className", "style", "size", "intent", "$outlineStyle", "$outlineColor", "$outlineOffset", "$outlineWidth", 'data-spaceweb']);
17
18
  var intent = useContextualFormProps({
18
19
  intent: _intent,
19
20
  }).intent;
@@ -107,7 +108,7 @@ var Checkbox = function (_a) {
107
108
  };
108
109
  var labelComp = children && (_jsx(Label, __assign({}, sharedProps, labelProps, { children: containsInteractiveElement ? (
109
110
  // eslint-disable-next-line jsx-a11y/click-events-have-key-events,jsx-a11y/no-static-element-interactions -- prevents the event from bubbling up to the label and moving focus to the radio button
110
- _jsx("div", __assign({ onClick: function (e) { return e.preventDefault(); } }, { children: children }))) : (children) })));
111
+ _jsx(Box, __assign({ onClick: function (e) { return e.preventDefault(); } }, { children: children }))) : (children) })));
111
112
  var getCheckmarkIcon = function () {
112
113
  if (isIndeterminate) {
113
114
  return _jsx(Indeterminate, { size: size === 'medium' || size === 'large' ? 10 : 8 });
@@ -131,10 +132,10 @@ var Checkbox = function (_a) {
131
132
  },
132
133
  style,
133
134
  rootProps === null || rootProps === void 0 ? void 0 : rootProps.style,
134
- ], className: [className, rootProps === null || rootProps === void 0 ? void 0 : rootProps.className] }, { children: [(labelPlacement === 'top' || labelPlacement === 'left') && labelComp, checkmarkType === STYLE_TYPE.toggle ? (_jsx(ToggleTrack, __assign({}, sharedProps, toggleTrackProps, { children: _jsx(Toggle, __assign({}, sharedProps, toggleProps)) }))) : (checkmarkComp), _jsx(Input, __assign({ value: value, id: id, name: name, checked: checked, required: required, "aria-label": ariaLabel || _ariaLabel, "aria-describedby": ariaDescribedby, "aria-checked": !!checked, "aria-errormessage": ariaErrormessage, "aria-invalid": error || null, "aria-required": required || null, disabled: disabled, type: "checkbox", ref: mergedRef,
135
+ ], className: [className, rootProps === null || rootProps === void 0 ? void 0 : rootProps.className] }, { children: [(labelPlacement === 'top' || labelPlacement === 'left') && labelComp, checkmarkType === STYLE_TYPE.toggle ? (_jsx(ToggleTrack, __assign({}, sharedProps, toggleTrackProps, { children: _jsx(Toggle, __assign({}, sharedProps, toggleProps)) }))) : (checkmarkComp), _jsx(Input, __assign({ value: value, id: id, name: name, checked: checked, required: required, disabled: disabled, type: "checkbox", ref: mergedRef,
135
136
  // Prevent a second click event from firing when label is clicked.
136
137
  // See https://github.com/uber/baseweb/issues/3847
137
- onClick: stopPropagation, role: checkmarkType === STYLE_TYPE.toggle ? 'switch' : undefined }, sharedProps, inputEvents, inputProps)), (labelPlacement === 'bottom' || labelPlacement === 'right') && labelComp] })));
138
+ onClick: stopPropagation, role: checkmarkType === STYLE_TYPE.toggle ? 'switch' : undefined }, restProps, { "aria-label": ariaLabel || _ariaLabel, "aria-describedby": ariaDescribedby, "aria-checked": !!checked, "aria-errormessage": ariaErrormessage, "aria-invalid": error || null, "aria-required": required || null }, sharedProps, inputEvents, inputProps)), (labelPlacement === 'bottom' || labelPlacement === 'right') && labelComp] })));
138
139
  };
139
140
  export default Checkbox;
140
141
  Checkbox.displayName = 'Checkbox';
@@ -1,9 +1,9 @@
1
- import * as React from 'react';
2
- import { SharedProps as BaseSharedProps } from '../baseui/input';
3
- import { OutlineProps } from '../helpers/commonStyles';
4
- import { Override } from '../overrides';
5
- import { Intent, SpacewebComponentProps } from '../types';
6
- import { STYLE_TYPE } from './constants';
1
+ import type * as React from 'react';
2
+ import type { SharedProps as BaseSharedProps } from '../baseui/input';
3
+ import type { OutlineProps } from '../helpers/commonStyles';
4
+ import type { Override } from '../overrides';
5
+ import type { Intent, SpacewebComponentProps } from '../types';
6
+ import type { STYLE_TYPE } from './constants';
7
7
  export type StyleType = keyof typeof STYLE_TYPE;
8
8
  export type LabelPlacement = 'top' | 'right' | 'bottom' | 'left';
9
9
  /** @deprecated */
@@ -39,8 +39,10 @@ export type CheckboxOverrides = {
39
39
  type BaseCheckboxProps = {
40
40
  'aria-describedby'?: string;
41
41
  'aria-errormessage'?: string;
42
+ 'aria-hidden'?: boolean | 'true' | 'false';
42
43
  ariaLabel?: string;
43
44
  'aria-label'?: string;
45
+ tabIndex?: number;
44
46
  children?: React.ReactNode;
45
47
  containsInteractiveElement?: boolean;
46
48
  overrides?: CheckboxOverrides;
@@ -1,7 +1,7 @@
1
1
  import { type ReactElement } from 'react';
2
2
  import { type RGBColor } from 'react-color';
3
3
  import type { CustomColorSelectorProps } from './types';
4
- import { ClassName, Styles } from '../types';
4
+ import type { ClassName, Styles } from '../types';
5
5
  export declare const ColorPreview: ({ color, className, style, }: {
6
6
  color?: RGBColor | undefined;
7
7
  className?: ClassName;
@@ -5,7 +5,7 @@ import { CustomPicker } from 'react-color';
5
5
  import { Alpha, EditableInput, Hue, Saturation } from 'react-color/lib/components/common';
6
6
  import { Stack } from '../stack';
7
7
  import { Box } from '../box';
8
- import { hexToRgb, isValidHex } from '../helpers/colors';
8
+ import { hexToRgb, isValidHex, normalizeHexWithAlpha } from '../helpers/colors';
9
9
  import TransparentBackground from '../icon/components/transparentBackground';
10
10
  var CustomPointer = function () { return (_jsx(Box, { style: function (_a) {
11
11
  var rtlCompatible = _a.rtlCompatible;
@@ -48,6 +48,12 @@ var CustomEditableInput = function (_a) {
48
48
  var handleChange = useCallback(function (data) {
49
49
  typedValue.current = data;
50
50
  }, []);
51
+ useEffect(function () {
52
+ // Sync typedValue to value if value changes due to another input being edited
53
+ if (label in typedValue.current && typedValue.current[label] !== value) {
54
+ typedValue.current[label] = value;
55
+ }
56
+ }, [label, value]);
51
57
  useEffect(function () {
52
58
  if (!editableInput)
53
59
  return undefined;
@@ -82,21 +88,28 @@ var ColorPickerComponent = function (_props) {
82
88
  // but @types/react-color simply passes the types through CustomPicker as-is
83
89
  // We forward CustomColorSelectorProps to the component signature but internally use InternalCustomColorSelectorProps
84
90
  var props = _props;
85
- var hex = props.hex, rgb = props.rgb, enableAlphaSelector = props.enableAlphaSelector, onChange = props.onChange, onChangeComplete = props.onChangeComplete, renderColorSuggestionPanel = props.renderColorSuggestionPanel;
91
+ var _hex = props.hex, rgb = props.rgb, enableAlphaSelector = props.enableAlphaSelector, onChange = props.onChange, onChangeComplete = props.onChangeComplete, renderColorSuggestionPanel = props.renderColorSuggestionPanel;
86
92
  // Bug in the react-color lib
87
93
  // https://github.com/casesandberg/react-color/blob/bc9a0e1dc5d11b06c511a8e02a95bd85c7129f4b/src/helpers/hue.js#L33
88
94
  // when left === containerWidth it return 360 which return 0 in hsl value the pointer shifts to the left most
89
95
  // color which cause a flickering issue
90
96
  //https://github.com/casesandberg/react-color/blob/bc9a0e1dc5d11b06c511a8e02a95bd85c7129f4b/src/components/sketch/SketchFields.js#L51
91
97
  var _a = rgb !== null && rgb !== void 0 ? rgb : {}, r = _a.r, g = _a.g, b = _a.b, a = _a.a;
98
+ // react-color doesn't support alpha hexes, so we need to insert it ourselves
99
+ var hex = normalizeHexWithAlpha(_hex, a);
100
+ var handleHueChange = useCallback(function (data) {
101
+ // If alpha was zero and the saturation/lightness is changed, reset alpha to full
102
+ if ('a' in data && data.a === 0) {
103
+ onChange(__assign(__assign({}, data), { a: 1 }));
104
+ }
105
+ else
106
+ onChange(data);
107
+ }, [onChange]);
92
108
  var handleChange = useCallback(function (data) {
93
- var _a;
94
109
  // react-color emitted data is very dynamic and uses properties from labels
95
110
  if ('Hex' in data) {
96
- var hexValue = data.Hex;
97
- var alpha = (_a = (data.A < 100 ? data.A / 100 : a)) !== null && _a !== void 0 ? _a : 1;
98
- var newHex = alpha !== undefined && alpha !== 1 ? hexValue + Math.floor(alpha * 255).toString(16) : hexValue;
99
- var parsedRgba = hexToRgb(newHex);
111
+ var newHex = data.Hex;
112
+ var parsedRgba = hexToRgb(data.Hex);
100
113
  var newRgba = enableAlphaSelector ? parsedRgba : __assign(__assign({}, parsedRgba), { a: 1 }); // No alpha values when enableAlphaSelector is disabled
101
114
  onChange(newRgba);
102
115
  // No need to invoke onChange based on isValidHex as onChange is standard handler for react-color
@@ -105,17 +118,21 @@ var ColorPickerComponent = function (_props) {
105
118
  onChangeComplete({ rgb: newRgba });
106
119
  }
107
120
  else if (data.R || data.G || data.B || data.A) {
121
+ var _a = __read(Object.keys(data), 1), changedKey = _a[0];
122
+ // Reset alpha IF:
123
+ // Changed value is R/G/B AND current alpha is 0 AND new value is different from old value
124
+ var resetAlpha = changedKey !== 'A' && a === 0 && data[changedKey] !== { R: r, G: g, B: b }[changedKey];
108
125
  var newRgba = {
109
126
  r: getNumberWithFallback(data.R, r),
110
127
  g: getNumberWithFallback(data.G, g),
111
128
  b: getNumberWithFallback(data.B, b),
112
- a: enableAlphaSelector ? getNumberWithFallback(data.A, (a !== null && a !== void 0 ? a : 1) * 100) / 100 : 1,
129
+ a: enableAlphaSelector && !resetAlpha ? getNumberWithFallback(data.A, (a !== null && a !== void 0 ? a : 1) * 100) / 100 : 1,
113
130
  };
114
131
  onChange(newRgba);
115
132
  onChangeComplete({ rgb: newRgba });
116
133
  }
117
134
  }, [onChange, onChangeComplete, enableAlphaSelector, r, g, b, a]);
118
- return (_jsxs(Stack, __assign({ direction: "vertical", gap: 4 }, { children: [renderColorSuggestionPanel ? renderColorSuggestionPanel(hex) : null, _jsx(Box, __assign({ className: "relative w-full rounded-16 overflow-hidden", style: { height: '150px' } }, { children: _jsx(Saturation, __assign({}, props)) })), _jsxs(Stack, __assign({ direction: "vertical", gap: 2 }, { children: [_jsx(Box, __assign({ className: "flex gap-2 justify-between ml-2" }, { children: _jsxs(Box, __assign({ className: "flex flex-col items-start gap-2" }, { children: [_jsxs(Box, __assign({ className: "flex items-center gap-2" }, { children: [_jsx(Box, __assign({ className: "relative h-3", style: { width: enableAlphaSelector ? '261px' : '228px' } }, { children: _jsx(Hue, __assign({ pointer: CustomPointer, radius: "24px" }, props)) })), _jsx(ColorPreview, { color: rgb })] })), enableAlphaSelector ? (_jsx(Box, __assign({ className: "relative h-3", style: { width: '261px' } }, { children: _jsx(Alpha, __assign({ pointer: CustomPointer, radius: "24px", style: { container: { margin: 0 } } }, props)) }))) : null] })) })), _jsxs(Box, __assign({ className: "grid w-full gap-2",
135
+ return (_jsxs(Stack, __assign({ direction: "vertical", gap: 4 }, { children: [renderColorSuggestionPanel ? renderColorSuggestionPanel(hex) : null, _jsx(Box, __assign({ className: "relative w-full h-32 rounded-16 overflow-hidden", style: { height: '150px' } }, { children: _jsx(Saturation, __assign({}, props, { onChange: handleHueChange })) })), _jsxs(Stack, __assign({ direction: "vertical", gap: 2 }, { children: [_jsx(Box, __assign({ className: "flex gap-2 justify-between ml-2" }, { children: _jsxs(Box, __assign({ className: "flex flex-col items-start gap-2" }, { children: [_jsxs(Box, __assign({ className: "flex items-center gap-2" }, { children: [_jsx(Box, __assign({ className: "relative h-3", style: { width: enableAlphaSelector ? '261px' : '228px' } }, { children: _jsx(Hue, __assign({ pointer: CustomPointer, radius: "24px" }, props, { onChange: handleHueChange })) })), _jsx(ColorPreview, { color: rgb })] })), enableAlphaSelector ? (_jsx(Box, __assign({ className: "relative h-3", style: { width: '261px' } }, { children: _jsx(Alpha, __assign({ pointer: CustomPointer, radius: "24px", style: { container: { margin: 0 } } }, props)) }))) : null] })) })), _jsxs(Box, __assign({ className: "grid w-full gap-2",
119
136
  // 5 columns with alpha, 4 columns without
120
137
  style: {
121
138
  gridTemplateColumns: "".concat(enableAlphaSelector ? '73' : '99', "fr").concat(' 51fr'.repeat(enableAlphaSelector ? 4 : 3)),
@@ -1,5 +1,5 @@
1
- import { ReactElement } from 'react';
2
- import { InputProps } from '../input';
1
+ import { type ReactElement } from 'react';
2
+ import { type InputProps } from '../input';
3
3
  type DatePickerInputProps = InputProps & {
4
4
  isOpen?: boolean;
5
5
  autoSizeInput?: boolean;
@@ -79,6 +79,7 @@ var DatePickerInput = function (_a) {
79
79
  var $intent = _a.$intent;
80
80
  return cx({
81
81
  'spr-focus-01': isOpen && $intent === 'default',
82
+ 'focus-within:spr-focus-01': $intent === 'default',
82
83
  'w-auto': autoSizeInput,
83
84
  });
84
85
  },
@@ -16,3 +16,4 @@ export declare function getContrastRatio(color1: string, color2: string): number
16
16
  export declare function RgbToHsl({ r, g, b, a }: RGBColor): HSLA;
17
17
  export declare function HslToRgb(hsl: HSLA): RGBColor;
18
18
  export declare function noAlphaHex(inputHex?: string): string | undefined;
19
+ export declare function normalizeHexWithAlpha<T extends string | undefined>(hex: T, alpha: number | undefined): T;
@@ -14,18 +14,19 @@ export var isValidHex = function (hex) {
14
14
  * @return {{r, g, b, a}} an object with rgba
15
15
  */
16
16
  export function hexToRgb(_hex) {
17
- var hex = _hex.replace(/^#?/, '#');
17
+ var hex = _hex.replace(/^#?/, '');
18
18
  if (!isValidHex(hex))
19
19
  return { r: 0, g: 0, b: 0 };
20
20
  var isShortHand = hex.length === 3 || hex.length === 4;
21
- var r = parseInt(isShortHand ? hex.substring(1, 2).repeat(2) : hex.substring(1, 3), 16);
22
- var g = parseInt(isShortHand ? hex.substring(2, 3).repeat(2) : hex.substring(3, 5), 16);
23
- var b = parseInt(isShortHand ? hex.substring(3, 4).repeat(2) : hex.substring(5, 7), 16);
24
- var a = parseInt(isShortHand ? hex.substring(4, 5).repeat(2) : hex.substring(7, 9), 16);
21
+ var r = parseInt(isShortHand ? hex.substring(0, 1).repeat(2) : hex.substring(0, 2), 16);
22
+ var g = parseInt(isShortHand ? hex.substring(1, 2).repeat(2) : hex.substring(2, 4), 16);
23
+ var b = parseInt(isShortHand ? hex.substring(2, 3).repeat(2) : hex.substring(4, 6), 16);
24
+ var a = parseInt(isShortHand ? hex.substring(3, 4).repeat(2) : hex.substring(6, 8), 16);
25
25
  return __assign({ r: r, g: g, b: b }, (a < 255 ? { a: a / 255 } : undefined));
26
26
  }
27
27
  export function RgbToHex(_a) {
28
28
  var r = _a.r, g = _a.g, b = _a.b, a = _a.a;
29
+ // eslint-disable-next-line react-google-translate/no-return-text-nodes -- This isn't a React Element
29
30
  return "#".concat(__spreadArray([r, g, b], __read((a < 1 ? [Math.round(a * 255)] : [])), false).map(function (n) { return (Number.isNaN(n) ? 10 : Math.round(Math.min(Math.max(n, 0), 255))).toString(16).padStart(2, '0'); })
30
31
  .join(''));
31
32
  }
@@ -84,3 +85,11 @@ export function noAlphaHex(inputHex) {
84
85
  return inputHex.slice(0, -2);
85
86
  return inputHex;
86
87
  }
88
+ export function normalizeHexWithAlpha(hex, alpha) {
89
+ if (typeof alpha !== 'number' || alpha === 1 || !hex)
90
+ return hex;
91
+ return (hex +
92
+ Math.floor(alpha * 255)
93
+ .toString(16)
94
+ .padStart(2, '0'));
95
+ }
@@ -6,6 +6,7 @@ declare const _default: React.MemoExoticComponent<React.ForwardRefExoticComponen
6
6
  } & {
7
7
  children?: React.ReactNode;
8
8
  virtual?: boolean | undefined;
9
+ keepFirstItemMounted?: boolean | undefined;
9
10
  overrides?: {
10
11
  Root?: import("../overrides").Override<Record<string, any>> | undefined;
11
12
  } | undefined;