@openwarelabs/ui 0.10.0 → 0.10.1

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 (33) hide show
  1. package/README.md +5 -1
  2. package/dist/components/Avatar/Avatar.d.cts +2 -13
  3. package/dist/components/Avatar/Avatar.d.ts +2 -13
  4. package/dist/components/Avatar/Avatar.types.d.cts +13 -0
  5. package/dist/components/Avatar/Avatar.types.d.ts +13 -0
  6. package/dist/components/Calendar/DatePicker.d.cts +2 -19
  7. package/dist/components/Calendar/DatePicker.d.ts +2 -19
  8. package/dist/components/Calendar/DatePicker.types.d.cts +19 -0
  9. package/dist/components/Calendar/DatePicker.types.d.ts +19 -0
  10. package/dist/components/Calendar/DateRangePicker.d.cts +2 -34
  11. package/dist/components/Calendar/DateRangePicker.d.ts +2 -34
  12. package/dist/components/Calendar/DateRangePicker.types.d.cts +34 -0
  13. package/dist/components/Calendar/DateRangePicker.types.d.ts +34 -0
  14. package/dist/components/ColorPicker/ColorPicker.d.cts +2 -55
  15. package/dist/components/ColorPicker/ColorPicker.d.ts +2 -55
  16. package/dist/components/ColorPicker/ColorPicker.types.d.cts +54 -0
  17. package/dist/components/ColorPicker/ColorPicker.types.d.ts +54 -0
  18. package/dist/components/ListBox/ListBox.d.cts +3 -61
  19. package/dist/components/ListBox/ListBox.d.ts +3 -61
  20. package/dist/components/ListBox/ListBox.types.d.cts +61 -0
  21. package/dist/components/ListBox/ListBox.types.d.ts +61 -0
  22. package/dist/components/Prose/Prose.d.cts +2 -16
  23. package/dist/components/Prose/Prose.d.ts +2 -16
  24. package/dist/components/Prose/Prose.types.d.cts +16 -0
  25. package/dist/components/Prose/Prose.types.d.ts +16 -0
  26. package/dist/components.css +16 -0
  27. package/dist/index.cjs +34 -13
  28. package/dist/index.cjs.map +2 -2
  29. package/dist/index.js +103 -82
  30. package/dist/index.js.map +3 -3
  31. package/dist/openware-ui.iife.js +6 -6
  32. package/dist/styles.css +16 -0
  33. package/package.json +4 -4
package/dist/index.js CHANGED
@@ -3303,7 +3303,7 @@ function ListBoxWithRef({
3303
3303
  );
3304
3304
  };
3305
3305
  const isEmpty = flat.length === 0;
3306
- const describedBy = [ariaDescribedBy, isEmpty ? emptyId : void 0].filter(Boolean).join(" ") || void 0;
3306
+ const describedBy = ariaDescribedBy;
3307
3307
  return /* @__PURE__ */ jsxs16(
3308
3308
  "div",
3309
3309
  {
@@ -3346,7 +3346,10 @@ function ListBoxWithRef({
3346
3346
  item.options.map(renderOption)
3347
3347
  ] }, `group-${item.label}-${groupIndex}`) : renderOption(item)
3348
3348
  ),
3349
- isEmpty ? /* @__PURE__ */ jsx25("div", { id: emptyId, className: "ow-listbox__empty", role: "presentation", children: emptyMessage }) : null
3349
+ isEmpty ? (
3350
+ // A listbox holds options, so an empty one says so with one that can't be chosen.
3351
+ /* @__PURE__ */ jsx25("div", { id: emptyId, className: "ow-listbox__empty", role: "option", "aria-disabled": "true", "aria-selected": "false", children: emptyMessage })
3352
+ ) : null
3350
3353
  ]
3351
3354
  }
3352
3355
  );
