@frontify/fondue-components 23.0.0-rc.1 → 23.0.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 (177) hide show
  1. package/dist/fondue-components.js +46 -50
  2. package/dist/fondue-components.js.map +1 -1
  3. package/dist/fondue-components10.js +27 -24
  4. package/dist/fondue-components10.js.map +1 -1
  5. package/dist/fondue-components11.js +86 -104
  6. package/dist/fondue-components11.js.map +1 -1
  7. package/dist/fondue-components12.js +2 -2
  8. package/dist/fondue-components13.js +82 -79
  9. package/dist/fondue-components13.js.map +1 -1
  10. package/dist/fondue-components14.js +2 -2
  11. package/dist/fondue-components15.js +2 -2
  12. package/dist/fondue-components16.js +2 -2
  13. package/dist/fondue-components17.js +36 -56
  14. package/dist/fondue-components17.js.map +1 -1
  15. package/dist/fondue-components18.js +16 -34
  16. package/dist/fondue-components18.js.map +1 -1
  17. package/dist/fondue-components19.js +73 -18
  18. package/dist/fondue-components19.js.map +1 -1
  19. package/dist/fondue-components20.js +36 -18
  20. package/dist/fondue-components20.js.map +1 -1
  21. package/dist/fondue-components21.js +50 -71
  22. package/dist/fondue-components21.js.map +1 -1
  23. package/dist/fondue-components22.js +138 -36
  24. package/dist/fondue-components22.js.map +1 -1
  25. package/dist/fondue-components23.js +50 -50
  26. package/dist/fondue-components23.js.map +1 -1
  27. package/dist/fondue-components24.js +33 -138
  28. package/dist/fondue-components24.js.map +1 -1
  29. package/dist/fondue-components25.js +193 -52
  30. package/dist/fondue-components25.js.map +1 -1
  31. package/dist/fondue-components26.js +137 -29
  32. package/dist/fondue-components26.js.map +1 -1
  33. package/dist/fondue-components27.js +127 -170
  34. package/dist/fondue-components27.js.map +1 -1
  35. package/dist/fondue-components28.js +30 -134
  36. package/dist/fondue-components28.js.map +1 -1
  37. package/dist/fondue-components29.js +63 -130
  38. package/dist/fondue-components29.js.map +1 -1
  39. package/dist/fondue-components3.js +1 -1
  40. package/dist/fondue-components30.js +101 -31
  41. package/dist/fondue-components30.js.map +1 -1
  42. package/dist/fondue-components31.js +29 -63
  43. package/dist/fondue-components31.js.map +1 -1
  44. package/dist/fondue-components32.js +52 -98
  45. package/dist/fondue-components32.js.map +1 -1
  46. package/dist/fondue-components33.js +20 -12
  47. package/dist/fondue-components33.js.map +1 -1
  48. package/dist/fondue-components34.js +23 -56
  49. package/dist/fondue-components34.js.map +1 -1
  50. package/dist/fondue-components35.js +7 -20
  51. package/dist/fondue-components35.js.map +1 -1
  52. package/dist/fondue-components36.js +6 -7
  53. package/dist/fondue-components36.js.map +1 -1
  54. package/dist/fondue-components37.js +32 -7
  55. package/dist/fondue-components37.js.map +1 -1
  56. package/dist/fondue-components38.js +5 -32
  57. package/dist/fondue-components38.js.map +1 -1
  58. package/dist/fondue-components39.js +12 -5
  59. package/dist/fondue-components39.js.map +1 -1
  60. package/dist/fondue-components4.js +35 -31
  61. package/dist/fondue-components4.js.map +1 -1
  62. package/dist/fondue-components40.js +153 -18
  63. package/dist/fondue-components40.js.map +1 -1
  64. package/dist/fondue-components41.js +22 -59
  65. package/dist/fondue-components41.js.map +1 -1
  66. package/dist/fondue-components42.js +19 -19
  67. package/dist/fondue-components42.js.map +1 -1
  68. package/dist/fondue-components43.js +15 -112
  69. package/dist/fondue-components43.js.map +1 -1
  70. package/dist/fondue-components44.js +30 -19
  71. package/dist/fondue-components44.js.map +1 -1
  72. package/dist/fondue-components45.js +54 -32
  73. package/dist/fondue-components45.js.map +1 -1
  74. package/dist/fondue-components46.js +125 -47
  75. package/dist/fondue-components46.js.map +1 -1
  76. package/dist/fondue-components47.js +20 -129
  77. package/dist/fondue-components47.js.map +1 -1
  78. package/dist/fondue-components48.js +53 -21
  79. package/dist/fondue-components48.js.map +1 -1
  80. package/dist/fondue-components49.js +8 -53
  81. package/dist/fondue-components49.js.map +1 -1
  82. package/dist/fondue-components5.js +2 -2
  83. package/dist/fondue-components50.js +13 -8
  84. package/dist/fondue-components50.js.map +1 -1
  85. package/dist/fondue-components51.js +15 -13
  86. package/dist/fondue-components51.js.map +1 -1
  87. package/dist/fondue-components52.js +4 -14
  88. package/dist/fondue-components52.js.map +1 -1
  89. package/dist/fondue-components53.js +60 -5
  90. package/dist/fondue-components53.js.map +1 -1
  91. package/dist/fondue-components54.js +17 -58
  92. package/dist/fondue-components54.js.map +1 -1
  93. package/dist/fondue-components55.js +19 -18
  94. package/dist/fondue-components55.js.map +1 -1
  95. package/dist/fondue-components56.js +4 -18
  96. package/dist/fondue-components56.js.map +1 -1
  97. package/dist/fondue-components57.js +13 -3
  98. package/dist/fondue-components57.js.map +1 -1
  99. package/dist/fondue-components58.js +3 -11
  100. package/dist/fondue-components58.js.map +1 -1
  101. package/dist/fondue-components59.js +17 -3
  102. package/dist/fondue-components59.js.map +1 -1
  103. package/dist/fondue-components6.js +4 -4
  104. package/dist/fondue-components60.js +10 -17
  105. package/dist/fondue-components60.js.map +1 -1
  106. package/dist/fondue-components61.js +35 -11
  107. package/dist/fondue-components61.js.map +1 -1
  108. package/dist/fondue-components62.js +4 -36
  109. package/dist/fondue-components62.js.map +1 -1
  110. package/dist/fondue-components63.js +13 -35
  111. package/dist/fondue-components63.js.map +1 -1
  112. package/dist/fondue-components64.js +1 -1
  113. package/dist/fondue-components65.js +24 -12
  114. package/dist/fondue-components65.js.map +1 -1
  115. package/dist/fondue-components66.js +16 -4
  116. package/dist/fondue-components66.js.map +1 -1
  117. package/dist/fondue-components67.js +150 -23
  118. package/dist/fondue-components67.js.map +1 -1
  119. package/dist/fondue-components68.js +19 -17
  120. package/dist/fondue-components68.js.map +1 -1
  121. package/dist/fondue-components69.js +75 -148
  122. package/dist/fondue-components69.js.map +1 -1
  123. package/dist/fondue-components7.js +2 -2
  124. package/dist/fondue-components70.js +8 -19
  125. package/dist/fondue-components70.js.map +1 -1
  126. package/dist/fondue-components71.js +36 -77
  127. package/dist/fondue-components71.js.map +1 -1
  128. package/dist/fondue-components72.js +71 -8
  129. package/dist/fondue-components72.js.map +1 -1
  130. package/dist/fondue-components73.js +10 -36
  131. package/dist/fondue-components73.js.map +1 -1
  132. package/dist/fondue-components74.js +12 -70
  133. package/dist/fondue-components74.js.map +1 -1
  134. package/dist/fondue-components75.js +12 -10
  135. package/dist/fondue-components75.js.map +1 -1
  136. package/dist/fondue-components76.js +22 -12
  137. package/dist/fondue-components76.js.map +1 -1
  138. package/dist/fondue-components77.js +34 -13
  139. package/dist/fondue-components77.js.map +1 -1
  140. package/dist/fondue-components78.js +10 -22
  141. package/dist/fondue-components78.js.map +1 -1
  142. package/dist/fondue-components79.js +67 -33
  143. package/dist/fondue-components79.js.map +1 -1
  144. package/dist/fondue-components8.js +5 -5
  145. package/dist/fondue-components80.js +11 -7
  146. package/dist/fondue-components80.js.map +1 -1
  147. package/dist/fondue-components81.js +25 -67
  148. package/dist/fondue-components81.js.map +1 -1
  149. package/dist/fondue-components82.js +18 -14
  150. package/dist/fondue-components82.js.map +1 -1
  151. package/dist/fondue-components83.js +21 -23
  152. package/dist/fondue-components83.js.map +1 -1
  153. package/dist/fondue-components84.js +6 -18
  154. package/dist/fondue-components84.js.map +1 -1
  155. package/dist/fondue-components85.js +19 -22
  156. package/dist/fondue-components85.js.map +1 -1
  157. package/dist/fondue-components86.js +6 -8
  158. package/dist/fondue-components86.js.map +1 -1
  159. package/dist/fondue-components87.js +3 -5
  160. package/dist/fondue-components87.js.map +1 -1
  161. package/dist/fondue-components88.js +5 -2
  162. package/dist/fondue-components88.js.map +1 -1
  163. package/dist/fondue-components89.js +15 -3
  164. package/dist/fondue-components89.js.map +1 -1
  165. package/dist/fondue-components9.js +92 -88
  166. package/dist/fondue-components9.js.map +1 -1
  167. package/dist/fondue-components90.js +2 -5
  168. package/dist/fondue-components90.js.map +1 -1
  169. package/dist/fondue-components91.js +39 -16
  170. package/dist/fondue-components91.js.map +1 -1
  171. package/dist/fondue-components92.js +20 -39
  172. package/dist/fondue-components92.js.map +1 -1
  173. package/dist/index.d.ts +58 -118
  174. package/dist/style.css +1 -1
  175. package/package.json +10 -7
  176. package/dist/fondue-components93.js +0 -9
  177. package/dist/fondue-components93.js.map +0 -1
