@economic/taco 8.1.3-alpha.0 → 8.1.4-hanger-base-ui-migration.0

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 (43) hide show
  1. package/dist/charts/utils/common.d.ts +1 -1
  2. package/dist/components/Field/Field.cjs +1 -2
  3. package/dist/components/Field/Field.cjs.map +1 -1
  4. package/dist/components/Field/Field.js +1 -2
  5. package/dist/components/Field/Field.js.map +1 -1
  6. package/dist/components/Hanger/Arrow.cjs +2 -3
  7. package/dist/components/Hanger/Arrow.cjs.map +1 -1
  8. package/dist/components/Hanger/Arrow.js +2 -2
  9. package/dist/components/Hanger/Arrow.js.map +1 -1
  10. package/dist/components/Hanger/Hanger.cjs +34 -40
  11. package/dist/components/Hanger/Hanger.cjs.map +1 -1
  12. package/dist/components/Hanger/Hanger.d.ts +1 -1
  13. package/dist/components/Hanger/Hanger.js +34 -39
  14. package/dist/components/Hanger/Hanger.js.map +1 -1
  15. package/dist/components/Header/components/Link.cjs.map +1 -1
  16. package/dist/components/Header/components/Link.js.map +1 -1
  17. package/dist/components/HoverCard/HoverCard.cjs +4 -5
  18. package/dist/components/HoverCard/HoverCard.cjs.map +1 -1
  19. package/dist/components/HoverCard/HoverCard.d.ts +1 -2
  20. package/dist/components/HoverCard/HoverCard.js +4 -5
  21. package/dist/components/HoverCard/HoverCard.js.map +1 -1
  22. package/dist/components/Input/util.cjs +2 -2
  23. package/dist/components/Input/util.cjs.map +1 -1
  24. package/dist/components/Input/util.js +2 -2
  25. package/dist/components/Input/util.js.map +1 -1
  26. package/dist/components/List/components/Collapsible.d.ts +1 -1
  27. package/dist/components/Menu/components/Content.d.ts +1 -1
  28. package/dist/components/Menu/components/SubMenu.d.ts +1 -1
  29. package/dist/components/Select/useSelect.cjs.map +1 -1
  30. package/dist/components/Select/useSelect.d.ts +2 -2
  31. package/dist/components/Select/useSelect.js.map +1 -1
  32. package/dist/components/Table3/features/useTableEditing.d.ts +4 -4
  33. package/dist/components/Toast/Toast.cjs.map +1 -1
  34. package/dist/components/Toast/Toast.d.ts +1 -1
  35. package/dist/components/Toast/Toast.js.map +1 -1
  36. package/dist/components/Toast/util.cjs.map +1 -1
  37. package/dist/components/Toast/util.d.ts +1 -1
  38. package/dist/components/Toast/util.js.map +1 -1
  39. package/dist/hooks/useTacoSettings.d.ts +1 -1
  40. package/dist/primitives/Table/useTableManager/useTableManager.d.ts +2 -2
  41. package/dist/primitives/Table/useTableManager/util/settings.d.ts +4 -4
  42. package/dist/utils/storyutils.d.ts +1 -1
  43. package/package.json +12 -10
@@ -10,7 +10,7 @@ export declare function getAxisProps<TData extends object>(axis: 'x' | 'y', prop
10
10
  scale: Function | import('recharts/types/util/types').ScaleType | undefined;
11
11
  tickLine: boolean;
12
12
  tickMargin: number;
13
- tickFormatter: import('../components/types').TickFormatter | undefined;
13
+ tickFormatter: import('../..').TickFormatter | undefined;
14
14
  type: any;
15
15
  width: number;
16
16
  };
