@beweco/aurora-ui 0.6.51 → 0.6.52

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/dist/index.cjs.js CHANGED
@@ -659,7 +659,7 @@ var defaultTranslations$d = {
659
659
  predefinedColorsLabel: "Colores predefinidos",
660
660
  recentColorsLabel: "Colores recientes",
661
661
  noRecentColors: "No hay colores recientes",
662
- invalidColorFormat: "Formato de color inválido. Usa #RRGGBB",
662
+ invalidColorFormat: "El código de color no es un formato HEX válido (Ej: #FF5733 o FFA07A)",
663
663
  colorPreview: "Vista previa del color",
664
664
  };
665
665
  /**
@@ -713,7 +713,7 @@ var stripHash = function (color) { return color.replace(/^#+/, ""); };
713
713
  * />
714
714
  * ```
715
715
  */
716
- var ColorPicker = function (_a) {
716
+ var ColorPicker = React.forwardRef(function (_a, ref) {
717
717
  var value = _a.value, onChange = _a.onChange, label = _a.label, _b = _a.required, required = _b === void 0 ? false : _b, _c = _a.disabled, disabled = _c === void 0 ? false : _c, _d = _a.error, error = _d === void 0 ? false : _d, errorText = _a.errorText, _e = _a.predefinedColors, predefinedColors = _e === void 0 ? DEFAULT_PREDEFINED_COLORS : _e, _f = _a.enableRecentColors, enableRecentColors = _f === void 0 ? true : _f, _g = _a.maxRecentColors, maxRecentColors = _g === void 0 ? 6 : _g, _h = _a.recentColorsStorageKey, recentColorsStorageKey = _h === void 0 ? "aurora-ui-recent-colors" : _h, _j = _a.showPredefinedColors, showPredefinedColors = _j === void 0 ? true : _j, _k = _a.translations, translations = _k === void 0 ? {} : _k, _l = _a.className, className = _l === void 0 ? "" : _l, id = _a.id, name = _a.name;
718
718
  var generatedId = React.useId();
719
719
  var inputId = id || generatedId;
@@ -775,26 +775,61 @@ var ColorPicker = function (_a) {
775
775
  onChange(newColor);
776
776
  };
777
777
  /**
778
- * Handle text input change
778
+ * Handle text input change — passive: no validation, normalization, or
779
+ * onChange propagation while typing. We only update local state and clear
780
+ * any stale error so the user can correct an invalid value without the
781
+ * red border lingering. Validation (and stripping of the leading "#")
782
+ * runs on blur.
783
+ *
784
+ * While typing we let the user see whatever they pressed — including a
785
+ * leading "#" — so the input feels responsive. To prevent a double "#"
786
+ * on screen, the fixed prefix in `startContent` is hidden while
787
+ * `textValue` already starts with "#". The cap is `7` (1 "#" + 6 hex)
788
+ * when the user opted into a leading "#", otherwise `6`.
779
789
  */
780
790
  var handleTextChange = function (newValue) {
781
- // Strip any "#" the user types or pastes — the prefix is fixed in the UI.
782
- var cleaned = stripHash(newValue);
783
- setTextValue(cleaned);
784
- // Validate the candidate hex color with "#" prepended
785
- var candidate = "#".concat(cleaned);
786
- if (isValidHexColor(candidate)) {
787
- var normalized = normalizeHexColor(candidate);
788
- setIsInvalidFormat(false);
789
- onChange(normalized);
790
- }
791
- else if (cleaned.length >= 3) {
792
- // Show error only if user has typed enough characters
791
+ var max = newValue.startsWith("#") ? 7 : 6;
792
+ setTextValue(newValue.slice(0, max));
793
+ setIsInvalidFormat(false);
794
+ };
795
+ /**
796
+ * Validate the current hex input. Updates `isInvalidFormat` and, when
797
+ * the input is a valid hex, normalizes the display and propagates via
798
+ * `onChange`. Returns whether the input is acceptable so a caller can
799
+ * decide to block submission.
800
+ *
801
+ * Empty + not required → valid (no error, no propagation).
802
+ * Empty + required invalid (error).
803
+ * Valid (3 or 6 hex chars, with or without leading "#") → normalize, sync
804
+ * display to canonical form, propagate, valid.
805
+ * Otherwise → invalid (error, no propagation).
806
+ */
807
+ var validate = React.useCallback(function () {
808
+ // User may have typed a leading "#" — strip it so it doesn't end up
809
+ // as "##" once we prepend "#" for the regex check.
810
+ var trimmed = stripHash(textValue.trim());
811
+ if (trimmed === "") {
812
+ var valid = !required;
813
+ setIsInvalidFormat(!valid);
814
+ // Drop any residual "#" the user typed but never followed up on,
815
+ // so the field reads as truly empty after blur.
816
+ setTextValue("");
817
+ return valid;
818
+ }
819
+ var candidate = "#".concat(trimmed);
820
+ if (!isValidHexColor(candidate)) {
793
821
  setIsInvalidFormat(true);
822
+ return false;
794
823
  }
795
- else {
796
- setIsInvalidFormat(false);
797
- }
824
+ var normalized = normalizeHexColor(candidate);
825
+ setIsInvalidFormat(false);
826
+ setTextValue(stripHash(normalized));
827
+ onChange(normalized);
828
+ return true;
829
+ }, [textValue, required, onChange]);
830
+ React.useImperativeHandle(ref, function () { return ({ validate: validate }); }, [validate]);
831
+ var handleTextBlur = function () {
832
+ validate();
798
833
  };
799
834
  /**
800
835
  * Handle predefined color selection
@@ -813,17 +848,17 @@ var ColorPicker = function (_a) {
813
848
  var renderColorCircle = function (colorValue, colorName, isSelected) { return (jsxRuntime.jsx("button", { type: "button", disabled: disabled, onClick: function () { return handlePredefinedColorClick(colorValue); }, className: "\n\t\t\t\tw-8 h-8 rounded-full border-2 cursor-pointer transition-all\n\t\t\t\tfocus:outline-none focus:ring-2 focus:ring-primary-500 focus:ring-offset-1\n\t\t\t\t".concat(disabled ? "opacity-50 cursor-not-allowed" : "hover:scale-110", "\n\t\t\t\t").concat(isSelected
814
849
  ? "border-primary-500 scale-110 ring-2 ring-primary-500 ring-offset-1"
815
850
  : "border-default-700", "\n\t\t\t"), style: { backgroundColor: colorValue }, title: colorName, "aria-label": colorName }, colorValue)); };
816
- return (jsxRuntime.jsxs("div", { className: "flex flex-col gap-3 ".concat(className), children: [label && (jsxRuntime.jsxs("label", { htmlFor: inputId, className: "block text-sm font-medium text-foreground", children: [label, required && jsxRuntime.jsx("span", { className: "text-danger ml-1", children: "*" })] })), jsxRuntime.jsxs("div", { className: "flex flex-col gap-1", children: [jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [jsxRuntime.jsx("input", { type: "color", id: inputId, name: name, value: "#".concat(textValue), onChange: handleColorPickerChange, disabled: disabled, className: "\n\t\t\t\t\t\t\tw-10 h-10 rounded-lg cursor-pointer border-2 flex-shrink-0\n\t\t\t\t\t\t\ttransition-colors appearance-none bg-transparent p-0.5\n\t\t\t\t\t\t\tfocus:border-primary-500\n\t\t\t\t\t\t\t".concat(disabled ? "opacity-50 cursor-not-allowed" : "hover:border-default-400", "\n\t\t\t\t\t\t\t").concat(error
851
+ return (jsxRuntime.jsxs("div", { className: "flex flex-col gap-3 ".concat(className), children: [label && (jsxRuntime.jsxs("label", { htmlFor: inputId, className: "block text-sm font-medium text-foreground", children: [label, required && jsxRuntime.jsx("span", { className: "text-danger ml-1", children: "*" })] })), jsxRuntime.jsxs("div", { className: "flex flex-col gap-1", children: [jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [jsxRuntime.jsx("input", { type: "color", id: inputId, name: name, value: "#".concat(stripHash(textValue)), onChange: handleColorPickerChange, disabled: disabled, className: "\n\t\t\t\t\t\t\tw-10 h-10 rounded-lg cursor-pointer border-2 flex-shrink-0\n\t\t\t\t\t\t\ttransition-colors appearance-none bg-transparent p-0.5\n\t\t\t\t\t\t\tfocus:border-primary-500\n\t\t\t\t\t\t\t".concat(disabled ? "opacity-50 cursor-not-allowed" : "hover:border-default-400", "\n\t\t\t\t\t\t\t").concat(error
817
852
  ? "border-danger dark:border-danger-400"
818
- : "border-default-300 dark:border-default-700", "\n\t\t\t\t\t\t"), "aria-label": t.customColorLabel, title: t.customColorLabel }), jsxRuntime.jsx(react.Input, { type: "text", value: textValue, onValueChange: handleTextChange, placeholder: t.placeholder, disabled: disabled, isInvalid: error || isInvalidFormat, size: "sm", variant: "bordered", maxLength: 6, classNames: {
853
+ : "border-default-300 dark:border-default-700", "\n\t\t\t\t\t\t"), "aria-label": t.customColorLabel, title: t.customColorLabel }), jsxRuntime.jsx(react.Input, { type: "text", value: textValue, onValueChange: handleTextChange, onBlur: handleTextBlur, placeholder: t.placeholder, disabled: disabled, isInvalid: error || isInvalidFormat, size: "sm", variant: "bordered", classNames: {
819
854
  input: "uppercase font-mono text-small",
820
855
  inputWrapper: "min-h-8 h-8 focus-within:!border-primary-500",
821
- }, startContent: jsxRuntime.jsx("span", { className: "text-default-400 text-sm", children: "#" }) })] }), (error || isInvalidFormat) && (jsxRuntime.jsx("p", { className: "text-tiny text-danger", children: isInvalidFormat ? t.invalidColorFormat : errorText }))] }), showPredefinedColors && predefinedColors.length > 0 && (jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx("p", { className: "text-xs font-medium text-default-600 mb-2", children: t.predefinedColorsLabel }), jsxRuntime.jsx("div", { className: "flex flex-wrap gap-2", children: predefinedColors.map(function (color) {
856
+ }, startContent: textValue.startsWith("#") ? null : (jsxRuntime.jsx("span", { className: "text-default-400 text-sm", children: "#" })) })] }), (error || isInvalidFormat) && (jsxRuntime.jsx("p", { className: "text-tiny text-danger", children: isInvalidFormat ? t.invalidColorFormat : errorText }))] }), showPredefinedColors && predefinedColors.length > 0 && (jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx("p", { className: "text-xs font-medium text-default-600 mb-2", children: t.predefinedColorsLabel }), jsxRuntime.jsx("div", { className: "flex flex-wrap gap-2", children: predefinedColors.map(function (color) {
822
857
  return renderColorCircle(color.value, color.name, normalizeHexColor(value) === normalizeHexColor(color.value));
823
858
  }) })] })), enableRecentColors && recentColors.length > 0 && (jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx("p", { className: "text-xs font-medium text-default-600 mb-2", children: t.recentColorsLabel }), jsxRuntime.jsx("div", { className: "flex flex-wrap gap-2", children: recentColors.map(function (color) {
824
859
  return renderColorCircle(color, color, normalizeHexColor(value) === color);
825
860
  }) })] }))] }));
826
- };
861
+ });
827
862
  ColorPicker.displayName = "ColorPicker";
828
863
 
829
864
  var ThemeContext = React.createContext({
package/dist/index.esm.js CHANGED
@@ -4,7 +4,7 @@ export { Slider } from '@heroui/react';
4
4
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
5
5
  import { Icon } from '@iconify/react';
6
6
  export { loadIcons } from '@iconify/react';
7
- import React, { useId, useState, useCallback, useMemo, useEffect, createContext, useContext, useRef, useLayoutEffect, memo, createElement, Fragment as Fragment$1, forwardRef, useImperativeHandle } from 'react';
7
+ import React, { useId, useState, useCallback, useMemo, forwardRef, useEffect, useImperativeHandle, createContext, useContext, useRef, useLayoutEffect, memo, createElement, Fragment as Fragment$1 } from 'react';
8
8
  import { ResponsiveContainer, AreaChart, CartesianGrid, XAxis, Tooltip, Area, LineChart, YAxis, Line } from 'recharts';
9
9
  import { createPortal } from 'react-dom';
10
10
  import { motion, AnimatePresence } from 'framer-motion';
@@ -660,7 +660,7 @@ var defaultTranslations$d = {
660
660
  predefinedColorsLabel: "Colores predefinidos",
661
661
  recentColorsLabel: "Colores recientes",
662
662
  noRecentColors: "No hay colores recientes",
663
- invalidColorFormat: "Formato de color inválido. Usa #RRGGBB",
663
+ invalidColorFormat: "El código de color no es un formato HEX válido (Ej: #FF5733 o FFA07A)",
664
664
  colorPreview: "Vista previa del color",
665
665
  };
666
666
  /**
@@ -714,7 +714,7 @@ var stripHash = function (color) { return color.replace(/^#+/, ""); };
714
714
  * />
715
715
  * ```
716
716
  */
717
- var ColorPicker = function (_a) {
717
+ var ColorPicker = forwardRef(function (_a, ref) {
718
718
  var value = _a.value, onChange = _a.onChange, label = _a.label, _b = _a.required, required = _b === void 0 ? false : _b, _c = _a.disabled, disabled = _c === void 0 ? false : _c, _d = _a.error, error = _d === void 0 ? false : _d, errorText = _a.errorText, _e = _a.predefinedColors, predefinedColors = _e === void 0 ? DEFAULT_PREDEFINED_COLORS : _e, _f = _a.enableRecentColors, enableRecentColors = _f === void 0 ? true : _f, _g = _a.maxRecentColors, maxRecentColors = _g === void 0 ? 6 : _g, _h = _a.recentColorsStorageKey, recentColorsStorageKey = _h === void 0 ? "aurora-ui-recent-colors" : _h, _j = _a.showPredefinedColors, showPredefinedColors = _j === void 0 ? true : _j, _k = _a.translations, translations = _k === void 0 ? {} : _k, _l = _a.className, className = _l === void 0 ? "" : _l, id = _a.id, name = _a.name;
719
719
  var generatedId = useId();
720
720
  var inputId = id || generatedId;
@@ -776,26 +776,61 @@ var ColorPicker = function (_a) {
776
776
  onChange(newColor);
777
777
  };
778
778
  /**
779
- * Handle text input change
779
+ * Handle text input change — passive: no validation, normalization, or
780
+ * onChange propagation while typing. We only update local state and clear
781
+ * any stale error so the user can correct an invalid value without the
782
+ * red border lingering. Validation (and stripping of the leading "#")
783
+ * runs on blur.
784
+ *
785
+ * While typing we let the user see whatever they pressed — including a
786
+ * leading "#" — so the input feels responsive. To prevent a double "#"
787
+ * on screen, the fixed prefix in `startContent` is hidden while
788
+ * `textValue` already starts with "#". The cap is `7` (1 "#" + 6 hex)
789
+ * when the user opted into a leading "#", otherwise `6`.
780
790
  */
781
791
  var handleTextChange = function (newValue) {
782
- // Strip any "#" the user types or pastes — the prefix is fixed in the UI.
783
- var cleaned = stripHash(newValue);
784
- setTextValue(cleaned);
785
- // Validate the candidate hex color with "#" prepended
786
- var candidate = "#".concat(cleaned);
787
- if (isValidHexColor(candidate)) {
788
- var normalized = normalizeHexColor(candidate);
789
- setIsInvalidFormat(false);
790
- onChange(normalized);
791
- }
792
- else if (cleaned.length >= 3) {
793
- // Show error only if user has typed enough characters
792
+ var max = newValue.startsWith("#") ? 7 : 6;
793
+ setTextValue(newValue.slice(0, max));
794
+ setIsInvalidFormat(false);
795
+ };
796
+ /**
797
+ * Validate the current hex input. Updates `isInvalidFormat` and, when
798
+ * the input is a valid hex, normalizes the display and propagates via
799
+ * `onChange`. Returns whether the input is acceptable so a caller can
800
+ * decide to block submission.
801
+ *
802
+ * Empty + not required → valid (no error, no propagation).
803
+ * Empty + required invalid (error).
804
+ * Valid (3 or 6 hex chars, with or without leading "#") → normalize, sync
805
+ * display to canonical form, propagate, valid.
806
+ * Otherwise → invalid (error, no propagation).
807
+ */
808
+ var validate = useCallback(function () {
809
+ // User may have typed a leading "#" — strip it so it doesn't end up
810
+ // as "##" once we prepend "#" for the regex check.
811
+ var trimmed = stripHash(textValue.trim());
812
+ if (trimmed === "") {
813
+ var valid = !required;
814
+ setIsInvalidFormat(!valid);
815
+ // Drop any residual "#" the user typed but never followed up on,
816
+ // so the field reads as truly empty after blur.
817
+ setTextValue("");
818
+ return valid;
819
+ }
820
+ var candidate = "#".concat(trimmed);
821
+ if (!isValidHexColor(candidate)) {
794
822
  setIsInvalidFormat(true);
823
+ return false;
795
824
  }
796
- else {
797
- setIsInvalidFormat(false);
798
- }
825
+ var normalized = normalizeHexColor(candidate);
826
+ setIsInvalidFormat(false);
827
+ setTextValue(stripHash(normalized));
828
+ onChange(normalized);
829
+ return true;
830
+ }, [textValue, required, onChange]);
831
+ useImperativeHandle(ref, function () { return ({ validate: validate }); }, [validate]);
832
+ var handleTextBlur = function () {
833
+ validate();
799
834
  };
800
835
  /**
801
836
  * Handle predefined color selection
@@ -814,17 +849,17 @@ var ColorPicker = function (_a) {
814
849
  var renderColorCircle = function (colorValue, colorName, isSelected) { return (jsx("button", { type: "button", disabled: disabled, onClick: function () { return handlePredefinedColorClick(colorValue); }, className: "\n\t\t\t\tw-8 h-8 rounded-full border-2 cursor-pointer transition-all\n\t\t\t\tfocus:outline-none focus:ring-2 focus:ring-primary-500 focus:ring-offset-1\n\t\t\t\t".concat(disabled ? "opacity-50 cursor-not-allowed" : "hover:scale-110", "\n\t\t\t\t").concat(isSelected
815
850
  ? "border-primary-500 scale-110 ring-2 ring-primary-500 ring-offset-1"
816
851
  : "border-default-700", "\n\t\t\t"), style: { backgroundColor: colorValue }, title: colorName, "aria-label": colorName }, colorValue)); };
817
- return (jsxs("div", { className: "flex flex-col gap-3 ".concat(className), children: [label && (jsxs("label", { htmlFor: inputId, className: "block text-sm font-medium text-foreground", children: [label, required && jsx("span", { className: "text-danger ml-1", children: "*" })] })), jsxs("div", { className: "flex flex-col gap-1", children: [jsxs("div", { className: "flex items-center gap-2", children: [jsx("input", { type: "color", id: inputId, name: name, value: "#".concat(textValue), onChange: handleColorPickerChange, disabled: disabled, className: "\n\t\t\t\t\t\t\tw-10 h-10 rounded-lg cursor-pointer border-2 flex-shrink-0\n\t\t\t\t\t\t\ttransition-colors appearance-none bg-transparent p-0.5\n\t\t\t\t\t\t\tfocus:border-primary-500\n\t\t\t\t\t\t\t".concat(disabled ? "opacity-50 cursor-not-allowed" : "hover:border-default-400", "\n\t\t\t\t\t\t\t").concat(error
852
+ return (jsxs("div", { className: "flex flex-col gap-3 ".concat(className), children: [label && (jsxs("label", { htmlFor: inputId, className: "block text-sm font-medium text-foreground", children: [label, required && jsx("span", { className: "text-danger ml-1", children: "*" })] })), jsxs("div", { className: "flex flex-col gap-1", children: [jsxs("div", { className: "flex items-center gap-2", children: [jsx("input", { type: "color", id: inputId, name: name, value: "#".concat(stripHash(textValue)), onChange: handleColorPickerChange, disabled: disabled, className: "\n\t\t\t\t\t\t\tw-10 h-10 rounded-lg cursor-pointer border-2 flex-shrink-0\n\t\t\t\t\t\t\ttransition-colors appearance-none bg-transparent p-0.5\n\t\t\t\t\t\t\tfocus:border-primary-500\n\t\t\t\t\t\t\t".concat(disabled ? "opacity-50 cursor-not-allowed" : "hover:border-default-400", "\n\t\t\t\t\t\t\t").concat(error
818
853
  ? "border-danger dark:border-danger-400"
819
- : "border-default-300 dark:border-default-700", "\n\t\t\t\t\t\t"), "aria-label": t.customColorLabel, title: t.customColorLabel }), jsx(Input$1, { type: "text", value: textValue, onValueChange: handleTextChange, placeholder: t.placeholder, disabled: disabled, isInvalid: error || isInvalidFormat, size: "sm", variant: "bordered", maxLength: 6, classNames: {
854
+ : "border-default-300 dark:border-default-700", "\n\t\t\t\t\t\t"), "aria-label": t.customColorLabel, title: t.customColorLabel }), jsx(Input$1, { type: "text", value: textValue, onValueChange: handleTextChange, onBlur: handleTextBlur, placeholder: t.placeholder, disabled: disabled, isInvalid: error || isInvalidFormat, size: "sm", variant: "bordered", classNames: {
820
855
  input: "uppercase font-mono text-small",
821
856
  inputWrapper: "min-h-8 h-8 focus-within:!border-primary-500",
822
- }, startContent: jsx("span", { className: "text-default-400 text-sm", children: "#" }) })] }), (error || isInvalidFormat) && (jsx("p", { className: "text-tiny text-danger", children: isInvalidFormat ? t.invalidColorFormat : errorText }))] }), showPredefinedColors && predefinedColors.length > 0 && (jsxs("div", { children: [jsx("p", { className: "text-xs font-medium text-default-600 mb-2", children: t.predefinedColorsLabel }), jsx("div", { className: "flex flex-wrap gap-2", children: predefinedColors.map(function (color) {
857
+ }, startContent: textValue.startsWith("#") ? null : (jsx("span", { className: "text-default-400 text-sm", children: "#" })) })] }), (error || isInvalidFormat) && (jsx("p", { className: "text-tiny text-danger", children: isInvalidFormat ? t.invalidColorFormat : errorText }))] }), showPredefinedColors && predefinedColors.length > 0 && (jsxs("div", { children: [jsx("p", { className: "text-xs font-medium text-default-600 mb-2", children: t.predefinedColorsLabel }), jsx("div", { className: "flex flex-wrap gap-2", children: predefinedColors.map(function (color) {
823
858
  return renderColorCircle(color.value, color.name, normalizeHexColor(value) === normalizeHexColor(color.value));
824
859
  }) })] })), enableRecentColors && recentColors.length > 0 && (jsxs("div", { children: [jsx("p", { className: "text-xs font-medium text-default-600 mb-2", children: t.recentColorsLabel }), jsx("div", { className: "flex flex-wrap gap-2", children: recentColors.map(function (color) {
825
860
  return renderColorCircle(color, color, normalizeHexColor(value) === color);
826
861
  }) })] }))] }));
827
- };
862
+ });
828
863
  ColorPicker.displayName = "ColorPicker";
829
864
 
830
865
  var ThemeContext = createContext({
@@ -1,5 +1,5 @@
1
1
  import type React from "react";
2
- import type { ColorPickerProps } from "./ColorPicker.types";
2
+ import type { ColorPickerHandle, ColorPickerProps } from "./ColorPicker.types";
3
3
  /**
4
4
  * ColorPicker - Advanced color selection component
5
5
  *
@@ -23,5 +23,5 @@ import type { ColorPickerProps } from "./ColorPicker.types";
23
23
  * />
24
24
  * ```
25
25
  */
26
- export declare const ColorPicker: React.FC<ColorPickerProps>;
26
+ export declare const ColorPicker: React.ForwardRefExoticComponent<ColorPickerProps & React.RefAttributes<ColorPickerHandle>>;
27
27
  //# sourceMappingURL=ColorPicker.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ColorPicker.d.ts","sourceRoot":"","sources":["../../../../src/components/color-picker/ColorPicker.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EACX,gBAAgB,EAGhB,MAAM,qBAAqB,CAAC;AAkD7B;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,eAAO,MAAM,WAAW,EAAE,KAAK,CAAC,EAAE,CAAC,gBAAgB,CA2PlD,CAAC"}
1
+ {"version":3,"file":"ColorPicker.d.ts","sourceRoot":"","sources":["../../../../src/components/color-picker/ColorPicker.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAS/B,OAAO,KAAK,EACX,iBAAiB,EACjB,gBAAgB,EAGhB,MAAM,qBAAqB,CAAC;AAmD7B;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,eAAO,MAAM,WAAW,4FAuStB,CAAC"}
@@ -30,6 +30,18 @@ export interface PredefinedColor {
30
30
  /** Optional tooltip */
31
31
  tooltip?: string;
32
32
  }
33
+ /**
34
+ * Imperative handle exposed via `ref` so a parent (typically the "Save" /
35
+ * "Continue" button handler of a form) can force the hex input to re-validate
36
+ * synchronously and decide whether to proceed.
37
+ *
38
+ * `validate()` returns `true` when the current input is acceptable and
39
+ * `false` when it is not. As a side effect it updates the visible error
40
+ * state, so the user sees what is blocking submission.
41
+ */
42
+ export interface ColorPickerHandle {
43
+ validate: () => boolean;
44
+ }
33
45
  /**
34
46
  * ColorPicker component props
35
47
  */
@@ -1 +1 @@
1
- {"version":3,"file":"ColorPicker.types.d.ts","sourceRoot":"","sources":["../../../../src/components/color-picker/ColorPicker.types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;GAGG;AACH,MAAM,WAAW,uBAAuB;IACvC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,YAAY,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC/B,wBAAwB;IACxB,GAAG,EAAE,MAAM,CAAC;IACZ,mBAAmB;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,wCAAwC;IACxC,KAAK,EAAE,MAAM,CAAC;IACd,uBAAuB;IACvB,OAAO,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAChC,mDAAmD;IACnD,KAAK,EAAE,MAAM,CAAC;IAEd,kCAAkC;IAClC,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAElC,iBAAiB;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf,oCAAoC;IACpC,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB,oCAAoC;IACpC,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB,kBAAkB;IAClB,KAAK,CAAC,EAAE,OAAO,CAAC;IAEhB,yBAAyB;IACzB,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,+BAA+B;IAC/B,gBAAgB,CAAC,EAAE,eAAe,EAAE,CAAC;IAErC,mCAAmC;IACnC,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAE7B,+CAA+C;IAC/C,eAAe,CAAC,EAAE,MAAM,CAAC;IAEzB,yCAAyC;IACzC,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAEhC,qCAAqC;IACrC,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAE/B,4BAA4B;IAC5B,YAAY,CAAC,EAAE,uBAAuB,CAAC;IAEvC,uBAAuB;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,oBAAoB;IACpB,EAAE,CAAC,EAAE,MAAM,CAAC;IAEZ,+BAA+B;IAC/B,IAAI,CAAC,EAAE,MAAM,CAAC;CACd;AAED;;GAEG;AACH,eAAO,MAAM,yBAAyB,EAAE,eAAe,EAyBtD,CAAC"}
1
+ {"version":3,"file":"ColorPicker.types.d.ts","sourceRoot":"","sources":["../../../../src/components/color-picker/ColorPicker.types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;GAGG;AACH,MAAM,WAAW,uBAAuB;IACvC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,YAAY,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC/B,wBAAwB;IACxB,GAAG,EAAE,MAAM,CAAC;IACZ,mBAAmB;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,wCAAwC;IACxC,KAAK,EAAE,MAAM,CAAC;IACd,uBAAuB;IACvB,OAAO,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,iBAAiB;IACjC,QAAQ,EAAE,MAAM,OAAO,CAAC;CACxB;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAChC,mDAAmD;IACnD,KAAK,EAAE,MAAM,CAAC;IAEd,kCAAkC;IAClC,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAElC,iBAAiB;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf,oCAAoC;IACpC,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB,oCAAoC;IACpC,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB,kBAAkB;IAClB,KAAK,CAAC,EAAE,OAAO,CAAC;IAEhB,yBAAyB;IACzB,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,+BAA+B;IAC/B,gBAAgB,CAAC,EAAE,eAAe,EAAE,CAAC;IAErC,mCAAmC;IACnC,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAE7B,+CAA+C;IAC/C,eAAe,CAAC,EAAE,MAAM,CAAC;IAEzB,yCAAyC;IACzC,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAEhC,qCAAqC;IACrC,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAE/B,4BAA4B;IAC5B,YAAY,CAAC,EAAE,uBAAuB,CAAC;IAEvC,uBAAuB;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,oBAAoB;IACpB,EAAE,CAAC,EAAE,MAAM,CAAC;IAEZ,+BAA+B;IAC/B,IAAI,CAAC,EAAE,MAAM,CAAC;CACd;AAED;;GAEG;AACH,eAAO,MAAM,yBAAyB,EAAE,eAAe,EAyBtD,CAAC"}
@@ -1,4 +1,4 @@
1
1
  export { ColorPicker } from "./ColorPicker.js";
2
- export type { ColorPickerProps, ColorPickerTranslations, PredefinedColor, } from "./ColorPicker.types.js";
2
+ export type { ColorPickerHandle, ColorPickerProps, ColorPickerTranslations, PredefinedColor, } from "./ColorPicker.types.js";
3
3
  export { DEFAULT_PREDEFINED_COLORS } from "./ColorPicker.types.js";
4
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/color-picker/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,YAAY,EACX,gBAAgB,EAChB,uBAAuB,EACvB,eAAe,GACf,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,yBAAyB,EAAE,MAAM,wBAAwB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/color-picker/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,YAAY,EACX,iBAAiB,EACjB,gBAAgB,EAChB,uBAAuB,EACvB,eAAe,GACf,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,yBAAyB,EAAE,MAAM,wBAAwB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@beweco/aurora-ui",
3
- "version": "0.6.51",
3
+ "version": "0.6.52",
4
4
  "description": "Bewe Aurora UI Component Library",
5
5
  "main": "./dist/index.cjs.js",
6
6
  "module": "./dist/index.esm.js",