@@ -1,24 +1,35 @@
1
- import { FOCUS_OUTLINE as t } from "./fondue-components88.js";
2
- import { sv as e } from "./fondue-components40.js";
3
- const r = e({
4
- base: `tw-peer tw-relative tw-inline-flex tw-bg-surface tw-text-white tw-shrink-0 tw-rounded-medium tw-border tw-border-line-strong group-hover:tw-border-line-strong hover:tw-border-line-strong tw-transition-colors data-[state="checked"]:tw-border-transparent data-[state="indeterminate"]:tw-border-transparent disabled:tw-border-line-strong disabled:tw-bg-surface disabled:tw-cursor-not-allowed data-[state="checked"]:disabled:tw-bg-disabled data-[readonly="true"]:tw-pointer-events-none ${t}`,
5
- variants: {
6
- size: {
7
- default: "tw-size-4",
8
- large: "tw-size-5"
9
- },
10
- emphasis: {
11
- default: 'data-[state="checked"]:tw-bg-highlight data-[state="checked"]:hover:tw-bg-highlight-hover data-[state="checked"]:active:tw-bg-highlight-active data-[state="indeterminate"]:tw-bg-highlight data-[state="indeterminate"]:hover:tw-bg-highlight-hover data-[state="indeterminate"]:active:tw-bg-highlight-active ',
12
- weak: 'data-[state="checked"]:tw-bg-primary data-[state="checked"]:hover:tw-bg-primary-hover data-[state="checked"]:active:tw-bg-primary-active data-[state="indeterminate"]:tw-bg-primary data-[state="indeterminate"]:hover:tw-bg-primary-hover data-[state="indeterminate"]:active:tw-bg-primary-active '
13
- }
1
+ import { jsx as r } from "react/jsx-runtime";
2
+ import { forwardRef as m } from "react";
3
+ import { RgbaColorPicker as n } from "react-colorful";
4
+ import t from "./fondue-components47.js";
5
+ import { DEFAULT_COLOR as s } from "./fondue-components48.js";
6
+ const i = ({
7
+ currentColor: a = s,
8
+ onColorChange: d = () => {
14
9
  },
15
- defaultVariants: {
16
- size: "default",
17
- emphasis: "default"
10
+ "data-test-id": o = "color-picker-input"
11
+ }, p) => /* @__PURE__ */ r("div", { className: t.gradientInput, "data-test-id": o, ref: p, children: /* @__PURE__ */ r(
12
+ n,
13
+ {
14
+ className: t.reactColorful,
15
+ color: {
16
+ r: a.red,
17
+ g: a.green,
18
+ b: a.blue,
19
+ a: a.alpha === void 0 ? 1 : a.alpha
20
+ },
21
+ onChange: (e) => d({
22
+ red: e.r,
23
+ green: e.g,
24
+ blue: e.b,
25
+ alpha: e.a
26
+ })
18
27
  }
19
- }), d = 'tw-group tw-absolute tw-inset-0 tw-inline-flex tw-items-center tw-justify-center tw-text-current tw-opacity-0 data-[state="checked"]:tw-opacity-100 data-[state="indeterminate"]:tw-opacity-100 tw-transition-opacity ';
28
+ ) });
29
+ i.displayName = "ColorPicker.Gradient";
30
+ const c = m(i);
20
31
  export {
21
- d as checkboxIndicatorStyles,
22
- r as checkboxStyles
32
+ i as ColorGradientInput,
33
+ c as ForwardedRefColorGradientInput
23
34
  };
24
35
  //# sourceMappingURL=fondue-components44.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"fondue-components44.js","sources":["../src/components/Checkbox/styles/checkboxStyles.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { FOCUS_OUTLINE } from '#/utilities/focusStyle';\nimport { sv } from '#/utilities/styleUtilities';\n\nexport const checkboxStyles = sv({\n base:\n 'tw-peer tw-relative tw-inline-flex tw-bg-surface tw-text-white tw-shrink-0 tw-rounded-medium tw-border tw-border-line-strong group-hover:tw-border-line-strong hover:tw-border-line-strong tw-transition-colors ' +\n 'data-[state=\"checked\"]:tw-border-transparent data-[state=\"indeterminate\"]:tw-border-transparent ' +\n 'disabled:tw-border-line-strong disabled:tw-bg-surface disabled:tw-cursor-not-allowed data-[state=\"checked\"]:disabled:tw-bg-disabled ' +\n 'data-[readonly=\"true\"]:tw-pointer-events-none ' +\n `${FOCUS_OUTLINE}`,\n variants: {\n size: {\n default: 'tw-size-4',\n large: 'tw-size-5',\n },\n emphasis: {\n default:\n 'data-[state=\"checked\"]:tw-bg-highlight data-[state=\"checked\"]:hover:tw-bg-highlight-hover data-[state=\"checked\"]:active:tw-bg-highlight-active ' +\n 'data-[state=\"indeterminate\"]:tw-bg-highlight data-[state=\"indeterminate\"]:hover:tw-bg-highlight-hover data-[state=\"indeterminate\"]:active:tw-bg-highlight-active ',\n weak:\n 'data-[state=\"checked\"]:tw-bg-primary data-[state=\"checked\"]:hover:tw-bg-primary-hover data-[state=\"checked\"]:active:tw-bg-primary-active ' +\n 'data-[state=\"indeterminate\"]:tw-bg-primary data-[state=\"indeterminate\"]:hover:tw-bg-primary-hover data-[state=\"indeterminate\"]:active:tw-bg-primary-active ',\n },\n },\n defaultVariants: {\n size: 'default',\n emphasis: 'default',\n },\n});\n\nexport const checkboxIndicatorStyles =\n 'tw-group tw-absolute tw-inset-0 tw-inline-flex tw-items-center tw-justify-center tw-text-current ' +\n 'tw-opacity-0 data-[state=\"checked\"]:tw-opacity-100 data-[state=\"indeterminate\"]:tw-opacity-100 tw-transition-opacity ';\n"],"names":["checkboxStyles","sv","FOCUS_OUTLINE","checkboxIndicatorStyles"],"mappings":";;AAKO,MAAMA,IAAiBC,EAAG;AAAA,EAC7B,MACI,qeAIGC,CAAa;AAAA,EACpB,UAAU;AAAA,IACN,MAAM;AAAA,MACF,SAAS;AAAA,MACT,OAAO;AAAA,IAAA;AAAA,IAEX,UAAU;AAAA,MACN,SACI;AAAA,MAEJ,MACI;AAAA,IAAA;AAAA,EAER;AAAA,EAEJ,iBAAiB;AAAA,IACb,MAAM;AAAA,IACN,UAAU;AAAA,EAAA;AAElB,CAAC,GAEYC,IACT;"}
1
+ {"version":3,"file":"fondue-components44.js","sources":["../src/components/ColorPicker/ColorGradientInput.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type ForwardedRef, forwardRef } from 'react';\nimport { RgbaColorPicker } from 'react-colorful';\n\nimport styles from './styles/customColorPicker.module.scss';\nimport { type RgbaColor } from './types';\nimport { DEFAULT_COLOR } from './utils';\n\ntype ColorGradientInputProps = {\n /**\n * @ignore\n * The active color in the color picker, passed down from the root component\n */\n currentColor?: RgbaColor;\n /**\n * @ignore\n * Event handler called when the color changes, passed down from the root component\n */\n onColorChange?: (color: RgbaColor) => void;\n /**\n * The test id of the color picker gradient input\n */\n 'data-test-id'?: string;\n};\n\nexport const ColorGradientInput = (\n {\n currentColor = DEFAULT_COLOR,\n onColorChange = () => {},\n 'data-test-id': dataTestId = 'color-picker-input',\n }: ColorGradientInputProps,\n forwardedRef: ForwardedRef<HTMLDivElement>,\n) => {\n return (\n <div className={styles.gradientInput} data-test-id={dataTestId} ref={forwardedRef}>\n <RgbaColorPicker\n className={styles.reactColorful}\n color={{\n r: currentColor.red,\n g: currentColor.green,\n b: currentColor.blue,\n a: currentColor.alpha === undefined ? 1 : currentColor.alpha,\n }}\n onChange={(color) =>\n onColorChange({\n red: color.r,\n green: color.g,\n blue: color.b,\n alpha: color.a,\n })\n }\n />\n </div>\n );\n};\nColorGradientInput.displayName = 'ColorPicker.Gradient';\n\nexport const ForwardedRefColorGradientInput = forwardRef<HTMLDivElement, ColorGradientInputProps>(ColorGradientInput);\n"],"names":["ColorGradientInput","currentColor","DEFAULT_COLOR","onColorChange","dataTestId","forwardedRef","jsx","styles","RgbaColorPicker","color","ForwardedRefColorGradientInput","forwardRef"],"mappings":";;;;;AA0BO,MAAMA,IAAqB,CAC9B;AAAA,EACI,cAAAC,IAAeC;AAAA,EACf,eAAAC,IAAgB,MAAM;AAAA,EAAC;AAAA,EACvB,gBAAgBC,IAAa;AACjC,GACAC,MAGI,gBAAAC,EAAC,SAAI,WAAWC,EAAO,eAAe,gBAAcH,GAAY,KAAKC,GACjE,UAAA,gBAAAC;AAAA,EAACE;AAAA,EAAA;AAAA,IACG,WAAWD,EAAO;AAAA,IAClB,OAAO;AAAA,MACH,GAAGN,EAAa;AAAA,MAChB,GAAGA,EAAa;AAAA,MAChB,GAAGA,EAAa;AAAA,MAChB,GAAGA,EAAa,UAAU,SAAY,IAAIA,EAAa;AAAA,IAAA;AAAA,IAE3D,UAAU,CAACQ,MACPN,EAAc;AAAA,MACV,KAAKM,EAAM;AAAA,MACX,OAAOA,EAAM;AAAA,MACb,MAAMA,EAAM;AAAA,MACZ,OAAOA,EAAM;AAAA,IAAA,CAChB;AAAA,EAAA;AAAA,GAGb;AAGRT,EAAmB,cAAc;AAE1B,MAAMU,IAAiCC,EAAoDX,CAAkB;"}
@@ -1,35 +1,57 @@
1
- import { jsx as r } from "react/jsx-runtime";
2
- import { forwardRef as m } from "react";
3
- import { RgbaColorPicker as n } from "react-colorful";
4
- import t from "./fondue-components48.js";
5
- import { DEFAULT_COLOR as s } from "./fondue-components49.js";
6
- const i = ({
7
- currentColor: a = s,
8
- onColorChange: d = () => {
9
- },
10
- "data-test-id": o = "color-picker-input"
11
- }, p) => /* @__PURE__ */ r("div", { className: t.gradientInput, "data-test-id": o, ref: p, children: /* @__PURE__ */ r(
12
- n,
13
- {
14
- className: t.reactColorful,
15
- color: {
16
- r: a.red,
17
- g: a.green,
18
- b: a.blue,
19
- a: a.alpha === void 0 ? 1 : a.alpha
20
- },
21
- onChange: (e) => d({
22
- red: e.r,
23
- green: e.g,
24
- blue: e.b,
25
- alpha: e.a
26
- })
27
- }
28
- ) });
29
- i.displayName = "ColorPicker.Gradient";
30
- const c = m(i);
1
+ import { jsxs as t, jsx as s, Fragment as h } from "react/jsx-runtime";
2
+ import { IconDroplet as I, IconCross as k, IconCaretDown as v } from "@frontify/fondue-icons";
3
+ import { forwardRef as P } from "react";
4
+ import { useTranslation as w } from "./fondue-components34.js";
5
+ import { Button as y } from "./fondue-components6.js";
6
+ import a from "./fondue-components89.js";
7
+ import { getColorWithName as z, colorToCss as x } from "./fondue-components48.js";
8
+ const c = ({
9
+ id: m,
10
+ currentColor: e,
11
+ isOpen: l,
12
+ disabled: o = !1,
13
+ onClear: i,
14
+ onClick: r,
15
+ "data-test-id": d = "color-picker-input",
16
+ ...n
17
+ }, p) => {
18
+ const { t: f } = w(), N = (e == null ? void 0 : e.name) ?? (e ? z(e, "RGBA").name : "");
19
+ return /* @__PURE__ */ t("div", { id: m, className: a.root, ref: p, "data-test-id": d, children: [
20
+ /* @__PURE__ */ t(
21
+ "button",
22
+ {
23
+ className: a.button,
24
+ ...n,
25
+ disabled: o,
26
+ onClick: r,
27
+ type: "button",
28
+ "data-color-input-select": !0,
29
+ children: [
30
+ (e == null ? void 0 : e.red) !== void 0 ? /* @__PURE__ */ s(
31
+ "div",
32
+ {
33
+ "aria-hidden": !0,
34
+ className: a.colorIndicator,
35
+ style: { "--active-color": x(e) }
36
+ }
37
+ ) : /* @__PURE__ */ t(h, { children: [
38
+ /* @__PURE__ */ s(I, { size: 16 }),
39
+ /* @__PURE__ */ s("span", { children: f("ColorPicker_selectColor") })
40
+ ] }),
41
+ /* @__PURE__ */ s("span", { className: a.colorName, children: N })
42
+ ]
43
+ }
44
+ ),
45
+ /* @__PURE__ */ t("div", { className: a.actions, children: [
46
+ i && /* @__PURE__ */ s(y, { onPress: i, disabled: o, size: "small", emphasis: "weak", aspect: "square", children: /* @__PURE__ */ s(k, { className: a.clearIcon, size: 16 }) }),
47
+ /* @__PURE__ */ s("div", { className: a.caret, "data-state": l ? "open" : "closed", children: /* @__PURE__ */ s(v, { size: 16, className: a.caret }) })
48
+ ] })
49
+ ] });
50
+ };
51
+ c.displayName = "ColorPicker.Input";
52
+ const F = P(c);
31
53
  export {
32
- i as ColorGradientInput,
33
- c as ForwardedRefColorGradientInput
54
+ c as ColorPickerInput,
55
+ F as ForwardedRefColorPickerInput
34
56
  };
35
57
  //# sourceMappingURL=fondue-components45.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"fondue-components45.js","sources":["../src/components/ColorPicker/ColorGradientInput.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type ForwardedRef, forwardRef } from 'react';\nimport { RgbaColorPicker } from 'react-colorful';\n\nimport styles from './styles/customColorPicker.module.scss';\nimport { type RgbaColor } from './types';\nimport { DEFAULT_COLOR } from './utils';\n\ntype ColorGradientInputProps = {\n /**\n * @ignore\n * The active color in the color picker, passed down from the root component\n */\n currentColor?: RgbaColor;\n /**\n * @ignore\n * Event handler called when the color changes, passed down from the root component\n */\n onColorChange?: (color: RgbaColor) => void;\n /**\n * The test id of the color picker gradient input\n */\n 'data-test-id'?: string;\n};\n\nexport const ColorGradientInput = (\n {\n currentColor = DEFAULT_COLOR,\n onColorChange = () => {},\n 'data-test-id': dataTestId = 'color-picker-input',\n }: ColorGradientInputProps,\n forwardedRef: ForwardedRef<HTMLDivElement>,\n) => {\n return (\n <div className={styles.gradientInput} data-test-id={dataTestId} ref={forwardedRef}>\n <RgbaColorPicker\n className={styles.reactColorful}\n color={{\n r: currentColor.red,\n g: currentColor.green,\n b: currentColor.blue,\n a: currentColor.alpha === undefined ? 1 : currentColor.alpha,\n }}\n onChange={(color) =>\n onColorChange({\n red: color.r,\n green: color.g,\n blue: color.b,\n alpha: color.a,\n })\n }\n />\n </div>\n );\n};\nColorGradientInput.displayName = 'ColorPicker.Gradient';\n\nexport const ForwardedRefColorGradientInput = forwardRef<HTMLDivElement, ColorGradientInputProps>(ColorGradientInput);\n"],"names":["ColorGradientInput","currentColor","DEFAULT_COLOR","onColorChange","dataTestId","forwardedRef","jsx","styles","RgbaColorPicker","color","ForwardedRefColorGradientInput","forwardRef"],"mappings":";;;;;AA0BO,MAAMA,IAAqB,CAC9B;AAAA,EACI,cAAAC,IAAeC;AAAA,EACf,eAAAC,IAAgB,MAAM;AAAA,EAAC;AAAA,EACvB,gBAAgBC,IAAa;AACjC,GACAC,MAGI,gBAAAC,EAAC,SAAI,WAAWC,EAAO,eAAe,gBAAcH,GAAY,KAAKC,GACjE,UAAA,gBAAAC;AAAA,EAACE;AAAA,EAAA;AAAA,IACG,WAAWD,EAAO;AAAA,IAClB,OAAO;AAAA,MACH,GAAGN,EAAa;AAAA,MAChB,GAAGA,EAAa;AAAA,MAChB,GAAGA,EAAa;AAAA,MAChB,GAAGA,EAAa,UAAU,SAAY,IAAIA,EAAa;AAAA,IAAA;AAAA,IAE3D,UAAU,CAACQ,MACPN,EAAc;AAAA,MACV,KAAKM,EAAM;AAAA,MACX,OAAOA,EAAM;AAAA,MACb,MAAMA,EAAM;AAAA,MACZ,OAAOA,EAAM;AAAA,IAAA,CAChB;AAAA,EAAA;AAAA,GAGb;AAGRT,EAAmB,cAAc;AAE1B,MAAMU,IAAiCC,EAAoDX,CAAkB;"}
1
+ {"version":3,"file":"fondue-components45.js","sources":["../src/components/ColorPicker/ColorPickerInput.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { IconCaretDown, IconCross, IconDroplet } from '@frontify/fondue-icons';\nimport { type CSSProperties, type ForwardedRef, forwardRef } from 'react';\n\nimport { useTranslation } from '#/hooks/useTranslation';\nimport { type CommonAriaAttrs } from '#/utilities/types';\n\nimport { Button } from '../Button/Button';\n\nimport styles from './styles/colorInput.module.scss';\nimport { type RgbaColor } from './types';\nimport { colorToCss, getColorWithName } from './utils';\n\ntype ColorPickerInputProps = {\n id?: string;\n /**\n * The active color in the color picker\n */\n currentColor?: RgbaColor;\n /**\n * The open state of the color picker used to determine arrow state\n */\n isOpen?: boolean;\n /**\n * Whether the color picker input is disabled\n */\n disabled?: boolean;\n /**\n * callback for clearing the color\n */\n onClear?: () => void;\n /**\n * Event handler called when the color picker input is clicked\n */\n onClick?: () => void;\n /**\n * The test id of the color picker input\n */\n 'data-test-id'?: string;\n} & CommonAriaAttrs;\n\nexport const ColorPickerInput = (\n {\n id,\n currentColor,\n isOpen,\n disabled = false,\n onClear,\n onClick,\n 'data-test-id': dataTestId = 'color-picker-input',\n ...props\n }: ColorPickerInputProps,\n forwardedRef: ForwardedRef<HTMLDivElement>,\n) => {\n const { t } = useTranslation();\n const colorName = currentColor?.name ?? (currentColor ? getColorWithName(currentColor, 'RGBA').name : '');\n return (\n <div id={id} className={styles.root} ref={forwardedRef} data-test-id={dataTestId}>\n <button\n className={styles.button}\n {...props}\n disabled={disabled}\n onClick={onClick}\n type=\"button\"\n data-color-input-select\n >\n {currentColor?.red !== undefined ? (\n <div\n aria-hidden\n className={styles.colorIndicator}\n style={{ '--active-color': colorToCss(currentColor) } as CSSProperties}\n />\n ) : (\n <>\n <IconDroplet size={16} />\n <span>{t('ColorPicker_selectColor')}</span>\n </>\n )}\n\n <span className={styles.colorName}>{colorName}</span>\n </button>\n <div className={styles.actions}>\n {onClear && (\n <Button onPress={onClear} disabled={disabled} size=\"small\" emphasis=\"weak\" aspect=\"square\">\n <IconCross className={styles.clearIcon} size={16} />\n </Button>\n )}\n <div className={styles.caret} data-state={isOpen ? 'open' : 'closed'}>\n <IconCaretDown size={16} className={styles.caret} />\n </div>\n </div>\n </div>\n );\n};\nColorPickerInput.displayName = 'ColorPicker.Input';\n\nexport const ForwardedRefColorPickerInput = forwardRef<HTMLDivElement, ColorPickerInputProps>(ColorPickerInput);\n"],"names":["ColorPickerInput","id","currentColor","isOpen","disabled","onClear","onClick","dataTestId","props","forwardedRef","t","useTranslation","colorName","getColorWithName","jsxs","styles","jsx","colorToCss","Fragment","IconDroplet","Button","IconCross","IconCaretDown","ForwardedRefColorPickerInput","forwardRef"],"mappings":";;;;;;;AA0CO,MAAMA,IAAmB,CAC5B;AAAA,EACI,IAAAC;AAAA,EACA,cAAAC;AAAA,EACA,QAAAC;AAAA,EACA,UAAAC,IAAW;AAAA,EACX,SAAAC;AAAA,EACA,SAAAC;AAAA,EACA,gBAAgBC,IAAa;AAAA,EAC7B,GAAGC;AACP,GACAC,MACC;AACD,QAAM,EAAE,GAAAC,EAAA,IAAMC,EAAA,GACRC,KAAYV,KAAA,gBAAAA,EAAc,UAASA,IAAeW,EAAiBX,GAAc,MAAM,EAAE,OAAO;AACtG,SACI,gBAAAY,EAAC,SAAI,IAAAb,GAAQ,WAAWc,EAAO,MAAM,KAAKN,GAAc,gBAAcF,GAClE,UAAA;AAAA,IAAA,gBAAAO;AAAA,MAAC;AAAA,MAAA;AAAA,QACG,WAAWC,EAAO;AAAA,QACjB,GAAGP;AAAA,QACJ,UAAAJ;AAAA,QACA,SAAAE;AAAA,QACA,MAAK;AAAA,QACL,2BAAuB;AAAA,QAEtB,UAAA;AAAA,WAAAJ,KAAA,gBAAAA,EAAc,SAAQ,SACnB,gBAAAc;AAAA,YAAC;AAAA,YAAA;AAAA,cACG,eAAW;AAAA,cACX,WAAWD,EAAO;AAAA,cAClB,OAAO,EAAE,kBAAkBE,EAAWf,CAAY,EAAA;AAAA,YAAE;AAAA,UAAA,IAGxD,gBAAAY,EAAAI,GAAA,EACI,UAAA;AAAA,YAAA,gBAAAF,EAACG,GAAA,EAAY,MAAM,GAAA,CAAI;AAAA,YACvB,gBAAAH,EAAC,QAAA,EAAM,UAAAN,EAAE,yBAAyB,EAAA,CAAE;AAAA,UAAA,GACxC;AAAA,UAGJ,gBAAAM,EAAC,QAAA,EAAK,WAAWD,EAAO,WAAY,UAAAH,EAAA,CAAU;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA;AAAA,IAElD,gBAAAE,EAAC,OAAA,EAAI,WAAWC,EAAO,SAClB,UAAA;AAAA,MAAAV,uBACIe,GAAA,EAAO,SAASf,GAAS,UAAAD,GAAoB,MAAK,SAAQ,UAAS,QAAO,QAAO,UAC9E,4BAACiB,GAAA,EAAU,WAAWN,EAAO,WAAW,MAAM,IAAI,GACtD;AAAA,wBAEH,OAAA,EAAI,WAAWA,EAAO,OAAO,cAAYZ,IAAS,SAAS,UACxD,UAAA,gBAAAa,EAACM,KAAc,MAAM,IAAI,WAAWP,EAAO,OAAO,EAAA,CACtD;AAAA,IAAA,EAAA,CACJ;AAAA,EAAA,GACJ;AAER;AACAf,EAAiB,cAAc;AAExB,MAAMuB,IAA+BC,EAAkDxB,CAAgB;"}
@@ -1,56 +1,134 @@
1
- import { jsxs as t, jsx as a, Fragment as f } from "react/jsx-runtime";
2
- import { IconDroplet as h, IconCross as I, IconCaretDown as v } from "@frontify/fondue-icons";
3
- import { forwardRef as k } from "react";
4
- import { Button as w } from "./fondue-components6.js";
5
- import s from "./fondue-components91.js";
6
- import { getColorWithName as y, colorToCss as z } from "./fondue-components49.js";
7
- const c = ({
8
- id: m,
9
- currentColor: e,
10
- isOpen: d,
11
- disabled: i = !1,
12
- onClear: o,
13
- onClick: l,
14
- "data-test-id": n = "color-picker-input",
15
- ...r
16
- }, p) => {
17
- const N = (e == null ? void 0 : e.name) ?? (e ? y(e, "RGBA").name : "");
18
- return /* @__PURE__ */ t("div", { id: m, className: s.root, ref: p, "data-test-id": n, children: [
19
- /* @__PURE__ */ t(
20
- "button",
1
+ import { jsxs as n, jsx as e } from "react/jsx-runtime";
2
+ import { forwardRef as N, useState as k, useEffect as I } from "react";
3
+ import { useTranslation as R } from "./fondue-components34.js";
4
+ import { Select as s } from "./fondue-components22.js";
5
+ import { TextInput as r } from "./fondue-components29.js";
6
+ import a from "./fondue-components47.js";
7
+ import { rgbColorToHex as m, DEFAULT_COLOR as x, DEFAULT_FORMAT as S, isValidHexColor as h, hexColorToRgba as y, getLimitedColorChannelValue as c } from "./fondue-components48.js";
8
+ const v = ({
9
+ currentColor: t = x,
10
+ onColorChange: o = () => {
11
+ },
12
+ currentFormat: u = S,
13
+ setCurrentFormat: f = () => {
14
+ },
15
+ "data-test-id": g = "color-picker-value-input"
16
+ }, b) => {
17
+ const { t: i } = R(), [p, d] = k(() => m(t));
18
+ return I(() => {
19
+ d(m(t));
20
+ }, [t]), /* @__PURE__ */ n("div", { className: a.inputs, "data-test-id": g, ref: b, children: [
21
+ /* @__PURE__ */ e("div", { className: a.colorFormatInput, children: /* @__PURE__ */ n(
22
+ s,
21
23
  {
22
- className: s.button,
23
- ...r,
24
- disabled: i,
25
- onClick: l,
26
- type: "button",
27
- "data-color-input-select": !0,
24
+ "data-test-id": "color-picker-select-format",
25
+ "aria-label": i("ColorPicker_selectFormat"),
26
+ onSelect: (l) => {
27
+ f(l);
28
+ },
29
+ value: u,
28
30
  children: [
29
- (e == null ? void 0 : e.red) !== void 0 ? /* @__PURE__ */ a(
30
- "div",
31
- {
32
- "aria-hidden": !0,
33
- className: s.colorIndicator,
34
- style: { "--active-color": z(e) }
35
- }
36
- ) : /* @__PURE__ */ t(f, { children: [
37
- /* @__PURE__ */ a(h, { size: 16 }),
38
- /* @__PURE__ */ a("span", { children: "Select Color" })
39
- ] }),
40
- /* @__PURE__ */ a("span", { className: s.colorName, children: N })
31
+ /* @__PURE__ */ e(s.Item, { value: "HEX", children: "HEX" }),
32
+ /* @__PURE__ */ e(s.Item, { value: "RGBA", children: "RGBA" })
41
33
  ]
42
34
  }
43
- ),
44
- /* @__PURE__ */ t("div", { className: s.actions, children: [
45
- o && /* @__PURE__ */ a(w, { onPress: o, disabled: i, size: "small", emphasis: "weak", aspect: "square", children: /* @__PURE__ */ a(I, { className: s.clearIcon, size: 16 }) }),
46
- /* @__PURE__ */ a("div", { className: s.caret, "data-state": d ? "open" : "closed", children: /* @__PURE__ */ a(v, { size: 16, className: s.caret }) })
47
- ] })
35
+ ) }),
36
+ u === "HEX" ? /* @__PURE__ */ e(
37
+ r.Root,
38
+ {
39
+ "data-test-id": "color-picker-value-input-hex",
40
+ className: a.valueInput,
41
+ type: "text",
42
+ value: p,
43
+ status: h(p) ? "neutral" : "error",
44
+ onBlur: (l) => {
45
+ h(l.target.value) && o({ ...y(l.target.value), alpha: t.alpha });
46
+ },
47
+ onChange: (l) => {
48
+ d(l.target.value);
49
+ },
50
+ "aria-label": i("ColorPicker_hexValue"),
51
+ children: /* @__PURE__ */ e(r.Slot, { name: "left", children: /* @__PURE__ */ e("span", { className: a.inputDecorator, children: "#" }) })
52
+ }
53
+ ) : /* @__PURE__ */ n("div", { className: a.colorChannelInputGroup, children: [
54
+ /* @__PURE__ */ e(
55
+ r.Root,
56
+ {
57
+ "data-test-id": "color-picker-value-input-red",
58
+ className: a.valueInput,
59
+ value: t.red,
60
+ type: "number",
61
+ onChange: (l) => {
62
+ o({
63
+ ...t,
64
+ red: c(l.target.value)
65
+ });
66
+ },
67
+ "aria-label": i("ColorPicker_redChannel"),
68
+ children: /* @__PURE__ */ e(r.Slot, { name: "left", children: /* @__PURE__ */ e("span", { className: a.inputDecorator, children: "R" }) })
69
+ }
70
+ ),
71
+ /* @__PURE__ */ e(
72
+ r.Root,
73
+ {
74
+ "data-test-id": "color-picker-value-input-green",
75
+ className: a.valueInput,
76
+ value: t.green,
77
+ type: "number",
78
+ onChange: (l) => {
79
+ o({
80
+ ...t,
81
+ green: c(l.target.value)
82
+ });
83
+ },
84
+ "aria-label": i("ColorPicker_greenChannel"),
85
+ children: /* @__PURE__ */ e(r.Slot, { name: "left", children: /* @__PURE__ */ e("span", { className: a.inputDecorator, children: "G" }) })
86
+ }
87
+ ),
88
+ /* @__PURE__ */ e(
89
+ r.Root,
90
+ {
91
+ "data-test-id": "color-picker-value-input-blue",
92
+ className: a.valueInput,
93
+ value: t.blue,
94
+ type: "number",
95
+ onChange: (l) => {
96
+ o({
97
+ ...t,
98
+ blue: c(l.target.value)
99
+ });
100
+ },
101
+ "aria-label": i("ColorPicker_blueChannel"),
102
+ children: /* @__PURE__ */ e(r.Slot, { name: "left", children: /* @__PURE__ */ e("span", { className: a.inputDecorator, children: "B" }) })
103
+ }
104
+ )
105
+ ] }),
106
+ /* @__PURE__ */ e("div", { className: a.colorAlphaInput, children: /* @__PURE__ */ n(
107
+ r.Root,
108
+ {
109
+ "data-test-id": "color-picker-value-input-alpha",
110
+ className: a.valueInput,
111
+ value: t.alpha === void 0 ? 100 : Math.trunc(t.alpha * 100).toString(),
112
+ type: "number",
113
+ onChange: (l) => {
114
+ o({
115
+ ...t,
116
+ alpha: c(l.target.value, 0, 100) / 100
117
+ });
118
+ },
119
+ "aria-label": i("ColorPicker_opacity"),
120
+ children: [
121
+ /* @__PURE__ */ e(r.Slot, { name: "left", children: /* @__PURE__ */ e("span", { className: a.inputDecorator, children: "A" }) }),
122
+ /* @__PURE__ */ e(r.Slot, { name: "right", children: /* @__PURE__ */ e("span", { className: a.inputDecorator, children: "%" }) })
123
+ ]
124
+ }
125
+ ) })
48
126
  ] });
49
127
  };
50
- c.displayName = "ColorPicker.Input";
51
- const B = k(c);
128
+ v.displayName = "ColorPicker.Values";
129
+ const E = N(v);
52
130
  export {
53
- c as ColorPickerInput,
54
- B as ForwardedRefColorPickerInput
131
+ v as ColorValueInput,
132
+ E as ForwardedRefColorValueInput
55
133
  };
56
134
  //# sourceMappingURL=fondue-components46.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"fondue-components46.js","sources":["../src/components/ColorPicker/ColorPickerInput.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { IconCaretDown, IconCross, IconDroplet } from '@frontify/fondue-icons';\nimport { type CSSProperties, type ForwardedRef, forwardRef } from 'react';\n\nimport { type CommonAriaAttrs } from '#/utilities/types';\n\nimport { Button } from '../Button/Button';\n\nimport styles from './styles/colorInput.module.scss';\nimport { type RgbaColor } from './types';\nimport { colorToCss, getColorWithName } from './utils';\n\ntype ColorPickerInputProps = {\n id?: string;\n /**\n * The active color in the color picker\n */\n currentColor?: RgbaColor;\n /**\n * The open state of the color picker used to determine arrow state\n */\n isOpen?: boolean;\n /**\n * Whether the color picker input is disabled\n */\n disabled?: boolean;\n /**\n * callback for clearing the color\n */\n onClear?: () => void;\n /**\n * Event handler called when the color picker input is clicked\n */\n onClick?: () => void;\n /**\n * The test id of the color picker input\n */\n 'data-test-id'?: string;\n} & CommonAriaAttrs;\n\nexport const ColorPickerInput = (\n {\n id,\n currentColor,\n isOpen,\n disabled = false,\n onClear,\n onClick,\n 'data-test-id': dataTestId = 'color-picker-input',\n ...props\n }: ColorPickerInputProps,\n forwardedRef: ForwardedRef<HTMLDivElement>,\n) => {\n const colorName = currentColor?.name ?? (currentColor ? getColorWithName(currentColor, 'RGBA').name : '');\n return (\n <div id={id} className={styles.root} ref={forwardedRef} data-test-id={dataTestId}>\n <button\n className={styles.button}\n {...props}\n disabled={disabled}\n onClick={onClick}\n type=\"button\"\n data-color-input-select\n >\n {currentColor?.red !== undefined ? (\n <div\n aria-hidden\n className={styles.colorIndicator}\n style={{ '--active-color': colorToCss(currentColor) } as CSSProperties}\n />\n ) : (\n <>\n <IconDroplet size={16} />\n <span>Select Color</span>\n </>\n )}\n\n <span className={styles.colorName}>{colorName}</span>\n </button>\n <div className={styles.actions}>\n {onClear && (\n <Button onPress={onClear} disabled={disabled} size=\"small\" emphasis=\"weak\" aspect=\"square\">\n <IconCross className={styles.clearIcon} size={16} />\n </Button>\n )}\n <div className={styles.caret} data-state={isOpen ? 'open' : 'closed'}>\n <IconCaretDown size={16} className={styles.caret} />\n </div>\n </div>\n </div>\n );\n};\nColorPickerInput.displayName = 'ColorPicker.Input';\n\nexport const ForwardedRefColorPickerInput = forwardRef<HTMLDivElement, ColorPickerInputProps>(ColorPickerInput);\n"],"names":["ColorPickerInput","id","currentColor","isOpen","disabled","onClear","onClick","dataTestId","props","forwardedRef","colorName","getColorWithName","jsxs","styles","jsx","colorToCss","Fragment","IconDroplet","Button","IconCross","IconCaretDown","ForwardedRefColorPickerInput","forwardRef"],"mappings":";;;;;;AAyCO,MAAMA,IAAmB,CAC5B;AAAA,EACI,IAAAC;AAAA,EACA,cAAAC;AAAA,EACA,QAAAC;AAAA,EACA,UAAAC,IAAW;AAAA,EACX,SAAAC;AAAA,EACA,SAAAC;AAAA,EACA,gBAAgBC,IAAa;AAAA,EAC7B,GAAGC;AACP,GACAC,MACC;AACD,QAAMC,KAAYR,KAAA,gBAAAA,EAAc,UAASA,IAAeS,EAAiBT,GAAc,MAAM,EAAE,OAAO;AACtG,SACI,gBAAAU,EAAC,SAAI,IAAAX,GAAQ,WAAWY,EAAO,MAAM,KAAKJ,GAAc,gBAAcF,GAClE,UAAA;AAAA,IAAA,gBAAAK;AAAA,MAAC;AAAA,MAAA;AAAA,QACG,WAAWC,EAAO;AAAA,QACjB,GAAGL;AAAA,QACJ,UAAAJ;AAAA,QACA,SAAAE;AAAA,QACA,MAAK;AAAA,QACL,2BAAuB;AAAA,QAEtB,UAAA;AAAA,WAAAJ,KAAA,gBAAAA,EAAc,SAAQ,SACnB,gBAAAY;AAAA,YAAC;AAAA,YAAA;AAAA,cACG,eAAW;AAAA,cACX,WAAWD,EAAO;AAAA,cAClB,OAAO,EAAE,kBAAkBE,EAAWb,CAAY,EAAA;AAAA,YAAE;AAAA,UAAA,IAGxD,gBAAAU,EAAAI,GAAA,EACI,UAAA;AAAA,YAAA,gBAAAF,EAACG,GAAA,EAAY,MAAM,GAAA,CAAI;AAAA,YACvB,gBAAAH,EAAC,UAAK,UAAA,eAAA,CAAY;AAAA,UAAA,GACtB;AAAA,UAGJ,gBAAAA,EAAC,QAAA,EAAK,WAAWD,EAAO,WAAY,UAAAH,EAAA,CAAU;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA;AAAA,IAElD,gBAAAE,EAAC,OAAA,EAAI,WAAWC,EAAO,SAClB,UAAA;AAAA,MAAAR,uBACIa,GAAA,EAAO,SAASb,GAAS,UAAAD,GAAoB,MAAK,SAAQ,UAAS,QAAO,QAAO,UAC9E,4BAACe,GAAA,EAAU,WAAWN,EAAO,WAAW,MAAM,IAAI,GACtD;AAAA,wBAEH,OAAA,EAAI,WAAWA,EAAO,OAAO,cAAYV,IAAS,SAAS,UACxD,UAAA,gBAAAW,EAACM,KAAc,MAAM,IAAI,WAAWP,EAAO,OAAO,EAAA,CACtD;AAAA,IAAA,EAAA,CACJ;AAAA,EAAA,GACJ;AAER;AACAb,EAAiB,cAAc;AAExB,MAAMqB,IAA+BC,EAAkDtB,CAAgB;"}
1
+ {"version":3,"file":"fondue-components46.js","sources":["../src/components/ColorPicker/ColorValueInput.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type ForwardedRef, forwardRef, useEffect, useState } from 'react';\n\nimport { useTranslation } from '#/hooks/useTranslation';\n\nimport { Select } from '../Select/Select';\nimport { TextInput } from '../TextInput/TextInput';\n\nimport styles from './styles/customColorPicker.module.scss';\nimport { type RgbaColor } from './types';\nimport {\n DEFAULT_COLOR,\n DEFAULT_FORMAT,\n getLimitedColorChannelValue,\n hexColorToRgba,\n isValidHexColor,\n rgbColorToHex,\n} from './utils';\n\ntype ColorFormat = 'HEX' | 'RGBA';\n\ntype ColorValueInputProps = {\n /**\n * @ignore\n * The active color in the color picker, passed down from the root component\n */\n currentColor?: RgbaColor;\n /**\n * @ignore\n * Event handler called when the color changes, passed down from the root component\n */\n onColorChange?: (color: RgbaColor) => void;\n /**\n * @ignore\n * The format to use for the color input, passed down from the root component\n */\n currentFormat?: ColorFormat;\n /**\n * @ignore\n * The format to use for the color input, passed down from the root component\n */\n setCurrentFormat?: (format: ColorFormat) => void;\n /**\n * The test id of the color picker value input\n */\n 'data-test-id'?: string;\n};\n\nexport const ColorValueInput = (\n {\n currentColor = DEFAULT_COLOR,\n onColorChange = () => {},\n currentFormat = DEFAULT_FORMAT,\n setCurrentFormat = () => {},\n 'data-test-id': dataTestId = 'color-picker-value-input',\n }: ColorValueInputProps,\n forwardedRef: ForwardedRef<HTMLDivElement>,\n) => {\n const { t } = useTranslation();\n const [hexColorValue, setHexColorValue] = useState<string>(() => rgbColorToHex(currentColor));\n\n useEffect(() => {\n setHexColorValue(rgbColorToHex(currentColor));\n }, [currentColor]);\n\n return (\n <div className={styles.inputs} data-test-id={dataTestId} ref={forwardedRef}>\n <div className={styles.colorFormatInput}>\n <Select\n data-test-id=\"color-picker-select-format\"\n aria-label={t('ColorPicker_selectFormat')}\n onSelect={(selectedValue) => {\n setCurrentFormat(selectedValue as ColorFormat);\n }}\n value={currentFormat}\n >\n <Select.Item value=\"HEX\">HEX</Select.Item>\n <Select.Item value=\"RGBA\">RGBA</Select.Item>\n </Select>\n </div>\n {currentFormat === 'HEX' ? (\n <TextInput.Root\n data-test-id=\"color-picker-value-input-hex\"\n className={styles.valueInput}\n type=\"text\"\n value={hexColorValue}\n status={isValidHexColor(hexColorValue) ? 'neutral' : 'error'}\n onBlur={(event) => {\n if (isValidHexColor(event.target.value)) {\n onColorChange({ ...hexColorToRgba(event.target.value), alpha: currentColor.alpha });\n }\n }}\n onChange={(event) => {\n setHexColorValue(event.target.value);\n }}\n aria-label={t('ColorPicker_hexValue')}\n >\n <TextInput.Slot name=\"left\">\n <span className={styles.inputDecorator}>#</span>\n </TextInput.Slot>\n </TextInput.Root>\n ) : (\n <div className={styles.colorChannelInputGroup}>\n <TextInput.Root\n data-test-id=\"color-picker-value-input-red\"\n className={styles.valueInput}\n value={currentColor.red}\n type=\"number\"\n onChange={(event) => {\n onColorChange({\n ...currentColor,\n red: getLimitedColorChannelValue(event.target.value),\n });\n }}\n aria-label={t('ColorPicker_redChannel')}\n >\n <TextInput.Slot name=\"left\">\n <span className={styles.inputDecorator}>R</span>\n </TextInput.Slot>\n </TextInput.Root>\n <TextInput.Root\n data-test-id=\"color-picker-value-input-green\"\n className={styles.valueInput}\n value={currentColor.green}\n type=\"number\"\n onChange={(event) => {\n onColorChange({\n ...currentColor,\n green: getLimitedColorChannelValue(event.target.value),\n });\n }}\n aria-label={t('ColorPicker_greenChannel')}\n >\n <TextInput.Slot name=\"left\">\n <span className={styles.inputDecorator}>G</span>\n </TextInput.Slot>\n </TextInput.Root>\n <TextInput.Root\n data-test-id=\"color-picker-value-input-blue\"\n className={styles.valueInput}\n value={currentColor.blue}\n type=\"number\"\n onChange={(event) => {\n onColorChange({\n ...currentColor,\n blue: getLimitedColorChannelValue(event.target.value),\n });\n }}\n aria-label={t('ColorPicker_blueChannel')}\n >\n <TextInput.Slot name=\"left\">\n <span className={styles.inputDecorator}>B</span>\n </TextInput.Slot>\n </TextInput.Root>\n </div>\n )}\n <div className={styles.colorAlphaInput}>\n <TextInput.Root\n data-test-id=\"color-picker-value-input-alpha\"\n className={styles.valueInput}\n /* .toString() is a workaround for https://github.com/facebook/react/issues/9402 */\n value={currentColor.alpha === undefined ? 100 : Math.trunc(currentColor.alpha * 100).toString()}\n type=\"number\"\n onChange={(event) => {\n onColorChange({\n ...currentColor,\n alpha: getLimitedColorChannelValue(event.target.value, 0, 100) / 100,\n });\n }}\n aria-label={t('ColorPicker_opacity')}\n >\n <TextInput.Slot name=\"left\">\n <span className={styles.inputDecorator}>A</span>\n </TextInput.Slot>\n <TextInput.Slot name=\"right\">\n <span className={styles.inputDecorator}>%</span>\n </TextInput.Slot>\n </TextInput.Root>\n </div>\n </div>\n );\n};\nColorValueInput.displayName = 'ColorPicker.Values';\n\nexport const ForwardedRefColorValueInput = forwardRef<HTMLDivElement, ColorValueInputProps>(ColorValueInput);\n"],"names":["ColorValueInput","currentColor","DEFAULT_COLOR","onColorChange","currentFormat","DEFAULT_FORMAT","setCurrentFormat","dataTestId","forwardedRef","t","useTranslation","hexColorValue","setHexColorValue","useState","rgbColorToHex","useEffect","jsxs","styles","jsx","Select","selectedValue","TextInput","isValidHexColor","event","hexColorToRgba","getLimitedColorChannelValue","ForwardedRefColorValueInput","forwardRef"],"mappings":";;;;;;;AAiDO,MAAMA,IAAkB,CAC3B;AAAA,EACI,cAAAC,IAAeC;AAAA,EACf,eAAAC,IAAgB,MAAM;AAAA,EAAC;AAAA,EACvB,eAAAC,IAAgBC;AAAA,EAChB,kBAAAC,IAAmB,MAAM;AAAA,EAAC;AAAA,EAC1B,gBAAgBC,IAAa;AACjC,GACAC,MACC;AACD,QAAM,EAAE,GAAAC,EAAA,IAAMC,EAAA,GACR,CAACC,GAAeC,CAAgB,IAAIC,EAAiB,MAAMC,EAAcb,CAAY,CAAC;AAE5F,SAAAc,EAAU,MAAM;AACZ,IAAAH,EAAiBE,EAAcb,CAAY,CAAC;AAAA,EAChD,GAAG,CAACA,CAAY,CAAC,GAGb,gBAAAe,EAAC,SAAI,WAAWC,EAAO,QAAQ,gBAAcV,GAAY,KAAKC,GAC1D,UAAA;AAAA,IAAA,gBAAAU,EAAC,OAAA,EAAI,WAAWD,EAAO,kBACnB,UAAA,gBAAAD;AAAA,MAACG;AAAA,MAAA;AAAA,QACG,gBAAa;AAAA,QACb,cAAYV,EAAE,0BAA0B;A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AEJ,gBAAAC,EAAC,OAAA,EAAI,WAAWD,EAAO,iBACnB,UAAA,gBAAAD;AAAA,MAACK,EAAU;AAAA,MAAV;AAAA,QACG,gBAAa;AAAA,QACb,WAAWJ,EAAO;AAAA,QAElB,OAAOhB,EAAa,UAAU,SAAY,MAAM,KAAK,MAAMA,EAAa,QAAQ,GAAG,EAAE,SAAA;AAAA,QACrF,MAAK;AAAA,QACL,UAAU,CAACsB,MAAU;AACjB,UAAApB,EAAc;AAAA,YACV,GAAGF;AAAA,YACH,OAAOwB,EAA4BF,EAAM,OAAO,OAAO,GAAG,GAAG,IAAI;AAAA,UAAA,CACpE;AAAA,QACL;AAAA,QACA,cAAYd,EAAE,qBAAqB;AAAA,QAEnC,UAAA;AAAA,UAAA,gBAAAS,EAACG,EAAU,MAAV,EAAe,MAAK,QACjB,UAAA,gBAAAH,EAAC,QAAA,EAAK,WAAWD,EAAO,gBAAgB,UAAA,IAAA,CAAC,GAC7C;AAAA,UACA,gBAAAC,EAACG,EAAU,MAAV,EAAe,MAAK,SACjB,UAAA,gBAAAH,EAAC,QAAA,EAAK,WAAWD,EAAO,gBAAgB,UAAA,IAAA,CAAC,EAAA,CAC7C;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA,EACJ,CACJ;AAAA,EAAA,GACJ;AAER;AACAjB,EAAgB,cAAc;AAEvB,MAAM0B,IAA8BC,EAAiD3B,CAAe;"}
@@ -1,133 +1,24 @@
1
- import { jsxs as n, jsx as e } from "react/jsx-runtime";
2
- import { forwardRef as N, useState as b, useEffect as R } from "react";
3
- import { Select as c } from "./fondue-components24.js";
4
- import { TextInput as r } from "./fondue-components31.js";
5
- import a from "./fondue-components48.js";
6
- import { rgbColorToHex as d, DEFAULT_COLOR as I, DEFAULT_FORMAT as x, isValidHexColor as m, hexColorToRgba as S, getLimitedColorChannelValue as o } from "./fondue-components49.js";
7
- const h = ({
8
- currentColor: t = I,
9
- onColorChange: i = () => {
10
- },
11
- currentFormat: s = x,
12
- setCurrentFormat: v = () => {
13
- },
14
- "data-test-id": f = "color-picker-value-input"
15
- }, g) => {
16
- const [u, p] = b(() => d(t));
17
- return R(() => {
18
- p(d(t));
19
- }, [t]), /* @__PURE__ */ n("div", { className: a.inputs, "data-test-id": f, ref: g, children: [
20
- /* @__PURE__ */ e("div", { className: a.colorFormatInput, children: /* @__PURE__ */ n(
21
- c,
22
- {
23
- "data-test-id": "color-picker-select-format",
24
- "aria-label": "Select a color format",
25
- onSelect: (l) => {
26
- v(l);
27
- },
28
- value: s,
29
- children: [
30
- /* @__PURE__ */ e(c.Item, { value: "HEX", children: "HEX" }),
31
- /* @__PURE__ */ e(c.Item, { value: "RGBA", children: "RGBA" })
32
- ]
33
- }
34
- ) }),
35
- s === "HEX" ? /* @__PURE__ */ e(
36
- r.Root,
37
- {
38
- "data-test-id": "color-picker-value-input-hex",
39
- className: a.valueInput,
40
- type: "text",
41
- value: u,
42
- status: m(u) ? "neutral" : "error",
43
- onBlur: (l) => {
44
- m(l.target.value) && i({ ...S(l.target.value), alpha: t.alpha });
45
- },
46
- onChange: (l) => {
47
- p(l.target.value);
48
- },
49
- "aria-label": "Hex color value",
50
- children: /* @__PURE__ */ e(r.Slot, { name: "left", children: /* @__PURE__ */ e("span", { className: a.inputDecorator, children: "#" }) })
51
- }
52
- ) : /* @__PURE__ */ n("div", { className: a.colorChannelInputGroup, children: [
53
- /* @__PURE__ */ e(
54
- r.Root,
55
- {
56
- "data-test-id": "color-picker-value-input-red",
57
- className: a.valueInput,
58
- value: t.red,
59
- type: "number",
60
- onChange: (l) => {
61
- i({
62
- ...t,
63
- red: o(l.target.value)
64
- });
65
- },
66
- "aria-label": "Red Color Channel",
67
- children: /* @__PURE__ */ e(r.Slot, { name: "left", children: /* @__PURE__ */ e("span", { className: a.inputDecorator, children: "R" }) })
68
- }
69
- ),
70
- /* @__PURE__ */ e(
71
- r.Root,
72
- {
73
- "data-test-id": "color-picker-value-input-green",
74
- className: a.valueInput,
75
- value: t.green,
76
- type: "number",
77
- onChange: (l) => {
78
- i({
79
- ...t,
80
- green: o(l.target.value)
81
- });
82
- },
83
- "aria-label": "Green Color Channel",
84
- children: /* @__PURE__ */ e(r.Slot, { name: "left", children: /* @__PURE__ */ e("span", { className: a.inputDecorator, children: "G" }) })
85
- }
86
- ),
87
- /* @__PURE__ */ e(
88
- r.Root,
89
- {
90
- "data-test-id": "color-picker-value-input-blue",
91
- className: a.valueInput,
92
- value: t.blue,
93
- type: "number",
94
- onChange: (l) => {
95
- i({
96
- ...t,
97
- blue: o(l.target.value)
98
- });
99
- },
100
- "aria-label": "Blue Color Channel",
101
- children: /* @__PURE__ */ e(r.Slot, { name: "left", children: /* @__PURE__ */ e("span", { className: a.inputDecorator, children: "B" }) })
102
- }
103
- )
104
- ] }),
105
- /* @__PURE__ */ e("div", { className: a.colorAlphaInput, children: /* @__PURE__ */ n(
106
- r.Root,
107
- {
108
- "data-test-id": "color-picker-value-input-alpha",
109
- className: a.valueInput,
110
- value: t.alpha === void 0 ? 100 : Math.trunc(t.alpha * 100).toString(),
111
- type: "number",
112
- onChange: (l) => {
113
- i({
114
- ...t,
115
- alpha: o(l.target.value, 0, 100) / 100
116
- });
117
- },
118
- "aria-label": "Color Opacity",
119
- children: [
120
- /* @__PURE__ */ e(r.Slot, { name: "left", children: /* @__PURE__ */ e("span", { className: a.inputDecorator, children: "A" }) }),
121
- /* @__PURE__ */ e(r.Slot, { name: "right", children: /* @__PURE__ */ e("span", { className: a.inputDecorator, children: "%" }) })
122
- ]
123
- }
124
- ) })
125
- ] });
1
+ const o = "_root_riubn_4", n = "_inputs_riubn_12", t = "_colorFormatInput_riubn_23", r = "_colorAlphaInput_riubn_24", u = "_colorChannelInputGroup_riubn_28", p = "_inputDecorator_riubn_39", _ = "_gradientInput_riubn_43", l = "_reactColorful_riubn_46", c = "_valueInput_riubn_50", a = {
2
+ root: o,
3
+ inputs: n,
4
+ colorFormatInput: t,
5
+ colorAlphaInput: r,
6
+ colorChannelInputGroup: u,
7
+ inputDecorator: p,
8
+ gradientInput: _,
9
+ reactColorful: l,
10
+ valueInput: c
126
11
  };
127
- h.displayName = "ColorPicker.Values";
128
- const E = N(h);
129
12
  export {
130
- h as ColorValueInput,
131
- E as ForwardedRefColorValueInput
13
+ r as colorAlphaInput,
14
+ u as colorChannelInputGroup,
15
+ t as colorFormatInput,
16
+ a as default,
17
+ _ as gradientInput,
18
+ p as inputDecorator,
19
+ n as inputs,
20
+ l as reactColorful,
21
+ o as root,
22
+ c as valueInput
132
23
  };
133
24
  //# sourceMappingURL=fondue-components47.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"fondue-components47.js","sources":["../src/components/ColorPicker/ColorValueInput.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type ForwardedRef, forwardRef, useEffect, useState } from 'react';\n\nimport { Select } from '../Select/Select';\nimport { TextInput } from '../TextInput/TextInput';\n\nimport styles from './styles/customColorPicker.module.scss';\nimport { type RgbaColor } from './types';\nimport {\n DEFAULT_COLOR,\n DEFAULT_FORMAT,\n getLimitedColorChannelValue,\n hexColorToRgba,\n isValidHexColor,\n rgbColorToHex,\n} from './utils';\n\ntype ColorFormat = 'HEX' | 'RGBA';\n\ntype ColorValueInputProps = {\n /**\n * @ignore\n * The active color in the color picker, passed down from the root component\n */\n currentColor?: RgbaColor;\n /**\n * @ignore\n * Event handler called when the color changes, passed down from the root component\n */\n onColorChange?: (color: RgbaColor) => void;\n /**\n * @ignore\n * The format to use for the color input, passed down from the root component\n */\n currentFormat?: ColorFormat;\n /**\n * @ignore\n * The format to use for the color input, passed down from the root component\n */\n setCurrentFormat?: (format: ColorFormat) => void;\n /**\n * The test id of the color picker value input\n */\n 'data-test-id'?: string;\n};\n\nexport const ColorValueInput = (\n {\n currentColor = DEFAULT_COLOR,\n onColorChange = () => {},\n currentFormat = DEFAULT_FORMAT,\n setCurrentFormat = () => {},\n 'data-test-id': dataTestId = 'color-picker-value-input',\n }: ColorValueInputProps,\n forwardedRef: ForwardedRef<HTMLDivElement>,\n) => {\n const [hexColorValue, setHexColorValue] = useState<string>(() => rgbColorToHex(currentColor));\n\n useEffect(() => {\n setHexColorValue(rgbColorToHex(currentColor));\n }, [currentColor]);\n\n return (\n <div className={styles.inputs} data-test-id={dataTestId} ref={forwardedRef}>\n <div className={styles.colorFormatInput}>\n <Select\n data-test-id=\"color-picker-select-format\"\n aria-label=\"Select a color format\"\n onSelect={(selectedValue) => {\n setCurrentFormat(selectedValue as ColorFormat);\n }}\n value={currentFormat}\n >\n <Select.Item value=\"HEX\">HEX</Select.Item>\n <Select.Item value=\"RGBA\">RGBA</Select.Item>\n </Select>\n </div>\n {currentFormat === 'HEX' ? (\n <TextInput.Root\n data-test-id=\"color-picker-value-input-hex\"\n className={styles.valueInput}\n type=\"text\"\n value={hexColorValue}\n status={isValidHexColor(hexColorValue) ? 'neutral' : 'error'}\n onBlur={(event) => {\n if (isValidHexColor(event.target.value)) {\n onColorChange({ ...hexColorToRgba(event.target.value), alpha: currentColor.alpha });\n }\n }}\n onChange={(event) => {\n setHexColorValue(event.target.value);\n }}\n aria-label=\"Hex color value\"\n >\n <TextInput.Slot name=\"left\">\n <span className={styles.inputDecorator}>#</span>\n </TextInput.Slot>\n </TextInput.Root>\n ) : (\n <div className={styles.colorChannelInputGroup}>\n <TextInput.Root\n data-test-id=\"color-picker-value-input-red\"\n className={styles.valueInput}\n value={currentColor.red}\n type=\"number\"\n onChange={(event) => {\n onColorChange({\n ...currentColor,\n red: getLimitedColorChannelValue(event.target.value),\n });\n }}\n aria-label=\"Red Color Channel\"\n >\n <TextInput.Slot name=\"left\">\n <span className={styles.inputDecorator}>R</span>\n </TextInput.Slot>\n </TextInput.Root>\n <TextInput.Root\n data-test-id=\"color-picker-value-input-green\"\n className={styles.valueInput}\n value={currentColor.green}\n type=\"number\"\n onChange={(event) => {\n onColorChange({\n ...currentColor,\n green: getLimitedColorChannelValue(event.target.value),\n });\n }}\n aria-label=\"Green Color Channel\"\n >\n <TextInput.Slot name=\"left\">\n <span className={styles.inputDecorator}>G</span>\n </TextInput.Slot>\n </TextInput.Root>\n <TextInput.Root\n data-test-id=\"color-picker-value-input-blue\"\n className={styles.valueInput}\n value={currentColor.blue}\n type=\"number\"\n onChange={(event) => {\n onColorChange({\n ...currentColor,\n blue: getLimitedColorChannelValue(event.target.value),\n });\n }}\n aria-label=\"Blue Color Channel\"\n >\n <TextInput.Slot name=\"left\">\n <span className={styles.inputDecorator}>B</span>\n </TextInput.Slot>\n </TextInput.Root>\n </div>\n )}\n <div className={styles.colorAlphaInput}>\n <TextInput.Root\n data-test-id=\"color-picker-value-input-alpha\"\n className={styles.valueInput}\n /* .toString() is a workaround for https://github.com/facebook/react/issues/9402 */\n value={currentColor.alpha === undefined ? 100 : Math.trunc(currentColor.alpha * 100).toString()}\n type=\"number\"\n onChange={(event) => {\n onColorChange({\n ...currentColor,\n alpha: getLimitedColorChannelValue(event.target.value, 0, 100) / 100,\n });\n }}\n aria-label=\"Color Opacity\"\n >\n <TextInput.Slot name=\"left\">\n <span className={styles.inputDecorator}>A</span>\n </TextInput.Slot>\n <TextInput.Slot name=\"right\">\n <span className={styles.inputDecorator}>%</span>\n </TextInput.Slot>\n </TextInput.Root>\n </div>\n </div>\n );\n};\nColorValueInput.displayName = 'ColorPicker.Values';\n\nexport const ForwardedRefColorValueInput = forwardRef<HTMLDivElement, ColorValueInputProps>(ColorValueInput);\n"],"names":["ColorValueInput","currentColor","DEFAULT_COLOR","onColorChange","currentFormat","DEFAULT_FORMAT","setCurrentFormat","dataTestId","forwardedRef","hexColorValue","setHexColorValue","useState","rgbColorToHex","useEffect","jsxs","styles","jsx","Select","selectedValue","TextInput","isValidHexColor","event","hexColorToRgba","getLimitedColorChannelValue","ForwardedRefColorValueInput","forwardRef"],"mappings":";;;;;;AA+CO,MAAMA,IAAkB,CAC3B;AAAA,EACI,cAAAC,IAAeC;AAAA,EACf,eAAAC,IAAgB,MAAM;AAAA,EAAC;AAAA,EACvB,eAA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