@sprinklrjs/spaceweb 14.14.0 → 14.14.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 (51) hide show
  1. package/banner/banner.js +4 -4
  2. package/color-picker/CustomColorSelector.js +25 -15
  3. package/color-picker/constants.d.ts +3 -0
  4. package/color-picker/constants.js +3 -1
  5. package/date-picker/StatelessDatePicker.js +10 -8
  6. package/esm/banner/banner.js +3 -3
  7. package/esm/color-picker/CustomColorSelector.js +26 -16
  8. package/esm/color-picker/constants.d.ts +3 -0
  9. package/esm/color-picker/constants.js +2 -0
  10. package/esm/date-picker/StatelessDatePicker.js +10 -8
  11. package/esm/form-control/form-control.js +3 -3
  12. package/esm/helpers/colors.d.ts +1 -0
  13. package/esm/helpers/colors.js +14 -2
  14. package/esm/icon/components/{alert-solid.d.ts → error-solid.d.ts} +1 -1
  15. package/esm/icon/components/error-solid.js +8 -0
  16. package/{icon/components/alert-solid.d.ts → esm/icon/components/warning-clr.d.ts} +1 -1
  17. package/esm/icon/components/warning-clr.js +8 -0
  18. package/esm/modal/modal.d.ts +3 -3
  19. package/esm/modal/modal.js +3 -3
  20. package/esm/progressSteps/step.js +2 -2
  21. package/esm/snackbar/constants.js +3 -3
  22. package/esm/time-range-picker/RangeSelectorContainer.js +2 -4
  23. package/form-control/form-control.js +4 -4
  24. package/helpers/colors.d.ts +1 -0
  25. package/helpers/colors.js +16 -3
  26. package/{esm/icon/components/alert.d.ts → icon/components/error-solid.d.ts} +1 -1
  27. package/icon/components/{alert-solid.js → error-solid.js} +3 -3
  28. package/{esm/icon/components/error.d.ts → icon/components/warning-clr.d.ts} +1 -1
  29. package/icon/components/warning-clr.js +11 -0
  30. package/modal/modal.d.ts +3 -3
  31. package/modal/modal.js +4 -4
  32. package/package.json +2 -2
  33. package/progressSteps/step.js +2 -2
  34. package/snackbar/constants.js +4 -4
  35. package/time-range-picker/RangeSelectorContainer.js +3 -5
  36. package/tsconfig.build.tsbuildinfo +1 -1
  37. package/esm/icon/components/alert-solid.js +0 -8
  38. package/esm/icon/components/alert.js +0 -8
  39. package/esm/icon/components/error-clr.d.ts +0 -3
  40. package/esm/icon/components/error-clr.js +0 -8
  41. package/esm/icon/components/error.js +0 -8
  42. package/esm/icon/components/warning-solid.d.ts +0 -3
  43. package/esm/icon/components/warning-solid.js +0 -8
  44. package/icon/components/alert.d.ts +0 -3
  45. package/icon/components/alert.js +0 -11
  46. package/icon/components/error-clr.d.ts +0 -3
  47. package/icon/components/error-clr.js +0 -11
  48. package/icon/components/error.d.ts +0 -3
  49. package/icon/components/error.js +0 -11
  50. package/icon/components/warning-solid.d.ts +0 -3
  51. package/icon/components/warning-solid.js +0 -11
package/banner/banner.js CHANGED
@@ -11,8 +11,8 @@ var button_1 = require("../button");
11
11
  var typography_1 = require("../typography");
12
12
  var base_button_1 = require("../base-button");
13
13
  // icons
14
- var warning_solid_1 = tslib_1.__importDefault(require("../icon/components/warning-solid"));
15
- var alert_solid_1 = tslib_1.__importDefault(require("../icon/components/alert-solid"));
14
+ var warning_clr_1 = tslib_1.__importDefault(require("../icon/components/warning-clr"));
15
+ var error_solid_1 = tslib_1.__importDefault(require("../icon/components/error-solid"));
16
16
  var info_circle_1 = tslib_1.__importDefault(require("../icon/components/info-circle"));
17
17
  var tickCircle_solid_1 = tslib_1.__importDefault(require("../icon/components/tickCircle-solid"));
18
18
  var close_1 = tslib_1.__importDefault(require("../icon/components/close"));
@@ -29,8 +29,8 @@ var styled_components_1 = require("../link/styled-components");
29
29
  var cvaConfig_1 = require("./cvaConfig");
30
30
  var box_1 = require("../box");
31
31
  var intentToIconMap = {
32
- error: { BaseIcon: alert_solid_1.default },
33
- warning: { BaseIcon: warning_solid_1.default },
32
+ error: { BaseIcon: error_solid_1.default },
33
+ warning: { BaseIcon: warning_clr_1.default },
34
34
  success: { BaseIcon: tickCircle_solid_1.default },
35
35
  info: { BaseIcon: info_circle_1.default },
36
36
  };
@@ -10,6 +10,7 @@ var stack_1 = require("../stack");
10
10
  var box_1 = require("../box");
11
11
  var colors_1 = require("../helpers/colors");
12
12
  var transparentBackground_1 = tslib_1.__importDefault(require("../icon/components/transparentBackground"));