@@ -33,8 +33,7 @@ const Field = React__namespace.forwardRef(function Field2(props, ref) {
33
33
  );
34
34
  const messageClassName = cn("h-4 text-xs text-left leading-normal font-normal truncate -mb-4", {
35
35
  "text-gray-700": !invalid && !warning,
36
- "text-red-500": invalid,
37
- "text-yellow-500": warning && !invalid,
36
+ "text-red-700": invalid,
38
37
  "opacity-50": disabled
39
38
  });
40
39
  return /* @__PURE__ */ React__namespace.createElement("label", { ...otherProps, className, "data-taco": "label", ref }, children, message && /* @__PURE__ */ React__namespace.createElement(Truncate.Truncate, { tooltip: message }, /* @__PURE__ */ React__namespace.createElement(
@@ -1 +1 @@
1
- {"version":3,"file":"Field.cjs","sources":["../../../src/components/Field/Field.tsx"],"sourcesContent":["import * as React from 'react';\nimport cn from 'clsx';\nimport './Field.css';\nimport { Truncate } from '../Truncate/Truncate';\n\nexport type FieldProps = React.LabelHTMLAttributes<HTMLLabelElement> & {\n /** Content of the field */\n children: React.ReactNode;\n /**\tChanges the style to indicate the element is disabled */\n disabled?: boolean;\n /* Whether the input is in an invalid state */\n invalid?: boolean;\n /* Whether the input is in a warning state */\n warning?: boolean;\n /**\n * Text displayed below the children of Field.\n * Should be a short text that indicates feedback for user.\n */\n message?: string;\n};\n\nexport const Field = React.forwardRef(function Field(props: FieldProps, ref: React.Ref<HTMLLabelElement>) {\n const messageRef = React.useRef<HTMLSpanElement>(null);\n\n const { disabled, children, invalid = false, warning = false, message, ...otherProps } = props;\n const className = cn(\n 'flex flex-col font-bold text-xs leading-loose pb-4 min-h-[theme(spacing.18)]',\n {\n 'text-gray-300': disabled,\n },\n props.className\n );\n const messageClassName = cn('h-4 text-xs text-left leading-normal font-normal truncate -mb-4', {\n 'text-gray-700': !invalid && !warning,\n 'text-red-500': invalid,\n 'text-yellow-500': warning && !invalid,\n 'opacity-50': disabled,\n });\n\n return (\n <label {...otherProps} className={className} data-taco=\"label\" ref={ref}>\n {children}\n {message && (\n <Truncate tooltip={message}>\n <span\n className={messageClassName}\n data-taco=\"label-message\"\n ref={messageRef}\n role={invalid ? 'alert' : undefined}>\n {message}\n </span>\n </Truncate>\n )}\n </label>\n );\n});\n"],"names":["React","Field","Truncate"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAqBO,MAAM,QAAQA,iBAAM,WAAW,SAASC,OAAM,OAAmB,KAAkC;AAChG,QAAA,aAAaD,iBAAM,OAAwB,IAAI;AAE/C,QAAA,EAAE,UAAU,UAAU,UAAU,OAAO,UAAU,OAAO,SAAS,GAAG,WAAA,IAAe;AACzF,QAAM,YAAY;AAAA,IACd;AAAA,IACA;AAAA,MACI,iBAAiB;AAAA,IACrB;AAAA,IACA,MAAM;AAAA,EACV;AACM,QAAA,mBAAmB,GAAG,mEAAmE;AAAA,IAC3F,iBAAiB,CAAC,WAAW,CAAC;AAAA,IAC9B,gBAAgB;AAAA,IAChB,mBAAmB,WAAW,CAAC;AAAA,IAC/B,cAAc;AAAA,EAAA,CACjB;AAED,SACKA,iCAAA,cAAA,SAAA,EAAO,GAAG,YAAY,WAAsB,aAAU,SAAQ,IAAA,GAC1D,UACA,WACIA,iCAAA,cAAAE,SAAAA,UAAA,EAAS,SAAS,WACfF,iCAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACG,WAAW;AAAA,MACX,aAAU;AAAA,MACV,KAAK;AAAA,MACL,MAAM,UAAU,UAAU;AAAA,IAAA;AAAA,IACzB;AAAA,EAAA,CAET,CAER;AAER,CAAC;;"}
1
+ {"version":3,"file":"Field.cjs","sources":["../../../src/components/Field/Field.tsx"],"sourcesContent":["import * as React from 'react';\nimport cn from 'clsx';\nimport './Field.css';\nimport { Truncate } from '../Truncate/Truncate';\n\nexport type FieldProps = React.LabelHTMLAttributes<HTMLLabelElement> & {\n /** Content of the field */\n children: React.ReactNode;\n /**\tChanges the style to indicate the element is disabled */\n disabled?: boolean;\n /* Whether the input is in an invalid state */\n invalid?: boolean;\n /* Whether the input is in a warning state */\n warning?: boolean;\n /**\n * Text displayed below the children of Field.\n * Should be a short text that indicates feedback for user.\n */\n message?: string;\n};\n\nexport const Field = React.forwardRef(function Field(props: FieldProps, ref: React.Ref<HTMLLabelElement>) {\n const messageRef = React.useRef<HTMLSpanElement>(null);\n\n const { disabled, children, invalid = false, warning = false, message, ...otherProps } = props;\n const className = cn(\n 'flex flex-col font-bold text-xs leading-loose pb-4 min-h-[theme(spacing.18)]',\n {\n 'text-gray-300': disabled,\n },\n props.className\n );\n const messageClassName = cn('h-4 text-xs text-left leading-normal font-normal truncate -mb-4', {\n 'text-gray-700': !invalid && !warning,\n 'text-red-700': invalid,\n 'opacity-50': disabled,\n });\n\n return (\n <label {...otherProps} className={className} data-taco=\"label\" ref={ref}>\n {children}\n {message && (\n <Truncate tooltip={message}>\n <span\n className={messageClassName}\n data-taco=\"label-message\"\n ref={messageRef}\n role={invalid ? 'alert' : undefined}>\n {message}\n </span>\n </Truncate>\n )}\n </label>\n );\n});\n"],"names":["React","Field","Truncate"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAqBO,MAAM,QAAQA,iBAAM,WAAW,SAASC,OAAM,OAAmB,KAAkC;AAChG,QAAA,aAAaD,iBAAM,OAAwB,IAAI;AAE/C,QAAA,EAAE,UAAU,UAAU,UAAU,OAAO,UAAU,OAAO,SAAS,GAAG,WAAA,IAAe;AACzF,QAAM,YAAY;AAAA,IACd;AAAA,IACA;AAAA,MACI,iBAAiB;AAAA,IACrB;AAAA,IACA,MAAM;AAAA,EACV;AACM,QAAA,mBAAmB,GAAG,mEAAmE;AAAA,IAC3F,iBAAiB,CAAC,WAAW,CAAC;AAAA,IAC9B,gBAAgB;AAAA,IAChB,cAAc;AAAA,EAAA,CACjB;AAED,SACKA,iCAAA,cAAA,SAAA,EAAO,GAAG,YAAY,WAAsB,aAAU,SAAQ,IAAA,GAC1D,UACA,WACIA,iCAAA,cAAAE,SAAAA,UAAA,EAAS,SAAS,WACfF,iCAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACG,WAAW;AAAA,MACX,aAAU;AAAA,MACV,KAAK;AAAA,MACL,MAAM,UAAU,UAAU;AAAA,IAAA;AAAA,IACzB;AAAA,EAAA,CAET,CAER;AAER,CAAC;;"}
@@ -14,8 +14,7 @@ const Field = React.forwardRef(function Field2(props, ref) {
14
14
  );
15
15
  const messageClassName = cn("h-4 text-xs text-left leading-normal font-normal truncate -mb-4", {
16
16
  "text-gray-700": !invalid && !warning,
17
- "text-red-500": invalid,
18
- "text-yellow-500": warning && !invalid,
17
+ "text-red-700": invalid,
19
18
  "opacity-50": disabled
20
19
  });
21
20
  return /* @__PURE__ */ React.createElement("label", { ...otherProps, className, "data-taco": "label", ref }, children, message && /* @__PURE__ */ React.createElement(Truncate, { tooltip: message }, /* @__PURE__ */ React.createElement(
@@ -1 +1 @@
1
- {"version":3,"file":"Field.js","sources":["../../../src/components/Field/Field.tsx"],"sourcesContent":["import * as React from 'react';\nimport cn from 'clsx';\nimport './Field.css';\nimport { Truncate } from '../Truncate/Truncate';\n\nexport type FieldProps = React.LabelHTMLAttributes<HTMLLabelElement> & {\n /** Content of the field */\n children: React.ReactNode;\n /**\tChanges the style to indicate the element is disabled */\n disabled?: boolean;\n /* Whether the input is in an invalid state */\n invalid?: boolean;\n /* Whether the input is in a warning state */\n warning?: boolean;\n /**\n * Text displayed below the children of Field.\n * Should be a short text that indicates feedback for user.\n */\n message?: string;\n};\n\nexport const Field = React.forwardRef(function Field(props: FieldProps, ref: React.Ref<HTMLLabelElement>) {\n const messageRef = React.useRef<HTMLSpanElement>(null);\n\n const { disabled, children, invalid = false, warning = false, message, ...otherProps } = props;\n const className = cn(\n 'flex flex-col font-bold text-xs leading-loose pb-4 min-h-[theme(spacing.18)]',\n {\n 'text-gray-300': disabled,\n },\n props.className\n );\n const messageClassName = cn('h-4 text-xs text-left leading-normal font-normal truncate -mb-4', {\n 'text-gray-700': !invalid && !warning,\n 'text-red-500': invalid,\n 'text-yellow-500': warning && !invalid,\n 'opacity-50': disabled,\n });\n\n return (\n <label {...otherProps} className={className} data-taco=\"label\" ref={ref}>\n {children}\n {message && (\n <Truncate tooltip={message}>\n <span\n className={messageClassName}\n data-taco=\"label-message\"\n ref={messageRef}\n role={invalid ? 'alert' : undefined}>\n {message}\n </span>\n </Truncate>\n )}\n </label>\n );\n});\n"],"names":["Field"],"mappings":";;;;AAqBO,MAAM,QAAQ,MAAM,WAAW,SAASA,OAAM,OAAmB,KAAkC;AAChG,QAAA,aAAa,MAAM,OAAwB,IAAI;AAE/C,QAAA,EAAE,UAAU,UAAU,UAAU,OAAO,UAAU,OAAO,SAAS,GAAG,WAAA,IAAe;AACzF,QAAM,YAAY;AAAA,IACd;AAAA,IACA;AAAA,MACI,iBAAiB;AAAA,IACrB;AAAA,IACA,MAAM;AAAA,EACV;AACM,QAAA,mBAAmB,GAAG,mEAAmE;AAAA,IAC3F,iBAAiB,CAAC,WAAW,CAAC;AAAA,IAC9B,gBAAgB;AAAA,IAChB,mBAAmB,WAAW,CAAC;AAAA,IAC/B,cAAc;AAAA,EAAA,CACjB;AAED,SACK,sBAAA,cAAA,SAAA,EAAO,GAAG,YAAY,WAAsB,aAAU,SAAQ,IAAA,GAC1D,UACA,WACI,sBAAA,cAAA,UAAA,EAAS,SAAS,WACf,sBAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACG,WAAW;AAAA,MACX,aAAU;AAAA,MACV,KAAK;AAAA,MACL,MAAM,UAAU,UAAU;AAAA,IAAA;AAAA,IACzB;AAAA,EAAA,CAET,CAER;AAER,CAAC;"}
1
+ {"version":3,"file":"Field.js","sources":["../../../src/components/Field/Field.tsx"],"sourcesContent":["import * as React from 'react';\nimport cn from 'clsx';\nimport './Field.css';\nimport { Truncate } from '../Truncate/Truncate';\n\nexport type FieldProps = React.LabelHTMLAttributes<HTMLLabelElement> & {\n /** Content of the field */\n children: React.ReactNode;\n /**\tChanges the style to indicate the element is disabled */\n disabled?: boolean;\n /* Whether the input is in an invalid state */\n invalid?: boolean;\n /* Whether the input is in a warning state */\n warning?: boolean;\n /**\n * Text displayed below the children of Field.\n * Should be a short text that indicates feedback for user.\n */\n message?: string;\n};\n\nexport const Field = React.forwardRef(function Field(props: FieldProps, ref: React.Ref<HTMLLabelElement>) {\n const messageRef = React.useRef<HTMLSpanElement>(null);\n\n const { disabled, children, invalid = false, warning = false, message, ...otherProps } = props;\n const className = cn(\n 'flex flex-col font-bold text-xs leading-loose pb-4 min-h-[theme(spacing.18)]',\n {\n 'text-gray-300': disabled,\n },\n props.className\n );\n const messageClassName = cn('h-4 text-xs text-left leading-normal font-normal truncate -mb-4', {\n 'text-gray-700': !invalid && !warning,\n 'text-red-700': invalid,\n 'opacity-50': disabled,\n });\n\n return (\n <label {...otherProps} className={className} data-taco=\"label\" ref={ref}>\n {children}\n {message && (\n <Truncate tooltip={message}>\n <span\n className={messageClassName}\n data-taco=\"label-message\"\n ref={messageRef}\n role={invalid ? 'alert' : undefined}>\n {message}\n </span>\n </Truncate>\n )}\n </label>\n );\n});\n"],"names":["Field"],"mappings":";;;;AAqBO,MAAM,QAAQ,MAAM,WAAW,SAASA,OAAM,OAAmB,KAAkC;AAChG,QAAA,aAAa,MAAM,OAAwB,IAAI;AAE/C,QAAA,EAAE,UAAU,UAAU,UAAU,OAAO,UAAU,OAAO,SAAS,GAAG,WAAA,IAAe;AACzF,QAAM,YAAY;AAAA,IACd;AAAA,IACA;AAAA,MACI,iBAAiB;AAAA,IACrB;AAAA,IACA,MAAM;AAAA,EACV;AACM,QAAA,mBAAmB,GAAG,mEAAmE;AAAA,IAC3F,iBAAiB,CAAC,WAAW,CAAC;AAAA,IAC9B,gBAAgB;AAAA,IAChB,cAAc;AAAA,EAAA,CACjB;AAED,SACK,sBAAA,cAAA,SAAA,EAAO,GAAG,YAAY,WAAsB,aAAU,SAAQ,IAAA,GAC1D,UACA,WACI,sBAAA,cAAA,UAAA,EAAS,SAAS,WACf,sBAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACG,WAAW;AAAA,MACX,aAAU;AAAA,MACV,KAAK;AAAA,MACL,MAAM,UAAU,UAAU;AAAA,IAAA;AAAA,IACzB;AAAA,EAAA,CAET,CAER;AAER,CAAC;"}
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const React = require("react");
4
- const PopoverPrimitive = require("@radix-ui/react-popover");
4
+ const popover = require("@base-ui/react/popover");
5
5
  function _interopNamespaceDefault(e) {
6
6
  const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
7
7
  if (e) {
@@ -19,9 +19,8 @@ function _interopNamespaceDefault(e) {
19
19
  return Object.freeze(n);
20
20
  }
21
21
  const React__namespace = /* @__PURE__ */ _interopNamespaceDefault(React);
22
- const PopoverPrimitive__namespace = /* @__PURE__ */ _interopNamespaceDefault(PopoverPrimitive);
23
22
  const UnstyledArrow = React__namespace.forwardRef(function PopoverArrow(props, ref) {
24
- return /* @__PURE__ */ React__namespace.createElement(PopoverPrimitive__namespace.Arrow, { className: "pointer-events-none -mt-px", asChild: true, offset: 2, width: 30, height: 11 }, /* @__PURE__ */ React__namespace.createElement("svg", { ...props, ref, viewBox: "0 19 30 11", style: { transform: "rotateZ(180deg)" } }, /* @__PURE__ */ React__namespace.createElement(
23
+ return /* @__PURE__ */ React__namespace.createElement(popover.Popover.Arrow, { className: "pointer-events-none h-[11px] w-[30px] data-[side=bottom]:top-[-10px] data-[side=left]:right-[-20px] data-[side=right]:left-[-20px] data-[side=top]:bottom-[-10px] data-[side=left]:rotate-90 data-[side=right]:-rotate-90 data-[side=top]:rotate-180" }, /* @__PURE__ */ React__namespace.createElement("svg", { ...props, ref, viewBox: "0 19 30 11" }, /* @__PURE__ */ React__namespace.createElement(
25
24
  "path",
26
25
  {
27
26
  className: "fill-current text-blue-500",
@@ -1 +1 @@
1
- {"version":3,"file":"Arrow.cjs","sources":["../../../src/components/Hanger/Arrow.tsx"],"sourcesContent":["import * as React from 'react';\nimport * as PopoverPrimitive from '@radix-ui/react-popover';\n\nexport const UnstyledArrow = React.forwardRef<SVGSVGElement, React.SVGAttributes<SVGElement>>(function PopoverArrow(props, ref) {\n return (\n <PopoverPrimitive.Arrow className=\"pointer-events-none -mt-px\" asChild offset={2} width={30} height={11}>\n <svg {...props} ref={ref} viewBox=\"0 19 30 11\" style={{ transform: 'rotateZ(180deg)' }}>\n <path\n className=\"fill-current text-blue-500\"\n d=\"M23.7,27.1L17,19.9C16.5,19.3,15.8,19,15,19s-1.6,0.3-2.1,0.9l-6.6,7.2C5.3,28.1,3.4,29,2,29h26 C26.7,29,24.6,28.1,23.7,27.1z\"></path>\n <path\n className=\"fill-current\"\n d=\"M23,27.8c1.1,1.2,3.4,2.2,5,2.2h2H0h2c1.7,0,3.9-1,5-2.2l6.6-7.2c0.7-0.8,2-0.8,2.7,0L23,27.8L23,27.8z\"></path>\n </svg>\n </PopoverPrimitive.Arrow>\n );\n});\n"],"names":["React","PopoverPrimitive"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAGO,MAAM,gBAAgBA,iBAAM,WAA2D,SAAS,aAAa,OAAO,KAAK;AAExH,SAAAA,iCAAA,cAACC,4BAAiB,OAAjB,EAAuB,WAAU,8BAA6B,SAAO,MAAC,QAAQ,GAAG,OAAO,IAAI,QAAQ,MACjGD,iCAAA,cAAC,OAAK,EAAA,GAAG,OAAO,KAAU,SAAQ,cAAa,OAAO,EAAE,WAAW,kBAAA,EAC/D,GAAAA,iCAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACG,WAAU;AAAA,MACV,GAAE;AAAA,IAAA;AAAA,EACN,GAAAA,iCAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACG,WAAU;AAAA,MACV,GAAE;AAAA,IAAA;AAAA,EAAA,CACV,CACJ;AAER,CAAC;;"}
1
+ {"version":3,"file":"Arrow.cjs","sources":["../../../src/components/Hanger/Arrow.tsx"],"sourcesContent":["import * as React from 'react';\nimport { Popover as PopoverPrimitive } from '@base-ui/react/popover';\n\nexport const UnstyledArrow = React.forwardRef<SVGSVGElement, React.SVGAttributes<SVGElement>>(function PopoverArrow(props, ref) {\n return (\n <PopoverPrimitive.Arrow className=\"pointer-events-none h-[11px] w-[30px] data-[side=bottom]:top-[-10px] data-[side=left]:right-[-20px] data-[side=right]:left-[-20px] data-[side=top]:bottom-[-10px] data-[side=left]:rotate-90 data-[side=right]:-rotate-90 data-[side=top]:rotate-180\">\n <svg {...props} ref={ref} viewBox=\"0 19 30 11\">\n <path\n className=\"fill-current text-blue-500\"\n d=\"M23.7,27.1L17,19.9C16.5,19.3,15.8,19,15,19s-1.6,0.3-2.1,0.9l-6.6,7.2C5.3,28.1,3.4,29,2,29h26 C26.7,29,24.6,28.1,23.7,27.1z\"></path>\n <path\n className=\"fill-current\"\n d=\"M23,27.8c1.1,1.2,3.4,2.2,5,2.2h2H0h2c1.7,0,3.9-1,5-2.2l6.6-7.2c0.7-0.8,2-0.8,2.7,0L23,27.8L23,27.8z\"></path>\n </svg>\n </PopoverPrimitive.Arrow>\n );\n});\n"],"names":["React","PopoverPrimitive"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAGO,MAAM,gBAAgBA,iBAAM,WAA2D,SAAS,aAAa,OAAO,KAAK;AAC5H,SACKA,iCAAA,cAAAC,QAAA,QAAiB,OAAjB,EAAuB,WAAU,uPAAA,GAC7BD,iCAAA,cAAA,OAAA,EAAK,GAAG,OAAO,KAAU,SAAQ,aAC9B,GAAAA,iCAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACG,WAAU;AAAA,MACV,GAAE;AAAA,IAAA;AAAA,EACN,GAAAA,iCAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACG,WAAU;AAAA,MACV,GAAE;AAAA,IAAA;AAAA,EAAA,CACV,CACJ;AAER,CAAC;;"}
@@ -1,7 +1,7 @@
1
1
  import * as React from "react";
2
- import * as PopoverPrimitive from "@radix-ui/react-popover";
2
+ import { Popover } from "@base-ui/react/popover";
3
3
  const UnstyledArrow = React.forwardRef(function PopoverArrow(props, ref) {
4
- return /* @__PURE__ */ React.createElement(PopoverPrimitive.Arrow, { className: "pointer-events-none -mt-px", asChild: true, offset: 2, width: 30, height: 11 }, /* @__PURE__ */ React.createElement("svg", { ...props, ref, viewBox: "0 19 30 11", style: { transform: "rotateZ(180deg)" } }, /* @__PURE__ */ React.createElement(
4
+ return /* @__PURE__ */ React.createElement(Popover.Arrow, { className: "pointer-events-none h-[11px] w-[30px] data-[side=bottom]:top-[-10px] data-[side=left]:right-[-20px] data-[side=right]:left-[-20px] data-[side=top]:bottom-[-10px] data-[side=left]:rotate-90 data-[side=right]:-rotate-90 data-[side=top]:rotate-180" }, /* @__PURE__ */ React.createElement("svg", { ...props, ref, viewBox: "0 19 30 11" }, /* @__PURE__ */ React.createElement(
5
5
  "path",
6
6
  {
7
7
  className: "fill-current text-blue-500",
@@ -1 +1 @@
1
- {"version":3,"file":"Arrow.js","sources":["../../../src/components/Hanger/Arrow.tsx"],"sourcesContent":["import * as React from 'react';\nimport * as PopoverPrimitive from '@radix-ui/react-popover';\n\nexport const UnstyledArrow = React.forwardRef<SVGSVGElement, React.SVGAttributes<SVGElement>>(function PopoverArrow(props, ref) {\n return (\n <PopoverPrimitive.Arrow className=\"pointer-events-none -mt-px\" asChild offset={2} width={30} height={11}>\n <svg {...props} ref={ref} viewBox=\"0 19 30 11\" style={{ transform: 'rotateZ(180deg)' }}>\n <path\n className=\"fill-current text-blue-500\"\n d=\"M23.7,27.1L17,19.9C16.5,19.3,15.8,19,15,19s-1.6,0.3-2.1,0.9l-6.6,7.2C5.3,28.1,3.4,29,2,29h26 C26.7,29,24.6,28.1,23.7,27.1z\"></path>\n <path\n className=\"fill-current\"\n d=\"M23,27.8c1.1,1.2,3.4,2.2,5,2.2h2H0h2c1.7,0,3.9-1,5-2.2l6.6-7.2c0.7-0.8,2-0.8,2.7,0L23,27.8L23,27.8z\"></path>\n </svg>\n </PopoverPrimitive.Arrow>\n );\n});\n"],"names":[],"mappings":";;AAGO,MAAM,gBAAgB,MAAM,WAA2D,SAAS,aAAa,OAAO,KAAK;AAExH,SAAA,sBAAA,cAAC,iBAAiB,OAAjB,EAAuB,WAAU,8BAA6B,SAAO,MAAC,QAAQ,GAAG,OAAO,IAAI,QAAQ,MACjG,sBAAA,cAAC,OAAK,EAAA,GAAG,OAAO,KAAU,SAAQ,cAAa,OAAO,EAAE,WAAW,kBAAA,EAC/D,GAAA,sBAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACG,WAAU;AAAA,MACV,GAAE;AAAA,IAAA;AAAA,EACN,GAAA,sBAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACG,WAAU;AAAA,MACV,GAAE;AAAA,IAAA;AAAA,EAAA,CACV,CACJ;AAER,CAAC;"}
1
+ {"version":3,"file":"Arrow.js","sources":["../../../src/components/Hanger/Arrow.tsx"],"sourcesContent":["import * as React from 'react';\nimport { Popover as PopoverPrimitive } from '@base-ui/react/popover';\n\nexport const UnstyledArrow = React.forwardRef<SVGSVGElement, React.SVGAttributes<SVGElement>>(function PopoverArrow(props, ref) {\n return (\n <PopoverPrimitive.Arrow className=\"pointer-events-none h-[11px] w-[30px] data-[side=bottom]:top-[-10px] data-[side=left]:right-[-20px] data-[side=right]:left-[-20px] data-[side=top]:bottom-[-10px] data-[side=left]:rotate-90 data-[side=right]:-rotate-90 data-[side=top]:rotate-180\">\n <svg {...props} ref={ref} viewBox=\"0 19 30 11\">\n <path\n className=\"fill-current text-blue-500\"\n d=\"M23.7,27.1L17,19.9C16.5,19.3,15.8,19,15,19s-1.6,0.3-2.1,0.9l-6.6,7.2C5.3,28.1,3.4,29,2,29h26 C26.7,29,24.6,28.1,23.7,27.1z\"></path>\n <path\n className=\"fill-current\"\n d=\"M23,27.8c1.1,1.2,3.4,2.2,5,2.2h2H0h2c1.7,0,3.9-1,5-2.2l6.6-7.2c0.7-0.8,2-0.8,2.7,0L23,27.8L23,27.8z\"></path>\n </svg>\n </PopoverPrimitive.Arrow>\n );\n});\n"],"names":["PopoverPrimitive"],"mappings":";;AAGO,MAAM,gBAAgB,MAAM,WAA2D,SAAS,aAAa,OAAO,KAAK;AAC5H,SACK,sBAAA,cAAAA,QAAiB,OAAjB,EAAuB,WAAU,uPAAA,GAC7B,sBAAA,cAAA,OAAA,EAAK,GAAG,OAAO,KAAU,SAAQ,aAC9B,GAAA,sBAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACG,WAAU;AAAA,MACV,GAAE;AAAA,IAAA;AAAA,EACN,GAAA,sBAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACG,WAAU;AAAA,MACV,GAAE;AAAA,IAAA;AAAA,EAAA,CACV,CACJ;AAER,CAAC;"}
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const React = require("react");
4
4
  const cn = require("clsx");
5
- const PopoverPrimitive = require("@radix-ui/react-popover");
5
+ const popover = require("@base-ui/react/popover");
6
6
  const IconButton = require("../IconButton/IconButton.cjs");
7
7
  const Arrow = require("./Arrow.cjs");
8
8
  const Localization = require("../Provider/Localization.cjs");
@@ -25,75 +25,69 @@ function _interopNamespaceDefault(e) {
25
25
  return Object.freeze(n);
26
26
  }
27
27
  const React__namespace = /* @__PURE__ */ _interopNamespaceDefault(React);
28
- const PopoverPrimitive__namespace = /* @__PURE__ */ _interopNamespaceDefault(PopoverPrimitive);
29
28
  const HangerContext = React__namespace.createContext({
30
- onClose: void 0,
31
- props: {},
32
- ref: null
29
+ anchorRef: { current: null },
30
+ onClose: void 0
33
31
  });
34
- const Anchor = React__namespace.forwardRef(function HangerAnchor(props, externalRef) {
35
- var _a;
36
- const { ref: parentRef, props: parentProps } = React__namespace.useContext(HangerContext);
37
- const refCallback = mergeRefs.mergeRefs([parentRef, externalRef]);
38
- let children = props.children;
39
- if (React__namespace.isValidElement(props.children) && typeof ((_a = props.children) == null ? void 0 : _a.type) === "function") {
40
- console.warn(
41
- `Hanger.Anchor requires its child to forwardRef so that it can attach to the dom element. Did you mean to wrap '${props.children.type.name}' in React.forwardRef()? Taco has wrapped '${props.children.type.name}' in a 'span' to maintain functionality, but this may cause unintended behaviour`
42
- );
43
- children = /* @__PURE__ */ React__namespace.createElement("span", null, props.children);
44
- }
45
- return /* @__PURE__ */ React__namespace.createElement(PopoverPrimitive__namespace.Anchor, { ...parentProps, ...props, ref: refCallback, asChild: true }, children);
32
+ const Anchor = React__namespace.forwardRef(function HangerAnchor(props) {
33
+ return /* @__PURE__ */ React__namespace.createElement(React__namespace.Fragment, null, props.children);
46
34
  });
47
35
  const Title = React__namespace.forwardRef(function DialogTitle(props, ref) {
48
36
  const className = cn("mb-1 text-base font-bold flex w-full", props.className);
49
37
  return /* @__PURE__ */ React__namespace.createElement("span", { ...props, className, ref });
50
38
  });
51
39
  const Content = React__namespace.forwardRef(function HangerContent(props, ref) {
52
- const { placement: side, hideWhenDetached = false, container } = props;
40
+ const { placement: side, hideWhenDetached = false, container, ...popoverContentProps } = props;
53
41
  const context = React__namespace.useContext(HangerContext);
54
42
  const { texts } = Localization.useLocalization();
55
43
  const className = cn(
56
44
  "wcag-blue-500 border border-transparent rounded p-3 pr-12 yt-shadow focus:border-transparent max-w-sm print:hidden",
57
45
  props.className
58
46
  );
59
- const handleInteractOutside = (event) => {
60
- event.preventDefault();
61
- };
62
- return /* @__PURE__ */ React__namespace.createElement(PopoverPrimitive__namespace.Portal, { container }, /* @__PURE__ */ React__namespace.createElement(
63
- PopoverPrimitive__namespace.Content,
47
+ return /* @__PURE__ */ React__namespace.createElement(popover.Popover.Portal, { container }, /* @__PURE__ */ React__namespace.createElement(
48
+ popover.Popover.Positioner,
64
49
  {
65
- className,
66
- "data-taco": "hanger",
67
- onInteractOutside: handleInteractOutside,
50
+ anchor: context.anchorRef,
51
+ className: hideWhenDetached ? "data-[anchor-hidden]:hidden" : void 0,
68
52
  side,
69
- sideOffset: 1,
70
- ref,
71
- hideWhenDetached
53
+ sideOffset: 11
72
54
  },
73
- props.children,
74
- /* @__PURE__ */ React__namespace.createElement(Arrow.UnstyledArrow, { className: "text-blue-500" }),
75
- /* @__PURE__ */ React__namespace.createElement(PopoverPrimitive__namespace.Close, { asChild: true }, /* @__PURE__ */ React__namespace.createElement(
76
- IconButton.IconButton,
55
+ /* @__PURE__ */ React__namespace.createElement(popover.Popover.Popup, { ...popoverContentProps, className, "data-taco": "hanger", ref }, props.children, /* @__PURE__ */ React__namespace.createElement(Arrow.UnstyledArrow, { className: "text-blue-500" }), /* @__PURE__ */ React__namespace.createElement(
56
+ popover.Popover.Close,
77
57
  {
78
- appearance: "primary",
79
- "aria-label": texts.hanger.close,
80
- className: "absolute right-0 top-0 ml-2 mr-2 mt-2 text-white",
81
- icon: "close",
82
- onClick: context.onClose
58
+ render: /* @__PURE__ */ React__namespace.createElement(
59
+ IconButton.IconButton,
60
+ {
61
+ appearance: "primary",
62
+ "aria-label": texts.hanger.close,
63
+ className: "absolute right-0 top-0 mx-2 mt-2 text-white",
64
+ icon: "close",
65
+ onClick: context.onClose
66
+ }
67
+ )
83
68
  }
84
69
  ))
85
70
  ));
86
71
  });
87
72
  const Hanger = React__namespace.forwardRef(function Hanger2(props, ref) {
88
73
  const { anchor, children, defaultOpen = true, onClose, ...otherProps } = props;
89
- const context = React__namespace.useMemo(() => ({ onClose, props: otherProps, ref }), [onClose, otherProps]);
74
+ const anchorRef = React__namespace.useRef(null);
75
+ const combinedRef = mergeRefs.mergeRefs([anchorRef, ref]);
76
+ const context = React__namespace.useMemo(() => ({ anchorRef, onClose }), [onClose]);
90
77
  const [open, setOpen] = React__namespace.useState(false);
91
78
  React__namespace.useEffect(() => {
92
79
  if (defaultOpen) {
93
80
  setOpen(defaultOpen);
94
81
  }
95
82
  }, []);
96
- return /* @__PURE__ */ React__namespace.createElement(HangerContext.Provider, { value: context }, /* @__PURE__ */ React__namespace.createElement(PopoverPrimitive__namespace.Root, { key: String(open), defaultOpen: open }, anchor && /* @__PURE__ */ React__namespace.createElement(Anchor, null, anchor), children));
83
+ const handleOpenChange = (nextOpen, eventDetails) => {
84
+ if (!nextOpen && (eventDetails.reason === "outside-press" || eventDetails.reason === "focus-out")) {
85
+ eventDetails.cancel();
86
+ return;
87
+ }
88
+ setOpen(nextOpen);
89
+ };
90
+ return /* @__PURE__ */ React__namespace.createElement(HangerContext.Provider, { value: context }, /* @__PURE__ */ React__namespace.createElement("span", { ...otherProps, ref: combinedRef }, /* @__PURE__ */ React__namespace.createElement(popover.Popover.Root, { open, onOpenChange: handleOpenChange }, anchor, children)));
97
91
  });
98
92
  Hanger.Anchor = Anchor;
99
93
  Hanger.Content = Content;
@@ -1 +1 @@
1
- {"version":3,"file":"Hanger.cjs","sources":["../../../src/components/Hanger/Hanger.tsx"],"sourcesContent":["import * as React from 'react';\nimport cn from 'clsx';\nimport * as PopoverPrimitive from '@radix-ui/react-popover';\n\nimport { IconButton } from '../IconButton/IconButton';\nimport { Placement } from '../..';\nimport { UnstyledArrow } from './Arrow';\nimport { useLocalization } from '../Provider/Localization';\nimport { mergeRefs } from '../../utils/mergeRefs';\nimport './Hanger.css';\n\ntype HangerContextValue = {\n /** Handler called when hanger closes by user interaction */\n onClose?: () => void;\n props: Record<string, any>;\n ref: React.Ref<HTMLElement>;\n};\nconst HangerContext = React.createContext<HangerContextValue>({\n onClose: undefined,\n props: {},\n ref: null,\n});\n\nexport type HangerTexts = {\n /** Aria-label for the close icon button of hanger */\n close: string;\n};\n\nexport type HangerAnchorProps = React.HTMLAttributes<HTMLDivElement>;\nconst Anchor = React.forwardRef(function HangerAnchor(props: HangerAnchorProps, externalRef: React.Ref<HTMLDivElement>) {\n const { ref: parentRef, props: parentProps } = React.useContext(HangerContext);\n const refCallback = mergeRefs([parentRef, externalRef]);\n\n let children = props.children;\n\n if (React.isValidElement(props.children) && typeof props.children?.type === 'function') {\n // oxlint-disable-next-line no-console\n console.warn(\n `Hanger.Anchor requires its child to forwardRef so that it can attach to the dom element. Did you mean to wrap '${props.children.type.name}' in React.forwardRef()? Taco has wrapped '${props.children.type.name}' in a 'span' to maintain functionality, but this may cause unintended behaviour`\n );\n children = <span>{props.children}</span>;\n }\n\n return (\n <PopoverPrimitive.Anchor {...parentProps} {...props} ref={refCallback} asChild>\n {children}\n </PopoverPrimitive.Anchor>\n );\n});\n\nexport type HangerTitleProps = React.HTMLAttributes<HTMLHeadingElement>;\nexport const Title = React.forwardRef(function DialogTitle(props: HangerTitleProps, ref: React.Ref<HTMLHeadingElement>) {\n const className = cn('mb-1 text-base font-bold flex w-full', props.className);\n return <span {...props} className={className} ref={ref} />;\n});\n\nexport type HangerContentProps = React.HTMLAttributes<HTMLDivElement> & {\n /** Set the position of the Hanger relative to its achor. Default value is `bottom` */\n placement?: Placement;\n hideWhenDetached?: boolean;\n container?: HTMLElement | null;\n};\n\nconst Content = React.forwardRef(function HangerContent(props: HangerContentProps, ref: React.Ref<HTMLDivElement>) {\n const { placement: side, hideWhenDetached = false, container } = props;\n const context = React.useContext(HangerContext);\n const { texts } = useLocalization();\n const className = cn(\n 'wcag-blue-500 border border-transparent rounded p-3 pr-12 yt-shadow focus:border-transparent max-w-sm print:hidden',\n props.className\n );\n const handleInteractOutside = (event: CustomEvent): void => {\n event.preventDefault();\n };\n\n return (\n <PopoverPrimitive.Portal container={container}>\n <PopoverPrimitive.Content\n className={className}\n data-taco=\"hanger\"\n onInteractOutside={handleInteractOutside}\n side={side}\n sideOffset={1}\n ref={ref}\n hideWhenDetached={hideWhenDetached}>\n {props.children}\n <UnstyledArrow className=\"text-blue-500\" />\n <PopoverPrimitive.Close asChild>\n <IconButton\n appearance=\"primary\"\n aria-label={texts.hanger.close}\n className=\"absolute right-0 top-0 ml-2 mr-2 mt-2 text-white\"\n icon=\"close\"\n onClick={context.onClose}\n />\n </PopoverPrimitive.Close>\n </PopoverPrimitive.Content>\n </PopoverPrimitive.Portal>\n );\n});\n\nexport type HangerProps = React.PropsWithChildren<{\n /** An anchor to be used for the hanger, should not be set if `children` already contains an anchor */\n anchor?: JSX.Element;\n /**\n * Shows or hides hanger depending on the value\n * @defaultValue true\n */\n defaultOpen?: boolean;\n /** Handler called when user closes the hanger */\n onClose?: () => void;\n}>;\n\nexport type ForwardedHangerWithStatics = React.ForwardRefExoticComponent<HangerProps & React.RefAttributes<HTMLElement>> & {\n Anchor: React.ForwardRefExoticComponent<HangerAnchorProps>;\n Content: React.ForwardRefExoticComponent<HangerContentProps>;\n Title: React.ForwardRefExoticComponent<HangerTitleProps>;\n};\n\nexport const Hanger = React.forwardRef<HTMLElement, HangerProps>(function Hanger(props, ref) {\n const { anchor, children, defaultOpen = true, onClose, ...otherProps } = props;\n const context = React.useMemo(() => ({ onClose, props: otherProps, ref }), [onClose, otherProps]);\n\n // we do this to ensure hangers are mounted after their containers, e.g. if the container is another portal\n const [open, setOpen] = React.useState(false);\n React.useEffect(() => {\n if (defaultOpen) {\n setOpen(defaultOpen);\n }\n }, []);\n\n return (\n <HangerContext.Provider value={context}>\n <PopoverPrimitive.Root key={String(open)} defaultOpen={open}>\n {anchor && <Anchor>{anchor}</Anchor>}\n {children}\n </PopoverPrimitive.Root>\n </HangerContext.Provider>\n );\n}) as ForwardedHangerWithStatics;\nHanger.Anchor = Anchor;\nHanger.Content = Content;\nHanger.Title = Title;\n"],"names":["React","mergeRefs","PopoverPrimitive","useLocalization","UnstyledArrow","IconButton","Hanger"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiBA,MAAM,gBAAgBA,iBAAM,cAAkC;AAAA,EAC1D,SAAS;AAAA,EACT,OAAO,CAAC;AAAA,EACR,KAAK;AACT,CAAC;AAQD,MAAM,SAASA,iBAAM,WAAW,SAAS,aAAa,OAA0B,aAAwC;;AAC9G,QAAA,EAAE,KAAK,WAAW,OAAO,gBAAgBA,iBAAM,WAAW,aAAa;AAC7E,QAAM,cAAcC,UAAA,UAAU,CAAC,WAAW,WAAW,CAAC;AAEtD,MAAI,WAAW,MAAM;AAEjB,MAAAD,iBAAM,eAAe,MAAM,QAAQ,KAAK,SAAO,WAAM,aAAN,mBAAgB,UAAS,YAAY;AAE5E,YAAA;AAAA,MACJ,kHAAkH,MAAM,SAAS,KAAK,IAAI,8CAA8C,MAAM,SAAS,KAAK,IAAI;AAAA,IACpN;AACW,eAAAA,iCAAA,cAAC,QAAM,MAAA,MAAM,QAAS;AAAA,EAAA;AAGrC,SACKA,iCAAA,cAAAE,4BAAiB,QAAjB,EAAyB,GAAG,aAAc,GAAG,OAAO,KAAK,aAAa,SAAO,KAAA,GACzE,QACL;AAER,CAAC;AAGM,MAAM,QAAQF,iBAAM,WAAW,SAAS,YAAY,OAAyB,KAAoC;AACpH,QAAM,YAAY,GAAG,wCAAwC,MAAM,SAAS;AAC5E,SAAQA,iCAAA,cAAA,QAAA,EAAM,GAAG,OAAO,WAAsB,KAAU;AAC5D,CAAC;AASD,MAAM,UAAUA,iBAAM,WAAW,SAAS,cAAc,OAA2B,KAAgC;AAC/G,QAAM,EAAE,WAAW,MAAM,mBAAmB,OAAO,cAAc;AAC3D,QAAA,UAAUA,iBAAM,WAAW,aAAa;AACxC,QAAA,EAAE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,yDAAW,QAAQ,MAAA,MAAO,GAC1B,QACL,CACJ;AAER,CAAC;AACD,OAAO,SAAS;AAChB,OAAO,UAAU;AACjB,OAAO,QAAQ;;;"}
1
+ {"version":3,"file":"Hanger.cjs","sources":["../../../src/components/Hanger/Hanger.tsx"],"sourcesContent":["import * as React from 'react';\nimport cn from 'clsx';\nimport { Popover as PopoverPrimitive } from '@base-ui/react/popover';\n\nimport { IconButton } from '../IconButton/IconButton';\nimport { Placement } from '../..';\nimport { UnstyledArrow } from './Arrow';\nimport { useLocalization } from '../Provider/Localization';\nimport { mergeRefs } from '../../utils/mergeRefs';\nimport './Hanger.css';\n\ntype HangerContextValue = {\n /** Handler called when hanger closes by user interaction */\n onClose?: () => void;\n anchorRef: React.RefObject<HTMLElement>;\n};\nconst HangerContext = React.createContext<HangerContextValue>({\n anchorRef: { current: null },\n onClose: undefined,\n});\n\nexport type HangerTexts = {\n /** Aria-label for the close icon button of hanger */\n close: string;\n};\n\nexport type HangerAnchorProps = React.HTMLAttributes<HTMLElement>;\n// Passthrough the surrounding Hanger root owns the single DOM wrapper that serves as the anchor.\n// `Hanger.Anchor` remains in the JSX API for backward compatibility and to signal intent.\nconst Anchor = React.forwardRef<HTMLElement, HangerAnchorProps>(function HangerAnchor(props) {\n return <>{props.children}</>;\n});\n\nexport type HangerTitleProps = React.HTMLAttributes<HTMLHeadingElement>;\nexport const Title = React.forwardRef(function DialogTitle(props: HangerTitleProps, ref: React.Ref<HTMLHeadingElement>) {\n const className = cn('mb-1 text-base font-bold flex w-full', props.className);\n return <span {...props} className={className} ref={ref} />;\n});\n\nexport type HangerContentProps = React.HTMLAttributes<HTMLDivElement> & {\n /** Set the position of the Hanger relative to its achor. Default value is `bottom` */\n placement?: Placement;\n hideWhenDetached?: boolean;\n container?: HTMLElement | null;\n};\n\nconst Content = React.forwardRef(function HangerContent(props: HangerContentProps, ref: React.Ref<HTMLDivElement>) {\n const { placement: side, hideWhenDetached = false, container, ...popoverContentProps } = props;\n const context = React.useContext(HangerContext);\n const { texts } = useLocalization();\n const className = cn(\n 'wcag-blue-500 border border-transparent rounded p-3 pr-12 yt-shadow focus:border-transparent max-w-sm print:hidden',\n props.className\n );\n\n return (\n <PopoverPrimitive.Portal container={container}>\n <PopoverPrimitive.Positioner\n anchor={context.anchorRef}\n className={hideWhenDetached ? 'data-[anchor-hidden]:hidden' : undefined}\n side={side}\n sideOffset={11}>\n <PopoverPrimitive.Popup {...popoverContentProps} className={className} data-taco=\"hanger\" ref={ref}>\n {props.children}\n <UnstyledArrow className=\"text-blue-500\" />\n <PopoverPrimitive.Close\n render={\n <IconButton\n appearance=\"primary\"\n aria-label={texts.hanger.close}\n className=\"absolute right-0 top-0 mx-2 mt-2 text-white\"\n icon=\"close\"\n onClick={context.onClose}\n />\n }\n />\n </PopoverPrimitive.Popup>\n </PopoverPrimitive.Positioner>\n </PopoverPrimitive.Portal>\n );\n});\n\nexport type HangerProps = React.PropsWithChildren<{\n /** An anchor to be used for the hanger, should not be set if `children` already contains an anchor */\n anchor?: JSX.Element;\n /**\n * Shows or hides hanger depending on the value\n * @defaultValue true\n */\n defaultOpen?: boolean;\n /** Handler called when user closes the hanger */\n onClose?: () => void;\n}>;\n\nexport type ForwardedHangerWithStatics = React.ForwardRefExoticComponent<HangerProps & React.RefAttributes<HTMLElement>> & {\n Anchor: React.ForwardRefExoticComponent<HangerAnchorProps>;\n Content: React.ForwardRefExoticComponent<HangerContentProps>;\n Title: React.ForwardRefExoticComponent<HangerTitleProps>;\n};\n\nexport const Hanger = React.forwardRef<HTMLSpanElement, HangerProps>(function Hanger(props, ref) {\n const { anchor, children, defaultOpen = true, onClose, ...otherProps } = props;\n const anchorRef = React.useRef<HTMLElement>(null);\n const combinedRef = mergeRefs([anchorRef as React.MutableRefObject<HTMLElement | null>, ref]);\n const context = React.useMemo(() => ({ anchorRef, onClose }), [onClose]);\n\n // we do this to ensure hangers are mounted after their containers, e.g. if the container is another portal\n const [open, setOpen] = React.useState(false);\n React.useEffect(() => {\n if (defaultOpen) {\n setOpen(defaultOpen);\n }\n }, []);\n\n // Hanger should only close from its close button, matching the previous Radix onInteractOutside behavior.\n const handleOpenChange = (nextOpen: boolean, eventDetails: PopoverPrimitive.Root.ChangeEventDetails) => {\n if (!nextOpen && (eventDetails.reason === 'outside-press' || eventDetails.reason === 'focus-out')) {\n eventDetails.cancel();\n return;\n }\n\n setOpen(nextOpen);\n };\n\n // Single inline <span> wrapper: serves as the Floating UI anchor (its rect matches the\n // in-flow trigger child) and contains the FloatingFocusManager guard spans Base UI injects\n // when open, so they aren't siblings of the Hanger in parent IntersectionObservers\n // (e.g. OverflowGroup's) and don't get counted as overflowed children.\n return (\n <HangerContext.Provider value={context}>\n <span {...otherProps} ref={combinedRef as React.Ref<HTMLSpanElement>}>\n <PopoverPrimitive.Root open={open} onOpenChange={handleOpenChange}>\n {/* Anchor via the `anchor` prop. */}\n {anchor}\n {/* Composition (<Hanger.Anchor>) and the popup Content (portaled out) come through {children}. */}\n {children}\n </PopoverPrimitive.Root>\n </span>\n </HangerContext.Provider>\n );\n}) as ForwardedHangerWithStatics;\nHanger.Anchor = Anchor;\nHanger.Content = Content;\nHanger.Title = Title;\n"],"names":["React","useLocalization","PopoverPrimitive","UnstyledArrow","IconButton","Hanger","mergeRefs"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAgBA,MAAM,gBAAgBA,iBAAM,cAAkC;AAAA,EAC1D,WAAW,EAAE,SAAS,KAAK;AAAA,EAC3B,SAAS;AACb,CAAC;AAUD,MAAM,SAASA,iBAAM,WAA2C,SAAS,aAAa,OAAO;AAClF,SAAAA,iCAAA,cAAAA,iBAAA,UAAA,MAAG,MAAM,QAAS;AAC7B,CAAC;AAGM,MAAM,QAAQA,iBAAM,WAAW,SAAS,YAAY,OAAyB,KAAoC;AACpH,QAAM,YAAY,GAAG,wCAAwC,MAAM,SAAS;AAC5E,SAAQA,iCAAA,cAAA,QAAA,EAAM,GAAG,OAAO,WAAsB,KAAU;AA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QAAM,CAAC,MAAM,OAAO,IAAIA,iBAAM,SAAS,KAAK;AAC5CA,mBAAM,UAAU,MAAM;AAClB,QAAI,aAAa;AACb,cAAQ,WAAW;AAAA,IAAA;AAAA,EAE3B,GAAG,EAAE;AAGC,QAAA,mBAAmB,CAAC,UAAmB,iBAA2D;AACpG,QAAI,CAAC,aAAa,aAAa,WAAW,mBAAmB,aAAa,WAAW,cAAc;AAC/F,mBAAa,OAAO;AACpB;AAAA,IAAA;AAGJ,YAAQ,QAAQ;AAAA,EACpB;AAOI,SAAAA,iCAAA,cAAC,cAAc,UAAd,EAAuB,OAAO,QAC3B,GAAAA,iCAAA,cAAC,QAAM,EAAA,GAAG,YAAY,KAAK,eACtBA,iCAAA,cAAAE,QAAAA,QAAiB,MAAjB,EAAsB,MAAY,cAAc,iBAE5C,GAAA,QAEA,QACL,CACJ,CACJ;AAER,CAAC;AACD,OAAO,SAAS;AAChB,OAAO,UAAU;AACjB,OAAO,QAAQ;;;"}
@@ -4,7 +4,7 @@ export type HangerTexts = {
4
4
  /** Aria-label for the close icon button of hanger */
5
5
  close: string;
6
6
  };
7
- export type HangerAnchorProps = React.HTMLAttributes<HTMLDivElement>;
7
+ export type HangerAnchorProps = React.HTMLAttributes<HTMLElement>;
8
8
  export type HangerTitleProps = React.HTMLAttributes<HTMLHeadingElement>;
9
9
  export declare const Title: React.ForwardRefExoticComponent<HangerTitleProps & React.RefAttributes<HTMLHeadingElement>>;
10
10
  export type HangerContentProps = React.HTMLAttributes<HTMLDivElement> & {
@@ -1,79 +1,74 @@
1
1
  import * as React from "react";
2
2
  import cn from "clsx";
3
- import * as PopoverPrimitive from "@radix-ui/react-popover";
3
+ import { Popover } from "@base-ui/react/popover";
4
4
  import { IconButton } from "../IconButton/IconButton.js";
5
5
  import { UnstyledArrow } from "./Arrow.js";
6
6
  import { useLocalization } from "../Provider/Localization.js";
7
7
  import { mergeRefs } from "../../utils/mergeRefs.js";
8
8
  /* empty css */
9
9
  const HangerContext = React.createContext({
10
- onClose: void 0,
11
- props: {},
12
- ref: null
10
+ anchorRef: { current: null },
11
+ onClose: void 0
13
12
  });
14
- const Anchor = React.forwardRef(function HangerAnchor(props, externalRef) {
15
- var _a;
16
- const { ref: parentRef, props: parentProps } = React.useContext(HangerContext);
17
- const refCallback = mergeRefs([parentRef, externalRef]);
18
- let children = props.children;
19
- if (React.isValidElement(props.children) && typeof ((_a = props.children) == null ? void 0 : _a.type) === "function") {
20
- console.warn(
21
- `Hanger.Anchor requires its child to forwardRef so that it can attach to the dom element. Did you mean to wrap '${props.children.type.name}' in React.forwardRef()? Taco has wrapped '${props.children.type.name}' in a 'span' to maintain functionality, but this may cause unintended behaviour`
22
- );
23
- children = /* @__PURE__ */ React.createElement("span", null, props.children);
24
- }
25
- return /* @__PURE__ */ React.createElement(PopoverPrimitive.Anchor, { ...parentProps, ...props, ref: refCallback, asChild: true }, children);
13
+ const Anchor = React.forwardRef(function HangerAnchor(props) {
14
+ return /* @__PURE__ */ React.createElement(React.Fragment, null, props.children);
26
15
  });
27
16
  const Title = React.forwardRef(function DialogTitle(props, ref) {
28
17
  const className = cn("mb-1 text-base font-bold flex w-full", props.className);
29
18
  return /* @__PURE__ */ React.createElement("span", { ...props, className, ref });
30
19
  });
31
20
  const Content = React.forwardRef(function HangerContent(props, ref) {
32
- const { placement: side, hideWhenDetached = false, container } = props;
21
+ const { placement: side, hideWhenDetached = false, container, ...popoverContentProps } = props;
33
22
  const context = React.useContext(HangerContext);
34
23
  const { texts } = useLocalization();
35
24
  const className = cn(
36
25
  "wcag-blue-500 border border-transparent rounded p-3 pr-12 yt-shadow focus:border-transparent max-w-sm print:hidden",
37
26
  props.className
38
27
  );
39
- const handleInteractOutside = (event) => {
40
- event.preventDefault();
41
- };
42
- return /* @__PURE__ */ React.createElement(PopoverPrimitive.Portal, { container }, /* @__PURE__ */ React.createElement(
43
- PopoverPrimitive.Content,
28
+ return /* @__PURE__ */ React.createElement(Popover.Portal, { container }, /* @__PURE__ */ React.createElement(
29
+ Popover.Positioner,
44
30
  {
45
- className,
46
- "data-taco": "hanger",
47
- onInteractOutside: handleInteractOutside,
31
+ anchor: context.anchorRef,
32
+ className: hideWhenDetached ? "data-[anchor-hidden]:hidden" : void 0,
48
33
  side,
49
- sideOffset: 1,
50
- ref,
51
- hideWhenDetached
34
+ sideOffset: 11
52
35
  },
53
- props.children,
54
- /* @__PURE__ */ React.createElement(UnstyledArrow, { className: "text-blue-500" }),
55
- /* @__PURE__ */ React.createElement(PopoverPrimitive.Close, { asChild: true }, /* @__PURE__ */ React.createElement(
56
- IconButton,
36
+ /* @__PURE__ */ React.createElement(Popover.Popup, { ...popoverContentProps, className, "data-taco": "hanger", ref }, props.children, /* @__PURE__ */ React.createElement(UnstyledArrow, { className: "text-blue-500" }), /* @__PURE__ */ React.createElement(
37
+ Popover.Close,
57
38
  {
58
- appearance: "primary",
59
- "aria-label": texts.hanger.close,
60
- className: "absolute right-0 top-0 ml-2 mr-2 mt-2 text-white",
61
- icon: "close",
62
- onClick: context.onClose
39
+ render: /* @__PURE__ */ React.createElement(
40
+ IconButton,
41
+ {
42
+ appearance: "primary",
43
+ "aria-label": texts.hanger.close,
44
+ className: "absolute right-0 top-0 mx-2 mt-2 text-white",
45
+ icon: "close",
46
+ onClick: context.onClose
47
+ }
48
+ )
63
49
  }
64
50
  ))
65
51
  ));
66
52
  });
67
53
  const Hanger = React.forwardRef(function Hanger2(props, ref) {
68
54
  const { anchor, children, defaultOpen = true, onClose, ...otherProps } = props;
69
- const context = React.useMemo(() => ({ onClose, props: otherProps, ref }), [onClose, otherProps]);
55
+ const anchorRef = React.useRef(null);
56
+ const combinedRef = mergeRefs([anchorRef, ref]);
57
+ const context = React.useMemo(() => ({ anchorRef, onClose }), [onClose]);
70
58
  const [open, setOpen] = React.useState(false);
71
59
  React.useEffect(() => {
72
60
  if (defaultOpen) {
73
61
  setOpen(defaultOpen);
74
62
  }
75
63
  }, []);
76
- return /* @__PURE__ */ React.createElement(HangerContext.Provider, { value: context }, /* @__PURE__ */ React.createElement(PopoverPrimitive.Root, { key: String(open), defaultOpen: open }, anchor && /* @__PURE__ */ React.createElement(Anchor, null, anchor), children));
64
+ const handleOpenChange = (nextOpen, eventDetails) => {
65
+ if (!nextOpen && (eventDetails.reason === "outside-press" || eventDetails.reason === "focus-out")) {
66
+ eventDetails.cancel();
67
+ return;
68
+ }
69
+ setOpen(nextOpen);
70
+ };
71
+ return /* @__PURE__ */ React.createElement(HangerContext.Provider, { value: context }, /* @__PURE__ */ React.createElement("span", { ...otherProps, ref: combinedRef }, /* @__PURE__ */ React.createElement(Popover.Root, { open, onOpenChange: handleOpenChange }, anchor, children)));
77
72
  });
78
73
  Hanger.Anchor = Anchor;
79
74
  Hanger.Content = Content;
@@ -1 +1 @@
1
- {"version":3,"file":"Hanger.js","sources":["../../../src/components/Hanger/Hanger.tsx"],"sourcesContent":["import * as React from 'react';\nimport cn from 'clsx';\nimport * as PopoverPrimitive from '@radix-ui/react-popover';\n\nimport { IconButton } from '../IconButton/IconButton';\nimport { Placement } from '../..';\nimport { UnstyledArrow } from './Arrow';\nimport { useLocalization } from '../Provider/Localization';\nimport { mergeRefs } from '../../utils/mergeRefs';\nimport './Hanger.css';\n\ntype HangerContextValue = {\n /** Handler called when hanger closes by user interaction */\n onClose?: () => void;\n props: Record<string, any>;\n ref: React.Ref<HTMLElement>;\n};\nconst HangerContext = React.createContext<HangerContextValue>({\n onClose: undefined,\n props: {},\n ref: null,\n});\n\nexport type HangerTexts = {\n /** Aria-label for the close icon button of hanger */\n close: string;\n};\n\nexport type HangerAnchorProps = React.HTMLAttributes<HTMLDivElement>;\nconst Anchor = React.forwardRef(function HangerAnchor(props: HangerAnchorProps, externalRef: React.Ref<HTMLDivElement>) {\n const { ref: parentRef, props: parentProps } = React.useContext(HangerContext);\n const refCallback = mergeRefs([parentRef, externalRef]);\n\n let children = props.children;\n\n if (React.isValidElement(props.children) && typeof props.children?.type === 'function') {\n // oxlint-disable-next-line no-console\n console.warn(\n `Hanger.Anchor requires its child to forwardRef so that it can attach to the dom element. Did you mean to wrap '${props.children.type.name}' in React.forwardRef()? Taco has wrapped '${props.children.type.name}' in a 'span' to maintain functionality, but this may cause unintended behaviour`\n );\n children = <span>{props.children}</span>;\n }\n\n return (\n <PopoverPrimitive.Anchor {...parentProps} {...props} ref={refCallback} asChild>\n {children}\n </PopoverPrimitive.Anchor>\n );\n});\n\nexport type HangerTitleProps = React.HTMLAttributes<HTMLHeadingElement>;\nexport const Title = React.forwardRef(function DialogTitle(props: HangerTitleProps, ref: React.Ref<HTMLHeadingElement>) {\n const className = cn('mb-1 text-base font-bold flex w-full', props.className);\n return <span {...props} className={className} ref={ref} />;\n});\n\nexport type HangerContentProps = React.HTMLAttributes<HTMLDivElement> & {\n /** Set the position of the Hanger relative to its achor. Default value is `bottom` */\n placement?: Placement;\n hideWhenDetached?: boolean;\n container?: HTMLElement | null;\n};\n\nconst Content = React.forwardRef(function HangerContent(props: HangerContentProps, ref: React.Ref<HTMLDivElement>) {\n const { placement: side, hideWhenDetached = false, container } = props;\n const context = React.useContext(HangerContext);\n const { texts } = useLocalization();\n const className = cn(\n 'wcag-blue-500 border border-transparent rounded p-3 pr-12 yt-shadow focus:border-transparent max-w-sm print:hidden',\n props.className\n );\n const handleInteractOutside = (event: CustomEvent): void => {\n event.preventDefault();\n };\n\n return (\n <PopoverPrimitive.Portal container={container}>\n <PopoverPrimitive.Content\n className={className}\n data-taco=\"hanger\"\n onInteractOutside={handleInteractOutside}\n side={side}\n sideOffset={1}\n ref={ref}\n hideWhenDetached={hideWhenDetached}>\n {props.children}\n <UnstyledArrow className=\"text-blue-500\" />\n <PopoverPrimitive.Close asChild>\n <IconButton\n appearance=\"primary\"\n aria-label={texts.hanger.close}\n className=\"absolute right-0 top-0 ml-2 mr-2 mt-2 text-white\"\n icon=\"close\"\n onClick={context.onClose}\n />\n </PopoverPrimitive.Close>\n </PopoverPrimitive.Content>\n </PopoverPrimitive.Portal>\n );\n});\n\nexport type HangerProps = React.PropsWithChildren<{\n /** An anchor to be used for the hanger, should not be set if `children` already contains an anchor */\n anchor?: JSX.Element;\n /**\n * Shows or hides hanger depending on the value\n * @defaultValue true\n */\n defaultOpen?: boolean;\n /** Handler called when user closes the hanger */\n onClose?: () => void;\n}>;\n\nexport type ForwardedHangerWithStatics = React.ForwardRefExoticComponent<HangerProps & React.RefAttributes<HTMLElement>> & {\n Anchor: React.ForwardRefExoticComponent<HangerAnchorProps>;\n Content: React.ForwardRefExoticComponent<HangerContentProps>;\n Title: React.ForwardRefExoticComponent<HangerTitleProps>;\n};\n\nexport const Hanger = React.forwardRef<HTMLElement, HangerProps>(function Hanger(props, ref) {\n const { anchor, children, defaultOpen = true, onClose, ...otherProps } = props;\n const context = React.useMemo(() => ({ onClose, props: otherProps, ref }), [onClose, otherProps]);\n\n // we do this to ensure hangers are mounted after their containers, e.g. if the container is another portal\n const [open, setOpen] = React.useState(false);\n React.useEffect(() => {\n if (defaultOpen) {\n setOpen(defaultOpen);\n }\n }, []);\n\n return (\n <HangerContext.Provider value={context}>\n <PopoverPrimitive.Root key={String(open)} defaultOpen={open}>\n {anchor && <Anchor>{anchor}</Anchor>}\n {children}\n </PopoverPrimitive.Root>\n </HangerContext.Provider>\n );\n}) as ForwardedHangerWithStatics;\nHanger.Anchor = Anchor;\nHanger.Content = Content;\nHanger.Title = Title;\n"],"names":["Hanger"],"mappings":";;;;;;;;AAiBA,MAAM,gBAAgB,MAAM,cAAkC;AAAA,EAC1D,SAAS;AAAA,EACT,OAAO,CAAC;AAAA,EACR,KAAK;AACT,CAAC;AAQD,MAAM,SAAS,MAAM,WAAW,SAAS,aAAa,OAA0B,aAAwC;;AAC9G,QAAA,EAAE,KAAK,WAAW,OAAO,gBAAgB,MAAM,WAAW,aAAa;AAC7E,QAAM,cAAc,UAAU,CAAC,WAAW,WAAW,CAAC;AAEtD,MAAI,WAAW,MAAM;AAEjB,MAAA,MAAM,eAAe,MAAM,QAAQ,KAAK,SAAO,WAA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WAAU;AAAA,QACV,MAAK;AAAA,QACL,SAAS,QAAQ;AAAA,MAAA;AAAA,IAEzB,CAAA;AAAA,EAAA,CAER;AAER,CAAC;AAoBM,MAAM,SAAS,MAAM,WAAqC,SAASA,QAAO,OAAO,KAAK;AACnF,QAAA,EAAE,QAAQ,UAAU,cAAc,MAAM,SAAS,GAAG,eAAe;AACzE,QAAM,UAAU,MAAM,QAAQ,OAAO,EAAE,SAAS,OAAO,YAAY,IAAI,IAAI,CAAC,SAAS,UAAU,CAAC;AAGhG,QAAM,CAAC,MAAM,OAAO,IAAI,MAAM,SAAS,KAAK;AAC5C,QAAM,UAAU,MAAM;AAClB,QAAI,aAAa;AACb,cAAQ,WAAW;AAAA,IAAA;AAAA,EAE3B,GAAG,EAAE;AAGD,SAAA,sBAAA,cAAC,cAAc,UAAd,EAAuB,OAAO,QAC3B,GAAA,sBAAA,cAAC,iBAAiB,MAAjB,EAAsB,KAAK,OAAO,IAAI,GAAG,aAAa,KAClD,GAAA,8CAAW,QAAQ,MAAA,MAAO,GAC1B,QACL,CACJ;AAER,CAAC;AACD,OAAO,SAAS;AAChB,OAAO,UAAU;AACjB,OAAO,QAAQ;"}
1
+ {"version":3,"file":"Hanger.js","sources":["../../../src/components/Hanger/Hanger.tsx"],"sourcesContent":["import * as React from 'react';\nimport cn from 'clsx';\nimport { Popover as PopoverPrimitive } from '@base-ui/react/popover';\n\nimport { IconButton } from '../IconButton/IconButton';\nimport { Placement } from '../..';\nimport { UnstyledArrow } from './Arrow';\nimport { useLocalization } from '../Provider/Localization';\nimport { mergeRefs } from '../../utils/mergeRefs';\nimport './Hanger.css';\n\ntype HangerContextValue = {\n /** Handler called when hanger closes by user interaction */\n onClose?: () => void;\n anchorRef: React.RefObject<HTMLElement>;\n};\nconst HangerContext = React.createContext<HangerContextValue>({\n anchorRef: { current: null },\n onClose: undefined,\n});\n\nexport type HangerTexts = {\n /** Aria-label for the close icon button of hanger */\n close: string;\n};\n\nexport type HangerAnchorProps = React.HTMLAttributes<HTMLElement>;\n// Passthrough the surrounding Hanger root owns the single DOM wrapper that serves as the anchor.\n// `Hanger.Anchor` remains in the JSX API for backward compatibility and to signal intent.\nconst Anchor = React.forwardRef<HTMLElement, HangerAnchorProps>(function HangerAnchor(props) {\n return <>{props.children}</>;\n});\n\nexport type HangerTitleProps = React.HTMLAttributes<HTMLHeadingElement>;\nexport const Title = React.forwardRef(function DialogTitle(props: HangerTitleProps, ref: React.Ref<HTMLHeadingElement>) {\n const className = cn('mb-1 text-base font-bold flex w-full', props.className);\n return <span {...props} className={className} ref={ref} />;\n});\n\nexport type HangerContentProps = React.HTMLAttributes<HTMLDivElement> & {\n /** Set the position of the Hanger relative to its achor. Default value is `bottom` */\n placement?: Placement;\n hideWhenDetached?: boolean;\n container?: HTMLElement | null;\n};\n\nconst Content = React.forwardRef(function HangerContent(props: HangerContentProps, ref: React.Ref<HTMLDivElement>) {\n const { placement: side, hideWhenDetached = false, container, ...popoverContentProps } = props;\n const context = React.useContext(HangerContext);\n const { texts } = useLocalization();\n const className = cn(\n 'wcag-blue-500 border border-transparent rounded p-3 pr-12 yt-shadow focus:border-transparent max-w-sm print:hidden',\n props.className\n );\n\n return (\n <PopoverPrimitive.Portal container={container}>\n <PopoverPrimitive.Positioner\n anchor={context.anchorRef}\n className={hideWhenDetached ? 'data-[anchor-hidden]:hidden' : undefined}\n side={side}\n sideOffset={11}>\n <PopoverPrimitive.Popup {...popoverContentProps} className={className} data-taco=\"hanger\" ref={ref}>\n {props.children}\n <UnstyledArrow className=\"text-blue-500\" />\n <PopoverPrimitive.Close\n render={\n <IconButton\n appearance=\"primary\"\n aria-label={texts.hanger.close}\n className=\"absolute right-0 top-0 mx-2 mt-2 text-white\"\n icon=\"close\"\n onClick={context.onClose}\n />\n }\n />\n </PopoverPrimitive.Popup>\n </PopoverPrimitive.Positioner>\n </PopoverPrimitive.Portal>\n );\n});\n\nexport type HangerProps = React.PropsWithChildren<{\n /** An anchor to be used for the hanger, should not be set if `children` already contains an anchor */\n anchor?: JSX.Element;\n /**\n * Shows or hides hanger depending on the value\n * @defaultValue true\n */\n defaultOpen?: boolean;\n /** Handler called when user closes the hanger */\n onClose?: () => void;\n}>;\n\nexport type ForwardedHangerWithStatics = React.ForwardRefExoticComponent<HangerProps & React.RefAttributes<HTMLElement>> & {\n Anchor: React.ForwardRefExoticComponent<HangerAnchorProps>;\n Content: React.ForwardRefExoticComponent<HangerContentProps>;\n Title: React.ForwardRefExoticComponent<HangerTitleProps>;\n};\n\nexport const Hanger = React.forwardRef<HTMLSpanElement, HangerProps>(function Hanger(props, ref) {\n const { anchor, children, defaultOpen = true, onClose, ...otherProps } = props;\n const anchorRef = React.useRef<HTMLElement>(null);\n const combinedRef = mergeRefs([anchorRef as React.MutableRefObject<HTMLElement | null>, ref]);\n const context = React.useMemo(() => ({ anchorRef, onClose }), [onClose]);\n\n // we do this to ensure hangers are mounted after their containers, e.g. if the container is another portal\n const [open, setOpen] = React.useState(false);\n React.useEffect(() => {\n if (defaultOpen) {\n setOpen(defaultOpen);\n }\n }, []);\n\n // Hanger should only close from its close button, matching the previous Radix onInteractOutside behavior.\n const handleOpenChange = (nextOpen: boolean, eventDetails: PopoverPrimitive.Root.ChangeEventDetails) => {\n if (!nextOpen && (eventDetails.reason === 'outside-press' || eventDetails.reason === 'focus-out')) {\n eventDetails.cancel();\n return;\n }\n\n setOpen(nextOpen);\n };\n\n // Single inline <span> wrapper: serves as the Floating UI anchor (its rect matches the\n // in-flow trigger child) and contains the FloatingFocusManager guard spans Base UI injects\n // when open, so they aren't siblings of the Hanger in parent IntersectionObservers\n // (e.g. OverflowGroup's) and don't get counted as overflowed children.\n return (\n <HangerContext.Provider value={context}>\n <span {...otherProps} ref={combinedRef as React.Ref<HTMLSpanElement>}>\n <PopoverPrimitive.Root open={open} onOpenChange={handleOpenChange}>\n {/* Anchor via the `anchor` prop. */}\n {anchor}\n {/* Composition (<Hanger.Anchor>) and the popup Content (portaled out) come through {children}. */}\n {children}\n </PopoverPrimitive.Root>\n </span>\n </HangerContext.Provider>\n );\n}) as ForwardedHangerWithStatics;\nHanger.Anchor = Anchor;\nHanger.Content = Content;\nHanger.Title = Title;\n"],"names":["PopoverPrimitive","Hanger"],"mappings":";;;;;;;;AAgBA,MAAM,gBAAgB,MAAM,cAAkC;AAAA,EAC1D,WAAW,EAAE,SAAS,KAAK;AAAA,EAC3B,SAAS;AACb,CAAC;AAUD,MAAM,SAAS,MAAM,WAA2C,SAAS,aAAa,OAAO;AAClF,SAAA,sBAAA,cAAA,MAAA,UAAA,MAAG,MAAM,QAAS;AAC7B,CAAC;AAGM,MAAM,QAAQ,MAAM,WAAW,SAAS,YAAY,OAAyB,KAAoC;AACpH,QAAM,YAAY,GAAG,wCAAwC,MAAM,SAAS;AAC5E,SAAQ,sBAAA,cAAA,QAAA,EAAM,GAAG,OAAO,WAAsB,KAAU;AAC5D,CAAC;AASD,MAAM,UAAU,MAAM,WAAW,SAAS,cAAc,OAA2B,KAAgC;AACzG,QAAA,EAAE,WAAW,MAAM,mBAAmB,OAAO,WAAW,GAAG,wBAAwB;AACnF,QAAA,UAAU,MAAM,WAAW,aAAa;AACxC,QAAA,EAAE,MAAM,IAAI,gBAAgB;AAClC,QAAM,YAAY;AAAA,IACd;AAAA,IACA,MAAM;AAAA,EACV;AAEA,SACK,sBAAA,cAAAA,QAAiB,QAAjB,EAAwB,UACrB,GAAA,sBAAA;AAAA,IAACA,QAAiB;AAAA,IAAjB;AAAA,MACG,QAAQ,QAAQ;AAAA,MAChB,WAAW,mBAAmB,gCAAgC;AAAA,MAC9D;AAAA,MACA,YAAY;AAAA,IAAA;AAAA,wCACXA,QAAiB,OAAjB,EAAwB,GAAG,qBAAqB,WAAsB,aAAU,UAAS,IAAA,GACrF,MAAM,UACP,sBAAA,cAAC,eAAc,EAAA,WAAU,iBAAgB,GACzC,sBAAA;AAAA,MAACA,QAAiB;AAAA,MAAjB;AAAA,QACG,QACI,sBAAA;AAAA,UAAC;AAAA,UAAA;AAAA,YACG,YAAW;AAAA,YACX,cAAY,MAAM,OAAO;AAAA,YACzB,WAAU;AAAA,YACV,MAAK;AAAA,YACL,SAAS,QAAQ;AAAA,UAAA;AAAA,QAAA;AAAA,MACrB;AAAA,IAGZ,CAAA;AAAA,EAAA,CAER;AAER,CAAC;AAoBM,MAAM,SAAS,MAAM,WAAyC,SAASC,QAAO,OAAO,KAAK;AACvF,QAAA,EAAE,QAAQ,UAAU,cAAc,MAAM,SAAS,GAAG,eAAe;AACnE,QAAA,YAAY,MAAM,OAAoB,IAAI;AAChD,QAAM,cAAc,UAAU,CAAC,WAAyD,GAAG,CAAC;AACtF,QAAA,UAAU,MAAM,QAAQ,OAAO,EAAE,WAAW,QAAQ,IAAI,CAAC,OAAO,CAAC;AAGvE,QAAM,CAAC,MAAM,OAAO,IAAI,MAAM,SAAS,KAAK;AAC5C,QAAM,UAAU,MAAM;AAClB,QAAI,aAAa;AACb,cAAQ,WAAW;AAAA,IAAA;AAAA,EAE3B,GAAG,EAAE;AAGC,QAAA,mBAAmB,CAAC,UAAmB,iBAA2D;AACpG,QAAI,CAAC,aAAa,aAAa,WAAW,mBAAmB,aAAa,WAAW,cAAc;AAC/F,mBAAa,OAAO;AACpB;AAAA,IAAA;AAGJ,YAAQ,QAAQ;AAAA,EACpB;AAOI,SAAA,sBAAA,cAAC,cAAc,UAAd,EAAuB,OAAO,QAC3B,GAAA,sBAAA,cAAC,QAAM,EAAA,GAAG,YAAY,KAAK,eACtB,sBAAA,cAAAD,QAAiB,MAAjB,EAAsB,MAAY,cAAc,iBAE5C,GAAA,QAEA,QACL,CACJ,CACJ;AAER,CAAC;AACD,OAAO,SAAS;AAChB,OAAO,UAAU;AACjB,OAAO,QAAQ;"}
@@ -1 +1 @@
1
- {"version":3,"file":"Link.cjs","sources":["../../../../src/components/Header/components/Link.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'clsx';\nimport { Icon, IconName } from '../../Icon/Icon';\nimport { Tooltip } from '../../Tooltip/Tooltip';\nimport { Badge } from '../../Badge/Badge';\nimport { useLocalization } from '../../Provider/Localization';\n\nexport type BaseLinkProps = React.AnchorHTMLAttributes<HTMLAnchorElement> & {\n tooltip?: string;\n};\n\ninterface LinkPropsWithoutIcon extends BaseLinkProps {\n children: JSX.Element | string;\n icon?: never;\n isNew?: never;\n}\n\ninterface LinkPropsWithIcon extends Omit<BaseLinkProps, 'aria-label'> {\n 'aria-label': string;\n children?: never;\n icon: IconName;\n isNew?: boolean;\n}\n\nexport type LinkProps = LinkPropsWithoutIcon | LinkPropsWithIcon;\n\nexport const Link = React.forwardRef<HTMLAnchorElement, LinkProps>(function Link(props, ref) {\n const { children, icon, isNew, tooltip, ...otherProps } = props;\n const { texts } = useLocalization();\n const className = cn(getLinkClasses(icon), 'relative', props.className);\n\n const link = (\n <a {...otherProps} className={className} data-taco=\"header-link\" ref={ref} tabIndex={0}>\n {icon ? <Icon name={icon} /> : null}\n {children}\n {isNew ? (\n <Badge\n color=\"blue\"\n small\n className=\"absolute right-0 top-0 -mr-2.5 -mt-1.5 !h-3 !px-0.5 text-[0.55rem] font-normal\">\n {texts.header.new}\n </Badge>\n ) : null}\n </a>\n );\n\n if (tooltip) {\n return <Tooltip title={tooltip}>{link}</Tooltip>;\n }\n\n return link;\n});\n\nexport const getLinkClasses = (icon: IconName | undefined = undefined) =>\n cn(\n 'flex h-8 flex-shrink-0 flex-grow-0 cursor-pointer items-center justify-center ',\n 'focus:!shadow-none focus:!outline-none focus-visible:!yt-focus-dark',\n 'bg-transparent hover:bg-white-subtle focus:bg-white-subtle aria-current-page:bg-white-subtle',\n '!text-white hover:text-white focus:text-white',\n {\n '!rounded-full !h-9 !w-9': icon,\n 'whitespace-nowrap px-3 rounded text-sm hidden lg:flex': !icon,\n }\n );\n"],"names":["Link","useLocalization","Icon","Badge","Tooltip"],"mappings":";;;;;;;;AA0BO,MAAM,OAAO,MAAM,WAAyC,SAASA,MAAK,OAAO,KAAK;AACzF,QAAM,EAAE,UAAU,MAAM,OAAO,SAAS,GAAG,eAAe;AACpD,QAAA,EAAE,MAAM,IAAIC,6BAAgB;AAClC,QAAM,YAAY,GAAG,eAAe,IAAI,GAAG,YAAY,MAAM,SAAS;AAEtE,QAAM,OACD,sBAAA,cAAA,KAAA,EAAG,GAAG,YAAY,WAAsB,aAAU,eAAc,KAAU,UAAU,KAChF,2CAAQC,KAAAA,MAAK,EAAA,MAAM,KAAM,CAAA,IAAK,MAC9B,UACA,QACG,sBAAA;AAAA,IAACC,MAAA;AAAA,IAAA;AAAA,MACG,OAAM;AAAA,MACN,OAAK;AAAA,MACL,WAAU;AAAA,IAAA;AAAA,IACT,MAAM,OAAO;AAAA,MAElB,IACR;AAGJ,MAAI,SAAS;AACT,WAAQ,sBAAA,cAAAC,QAAA,SAAA,EAAQ,OAAO,QAAA,GAAU,IAAK;AAAA,EAAA;AAGnC,SAAA;AACX,CAAC;AAEY,MAAA,iBAAiB,CAAC,OAA6B,WACxD;AAAA,EACI;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,IACI,2BAA2B;AAAA,IAC3B,yDAAyD,CAAC;AAAA,EAAA;AAElE;;;"}
1
+ {"version":3,"file":"Link.cjs","sources":["../../../../src/components/Header/components/Link.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'clsx';\nimport { Icon, IconName } from '../../Icon/Icon';\nimport { Tooltip } from '../../Tooltip/Tooltip';\nimport { Badge } from '../../Badge/Badge';\nimport { useLocalization } from '../../Provider/Localization';\n\nexport type BaseLinkProps = React.AnchorHTMLAttributes<HTMLAnchorElement> & {\n tooltip?: string;\n};\n\ninterface LinkPropsWithoutIcon extends BaseLinkProps {\n children: JSX.Element | string;\n icon?: never;\n isNew?: never;\n}\n\ninterface LinkPropsWithIcon extends Omit<BaseLinkProps, 'aria-label'> {\n 'aria-label': string;\n children?: never;\n icon: IconName;\n isNew?: boolean;\n}\n\nexport type LinkProps = LinkPropsWithoutIcon | LinkPropsWithIcon;\n\nexport const Link = React.forwardRef<HTMLAnchorElement, LinkProps>(function Link(props, ref) {\n const { children, icon, isNew, tooltip, ...otherProps } = props;\n const { texts } = useLocalization();\n const className = cn(getLinkClasses(icon), 'relative', props.className);\n\n const link = (\n <a {...otherProps} className={className} data-taco=\"header-link\" ref={ref} tabIndex={0}>\n {icon ? <Icon name={icon} /> : null}\n {children}\n {isNew ? (\n <Badge\n color=\"blue\"\n small\n // TODO: remove the text-[0.55rem] and replace with a taco approved font size\n // oxlint-disable-next-line class-rules/no-disallowed-color-classes\n className=\"absolute right-0 top-0 -mr-2.5 -mt-1.5 !h-3 !px-0.5 text-[0.55rem] font-normal\">\n {texts.header.new}\n </Badge>\n ) : null}\n </a>\n );\n\n if (tooltip) {\n return <Tooltip title={tooltip}>{link}</Tooltip>;\n }\n\n return link;\n});\n\nexport const getLinkClasses = (icon: IconName | undefined = undefined) =>\n cn(\n 'flex h-8 flex-shrink-0 flex-grow-0 cursor-pointer items-center justify-center ',\n 'focus:!shadow-none focus:!outline-none focus-visible:!yt-focus-dark',\n 'bg-transparent hover:bg-white-subtle focus:bg-white-subtle aria-current-page:bg-white-subtle',\n '!text-white hover:text-white focus:text-white',\n {\n '!rounded-full !h-9 !w-9': icon,\n 'whitespace-nowrap px-3 rounded text-sm hidden lg:flex': !icon,\n }\n );\n"],"names":["Link","useLocalization","Icon","Badge","Tooltip"],"mappings":";;;;;;;;AA0BO,MAAM,OAAO,MAAM,WAAyC,SAASA,MAAK,OAAO,KAAK;AACzF,QAAM,EAAE,UAAU,MAAM,OAAO,SAAS,GAAG,eAAe;AACpD,QAAA,EAAE,MAAM,IAAIC,6BAAgB;AAClC,QAAM,YAAY,GAAG,eAAe,IAAI,GAAG,YAAY,MAAM,SAAS;AAEtE,QAAM,OACD,sBAAA,cAAA,KAAA,EAAG,GAAG,YAAY,WAAsB,aAAU,eAAc,KAAU,UAAU,KAChF,2CAAQC,KAAAA,MAAK,EAAA,MAAM,KAAM,CAAA,IAAK,MAC9B,UACA,QACG,sBAAA;AAAA,IAACC,MAAA;AAAA,IAAA;AAAA,MACG,OAAM;AAAA,MACN,OAAK;AAAA,MAGL,WAAU;AAAA,IAAA;AAAA,IACT,MAAM,OAAO;AAAA,MAElB,IACR;AAGJ,MAAI,SAAS;AACT,WAAQ,sBAAA,cAAAC,QAAA,SAAA,EAAQ,OAAO,QAAA,GAAU,IAAK;AAAA,EAAA;AAGnC,SAAA;AACX,CAAC;AAEY,MAAA,iBAAiB,CAAC,OAA6B,WACxD;AAAA,EACI;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,IACI,2BAA2B;AAAA,IAC3B,yDAAyD,CAAC;AAAA,EAAA;AAElE;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"Link.js","sources":["../../../../src/components/Header/components/Link.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'clsx';\nimport { Icon, IconName } from '../../Icon/Icon';\nimport { Tooltip } from '../../Tooltip/Tooltip';\nimport { Badge } from '../../Badge/Badge';\nimport { useLocalization } from '../../Provider/Localization';\n\nexport type BaseLinkProps = React.AnchorHTMLAttributes<HTMLAnchorElement> & {\n tooltip?: string;\n};\n\ninterface LinkPropsWithoutIcon extends BaseLinkProps {\n children: JSX.Element | string;\n icon?: never;\n isNew?: never;\n}\n\ninterface LinkPropsWithIcon extends Omit<BaseLinkProps, 'aria-label'> {\n 'aria-label': string;\n children?: never;\n icon: IconName;\n isNew?: boolean;\n}\n\nexport type LinkProps = LinkPropsWithoutIcon | LinkPropsWithIcon;\n\nexport const Link = React.forwardRef<HTMLAnchorElement, LinkProps>(function Link(props, ref) {\n const { children, icon, isNew, tooltip, ...otherProps } = props;\n const { texts } = useLocalization();\n const className = cn(getLinkClasses(icon), 'relative', props.className);\n\n const link = (\n <a {...otherProps} className={className} data-taco=\"header-link\" ref={ref} tabIndex={0}>\n {icon ? <Icon name={icon} /> : null}\n {children}\n {isNew ? (\n <Badge\n color=\"blue\"\n small\n className=\"absolute right-0 top-0 -mr-2.5 -mt-1.5 !h-3 !px-0.5 text-[0.55rem] font-normal\">\n {texts.header.new}\n </Badge>\n ) : null}\n </a>\n );\n\n if (tooltip) {\n return <Tooltip title={tooltip}>{link}</Tooltip>;\n }\n\n return link;\n});\n\nexport const getLinkClasses = (icon: IconName | undefined = undefined) =>\n cn(\n 'flex h-8 flex-shrink-0 flex-grow-0 cursor-pointer items-center justify-center ',\n 'focus:!shadow-none focus:!outline-none focus-visible:!yt-focus-dark',\n 'bg-transparent hover:bg-white-subtle focus:bg-white-subtle aria-current-page:bg-white-subtle',\n '!text-white hover:text-white focus:text-white',\n {\n '!rounded-full !h-9 !w-9': icon,\n 'whitespace-nowrap px-3 rounded text-sm hidden lg:flex': !icon,\n }\n );\n"],"names":["React","Link"],"mappings":";;;;;;AA0BO,MAAM,OAAOA,eAAM,WAAyC,SAASC,MAAK,OAAO,KAAK;AACzF,QAAM,EAAE,UAAU,MAAM,OAAO,SAAS,GAAG,eAAe;AACpD,QAAA,EAAE,MAAM,IAAI,gBAAgB;AAClC,QAAM,YAAY,GAAG,eAAe,IAAI,GAAG,YAAY,MAAM,SAAS;AAEtE,QAAM,OACDD,+BAAA,cAAA,KAAA,EAAG,GAAG,YAAY,WAAsB,aAAU,eAAc,KAAU,UAAU,KAChF,oDAAQ,MAAK,EAAA,MAAM,KAAM,CAAA,IAAK,MAC9B,UACA,QACGA,+BAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACG,OAAM;AAAA,MACN,OAAK;AAAA,MACL,WAAU;AAAA,IAAA;AAAA,IACT,MAAM,OAAO;AAAA,MAElB,IACR;AAGJ,MAAI,SAAS;AACT,WAAQA,+BAAA,cAAA,SAAA,EAAQ,OAAO,QAAA,GAAU,IAAK;AAAA,EAAA;AAGnC,SAAA;AACX,CAAC;AAEY,MAAA,iBAAiB,CAAC,OAA6B,WACxD;AAAA,EACI;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,IACI,2BAA2B;AAAA,IAC3B,yDAAyD,CAAC;AAAA,EAAA;AAElE;"}
1
+ {"version":3,"file":"Link.js","sources":["../../../../src/components/Header/components/Link.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'clsx';\nimport { Icon, IconName } from '../../Icon/Icon';\nimport { Tooltip } from '../../Tooltip/Tooltip';\nimport { Badge } from '../../Badge/Badge';\nimport { useLocalization } from '../../Provider/Localization';\n\nexport type BaseLinkProps = React.AnchorHTMLAttributes<HTMLAnchorElement> & {\n tooltip?: string;\n};\n\ninterface LinkPropsWithoutIcon extends BaseLinkProps {\n children: JSX.Element | string;\n icon?: never;\n isNew?: never;\n}\n\ninterface LinkPropsWithIcon extends Omit<BaseLinkProps, 'aria-label'> {\n 'aria-label': string;\n children?: never;\n icon: IconName;\n isNew?: boolean;\n}\n\nexport type LinkProps = LinkPropsWithoutIcon | LinkPropsWithIcon;\n\nexport const Link = React.forwardRef<HTMLAnchorElement, LinkProps>(function Link(props, ref) {\n const { children, icon, isNew, tooltip, ...otherProps } = props;\n const { texts } = useLocalization();\n const className = cn(getLinkClasses(icon), 'relative', props.className);\n\n const link = (\n <a {...otherProps} className={className} data-taco=\"header-link\" ref={ref} tabIndex={0}>\n {icon ? <Icon name={icon} /> : null}\n {children}\n {isNew ? (\n <Badge\n color=\"blue\"\n small\n // TODO: remove the text-[0.55rem] and replace with a taco approved font size\n // oxlint-disable-next-line class-rules/no-disallowed-color-classes\n className=\"absolute right-0 top-0 -mr-2.5 -mt-1.5 !h-3 !px-0.5 text-[0.55rem] font-normal\">\n {texts.header.new}\n </Badge>\n ) : null}\n </a>\n );\n\n if (tooltip) {\n return <Tooltip title={tooltip}>{link}</Tooltip>;\n }\n\n return link;\n});\n\nexport const getLinkClasses = (icon: IconName | undefined = undefined) =>\n cn(\n 'flex h-8 flex-shrink-0 flex-grow-0 cursor-pointer items-center justify-center ',\n 'focus:!shadow-none focus:!outline-none focus-visible:!yt-focus-dark',\n 'bg-transparent hover:bg-white-subtle focus:bg-white-subtle aria-current-page:bg-white-subtle',\n '!text-white hover:text-white focus:text-white',\n {\n '!rounded-full !h-9 !w-9': icon,\n 'whitespace-nowrap px-3 rounded text-sm hidden lg:flex': !icon,\n }\n );\n"],"names":["React","Link"],"mappings":";;;;;;AA0BO,MAAM,OAAOA,eAAM,WAAyC,SAASC,MAAK,OAAO,KAAK;AACzF,QAAM,EAAE,UAAU,MAAM,OAAO,SAAS,GAAG,eAAe;AACpD,QAAA,EAAE,MAAM,IAAI,gBAAgB;AAClC,QAAM,YAAY,GAAG,eAAe,IAAI,GAAG,YAAY,MAAM,SAAS;AAEtE,QAAM,OACDD,+BAAA,cAAA,KAAA,EAAG,GAAG,YAAY,WAAsB,aAAU,eAAc,KAAU,UAAU,KAChF,oDAAQ,MAAK,EAAA,MAAM,KAAM,CAAA,IAAK,MAC9B,UACA,QACGA,+BAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACG,OAAM;AAAA,MACN,OAAK;AAAA,MAGL,WAAU;AAAA,IAAA;AAAA,IACT,MAAM,OAAO;AAAA,MAElB,IACR;AAGJ,MAAI,SAAS;AACT,WAAQA,+BAAA,cAAA,SAAA,EAAQ,OAAO,QAAA,GAAU,IAAK;AAAA,EAAA;AAGnC,SAAA;AACX,CAAC;AAEY,MAAA,iBAAiB,CAAC,OAA6B,WACxD;AAAA,EACI;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,IACI,2BAA2B;AAAA,IAC3B,yDAAyD,CAAC;AAAA,EAAA;AAElE;"}
@@ -58,10 +58,9 @@ const Content = React__namespace.forwardRef(function HoverCardContent(props, ref
58
58
  const className = cn(util.getPopoverStyleClassnames(), "min-w-[theme(spacing.40)] max-w-[theme(spacing.96)]", props.className);
59
59
  return /* @__PURE__ */ React__namespace.createElement(previewCard.PreviewCard.Portal, null, /* @__PURE__ */ React__namespace.createElement(previewCard.PreviewCard.Positioner, { side, sideOffset: 12 }, /* @__PURE__ */ React__namespace.createElement(previewCard.PreviewCard.Popup, { className, "data-taco": "hover-card", ref }, props.children, /* @__PURE__ */ React__namespace.createElement(Arrow, null))));
60
60
  });
61
- const HoverCard = (props) => {
62
- return /* @__PURE__ */ React__namespace.createElement(previewCard.PreviewCard.Root, { ...props });
63
- };
64
- HoverCard.Trigger = Trigger;
65
- HoverCard.Content = Content;
61
+ const HoverCard = Object.assign((props) => /* @__PURE__ */ React__namespace.createElement(previewCard.PreviewCard.Root, { ...props }), {
62
+ Trigger,
63
+ Content
64
+ });
66
65
  exports.HoverCard = HoverCard;
67
66
  //# sourceMappingURL=HoverCard.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"HoverCard.cjs","sources":["../../../src/components/HoverCard/HoverCard.tsx"],"sourcesContent":["import * as React from 'react';\nimport cn from 'clsx';\nimport { PreviewCard as PreviewCardPrimitive } from '@base-ui/react/preview-card';\n\nimport { Placement } from '../..';\nimport { getPopoverStyleClassnames } from '../Popover/util';\n\nconst Arrow = () => (\n <PreviewCardPrimitive.Arrow className=\"data-[side=bottom]:top-[-8px] data-[side=left]:right-[-13px] data-[side=right]:left-[-13px] data-[side=top]:bottom-[-8px] data-[side=left]:rotate-90 data-[side=right]:-rotate-90 data-[side=top]:rotate-180\">\n <svg width=\"20\" height=\"10\" viewBox=\"0 0 20 10\" fill=\"none\">\n <path\n d=\"M9.66437 2.60207L4.80758 6.97318C4.07308 7.63423 3.11989 8 2.13172 8H0V10H20V8H18.5349C17.5468 8 16.5936 7.63423 15.8591 6.97318L11.0023 2.60207C10.622 2.2598 10.0447 2.25979 9.66437 2.60207Z\"\n className=\"fill-[canvas]\"\n />\n <path\n d=\"M8.99542 1.85876C9.75604 1.17425 10.9106 1.17422 11.6713 1.85878L16.5281 6.22989C17.0789 6.72568 17.7938 7.00001 18.5349 7.00001L15.89 7L11.0023 2.60207C10.622 2.2598 10.0447 2.2598 9.66436 2.60207L4.77734 7L2.13171 7.00001C2.87284 7.00001 3.58774 6.72568 4.13861 6.22989L8.99542 1.85876Z\"\n className=\"fill-gray-100 dark:fill-none\"\n />\n <path\n d=\"M10.3333 3.34539L5.47654 7.71648C4.55842 8.54279 3.36693 9 2.13172 9H0V8H2.13172C3.11989 8 4.07308 7.63423 4.80758 6.97318L9.66437 2.60207C10.0447 2.25979 10.622 2.2598 11.0023 2.60207L15.8591 6.97318C16.5936 7.63423 17.5468 8 18.5349 8H20V9H18.5349C17.2998 9 16.1083 8.54278 15.1901 7.71648L10.3333 3.34539Z\"\n className=\"dark:fill-gray-100\"\n />\n </svg>\n </PreviewCardPrimitive.Arrow>\n);\n\n/**\n * @deprecated\n */\nexport type HoverCardTriggerProps = React.HTMLAttributes<HTMLAnchorElement> & { children: React.ReactElement };\nconst Trigger = React.forwardRef(function HoverCardTrigger(props: HoverCardTriggerProps, ref: React.Ref<HTMLAnchorElement>) {\n const { children, className, ...otherProps } = props;\n\n return (\n <PreviewCardPrimitive.Trigger\n {...otherProps}\n className={cn('text-black', className)}\n delay={300}\n ref={ref}\n render={children}\n />\n );\n});\n\n/**\n * @deprecated\n */\nexport type HoverCardContentProps = React.HTMLAttributes<HTMLDivElement> & {\n /** Set the position of the HoverCard relative to its trigger. Default value is `bottom` */\n placement?: Placement;\n};\nconst Content = React.forwardRef(function HoverCardContent(props: HoverCardContentProps, ref: React.Ref<HTMLDivElement>) {\n const { placement: side } = props;\n const className = cn(getPopoverStyleClassnames(), 'min-w-[theme(spacing.40)] max-w-[theme(spacing.96)]', props.className);\n\n return (\n <PreviewCardPrimitive.Portal>\n <PreviewCardPrimitive.Positioner side={side} sideOffset={12}>\n <PreviewCardPrimitive.Popup className={className} data-taco=\"hover-card\" ref={ref}>\n {props.children}\n <Arrow />\n </PreviewCardPrimitive.Popup>\n </PreviewCardPrimitive.Positioner>\n </PreviewCardPrimitive.Portal>\n );\n});\n\n/**\n * @deprecated\n */\nexport type HoverCardProps = React.PropsWithChildren<object>;\n\n/**\n * @deprecated\n */\nexport const HoverCard = (props: HoverCardProps) => {\n return <PreviewCardPrimitive.Root {...props} />;\n};\nHoverCard.Trigger = Tr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AAC;AAUY,MAAA,YAAY,CAAC,UAA0B;AAChD,SAAQA,iCAAA,cAAAC,YAAAA,YAAqB,MAArB,EAA2B,GAAG,OAAO;AACjD;AACA,UAAU,UAAU;AACpB,UAAU,UAAU;;"}
1
+ {"version":3,"file":"HoverCard.cjs","sources":["../../../src/components/HoverCard/HoverCard.tsx"],"sourcesContent":["import * as React from 'react';\nimport cn from 'clsx';\nimport { PreviewCard as PreviewCardPrimitive } from '@base-ui/react/preview-card';\n\nimport { Placement } from '../..';\nimport { getPopoverStyleClassnames } from '../Popover/util';\n\nconst Arrow = () => (\n <PreviewCardPrimitive.Arrow className=\"data-[side=bottom]:top-[-8px] data-[side=left]:right-[-13px] data-[side=right]:left-[-13px] data-[side=top]:bottom-[-8px] data-[side=left]:rotate-90 data-[side=right]:-rotate-90 data-[side=top]:rotate-180\">\n <svg width=\"20\" height=\"10\" viewBox=\"0 0 20 10\" fill=\"none\">\n <path\n d=\"M9.66437 2.60207L4.80758 6.97318C4.07308 7.63423 3.11989 8 2.13172 8H0V10H20V8H18.5349C17.5468 8 16.5936 7.63423 15.8591 6.97318L11.0023 2.60207C10.622 2.2598 10.0447 2.25979 9.66437 2.60207Z\"\n className=\"fill-[canvas]\"\n />\n <path\n d=\"M8.99542 1.85876C9.75604 1.17425 10.9106 1.17422 11.6713 1.85878L16.5281 6.22989C17.0789 6.72568 17.7938 7.00001 18.5349 7.00001L15.89 7L11.0023 2.60207C10.622 2.2598 10.0447 2.2598 9.66436 2.60207L4.77734 7L2.13171 7.00001C2.87284 7.00001 3.58774 6.72568 4.13861 6.22989L8.99542 1.85876Z\"\n className=\"fill-gray-100 dark:fill-none\"\n />\n <path\n d=\"M10.3333 3.34539L5.47654 7.71648C4.55842 8.54279 3.36693 9 2.13172 9H0V8H2.13172C3.11989 8 4.07308 7.63423 4.80758 6.97318L9.66437 2.60207C10.0447 2.25979 10.622 2.2598 11.0023 2.60207L15.8591 6.97318C16.5936 7.63423 17.5468 8 18.5349 8H20V9H18.5349C17.2998 9 16.1083 8.54278 15.1901 7.71648L10.3333 3.34539Z\"\n className=\"dark:fill-gray-100\"\n />\n </svg>\n </PreviewCardPrimitive.Arrow>\n);\n\n/**\n * @deprecated\n */\nexport type HoverCardTriggerProps = React.HTMLAttributes<HTMLAnchorElement> & { children: React.ReactElement };\nconst Trigger = React.forwardRef(function HoverCardTrigger(props: HoverCardTriggerProps, ref: React.Ref<HTMLAnchorElement>) {\n const { children, className, ...otherProps } = props;\n\n return (\n <PreviewCardPrimitive.Trigger\n {...otherProps}\n className={cn('text-black', className)}\n delay={300}\n ref={ref}\n render={children}\n />\n );\n});\n\n/**\n * @deprecated\n */\nexport type HoverCardContentProps = React.HTMLAttributes<HTMLDivElement> & {\n /** Set the position of the HoverCard relative to its trigger. Default value is `bottom` */\n placement?: Placement;\n};\nconst Content = React.forwardRef(function HoverCardContent(props: HoverCardContentProps, ref: React.Ref<HTMLDivElement>) {\n const { placement: side } = props;\n const className = cn(getPopoverStyleClassnames(), 'min-w-[theme(spacing.40)] max-w-[theme(spacing.96)]', props.className);\n\n return (\n <PreviewCardPrimitive.Portal>\n <PreviewCardPrimitive.Positioner side={side} sideOffset={12}>\n <PreviewCardPrimitive.Popup className={className} data-taco=\"hover-card\" ref={ref}>\n {props.children}\n <Arrow />\n </PreviewCardPrimitive.Popup>\n </PreviewCardPrimitive.Positioner>\n </PreviewCardPrimitive.Portal>\n );\n});\n\n/**\n * @deprecated\n */\nexport type HoverCardProps = React.PropsWithChildren<object>;\n\n/**\n * @deprecated\n */\nexport const HoverCard = Object.assign((props: HoverCardProps) => <PreviewCardPrimitive.Root {...props} />, {\n Trigger,\n Content,\n});\n"],"names":["React","PreviewCardPrimitive","getPopoverStyleClassnames"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAOA,MAAM,QAAQ,MACVA,iCAAA,cAACC,YAAqB,YAAA,OAArB,EAA2B,WAAU,kNACjCD,iCAAA,cAAA,OAAA,EAAI,OAAM,MAAK,QAAO,MAAK,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ated
22
22
  */
23
- export declare const HoverCard: {
24
- (props: HoverCardProps): React.JSX.Element;
23
+ export declare const HoverCard: ((props: HoverCardProps) => React.JSX.Element) & {
25
24
  Trigger: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLAnchorElement> & {
26
25
  children: React.ReactElement;
27
26
  } & React.RefAttributes<HTMLAnchorElement>>;
@@ -39,11 +39,10 @@ const Content = React.forwardRef(function HoverCardContent(props, ref) {
39
39
  const className = cn(getPopoverStyleClassnames(), "min-w-[theme(spacing.40)] max-w-[theme(spacing.96)]", props.className);
40
40
  return /* @__PURE__ */ React.createElement(PreviewCard.Portal, null, /* @__PURE__ */ React.createElement(PreviewCard.Positioner, { side, sideOffset: 12 }, /* @__PURE__ */ React.createElement(PreviewCard.Popup, { className, "data-taco": "hover-card", ref }, props.children, /* @__PURE__ */ React.createElement(Arrow, null))));
41
41
  });
42
- const HoverCard = (props) => {
43
- return /* @__PURE__ */ React.createElement(PreviewCard.Root, { ...props });
44
- };
45
- HoverCard.Trigger = Trigger;
46
- HoverCard.Content = Content;
42
+ const HoverCard = Object.assign((props) => /* @__PURE__ */ React.createElement(PreviewCard.Root, { ...props }), {
43
+ Trigger,
44
+ Content
45
+ });
47
46
  export {
48
47
  HoverCard
49
48
  };
@@ -1 +1 @@
1
- {"version":3,"file":"HoverCard.js","sources":["../../../src/components/HoverCard/HoverCard.tsx"],"sourcesContent":["import * as React from 'react';\nimport cn from 'clsx';\nimport { PreviewCard as PreviewCardPrimitive } from '@base-ui/react/preview-card';\n\nimport { Placement } from '../..';\nimport { getPopoverStyleClassnames } from '../Popover/util';\n\nconst Arrow = () => (\n <PreviewCardPrimitive.Arrow className=\"data-[side=bottom]:top-[-8px] data-[side=left]:right-[-13px] data-[side=right]:left-[-13px] data-[side=top]:bottom-[-8px] data-[side=left]:rotate-90 data-[side=right]:-rotate-90 data-[side=top]:rotate-180\">\n <svg width=\"20\" height=\"10\" viewBox=\"0 0 20 10\" fill=\"none\">\n <path\n d=\"M9.66437 2.60207L4.80758 6.97318C4.07308 7.63423 3.11989 8 2.13172 8H0V10H20V8H18.5349C17.5468 8 16.5936 7.63423 15.8591 6.97318L11.0023 2.60207C10.622 2.2598 10.0447 2.25979 9.66437 2.60207Z\"\n className=\"fill-[canvas]\"\n />\n <path\n d=\"M8.99542 1.85876C9.75604 1.17425 10.9106 1.17422 11.6713 1.85878L16.5281 6.22989C17.0789 6.72568 17.7938 7.00001 18.5349 7.00001L15.89 7L11.0023 2.60207C10.622 2.2598 10.0447 2.2598 9.66436 2.60207L4.77734 7L2.13171 7.00001C2.87284 7.00001 3.58774 6.72568 4.13861 6.22989L8.99542 1.85876Z\"\n className=\"fill-gray-100 dark:fill-none\"\n />\n <path\n d=\"M10.3333 3.34539L5.47654 7.71648C4.55842 8.54279 3.36693 9 2.13172 9H0V8H2.13172C3.11989 8 4.07308 7.63423 4.80758 6.97318L9.66437 2.60207C10.0447 2.25979 10.622 2.2598 11.0023 2.60207L15.8591 6.97318C16.5936 7.63423 17.5468 8 18.5349 8H20V9H18.5349C17.2998 9 16.1083 8.54278 15.1901 7.71648L10.3333 3.34539Z\"\n className=\"dark:fill-gray-100\"\n />\n </svg>\n </PreviewCardPrimitive.Arrow>\n);\n\n/**\n * @deprecated\n */\nexport type HoverCardTriggerProps = React.HTMLAttributes<HTMLAnchorElement> & { children: React.ReactElement };\nconst Trigger = React.forwardRef(function HoverCardTrigger(props: HoverCardTriggerProps, ref: React.Ref<HTMLAnchorElement>) {\n const { children, className, ...otherProps } = props;\n\n return (\n <PreviewCardPrimitive.Trigger\n {...otherProps}\n className={cn('text-black', className)}\n delay={300}\n ref={ref}\n render={children}\n />\n );\n});\n\n/**\n * @deprecated\n */\nexport type HoverCardContentProps = React.HTMLAttributes<HTMLDivElement> & {\n /** Set the position of the HoverCard relative to its trigger. Default value is `bottom` */\n placement?: Placement;\n};\nconst Content = React.forwardRef(function HoverCardContent(props: HoverCardContentProps, ref: React.Ref<HTMLDivElement>) {\n const { placement: side } = props;\n const className = cn(getPopoverStyleClassnames(), 'min-w-[theme(spacing.40)] max-w-[theme(spacing.96)]', props.className);\n\n return (\n <PreviewCardPrimitive.Portal>\n <PreviewCardPrimitive.Positioner side={side} sideOffset={12}>\n <PreviewCardPrimitive.Popup className={className} data-taco=\"hover-card\" ref={ref}>\n {props.children}\n <Arrow />\n </PreviewCardPrimitive.Popup>\n </PreviewCardPrimitive.Positioner>\n </PreviewCardPrimitive.Portal>\n );\n});\n\n/**\n * @deprecated\n */\nexport type HoverCardProps = React.PropsWithChildren<object>;\n\n/**\n * @deprecated\n */\nexport const HoverCard = (props: HoverCardProps) => {\n return <PreviewCardPrimitive.Root {...props} />;\n};\nHoverCard.Trigger = Trigger;\nHoverCard.Content = Content;\n"],"names":["PreviewCardPrimitive"],"mappings":";;;;AAOA,MAAM,QAAQ,MACV,sBAAA,cAACA,YAAqB,OAArB,EAA2B,WAAU,kNACjC,sBAAA,cAAA,OAAA,EAAI,OAAM,MAAK,QAAO,MAAK,SAAQ,aAAY,MAAK,UACjD,sBAAA;AAAA,EAAC;AAAA,EAAA;AAAA,IACG,GAAE;AAAA,IACF,WAAU;AAAA,EAAA;AACd,GACA,sBAAA;AAAA,EAAC;AAAA,EAAA;AAAA,IACG,GAAE;AAAA,IACF,WAAU;AAAA,EAAA;AACd,GACA,sBAAA;AAAA,EAAC;AAAA,EAAA;AAAA,IACG,GAAE;AAAA,IACF,WAAU;AAAA,EAAA;AACd,CACJ,CACJ;AAOJ,MAAM,UAAU,MAAM,WAAW,SAAS,iBAAiB,OAA8B,KAAmC;AACxH,QAAM,EAAE,UAAU,WAAW,GAAG,WAAe,IAAA;AAG3C,SAAA,sBAAA;AAAA,IAACA,YAAqB;AAAA,IAArB;AAAA,MACI,GAAG;AAAA,MACJ,WAAW,GAAG,cAAc,SAAS;AAAA,MACrC,OAAO;AAAA,MACP;AAAA,MACA,QAAQ;AAAA,IAAA;AAAA,EACZ;AAER,CAAC;AASD,MAAM,UAAU,MAAM,WAAW,SAAS,iBAAiB,OAA8B,KAAgC;AAC/G,QAAA,EAAE,WAAW,KAAA,IAAS;AAC5B,QAAM,YAAY,GAAG,0BAA6B,GAAA,uDAAuD,MAAM,SAAS;AAGpH,SAAA,sBAAA,cAACA,YAAqB,QAArB,MACG,sBAAA,cAACA,YAAqB,YAArB,EAAgC,MAAY,YAAY,GACrD,GAAA,sBAAA,cAACA,YAAqB,OAArB,EAA2B,WAAsB,aAAU,cAAa,IAAA,GACpE,MAAM,UACN,sBAAA,cAAA,OAAA,IAAM,CACX,CACJ,CACJ;AAER,CAAC;AAUY,MAAA,YAAY,CAAC,UAA0B;AAChD,SAAQ,sBAAA,cAAAA,YAAqB,MAArB,EAA2B,GAAG,OAAO;AACjD;AACA,UAAU,UAAU;AACpB,UAAU,UAAU;"}
1
+ {"version":3,"file":"HoverCard.js","sources":["../../../src/components/HoverCard/HoverCard.tsx"],"sourcesContent":["import * as React from 'react';\nimport cn from 'clsx';\nimport { PreviewCard as PreviewCardPrimitive } from '@base-ui/react/preview-card';\n\nimport { Placement } from '../..';\nimport { getPopoverStyleClassnames } from '../Popover/util';\n\nconst Arrow = () => (\n <PreviewCardPrimitive.Arrow className=\"data-[side=bottom]:top-[-8px] data-[side=left]:right-[-13px] data-[side=right]:left-[-13px] data-[side=top]:bottom-[-8px] data-[side=left]:rotate-90 data-[side=right]:-rotate-90 data-[side=top]:rotate-180\">\n <svg width=\"20\" height=\"10\" viewBox=\"0 0 20 10\" fill=\"none\">\n <path\n d=\"M9.66437 2.60207L4.80758 6.97318C4.07308 7.63423 3.11989 8 2.13172 8H0V10H20V8H18.5349C17.5468 8 16.5936 7.63423 15.8591 6.97318L11.0023 2.60207C10.622 2.2598 10.0447 2.25979 9.66437 2.60207Z\"\n className=\"fill-[canvas]\"\n />\n <path\n d=\"M8.99542 1.85876C9.75604 1.17425 10.9106 1.17422 11.6713 1.85878L16.5281 6.22989C17.0789 6.72568 17.7938 7.00001 18.5349 7.00001L15.89 7L11.0023 2.60207C10.622 2.2598 10.0447 2.2598 9.66436 2.60207L4.77734 7L2.13171 7.00001C2.87284 7.00001 3.58774 6.72568 4.13861 6.22989L8.99542 1.85876Z\"\n className=\"fill-gray-100 dark:fill-none\"\n />\n <path\n d=\"M10.3333 3.34539L5.47654 7.71648C4.55842 8.54279 3.36693 9 2.13172 9H0V8H2.13172C3.11989 8 4.07308 7.63423 4.80758 6.97318L9.66437 2.60207C10.0447 2.25979 10.622 2.2598 11.0023 2.60207L15.8591 6.97318C16.5936 7.63423 17.5468 8 18.5349 8H20V9H18.5349C17.2998 9 16.1083 8.54278 15.1901 7.71648L10.3333 3.34539Z\"\n className=\"dark:fill-gray-100\"\n />\n </svg>\n </PreviewCardPrimitive.Arrow>\n);\n\n/**\n * @deprecated\n */\nexport type HoverCardTriggerProps = React.HTMLAttributes<HTMLAnchorElement> & { children: React.ReactElement };\nconst Trigger = React.forwardRef(function HoverCardTrigger(props: HoverCardTriggerProps, ref: React.Ref<HTMLAnchorElement>) {\n const { children, className, ...otherProps } = props;\n\n return (\n <PreviewCardPrimitive.Trigger\n {...otherProps}\n className={cn('text-black', className)}\n delay={300}\n ref={ref}\n render={children}\n />\n );\n});\n\n/**\n * @deprecated\n */\nexport type HoverCardContentProps = React.HTMLAttributes<HTMLDivElement> & {\n /** Set the position of the HoverCard relative to its trigger. Default value is `bottom` */\n placement?: Placement;\n};\nconst Content = React.forwardRef(function HoverCardContent(props: HoverCardContentProps, ref: React.Ref<HTMLDivElement>) {\n const { placement: side } = props;\n const className = cn(getPopoverStyleClassnames(), 'min-w-[theme(spacing.40)] max-w-[theme(spacing.96)]', props.className);\n\n return (\n <PreviewCardPrimitive.Portal>\n <PreviewCardPrimitive.Positioner side={side} sideOffset={12}>\n <PreviewCardPrimitive.Popup className={className} data-taco=\"hover-card\" ref={ref}>\n {props.children}\n <Arrow />\n </PreviewCardPrimitive.Popup>\n </PreviewCardPrimitive.Positioner>\n </PreviewCardPrimitive.Portal>\n );\n});\n\n/**\n * @deprecated\n */\nexport type HoverCardProps = React.PropsWithChildren<object>;\n\n/**\n * @deprecated\n */\nexport const HoverCard = Object.assign((props: HoverCardProps) => <PreviewCardPrimitive.Root {...props} />, {\n Trigger,\n Content,\n});\n"],"names":["PreviewCardPrimitive"],"mappings":";;;;AAOA,MAAM,QAAQ,MACV,sBAAA,cAACA,YAAqB,OAArB,EAA2B,WAAU,kNACjC,sBAAA,cAAA,OAAA,EAAI,OAAM,MAAK,QAAO,MAAK,SAAQ,aAAY,MAAK,UACjD,sBAAA;AAAA,EAAC;AAAA,EAAA;AAAA,IACG,GAAE;AAAA,IACF,WAAU;AAAA,EAAA;AACd,GACA,sBAAA;AAAA,EAAC;AAAA,EAAA;AAAA,IACG,GAAE;AAAA,IACF,WAAU;AAAA,EAAA;AACd,GACA,sBAAA;AAAA,EAAC;AAAA,EAAA;AAAA,IACG,GAAE;AAAA,IACF,WAAU;AAAA,EAAA;AACd,CACJ,CACJ;AAOJ,MAAM,UAAU,MAAM,WAAW,SAAS,iBAAiB,OAA8B,KAAmC;AACxH,QAAM,EAAE,UAAU,WAAW,GAAG,WAAe,IAAA;AAG3C,SAAA,sBAAA;AAAA,IAACA,YAAqB;AAAA,IAArB;AAAA,MACI,GAAG;AAAA,MACJ,WAAW,GAAG,cAAc,SAAS;AAAA,MACrC,OAAO;AAAA,MACP;AAAA,MACA,QAAQ;AAAA,IAAA;AAAA,EACZ;AAER,CAAC;AASD,MAAM,UAAU,MAAM,WAAW,SAAS,iBAAiB,OAA8B,KAAgC;AAC/G,QAAA,EAAE,WAAW,KAAA,IAAS;AAC5B,QAAM,YAAY,GAAG,0BAA6B,GAAA,uDAAuD,MAAM,SAAS;AAGpH,SAAA,sBAAA,cAACA,YAAqB,QAArB,MACG,sBAAA,cAACA,YAAqB,YAArB,EAAgC,MAAY,YAAY,GACrD,GAAA,sBAAA,cAACA,YAAqB,OAArB,EAA2B,WAAsB,aAAU,cAAa,IAAA,GACpE,MAAM,UACN,sBAAA,cAAA,OAAA,IAAM,CACX,CACJ,CACJ;AAER,CAAC;AAUY,MAAA,YAAY,OAAO,OAAO,CAAC,UAA2B,sBAAA,cAAAA,YAAqB,MAArB,EAA2B,GAAG,MAAO,CAAA,GAAI;AAAA,EACxG;AAAA,EACA;AACJ,CAAC;"}
@@ -16,8 +16,8 @@ const getInputClasses = (props) => {
16
16
  // disabled
17
17
  "text-opacity-25 cursor-not-allowed placeholder:text-gray-500": disabled,
18
18
  // highlighted
19
- "bg-yellow-50/25": props.highlighted && disabled,
20
- "bg-yellow-50/50": props.highlighted && !disabled,
19
+ "bg-yellow-50 placeholder:text-yellow-300": props.highlighted && disabled,
20
+ "bg-yellow-100 placeholder:text-yellow-500": props.highlighted && !disabled,
21
21
  // invalid
22
22
  "border-red-500 enabled:hover:border-red-500 disabled:border-red-300/50": invalid,
23
23
  // readOnly
@@ -1 +1 @@
1
- {"version":3,"file":"util.cjs","sources":["../../../src/components/Input/util.ts"],"sourcesContent":["import cn from 'clsx';\n\ntype InputClassesProps = Pick<\n React.InputHTMLAttributes<HTMLInputElement>,\n 'aria-disabled' | 'aria-readonly' | 'aria-invalid' | 'readOnly' | 'disabled'\n> & {\n invalid?: boolean;\n highlighted?: boolean;\n};\n\nexport const getInputClasses = (props: InputClassesProps) => {\n const disabled = props.disabled || !!props['aria-disabled'];\n const readOnly = props.readOnly || !!props['aria-readonly'];\n const invalid = props.invalid || !!props['aria-invalid'];\n\n return cn(\n 'peer text-black text-sm border font-normal not-italic no-underline rounded flex items-center leading-6 px-2 relative w-full text-ellipsis transition-colors transition-opacity ease-in min-h-[theme(spacing.8)] focus:yt-focus',\n // hide the arrow controls on input[type=number]\n '[appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none',\n {\n 'bg-white': !props.highlighted && !readOnly,\n // default\n 'border-gray-200 enabled:hover:border-gray-300 disabled:border-gray-100': !invalid,\n // disabled\n 'text-opacity-25 cursor-not-allowed placeholder:text-gray-500': disabled,\n // highlighted\n 'bg-yellow-50/25': props.highlighted && disabled,\n 'bg-yellow-50/50': props.highlighted && !disabled,\n // invalid\n 'border-red-500 enabled:hover:border-red-500 disabled:border-red-300/50': invalid,\n // readOnly\n 'cursor-not-allowed text-black bg-gray-50': readOnly,\n }\n );\n};\n\nexport const getButtonStateClasses = (invalid: boolean | undefined, disabled = false): string => {\n if (invalid) {\n return cn('border border-red-500 group-peer-hover:enabled:border-red-700 transition-colors ease-in', {\n 'border-red-500/30': disabled,\n });\n }\n\n return 'border border-gray-200 group-peer-hover:enabled:border-gray-300 transition-colors transition-opacity ease-in';\n};\n"],"names":[],"mappings":";;;AAUa,MAAA,kBAAkB,CAAC,UAA6B;AACzD,QAAM,WAAW,MAAM,YAAY,CAAC,CAAC,MAAM,eAAe;AAC1D,QAAM,WAAW,MAAM,YAAY,CAAC,CAAC,MAAM,eAAe;AAC1D,QAAM,UAAU,MAAM,WAAW,CAAC,CAAC,MAAM,cAAc;AAEhD,SAAA;AAAA,IACH;AAAA;AAAA,IAEA;AAAA,IACA;AAAA,MACI,YAAY,CAAC,MAAM,eAAe,CAAC;AAAA;AAAA,MAEnC,0EAA0E,CAAC;AAAA;AAAA,MAE3E,gEAAgE;AAAA;AAAA,MAEhE,mBAAmB,MAAM,eAAe;AAAA,MACxC,mBAAmB,MAAM,eAAe,CAAC;AAAA;AAAA,MAEzC,0EAA0E;AAAA;AAAA,MAE1E,4CAA4C;AAAA,IAAA;AAAA,EAEpD;AACJ;AAEO,MAAM,wBAAwB,CAAC,SAA8B,WAAW,UAAkB;AAC7F,MAAI,SAAS;AACT,WAAO,GAAG,2FAA2F;AAAA,MACjG,qBAAqB;AAAA,IAAA,CACxB;AAAA,EAAA;AAGE,SAAA;AACX;;;"}
1
+ {"version":3,"file":"util.cjs","sources":["../../../src/components/Input/util.ts"],"sourcesContent":["import cn from 'clsx';\n\ntype InputClassesProps = Pick<\n React.InputHTMLAttributes<HTMLInputElement>,\n 'aria-disabled' | 'aria-readonly' | 'aria-invalid' | 'readOnly' | 'disabled'\n> & {\n invalid?: boolean;\n highlighted?: boolean;\n};\n\nexport const getInputClasses = (props: InputClassesProps) => {\n const disabled = props.disabled || !!props['aria-disabled'];\n const readOnly = props.readOnly || !!props['aria-readonly'];\n const invalid = props.invalid || !!props['aria-invalid'];\n\n return cn(\n 'peer text-black text-sm border font-normal not-italic no-underline rounded flex items-center leading-6 px-2 relative w-full text-ellipsis transition-colors transition-opacity ease-in min-h-[theme(spacing.8)] focus:yt-focus',\n // hide the arrow controls on input[type=number]\n '[appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none',\n {\n 'bg-white': !props.highlighted && !readOnly,\n // default\n 'border-gray-200 enabled:hover:border-gray-300 disabled:border-gray-100': !invalid,\n // disabled\n 'text-opacity-25 cursor-not-allowed placeholder:text-gray-500': disabled,\n // highlighted\n 'bg-yellow-50 placeholder:text-yellow-300': props.highlighted && disabled,\n 'bg-yellow-100 placeholder:text-yellow-500': props.highlighted && !disabled,\n // invalid\n 'border-red-500 enabled:hover:border-red-500 disabled:border-red-300/50': invalid,\n // readOnly\n 'cursor-not-allowed text-black bg-gray-50': readOnly,\n }\n );\n};\n\nexport const getButtonStateClasses = (invalid: boolean | undefined, disabled = false): string => {\n if (invalid) {\n return cn('border border-red-500 group-peer-hover:enabled:border-red-700 transition-colors ease-in', {\n 'border-red-500/30': disabled,\n });\n }\n\n return 'border border-gray-200 group-peer-hover:enabled:border-gray-300 transition-colors transition-opacity ease-in';\n};\n"],"names":[],"mappings":";;;AAUa,MAAA,kBAAkB,CAAC,UAA6B;AACzD,QAAM,WAAW,MAAM,YAAY,CAAC,CAAC,MAAM,eAAe;AAC1D,QAAM,WAAW,MAAM,YAAY,CAAC,CAAC,MAAM,eAAe;AAC1D,QAAM,UAAU,MAAM,WAAW,CAAC,CAAC,MAAM,cAAc;AAEhD,SAAA;AAAA,IACH;AAAA;AAAA,IAEA;AAAA,IACA;AAAA,MACI,YAAY,CAAC,MAAM,eAAe,CAAC;AAAA;AAAA,MAEnC,0EAA0E,CAAC;AAAA;AAAA,MAE3E,gEAAgE;AAAA;AAAA,MAEhE,4CAA4C,MAAM,eAAe;AAAA,MACjE,6CAA6C,MAAM,eAAe,CAAC;AAAA;AAAA,MAEnE,0EAA0E;AAAA;AAAA,MAE1E,4CAA4C;AAAA,IAAA;AAAA,EAEpD;AACJ;AAEO,MAAM,wBAAwB,CAAC,SAA8B,WAAW,UAAkB;AAC7F,MAAI,SAAS;AACT,WAAO,GAAG,2FAA2F;AAAA,MACjG,qBAAqB;AAAA,IAAA,CACxB;AAAA,EAAA;AAGE,SAAA;AACX;;;"}
@@ -14,8 +14,8 @@ const getInputClasses = (props) => {
14
14
  // disabled
15
15
  "text-opacity-25 cursor-not-allowed placeholder:text-gray-500": disabled,
16
16
  // highlighted
17
- "bg-yellow-50/25": props.highlighted && disabled,
18
- "bg-yellow-50/50": props.highlighted && !disabled,
17
+ "bg-yellow-50 placeholder:text-yellow-300": props.highlighted && disabled,
18
+ "bg-yellow-100 placeholder:text-yellow-500": props.highlighted && !disabled,
19
19
  // invalid
20
20
  "border-red-500 enabled:hover:border-red-500 disabled:border-red-300/50": invalid,
21
21
  // readOnly
@@ -1 +1 @@
1
- {"version":3,"file":"util.js","sources":["../../../src/components/Input/util.ts"],"sourcesContent":["import cn from 'clsx';\n\ntype InputClassesProps = Pick<\n React.InputHTMLAttributes<HTMLInputElement>,\n 'aria-disabled' | 'aria-readonly' | 'aria-invalid' | 'readOnly' | 'disabled'\n> & {\n invalid?: boolean;\n highlighted?: boolean;\n};\n\nexport const getInputClasses = (props: InputClassesProps) => {\n const disabled = props.disabled || !!props['aria-disabled'];\n const readOnly = props.readOnly || !!props['aria-readonly'];\n const invalid = props.invalid || !!props['aria-invalid'];\n\n return cn(\n 'peer text-black text-sm border font-normal not-italic no-underline rounded flex items-center leading-6 px-2 relative w-full text-ellipsis transition-colors transition-opacity ease-in min-h-[theme(spacing.8)] focus:yt-focus',\n // hide the arrow controls on input[type=number]\n '[appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none',\n {\n 'bg-white': !props.highlighted && !readOnly,\n // default\n 'border-gray-200 enabled:hover:border-gray-300 disabled:border-gray-100': !invalid,\n // disabled\n 'text-opacity-25 cursor-not-allowed placeholder:text-gray-500': disabled,\n // highlighted\n 'bg-yellow-50/25': props.highlighted && disabled,\n 'bg-yellow-50/50': props.highlighted && !disabled,\n // invalid\n 'border-red-500 enabled:hover:border-red-500 disabled:border-red-300/50': invalid,\n // readOnly\n 'cursor-not-allowed text-black bg-gray-50': readOnly,\n }\n );\n};\n\nexport const getButtonStateClasses = (invalid: boolean | undefined, disabled = false): string => {\n if (invalid) {\n return cn('border border-red-500 group-peer-hover:enabled:border-red-700 transition-colors ease-in', {\n 'border-red-500/30': disabled,\n });\n }\n\n return 'border border-gray-200 group-peer-hover:enabled:border-gray-300 transition-colors transition-opacity ease-in';\n};\n"],"names":[],"mappings":";AAUa,MAAA,kBAAkB,CAAC,UAA6B;AACzD,QAAM,WAAW,MAAM,YAAY,CAAC,CAAC,MAAM,eAAe;AAC1D,QAAM,WAAW,MAAM,YAAY,CAAC,CAAC,MAAM,eAAe;AAC1D,QAAM,UAAU,MAAM,WAAW,CAAC,CAAC,MAAM,cAAc;AAEhD,SAAA;AAAA,IACH;AAAA;AAAA,IAEA;AAAA,IACA;AAAA,MACI,YAAY,CAAC,MAAM,eAAe,CAAC;AAAA;AAAA,MAEnC,0EAA0E,CAAC;AAAA;AAAA,MAE3E,gEAAgE;AAAA;AAAA,MAEhE,mBAAmB,MAAM,eAAe;AAAA,MACxC,mBAAmB,MAAM,eAAe,CAAC;AAAA;AAAA,MAEzC,0EAA0E;AAAA;AAAA,MAE1E,4CAA4C;AAAA,IAAA;AAAA,EAEpD;AACJ;AAEO,MAAM,wBAAwB,CAAC,SAA8B,WAAW,UAAkB;AAC7F,MAAI,SAAS;AACT,WAAO,GAAG,2FAA2F;AAAA,MACjG,qBAAqB;AAAA,IAAA,CACxB;AAAA,EAAA;AAGE,SAAA;AACX;"}
1
+ {"version":3,"file":"util.js","sources":["../../../src/components/Input/util.ts"],"sourcesContent":["import cn from 'clsx';\n\ntype InputClassesProps = Pick<\n React.InputHTMLAttributes<HTMLInputElement>,\n 'aria-disabled' | 'aria-readonly' | 'aria-invalid' | 'readOnly' | 'disabled'\n> & {\n invalid?: boolean;\n highlighted?: boolean;\n};\n\nexport const getInputClasses = (props: InputClassesProps) => {\n const disabled = props.disabled || !!props['aria-disabled'];\n const readOnly = props.readOnly || !!props['aria-readonly'];\n const invalid = props.invalid || !!props['aria-invalid'];\n\n return cn(\n 'peer text-black text-sm border font-normal not-italic no-underline rounded flex items-center leading-6 px-2 relative w-full text-ellipsis transition-colors transition-opacity ease-in min-h-[theme(spacing.8)] focus:yt-focus',\n // hide the arrow controls on input[type=number]\n '[appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none',\n {\n 'bg-white': !props.highlighted && !readOnly,\n // default\n 'border-gray-200 enabled:hover:border-gray-300 disabled:border-gray-100': !invalid,\n // disabled\n 'text-opacity-25 cursor-not-allowed placeholder:text-gray-500': disabled,\n // highlighted\n 'bg-yellow-50 placeholder:text-yellow-300': props.highlighted && disabled,\n 'bg-yellow-100 placeholder:text-yellow-500': props.highlighted && !disabled,\n // invalid\n 'border-red-500 enabled:hover:border-red-500 disabled:border-red-300/50': invalid,\n // readOnly\n 'cursor-not-allowed text-black bg-gray-50': readOnly,\n }\n );\n};\n\nexport const getButtonStateClasses = (invalid: boolean | undefined, disabled = false): string => {\n if (invalid) {\n return cn('border border-red-500 group-peer-hover:enabled:border-red-700 transition-colors ease-in', {\n 'border-red-500/30': disabled,\n });\n }\n\n return 'border border-gray-200 group-peer-hover:enabled:border-gray-300 transition-colors transition-opacity ease-in';\n};\n"],"names":[],"mappings":";AAUa,MAAA,kBAAkB,CAAC,UAA6B;AACzD,QAAM,WAAW,MAAM,YAAY,CAAC,CAAC,MAAM,eAAe;AAC1D,QAAM,WAAW,MAAM,YAAY,CAAC,CAAC,MAAM,eAAe;AAC1D,QAAM,UAAU,MAAM,WAAW,CAAC,CAAC,MAAM,cAAc;AAEhD,SAAA;AAAA,IACH;AAAA;AAAA,IAEA;AAAA,IACA;AAAA,MACI,YAAY,CAAC,MAAM,eAAe,CAAC;AAAA;AAAA,MAEnC,0EAA0E,CAAC;AAAA;AAAA,MAE3E,gEAAgE;AAAA;AAAA,MAEhE,4CAA4C,MAAM,eAAe;AAAA,MACjE,6CAA6C,MAAM,eAAe,CAAC;AAAA;AAAA,MAEnE,0EAA0E;AAAA;AAAA,MAE1E,4CAA4C;AAAA,IAAA;AAAA,EAEpD;AACJ;AAEO,MAAM,wBAAwB,CAAC,SAA8B,WAAW,UAAkB;AAC7F,MAAI,SAAS;AACT,WAAO,GAAG,2FAA2F;AAAA,MACjG,qBAAqB;AAAA,IAAA,CACxB;AAAA,EAAA;AAGE,SAAA;AACX;"}
@@ -5,7 +5,7 @@ export type ListCollapsibleProps = Omit<ComposableListItemProps<typeof Collapsib
5
5
  children: JSX.Element | JSX.Element[];
6
6
  defaultOpen?: boolean;
7
7
  };
8
- export declare const Collapsible: React.ForwardRefExoticComponent<Omit<ComposableListItemProps<React.ForwardRefExoticComponent<Omit<import('@base-ui/react/collapsible').CollapsibleRootProps, "ref"> & React.RefAttributes<HTMLDivElement>>>, "children"> & {
8
+ export declare const Collapsible: React.ForwardRefExoticComponent<Omit<ComposableListItemProps<React.ForwardRefExoticComponent<Omit<import('@base-ui/react').CollapsibleRootProps, "ref"> & React.RefAttributes<HTMLDivElement>>>, "children"> & {
9
9
  children: JSX.Element | JSX.Element[];
10
10
  defaultOpen?: boolean;
11
11
  } & React.RefAttributes<HTMLDivElement>>;
@@ -7,7 +7,7 @@ export type MenuContentProps = Omit<React.ComponentPropsWithoutRef<typeof MenuPr
7
7
  /** Set the position of the Menu relative to its trigger. Default value is `bottom` */
8
8
  placement?: Placement;
9
9
  };
10
- export declare const Content: React.ForwardRefExoticComponent<Omit<Omit<Omit<import('@base-ui/react/menu').MenuPopupProps, "ref"> & React.RefAttributes<HTMLDivElement>, "ref">, "children" | "side"> & {
10
+ export declare const Content: React.ForwardRefExoticComponent<Omit<Omit<Omit<import('@base-ui/react').ContextMenuPopupProps, "ref"> & React.RefAttributes<HTMLDivElement>, "ref">, "children" | "side"> & {
11
11
  align?: Align;
12
12
  children: React.ReactNode;
13
13
  /** Set the position of the Menu relative to its trigger. Default value is `bottom` */
@@ -3,6 +3,6 @@ import * as React from 'react';
3
3
  export type MenuSubMenuProps = Omit<React.ComponentPropsWithoutRef<typeof MenuPrimitive.Popup>, 'children' | 'side'> & {
4
4
  children: React.ReactNode;
5
5
  };
6
- export declare const SubMenu: React.ForwardRefExoticComponent<Omit<Omit<Omit<import('@base-ui/react/menu').MenuPopupProps, "ref"> & React.RefAttributes<HTMLDivElement>, "ref">, "children" | "side"> & {
6
+ export declare const SubMenu: React.ForwardRefExoticComponent<Omit<Omit<Omit<import('@base-ui/react').ContextMenuPopupProps, "ref"> & React.RefAttributes<HTMLDivElement>, "ref">, "children" | "side"> & {
7
7
  children: React.ReactNode;
8
8
  } & React.RefAttributes<HTMLDivElement>>;
@@ -1 +1 @@
1
- {"version":3,"file":"useSelect.cjs","sources":["../../../src/components/Select/useSelect.tsx"],"sourcesContent":["import * as React from 'react';\nimport cn from 'clsx';\nimport { nanoid } from 'nanoid';\nimport * as PopoverPrimitive from '@radix-ui/react-popover';\nimport { useLocalization } from '../Provider/Localization';\nimport { SelectProps } from './Select';\nimport { ListboxProps } from '../Listbox/Listbox';\nimport { useMergedRef } from '../../hooks/useMergedRef';\nimport { setInputValueByRef, findByValue, useFlattenedData, sanitizeItem } from '../Listbox/util';\nimport { ScrollableListItemValue } from '../Listbox/ScrollableList';\nimport { createCustomEvent } from '../../utils/input';\n\ntype InternalButtonProps = React.ButtonHTMLAttributes<HTMLButtonElement>;\ntype InternalListboxProps = ListboxProps & { ref: React.ForwardedRef<HTMLInputElement> };\ntype InternalInputProps = React.InputHTMLAttributes<HTMLInputElement> & { ref: React.ForwardedRef<HTMLInputElement> };\n\ntype useSelect = React.HtmlHTMLAttributes<HTMLDivElement> & {\n button: InternalButtonProps;\n listbox: InternalListboxProps;\n input: InternalInputProps;\n popover: Pick<PopoverPrimitive.PopoverProps, 'onOpenChange' | 'open'>;\n text: string | JSX.Element;\n more?: number;\n};\n\nexport const useSelect = (\n {\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n data = [],\n defaultValue,\n disabled,\n emptyValue,\n id: nativeId,\n multiselect,\n onBlur,\n onClick: _1,\n onChange,\n readOnly,\n tabIndex,\n value,\n ...otherProps\n }: SelectProps,\n ref: React.Ref<HTMLInputElement>\n): useSelect => {\n const { texts } = useLocalization();\n const flattenedData = useFlattenedData(data);\n const listboxInputRef = useMergedRef<HTMLInputElement>(ref);\n const [open, setOpen] = React.useState(false);\n const id = React.useMemo(() => nativeId || `select_${nanoid()}`, [nativeId]);\n const inputRef = React.useRef<HTMLInputElement>(null);\n const buttonId = `${id}-button`;\n // support 'escape' resetting to the value that was set when the listbox opened\n const [lastValue, setLastValue] = React.useState<ScrollableListItemValue | undefined>(value);\n\n React.useEffect(() => {\n setLastValue(value);\n }, [open]);\n\n React.useEffect(() => {\n if (value === undefined) {\n if (defaultValue !== undefined && findByValue(flattenedData, defaultValue)) {\n setInputValueByRef(inputRef.current, defaultValue);\n } else if (emptyValue !== undefined) {\n setInputValueByRef(inputRef.current, emptyValue);\n } else if (data.length > 0) {\n setInputValueByRef(inputRef.current, data[0]?.value);\n }\n } else if (!multiselect && !findByValue(flattenedData, value)) {\n if (emptyValue !== undefined) {\n setInputValueByRef(inputRef.current, emptyValue);\n } else if (data.length > 0) {\n setInputValueByRef(inputRef.current, data[0]?.value);\n }\n }\n }, []);\n\n // event handlers\n const handleButtonKeyDown = (event: React.KeyboardEvent<HTMLButtonElement>): void => {\n if (event.key === 'ArrowUp' || event.key === 'ArrowDown') {\n event.preventDefault();\n setOpen(true);\n }\n };\n\n const handleListboxKeyDown = (event: React.KeyboardEvent<HTMLElement>): void => {\n switch (event.key) {\n case 'Escape': {\n event.preventDefault();\n if (lastValue !== undefined) {\n setInputValueByRef(listboxInputRef.current, lastValue);\n }\n\n setOpen(false);\n break;\n }\n\n case 'Tab':\n case 'Enter': {\n if (event.key !== 'Tab') {\n event.preventDefault();\n }\n setOpen(false);\n break;\n }\n\n default:\n }\n\n if (otherProps.onKeyDown) {\n otherProps.onKeyDown(event);\n }\n };\n\n const handleListboxClick = (event: React.MouseEvent<HTMLLIElement>): void => {\n event.preventDefault();\n if (!multiselect) {\n setOpen(false);\n if (onBlur) {\n onBlur(createCustomEvent('blur') as unknown as React.FocusEvent<HTMLElement, Element>);\n }\n }\n };\n\n let text: string | JSX.Element = '';\n let more = 0;\n\n if (value !== undefined) {\n if (multiselect) {\n const selectedValues = value?.toString().split(',') || [];\n\n if (selectedValues.length === flattenedData.filter(item => !item.disabled).length) {\n text = texts.select.allOptionsSelected;\n } else {\n text = findByValue(flattenedData, selectedValues[0])?.text ?? '';\n more = selectedValues.length > 1 ? selectedValues.length - 1 : 0;\n }\n } else {\n const item = findByValue(flattenedData, value);\n\n if (item) {\n text = item.icon ? (\n <>\n {React.cloneElement(item.icon, {\n className: cn(item.icon.props.className, 'mr-1 -mt-px'),\n })}\n {item.text}\n </>\n ) : (\n item.text\n );\n }\n }\n }\n\n const handleInputChange = (event: React.ChangeEvent<HTMLInputElement>): void => {\n event.persist();\n\n if (onChange) {\n const item = findByValue(flattenedData, event.target.value);\n (event as any).detail = sanitizeItem(item);\n\n const indexes = item?.path?.split('.') ?? [];\n\n if (indexes.length > 1) {\n // we don't want to map the current item\n indexes.pop();\n // we need to rebuild the path as we map\n let lastPath: string;\n\n (event as any).detail.parents = indexes.map(i => {\n lastPath = lastPath ? [lastPath, i].join('.') : i;\n return sanitizeItem(flattenedData.find(i => i.path === lastPath));\n });\n }\n\n onChange(event);\n }\n };\n\n const handleButtonClick = (event: React.MouseEvent<HTMLButtonElement>) => {\n if (readOnly) {\n event.preventDefault();\n }\n };\n\n // select the value text if the select is readonly\n const handleButtonFocus = (event: React.FocusEvent<HTMLButtonElement>) => {\n if (readOnly) {\n const value = event.currentTarget.querySelector(':first-child');\n\n if (value) {\n window.getSelection()?.selectAllChildren?.(value);\n }\n }\n };\n\n const button: InternalButtonProps = {\n 'aria-haspopup': 'listbox' as const,\n 'aria-label': ariaLabel ? `${ariaLabel} ${text}` : undefined,\n 'aria-labelledby': ariaLabelledBy ? `${ariaLabelledBy} ${buttonId}` : undefined,\n 'aria-readonly': readOnly ? 'true' : undefined,\n disabled: disabled,\n id: buttonId,\n onClick: handleButtonClick,\n onFocus: handleButtonFocus,\n onKeyDown: !disabled && !readOnly ? handleButtonKeyDown : undefined,\n tabIndex,\n type: 'button',\n };\n\n const listbox: InternalListboxProps = {\n ...otherProps,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n data,\n disabled,\n emptyValue,\n onBlur,\n onClick: handleListboxClick,\n onChange: event => {\n setInputValueByRef(inputRef.current, event.target.value);\n },\n onKeyDown: handleListboxKeyDown,\n ref: listboxInputRef,\n value,\n };\n\n const input: InternalInputProps = {\n onChange: handleInputChange,\n ref: inputRef,\n value: String(value ?? ''),\n };\n\n return {\n button,\n listbox,\n input,\n popover: {\n open,\n onOpenChange: setOpen,\n },\n text,\n more,\n };\n};\n"],"names":["useLocalization","useFlattenedData","useMergedRef","React","nanoid","findByValue","setInputValueByRef","_a","createCustomEvent","sanitizeItem","i","value","input"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAyBO,MAAM,YAAY,CACrB;AAAA,EACI,cAAc;AAAA,EACd,mBAAmB;AAAA,EACnB,OAAO,CAAC;AAAA,EACR;AAAA,EACA;AAAA,EACA;AAAA,EACA,IAAI;AAAA,EACJ;AAAA,EACA;AAAA,EACA,SAAS;AAAA,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IAAI;AAAA,IACJ,SAAS;AAAA,IACT,SAAS;AAAA,IACT,WAAW,CAAC,YAAY,CAAC,WAAW,sBAAsB;AAAA,IAC1D;AAAA,IACA,MAAM;AAAA,EACV;AAEA,QAAM,UAAgC;AAAA,IAClC,GAAG;AAAA,IACH,cAAc;AAAA,IACd,mBAAmB;AAAA,IACnB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,SAAS;AAAA,IACT,UAAU,CAAS,UAAA;AACfL,WAAAA,mBAAmB,SAAS,SAAS,MAAM,OAAO,KAAK;AAAA,IAC3D;AAAA,IACA,WAAW;AAAA,IACX,KAAK;AAAA,IACL;AAAA,EACJ;AAEA,QAAMM,UAA4B;AAAA,IAC9B,UAAU;AAAA,IACV,KAAK;AAAA,IACL,OAAO,OAAO,SAAS,EAAE;AAAA,EAC7B;AAEO,SAAA;AAAA,IACH;AAAA,IACA;AAAA,IAAA,OACAA;AAAAA,IACA,SAAS;AAAA,MACL;AAAA,MACA,cAAc;AAAA,IAClB;AAAA,IACA;AAAA,IACA;AAAA,EACJ;AACJ;;"}
1
+ {"version":3,"file":"useSelect.cjs","sources":["../../../src/components/Select/useSelect.tsx"],"sourcesContent":["import * as React from 'react';\nimport cn from 'clsx';\nimport { nanoid } from 'nanoid';\nimport { Popover as PopoverPrimitive } from '@base-ui/react/popover';\nimport { useLocalization } from '../Provider/Localization';\nimport { SelectProps } from './Select';\nimport { ListboxProps } from '../Listbox/Listbox';\nimport { useMergedRef } from '../../hooks/useMergedRef';\nimport { setInputValueByRef, findByValue, useFlattenedData, sanitizeItem } from '../Listbox/util';\nimport { ScrollableListItemValue } from '../Listbox/ScrollableList';\nimport { createCustomEvent } from '../../utils/input';\n\ntype InternalButtonProps = React.ButtonHTMLAttributes<HTMLButtonElement>;\ntype InternalListboxProps = ListboxProps & { ref: React.ForwardedRef<HTMLInputElement> };\ntype InternalInputProps = React.InputHTMLAttributes<HTMLInputElement> & { ref: React.ForwardedRef<HTMLInputElement> };\n\ntype useSelect = React.HtmlHTMLAttributes<HTMLDivElement> & {\n button: InternalButtonProps;\n listbox: InternalListboxProps;\n input: InternalInputProps;\n popover: Pick<PopoverPrimitive.Root.Props, 'onOpenChange' | 'open'>;\n text: string | JSX.Element;\n more?: number;\n};\n\nexport const useSelect = (\n {\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n data = [],\n defaultValue,\n disabled,\n emptyValue,\n id: nativeId,\n multiselect,\n onBlur,\n onClick: _1,\n onChange,\n readOnly,\n tabIndex,\n value,\n ...otherProps\n }: SelectProps,\n ref: React.Ref<HTMLInputElement>\n): useSelect => {\n const { texts } = useLocalization();\n const flattenedData = useFlattenedData(data);\n const listboxInputRef = useMergedRef<HTMLInputElement>(ref);\n const [open, setOpen] = React.useState(false);\n const id = React.useMemo(() => nativeId || `select_${nanoid()}`, [nativeId]);\n const inputRef = React.useRef<HTMLInputElement>(null);\n const buttonId = `${id}-button`;\n // support 'escape' resetting to the value that was set when the listbox opened\n const [lastValue, setLastValue] = React.useState<ScrollableListItemValue | undefined>(value);\n\n React.useEffect(() => {\n setLastValue(value);\n }, [open]);\n\n React.useEffect(() => {\n if (value === undefined) {\n if (defaultValue !== undefined && findByValue(flattenedData, defaultValue)) {\n setInputValueByRef(inputRef.current, defaultValue);\n } else if (emptyValue !== undefined) {\n setInputValueByRef(inputRef.current, emptyValue);\n } else if (data.length > 0) {\n setInputValueByRef(inputRef.current, data[0]?.value);\n }\n } else if (!multiselect && !findByValue(flattenedData, value)) {\n if (emptyValue !== undefined) {\n setInputValueByRef(inputRef.current, emptyValue);\n } else if (data.length > 0) {\n setInputValueByRef(inputRef.current, data[0]?.value);\n }\n }\n }, []);\n\n // event handlers\n const handleButtonKeyDown = (event: React.KeyboardEvent<HTMLButtonElement>): void => {\n if (event.key === 'ArrowUp' || event.key === 'ArrowDown') {\n event.preventDefault();\n setOpen(true);\n }\n };\n\n const handleListboxKeyDown = (event: React.KeyboardEvent<HTMLElement>): void => {\n switch (event.key) {\n case 'Escape': {\n event.preventDefault();\n if (lastValue !== undefined) {\n setInputValueByRef(listboxInputRef.current, lastValue);\n }\n\n setOpen(false);\n break;\n }\n\n case 'Tab':\n case 'Enter': {\n if (event.key !== 'Tab') {\n event.preventDefault();\n }\n setOpen(false);\n break;\n }\n\n default:\n }\n\n if (otherProps.onKeyDown) {\n otherProps.onKeyDown(event);\n }\n };\n\n const handleListboxClick = (event: React.MouseEvent<HTMLLIElement>): void => {\n event.preventDefault();\n if (!multiselect) {\n setOpen(false);\n if (onBlur) {\n onBlur(createCustomEvent('blur') as unknown as React.FocusEvent<HTMLElement, Element>);\n }\n }\n };\n\n let text: string | JSX.Element = '';\n let more = 0;\n\n if (value !== undefined) {\n if (multiselect) {\n const selectedValues = value?.toString().split(',') || [];\n\n if (selectedValues.length === flattenedData.filter(item => !item.disabled).length) {\n text = texts.select.allOptionsSelected;\n } else {\n text = findByValue(flattenedData, selectedValues[0])?.text ?? '';\n more = selectedValues.length > 1 ? selectedValues.length - 1 : 0;\n }\n } else {\n const item = findByValue(flattenedData, value);\n\n if (item) {\n text = item.icon ? (\n <>\n {React.cloneElement(item.icon, {\n className: cn(item.icon.props.className, 'mr-1 -mt-px'),\n })}\n {item.text}\n </>\n ) : (\n item.text\n );\n }\n }\n }\n\n const handleInputChange = (event: React.ChangeEvent<HTMLInputElement>): void => {\n event.persist();\n\n if (onChange) {\n const item = findByValue(flattenedData, event.target.value);\n (event as any).detail = sanitizeItem(item);\n\n const indexes = item?.path?.split('.') ?? [];\n\n if (indexes.length > 1) {\n // we don't want to map the current item\n indexes.pop();\n // we need to rebuild the path as we map\n let lastPath: string;\n\n (event as any).detail.parents = indexes.map(i => {\n lastPath = lastPath ? [lastPath, i].join('.') : i;\n return sanitizeItem(flattenedData.find(i => i.path === lastPath));\n });\n }\n\n onChange(event);\n }\n };\n\n const handleButtonClick = (event: React.MouseEvent<HTMLButtonElement>) => {\n if (readOnly) {\n event.preventDefault();\n }\n };\n\n // select the value text if the select is readonly\n const handleButtonFocus = (event: React.FocusEvent<HTMLButtonElement>) => {\n if (readOnly) {\n const value = event.currentTarget.querySelector(':first-child');\n\n if (value) {\n window.getSelection()?.selectAllChildren?.(value);\n }\n }\n };\n\n const button: InternalButtonProps = {\n 'aria-haspopup': 'listbox' as const,\n 'aria-label': ariaLabel ? `${ariaLabel} ${text}` : undefined,\n 'aria-labelledby': ariaLabelledBy ? `${ariaLabelledBy} ${buttonId}` : undefined,\n 'aria-readonly': readOnly ? 'true' : undefined,\n disabled: disabled,\n id: buttonId,\n onClick: handleButtonClick,\n onFocus: handleButtonFocus,\n onKeyDown: !disabled && !readOnly ? handleButtonKeyDown : undefined,\n tabIndex,\n type: 'button',\n };\n\n const listbox: InternalListboxProps = {\n ...otherProps,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n data,\n disabled,\n emptyValue,\n onBlur,\n onClick: handleListboxClick,\n onChange: event => {\n setInputValueByRef(inputRef.current, event.target.value);\n },\n onKeyDown: handleListboxKeyDown,\n ref: listboxInputRef,\n value,\n };\n\n const input: InternalInputProps = {\n onChange: handleInputChange,\n ref: inputRef,\n value: String(value ?? ''),\n };\n\n return {\n button,\n listbox,\n input,\n popover: {\n open,\n onOpenChange: setOpen,\n },\n text,\n more,\n };\n};\n"],"names":["useLocalization","useFlattenedData","useMergedRef","React","nanoid","findByValue","setInputValueByRef","_a","createCustomEvent","sanitizeItem","i","value","input"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAyBO,MAAM,YAAY,CACrB;AAAA,EACI,cAAc;AAAA,EACd,mBAAmB;AAAA,EACnB,OAAO,CAAC;AAAA,EACR;AAAA,EACA;AAAA,EACA;AAAA,EACA,IAAI;AAAA,EACJ;AAAA,EACA;AAAA,EACA,SAAS;AAAA,EACT;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACP,GACA,QACY;;AACN,QAAA,EAAE,MAAM,IAAIA,6BAAgB;AAC5B,QAAA,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AAA,EACV;AAEA,QAAM,UAAgC;AAAA,IAClC,GAAG;AAAA,IACH,cAAc;AAAA,IACd,mBAAmB;AAAA,IACnB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,SAAS;AAAA,IACT,UAAU,CAAS,UAAA;AACfL,WAAAA,mBAAmB,SAAS,SAAS,MAAM,OAAO,KAAK;AAAA,IAC3D;AAAA,IACA,WAAW;AAAA,IACX,KAAK;AAAA,IACL;AAAA,EACJ;AAEA,QAAMM,UAA4B;AAAA,IAC9B,UAAU;AAAA,IACV,KAAK;AAAA,IACL,OAAO,OAAO,SAAS,EAAE;AAAA,EAC7B;AAEO,SAAA;AAAA,IACH;AAAA,IACA;AAAA,IAAA,OACAA;AAAAA,IACA,SAAS;AAAA,MACL;AAAA,MACA,cAAc;AAAA,IAClB;AAAA,IACA;AAAA,IACA;AAAA,EACJ;AACJ;;"}
@@ -1,7 +1,7 @@
1
+ import { Popover as PopoverPrimitive } from '@base-ui/react/popover';
1
2
  import { SelectProps } from './Select';
2
3
  import { ListboxProps } from '../Listbox/Listbox';
3
4
  import * as React from 'react';
4
- import * as PopoverPrimitive from '@radix-ui/react-popover';
5
5
  type InternalButtonProps = React.ButtonHTMLAttributes<HTMLButtonElement>;
6
6
  type InternalListboxProps = ListboxProps & {
7
7
  ref: React.ForwardedRef<HTMLInputElement>;
@@ -13,7 +13,7 @@ type useSelect = React.HtmlHTMLAttributes<HTMLDivElement> & {
13
13
  button: InternalButtonProps;
14
14
  listbox: InternalListboxProps;
15
15
  input: InternalInputProps;
16
- popover: Pick<PopoverPrimitive.PopoverProps, 'onOpenChange' | 'open'>;
16
+ popover: Pick<PopoverPrimitive.Root.Props, 'onOpenChange' | 'open'>;
17
17
  text: string | JSX.Element;
18
18
  more?: number;
19
19
  };
@@ -1 +1 @@
1
- {"version":3,"file":"useSelect.js","sources":["../../../src/components/Select/useSelect.tsx"],"sourcesContent":["import * as React from 'react';\nimport cn from 'clsx';\nimport { nanoid } from 'nanoid';\nimport * as PopoverPrimitive from '@radix-ui/react-popover';\nimport { useLocalization } from '../Provider/Localization';\nimport { SelectProps } from './Select';\nimport { ListboxProps } from '../Listbox/Listbox';\nimport { useMergedRef } from '../../hooks/useMergedRef';\nimport { setInputValueByRef, findByValue, useFlattenedData, sanitizeItem } from '../Listbox/util';\nimport { ScrollableListItemValue } from '../Listbox/ScrollableList';\nimport { createCustomEvent } from '../../utils/input';\n\ntype InternalButtonProps = React.ButtonHTMLAttributes<HTMLButtonElement>;\ntype InternalListboxProps = ListboxProps & { ref: React.ForwardedRef<HTMLInputElement> };\ntype InternalInputProps = React.InputHTMLAttributes<HTMLInputElement> & { ref: React.ForwardedRef<HTMLInputElement> };\n\ntype useSelect = React.HtmlHTMLAttributes<HTMLDivElement> & {\n button: InternalButtonProps;\n listbox: InternalListboxProps;\n input: InternalInputProps;\n popover: Pick<PopoverPrimitive.PopoverProps, 'onOpenChange' | 'open'>;\n text: string | JSX.Element;\n more?: number;\n};\n\nexport const useSelect = (\n {\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n data = [],\n defaultValue,\n disabled,\n emptyValue,\n id: nativeId,\n multiselect,\n onBlur,\n onClick: _1,\n onChange,\n readOnly,\n tabIndex,\n value,\n ...otherProps\n }: SelectProps,\n ref: React.Ref<HTMLInputElement>\n): useSelect => {\n const { texts } = useLocalization();\n const flattenedData = useFlattenedData(data);\n const listboxInputRef = useMergedRef<HTMLInputElement>(ref);\n const [open, setOpen] = React.useState(false);\n const id = React.useMemo(() => nativeId || `select_${nanoid()}`, [nativeId]);\n const inputRef = React.useRef<HTMLInputElement>(null);\n const buttonId = `${id}-button`;\n // support 'escape' resetting to the value that was set when the listbox opened\n const [lastValue, setLastValue] = React.useState<ScrollableListItemValue | undefined>(value);\n\n React.useEffect(() => {\n setLastValue(value);\n }, [open]);\n\n React.useEffect(() => {\n if (value === undefined) {\n if (defaultValue !== undefined && findByValue(flattenedData, defaultValue)) {\n setInputValueByRef(inputRef.current, defaultValue);\n } else if (emptyValue !== undefined) {\n setInputValueByRef(inputRef.current, emptyValue);\n } else if (data.length > 0) {\n setInputValueByRef(inputRef.current, data[0]?.value);\n }\n } else if (!multiselect && !findByValue(flattenedData, value)) {\n if (emptyValue !== undefined) {\n setInputValueByRef(inputRef.current, emptyValue);\n } else if (data.length > 0) {\n setInputValueByRef(inputRef.current, data[0]?.value);\n }\n }\n }, []);\n\n // event handlers\n const handleButtonKeyDown = (event: React.KeyboardEvent<HTMLButtonElement>): void => {\n if (event.key === 'ArrowUp' || event.key === 'ArrowDown') {\n event.preventDefault();\n setOpen(true);\n }\n };\n\n const handleListboxKeyDown = (event: React.KeyboardEvent<HTMLElement>): void => {\n switch (event.key) {\n case 'Escape': {\n event.preventDefault();\n if (lastValue !== undefined) {\n setInputValueByRef(listboxInputRef.current, lastValue);\n }\n\n setOpen(false);\n break;\n }\n\n case 'Tab':\n case 'Enter': {\n if (event.key !== 'Tab') {\n event.preventDefault();\n }\n setOpen(false);\n break;\n }\n\n default:\n }\n\n if (otherProps.onKeyDown) {\n otherProps.onKeyDown(event);\n }\n };\n\n const handleListboxClick = (event: React.MouseEvent<HTMLLIElement>): void => {\n event.preventDefault();\n if (!multiselect) {\n setOpen(false);\n if (onBlur) {\n onBlur(createCustomEvent('blur') as unknown as React.FocusEvent<HTMLElement, Element>);\n }\n }\n };\n\n let text: string | JSX.Element = '';\n let more = 0;\n\n if (value !== undefined) {\n if (multiselect) {\n const selectedValues = value?.toString().split(',') || [];\n\n if (selectedValues.length === flattenedData.filter(item => !item.disabled).length) {\n text = texts.select.allOptionsSelected;\n } else {\n text = findByValue(flattenedData, selectedValues[0])?.text ?? '';\n more = selectedValues.length > 1 ? selectedValues.length - 1 : 0;\n }\n } else {\n const item = findByValue(flattenedData, value);\n\n if (item) {\n text = item.icon ? (\n <>\n {React.cloneElement(item.icon, {\n className: cn(item.icon.props.className, 'mr-1 -mt-px'),\n })}\n {item.text}\n </>\n ) : (\n item.text\n );\n }\n }\n }\n\n const handleInputChange = (event: React.ChangeEvent<HTMLInputElement>): void => {\n event.persist();\n\n if (onChange) {\n const item = findByValue(flattenedData, event.target.value);\n (event as any).detail = sanitizeItem(item);\n\n const indexes = item?.path?.split('.') ?? [];\n\n if (indexes.length > 1) {\n // we don't want to map the current item\n indexes.pop();\n // we need to rebuild the path as we map\n let lastPath: string;\n\n (event as any).detail.parents = indexes.map(i => {\n lastPath = lastPath ? [lastPath, i].join('.') : i;\n return sanitizeItem(flattenedData.find(i => i.path === lastPath));\n });\n }\n\n onChange(event);\n }\n };\n\n const handleButtonClick = (event: React.MouseEvent<HTMLButtonElement>) => {\n if (readOnly) {\n event.preventDefault();\n }\n };\n\n // select the value text if the select is readonly\n const handleButtonFocus = (event: React.FocusEvent<HTMLButtonElement>) => {\n if (readOnly) {\n const value = event.currentTarget.querySelector(':first-child');\n\n if (value) {\n window.getSelection()?.selectAllChildren?.(value);\n }\n }\n };\n\n const button: InternalButtonProps = {\n 'aria-haspopup': 'listbox' as const,\n 'aria-label': ariaLabel ? `${ariaLabel} ${text}` : undefined,\n 'aria-labelledby': ariaLabelledBy ? `${ariaLabelledBy} ${buttonId}` : undefined,\n 'aria-readonly': readOnly ? 'true' : undefined,\n disabled: disabled,\n id: buttonId,\n onClick: handleButtonClick,\n onFocus: handleButtonFocus,\n onKeyDown: !disabled && !readOnly ? handleButtonKeyDown : undefined,\n tabIndex,\n type: 'button',\n };\n\n const listbox: InternalListboxProps = {\n ...otherProps,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n data,\n disabled,\n emptyValue,\n onBlur,\n onClick: handleListboxClick,\n onChange: event => {\n setInputValueByRef(inputRef.current, event.target.value);\n },\n onKeyDown: handleListboxKeyDown,\n ref: listboxInputRef,\n value,\n };\n\n const input: InternalInputProps = {\n onChange: handleInputChange,\n ref: inputRef,\n value: String(value ?? ''),\n };\n\n return {\n button,\n listbox,\n input,\n popover: {\n open,\n onOpenChange: setOpen,\n },\n text,\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I,KAAK;AAAA,IACnD,mBAAmB,iBAAiB,GAAG,cAAc,IAAI,QAAQ,KAAK;AAAA,IACtE,iBAAiB,WAAW,SAAS;AAAA,IACrC;AAAA,IACA,IAAI;AAAA,IACJ,SAAS;AAAA,IACT,SAAS;AAAA,IACT,WAAW,CAAC,YAAY,CAAC,WAAW,sBAAsB;AAAA,IAC1D;AAAA,IACA,MAAM;AAAA,EACV;AAEA,QAAM,UAAgC;AAAA,IAClC,GAAG;AAAA,IACH,cAAc;AAAA,IACd,mBAAmB;AAAA,IACnB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,SAAS;AAAA,IACT,UAAU,CAAS,UAAA;AACf,yBAAmB,SAAS,SAAS,MAAM,OAAO,KAAK;AAAA,IAC3D;AAAA,IACA,WAAW;AAAA,IACX,KAAK;AAAA,IACL;AAAA,EACJ;AAEA,QAAM,QAA4B;AAAA,IAC9B,UAAU;AAAA,IACV,KAAK;AAAA,IACL,OAAO,OAAO,SAAS,EAAE;AAAA,EAC7B;AAEO,SAAA;AAAA,IACH;AAAA,IACA;AAAA,IACA;AAAA,IACA,SAAS;AAAA,MACL;AAAA,MACA,cAAc;AAAA,IAClB;AAAA,IACA;AAAA,IACA;AAAA,EACJ;AACJ;"}
1
+ {"version":3,"file":"useSelect.js","sources":["../../../src/components/Select/useSelect.tsx"],"sourcesContent":["import * as React from 'react';\nimport cn from 'clsx';\nimport { nanoid } from 'nanoid';\nimport { Popover as PopoverPrimitive } from '@base-ui/react/popover';\nimport { useLocalization } from '../Provider/Localization';\nimport { SelectProps } from './Select';\nimport { ListboxProps } from '../Listbox/Listbox';\nimport { useMergedRef } from '../../hooks/useMergedRef';\nimport { setInputValueByRef, findByValue, useFlattenedData, sanitizeItem } from '../Listbox/util';\nimport { ScrollableListItemValue } from '../Listbox/ScrollableList';\nimport { createCustomEvent } from '../../utils/input';\n\ntype InternalButtonProps = React.ButtonHTMLAttributes<HTMLButtonElement>;\ntype InternalListboxProps = ListboxProps & { ref: React.ForwardedRef<HTMLInputElement> };\ntype InternalInputProps = React.InputHTMLAttributes<HTMLInputElement> & { ref: React.ForwardedRef<HTMLInputElement> };\n\ntype useSelect = React.HtmlHTMLAttributes<HTMLDivElement> & {\n button: InternalButtonProps;\n listbox: InternalListboxProps;\n input: InternalInputProps;\n popover: Pick<PopoverPrimitive.Root.Props, 'onOpenChange' | 'open'>;\n text: string | JSX.Element;\n more?: number;\n};\n\nexport const useSelect = (\n {\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n data = [],\n defaultValue,\n disabled,\n emptyValue,\n id: nativeId,\n multiselect,\n onBlur,\n onClick: _1,\n onChange,\n readOnly,\n tabIndex,\n value,\n ...otherProps\n }: SelectProps,\n ref: React.Ref<HTMLInputElement>\n): useSelect => {\n const { texts } = useLocalization();\n const flattenedData = useFlattenedData(data);\n const listboxInputRef = useMergedRef<HTMLInputElement>(ref);\n const [open, setOpen] = React.useState(false);\n const id = React.useMemo(() => nativeId || `select_${nanoid()}`, [nativeId]);\n const inputRef = React.useRef<HTMLInputElement>(null);\n const buttonId = `${id}-button`;\n // support 'escape' resetting to the value that was set when the listbox opened\n const [lastValue, setLastValue] = React.useState<ScrollableListItemValue | undefined>(value);\n\n React.useEffect(() => {\n setLastValue(value);\n }, [open]);\n\n React.useEffect(() => {\n if (value === undefined) {\n if (defaultValue !== undefined && findByValue(flattenedData, defaultValue)) {\n setInputValueByRef(inputRef.current, defaultValue);\n } else if (emptyValue !== undefined) {\n setInputValueByRef(inputRef.current, emptyValue);\n } else if (data.length > 0) {\n setInputValueByRef(inputRef.current, data[0]?.value);\n }\n } else if (!multiselect && !findByValue(flattenedData, value)) {\n if (emptyValue !== undefined) {\n setInputValueByRef(inputRef.current, emptyValue);\n } else if (data.length > 0) {\n setInputValueByRef(inputRef.current, data[0]?.value);\n }\n }\n }, []);\n\n // event handlers\n const handleButtonKeyDown = (event: React.KeyboardEvent<HTMLButtonElement>): void => {\n if (event.key === 'ArrowUp' || event.key === 'ArrowDown') {\n event.preventDefault();\n setOpen(true);\n }\n };\n\n const handleListboxKeyDown = (event: React.KeyboardEvent<HTMLElement>): void => {\n switch (event.key) {\n case 'Escape': {\n event.preventDefault();\n if (lastValue !== undefined) {\n setInputValueByRef(listboxInputRef.current, lastValue);\n }\n\n setOpen(false);\n break;\n }\n\n case 'Tab':\n case 'Enter': {\n if (event.key !== 'Tab') {\n event.preventDefault();\n }\n setOpen(false);\n break;\n }\n\n default:\n }\n\n if (otherProps.onKeyDown) {\n otherProps.onKeyDown(event);\n }\n };\n\n const handleListboxClick = (event: React.MouseEvent<HTMLLIElement>): void => {\n event.preventDefault();\n if (!multiselect) {\n setOpen(false);\n if (onBlur) {\n onBlur(createCustomEvent('blur') as unknown as React.FocusEvent<HTMLElement, Element>);\n }\n }\n };\n\n let text: string | JSX.Element = '';\n let more = 0;\n\n if (value !== undefined) {\n if (multiselect) {\n const selectedValues = value?.toString().split(',') || [];\n\n if (selectedValues.length === flattenedData.filter(item => !item.disabled).length) {\n text = texts.select.allOptionsSelected;\n } else {\n text = findByValue(flattenedData, selectedValues[0])?.text ?? '';\n more = selectedValues.length > 1 ? selectedValues.length - 1 : 0;\n }\n } else {\n const item = findByValue(flattenedData, value);\n\n if (item) {\n text = item.icon ? (\n <>\n {React.cloneElement(item.icon, {\n className: cn(item.icon.props.className, 'mr-1 -mt-px'),\n })}\n {item.text}\n </>\n ) : (\n item.text\n );\n }\n }\n }\n\n const handleInputChange = (event: React.ChangeEvent<HTMLInputElement>): void => {\n event.persist();\n\n if (onChange) {\n const item = findByValue(flattenedData, event.target.value);\n (event as any).detail = sanitizeItem(item);\n\n const indexes = item?.path?.split('.') ?? [];\n\n if (indexes.length > 1) {\n // we don't want to map the current item\n indexes.pop();\n // we need to rebuild the path as we map\n let lastPath: string;\n\n (event as any).detail.parents = indexes.map(i => {\n lastPath = lastPath ? [lastPath, i].join('.') : i;\n return sanitizeItem(flattenedData.find(i => i.path === lastPath));\n });\n }\n\n onChange(event);\n }\n };\n\n const handleButtonClick = (event: React.MouseEvent<HTMLButtonElement>) => {\n if (readOnly) {\n event.preventDefault();\n }\n };\n\n // select the value text if the select is readonly\n const handleButtonFocus = (event: React.FocusEvent<HTMLButtonElement>) => {\n if (readOnly) {\n const value = event.currentTarget.querySelector(':first-child');\n\n if (value) {\n window.getSelection()?.selectAllChildren?.(value);\n }\n }\n };\n\n const button: InternalButtonProps = {\n 'aria-haspopup': 'listbox' as const,\n 'aria-label': ariaLabel ? `${ariaLabel} ${text}` : undefined,\n 'aria-labelledby': ariaLabelledBy ? `${ariaLabelledBy} ${buttonId}` : undefined,\n 'aria-readonly': readOnly ? 'true' : undefined,\n disabled: disabled,\n id: buttonId,\n onClick: handleButtonClick,\n onFocus: handleButtonFocus,\n onKeyDown: !disabled && !readOnly ? handleButtonKeyDown : undefined,\n tabIndex,\n type: 'button',\n };\n\n const listbox: InternalListboxProps = {\n ...otherProps,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n data,\n disabled,\n emptyValue,\n onBlur,\n onClick: handleListboxClick,\n onChange: event => {\n setInputValueByRef(inputRef.current, event.target.value);\n },\n onKeyDown: handleListboxKeyDown,\n ref: listboxInputRef,\n value,\n };\n\n const input: InternalInputProps = {\n onChange: handleInputChange,\n ref: inputRef,\n value: String(value ?? ''),\n };\n\n return {\n button,\n listbox,\n input,\n popover: {\n open,\n onOpenChange: setOpen,\n },\n text,\n more,\n };\n};\n"],"names":["_a","i","value"],"mappings":";;;;;;;AAyBO,MAAM,YAAY,CACrB;AAAA,EACI,cAAc;AAAA,EACd,mBAAmB;AAAA,EACnB,OAAO,CAAC;AAAA,EACR;AAAA,EACA;AAAA,EACA;AAAA,EACA,IAAI;AAAA,EACJ;AAAA,EACA;AAAA,EACA,SAAS;AAAA,EACT;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACP,GACA,QACY;;AACN,QAAA,EAAE,MAAM,IAAI,gBAAgB;AAC5B,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;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,SAAS;AAAA,IACT,UAAU,CAAS,UAAA;AACf,yBAAmB,SAAS,SAAS,MAAM,OAAO,KAAK;AAAA,IAC3D;AAAA,IACA,WAAW;AAAA,IACX,KAAK;AAAA,IACL;AAAA,EACJ;AAEA,QAAM,QAA4B;AAAA,IAC9B,UAAU;AAAA,IACV,KAAK;AAAA,IACL,OAAO,OAAO,SAAS,EAAE;AAAA,EAC7B;AAEO,SAAA;AAAA,IACH;AAAA,IACA;AAAA,IACA;AAAA,IACA,SAAS;AAAA,MACL;AAAA,MACA,cAAc;AAAA,IAClB;AAAA,IACA;AAAA,IACA;AAAA,EACJ;AACJ;"}
@@ -12,10 +12,10 @@ export declare function useTableEditing<TType = unknown>(isEnabled: boolean | un
12
12
  getRowStatus: (rowId: string) => ("saving" | "saved" | "errored") | undefined;
13
13
  setRowStatus: (rowId: string, status: ("saving" | "saved" | "errored") | undefined) => void;
14
14
  forceValidate: <T extends TType>(table: ReactTable<T>) => Promise<string[]>;
15
- setCellValue: <T extends TType>(cell: import('@tanstack/react-table').Cell<T, unknown>, rowIndex: number, value: unknown) => void;
16
- getCellValue: <T extends TType>(cell: import('@tanstack/react-table').Cell<T, unknown>) => unknown | undefined;
17
- getCellError: <T extends TType>(cell: import('@tanstack/react-table').Cell<T, unknown>) => string | undefined;
18
- onCellChanged: <T extends TType>(cell: import('@tanstack/react-table').Cell<T, unknown>, rowIndex: number, nextValue: any, shouldRunUpdaters?: boolean, shouldRunValidation?: boolean) => Promise<void>;
15
+ setCellValue: <T extends TType>(cell: import('@tanstack/table-core').Cell<T, unknown>, rowIndex: number, value: unknown) => void;
16
+ getCellValue: <T extends TType>(cell: import('@tanstack/table-core').Cell<T, unknown>) => unknown | undefined;
17
+ getCellError: <T extends TType>(cell: import('@tanstack/table-core').Cell<T, unknown>) => string | undefined;
18
+ onCellChanged: <T extends TType>(cell: import('@tanstack/table-core').Cell<T, unknown>, rowIndex: number, nextValue: any, shouldRunUpdaters?: boolean, shouldRunValidation?: boolean) => Promise<void>;
19
19
  getErrors: () => string[];
20
20
  getErrorsShownInAlert: <T extends TType>() => {
21
21
  rowId: string;
@@ -1 +1 @@
1
- {"version":3,"file":"Toast.cjs","sources":["../../../src/components/Toast/Toast.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'clsx';\nimport { motion, useAnimation } from 'framer-motion';\nimport { useTimer } from '../../utils/hooks/useTimer';\nimport { getBadgeIcon, getToastEmptyContentWarning } from './util';\nimport { State } from '../../types';\nimport { useLocalization } from '../Provider/Localization';\nimport { IconButton } from '../IconButton/IconButton';\n\nexport type ToastsTexts = {\n /** Aria-label for the close icon button of toast */\n dismiss: string;\n};\n\nexport type ToastType = Omit<State, 'default'> | 'loading';\nexport type ToastOptions = {\n /** Provide time in milliseconds after which the toast should autoclose */\n autoClose?: number;\n /**\n * State will change the icon displayed in toast and other characteristics,\n * for e.g. `loading` state will display a progress animation.\n * Default value is `default`\n */\n type?: ToastType;\n};\nexport type ToastContent = Omit<React.ReactNode, 'null' | 'undefined'>;\nexport type ToastProps = {\n /** Provide a unique id for toast */\n id: string;\n /**\n * Content can be any valid react node, for e.g. a `div`, or a simple text.\n */\n content: ToastContent;\n /** Additional options to define your toast */\n options: ToastOptions;\n /**\n * Handler called when toast closes.\n * To read more about how to provide the text, see [Provider](component:provider) component\n */\n onClose: () => void;\n lastUpdated?: number;\n lastDuplicateId?: string;\n};\n\nexport const Toast = ({ content, lastUpdated, onClose: handleClose, options, ...props }: ToastProps): JSX.Element => {\n const { texts } = useLocalization();\n const { autoClose, type = 'default' } = options;\n const className = cn('bg-white relative flex items-center py-1 px-2 mt-3 w-full rounded yt-shadow print:hidden', {\n 'border border-gray-500': type === 'default' || type === 'loading' || !type,\n 'border border-green-500': type === 'success',\n 'border border-blue-500': type === 'information',\n 'border border-yellow-500': type === 'warning',\n 'border border-red-500': type === 'error',\n });\n const timer = useTimer(autoClose, handleClose);\n const controls = useAnimation();\n\n if (!content) {\n // oxlint-disable-next-line no-console\n console.warn(getToastEmptyContentWarning(content));\n }\n\n React.useEffect(() => {\n if (autoClose) {\n timer.start();\n }\n }, [autoClose]);\n\n const triggerUpdateAnimation = async () => {\n await controls.start({ scale: 1.05 });\n await controls.start({ scale: 1 });\n };\n\n React.useEffect(() => {\n if (lastUpdated) {\n triggerUpdateAnimation();\n\n if (timer.running) {\n timer.start();\n }\n }\n }, [lastUpdated]);\n\n return (\n <motion.div\n {...props}\n animate={controls}\n className={className}\n data-taco=\"toast\"\n onMouseEnter={timer.pause}\n onMouseLeave={timer.resume}>\n {getBadgeIcon(type)}\n <div className=\"flex-grow\">{content as React.ReactNode}</div>\n <IconButton\n appearance=\"discrete\"\n className=\"-mr-2 cursor-pointer self-start !px-0 text-gray-700\"\n icon=\"close\"\n aria-label={texts.toasts.dismiss}\n onClick={handleClose}\n />\n </motion.div>\n );\n};\n"],"names":["useLocalization","useTimer","useAnimation","getToastEmptyContentWarning","motion","getBadgeIcon","IconButton"],"mappings":";;;;;;;;;AA4Ca,MAAA,QAAQ,CAAC,EAAE,SAAS,aAAa,SAAS,aAAa,SAAS,GAAG,YAAqC;AAC3G,QAAA,EAAE,MAAM,IAAIA,6BAAgB;AAClC,QAAM,EAAE,WAAW,OAAO,UAAc,IAAA;AAClC,QAAA,YAAY,GAAG,4FAA4F;AAAA,IAC7G,0BAA0B,SAAS,aAAa,SAAS,aAAa,CAAC;AAAA,IACvE,2BAA2B,SAAS;AAAA,IACpC,0BAA0B,SAAS;AAAA,IACnC,4BAA4B,SAAS;AAAA,IACrC,yBAAyB,SAAS;AAAA,EAAA,CACrC;AACK,QAAA,QAAQC,SAAAA,SAAS,WAAW,WAAW;AAC7C,QAAM,WAAWC,aAAAA,aAAa;AAE9B,MAAI,CAAC,SAAS;AAEF,YAAA,KAAKC,iCAA4B,OAAO,CAAC;AAAA,EAAA;AAGrD,QAAM,UAAU,MAAM;AAClB,QAAI,WAAW;AACX,YAAM,MAAM;AAAA,IAAA;AAAA,EAChB,GACD,CAAC,SAAS,CAAC;AAEd,QAAM,yBAAyB,YAAY;AACvC,UAAM,SAAS,MAAM,EAAE,OAAO,MAAM;AACpC,UAAM,SAAS,MAAM,EAAE,OAAO,GAAG;AAAA,EACrC;AAEA,QAAM,UAAU,MAAM;AAClB,QAAI,aAAa;AACU,6BAAA;AAEvB,UAAI,MAAM,SAAS;AACf,cAAM,MAAM;AAAA,MAAA;AAAA,IAChB;AAAA,EACJ,GACD,CAAC,WAAW,CAAC;AAGZ,SAAA,sBAAA;AAAA,IAACC,aAAAA,OAAO;AAAA,IAAP;AAAA,MACI,GAAG;AAAA,MACJ,SAAS;AAAA,MACT;AAAA,MACA,aAAU;AAAA,MACV,cAAc,MAAM;AAAA,MACpB,cAAc,MAAM;AAAA,IAAA;AAAA,IACnBC,KAAAA,aAAa,IAAI;AAAA,IACjB,sBAAA,cAAA,OAAA,EAAI,WAAU,YAAA,GAAa,OAA2B;AAAA,IACvD,sBAAA;AAAA,MAACC,WAAA;AAAA,MAAA;AAAA,QACG,YAAW;AAAA,QACX,WAAU;AAAA,QACV,MAAK;AAAA,QACL,cAAY,MAAM,OAAO;AAAA,QACzB,SAAS;AAAA,MAAA;AAAA,IAAA;AAAA,EAEjB;AAER;;"}
1
+ {"version":3,"file":"Toast.cjs","sources":["../../../src/components/Toast/Toast.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'clsx';\nimport { motion, useAnimation } from 'framer-motion';\nimport { useTimer } from '../../utils/hooks/useTimer';\nimport { getBadgeIcon, getToastEmptyContentWarning } from './util';\nimport type { State } from '../../types';\nimport { useLocalization } from '../Provider/Localization';\nimport { IconButton } from '../IconButton/IconButton';\n\nexport type ToastsTexts = {\n /** Aria-label for the close icon button of toast */\n dismiss: string;\n};\n\nexport type ToastType = Exclude<State, 'default'> | 'loading';\nexport type ToastOptions = {\n /** Provide time in milliseconds after which the toast should autoclose */\n autoClose?: number;\n /**\n * State will change the icon displayed in toast and other characteristics,\n * for e.g. `loading` state will display a progress animation.\n * Default value is `default`\n */\n type?: ToastType;\n};\nexport type ToastContent = Omit<React.ReactNode, 'null' | 'undefined'>;\nexport type ToastProps = {\n /** Provide a unique id for toast */\n id: string;\n /**\n * Content can be any valid react node, for e.g. a `div`, or a simple text.\n */\n content: ToastContent;\n /** Additional options to define your toast */\n options: ToastOptions;\n /**\n * Handler called when toast closes.\n * To read more about how to provide the text, see [Provider](component:provider) component\n */\n onClose: () => void;\n lastUpdated?: number;\n lastDuplicateId?: string;\n};\n\nexport const Toast = ({ content, lastUpdated, onClose: handleClose, options, ...props }: ToastProps): JSX.Element => {\n const { texts } = useLocalization();\n const { autoClose, type = 'default' } = options;\n const className = cn('bg-white relative flex items-center py-1 px-2 mt-3 w-full rounded yt-shadow print:hidden', {\n 'border border-gray-500': type === 'default' || type === 'loading' || !type,\n 'border border-green-500': type === 'success',\n 'border border-blue-500': type === 'information',\n 'border border-yellow-500': type === 'warning',\n 'border border-red-500': type === 'error',\n });\n const timer = useTimer(autoClose, handleClose);\n const controls = useAnimation();\n\n if (!content) {\n // oxlint-disable-next-line no-console\n console.warn(getToastEmptyContentWarning(content));\n }\n\n React.useEffect(() => {\n if (autoClose) {\n timer.start();\n }\n }, [autoClose]);\n\n const triggerUpdateAnimation = async () => {\n await controls.start({ scale: 1.05 });\n await controls.start({ scale: 1 });\n };\n\n React.useEffect(() => {\n if (lastUpdated) {\n triggerUpdateAnimation();\n\n if (timer.running) {\n timer.start();\n }\n }\n }, [lastUpdated]);\n\n return (\n <motion.div\n {...props}\n animate={controls}\n className={className}\n data-taco=\"toast\"\n onMouseEnter={timer.pause}\n onMouseLeave={timer.resume}>\n {getBadgeIcon(type)}\n <div className=\"flex-grow\">{content as React.ReactNode}</div>\n <IconButton\n appearance=\"discrete\"\n className=\"-mr-2 cursor-pointer self-start !px-0 text-gray-700\"\n icon=\"close\"\n aria-label={texts.toasts.dismiss}\n onClick={handleClose}\n />\n </motion.div>\n );\n};\n"],"names":["useLocalization","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AA,GAAa,OAA2B;AAAA,IACvD,sBAAA;AAAA,MAACC,WAAA;AAAA,MAAA;AAAA,QACG,YAAW;AAAA,QACX,WAAU;AAAA,QACV,MAAK;AAAA,QACL,cAAY,MAAM,OAAO;AAAA,QACzB,SAAS;AAAA,MAAA;AAAA,IAAA;AAAA,EAEjB;AAER;;"}
@@ -4,7 +4,7 @@ export type ToastsTexts = {
4
4
  /** Aria-label for the close icon button of toast */
5
5
  dismiss: string;
6
6
  };
7
- export type ToastType = Omit<State, 'default'> | 'loading';
7
+ export type ToastType = Exclude<State, 'default'> | 'loading';
8
8
  export type ToastOptions = {
9
9
  /** Provide time in milliseconds after which the toast should autoclose */
10
10
  autoClose?: number;
@@ -1 +1 @@
1
- {"version":3,"file":"Toast.js","sources":["../../../src/components/Toast/Toast.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'clsx';\nimport { motion, useAnimation } from 'framer-motion';\nimport { useTimer } from '../../utils/hooks/useTimer';\nimport { getBadgeIcon, getToastEmptyContentWarning } from './util';\nimport { State } from '../../types';\nimport { useLocalization } from '../Provider/Localization';\nimport { IconButton } from '../IconButton/IconButton';\n\nexport type ToastsTexts = {\n /** Aria-label for the close icon button of toast */\n dismiss: string;\n};\n\nexport type ToastType = Omit<State, 'default'> | 'loading';\nexport type ToastOptions = {\n /** Provide time in milliseconds after which the toast should autoclose */\n autoClose?: number;\n /**\n * State will change the icon displayed in toast and other characteristics,\n * for e.g. `loading` state will display a progress animation.\n * Default value is `default`\n */\n type?: ToastType;\n};\nexport type ToastContent = Omit<React.ReactNode, 'null' | 'undefined'>;\nexport type ToastProps = {\n /** Provide a unique id for toast */\n id: string;\n /**\n * Content can be any valid react node, for e.g. a `div`, or a simple text.\n */\n content: ToastContent;\n /** Additional options to define your toast */\n options: ToastOptions;\n /**\n * Handler called when toast closes.\n * To read more about how to provide the text, see [Provider](component:provider) component\n */\n onClose: () => void;\n lastUpdated?: number;\n lastDuplicateId?: string;\n};\n\nexport const Toast = ({ content, lastUpdated, onClose: handleClose, options, ...props }: ToastProps): JSX.Element => {\n const { texts } = useLocalization();\n const { autoClose, type = 'default' } = options;\n const className = cn('bg-white relative flex items-center py-1 px-2 mt-3 w-full rounded yt-shadow print:hidden', {\n 'border border-gray-500': type === 'default' || type === 'loading' || !type,\n 'border border-green-500': type === 'success',\n 'border border-blue-500': type === 'information',\n 'border border-yellow-500': type === 'warning',\n 'border border-red-500': type === 'error',\n });\n const timer = useTimer(autoClose, handleClose);\n const controls = useAnimation();\n\n if (!content) {\n // oxlint-disable-next-line no-console\n console.warn(getToastEmptyContentWarning(content));\n }\n\n React.useEffect(() => {\n if (autoClose) {\n timer.start();\n }\n }, [autoClose]);\n\n const triggerUpdateAnimation = async () => {\n await controls.start({ scale: 1.05 });\n await controls.start({ scale: 1 });\n };\n\n React.useEffect(() => {\n if (lastUpdated) {\n triggerUpdateAnimation();\n\n if (timer.running) {\n timer.start();\n }\n }\n }, [lastUpdated]);\n\n return (\n <motion.div\n {...props}\n animate={controls}\n className={className}\n data-taco=\"toast\"\n onMouseEnter={timer.pause}\n onMouseLeave={timer.resume}>\n {getBadgeIcon(type)}\n <div className=\"flex-grow\">{content as React.ReactNode}</div>\n <IconButton\n appearance=\"discrete\"\n className=\"-mr-2 cursor-pointer self-start !px-0 text-gray-700\"\n icon=\"close\"\n aria-label={texts.toasts.dismiss}\n onClick={handleClose}\n />\n </motion.div>\n );\n};\n"],"names":["React"],"mappings":";;;;;;;AA4Ca,MAAA,QAAQ,CAAC,EAAE,SAAS,aAAa,SAAS,aAAa,SAAS,GAAG,YAAqC;AAC3G,QAAA,EAAE,MAAM,IAAI,gBAAgB;AAClC,QAAM,EAAE,WAAW,OAAO,UAAc,IAAA;AAClC,QAAA,YAAY,GAAG,4FAA4F;AAAA,IAC7G,0BAA0B,SAAS,aAAa,SAAS,aAAa,CAAC;AAAA,IACvE,2BAA2B,SAAS;AAAA,IACpC,0BAA0B,SAAS;AAAA,IACnC,4BAA4B,SAAS;AAAA,IACrC,yBAAyB,SAAS;AAAA,EAAA,CACrC;AACK,QAAA,QAAQ,SAAS,WAAW,WAAW;AAC7C,QAAM,WAAW,aAAa;AAE9B,MAAI,CAAC,SAAS;AAEF,YAAA,KAAK,4BAA4B,OAAO,CAAC;AAAA,EAAA;AAGrDA,iBAAM,UAAU,MAAM;AAClB,QAAI,WAAW;AACX,YAAM,MAAM;AAAA,IAAA;AAAA,EAChB,GACD,CAAC,SAAS,CAAC;AAEd,QAAM,yBAAyB,YAAY;AACvC,UAAM,SAAS,MAAM,EAAE,OAAO,MAAM;AACpC,UAAM,SAAS,MAAM,EAAE,OAAO,GAAG;AAAA,EACrC;AAEAA,iBAAM,UAAU,MAAM;AAClB,QAAI,aAAa;AACU,6BAAA;AAEvB,UAAI,MAAM,SAAS;AACf,cAAM,MAAM;AAAA,MAAA;AAAA,IAChB;AAAA,EACJ,GACD,CAAC,WAAW,CAAC;AAGZ,SAAAA,+BAAA;AAAA,IAAC,OAAO;AAAA,IAAP;AAAA,MACI,GAAG;AAAA,MACJ,SAAS;AAAA,MACT;AAAA,MACA,aAAU;AAAA,MACV,cAAc,MAAM;AAAA,MACpB,cAAc,MAAM;AAAA,IAAA;AAAA,IACnB,aAAa,IAAI;AAAA,IACjBA,+BAAA,cAAA,OAAA,EAAI,WAAU,YAAA,GAAa,OAA2B;AAAA,IACvDA,+BAAA;AAAA,MAAC;AAAA,MAAA;AAAA,QACG,YAAW;AAAA,QACX,WAAU;AAAA,QACV,MAAK;AAAA,QACL,cAAY,MAAM,OAAO;AAAA,QACzB,SAAS;AAAA,MAAA;AAAA,IAAA;AAAA,EAEjB;AAER;"}
1
+ {"version":3,"file":"Toast.js","sources":["../../../src/components/Toast/Toast.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'clsx';\nimport { motion, useAnimation } from 'framer-motion';\nimport { useTimer } from '../../utils/hooks/useTimer';\nimport { getBadgeIcon, getToastEmptyContentWarning } from './util';\nimport type { State } from '../../types';\nimport { useLocalization } from '../Provider/Localization';\nimport { IconButton } from '../IconButton/IconButton';\n\nexport type ToastsTexts = {\n /** Aria-label for the close icon button of toast */\n dismiss: string;\n};\n\nexport type ToastType = Exclude<State, 'default'> | 'loading';\nexport type ToastOptions = {\n /** Provide time in milliseconds after which the toast should autoclose */\n autoClose?: number;\n /**\n * State will change the icon displayed in toast and other characteristics,\n * for e.g. `loading` state will display a progress animation.\n * Default value is `default`\n */\n type?: ToastType;\n};\nexport type ToastContent = Omit<React.ReactNode, 'null' | 'undefined'>;\nexport type ToastProps = {\n /** Provide a unique id for toast */\n id: string;\n /**\n * Content can be any valid react node, for e.g. a `div`, or a simple text.\n */\n content: ToastContent;\n /** Additional options to define your toast */\n options: ToastOptions;\n /**\n * Handler called when toast closes.\n * To read more about how to provide the text, see [Provider](component:provider) component\n */\n onClose: () => void;\n lastUpdated?: number;\n lastDuplicateId?: string;\n};\n\nexport const Toast = ({ content, lastUpdated, onClose: handleClose, options, ...props }: ToastProps): JSX.Element => {\n const { texts } = useLocalization();\n const { autoClose, type = 'default' } = options;\n const className = cn('bg-white relative flex items-center py-1 px-2 mt-3 w-full rounded yt-shadow print:hidden', {\n 'border border-gray-500': type === 'default' || type === 'loading' || !type,\n 'border border-green-500': type === 'success',\n 'border border-blue-500': type === 'information',\n 'border border-yellow-500': type === 'warning',\n 'border border-red-500': type === 'error',\n });\n const timer = useTimer(autoClose, handleClose);\n const controls = useAnimation();\n\n if (!content) {\n // oxlint-disable-next-line no-console\n console.warn(getToastEmptyContentWarning(content));\n }\n\n React.useEffect(() => {\n if (autoClose) {\n timer.start();\n }\n }, [autoClose]);\n\n const triggerUpdateAnimation = async () => {\n await controls.start({ scale: 1.05 });\n await controls.start({ scale: 1 });\n };\n\n React.useEffect(() => {\n if (lastUpdated) {\n triggerUpdateAnimation();\n\n if (timer.running) {\n timer.start();\n }\n }\n }, [lastUpdated]);\n\n return (\n <motion.div\n {...props}\n animate={controls}\n className={className}\n data-taco=\"toast\"\n onMouseEnter={timer.pause}\n onMouseLeave={timer.resume}>\n {getBadgeIcon(type)}\n <div className=\"flex-grow\">{content as React.ReactNode}</div>\n <IconButton\n appearance=\"discrete\"\n className=\"-mr-2 cursor-pointer self-start !px-0 text-gray-700\"\n icon=\"close\"\n aria-label={texts.toasts.dismiss}\n onClick={handleClose}\n />\n </motion.div>\n );\n};\n"],"names":["React"],"mappings":";;;;;;;AA4Ca,MAAA,QAAQ,CAAC,EAAE,SAAS,aAAa,SAAS,aAAa,SAAS,GAAG,YAAqC;AAC3G,QAAA,EAAE,MAAM,IAAI,gBAAgB;AAClC,QAAM,EAAE,WAAW,OAAO,UAAc,IAAA;AAClC,QAAA,YAAY,GAAG,4FAA4F;AAAA,IAC7G,0BAA0B,SAAS,aAAa,SAAS,aAAa,CAAC;AAAA,IACvE,2BAA2B,SAAS;AAAA,IACpC,0BAA0B,SAAS;AAAA,IACnC,4BAA4B,SAAS;AAAA,IACrC,yBAAyB,SAAS;AAAA,EAAA,CACrC;AACK,QAAA,QAAQ,SAAS,WAAW,WAAW;AAC7C,QAAM,WAAW,aAAa;AAE9B,MAAI,CAAC,SAAS;AAEF,YAAA,KAAK,4BAA4B,OAAO,CAAC;AAAA,EAAA;AAGrDA,iBAAM,UAAU,MAAM;AAClB,QAAI,WAAW;AACX,YAAM,MAAM;AAAA,IAAA;AAAA,EAChB,GACD,CAAC,SAAS,CAAC;AAEd,QAAM,yBAAyB,YAAY;AACvC,UAAM,SAAS,MAAM,EAAE,OAAO,MAAM;AACpC,UAAM,SAAS,MAAM,EAAE,OAAO,GAAG;AAAA,EACrC;AAEAA,iBAAM,UAAU,MAAM;AAClB,QAAI,aAAa;AACU,6BAAA;AAEvB,UAAI,MAAM,SAAS;AACf,cAAM,MAAM;AAAA,MAAA;AAAA,IAChB;AAAA,EACJ,GACD,CAAC,WAAW,CAAC;AAGZ,SAAAA,+BAAA;AAAA,IAAC,OAAO;AAAA,IAAP;AAAA,MACI,GAAG;AAAA,MACJ,SAAS;AAAA,MACT;AAAA,MACA,aAAU;AAAA,MACV,cAAc,MAAM;AAAA,MACpB,cAAc,MAAM;AAAA,IAAA;AAAA,IACnB,aAAa,IAAI;AAAA,IACjBA,+BAAA,cAAA,OAAA,EAAI,WAAU,YAAA,GAAa,OAA2B;AAAA,IACvDA,+BAAA;AAAA,MAAC;AAAA,MAAA;AAAA,QACG,YAAW;AAAA,QACX,WAAU;AAAA,QACV,MAAK;AAAA,QACL,cAAY,MAAM,OAAO;AAAA,QACzB,SAAS;AAAA,MAAA;AAAA,IAAA;AAAA,EAEjB;AAER;"}
@@ -1 +1 @@
1
- {"version":3,"file":"util.cjs","sources":["../../../src/components/Toast/util.tsx"],"sourcesContent":["import React from 'react';\nimport { Spinner } from '../Spinner/Spinner';\nimport { ToastContent, ToastType } from './Toast';\nimport { BadgeIcon } from '../BadgeIcon/BadgeIcon';\n\nexport const getBadgeIcon = (type: ToastType): JSX.Element | null => {\n return (\n <div className=\"mr-2 mt-[5px] flex-shrink-0 self-start\">\n {(() => {\n switch (type) {\n case 'success':\n return <BadgeIcon icon=\"tick\" color=\"green\" />;\n case 'error':\n return <BadgeIcon icon=\"close\" color=\"red\" />;\n case 'warning':\n return <BadgeIcon icon=\"warning\" color=\"yellow\" />;\n case 'information':\n return <BadgeIcon icon=\"info\" color=\"blue\" />;\n case 'loading':\n return <Spinner delay={0} className=\"h-5 w-5\" />;\n default:\n return null;\n }\n })()}\n </div>\n );\n};\n\nexport const getToastEmptyContentWarning = (content?: ToastContent) =>\n `Toast requires 'content' property, which can't be empty string, null or undefined. Current content value is set to ${\n content === '' ? 'empty string' : content\n }.`;\n"],"names":["BadgeIcon","Spinner"],"mappings":";;;;;AAKa,MAAA,eAAe,CAAC,SAAwC;AACjE,SACK,sBAAA,cAAA,OAAA,EAAI,WAAU,yCAAA,IACT,MAAM;AACJ,YAAQ,MAAM;AAAA,MACV,KAAK;AACD,eAAQ,sBAAA,cAAAA,qBAAA,EAAU,MAAK,QAAO,OAAM,SAAQ;AAAA,MAChD,KAAK;AACD,eAAQ,sBAAA,cAAAA,qBAAA,EAAU,MAAK,SAAQ,OAAM,OAAM;AAAA,MAC/C,KAAK;AACD,eAAQ,sBAAA,cAAAA,qBAAA,EAAU,MAAK,WAAU,OAAM,UAAS;AAAA,MACpD,KAAK;AACD,eAAQ,sBAAA,cAAAA,qBAAA,EAAU,MAAK,QAAO,OAAM,QAAO;AAAA,MAC/C,KAAK;AACD,eAAQ,sBAAA,cAAAC,iBAAA,EAAQ,OAAO,GAAG,WAAU,WAAU;AAAA,MAClD;AACW,eAAA;AAAA,IAAA;AAAA,EACf,IAER;AAER;AAEO,MAAM,8BAA8B,CAAC,YACxC,sHACI,YAAY,KAAK,iBAAiB,OACtC;;;"}
1
+ {"version":3,"file":"util.cjs","sources":["../../../src/components/Toast/util.tsx"],"sourcesContent":["import React from 'react';\nimport { Spinner } from '../Spinner/Spinner';\nimport { ToastContent, ToastType } from './Toast';\nimport { BadgeIcon } from '../BadgeIcon/BadgeIcon';\n\nexport const getBadgeIcon = (type: ToastType | 'default'): JSX.Element | null => {\n return (\n <div className=\"mr-2 mt-[5px] flex-shrink-0 self-start\">\n {(() => {\n switch (type) {\n case 'success':\n return <BadgeIcon icon=\"tick\" color=\"green\" />;\n case 'error':\n return <BadgeIcon icon=\"close\" color=\"red\" />;\n case 'warning':\n return <BadgeIcon icon=\"warning\" color=\"yellow\" />;\n case 'information':\n return <BadgeIcon icon=\"info\" color=\"blue\" />;\n case 'loading':\n return <Spinner delay={0} className=\"h-5 w-5\" />;\n default:\n return null;\n }\n })()}\n </div>\n );\n};\n\nexport const getToastEmptyContentWarning = (content?: ToastContent) =>\n `Toast requires 'content' property, which can't be empty string, null or undefined. Current content value is set to ${\n content === '' ? 'empty string' : content\n }.`;\n"],"names":["BadgeIcon","Spinner"],"mappings":";;;;;AAKa,MAAA,eAAe,CAAC,SAAoD;AAC7E,SACK,sBAAA,cAAA,OAAA,EAAI,WAAU,yCAAA,IACT,MAAM;AACJ,YAAQ,MAAM;AAAA,MACV,KAAK;AACD,eAAQ,sBAAA,cAAAA,qBAAA,EAAU,MAAK,QAAO,OAAM,SAAQ;AAAA,MAChD,KAAK;AACD,eAAQ,sBAAA,cAAAA,qBAAA,EAAU,MAAK,SAAQ,OAAM,OAAM;AAAA,MAC/C,KAAK;AACD,eAAQ,sBAAA,cAAAA,qBAAA,EAAU,MAAK,WAAU,OAAM,UAAS;AAAA,MACpD,KAAK;AACD,eAAQ,sBAAA,cAAAA,qBAAA,EAAU,MAAK,QAAO,OAAM,QAAO;AAAA,MAC/C,KAAK;AACD,eAAQ,sBAAA,cAAAC,iBAAA,EAAQ,OAAO,GAAG,WAAU,WAAU;AAAA,MAClD;AACW,eAAA;AAAA,IAAA;AAAA,EACf,IAER;AAER;AAEO,MAAM,8BAA8B,CAAC,YACxC,sHACI,YAAY,KAAK,iBAAiB,OACtC;;;"}
@@ -1,3 +1,3 @@
1
1
  import { ToastContent, ToastType } from './Toast';
2
- export declare const getBadgeIcon: (type: ToastType) => JSX.Element | null;
2
+ export declare const getBadgeIcon: (type: ToastType | "default") => JSX.Element | null;
3
3
  export declare const getToastEmptyContentWarning: (content?: ToastContent) => string;
@@ -1 +1 @@
1
- {"version":3,"file":"util.js","sources":["../../../src/components/Toast/util.tsx"],"sourcesContent":["import React from 'react';\nimport { Spinner } from '../Spinner/Spinner';\nimport { ToastContent, ToastType } from './Toast';\nimport { BadgeIcon } from '../BadgeIcon/BadgeIcon';\n\nexport const getBadgeIcon = (type: ToastType): JSX.Element | null => {\n return (\n <div className=\"mr-2 mt-[5px] flex-shrink-0 self-start\">\n {(() => {\n switch (type) {\n case 'success':\n return <BadgeIcon icon=\"tick\" color=\"green\" />;\n case 'error':\n return <BadgeIcon icon=\"close\" color=\"red\" />;\n case 'warning':\n return <BadgeIcon icon=\"warning\" color=\"yellow\" />;\n case 'information':\n return <BadgeIcon icon=\"info\" color=\"blue\" />;\n case 'loading':\n return <Spinner delay={0} className=\"h-5 w-5\" />;\n default:\n return null;\n }\n })()}\n </div>\n );\n};\n\nexport const getToastEmptyContentWarning = (content?: ToastContent) =>\n `Toast requires 'content' property, which can't be empty string, null or undefined. Current content value is set to ${\n content === '' ? 'empty string' : content\n }.`;\n"],"names":["React"],"mappings":";;;AAKa,MAAA,eAAe,CAAC,SAAwC;AACjE,SACKA,+BAAA,cAAA,OAAA,EAAI,WAAU,yCAAA,IACT,MAAM;AACJ,YAAQ,MAAM;AAAA,MACV,KAAK;AACD,eAAQA,+BAAA,cAAA,WAAA,EAAU,MAAK,QAAO,OAAM,SAAQ;AAAA,MAChD,KAAK;AACD,eAAQA,+BAAA,cAAA,WAAA,EAAU,MAAK,SAAQ,OAAM,OAAM;AAAA,MAC/C,KAAK;AACD,eAAQA,+BAAA,cAAA,WAAA,EAAU,MAAK,WAAU,OAAM,UAAS;AAAA,MACpD,KAAK;AACD,eAAQA,+BAAA,cAAA,WAAA,EAAU,MAAK,QAAO,OAAM,QAAO;AAAA,MAC/C,KAAK;AACD,eAAQA,+BAAA,cAAA,SAAA,EAAQ,OAAO,GAAG,WAAU,WAAU;AAAA,MAClD;AACW,eAAA;AAAA,IAAA;AAAA,EACf,IAER;AAER;AAEO,MAAM,8BAA8B,CAAC,YACxC,sHACI,YAAY,KAAK,iBAAiB,OACtC;"}
1
+ {"version":3,"file":"util.js","sources":["../../../src/components/Toast/util.tsx"],"sourcesContent":["import React from 'react';\nimport { Spinner } from '../Spinner/Spinner';\nimport { ToastContent, ToastType } from './Toast';\nimport { BadgeIcon } from '../BadgeIcon/BadgeIcon';\n\nexport const getBadgeIcon = (type: ToastType | 'default'): JSX.Element | null => {\n return (\n <div className=\"mr-2 mt-[5px] flex-shrink-0 self-start\">\n {(() => {\n switch (type) {\n case 'success':\n return <BadgeIcon icon=\"tick\" color=\"green\" />;\n case 'error':\n return <BadgeIcon icon=\"close\" color=\"red\" />;\n case 'warning':\n return <BadgeIcon icon=\"warning\" color=\"yellow\" />;\n case 'information':\n return <BadgeIcon icon=\"info\" color=\"blue\" />;\n case 'loading':\n return <Spinner delay={0} className=\"h-5 w-5\" />;\n default:\n return null;\n }\n })()}\n </div>\n );\n};\n\nexport const getToastEmptyContentWarning = (content?: ToastContent) =>\n `Toast requires 'content' property, which can't be empty string, null or undefined. Current content value is set to ${\n content === '' ? 'empty string' : content\n }.`;\n"],"names":["React"],"mappings":";;;AAKa,MAAA,eAAe,CAAC,SAAoD;AAC7E,SACKA,+BAAA,cAAA,OAAA,EAAI,WAAU,yCAAA,IACT,MAAM;AACJ,YAAQ,MAAM;AAAA,MACV,KAAK;AACD,eAAQA,+BAAA,cAAA,WAAA,EAAU,MAAK,QAAO,OAAM,SAAQ;AAAA,MAChD,KAAK;AACD,eAAQA,+BAAA,cAAA,WAAA,EAAU,MAAK,SAAQ,OAAM,OAAM;AAAA,MAC/C,KAAK;AACD,eAAQA,+BAAA,cAAA,WAAA,EAAU,MAAK,WAAU,OAAM,UAAS;AAAA,MACpD,KAAK;AACD,eAAQA,+BAAA,cAAA,WAAA,EAAU,MAAK,QAAO,OAAM,QAAO;AAAA,MAC/C,KAAK;AACD,eAAQA,+BAAA,cAAA,SAAA,EAAQ,OAAO,GAAG,WAAU,WAAU;AAAA,MAClD;AACW,eAAA;AAAA,IAAA;AAAA,EACf,IAER;AAER;AAEO,MAAM,8BAA8B,CAAC,YACxC,sHACI,YAAY,KAAK,iBAAiB,OACtC;"}
@@ -1 +1 @@
1
- export declare function useTacoSettings(): import('../components/Provider/Provider').TacoSettings;
1
+ export declare function useTacoSettings(): import('..').TacoSettings;
@@ -64,7 +64,7 @@ declare module '@tanstack/table-core' {
64
64
  }
65
65
  export declare function useTableManager<TType = unknown, TMeta = object>(props: TableProps<TType>, ref: React.RefObject<TableRef>, meta?: Partial<ReactTableMeta<TType>> & TMeta, internalColumns?: useTableManagerInternalColumns<TType>): {
66
66
  id: string;
67
- instance: import('@tanstack/react-table').Table<TType>;
67
+ instance: import('@tanstack/table-core').Table<TType>;
68
68
  meta: ReactTableMeta<TType> & TMeta;
69
- state: import('@tanstack/react-table').TableState;
69
+ state: import('@tanstack/table-core').TableState;
70
70
  };
@@ -1,12 +1,12 @@
1
1
  import { ColumnSizingState, Table as ReactTable } from '@tanstack/react-table';
2
2
  export declare function getSettings<TType = unknown>(table: ReactTable<TType>): {
3
- columnOrder: import('@tanstack/react-table').ColumnOrderState | undefined;
4
- columnPinning: import('@tanstack/react-table').ColumnPinningState;
3
+ columnOrder: import('@tanstack/table-core').ColumnOrderState | undefined;
4
+ columnPinning: import('@tanstack/table-core').ColumnPinningState;
5
5
  columnSizing: {};
6
- columnVisibility: import('@tanstack/react-table').VisibilityState | undefined;
6
+ columnVisibility: import('@tanstack/table-core').VisibilityState | undefined;
7
7
  excludeUnmatchedRecordsInSearch: boolean | undefined;
8
8
  fontSize: "small" | "medium" | "large" | undefined;
9
9
  rowHeight: import('../../types').TableRowHeight | undefined;
10
- sorting: import('@tanstack/react-table').SortingState;
10
+ sorting: import('@tanstack/table-core').SortingState;
11
11
  };
12
12
  export declare function ignoreInternalColumns(data: ColumnSizingState): {};
@@ -4,5 +4,5 @@ export declare const createFakeData: (creator: (faker: Faker) => any, ...length:
4
4
  export declare const getRandomNumber: (max: number, min?: number) => number;
5
5
  export declare const iconNames: string[];
6
6
  export declare const generateId: () => string;
7
- export declare const sleep: (ms: number) => Promise<unknown>;
7
+ export declare const sleep: (ms: number) => Promise<void>;
8
8
  export { sort };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@economic/taco",
3
- "version": "8.1.3-alpha.0",
3
+ "version": "8.1.4-hanger-base-ui-migration.0",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -29,13 +29,16 @@
29
29
  "scripts/stylelint-plugin"
30
30
  ],
31
31
  "scripts": {
32
- "build": "npx tsc --noEmit && vite build",
32
+ "build": "vite build",
33
+ "prebuild": "npx tsc --noEmit",
33
34
  "test": "vitest run",
35
+ "test:watch": "vitest",
34
36
  "lint": "npm run lint:styles && oxlint --quiet",
35
37
  "lint:styles": "stylelint \"src/**/*.css\" --config ./stylelint.config.mjs --allow-empty-input",
36
38
  "pree2e": "npx playwright install chromium --with-deps",
37
39
  "e2e": "npx playwright test",
38
- "generate-icons": "node scripts/generate-icons.cjs"
40
+ "generate-icons": "node scripts/generate-icons.cjs",
41
+ "typecheck": "npx tsc --noEmit"
39
42
  },
40
43
  "dependencies": {
41
44
  "@base-ui/react": "1.5.0",
@@ -43,8 +46,7 @@
43
46
  "@dnd-kit/modifiers": "^7.0.0",
44
47
  "@dnd-kit/sortable": "^7.0.2",
45
48
  "@dnd-kit/utilities": "^3.2.2",
46
- "@economic/taco-tokens": "^2.2.5-alpha.0",
47
- "@radix-ui/react-popover": "1.0.2",
49
+ "@economic/taco-tokens": "^2.2.6-hanger-base-ui-migration.0",
48
50
  "@radix-ui/react-scroll-area": "1.2.10",
49
51
  "@react-aria/focus": "^3.19.0",
50
52
  "@react-aria/interactions": "^3.12.0",
@@ -54,7 +56,7 @@
54
56
  "date-fns": "^3.6.0",
55
57
  "framer-motion": "12.38.0",
56
58
  "lodash": "^4.17.21",
57
- "nanoid": "^5.1.11",
59
+ "nanoid": "^5.1.15",
58
60
  "react-aria-components": "^1.7.1",
59
61
  "react-day-picker": "^9.11.0",
60
62
  "react-intersection-observer": "^9.4.0",
@@ -71,13 +73,13 @@
71
73
  "tailwindcss": ">=3.4.19"
72
74
  },
73
75
  "devDependencies": {
74
- "@oxlint/plugins": "^1.69.0",
76
+ "@oxlint/plugins": "^1.70.0",
75
77
  "@svgr/cli": "^5.5.0",
76
78
  "@testing-library/jest-dom": "6.9.1",
77
79
  "@testing-library/react": "16.3.2",
78
80
  "@testing-library/user-event": "14.6.1",
79
81
  "@types/lodash": "^4.17.24",
80
- "@types/node": "^22.19.21",
82
+ "@types/node": "^22.20.0",
81
83
  "@types/react": "18.3.31",
82
84
  "@types/react-dom": "18.3.7",
83
85
  "@types/react-table": "^7.7.20",
@@ -97,7 +99,7 @@
97
99
  "vitest": "^3.2.6"
98
100
  },
99
101
  "optionalDependencies": {
100
- "@rollup/rollup-linux-x64-gnu": "^4.62.0"
102
+ "@rollup/rollup-linux-x64-gnu": "^4.62.2"
101
103
  },
102
- "gitHead": "e2b2169e5fbc9a76f671e2eac5b6532a2e68336a"
104
+ "gitHead": "7313e299dd784f75e596baa8d386d5a5be1a2b5f"
103
105
  }