@@ -4114,9 +4117,9 @@ var DatePicker = /* @__PURE__ */ forwardRef17(function DatePicker2({
4114
4117
  "aria-haspopup": "dialog",
4115
4118
  "aria-expanded": isOpen,
4116
4119
  "aria-controls": isOpen ? panelId : void 0,
4117
- "aria-label": ariaLabel,
4118
- "aria-labelledby": ariaLabelledBy,
4119
- "aria-describedby": [`${panelId}-value`, ariaDescribedBy].filter(Boolean).join(" "),
4120
+ "aria-label": ariaLabel && !ariaLabelledBy ? `${ariaLabel}, ${label}` : void 0,
4121
+ "aria-labelledby": ariaLabelledBy ? `${ariaLabelledBy} ${panelId}-value` : void 0,
4122
+ "aria-describedby": ariaDescribedBy,
4120
4123
  "aria-invalid": isInvalid || void 0,
4121
4124
  disabled,
4122
4125
  className: cx(
@@ -4419,9 +4422,9 @@ var DateRangePicker = /* @__PURE__ */ forwardRef19(function DateRangePicker2({
4419
4422
  "aria-haspopup": "dialog",
4420
4423
  "aria-expanded": isOpen,
4421
4424
  "aria-controls": isOpen ? panelId : void 0,
4422
- "aria-label": ariaLabel,
4423
- "aria-labelledby": ariaLabelledBy,
4424
- "aria-describedby": [`${panelId}-value`, ariaDescribedBy].filter(Boolean).join(" "),
4425
+ "aria-label": ariaLabel && !ariaLabelledBy ? `${ariaLabel}, ${label}` : void 0,
4426
+ "aria-labelledby": ariaLabelledBy ? `${ariaLabelledBy} ${panelId}-value` : void 0,
4427
+ "aria-describedby": ariaDescribedBy,
4425
4428
  "aria-invalid": isInvalid || void 0,
4426
4429
  disabled,
4427
4430
  className: cx("ow-select", "ow-date-range-picker__trigger", `ow-select--${size2}`, {
@@ -6164,7 +6167,8 @@ function Avatar({ name, src, size: size2 = "md", label, className }) {
6164
6167
  className: cx("ow-avatar", sizing.className, !initials && !showImage && "ow-avatar--empty", className),
6165
6168
  style: sizing.style,
6166
6169
  ...label ? { role: "img", "aria-label": label } : { "aria-hidden": true },
6167
- children: showImage ? /* @__PURE__ */ jsx56("img", { src, alt: "", className: "ow-avatar__image", onError: () => setFailedImage(src) }) : initials || /* @__PURE__ */ jsx56(UserIcon, { size: Math.round(sizing.pixels * 0.52) })
6170
+ "data-initials": !showImage && initials ? initials : void 0,
6171
+ children: showImage ? /* @__PURE__ */ jsx56("img", { src, alt: "", className: "ow-avatar__image", onError: () => setFailedImage(src) }) : initials ? null : /* @__PURE__ */ jsx56(UserIcon, { size: Math.round(sizing.pixels * 0.52) })
6168
6172
  }
6169
6173
  );
6170
6174
  }
@@ -6392,14 +6396,31 @@ function DotGrid({ fade = false, interactive = false, className, children, onPoi
6392
6396
  }
6393
6397
 
6394
6398
  // src/components/Prose/Prose.tsx
6395
- import { forwardRef as forwardRef23 } from "react";
6399
+ import { forwardRef as forwardRef23, useEffect as useEffect26, useRef as useRef34 } from "react";
6396
6400
  import { jsx as jsx62 } from "react/jsx-runtime";
6397
6401
  var Prose = /* @__PURE__ */ forwardRef23(function Prose2({ size: size2 = "md", fullWidth = false, as = "div", className, children, ...props }, ref) {
6398
6402
  const Element2 = as;
6403
+ const root = useRef34(null);
6404
+ useEffect26(() => {
6405
+ const element = root.current;
6406
+ if (!element) return;
6407
+ for (const scroller of element.querySelectorAll("pre, .ow-table-wrap")) {
6408
+ if (scroller.scrollWidth > scroller.clientWidth && !scroller.hasAttribute("tabindex")) scroller.tabIndex = 0;
6409
+ }
6410
+ for (const box of element.querySelectorAll('li > input[type="checkbox"], li > p > input[type="checkbox"]')) {
6411
+ if (box.labels?.length || box.hasAttribute("aria-label") || box.hasAttribute("aria-labelledby")) continue;
6412
+ const text = box.closest("li")?.textContent?.trim();
6413
+ if (text) box.setAttribute("aria-label", text);
6414
+ }
6415
+ });
6399
6416
  return /* @__PURE__ */ jsx62(
6400
6417
  Element2,
6401
6418
  {
6402
- ref,
6419
+ ref: (node) => {
6420
+ root.current = node;
6421
+ if (typeof ref === "function") ref(node);
6422
+ else if (ref) ref.current = node;
6423
+ },
6403
6424
  className: cx("ow-prose", `ow-prose--${size2}`, size2 === "md" ? "ow-type-prose" : "ow-type-copy", fullWidth && "ow-prose--full", className),
6404
6425
  ...props,
6405
6426
  children
@@ -6424,10 +6445,10 @@ function TextShimmer({ children, as = "span", duration = 2, active = true, class
6424
6445
  // src/components/PromptInput/PromptInput.tsx
6425
6446
  import {
6426
6447
  forwardRef as forwardRef24,
6427
- useEffect as useEffect26,
6448
+ useEffect as useEffect27,
6428
6449
  useId as useId22,
6429
6450
  useLayoutEffect as useLayoutEffect7,
6430
- useRef as useRef34,
6451
+ useRef as useRef35,
6431
6452
  useState as useState29
6432
6453
  } from "react";
6433
6454
  import { jsx as jsx64, jsxs as jsxs48 } from "react/jsx-runtime";
@@ -6549,13 +6570,13 @@ var PromptInput = /* @__PURE__ */ forwardRef24(function PromptInput2({
6549
6570
  className
6550
6571
  }, ref) {
6551
6572
  const [text, setText] = useControllableState(value, defaultValue, onChange);
6552
- const textAreaRef = useRef34(null);
6553
- const actionRef = useRef34(null);
6554
- const pickerRef = useRef34(null);
6555
- const listRef = useRef34(null);
6556
- const composing = useRef34(false);
6557
- const dragDepth = useRef34(0);
6558
- const pendingFocus = useRef34(null);
6573
+ const textAreaRef = useRef35(null);
6574
+ const actionRef = useRef35(null);
6575
+ const pickerRef = useRef35(null);
6576
+ const listRef = useRef35(null);
6577
+ const composing = useRef35(false);
6578
+ const dragDepth = useRef35(0);
6579
+ const pendingFocus = useRef35(null);
6559
6580
  const [isDragging, setIsDragging] = useState29(false);
6560
6581
  const [notice, setNotice] = useState29();
6561
6582
  const [announcement, setAnnouncement] = useState29("");
@@ -6578,7 +6599,7 @@ var PromptInput = /* @__PURE__ */ forwardRef24(function PromptInput2({
6578
6599
  if (typeof ref === "function") ref(element);
6579
6600
  else if (ref) ref.current = element;
6580
6601
  }
6581
- useEffect26(() => {
6602
+ useEffect27(() => {
6582
6603
  const textArea = textAreaRef.current;
6583
6604
  if (!textArea || typeof ResizeObserver === "undefined") return;
6584
6605
  let width = textArea.clientWidth;
@@ -6593,8 +6614,8 @@ var PromptInput = /* @__PURE__ */ forwardRef24(function PromptInput2({
6593
6614
  useLayoutEffect7(() => {
6594
6615
  if (textAreaRef.current) resizeTextArea(textAreaRef.current);
6595
6616
  }, [size2, rows]);
6596
- const wasStreaming = useRef34(isStreaming);
6597
- const actionHadFocus = useRef34(false);
6617
+ const wasStreaming = useRef35(isStreaming);
6618
+ const actionHadFocus = useRef35(false);
6598
6619
  if (wasStreaming.current !== isStreaming) {
6599
6620
  actionHadFocus.current = typeof document !== "undefined" && document.activeElement === actionRef.current;
6600
6621
  }
@@ -6612,7 +6633,7 @@ var PromptInput = /* @__PURE__ */ forwardRef24(function PromptInput2({
6612
6633
  const next = buttons?.length ? buttons[Math.min(pending.index, buttons.length - 1)] : void 0;
6613
6634
  (next ?? textAreaRef.current)?.focus();
6614
6635
  }, [attachments]);
6615
- useEffect26(() => {
6636
+ useEffect27(() => {
6616
6637
  if (!showCounter || document.activeElement !== textAreaRef.current) return;
6617
6638
  const timer = window.setTimeout(() => {
6618
6639
  setAnnouncement(`${number(remaining)} ${remaining === 1 ? "character" : "characters"} left`);
@@ -6926,11 +6947,11 @@ import {
6926
6947
  createContext as createContext8,
6927
6948
  forwardRef as forwardRef26,
6928
6949
  useCallback as useCallback10,
6929
- useEffect as useEffect27,
6950
+ useEffect as useEffect28,
6930
6951
  useImperativeHandle as useImperativeHandle3,
6931
6952
  useLayoutEffect as useLayoutEffect8,
6932
6953
  useMemo as useMemo12,
6933
- useRef as useRef35,
6954
+ useRef as useRef36,
6934
6955
  useState as useState30
6935
6956
  } from "react";
6936
6957
  import { jsx as jsx66, jsxs as jsxs50 } from "react/jsx-runtime";
@@ -6950,13 +6971,13 @@ var ChatConversation = /* @__PURE__ */ forwardRef26(function ChatConversation2({
6950
6971
  className,
6951
6972
  ...props
6952
6973
  }, ref) {
6953
- const scrollerRef = useRef35(null);
6954
- const contentRef = useRef35(null);
6955
- const jumpRef = useRef35(null);
6956
- const following = useRef35(true);
6957
- const lastTop = useRef35(0);
6958
- const ready = useRef35(false);
6959
- const unseen = useRef35(/* @__PURE__ */ new Set());
6974
+ const scrollerRef = useRef36(null);
6975
+ const contentRef = useRef36(null);
6976
+ const jumpRef = useRef36(null);
6977
+ const following = useRef36(true);
6978
+ const lastTop = useRef36(0);
6979
+ const ready = useRef36(false);
6980
+ const unseen = useRef36(/* @__PURE__ */ new Set());
6960
6981
  const [isFollowing, setIsFollowing] = useState30(true);
6961
6982
  const [newCount, setNewCount] = useState30(0);
6962
6983
  const isEmpty = Children2.toArray(children).length === 0;
@@ -6985,10 +7006,10 @@ var ChatConversation = /* @__PURE__ */ forwardRef26(function ChatConversation2({
6985
7006
  );
6986
7007
  useImperativeHandle3(ref, () => ({ scrollToBottom }), [scrollToBottom]);
6987
7008
  useLayoutEffect8(stick, [stick]);
6988
- useEffect27(() => {
7009
+ useEffect28(() => {
6989
7010
  ready.current = true;
6990
7011
  }, []);
6991
- useEffect27(() => {
7012
+ useEffect28(() => {
6992
7013
  const scroller = scrollerRef.current;
6993
7014
  const content = contentRef.current;
6994
7015
  if (!scroller || !content || typeof ResizeObserver === "undefined") return void 0;
@@ -7074,10 +7095,10 @@ var ChatConversation = /* @__PURE__ */ forwardRef26(function ChatConversation2({
7074
7095
  import {
7075
7096
  forwardRef as forwardRef27,
7076
7097
  useContext as useContext10,
7077
- useEffect as useEffect28,
7098
+ useEffect as useEffect29,
7078
7099
  useId as useId23,
7079
7100
  useLayoutEffect as useLayoutEffect9,
7080
- useRef as useRef36,
7101
+ useRef as useRef37,
7081
7102
  useState as useState31
7082
7103
  } from "react";
7083
7104
  import { Fragment as Fragment10, jsx as jsx67, jsxs as jsxs51 } from "react/jsx-runtime";
@@ -7227,11 +7248,11 @@ var ChatMessage = /* @__PURE__ */ forwardRef27(function ChatMessage2({ from, chi
7227
7248
  const conversation = useContext10(ChatConversationContext);
7228
7249
  const entering = useChatEntrance();
7229
7250
  const id = useId23();
7230
- const bodyRef = useRef36(null);
7231
- const contentRef = useRef36(null);
7232
- const caretRef = useRef36(null);
7251
+ const bodyRef = useRef37(null);
7252
+ const contentRef = useRef37(null);
7253
+ const caretRef = useRef37(null);
7233
7254
  const streaming = status === "streaming";
7234
- useEffect28(() => conversation?.register(id), [conversation, id]);
7255
+ useEffect29(() => conversation?.register(id), [conversation, id]);
7235
7256
  useStreamingCaret(bodyRef, contentRef, caretRef, streaming && from !== "system");
7236
7257
  if (from === "system") {
7237
7258
  return /* @__PURE__ */ jsx67(
@@ -7294,8 +7315,8 @@ var ChatMessage = /* @__PURE__ */ forwardRef27(function ChatMessage2({ from, chi
7294
7315
  var defaultLabels = { copy: "Copy", copied: "Copied", edit: "Edit", retry: "Retry", good: "Good response", bad: "Bad response" };
7295
7316
  function CopyAction({ text, label, copiedLabel }) {
7296
7317
  const [copied, setCopied] = useState31(false);
7297
- const timer = useRef36(0);
7298
- useEffect28(() => () => window.clearTimeout(timer.current), []);
7318
+ const timer = useRef37(0);
7319
+ useEffect29(() => () => window.clearTimeout(timer.current), []);
7299
7320
  const current = copied ? copiedLabel : label;
7300
7321
  return /* @__PURE__ */ jsxs51(Fragment10, { children: [
7301
7322
  /* @__PURE__ */ jsx67(Tooltip, { label: current, children: /* @__PURE__ */ jsx67(
@@ -7388,7 +7409,7 @@ function ChatLoader({ label, inline = false, name, avatar, srLabel = "Working\u2
7388
7409
  }
7389
7410
 
7390
7411
  // src/components/ChatTool/ChatTool.tsx
7391
- import { forwardRef as forwardRef28, useEffect as useEffect29, useId as useId24, useRef as useRef37, useState as useState32 } from "react";
7412
+ import { forwardRef as forwardRef28, useEffect as useEffect30, useId as useId24, useRef as useRef38, useState as useState32 } from "react";
7392
7413
  import { Fragment as Fragment11, jsx as jsx69, jsxs as jsxs53 } from "react/jsx-runtime";
7393
7414
  var statusWords = {
7394
7415
  pending: "Not started",
@@ -7474,9 +7495,9 @@ function useStatusExpansion({
7474
7495
  initial = wantsOpen
7475
7496
  }) {
7476
7497
  const [isOpen, setOpen] = useControllableState(expanded, defaultExpanded ?? initial, onExpandedChange);
7477
- const touched = useRef37(false);
7478
- const previous = useRef37(wantsOpen);
7479
- useEffect29(() => {
7498
+ const touched = useRef38(false);
7499
+ const previous = useRef38(wantsOpen);
7500
+ useEffect30(() => {
7480
7501
  if (previous.current === wantsOpen) return;
7481
7502
  previous.current = wantsOpen;
7482
7503
  if (expanded !== void 0) return;
@@ -7502,8 +7523,8 @@ function ChatCollapse({
7502
7523
  className,
7503
7524
  children
7504
7525
  }) {
7505
- const ref = useRef37(null);
7506
- useEffect29(() => {
7526
+ const ref = useRef38(null);
7527
+ useEffect30(() => {
7507
7528
  if (ref.current) ref.current.inert = !open;
7508
7529
  }, [open]);
7509
7530
  return /* @__PURE__ */ jsx69("div", { ref, id, className: cx("ow-chat-collapse", bleed && "ow-chat-collapse--bleed"), "data-open": open, children: /* @__PURE__ */ jsx69("div", { className: "ow-chat-collapse__clip", children: /* @__PURE__ */ jsx69("div", { className, children }) }) });
@@ -7540,10 +7561,10 @@ var ChatTool = /* @__PURE__ */ forwardRef28(function ChatTool2({
7540
7561
  ...props
7541
7562
  }, ref) {
7542
7563
  const id = useId24();
7543
- const rootRef = useRef37(null);
7544
- const triggerRef = useRef37(null);
7545
- const messageRef = useRef37(null);
7546
- const decided = useRef37(false);
7564
+ const rootRef = useRef38(null);
7565
+ const triggerRef = useRef38(null);
7566
+ const messageRef = useRef38(null);
7567
+ const decided = useRef38(false);
7547
7568
  const [announcement, setAnnouncement] = useState32("");
7548
7569
  const needsApproval = status === "approval";
7549
7570
  const [isOpen, toggle] = useStatusExpansion({
@@ -7557,7 +7578,7 @@ var ChatTool = /* @__PURE__ */ forwardRef28(function ChatTool2({
7557
7578
  const hasError = error !== void 0 && error !== null && error !== false && error !== "";
7558
7579
  const hasDetails = hasInput || hasOutput || hasError;
7559
7580
  const hasMeta = Boolean(summary) || duration !== void 0;
7560
- useEffect29(() => {
7581
+ useEffect30(() => {
7561
7582
  if (!needsApproval) {
7562
7583
  setAnnouncement("");
7563
7584
  return;
@@ -7568,7 +7589,7 @@ var ChatTool = /* @__PURE__ */ forwardRef28(function ChatTool2({
7568
7589
  }, 150);
7569
7590
  return () => window.clearTimeout(timer);
7570
7591
  }, [needsApproval]);
7571
- useEffect29(() => {
7592
+ useEffect30(() => {
7572
7593
  if (needsApproval || !decided.current) return;
7573
7594
  decided.current = false;
7574
7595
  const active = document.activeElement;
@@ -7735,7 +7756,7 @@ var ChainOfThought = /* @__PURE__ */ forwardRef29(function ChainOfThought2({
7735
7756
  });
7736
7757
 
7737
7758
  // src/components/ChatSource/ChatSource.tsx
7738
- import { forwardRef as forwardRef30, useCallback as useCallback11, useEffect as useEffect30, useId as useId26, useRef as useRef38, useState as useState33 } from "react";
7759
+ import { forwardRef as forwardRef30, useCallback as useCallback11, useEffect as useEffect31, useId as useId26, useRef as useRef39, useState as useState33 } from "react";
7739
7760
  import { Fragment as Fragment12, jsx as jsx71, jsxs as jsxs55 } from "react/jsx-runtime";
7740
7761
  var openDelay = 250;
7741
7762
  var closeDelay = 150;
@@ -7755,11 +7776,11 @@ var ChatSource = /* @__PURE__ */ forwardRef30(function ChatSource2({
7755
7776
  className
7756
7777
  }, ref) {
7757
7778
  const id = useId26();
7758
- const wrapperRef = useRef38(null);
7759
- const chipRef = useRef38(null);
7760
- const cardRef = useRef38(null);
7761
- const timer = useRef38(0);
7762
- const pointer = useRef38("mouse");
7779
+ const wrapperRef = useRef39(null);
7780
+ const chipRef = useRef39(null);
7781
+ const cardRef = useRef39(null);
7782
+ const timer = useRef39(0);
7783
+ const pointer = useRef39("mouse");
7763
7784
  const [open, setOpen] = useState33(false);
7764
7785
  const { mounted, state } = usePresence(open);
7765
7786
  const style = useFloating({ open: mounted, anchorRef: chipRef, floatingRef: cardRef, placement: "bottom-start", offset: 6, maxHeight: 360 });
@@ -7773,7 +7794,7 @@ var ChatSource = /* @__PURE__ */ forwardRef30(function ChatSource2({
7773
7794
  setOpen(false);
7774
7795
  }, []);
7775
7796
  useDismiss(open, [wrapperRef], close);
7776
- useEffect30(() => () => window.clearTimeout(timer.current), []);
7797
+ useEffect31(() => () => window.clearTimeout(timer.current), []);
7777
7798
  const name = ariaLabel ?? (index !== void 0 ? `Source ${index}` : label ?? "Source");
7778
7799
  const describedBy = [`${id}-title`, source ? `${id}-source` : null, snippet ? `${id}-snippet` : null].filter(Boolean).join(" ");
7779
7800
  const externalProps = external ? { target: "_blank", rel: "noopener noreferrer" } : {};
@@ -7879,7 +7900,7 @@ var ChatSources = /* @__PURE__ */ forwardRef30(function ChatSources2({ sources,
7879
7900
  });
7880
7901
 
7881
7902
  // src/components/ColorPicker/ColorPicker.tsx
7882
- import { forwardRef as forwardRef31, useCallback as useCallback12, useEffect as useEffect31, useId as useId27, useRef as useRef39, useState as useState34 } from "react";
7903
+ import { forwardRef as forwardRef31, useCallback as useCallback12, useEffect as useEffect32, useId as useId27, useRef as useRef40, useState as useState34 } from "react";
7883
7904
  import { HexAlphaColorPicker, HexColorInput, HexColorPicker } from "react-colorful";
7884
7905
  import { Fragment as Fragment13, jsx as jsx72, jsxs as jsxs56 } from "react/jsx-runtime";
7885
7906
  var swatchColor = (swatch) => typeof swatch === "string" ? swatch : swatch.color;
@@ -7898,9 +7919,9 @@ function ColorPicker({
7898
7919
  }) {
7899
7920
  const [color, setColor] = useControllableState(value, defaultValue, onChange);
7900
7921
  const [canPick, setCanPick] = useState34(false);
7901
- const rootRef = useRef39(null);
7902
- useEffect31(() => setCanPick(typeof window !== "undefined" && "EyeDropper" in window), []);
7903
- useEffect31(() => {
7922
+ const rootRef = useRef40(null);
7923
+ useEffect32(() => setCanPick(typeof window !== "undefined" && "EyeDropper" in window), []);
7924
+ useEffect32(() => {
7904
7925
  const names = { saturation: "Colour", hue: "Hue", alpha: "Opacity" };
7905
7926
  for (const [part, label] of Object.entries(names)) {
7906
7927
  rootRef.current?.querySelector(`.react-colorful__${part} .react-colorful__interactive`)?.setAttribute("aria-label", label);
@@ -7975,8 +7996,8 @@ var ColorField = /* @__PURE__ */ forwardRef31(function ColorField2({
7975
7996
  }, ref) {
7976
7997
  const [color, setColor] = useControllableState(value, defaultValue, onChange);
7977
7998
  const [isOpen, setOpen] = useState34(false);
7978
- const triggerRef = useRef39(null);
7979
- const panelRef = useRef39(null);
7999
+ const triggerRef = useRef40(null);
8000
+ const panelRef = useRef40(null);
7980
8001
  const panelId = useId27();
7981
8002
  const { mounted, state } = usePresence(isOpen);
7982
8003
  const style = useFloating({ open: mounted, anchorRef: triggerRef, floatingRef: panelRef, placement, offset: 6, maxHeight: 640 });
@@ -7985,7 +8006,7 @@ var ColorField = /* @__PURE__ */ forwardRef31(function ColorField2({
7985
8006
  if (reason !== "outside") triggerRef.current?.focus();
7986
8007
  }, []);
7987
8008
  useDismiss(isOpen, [panelRef, triggerRef], close);
7988
- useEffect31(() => {
8009
+ useEffect32(() => {
7989
8010
  if (!isOpen) return void 0;
7990
8011
  const frame = requestAnimationFrame(() => panelRef.current?.querySelector(".react-colorful__interactive")?.focus());
7991
8012
  return () => cancelAnimationFrame(frame);
@@ -8003,9 +8024,9 @@ var ColorField = /* @__PURE__ */ forwardRef31(function ColorField2({
8003
8024
  "aria-haspopup": "dialog",
8004
8025
  "aria-expanded": isOpen,
8005
8026
  "aria-controls": isOpen ? panelId : void 0,
8006
- "aria-label": ariaLabel,
8007
- "aria-labelledby": ariaLabelledBy,
8008
- "aria-describedby": [`${panelId}-value`, ariaDescribedBy].filter(Boolean).join(" "),
8027
+ "aria-label": ariaLabel && !ariaLabelledBy ? `${ariaLabel}, ${color.toUpperCase()}` : void 0,
8028
+ "aria-labelledby": ariaLabelledBy ? `${ariaLabelledBy} ${panelId}-value` : void 0,
8029
+ "aria-describedby": ariaDescribedBy,
8009
8030
  "aria-invalid": isInvalid || void 0,
8010
8031
  disabled,
8011
8032
  className: cx(
@@ -8050,10 +8071,10 @@ var ColorField = /* @__PURE__ */ forwardRef31(function ColorField2({
8050
8071
  });
8051
8072
 
8052
8073
  // src/components/ColorPicker/ColorArea.tsx
8053
- import { forwardRef as forwardRef32, useRef as useRef41, useState as useState36 } from "react";
8074
+ import { forwardRef as forwardRef32, useRef as useRef42, useState as useState36 } from "react";
8054
8075
 
8055
8076
  // src/components/ColorPicker/color.ts
8056
- import { useCallback as useCallback13, useReducer, useRef as useRef40, useState as useState35 } from "react";
8077
+ import { useCallback as useCallback13, useReducer, useRef as useRef41, useState as useState35 } from "react";
8057
8078
  var clamp2 = (n, min, max) => Math.min(max, Math.max(min, n));
8058
8079
  function parseHex(color) {
8059
8080
  let hex = color.trim().replace(/^#/, "");
@@ -8130,7 +8151,7 @@ var hslModel = {
8130
8151
  var fallback = { r: 0, g: 0, b: 0, a: 1 };
8131
8152
  function useColorModel(value, defaultValue, onChange, model, { hue, alpha = false } = {}) {
8132
8153
  const [color, setColor] = useControllableState(value, defaultValue, onChange);
8133
- const memory = useRef40(null);
8154
+ const memory = useRef41(null);
8134
8155
  const [, rerender] = useReducer((n) => n + 1, 0);
8135
8156
  const incoming = normalizeHex(color);
8136
8157
  if (!memory.current || memory.current.hex !== incoming || memory.current.model !== model) {
@@ -8258,8 +8279,8 @@ var ColorArea = /* @__PURE__ */ forwardRef32(function ColorArea2({
8258
8279
  className
8259
8280
  }, ref) {
8260
8281
  const { value: hsv, rgba, hex, set, latest } = useColorModel(value, defaultValue, onChange, hsvModel, { hue });
8261
- const rootRef = useRef41(null);
8262
- const inputs = useRef41({ x: null, y: null });
8282
+ const rootRef = useRef42(null);
8283
+ const inputs = useRef42({ x: null, y: null });
8263
8284
  const [axis, setAxis] = useState36("x");
8264
8285
  const isRtl = () => rootRef.current ? getComputedStyle(rootRef.current).direction === "rtl" : false;
8265
8286
  const end = () => onChangeEnd?.(latest());
@@ -8381,7 +8402,7 @@ var ColorArea = /* @__PURE__ */ forwardRef32(function ColorArea2({
8381
8402
  });
8382
8403
 
8383
8404
  // src/components/ColorPicker/ColorSlider.tsx
8384
- import { forwardRef as forwardRef33, useId as useId28, useRef as useRef42 } from "react";
8405
+ import { forwardRef as forwardRef33, useId as useId28, useRef as useRef43 } from "react";
8385
8406
  import { jsx as jsx74, jsxs as jsxs58 } from "react/jsx-runtime";
8386
8407
  var channels = {
8387
8408
  hue: { name: "Hue", max: 360, unit: "degree" },
@@ -8458,8 +8479,8 @@ var ColorSlider = /* @__PURE__ */ forwardRef33(function ColorSlider2({
8458
8479
  const { rgba, latest } = color;
8459
8480
  const current = read(channel, color.value, rgba);
8460
8481
  const labelId = useId28();
8461
- const trackRef = useRef42(null);
8462
- const inputRef = useRef42(null);
8482
+ const trackRef = useRef43(null);
8483
+ const inputRef = useRef43(null);
8463
8484
  const vertical = orientation === "vertical";
8464
8485
  const isRtl = () => !vertical && trackRef.current !== null && getComputedStyle(trackRef.current).direction === "rtl";
8465
8486
  const end = () => onChangeEnd?.(latest());
@@ -8569,11 +8590,11 @@ var ColorSlider = /* @__PURE__ */ forwardRef33(function ColorSlider2({
8569
8590
  });
8570
8591
 
8571
8592
  // src/components/ColorPicker/ColorSwatchPicker.tsx
8572
- import { forwardRef as forwardRef34, useRef as useRef43 } from "react";
8593
+ import { forwardRef as forwardRef34, useRef as useRef44 } from "react";
8573
8594
  import { jsx as jsx75, jsxs as jsxs59 } from "react/jsx-runtime";
8574
8595
  var ColorSwatchPicker = /* @__PURE__ */ forwardRef34(function ColorSwatchPicker2({ options, value, defaultValue, onChange, size: size2 = "md", shape = "square", disabled = false, name, className, ...aria }, ref) {
8575
8596
  const [current, setCurrent] = useControllableState(value, defaultValue ?? "", onChange);
8576
- const refs = useRef43([]);
8597
+ const refs = useRef44([]);
8577
8598
  const items2 = options.map((option) => {
8578
8599
  const item = typeof option === "string" ? { value: option } : option;
8579
8600
  const rgba = parseHex(item.value);