13
+ var constants_1 = require("./constants");
13
14
  var CustomPointer = function () { return ((0, jsx_runtime_1.jsx)(box_1.Box, { style: function (_a) {
14
15
  var rtlCompatible = _a.rtlCompatible;
15
16
  return rtlCompatible({ transform: 'translate(-50%, -2px)' });
@@ -64,6 +65,11 @@ var CustomEditableInput = function (_a) {
64
65
  // @ts-ignore -- @types/react-color doesn't properly include types for input
65
66
  var input = editableInput.input;
66
67
  var fireChange = function () {
68
+ var inputValue = input.value;
69
+ if (inputValue === String(value))
70
+ return;
71
+ if (label === 'Hex' && (0, colors_1.normalizeHex)(inputValue) === (0, colors_1.normalizeHex)(String(value)))
72
+ return;
67
73
  onChange(typedValue.current);
68
74
  };
69
75
  var keydownHandler = function (event) {
@@ -76,16 +82,15 @@ var CustomEditableInput = function (_a) {
76
82
  input.removeEventListener('blur', fireChange);
77
83
  input.removeEventListener('keydown', keydownHandler);
78
84
  };
79
- }, [editableInput, label, onChange]);
85
+ }, [editableInput, label, onChange, value]);
80
86
  return ((0, jsx_runtime_1.jsx)(common_1.EditableInput, { style: EDITABLE_INPUT_STYLES, label: label, value: value, onChange: handleChange, ref: setInput }));
81
87
  };
82
88
  function getNumberWithFallback(input, fallback) {
83
- var _fallback = fallback !== null && fallback !== void 0 ? fallback : 0;
84
- if (!input)
85
- return _fallback;
86
- if (Number.isNaN(+input))
87
- return _fallback;
88
- return parseInt(input);
89
+ if (fallback === void 0) { fallback = 0; }
90
+ var trimmedInput = input === null || input === void 0 ? void 0 : input.trim();
91
+ if (!trimmedInput || Number.isNaN(+trimmedInput))
92
+ return fallback;
93
+ return parseInt(trimmedInput);
89
94
  }
90
95
  var ColorPickerComponent = function (_props) {
91
96
  // react-color intercepts the onChange function, wraps the data, and forwards it accordingly
@@ -99,8 +104,9 @@ var ColorPickerComponent = function (_props) {
99
104
  // color which cause a flickering issue
100
105
  //https://github.com/casesandberg/react-color/blob/bc9a0e1dc5d11b06c511a8e02a95bd85c7129f4b/src/components/sketch/SketchFields.js#L51
101
106
  var _a = rgb !== null && rgb !== void 0 ? rgb : {}, r = _a.r, g = _a.g, b = _a.b, a = _a.a;
107
+ var hexInput = (_hex === null || _hex === void 0 ? void 0 : _hex.toLowerCase()) === 'transparent' ? '#000000' : _hex;
102
108
  // react-color doesn't support alpha hexes, so we need to insert it ourselves
103
- var hex = (0, colors_1.normalizeHexWithAlpha)(_hex, a);
109
+ var hex = (0, colors_1.normalizeHexWithAlpha)(hexInput, a);
104
110
  var handleHueChange = (0, react_1.useCallback)(function (data) {
105
111
  // If alpha was zero and the saturation/lightness is changed, reset alpha to full
106
112
  if ('a' in data && data.a === 0) {
@@ -113,15 +119,19 @@ var ColorPickerComponent = function (_props) {
113
119
  // react-color emitted data is very dynamic and uses properties from labels
114
120
  if ('Hex' in data) {
115
121
  var newHex = data.Hex;
116
- var parsedRgba = (0, colors_1.hexToRgb)(data.Hex);
122
+ if (newHex.toLowerCase() === 'transparent' && hex !== constants_1.TRANSPARENT_HEX) {
123
+ onChange(constants_1.TRANSPARENT_RGBA);
124
+ onChangeComplete({ rgb: constants_1.TRANSPARENT_RGBA });
125
+ return;
126
+ }
127
+ if (!(0, colors_1.isValidHex)(newHex))
128
+ return;
129
+ var parsedRgba = (0, colors_1.hexToRgb)(newHex);
117
130
  var newRgba = enableAlphaSelector ? parsedRgba : tslib_1.__assign(tslib_1.__assign({}, parsedRgba), { a: 1 }); // No alpha values when enableAlphaSelector is disabled
118
131
  onChange(newRgba);
119
- // No need to invoke onChange based on isValidHex as onChange is standard handler for react-color
120
- // CustomPicker HOC takes care that onChange is invoked with correct values in case of invalid value of rgba.
121
- if ((0, colors_1.isValidHex)(newHex))
122
- onChangeComplete({ rgb: newRgba });
132
+ onChangeComplete({ rgb: newRgba });
123
133
  }
124
- else if (data.R || data.G || data.B || data.A) {
134
+ else if ('R' in data || 'G' in data || 'B' in data || 'A' in data) {
125
135
  var _a = tslib_1.__read(Object.keys(data), 1), changedKey = _a[0];
126
136
  // Reset alpha IF:
127
137
  // Changed value is R/G/B AND current alpha is 0 AND new value is different from old value
@@ -135,7 +145,7 @@ var ColorPickerComponent = function (_props) {
135
145
  onChange(newRgba);
136
146
  onChangeComplete({ rgb: newRgba });
137
147
  }
138
- }, [onChange, onChangeComplete, enableAlphaSelector, r, g, b, a]);
148
+ }, [onChange, onChangeComplete, enableAlphaSelector, r, g, b, a, hex]);
139
149
  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",
140
150
  // 5 columns with alpha, 4 columns without
141
151
  style: {
@@ -1,3 +1,4 @@
1
+ import type { RGBColor } from 'react-color';
1
2
  export declare const GRADIENT_TYPE: {
2
3
  LINEAR: string;
3
4
  RADIAL: string;
@@ -12,3 +13,5 @@ export declare const COLOR_TYPE: {
12
13
  readonly GRADIENT: "gradient";
13
14
  };
14
15
  export declare const SWATCHES_PER_ROW = 10;
16
+ export declare const TRANSPARENT_HEX = "#00000000";
17
+ export declare const TRANSPARENT_RGBA: RGBColor;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SWATCHES_PER_ROW = exports.COLOR_TYPE = exports.TAB_IDS = exports.GRADIENT_TYPE = void 0;
3
+ exports.TRANSPARENT_RGBA = exports.TRANSPARENT_HEX = exports.SWATCHES_PER_ROW = exports.COLOR_TYPE = exports.TAB_IDS = exports.GRADIENT_TYPE = void 0;
4
4
  exports.GRADIENT_TYPE = {
5
5
  LINEAR: 'linear',
6
6
  RADIAL: 'radial',
@@ -11,3 +11,5 @@ exports.COLOR_TYPE = {
11
11
  GRADIENT: 'gradient',
12
12
  };
13
13
  exports.SWATCHES_PER_ROW = 10;
14
+ exports.TRANSPARENT_HEX = '#00000000';
15
+ exports.TRANSPARENT_RGBA = { r: 0, g: 0, b: 0, a: 0 };
@@ -27,9 +27,9 @@ var themeHelpers_1 = require("../helpers/themeHelpers");
27
27
  var style_1 = require("../style");
28
28
  // eslint-disable-next-line max-statements -- required for function component
29
29
  var StatelessDatePicker = function (_props) {
30
- var _a, _b, _c;
30
+ var _a, _b, _c, _d;
31
31
  var theme = (0, style_1.useStyle)().theme;
32
- var _d = (0, context_1.useContextualFormProps)(_props), onChange = _d.onChange, onBlur = _d.onBlur, _e = _d.adapter, adapter = _e === void 0 ? date_fns_adapter_1.default : _e, _f = _d.size, size = _f === void 0 ? (0, themeHelpers_1.getDefaultSize)(theme) : _f, _g = _d.formatString, formatString = _g === void 0 ? constants_1.DEFAULT_FORMAT_STRING : _g, _h = _d.isOpen, isOpen = _h === void 0 ? false : _h, onFocus = _d.onFocus, clearable = _d.clearable, _displayValueAtRangeIndex = _d.displayValueAtRangeIndex, _j = _d.variant, variant = _j === void 0 ? 'default' : _j, overrides = _d.overrides, intent = _d.intent, _value = _d.value, formatDisplayValue = _d.formatDisplayValue, _k = _d.autoSizeInput, autoSizeInput = _k === void 0 ? false : _k, weekStartsOn = _d.weekStartsOn, _l = _d.timezone, timezone = _l === void 0 ? (0, getSystemTzName_1.getSystemTzName)() : _l, _m = _d.showTimezone, showTimezone = _m === void 0 ? false : _m, timezoneOptions = _d.timezoneOptions, props = tslib_1.__rest(_d, ["onChange", "onBlur", "adapter", "size", "formatString", "isOpen", "onFocus", "clearable", "displayValueAtRangeIndex", "variant", "overrides", "intent", "value", "formatDisplayValue", "autoSizeInput", "weekStartsOn", "timezone", "showTimezone", "timezoneOptions"]);
32
+ var _e = (0, context_1.useContextualFormProps)(_props), onChange = _e.onChange, onBlur = _e.onBlur, _f = _e.adapter, adapter = _f === void 0 ? date_fns_adapter_1.default : _f, _g = _e.size, size = _g === void 0 ? (0, themeHelpers_1.getDefaultSize)(theme) : _g, _h = _e.formatString, formatString = _h === void 0 ? constants_1.DEFAULT_FORMAT_STRING : _h, _j = _e.isOpen, isOpen = _j === void 0 ? false : _j, onFocus = _e.onFocus, clearable = _e.clearable, _displayValueAtRangeIndex = _e.displayValueAtRangeIndex, _k = _e.variant, variant = _k === void 0 ? 'default' : _k, overrides = _e.overrides, intent = _e.intent, _value = _e.value, formatDisplayValue = _e.formatDisplayValue, _l = _e.autoSizeInput, autoSizeInput = _l === void 0 ? false : _l, weekStartsOn = _e.weekStartsOn, _m = _e.timezone, timezone = _m === void 0 ? (0, getSystemTzName_1.getSystemTzName)() : _m, _o = _e.showTimezone, showTimezone = _o === void 0 ? false : _o, timezoneOptions = _e.timezoneOptions, props = tslib_1.__rest(_e, ["onChange", "onBlur", "adapter", "size", "formatString", "isOpen", "onFocus", "clearable", "displayValueAtRangeIndex", "variant", "overrides", "intent", "value", "formatDisplayValue", "autoSizeInput", "weekStartsOn", "timezone", "showTimezone", "timezoneOptions"]);
33
33
  var locale = (0, locale_1.useLocale)();
34
34
  var dateHelpers = React.useMemo(function () { return new date_helpers_1.default(adapter); }, [adapter]);
35
35
  var dateFnsLocale = React.useMemo(function () { return (0, utils_1.prepareLocale)(props.locale, { weekStartsOn: weekStartsOn }); }, [weekStartsOn, props.locale]);
@@ -44,8 +44,8 @@ var StatelessDatePicker = function (_props) {
44
44
  }, [_value, timezone, timezoneOptions]);
45
45
  // this state is required for a11y of calendar, this will be set to true when user first press down arrow key on opened calendar
46
46
  // and we will set this to false when calendar will be closed.
47
- var _o = tslib_1.__read(React.useState(false), 2), autoFocusCalendar = _o[0], setAutoFocusCalendar = _o[1];
48
- var _p = tslib_1.__read(React.useState(false), 2), error = _p[0], setError = _p[1];
47
+ var _p = tslib_1.__read(React.useState(false), 2), autoFocusCalendar = _p[0], setAutoFocusCalendar = _p[1];
48
+ var _q = tslib_1.__read(React.useState(false), 2), error = _q[0], setError = _q[1];
49
49
  React.useEffect(function () {
50
50
  var _a = (0, utils_2.getMinMaxDateInTimezone)({
51
51
  maxDate: props.maxDate,
@@ -61,7 +61,9 @@ var StatelessDatePicker = function (_props) {
61
61
  }
62
62
  }, [value, props.minDate, props.maxDate, dateHelpers, timezone, timezoneOptions]);
63
63
  var screenReaderMsgId = (0, useUniqueId_1.default)();
64
- var _q = props["aria-describedby"], ariaDescribedBy = _q === void 0 ? "datepicker--screenreader--message--input-".concat(screenReaderMsgId) : _q;
64
+ var screenReaderMsgDescribedById = "datepicker--screenreader--message--input-".concat(screenReaderMsgId);
65
+ var baseAriaDescribedBy = (_a = props['aria-describedby']) !== null && _a !== void 0 ? _a : '';
66
+ var ariaDescribedBy = "".concat(screenReaderMsgDescribedById, " ").concat(baseAriaDescribedBy).trim();
65
67
  var defaultFormatDisplayValue = React.useCallback(function (date) {
66
68
  var normalizedFormatString = (0, utils_1.normalizeDashes)(formatString);
67
69
  if (formatDisplayValue) {
@@ -140,11 +142,11 @@ var StatelessDatePicker = function (_props) {
140
142
  var _r = tslib_1.__read((0, overrides_1.useOverrides)(mergedOverrides === null || mergedOverrides === void 0 ? void 0 : mergedOverrides.Input, DatePickerInput_1.default), 2), InputComponent = _r[0], inputProps = _r[1];
141
143
  var _s = tslib_1.__read((0, overrides_1.useOverrides)(mergedOverrides === null || mergedOverrides === void 0 ? void 0 : mergedOverrides.Popover, popover_2.Popover), 2), PopoverComponent = _s[0], popoverProps = _s[1];
142
144
  var _t = tslib_1.__read((0, overrides_1.useOverrides)(mergedOverrides === null || mergedOverrides === void 0 ? void 0 : mergedOverrides.InputWrapper, styled_components_1.StyledInputWrapper), 2), InputWrapper = _t[0], inputWrapperProps = _t[1];
143
- var placeholder = (_a = props.placeholder) !== null && _a !== void 0 ? _a : formatString.toLowerCase();
145
+ var placeholder = (_b = props.placeholder) !== null && _b !== void 0 ? _b : formatString.toLowerCase();
144
146
  // if calendar is close, open it on click otherwise close the calendar
145
147
  var popoverHandleClick = isOpen ? onBlur : onFocus;
146
- return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(PopoverComponent, tslib_1.__assign({ accessibilityType: "none", focusLock: true, returnFocus: true, mountNode: props.mountNode, placement: popover_1.PLACEMENT.auto, isOpen: isOpen, onClickOutside: onClose, onEsc: onClose, showArrow: false, triggerType: "click", onClick: props.disabled ? noop_1.default : popoverHandleClick, content: (0, jsx_runtime_1.jsx)(DatePickerContent_1.DatePickerContent, tslib_1.__assign({}, props, { value: value, onChange: handleDateChange, overrides: mergedOverrides, autoFocusCalendar: autoFocusCalendar, onClose: onClose, formatString: formatString, adapter: adapter, locale: dateFnsLocale, showTimezone: showTimezone, timezone: timezone, timezoneOptions: timezoneOptions, formatDisplayValue: defaultFormatDisplayValue })) }, popoverProps, { children: (0, jsx_runtime_1.jsx)(InputWrapper, tslib_1.__assign({}, inputWrapperProps, { children: (0, jsx_runtime_1.jsx)(InputComponent, tslib_1.__assign({ id: props.id, "aria-disabled": props.disabled, "aria-label": (_b = props['aria-label']) !== null && _b !== void 0 ? _b : locale.timeRangePicker.ariaLabel, "aria-describedby": ariaDescribedBy, "aria-labelledby": props['aria-labelledby'], "aria-invalid": props['aria-invalid'], "aria-errormessage": props['aria-errormessage'], "aria-required": (_c = props.required) !== null && _c !== void 0 ? _c : props['aria-required'], disabled: props.disabled, size: size, variant: variant, intent: error ? 'error' : intent, value: displayValue,
148
+ return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(PopoverComponent, tslib_1.__assign({ accessibilityType: "none", focusLock: true, returnFocus: true, mountNode: props.mountNode, placement: popover_1.PLACEMENT.auto, isOpen: isOpen, onClickOutside: onClose, onEsc: onClose, showArrow: false, triggerType: "click", onClick: props.disabled ? noop_1.default : popoverHandleClick, content: (0, jsx_runtime_1.jsx)(DatePickerContent_1.DatePickerContent, tslib_1.__assign({}, props, { value: value, onChange: handleDateChange, overrides: mergedOverrides, autoFocusCalendar: autoFocusCalendar, onClose: onClose, formatString: formatString, adapter: adapter, locale: dateFnsLocale, showTimezone: showTimezone, timezone: timezone, timezoneOptions: timezoneOptions, formatDisplayValue: defaultFormatDisplayValue })) }, popoverProps, { children: (0, jsx_runtime_1.jsx)(InputWrapper, tslib_1.__assign({}, inputWrapperProps, { children: (0, jsx_runtime_1.jsx)(InputComponent, tslib_1.__assign({ id: props.id, "aria-disabled": props.disabled, "aria-label": (_c = props['aria-label']) !== null && _c !== void 0 ? _c : locale.timeRangePicker.ariaLabel, "aria-describedby": ariaDescribedBy, "aria-labelledby": props['aria-labelledby'], "aria-invalid": props['aria-invalid'], "aria-errormessage": props['aria-errormessage'], "aria-required": (_d = props.required) !== null && _d !== void 0 ? _d : props['aria-required'], disabled: props.disabled, size: size, variant: variant, intent: error ? 'error' : intent, value: displayValue,
147
149
  // onFocus={onFocus}
148
- onKeyDown: handleKeyDown, onChange: handleInputChange, placeholder: placeholder, required: props.required, clearable: clearable, isOpen: isOpen, autoSizeInput: autoSizeInput }, inputProps)) })) })), (0, jsx_runtime_1.jsxs)(box_1.Box, tslib_1.__assign({ className: "relative" }, { children: [(0, jsx_runtime_1.jsx)(typography_1.Typography, tslib_1.__assign({ id: ariaDescribedBy, className: "sr-only" }, { children: locale.timeRangePicker.screenReaderMessageInput })), (0, jsx_runtime_1.jsx)(typography_1.Typography, tslib_1.__assign({ "aria-live": "assertive", className: "sr-only" }, { children: dateAriaLabel }))] }))] }));
150
+ onKeyDown: handleKeyDown, onChange: handleInputChange, placeholder: placeholder, required: props.required, clearable: clearable, isOpen: isOpen, autoSizeInput: autoSizeInput }, inputProps)) })) })), (0, jsx_runtime_1.jsxs)(box_1.Box, tslib_1.__assign({ className: "relative" }, { children: [(0, jsx_runtime_1.jsx)(typography_1.Typography, tslib_1.__assign({ id: screenReaderMsgDescribedById, className: "sr-only" }, { children: locale.timeRangePicker.screenReaderMessageInput })), (0, jsx_runtime_1.jsx)(typography_1.Typography, tslib_1.__assign({ "aria-live": "assertive", className: "sr-only" }, { children: dateAriaLabel }))] }))] }));
149
151
  };
150
152
  exports.StatelessDatePicker = StatelessDatePicker;
@@ -9,8 +9,8 @@ import { IconButton } from '../button';
9
9
  import { Typography } from '../typography';
10
10
  import { BaseButton } from '../base-button';
11
11
  // icons
12
- import WarningIcon from '../icon/components/warning-solid';
13
- import AlertIcon from '../icon/components/alert-solid';
12
+ import WarningIcon from '../icon/components/warning-clr';
13
+ import ErrorIcon from '../icon/components/error-solid';
14
14
  import InfoCircle from '../icon/components/info-circle';
15
15
  import TickCircleIcon from '../icon/components/tickCircle-solid';
16
16
  import CloseIcon from '../icon/components/close';
@@ -27,7 +27,7 @@ import { linkStyles } from '../link/styled-components';
27
27
  import { bannerIconFillColor } from './cvaConfig';
28
28
  import { Box } from '../box';
29
29
  var intentToIconMap = {
30
- error: { BaseIcon: AlertIcon },
30
+ error: { BaseIcon: ErrorIcon },
31
31
  warning: { BaseIcon: WarningIcon },
32
32
  success: { BaseIcon: TickCircleIcon },
33
33
  info: { BaseIcon: InfoCircle },
@@ -5,8 +5,9 @@ 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, normalizeHexWithAlpha } from '../helpers/colors';
8
+ import { hexToRgb, isValidHex, normalizeHexWithAlpha, normalizeHex } from '../helpers/colors';
9
9
  import TransparentBackground from '../icon/components/transparentBackground';
10
+ import { TRANSPARENT_HEX, TRANSPARENT_RGBA } from './constants';
10
11
  var CustomPointer = function () { return (_jsx(Box, { style: function (_a) {
11
12
  var rtlCompatible = _a.rtlCompatible;
12
13
  return rtlCompatible({ transform: 'translate(-50%, -2px)' });
@@ -60,6 +61,11 @@ var CustomEditableInput = function (_a) {
60
61
  // @ts-ignore -- @types/react-color doesn't properly include types for input
61
62
  var input = editableInput.input;
62
63
  var fireChange = function () {
64
+ var inputValue = input.value;
65
+ if (inputValue === String(value))
66
+ return;
67
+ if (label === 'Hex' && normalizeHex(inputValue) === normalizeHex(String(value)))
68
+ return;
63
69
  onChange(typedValue.current);
64
70
  };
65
71
  var keydownHandler = function (event) {
@@ -72,16 +78,15 @@ var CustomEditableInput = function (_a) {
72
78
  input.removeEventListener('blur', fireChange);
73
79
  input.removeEventListener('keydown', keydownHandler);
74
80
  };
75
- }, [editableInput, label, onChange]);
81
+ }, [editableInput, label, onChange, value]);
76
82
  return (_jsx(EditableInput, { style: EDITABLE_INPUT_STYLES, label: label, value: value, onChange: handleChange, ref: setInput }));
77
83
  };
78
84
  function getNumberWithFallback(input, fallback) {
79
- var _fallback = fallback !== null && fallback !== void 0 ? fallback : 0;
80
- if (!input)
81
- return _fallback;
82
- if (Number.isNaN(+input))
83
- return _fallback;
84
- return parseInt(input);
85
+ if (fallback === void 0) { fallback = 0; }
86
+ var trimmedInput = input === null || input === void 0 ? void 0 : input.trim();
87
+ if (!trimmedInput || Number.isNaN(+trimmedInput))
88
+ return fallback;
89
+ return parseInt(trimmedInput);
85
90
  }
86
91
  var ColorPickerComponent = function (_props) {
87
92
  // react-color intercepts the onChange function, wraps the data, and forwards it accordingly
@@ -95,8 +100,9 @@ var ColorPickerComponent = function (_props) {
95
100
  // color which cause a flickering issue
96
101
  //https://github.com/casesandberg/react-color/blob/bc9a0e1dc5d11b06c511a8e02a95bd85c7129f4b/src/components/sketch/SketchFields.js#L51
97
102
  var _a = rgb !== null && rgb !== void 0 ? rgb : {}, r = _a.r, g = _a.g, b = _a.b, a = _a.a;
103
+ var hexInput = (_hex === null || _hex === void 0 ? void 0 : _hex.toLowerCase()) === 'transparent' ? '#000000' : _hex;
98
104
  // react-color doesn't support alpha hexes, so we need to insert it ourselves
99
- var hex = normalizeHexWithAlpha(_hex, a);
105
+ var hex = normalizeHexWithAlpha(hexInput, a);
100
106
  var handleHueChange = useCallback(function (data) {
101
107
  // If alpha was zero and the saturation/lightness is changed, reset alpha to full
102
108
  if ('a' in data && data.a === 0) {
@@ -109,15 +115,19 @@ var ColorPickerComponent = function (_props) {
109
115
  // react-color emitted data is very dynamic and uses properties from labels
110
116
  if ('Hex' in data) {
111
117
  var newHex = data.Hex;
112
- var parsedRgba = hexToRgb(data.Hex);
118
+ if (newHex.toLowerCase() === 'transparent' && hex !== TRANSPARENT_HEX) {
119
+ onChange(TRANSPARENT_RGBA);
120
+ onChangeComplete({ rgb: TRANSPARENT_RGBA });
121
+ return;
122
+ }
123
+ if (!isValidHex(newHex))
124
+ return;
125
+ var parsedRgba = hexToRgb(newHex);
113
126
  var newRgba = enableAlphaSelector ? parsedRgba : __assign(__assign({}, parsedRgba), { a: 1 }); // No alpha values when enableAlphaSelector is disabled
114
127
  onChange(newRgba);
115
- // No need to invoke onChange based on isValidHex as onChange is standard handler for react-color
116
- // CustomPicker HOC takes care that onChange is invoked with correct values in case of invalid value of rgba.
117
- if (isValidHex(newHex))
118
- onChangeComplete({ rgb: newRgba });
128
+ onChangeComplete({ rgb: newRgba });
119
129
  }
120
- else if (data.R || data.G || data.B || data.A) {
130
+ else if ('R' in data || 'G' in data || 'B' in data || 'A' in data) {
121
131
  var _a = __read(Object.keys(data), 1), changedKey = _a[0];
122
132
  // Reset alpha IF:
123
133
  // Changed value is R/G/B AND current alpha is 0 AND new value is different from old value
@@ -131,7 +141,7 @@ var ColorPickerComponent = function (_props) {
131
141
  onChange(newRgba);
132
142
  onChangeComplete({ rgb: newRgba });
133
143
  }
134
- }, [onChange, onChangeComplete, enableAlphaSelector, r, g, b, a]);
144
+ }, [onChange, onChangeComplete, enableAlphaSelector, r, g, b, a, hex]);
135
145
  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",
136
146
  // 5 columns with alpha, 4 columns without
137
147
  style: {
@@ -1,3 +1,4 @@
1
+ import type { RGBColor } from 'react-color';
1
2
  export declare const GRADIENT_TYPE: {
2
3
  LINEAR: string;
3
4
  RADIAL: string;
@@ -12,3 +13,5 @@ export declare const COLOR_TYPE: {
12
13
  readonly GRADIENT: "gradient";
13
14
  };
14
15
  export declare const SWATCHES_PER_ROW = 10;
16
+ export declare const TRANSPARENT_HEX = "#00000000";
17
+ export declare const TRANSPARENT_RGBA: RGBColor;
@@ -8,3 +8,5 @@ export var COLOR_TYPE = {
8
8
  GRADIENT: 'gradient',
9
9
  };
10
10
  export var SWATCHES_PER_ROW = 10;
11
+ export var TRANSPARENT_HEX = '#00000000';
12
+ export var TRANSPARENT_RGBA = { r: 0, g: 0, b: 0, a: 0 };
@@ -24,9 +24,9 @@ import { getDefaultSize } from '../helpers/themeHelpers';
24
24
  import { useStyle } from '../style';
25
25
  // eslint-disable-next-line max-statements -- required for function component
26
26
  export var StatelessDatePicker = function (_props) {
27
- var _a, _b, _c;
27
+ var _a, _b, _c, _d;
28
28
  var theme = useStyle().theme;
29
- var _d = useContextualFormProps(_props), onChange = _d.onChange, onBlur = _d.onBlur, _e = _d.adapter, adapter = _e === void 0 ? dateFnsAdapter : _e, _f = _d.size, size = _f === void 0 ? getDefaultSize(theme) : _f, _g = _d.formatString, formatString = _g === void 0 ? DEFAULT_FORMAT_STRING : _g, _h = _d.isOpen, isOpen = _h === void 0 ? false : _h, onFocus = _d.onFocus, clearable = _d.clearable, _displayValueAtRangeIndex = _d.displayValueAtRangeIndex, _j = _d.variant, variant = _j === void 0 ? 'default' : _j, overrides = _d.overrides, intent = _d.intent, _value = _d.value, formatDisplayValue = _d.formatDisplayValue, _k = _d.autoSizeInput, autoSizeInput = _k === void 0 ? false : _k, weekStartsOn = _d.weekStartsOn, _l = _d.timezone, timezone = _l === void 0 ? getSystemTzName() : _l, _m = _d.showTimezone, showTimezone = _m === void 0 ? false : _m, timezoneOptions = _d.timezoneOptions, props = __rest(_d, ["onChange", "onBlur", "adapter", "size", "formatString", "isOpen", "onFocus", "clearable", "displayValueAtRangeIndex", "variant", "overrides", "intent", "value", "formatDisplayValue", "autoSizeInput", "weekStartsOn", "timezone", "showTimezone", "timezoneOptions"]);
29
+ var _e = useContextualFormProps(_props), onChange = _e.onChange, onBlur = _e.onBlur, _f = _e.adapter, adapter = _f === void 0 ? dateFnsAdapter : _f, _g = _e.size, size = _g === void 0 ? getDefaultSize(theme) : _g, _h = _e.formatString, formatString = _h === void 0 ? DEFAULT_FORMAT_STRING : _h, _j = _e.isOpen, isOpen = _j === void 0 ? false : _j, onFocus = _e.onFocus, clearable = _e.clearable, _displayValueAtRangeIndex = _e.displayValueAtRangeIndex, _k = _e.variant, variant = _k === void 0 ? 'default' : _k, overrides = _e.overrides, intent = _e.intent, _value = _e.value, formatDisplayValue = _e.formatDisplayValue, _l = _e.autoSizeInput, autoSizeInput = _l === void 0 ? false : _l, weekStartsOn = _e.weekStartsOn, _m = _e.timezone, timezone = _m === void 0 ? getSystemTzName() : _m, _o = _e.showTimezone, showTimezone = _o === void 0 ? false : _o, timezoneOptions = _e.timezoneOptions, props = __rest(_e, ["onChange", "onBlur", "adapter", "size", "formatString", "isOpen", "onFocus", "clearable", "displayValueAtRangeIndex", "variant", "overrides", "intent", "value", "formatDisplayValue", "autoSizeInput", "weekStartsOn", "timezone", "showTimezone", "timezoneOptions"]);
30
30
  var locale = useLocale();
31
31
  var dateHelpers = React.useMemo(function () { return new DateHelpers(adapter); }, [adapter]);
32
32
  var dateFnsLocale = React.useMemo(function () { return prepareLocale(props.locale, { weekStartsOn: weekStartsOn }); }, [weekStartsOn, props.locale]);
@@ -41,8 +41,8 @@ export var StatelessDatePicker = function (_props) {
41
41
  }, [_value, timezone, timezoneOptions]);
42
42
  // this state is required for a11y of calendar, this will be set to true when user first press down arrow key on opened calendar
43
43
  // and we will set this to false when calendar will be closed.
44
- var _o = __read(React.useState(false), 2), autoFocusCalendar = _o[0], setAutoFocusCalendar = _o[1];
45
- var _p = __read(React.useState(false), 2), error = _p[0], setError = _p[1];
44
+ var _p = __read(React.useState(false), 2), autoFocusCalendar = _p[0], setAutoFocusCalendar = _p[1];
45
+ var _q = __read(React.useState(false), 2), error = _q[0], setError = _q[1];
46
46
  React.useEffect(function () {
47
47
  var _a = getMinMaxDateInTimezone({
48
48
  maxDate: props.maxDate,
@@ -58,7 +58,9 @@ export var StatelessDatePicker = function (_props) {
58
58
  }
59
59
  }, [value, props.minDate, props.maxDate, dateHelpers, timezone, timezoneOptions]);
60
60
  var screenReaderMsgId = useUniqueId();
61
- var _q = props["aria-describedby"], ariaDescribedBy = _q === void 0 ? "datepicker--screenreader--message--input-".concat(screenReaderMsgId) : _q;
61
+ var screenReaderMsgDescribedById = "datepicker--screenreader--message--input-".concat(screenReaderMsgId);
62
+ var baseAriaDescribedBy = (_a = props['aria-describedby']) !== null && _a !== void 0 ? _a : '';
63
+ var ariaDescribedBy = "".concat(screenReaderMsgDescribedById, " ").concat(baseAriaDescribedBy).trim();
62
64
  var defaultFormatDisplayValue = React.useCallback(function (date) {
63
65
  var normalizedFormatString = normalizeDashes(formatString);
64
66
  if (formatDisplayValue) {
@@ -137,10 +139,10 @@ export var StatelessDatePicker = function (_props) {
137
139
  var _r = __read(useOverrides(mergedOverrides === null || mergedOverrides === void 0 ? void 0 : mergedOverrides.Input, DatePickerInput), 2), InputComponent = _r[0], inputProps = _r[1];
138
140
  var _s = __read(useOverrides(mergedOverrides === null || mergedOverrides === void 0 ? void 0 : mergedOverrides.Popover, Popover), 2), PopoverComponent = _s[0], popoverProps = _s[1];
139
141
  var _t = __read(useOverrides(mergedOverrides === null || mergedOverrides === void 0 ? void 0 : mergedOverrides.InputWrapper, StyledInputWrapper), 2), InputWrapper = _t[0], inputWrapperProps = _t[1];
140
- var placeholder = (_a = props.placeholder) !== null && _a !== void 0 ? _a : formatString.toLowerCase();
142
+ var placeholder = (_b = props.placeholder) !== null && _b !== void 0 ? _b : formatString.toLowerCase();
141
143
  // if calendar is close, open it on click otherwise close the calendar
142
144
  var popoverHandleClick = isOpen ? onBlur : onFocus;
143
- return (_jsxs(_Fragment, { children: [_jsx(PopoverComponent, __assign({ accessibilityType: "none", focusLock: true, returnFocus: true, mountNode: props.mountNode, placement: PLACEMENT.auto, isOpen: isOpen, onClickOutside: onClose, onEsc: onClose, showArrow: false, triggerType: "click", onClick: props.disabled ? _noop : popoverHandleClick, content: _jsx(DatePickerContent, __assign({}, props, { value: value, onChange: handleDateChange, overrides: mergedOverrides, autoFocusCalendar: autoFocusCalendar, onClose: onClose, formatString: formatString, adapter: adapter, locale: dateFnsLocale, showTimezone: showTimezone, timezone: timezone, timezoneOptions: timezoneOptions, formatDisplayValue: defaultFormatDisplayValue })) }, popoverProps, { children: _jsx(InputWrapper, __assign({}, inputWrapperProps, { children: _jsx(InputComponent, __assign({ id: props.id, "aria-disabled": props.disabled, "aria-label": (_b = props['aria-label']) !== null && _b !== void 0 ? _b : locale.timeRangePicker.ariaLabel, "aria-describedby": ariaDescribedBy, "aria-labelledby": props['aria-labelledby'], "aria-invalid": props['aria-invalid'], "aria-errormessage": props['aria-errormessage'], "aria-required": (_c = props.required) !== null && _c !== void 0 ? _c : props['aria-required'], disabled: props.disabled, size: size, variant: variant, intent: error ? 'error' : intent, value: displayValue,
145
+ return (_jsxs(_Fragment, { children: [_jsx(PopoverComponent, __assign({ accessibilityType: "none", focusLock: true, returnFocus: true, mountNode: props.mountNode, placement: PLACEMENT.auto, isOpen: isOpen, onClickOutside: onClose, onEsc: onClose, showArrow: false, triggerType: "click", onClick: props.disabled ? _noop : popoverHandleClick, content: _jsx(DatePickerContent, __assign({}, props, { value: value, onChange: handleDateChange, overrides: mergedOverrides, autoFocusCalendar: autoFocusCalendar, onClose: onClose, formatString: formatString, adapter: adapter, locale: dateFnsLocale, showTimezone: showTimezone, timezone: timezone, timezoneOptions: timezoneOptions, formatDisplayValue: defaultFormatDisplayValue })) }, popoverProps, { children: _jsx(InputWrapper, __assign({}, inputWrapperProps, { children: _jsx(InputComponent, __assign({ id: props.id, "aria-disabled": props.disabled, "aria-label": (_c = props['aria-label']) !== null && _c !== void 0 ? _c : locale.timeRangePicker.ariaLabel, "aria-describedby": ariaDescribedBy, "aria-labelledby": props['aria-labelledby'], "aria-invalid": props['aria-invalid'], "aria-errormessage": props['aria-errormessage'], "aria-required": (_d = props.required) !== null && _d !== void 0 ? _d : props['aria-required'], disabled: props.disabled, size: size, variant: variant, intent: error ? 'error' : intent, value: displayValue,
144
146
  // onFocus={onFocus}
145
- onKeyDown: handleKeyDown, onChange: handleInputChange, placeholder: placeholder, required: props.required, clearable: clearable, isOpen: isOpen, autoSizeInput: autoSizeInput }, inputProps)) })) })), _jsxs(Box, __assign({ className: "relative" }, { children: [_jsx(Typography, __assign({ id: ariaDescribedBy, className: "sr-only" }, { children: locale.timeRangePicker.screenReaderMessageInput })), _jsx(Typography, __assign({ "aria-live": "assertive", className: "sr-only" }, { children: dateAriaLabel }))] }))] }));
147
+ onKeyDown: handleKeyDown, onChange: handleInputChange, placeholder: placeholder, required: props.required, clearable: clearable, isOpen: isOpen, autoSizeInput: autoSizeInput }, inputProps)) })) })), _jsxs(Box, __assign({ className: "relative" }, { children: [_jsx(Typography, __assign({ id: screenReaderMsgDescribedById, className: "sr-only" }, { children: locale.timeRangePicker.screenReaderMessageInput })), _jsx(Typography, __assign({ "aria-live": "assertive", className: "sr-only" }, { children: dateAriaLabel }))] }))] }));
146
148
  };
@@ -7,8 +7,8 @@ import { add$props } from '../helpers';
7
7
  import { Stack, StackItem } from '../stack';
8
8
  import { Box } from '../box';
9
9
  import InfoIcon from './info-icon';
10
- import WarningIcon from '../icon/components/warning-solid';
11
- import AlertIcon from '../icon/components/alert-solid';
10
+ import WarningIcon from '../icon/components/warning-clr';
11
+ import ErrorIcon from '../icon/components/error-solid';
12
12
  import TickCircleIcon from '../icon/components/tickCircle-solid';
13
13
  import { useOverrides } from '../overrides';
14
14
  import { StatefulTooltip } from '../tooltip';
@@ -19,7 +19,7 @@ import classNames from '../classNames';
19
19
  import { getTextFromNode } from '../utils/generalUtils';
20
20
  var addConditionalIds = classNames;
21
21
  var intentToIconMap = {
22
- error: AlertIcon,
22
+ error: ErrorIcon,
23
23
  warning: WarningIcon,
24
24
  success: TickCircleIcon,
25
25
  };
@@ -7,6 +7,7 @@ export declare const isValidHex: (hex: unknown) => string | undefined;
7
7
  */
8
8
  export declare function hexToRgb(_hex: string): RGBColor;
9
9
  export declare function RgbToHex({ r, g, b, a }: RGBColor): string;
10
+ export declare function normalizeHex(hex: string): string | undefined;
10
11
  /**
11
12
  * https://medium.muz.li/the-science-of-color-contrast-an-expert-designers-guide-33e84c41d156
12
13
  * https://www.w3.org/WAI/WCAG21/Understanding/contrast-minimum#dfn-contrast-ratio
@@ -7,7 +7,7 @@ export var isValidHex = function (hex) {
7
7
  if (![3, 4, 6, 8].includes(hexVal.length))
8
8
  return undefined;
9
9
  if (/^[0-9a-f]+$/i.test(hexVal))
10
- return hexVal;
10
+ return hexVal.toUpperCase();
11
11
  return undefined;
12
12
  };
13
13
  /**
@@ -30,6 +30,18 @@ export function RgbToHex(_a) {
30
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'); })
31
31
  .join(''));
32
32
  }
33
+ export function normalizeHex(hex) {
34
+ if (!isValidHex(hex))
35
+ return undefined;
36
+ var _a = hexToRgb(hex), r = _a.r, g = _a.g, b = _a.b, a = _a.a;
37
+ return "#".concat([r, g, b, Math.round((a !== null && a !== void 0 ? a : 1) * 255)]
38
+ .map(function (n) {
39
+ return Math.round(Math.min(Math.max(n, 0), 255))
40
+ .toString(16)
41
+ .padStart(2, '0');
42
+ })
43
+ .join(''));
44
+ }
33
45
  /**
34
46
  * https://medium.muz.li/the-science-of-color-contrast-an-expert-designers-guide-33e84c41d156
35
47
  * https://www.w3.org/WAI/WCAG21/Understanding/contrast-minimum#dfn-contrast-ratio
@@ -86,7 +98,7 @@ export function noAlphaHex(inputHex) {
86
98
  return inputHex;
87
99
  }
88
100
  export function normalizeHexWithAlpha(hex, alpha) {
89
- if (typeof alpha !== 'number' || alpha === 1 || !hex)
101
+ if (typeof alpha !== 'number' || alpha === 1 || !hex || !isValidHex(hex))
90
102
  return hex;
91
103
  return (hex +
92
104
  Math.floor(alpha * 255)
@@ -1,3 +1,3 @@
1
1
  import * as React from 'react';
2
2
  import type { IconProps } from '../types';
3
- export default function AlertSolid(props: IconProps): React.ReactElement;
3
+ export default function ErrorSolid(props: IconProps): React.ReactElement;
@@ -0,0 +1,8 @@
1
+ import { __assign } from "tslib";
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import { useStyle } from '../../style';
4
+ import Icon from '../icon';
5
+ export default function ErrorSolid(props) {
6
+ var _a = useStyle(), theme = _a.theme, isRTL = _a.isRTL;
7
+ return (_jsx(Icon, __assign({ viewBox: "0 0 14 14", "data-icon-name": "ErrorSolid" }, props, { children: _jsx("path", { d: "M7.063.012a6.994 6.994 0 106.994 6.994A6.996 6.996 0 007.063.012zm0 7.693a.701.701 0 01-.7-.699V4.21a.701.701 0 01.7-.7.701.701 0 01.7.7v2.797a.701.701 0 01-.7.7zm0 2.798a.701.701 0 01-.7-.7.701.701 0 01.7-.699.701.701 0 01.7.7.701.701 0 01-.7.699z" }) })));
8
+ }
@@ -1,3 +1,3 @@
1
1
  import * as React from 'react';
2
2
  import type { IconProps } from '../types';
3
- export default function AlertSolid(props: IconProps): React.ReactElement;
3
+ export default function WarningClr(props: IconProps): React.ReactElement;
@@ -0,0 +1,8 @@
1
+ import { __assign } from "tslib";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { useStyle } from '../../style';
4
+ import Icon from '../icon';
5
+ export default function WarningClr(props) {
6
+ var _a = useStyle(), theme = _a.theme, isRTL = _a.isRTL;
7
+ return (_jsxs(Icon, __assign({ viewBox: "0 0 16 16", "data-icon-name": "WarningClr" }, props, { children: [_jsx("path", { fillRule: "evenodd", d: "M16 13.518c0 .96-.778 1.738-1.738 1.738H1.738a1.738 1.738 0 0 1-1.515-2.59L6.405 1.677l.064-.105a1.83 1.83 0 0 1 3.126.105l6.182 10.99.052.098c.112.235.171.492.171.753", clipRule: "evenodd" }), _jsx("path", { fill: "currentColor", d: "M8 .744c.661 0 1.271.357 1.596.934l6.181 10.988.051.1a1.738 1.738 0 0 1-1.565 2.49H1.737a1.738 1.738 0 0 1-1.514-2.59L6.405 1.678l.064-.106A1.83 1.83 0 0 1 8 .744m0 1a.83.83 0 0 0-.694.376l-.03.048-6.181 10.988a.738.738 0 0 0 .643 1.1h12.525a.738.738 0 0 0 .664-1.058l-.022-.042L8.724 2.168A.83.83 0 0 0 8 1.744" }), _jsx("path", { fill: "currentColor", fillRule: "evenodd", d: "M8 9.99a.75.75 0 0 1-.75-.75V5.868a.75.75 0 0 1 1.5 0V9.24a.75.75 0 0 1-.75.75m-.75 1.88a.75.75 0 1 0 1.5-.007.75.75 0 1 0-1.5.007", clipRule: "evenodd" })] })));
8
+ }
@@ -1,11 +1,11 @@
1
1
  import { type ReactElement } from 'react';
2
2
  import type { ModalProps } from './types';
3
- import Alert from '../icon/components/alert-solid';
3
+ import Error from '../icon/components/error-solid';
4
4
  import Tick from '../icon/components/tickCircle-solid';
5
- import Warning from '../icon/components/warning-solid';
5
+ import Warning from '../icon/components/warning-clr';
6
6
  export declare const INTENT_TO_ICON: {
7
7
  success: typeof Tick;
8
- error: typeof Alert;
8
+ error: typeof Error;
9
9
  warning: typeof Warning;
10
10
  };
11
11
  declare const _default: import("react").MemoExoticComponent<{
@@ -12,14 +12,14 @@ import { useLocale } from '../locale';
12
12
  import { mergeOverrides } from '../overrides';
13
13
  import { ModalContextProvider } from './ModalContext';
14
14
  import useUniqueId from '../hooks/useUniqueId';
15
- import Alert from '../icon/components/alert-solid';
15
+ import Error from '../icon/components/error-solid';
16
16
  import Tick from '../icon/components/tickCircle-solid';
17
- import Warning from '../icon/components/warning-solid';
17
+ import Warning from '../icon/components/warning-clr';
18
18
  import { isDarkTheme } from '../helpers/themeHelpers';
19
19
  var CloseButton = function (closeProps) { return (_jsx(IconButton, __assign({}, closeProps, { children: _jsx(Close, {}) }))); };
20
20
  export var INTENT_TO_ICON = {
21
21
  success: Tick,
22
- error: Alert,
22
+ error: Error,
23
23
  warning: Warning,
24
24
  };
25
25
  var getWarningIconClassName = function (_a) {
@@ -4,10 +4,10 @@ import { memo } from 'react';
4
4
  import { useOverrides } from '../overrides';
5
5
  import { StyledStep, StyledIconContainer, StyledInnerIcon, StyledContent, StyledContentTitle, StyledContentSubTitle, StyledContentTail, StyledContentDescription, getContentTailStyle, getIconContainerStyle, } from './styled-components';
6
6
  import TickCircleIcon from '../icon/components/tickCircle-solid';
7
- import Alert from '../icon/components/alert-solid';
7
+ import Error from '../icon/components/error-solid';
8
8
  import { ORIENTATION } from './constants';
9
9
  var INTENT_TO_ICON_MAP = {
10
- error: _jsx(Alert, { size: 16, className: "spr-support-error-text" }),
10
+ error: _jsx(Error, { size: 16, className: "spr-support-error-text" }),
11
11
  };
12
12
  var Step = function (_a) {
13
13
  var _b = _a.overrides, overrides = _b === void 0 ? {} : _b, isCompleted = _a.isCompleted, isCurrent = _a.isCurrent, isActive = _a.isActive, _c = _a.intent, intent = _c === void 0 ? 'default' : _c, isRightBeforeActive = _a.isRightBeforeActive, _d = _a.isLast, isLast = _d === void 0 ? false : _d, childrenCount = _a.childrenCount, _e = _a.orientation, orientation = _e === void 0 ? ORIENTATION.vertical : _e, title = _a.title, subTitle = _a.subTitle, alwaysShowDescription = _a.alwaysShowDescription, children = _a.children, className = _a.className, onClick = _a.onClick, variant = _a.variant, role = _a.role, style = _a.style, step = _a.step, showStepNumber = _a.showStepNumber, restProps = __rest(_a, ["overrides", "isCompleted", "isCurrent", "isActive", "intent", "isRightBeforeActive", "isLast", "childrenCount", "orientation", "title", "subTitle", "alwaysShowDescription", "children", "className", "onClick", "variant", "role", "style", "step", "showStepNumber"]);
@@ -1,11 +1,11 @@
1
- import Alert from '../icon/components/alert-solid';
2
- import Warning from '../icon/components/warning-solid';
1
+ import Error from '../icon/components/error-solid';
2
+ import Warning from '../icon/components/warning-clr';
3
3
  import Tick from '../icon/components/tickCircle-solid';
4
4
  import Delete from '../icon/components/delete-solid';
5
5
  export var TRANSITION_DURATION = 1000;
6
6
  export var INTENT_TO_ICON = {
7
7
  success: Tick,
8
- error: Alert,
8
+ error: Error,
9
9
  warning: Warning,
10
10
  delete: Delete,
11
11
  };
@@ -10,7 +10,7 @@ import { Button } from '../button';
10
10
  import { StyledHeader } from './styled-component';
11
11
  import { Stack, StackItem } from '../stack';
12
12
  import DefaultTimezonePicker from './TimezonePicker';
13
- import ErrorIcon from '../icon/components/error';
13
+ import ErrorIcon from '../icon/components/error-solid';
14
14
  import { StyledFooter, StyledFooterBeforeEnhancer } from '../date-picker/styled-components';
15
15
  import { useLocale } from '../locale';
16
16
  import { getRangeError, getSelectedTimeRange, getValidRange, getMinMaxDateInTimezone, convertDateFromSystemTzToTargetTz, } from './utils';
@@ -114,9 +114,7 @@ var RangeSelectorContainer = function (_a) {
114
114
  fill: theme.spr.clrRed,
115
115
  });
116
116
  } }), _jsx(Typography, __assign({ className: "my-0", variant: "bs3" }, { children: errMsg }))] }))) : null;
117
- return (_jsxs(Box, __assign({ className: "spr-ui-01 rounded-8" }, { children: [_jsxs(Header, __assign({ "$setTimezone": setTimezone, "$onClose": props.onClose }, headerProps, { children: [_jsx(HeaderBeforeEnhancer, __assign({ variant: "heading-7", "$as": "span", className: "flex items-center" }, headerBeforeEnhancerProps, { children: locale.timeRangePicker.headerLabel })), disableTimezone ? null : (_jsx(TimezonePicker, __assign({ setTimezone: setTimezone, timezone: timezone, timezoneOptions: timezoneOptions }, timezonePickerProps, { className: ['w-0 grow max-w-md', timezonePickerProps === null || timezonePickerProps === void 0 ? void 0 : timezonePickerProps.className] })))] })), _jsx(RangeSelector, __assign({ overrides: props.overrides, timeSelect: props.timeSelect, timeRangePresets: timeRangePresets, timezone: timezone, timeRange: timeRange, preset: preset, onChange: onDateChange, adapter: adapter, peekNextMonth: props.peekNextMonth, excludeDates: props.excludeDates, filterDate: props.filterDate, minDate: minDate, maxDate: maxDate, formatString: props.formatString, locale: props.locale, fixedHeight: props.fixedHeight, monthsShown: monthsShown, hidePresetSearch: hidePresetSearch, footerContent: _jsx(Footer, __assign({ "$hasError": hasError, "$onSubmit": handleSubmit, "$onClose": props.onClose }, footerProps, { className: ['px-6 py-3 mt-2', footerProps.className] }, { children: _jsxs(Box, __assign({ className: "justify-between w-0 grow flex" }, { children: [_jsx(FooterBeforeEnhancer, __assign({}, footerBeforeEnhancerProps)), _jsxs(Stack, __assign({ direction: monthsShown === 1 ? 'vertical' : 'horizontal', gap: 3,
118
- // @ts-ignore -- CSS-in-JS
119
- className: [cx({ 'items-center': monthsShown !== 1 }), { maxWidth: 'fit-content' }] }, { children: [monthsShown === 1 ? null : errorEl, _jsxs(StackItem, __assign({ className: "flex self-end" }, { children: [(footerProps === null || footerProps === void 0 ? void 0 : footerProps.showClearButton) ? (_jsx(Button, __assign({ size: "xs", onClick: footerProps.handleClearBtnClick, variant: "secondary", "data-testid": "clear", disabled: timeRange.length === 0 }, { children: locale.timeRangePicker.clearBtnLabel }))) : (_jsx(Button, __assign({ size: "xs", onClick: props.onClose, variant: "secondary", "data-testid": "cancel" }, { children: locale.timeRangePicker.cancelBtnLabel }))), _jsx(Button, __assign({ size: "xs", className: "ml-3", onClick: handleSubmit, disabled: hasError, "data-testid": "save" }, { children: locale.timeRangePicker.saveBtnLabel }))] })), monthsShown === 1 ? errorEl : null] }))] })) })) }, rangeSelectorProps))] })));
117
+ return (_jsxs(Box, __assign({ className: "spr-ui-01 rounded-8" }, { children: [_jsxs(Header, __assign({ "$setTimezone": setTimezone, "$onClose": props.onClose }, headerProps, { children: [_jsx(HeaderBeforeEnhancer, __assign({ variant: "heading-7", "$as": "span", className: "flex items-center" }, headerBeforeEnhancerProps, { children: locale.timeRangePicker.headerLabel })), disableTimezone ? null : (_jsx(TimezonePicker, __assign({ setTimezone: setTimezone, timezone: timezone, timezoneOptions: timezoneOptions }, timezonePickerProps, { className: ['w-0 grow max-w-md', timezonePickerProps === null || timezonePickerProps === void 0 ? void 0 : timezonePickerProps.className] })))] })), _jsx(RangeSelector, __assign({ overrides: props.overrides, timeSelect: props.timeSelect, timeRangePresets: timeRangePresets, timezone: timezone, timeRange: timeRange, preset: preset, onChange: onDateChange, adapter: adapter, peekNextMonth: props.peekNextMonth, excludeDates: props.excludeDates, filterDate: props.filterDate, minDate: minDate, maxDate: maxDate, formatString: props.formatString, locale: props.locale, fixedHeight: props.fixedHeight, monthsShown: monthsShown, hidePresetSearch: hidePresetSearch, footerContent: _jsx(Footer, __assign({ "$hasError": hasError, "$onSubmit": handleSubmit, "$onClose": props.onClose }, footerProps, { className: ['px-6 py-3 mt-2', footerProps.className] }, { children: _jsxs(Box, __assign({ className: "justify-between w-0 grow flex" }, { children: [_jsx(FooterBeforeEnhancer, __assign({}, footerBeforeEnhancerProps)), _jsxs(Stack, __assign({ direction: monthsShown === 1 ? 'vertical' : 'horizontal', gap: 3, className: monthsShown !== 1 ? 'items-center' : undefined, style: { maxWidth: 'fit-content' } }, { children: [monthsShown === 1 ? null : errorEl, _jsxs(StackItem, __assign({ className: "flex self-end" }, { children: [(footerProps === null || footerProps === void 0 ? void 0 : footerProps.showClearButton) ? (_jsx(Button, __assign({ size: "xs", onClick: footerProps.handleClearBtnClick, variant: "secondary", "data-testid": "clear", disabled: timeRange.length === 0 }, { children: locale.timeRangePicker.clearBtnLabel }))) : (_jsx(Button, __assign({ size: "xs", onClick: props.onClose, variant: "secondary", "data-testid": "cancel" }, { children: locale.timeRangePicker.cancelBtnLabel }))), _jsx(Button, __assign({ size: "xs", className: "ml-3", onClick: handleSubmit, disabled: hasError, "data-testid": "save" }, { children: locale.timeRangePicker.saveBtnLabel }))] })), monthsShown === 1 ? errorEl : null] }))] })) })) }, rangeSelectorProps))] })));
120
118
  };
121
119
  RangeSelectorContainer.displayName = 'RangeSelectorContainer';
122
120
  export default RangeSelectorContainer;