@cerebruminc/cerebellum 16.1.1-beta.dangerous.94a8f04 → 16.1.1-beta.dangerous.bc77c27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/DatePicker.cjs +1 -1
- package/lib/cjs/Form.cjs +4 -7
- package/lib/cjs/Form.cjs.map +1 -1
- package/lib/cjs/FormFieldTypeEnum.cjs +0 -5
- package/lib/cjs/FormFieldTypeEnum.cjs.map +1 -1
- package/lib/cjs/FormSeparator.cjs +1 -3
- package/lib/cjs/FormSeparator.cjs.map +1 -1
- package/lib/cjs/{FormStyles-CM25rbhG.js → FormStyles-CxgYRZOl.js} +21 -38
- package/lib/cjs/{FormStyles-CM25rbhG.js.map → FormStyles-CxgYRZOl.js.map} +1 -1
- package/lib/cjs/FormWrapper.cjs +1 -3
- package/lib/cjs/FormWrapper.cjs.map +1 -1
- package/lib/cjs/{FormikContainer-DVL86Jri.js → FormikContainer-CY2nLsAs.js} +3 -33
- package/lib/{esm/FormikContainer-uI5oe1px.js.map → cjs/FormikContainer-CY2nLsAs.js.map} +1 -1
- package/lib/cjs/{InlineDatePicker-B7DTwvhv.js → InlineDatePicker-DFv_uHo9.js} +176 -344
- package/lib/cjs/InlineDatePicker-DFv_uHo9.js.map +1 -0
- package/lib/cjs/InlineDatePicker.cjs +1 -1
- package/lib/cjs/TitleGroup.cjs +1 -3
- package/lib/cjs/TitleGroup.cjs.map +1 -1
- package/lib/cjs/cerebellumTheme.cjs +0 -5
- package/lib/cjs/cerebellumTheme.cjs.map +1 -1
- package/lib/cjs/index.cjs +3 -9
- package/lib/cjs/index.cjs.map +1 -1
- package/lib/esm/DatePicker.js +1 -1
- package/lib/esm/Form.js +5 -7
- package/lib/esm/Form.js.map +1 -1
- package/lib/esm/FormFieldTypeEnum.js +1 -5
- package/lib/esm/FormFieldTypeEnum.js.map +1 -1
- package/lib/esm/FormSeparator.js +1 -3
- package/lib/esm/FormSeparator.js.map +1 -1
- package/lib/esm/{FormStyles-CyqyMC1o.js → FormStyles-BQJPyTS0.js} +22 -39
- package/lib/esm/{FormStyles-CyqyMC1o.js.map → FormStyles-BQJPyTS0.js.map} +1 -1
- package/lib/esm/FormWrapper.js +1 -3
- package/lib/esm/FormWrapper.js.map +1 -1
- package/lib/esm/{FormikContainer-uI5oe1px.js → FormikContainer-SJPYfIkF.js} +4 -34
- package/lib/{cjs/FormikContainer-DVL86Jri.js.map → esm/FormikContainer-SJPYfIkF.js.map} +1 -1
- package/lib/esm/{InlineDatePicker-BuxjkoV0.js → InlineDatePicker-ClVBWEzW.js} +177 -345
- package/lib/esm/InlineDatePicker-ClVBWEzW.js.map +1 -0
- package/lib/esm/InlineDatePicker.js +1 -1
- package/lib/esm/TitleGroup.js +1 -3
- package/lib/esm/TitleGroup.js.map +1 -1
- package/lib/esm/cerebellumTheme.js +0 -5
- package/lib/esm/cerebellumTheme.js.map +1 -1
- package/lib/esm/index.js +4 -6
- package/lib/esm/index.js.map +1 -1
- package/lib/types/src/components/Form/fields/index.d.ts +1 -2
- package/lib/types/src/components/Form/index.d.ts +3 -3
- package/lib/types/src/components/Form/mocks/fields.d.ts +0 -62
- package/lib/types/src/components/Form/types.d.ts +2 -36
- package/lib/types/src/index.d.ts +1 -5
- package/lib/types/src/theme.d.ts +0 -6
- package/package.json +2 -2
- package/lib/cjs/ColorPickerInput-CBPI8IJ-.js +0 -187
- package/lib/cjs/ColorPickerInput-CBPI8IJ-.js.map +0 -1
- package/lib/cjs/ColorPickerInput.cjs +0 -25
- package/lib/cjs/ColorPickerInput.cjs.map +0 -1
- package/lib/cjs/InlineColorPickerInput.cjs +0 -25
- package/lib/cjs/InlineColorPickerInput.cjs.map +0 -1
- package/lib/cjs/InlineDatePicker-B7DTwvhv.js.map +0 -1
- package/lib/cjs/validateColorContrast.cjs +0 -53
- package/lib/cjs/validateColorContrast.cjs.map +0 -1
- package/lib/cjs/validateColorContrastWithMessage.cjs +0 -10
- package/lib/cjs/validateColorContrastWithMessage.cjs.map +0 -1
- package/lib/esm/ColorPickerInput-S8X2gIA5.js +0 -180
- package/lib/esm/ColorPickerInput-S8X2gIA5.js.map +0 -1
- package/lib/esm/ColorPickerInput.js +0 -18
- package/lib/esm/ColorPickerInput.js.map +0 -1
- package/lib/esm/InlineColorPickerInput.js +0 -18
- package/lib/esm/InlineColorPickerInput.js.map +0 -1
- package/lib/esm/InlineDatePicker-BuxjkoV0.js.map +0 -1
- package/lib/esm/validateColorContrast.js +0 -50
- package/lib/esm/validateColorContrast.js.map +0 -1
- package/lib/esm/validateColorContrastWithMessage.js +0 -3
- package/lib/esm/validateColorContrastWithMessage.js.map +0 -1
- package/lib/types/src/components/ColorPickerInput/ColorPickerInput.d.ts +0 -3
- package/lib/types/src/components/ColorPickerInput/InlineColorPickerInput.d.ts +0 -3
- package/lib/types/src/components/ColorPickerInput/index.d.ts +0 -3
- package/lib/types/src/components/ColorPickerInput/types.d.ts +0 -48
- package/lib/types/src/components/Form/fields/ColorPickerField/ColorPickerField.d.ts +0 -4
- package/lib/types/src/components/Form/fields/ColorPickerField/index.d.ts +0 -1
- package/lib/types/src/helpers/colorValidators.d.ts +0 -19
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var pressedEnter = require('./pressedEnter.cjs');
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Validates that a color has sufficient contrast against a background color
|
|
7
|
-
* according to WCAG AA accessibility standards (4.5:1 ratio for normal text).
|
|
8
|
-
*
|
|
9
|
-
* @param color - The foreground color (hex format, e.g., "#ff0000")
|
|
10
|
-
* @param backgroundColor - The background color to check against (hex format, defaults to "#ffffff")
|
|
11
|
-
* @returns boolean - true if the contrast ratio is >= 4.5:1, false otherwise
|
|
12
|
-
*/
|
|
13
|
-
var validateColorContrast = function (color, backgroundColor) {
|
|
14
|
-
if (backgroundColor === void 0) { backgroundColor = "#ffffff"; }
|
|
15
|
-
if (!color) {
|
|
16
|
-
return true; // Allow empty values, let required validation handle this
|
|
17
|
-
}
|
|
18
|
-
try {
|
|
19
|
-
var contrastRatio = pressedEnter.contrast(color, backgroundColor);
|
|
20
|
-
// WCAG AA requires 4.5:1 for normal text, 3:1 for large text
|
|
21
|
-
// Using 4.5 as the threshold for accessibility compliance
|
|
22
|
-
return contrastRatio >= 4.5;
|
|
23
|
-
}
|
|
24
|
-
catch (error) {
|
|
25
|
-
// If there's an error in contrast calculation (invalid color format, etc.)
|
|
26
|
-
// return true to avoid blocking the form, let other validation handle format issues
|
|
27
|
-
return true;
|
|
28
|
-
}
|
|
29
|
-
};
|
|
30
|
-
/**
|
|
31
|
-
* Validates that a color has sufficient contrast against a background color
|
|
32
|
-
* and returns an error message if validation fails.
|
|
33
|
-
*
|
|
34
|
-
* @param color - The foreground color (hex format, e.g., "#ff0000")
|
|
35
|
-
* @param backgroundColor - The background color to check against (hex format, defaults to "#ffffff")
|
|
36
|
-
* @param errorMessage - Custom error message (optional)
|
|
37
|
-
* @returns string | null - Error message if validation fails, null if valid
|
|
38
|
-
*/
|
|
39
|
-
var validateColorContrastWithMessage = function (color, backgroundColor, errorMessage) {
|
|
40
|
-
if (backgroundColor === void 0) { backgroundColor = "#ffffff"; }
|
|
41
|
-
if (!color) {
|
|
42
|
-
return null; // Allow empty values, let required validation handle this
|
|
43
|
-
}
|
|
44
|
-
var isValid = validateColorContrast(color, backgroundColor);
|
|
45
|
-
if (!isValid) {
|
|
46
|
-
return errorMessage || "This color does not have sufficient contrast for accessibility";
|
|
47
|
-
}
|
|
48
|
-
return null;
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
exports.validateColorContrast = validateColorContrast;
|
|
52
|
-
exports.validateColorContrastWithMessage = validateColorContrastWithMessage;
|
|
53
|
-
//# sourceMappingURL=validateColorContrast.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"validateColorContrast.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
require('./pressedEnter.cjs');
|
|
4
|
-
var validateColorContrast = require('./validateColorContrast.cjs');
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
exports.validateColorContrast = validateColorContrast.validateColorContrast;
|
|
9
|
-
exports.validateColorContrastWithMessage = validateColorContrast.validateColorContrastWithMessage;
|
|
10
|
-
//# sourceMappingURL=validateColorContrastWithMessage.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"validateColorContrastWithMessage.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;"}
|
|
@@ -1,180 +0,0 @@
|
|
|
1
|
-
import { b as __makeTemplateObject, _ as __assign } from './_tslib-CcAXazg4.js';
|
|
2
|
-
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
|
-
import { useRef, useMemo, useEffect, useState } from 'react';
|
|
4
|
-
import styled from 'styled-components';
|
|
5
|
-
import { BodyXSPrimary } from './BodyLEmphasis.js';
|
|
6
|
-
import { u as useMeasure } from './useMeasure-D89v6c_A.js';
|
|
7
|
-
import { s as showLabel } from './showLabel-D6KgNem4.js';
|
|
8
|
-
import { I as InputGroup, L as LabelBox, V as ValidationText, H as HelperText } from './Inputs-C6OWHviY.js';
|
|
9
|
-
import { contrast } from './pressedEnter.js';
|
|
10
|
-
import { validateColorContrast } from './validateColorContrast.js';
|
|
11
|
-
|
|
12
|
-
// Container that holds both the input and the text side by side
|
|
13
|
-
var ColorPickerContainer = styled.div(templateObject_1$1 || (templateObject_1$1 = __makeTemplateObject(["\n align-items: center;\n display: flex;\n flex-wrap: nowrap;\n gap: 12px;\n"], ["\n align-items: center;\n display: flex;\n flex-wrap: nowrap;\n gap: 12px;\n"])));
|
|
14
|
-
var ColorInputWrapper = styled.div(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n align-items: center;\n background: ", ";\n border: solid 1px ", ";\n border-radius: ", "px;\n display: flex;\n flex-shrink: 0; /* Prevent the square from shrinking */\n height: ", "px;\n justify-content: center;\n min-width: ", "px;\n padding: ", "px;\n position: relative;\n transition: border-color 350ms ease-out 50ms, background-color 350ms ease-out 50ms;\n /* Make the wrapper square based on inputHeight, with a larger default for color pickers */\n width: ", "px;\n \n &:hover {\n border-color: ", ";\n }\n \n &:focus-within {\n border-color: ", ";\n }\n"], ["\n align-items: center;\n background: ", ";\n border: solid 1px ", ";\n border-radius: ", "px;\n display: flex;\n flex-shrink: 0; /* Prevent the square from shrinking */\n height: ", "px;\n justify-content: center;\n min-width: ", "px;\n padding: ", "px;\n position: relative;\n transition: border-color 350ms ease-out 50ms, background-color 350ms ease-out 50ms;\n /* Make the wrapper square based on inputHeight, with a larger default for color pickers */\n width: ", "px;\n \n &:hover {\n border-color: ", ";\n }\n \n &:focus-within {\n border-color: ", ";\n }\n"])), function (_a) {
|
|
15
|
-
var _b;
|
|
16
|
-
var $themeOverride = _a.$themeOverride, theme = _a.theme;
|
|
17
|
-
return ($themeOverride === null || $themeOverride === void 0 ? void 0 : $themeOverride.inputBackgroundColor) || ((_b = theme.input) === null || _b === void 0 ? void 0 : _b.inputBackgroundColor);
|
|
18
|
-
}, function (_a) {
|
|
19
|
-
var _b, _c, _d;
|
|
20
|
-
var $disabled = _a.$disabled, theme = _a.theme, $showValidationMessage = _a.$showValidationMessage, $themeOverride = _a.$themeOverride;
|
|
21
|
-
return $showValidationMessage
|
|
22
|
-
? ($themeOverride === null || $themeOverride === void 0 ? void 0 : $themeOverride.failColor) || ((_b = theme.input) === null || _b === void 0 ? void 0 : _b.failColor)
|
|
23
|
-
: $disabled
|
|
24
|
-
? ($themeOverride === null || $themeOverride === void 0 ? void 0 : $themeOverride.disabledBorderColor) || ((_c = theme.input) === null || _c === void 0 ? void 0 : _c.disabledBorderColor)
|
|
25
|
-
: ($themeOverride === null || $themeOverride === void 0 ? void 0 : $themeOverride.inactiveBorderColor) || ((_d = theme.input) === null || _d === void 0 ? void 0 : _d.inactiveBorderColor);
|
|
26
|
-
}, function (_a) {
|
|
27
|
-
var $themeOverride = _a.$themeOverride, theme = _a.theme;
|
|
28
|
-
return ($themeOverride === null || $themeOverride === void 0 ? void 0 : $themeOverride.inputBorderRadius) || theme.input.inputBorderRadius;
|
|
29
|
-
}, function (_a) {
|
|
30
|
-
var $themeOverride = _a.$themeOverride, theme = _a.theme;
|
|
31
|
-
return ($themeOverride === null || $themeOverride === void 0 ? void 0 : $themeOverride.inputHeight) || theme.input.inputHeight;
|
|
32
|
-
}, function (_a) {
|
|
33
|
-
var $themeOverride = _a.$themeOverride, theme = _a.theme;
|
|
34
|
-
return ($themeOverride === null || $themeOverride === void 0 ? void 0 : $themeOverride.inputHeight) || theme.input.inputHeight;
|
|
35
|
-
}, function (_a) {
|
|
36
|
-
var _b;
|
|
37
|
-
var $themeOverride = _a.$themeOverride, theme = _a.theme;
|
|
38
|
-
return (_b = $themeOverride === null || $themeOverride === void 0 ? void 0 : $themeOverride.inputPadding) !== null && _b !== void 0 ? _b : theme.colorPickerInput.padding;
|
|
39
|
-
}, function (_a) {
|
|
40
|
-
var $themeOverride = _a.$themeOverride, theme = _a.theme;
|
|
41
|
-
return ($themeOverride === null || $themeOverride === void 0 ? void 0 : $themeOverride.inputHeight) || theme.input.inputHeight;
|
|
42
|
-
}, function (_a) {
|
|
43
|
-
var _b, _c, _d;
|
|
44
|
-
var $disabled = _a.$disabled, theme = _a.theme, $showValidationMessage = _a.$showValidationMessage, $themeOverride = _a.$themeOverride;
|
|
45
|
-
return $showValidationMessage
|
|
46
|
-
? ($themeOverride === null || $themeOverride === void 0 ? void 0 : $themeOverride.failColor) || ((_b = theme.input) === null || _b === void 0 ? void 0 : _b.failColor)
|
|
47
|
-
: $disabled
|
|
48
|
-
? ($themeOverride === null || $themeOverride === void 0 ? void 0 : $themeOverride.disabledBorderColor) || ((_c = theme.input) === null || _c === void 0 ? void 0 : _c.disabledBorderColor)
|
|
49
|
-
: ($themeOverride === null || $themeOverride === void 0 ? void 0 : $themeOverride.hoverBorderColor) || ((_d = theme.input) === null || _d === void 0 ? void 0 : _d.hoverBorderColor);
|
|
50
|
-
}, function (_a) {
|
|
51
|
-
var _b, _c, _d;
|
|
52
|
-
var $disabled = _a.$disabled, theme = _a.theme, $showValidationMessage = _a.$showValidationMessage, $themeOverride = _a.$themeOverride;
|
|
53
|
-
return $showValidationMessage
|
|
54
|
-
? ($themeOverride === null || $themeOverride === void 0 ? void 0 : $themeOverride.failColor) || ((_b = theme.input) === null || _b === void 0 ? void 0 : _b.failColor)
|
|
55
|
-
: $disabled
|
|
56
|
-
? ($themeOverride === null || $themeOverride === void 0 ? void 0 : $themeOverride.disabledBorderColor) || ((_c = theme.input) === null || _c === void 0 ? void 0 : _c.disabledBorderColor)
|
|
57
|
-
: ($themeOverride === null || $themeOverride === void 0 ? void 0 : $themeOverride.activeBorderColor) || ((_d = theme.input) === null || _d === void 0 ? void 0 : _d.activeBorderColor);
|
|
58
|
-
});
|
|
59
|
-
// Custom styled color input that is 90% of the wrapper size and centered
|
|
60
|
-
var ColorInput = styled.input(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n background: none;\n border-radius: 4px;\n border: none;\n cursor: ", ";\n height: 90%;\n opacity: ", ";\n outline: none;\n width: 90%;\n \n /* Remove the default color input outline/border and ensure color is visible */\n &::-webkit-color-swatch-wrapper {\n border-radius: 4px;\n border: none;\n padding: 0;\n }\n \n &::-webkit-color-swatch {\n border: none;\n border-radius: 4px;\n outline: none;\n }\n \n &::-moz-color-swatch {\n border: none;\n border-radius: 4px;\n outline: none;\n }\n \n /* Firefox specific fixes */\n &::-moz-focus-inner {\n border: none;\n padding: 0;\n }\n \n &:focus {\n outline: none;\n }\n"], ["\n background: none;\n border-radius: 4px;\n border: none;\n cursor: ", ";\n height: 90%;\n opacity: ", ";\n outline: none;\n width: 90%;\n \n /* Remove the default color input outline/border and ensure color is visible */\n &::-webkit-color-swatch-wrapper {\n border-radius: 4px;\n border: none;\n padding: 0;\n }\n \n &::-webkit-color-swatch {\n border: none;\n border-radius: 4px;\n outline: none;\n }\n \n &::-moz-color-swatch {\n border: none;\n border-radius: 4px;\n outline: none;\n }\n \n /* Firefox specific fixes */\n &::-moz-focus-inner {\n border: none;\n padding: 0;\n }\n \n &:focus {\n outline: none;\n }\n"])), function (_a) {
|
|
61
|
-
var $disabled = _a.$disabled;
|
|
62
|
-
return ($disabled ? "not-allowed" : "pointer");
|
|
63
|
-
}, function (_a) {
|
|
64
|
-
var $disabled = _a.$disabled;
|
|
65
|
-
return ($disabled ? 0.5 : 1);
|
|
66
|
-
});
|
|
67
|
-
// Legibility text component that displays to the right, vertically centered
|
|
68
|
-
var LegibilityText = styled.div(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n color: ", ";\n font-size: ", "px;\n opacity: ", ";\n white-space: nowrap;\n"], ["\n color: ", ";\n font-size: ", "px;\n opacity: ", ";\n white-space: nowrap;\n"])), function (_a) {
|
|
69
|
-
var _b, _c;
|
|
70
|
-
var $disabled = _a.$disabled, $themeOverride = _a.$themeOverride, theme = _a.theme;
|
|
71
|
-
return $disabled ? ($themeOverride === null || $themeOverride === void 0 ? void 0 : $themeOverride.disabledColor) || ((_b = theme.input) === null || _b === void 0 ? void 0 : _b.disabledColor) : (_c = theme.input) === null || _c === void 0 ? void 0 : _c.helperTextColor;
|
|
72
|
-
}, function (_a) {
|
|
73
|
-
var _b;
|
|
74
|
-
var theme = _a.theme;
|
|
75
|
-
return (((_b = theme.input) === null || _b === void 0 ? void 0 : _b.textFontSize) || 14) - 2;
|
|
76
|
-
}, function (_a) {
|
|
77
|
-
var $disabled = _a.$disabled;
|
|
78
|
-
return ($disabled ? 0.5 : 1);
|
|
79
|
-
});
|
|
80
|
-
var InlineColorPickerInput = function (_a) {
|
|
81
|
-
var _b = _a.checkLegible, checkLegible = _b === void 0 ? false : _b, _c = _a.disabled, disabled = _c === void 0 ? false : _c, focus = _a.focus, innerRef = _a.innerRef, inputLabel = _a.inputLabel, _d = _a.legibleAgainst, legibleAgainst = _d === void 0 ? "#ffffff" : _d, name = _a.name, onChange = _a.onChange, onEnter = _a.onEnter, onInputBlur = _a.onInputBlur, onInputFocus = _a.onInputFocus, onValueChange = _a.onValueChange, _e = _a.showValidationMessage, showValidationMessage = _e === void 0 ? false : _e, themeOverride = _a.themeOverride, value = _a.value;
|
|
82
|
-
var inputRef = innerRef || useRef(null);
|
|
83
|
-
// Calculate legibility and dynamic text
|
|
84
|
-
var legibilityInfo = useMemo(function () {
|
|
85
|
-
if (!checkLegible || !value) {
|
|
86
|
-
return { isLegible: true, legibilityText: undefined };
|
|
87
|
-
}
|
|
88
|
-
try {
|
|
89
|
-
var isLegible = validateColorContrast(value, legibleAgainst);
|
|
90
|
-
var legibilityText = void 0;
|
|
91
|
-
if (isLegible) {
|
|
92
|
-
legibilityText = "✅ Looks good";
|
|
93
|
-
}
|
|
94
|
-
else {
|
|
95
|
-
// Determine if we need lighter or darker
|
|
96
|
-
// If contrast with black is greater, the color is light and needs to be darker
|
|
97
|
-
// If contrast with white is greater, the color is dark and needs to be lighter
|
|
98
|
-
var needsDarker = contrast(value, "#000000") > contrast(value, "#ffffff");
|
|
99
|
-
legibilityText = needsDarker ? "⚠️ Too light" : "⚠️ Too dark";
|
|
100
|
-
}
|
|
101
|
-
return { isLegible: isLegible, legibilityText: legibilityText };
|
|
102
|
-
}
|
|
103
|
-
catch (error) {
|
|
104
|
-
// If there's an error in contrast calculation, assume it's legible
|
|
105
|
-
return { isLegible: true, legibilityText: undefined };
|
|
106
|
-
}
|
|
107
|
-
}, [checkLegible, value, legibleAgainst]);
|
|
108
|
-
useEffect(function () {
|
|
109
|
-
var _a;
|
|
110
|
-
if (focus) {
|
|
111
|
-
(_a = inputRef === null || inputRef === void 0 ? void 0 : inputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
112
|
-
}
|
|
113
|
-
}, [focus]);
|
|
114
|
-
return (jsxs(ColorPickerContainer, { children: [jsx(ColorInputWrapper, { "$disabled": disabled, "$showValidationMessage": showValidationMessage || (checkLegible && !legibilityInfo.isLegible), "$themeOverride": themeOverride, children: jsx(ColorInput, __assign({ ref: inputRef, type: "color", value: value, disabled: disabled, "$disabled": disabled, "$themeOverride": themeOverride }, (name ? { name: name } : {}), { onChange: function (event) {
|
|
115
|
-
onValueChange === null || onValueChange === void 0 ? void 0 : onValueChange(event.target.value);
|
|
116
|
-
onChange === null || onChange === void 0 ? void 0 : onChange({
|
|
117
|
-
target: {
|
|
118
|
-
value: event.target.value,
|
|
119
|
-
name: name,
|
|
120
|
-
selectionStart: event.target.selectionStart || undefined,
|
|
121
|
-
selectionEnd: event.target.selectionEnd || undefined,
|
|
122
|
-
},
|
|
123
|
-
nativeEvent: event.nativeEvent,
|
|
124
|
-
});
|
|
125
|
-
}, onBlur: function (event) {
|
|
126
|
-
if (onInputBlur) {
|
|
127
|
-
onInputBlur(event);
|
|
128
|
-
}
|
|
129
|
-
}, onFocus: function (event) {
|
|
130
|
-
if (onInputFocus) {
|
|
131
|
-
onInputFocus(event);
|
|
132
|
-
}
|
|
133
|
-
}, onKeyDown: function (event) {
|
|
134
|
-
if (event.key === "Enter" && onEnter) {
|
|
135
|
-
onEnter(value);
|
|
136
|
-
}
|
|
137
|
-
}, "aria-label": typeof inputLabel === "string" ? inputLabel : undefined })) }), checkLegible && legibilityInfo.legibilityText && (jsx(LegibilityText, { "$isLegible": legibilityInfo.isLegible, "$disabled": disabled, "$themeOverride": themeOverride, children: legibilityInfo.legibilityText }))] }));
|
|
138
|
-
};
|
|
139
|
-
var templateObject_1$1, templateObject_2, templateObject_3, templateObject_4;
|
|
140
|
-
|
|
141
|
-
var InstructionalText = styled(BodyXSPrimary)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n\tcolor: ", ";\n\tfont-size: ", "px;\n\tmargin-bottom: ", "px;\n"], ["\n\tcolor: ", ";\n\tfont-size: ", "px;\n\tmargin-bottom: ", "px;\n"])), function (_a) {
|
|
142
|
-
var theme = _a.theme, $themeOverride = _a.$themeOverride;
|
|
143
|
-
return ($themeOverride === null || $themeOverride === void 0 ? void 0 : $themeOverride.instructionalTextColor) || theme.colorPickerInput.instructionalTextColor;
|
|
144
|
-
}, function (_a) {
|
|
145
|
-
var theme = _a.theme, $themeOverride = _a.$themeOverride;
|
|
146
|
-
return ($themeOverride === null || $themeOverride === void 0 ? void 0 : $themeOverride.instructionalTextFontSize) || theme.colorPickerInput.instructionalTextFontSize;
|
|
147
|
-
}, function (_a) {
|
|
148
|
-
var theme = _a.theme, $themeOverride = _a.$themeOverride;
|
|
149
|
-
return ($themeOverride === null || $themeOverride === void 0 ? void 0 : $themeOverride.instructionalTextFontSize) || theme.colorPickerInput.instructionalTextFontSize;
|
|
150
|
-
});
|
|
151
|
-
var ColorPickerInput = function (props) {
|
|
152
|
-
var _a = props.checkLegible, checkLegible = _a === void 0 ? false : _a, _b = props.disabled, disabled = _b === void 0 ? false : _b, helperText = props.helperText, inputLabel = props.inputLabel, inputWidth = props.inputWidth, instructionalText = props.instructionalText, _c = props.showValidationMessage, showValidationMessage = _c === void 0 ? false : _c, themeOverride = props.themeOverride, validationMessage = props.validationMessage;
|
|
153
|
-
var labelBoxRef = useRef(null);
|
|
154
|
-
var _d = useMeasure(), inputGroupRef = _d[0], inputGroupMeasure = _d[1];
|
|
155
|
-
var validationRef = useRef(null);
|
|
156
|
-
var _e = useState(false), designSwitch = _e[0], setDesignSwitch = _e[1];
|
|
157
|
-
var helperTextVisible = !showValidationMessage || !designSwitch;
|
|
158
|
-
useEffect(function () {
|
|
159
|
-
var _a, _b;
|
|
160
|
-
var validationWidth = ((_a = validationRef.current) === null || _a === void 0 ? void 0 : _a.clientWidth) || 0;
|
|
161
|
-
var labelWidth = ((_b = labelBoxRef.current) === null || _b === void 0 ? void 0 : _b.clientWidth) || 0;
|
|
162
|
-
var noRoomForTopLabel = validationWidth + labelWidth >= inputGroupMeasure.width;
|
|
163
|
-
if (noRoomForTopLabel) {
|
|
164
|
-
setDesignSwitch(true);
|
|
165
|
-
}
|
|
166
|
-
else {
|
|
167
|
-
setDesignSwitch(false);
|
|
168
|
-
}
|
|
169
|
-
}, [inputGroupMeasure.width, showValidationMessage, inputLabel, validationMessage]);
|
|
170
|
-
return (jsxs(InputGroup, { ref: inputGroupRef, "$inputWidth": inputWidth, "$roomForError": showValidationMessage && !inputLabel, children: [jsx(LabelBox, { ref: labelBoxRef, children: showLabel({
|
|
171
|
-
inputLabel: inputLabel,
|
|
172
|
-
disabled: disabled,
|
|
173
|
-
disabledColor: themeOverride === null || themeOverride === void 0 ? void 0 : themeOverride.disabledColor,
|
|
174
|
-
labelColor: themeOverride === null || themeOverride === void 0 ? void 0 : themeOverride.labelColor,
|
|
175
|
-
}) }), instructionalText && jsx(InstructionalText, { "$themeOverride": themeOverride, children: instructionalText }), jsx(InlineColorPickerInput, __assign({}, props, { checkLegible: checkLegible, themeOverride: themeOverride })), jsx(ValidationText, { ref: validationRef, "$showValidationMessage": showValidationMessage, "$disabled": disabled, "$failColor": themeOverride === null || themeOverride === void 0 ? void 0 : themeOverride.failColor, "$disabledColor": themeOverride === null || themeOverride === void 0 ? void 0 : themeOverride.disabledColor, "$designSwitch": designSwitch && showValidationMessage, children: validationMessage }), helperTextVisible && (jsx(HelperText, { "$disabled": disabled, "$helperTextColor": themeOverride === null || themeOverride === void 0 ? void 0 : themeOverride.helperTextColor, "$disabledColor": themeOverride === null || themeOverride === void 0 ? void 0 : themeOverride.disabledColor, "data-sentry-unmask": true, children: helperText }))] }));
|
|
176
|
-
};
|
|
177
|
-
var templateObject_1;
|
|
178
|
-
|
|
179
|
-
export { ColorPickerInput as C, InlineColorPickerInput as I };
|
|
180
|
-
//# sourceMappingURL=ColorPickerInput-S8X2gIA5.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ColorPickerInput-S8X2gIA5.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
export { C as ColorPickerInput, I as InlineColorPickerInput } from './ColorPickerInput-S8X2gIA5.js';
|
|
2
|
-
import './_tslib-CcAXazg4.js';
|
|
3
|
-
import 'react/jsx-runtime';
|
|
4
|
-
import 'react';
|
|
5
|
-
import 'styled-components';
|
|
6
|
-
import './BodyLEmphasis.js';
|
|
7
|
-
import './useMeasure-D89v6c_A.js';
|
|
8
|
-
import './addOrRemoveById.js';
|
|
9
|
-
import 'dayjs';
|
|
10
|
-
import './isEmptyObject.js';
|
|
11
|
-
import './useIsomorphicLayoutEffect-Br1zBZHl.js';
|
|
12
|
-
import './showLabel-D6KgNem4.js';
|
|
13
|
-
import './Inputs-C6OWHviY.js';
|
|
14
|
-
import './colors.js';
|
|
15
|
-
import './IconComponentStyles-BwczcTS4.js';
|
|
16
|
-
import './pressedEnter.js';
|
|
17
|
-
import './validateColorContrast.js';
|
|
18
|
-
//# sourceMappingURL=ColorPickerInput.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ColorPickerInput.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
export { C as ColorPickerInput, I as InlineColorPickerInput } from './ColorPickerInput-S8X2gIA5.js';
|
|
2
|
-
import './_tslib-CcAXazg4.js';
|
|
3
|
-
import 'react/jsx-runtime';
|
|
4
|
-
import 'react';
|
|
5
|
-
import 'styled-components';
|
|
6
|
-
import './BodyLEmphasis.js';
|
|
7
|
-
import './useMeasure-D89v6c_A.js';
|
|
8
|
-
import './addOrRemoveById.js';
|
|
9
|
-
import 'dayjs';
|
|
10
|
-
import './isEmptyObject.js';
|
|
11
|
-
import './useIsomorphicLayoutEffect-Br1zBZHl.js';
|
|
12
|
-
import './showLabel-D6KgNem4.js';
|
|
13
|
-
import './Inputs-C6OWHviY.js';
|
|
14
|
-
import './colors.js';
|
|
15
|
-
import './IconComponentStyles-BwczcTS4.js';
|
|
16
|
-
import './pressedEnter.js';
|
|
17
|
-
import './validateColorContrast.js';
|
|
18
|
-
//# sourceMappingURL=InlineColorPickerInput.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"InlineColorPickerInput.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;"}
|