@frontify/fondue-components 16.0.0 → 16.0.3

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.
@@ -1,43 +1,46 @@
1
- import { jsx as i } from "react/jsx-runtime";
2
- import { Slot as u } from "@radix-ui/react-slot";
3
- import { forwardRef as k, useState as R, Children as P } from "react";
4
- import { ForwardedRefColorGradientInput as F } from "./fondue-components38.js";
5
- import { ForwardedRefColorPickerInput as y } from "./fondue-components39.js";
6
- import { ForwardedRefColorValueInput as N } from "./fondue-components40.js";
7
- import I from "./fondue-components41.js";
8
- import { getColorWithName as d, DEFAULT_COLOR as w, DEFAULT_FORMAT as h } from "./fondue-components42.js";
9
- const m = ({
1
+ import { jsx as a } from "react/jsx-runtime";
2
+ import { Slot as P } from "@radix-ui/react-slot";
3
+ import { forwardRef as F, useState as y, useMemo as N, Children as I } from "react";
4
+ import { ForwardedRefColorGradientInput as w } from "./fondue-components38.js";
5
+ import { ForwardedRefColorPickerInput as h } from "./fondue-components39.js";
6
+ import { ForwardedRefColorValueInput as G } from "./fondue-components40.js";
7
+ import V from "./fondue-components41.js";
8
+ import { DEFAULT_FORMAT as g, DEFAULT_COLOR as A, getColorWithName as s } from "./fondue-components42.js";
9
+ const p = ({
10
10
  children: t,
11
- currentColor: o = w,
12
- onColorChange: a = () => {
11
+ currentColor: r = A,
12
+ onColorChange: i = () => {
13
13
  },
14
- defaultFormat: p = h,
15
- "data-test-id": s = "color-picker-input",
16
- ...c
17
- }, n) => {
18
- const [l, C] = R(p);
19
- return /* @__PURE__ */ i("div", { className: I.root, "data-picker-type": "custom-color", "data-test-id": s, ref: n, children: P.map(t, (f) => /* @__PURE__ */ i(
20
- G,
14
+ currentFormat: l,
15
+ onFormatChange: c = () => {
16
+ },
17
+ defaultFormat: n = g,
18
+ "data-test-id": f = "color-picker-input",
19
+ ...C
20
+ }, u) => {
21
+ const [d, k] = y(n), m = N(() => l ?? d, [l, d]);
22
+ return /* @__PURE__ */ a("div", { className: V.root, "data-picker-type": "custom-color", "data-test-id": f, ref: u, children: I.map(t, (R) => /* @__PURE__ */ a(
23
+ L,
21
24
  {
22
- ...c,
23
- onColorChange: (r) => {
24
- a(d(r, l));
25
+ ...C,
26
+ onColorChange: (o) => {
27
+ i(s(o, m));
25
28
  },
26
- currentColor: o,
27
- currentFormat: l,
28
- setCurrentFormat: (r) => {
29
- C(r), a(d(o, r));
29
+ currentColor: r,
30
+ currentFormat: m,
31
+ setCurrentFormat: (o) => {
32
+ k(o), c(o), i(s(r, o));
30
33
  },
31
- children: f
34
+ children: R
32
35
  }
33
36
  )) });
34
37
  };
35
- m.displayName = "ColorPicker";
36
- const G = ({ children: t, ...o }) => /* @__PURE__ */ i(u, { ...o, children: t }), V = k(m), e = {
37
- Root: V,
38
- Values: N,
39
- Gradient: F,
40
- Input: y
38
+ p.displayName = "ColorPicker";
39
+ const L = ({ children: t, ...r }) => /* @__PURE__ */ a(P, { ...r, children: t }), M = F(p), e = {
40
+ Root: M,
41
+ Values: G,
42
+ Gradient: w,
43
+ Input: h
41
44
  };
42
45
  e.Root.displayName = "ColorPicker.Root";
43
46
  e.Values.displayName = "ColorPicker.Values";
@@ -45,7 +48,7 @@ e.Gradient.displayName = "ColorPicker.Gradient";
45
48
  e.Input.displayName = "ColorPicker.Input";
46
49
  export {
47
50
  e as ColorPicker,
48
- m as ColorPickerRoot,
49
- V as ForwardedRefColorPicker
51
+ p as ColorPickerRoot,
52
+ M as ForwardedRefColorPicker
50
53
  };
51
54
  //# sourceMappingURL=fondue-components7.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"fondue-components7.js","sources":["../src/components/ColorPicker/ColorPicker.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { Slot as RadixSlot } from '@radix-ui/react-slot';\nimport { Children, forwardRef, useState, type ForwardedRef, type ReactNode } from 'react';\n\nimport { ForwardedRefColorGradientInput } from './ColorGradientInput';\nimport { ForwardedRefColorPickerInput } from './ColorPickerInput';\nimport { ForwardedRefColorValueInput } from './ColorValueInput';\nimport styles from './styles/customColorPicker.module.scss';\nimport { type ColorFormat, type RgbaColor } from './types';\nimport { DEFAULT_COLOR, DEFAULT_FORMAT, getColorWithName } from './utils';\n\ntype ColorPickerProps = {\n /**\n * The children of the color picker component. This can contain multiple `ColorPicker.Values` or `ColorPicker.Gradient` components.\n */\n children?: ReactNode;\n /**\n * The active color in the color picker\n */\n currentColor?: RgbaColor;\n /**\n * Event handler called when the color changes\n */\n onColorChange?: (color: RgbaColor) => void;\n /**\n * The default format to use for the color input\n * @default \"HEX\"\n */\n defaultFormat?: ColorFormat;\n /**\n * The test id of the color picker\n */\n 'data-test-id'?: string;\n};\n\nexport const ColorPickerRoot = (\n {\n children,\n currentColor = DEFAULT_COLOR,\n onColorChange = () => {},\n defaultFormat = DEFAULT_FORMAT,\n 'data-test-id': dataTestId = 'color-picker-input',\n ...props\n }: ColorPickerProps,\n forwardedRef: ForwardedRef<HTMLDivElement>,\n) => {\n const [currentFormat, setCurrentFormat] = useState<ColorFormat>(defaultFormat);\n\n return (\n <div className={styles.root} data-picker-type=\"custom-color\" data-test-id={dataTestId} ref={forwardedRef}>\n {Children.map(children, (child) => (\n <ColorPickerSlot\n {...props}\n onColorChange={(color: RgbaColor) => {\n onColorChange(getColorWithName(color, currentFormat));\n }}\n currentColor={currentColor}\n currentFormat={currentFormat}\n setCurrentFormat={(currentFormat: ColorFormat) => {\n setCurrentFormat(currentFormat);\n onColorChange(getColorWithName(currentColor, currentFormat));\n }}\n >\n {child}\n </ColorPickerSlot>\n ))}\n </div>\n );\n};\nColorPickerRoot.displayName = 'ColorPicker';\n\ntype ColorPickerSlotProps = ColorPickerProps & {\n currentFormat?: ColorFormat;\n setCurrentFormat?: (format: ColorFormat) => void;\n};\nconst ColorPickerSlot = ({ children, ...props }: ColorPickerSlotProps) => <RadixSlot {...props}>{children}</RadixSlot>;\n\nexport const ForwardedRefColorPicker = forwardRef<HTMLDivElement, ColorPickerProps>(ColorPickerRoot);\n\nexport const ColorPicker = {\n Root: ForwardedRefColorPicker,\n Values: ForwardedRefColorValueInput,\n Gradient: ForwardedRefColorGradientInput,\n Input: ForwardedRefColorPickerInput,\n};\n\nColorPicker.Root.displayName = 'ColorPicker.Root';\nColorPicker.Values.displayName = 'ColorPicker.Values';\nColorPicker.Gradient.displayName = 'ColorPicker.Gradient';\nColorPicker.Input.displayName = 'ColorPicker.Input';\n"],"names":["ColorPickerRoot","children","currentColor","DEFAULT_COLOR","onColorChange","defaultFormat","DEFAULT_FORMAT","dataTestId","props","forwardedRef","currentFormat","setCurrentFormat","useState","jsx","styles","Children","child","ColorPickerSlot","color","getColorWithName","RadixSlot","ForwardedRefColorPicker","forwardRef","ColorPicker","ForwardedRefColorValueInput","ForwardedRefColorGradientInput","ForwardedRefColorPickerInput"],"mappings":";;;;;;;;AAoCO,MAAMA,IAAkB,CAC3B;AAAA,EACI,UAAAC;AAAA,EACA,cAAAC,IAAeC;AAAA,EACf,eAAAC,IAAgB,MAAM;AAAA,EAAC;AAAA,EACvB,eAAAC,IAAgBC;AAAA,EAChB,gBAAgBC,IAAa;AAAA,EAC7B,GAAGC;AACP,GACAC,MACC;AACD,QAAM,CAACC,GAAeC,CAAgB,IAAIC,EAAsBP,CAAa;AAE7E,SACK,gBAAAQ,EAAA,OAAA,EAAI,WAAWC,EAAO,MAAM,oBAAiB,gBAAe,gBAAcP,GAAY,KAAKE,GACvF,UAAAM,EAAS,IAAId,GAAU,CAACe,MACrB,gBAAAH;AAAA,IAACI;AAAA,IAAA;AAAA,MACI,GAAGT;AAAA,MACJ,eAAe,CAACU,MAAqB;AACnB,QAAAd,EAAAe,EAAiBD,GAAOR,CAAa,CAAC;AAAA,MACxD;AAAA,MACA,cAAAR;AAAA,MACA,eAAAQ;AAAA,MACA,kBAAkB,CAACA,MAA+B;AAC9C,QAAAC,EAAiBD,CAAa,GAChBN,EAAAe,EAAiBjB,GAAcQ,CAAa,CAAC;AAAA,MAC/D;AAAA,MAEC,UAAAM;AAAA,IAAA;AAAA,EAER,CAAA,GACL;AAER;AACAhB,EAAgB,cAAc;AAM9B,MAAMiB,IAAkB,CAAC,EAAE,UAAAhB,GAAU,GAAGO,EAAM,MAA6B,gBAAAK,EAAAO,GAAA,EAAW,GAAGZ,GAAQ,UAAAP,GAAS,GAE7FoB,IAA0BC,EAA6CtB,CAAe,GAEtFuB,IAAc;AAAA,EACvB,MAAMF;AAAA,EACN,QAAQG;AAAA,EACR,UAAUC;AAAA,EACV,OAAOC;AACX;AAEAH,EAAY,KAAK,cAAc;AAC/BA,EAAY,OAAO,cAAc;AACjCA,EAAY,SAAS,cAAc;AACnCA,EAAY,MAAM,cAAc;"}
1
+ {"version":3,"file":"fondue-components7.js","sources":["../src/components/ColorPicker/ColorPicker.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { Slot as RadixSlot } from '@radix-ui/react-slot';\nimport { Children, forwardRef, useMemo, useState, type ForwardedRef, type ReactNode } from 'react';\n\nimport { ForwardedRefColorGradientInput } from './ColorGradientInput';\nimport { ForwardedRefColorPickerInput } from './ColorPickerInput';\nimport { ForwardedRefColorValueInput } from './ColorValueInput';\nimport styles from './styles/customColorPicker.module.scss';\nimport { type ColorFormat, type RgbaColor } from './types';\nimport { DEFAULT_COLOR, DEFAULT_FORMAT, getColorWithName } from './utils';\n\ntype ColorPickerProps = {\n /**\n * The children of the color picker component. This can contain multiple `ColorPicker.Values` or `ColorPicker.Gradient` components.\n */\n children?: ReactNode;\n /**\n * The active color in the color picker\n */\n currentColor?: RgbaColor;\n /**\n * Event handler called when the color changes\n */\n onColorChange?: (color: RgbaColor) => void;\n /**\n * The active color format in the color picker\n */\n currentFormat?: ColorFormat;\n /**\n * Event handler called when the color format changes\n */\n onFormatChange?: (format: ColorFormat) => void;\n /**\n * The default format to use for the color input when not controlled externally\n * @default \"HEX\"\n */\n defaultFormat?: ColorFormat;\n /**\n * The test id of the color picker\n */\n 'data-test-id'?: string;\n};\n\nexport const ColorPickerRoot = (\n {\n children,\n currentColor = DEFAULT_COLOR,\n onColorChange = () => {},\n currentFormat,\n onFormatChange = () => {},\n defaultFormat = DEFAULT_FORMAT,\n 'data-test-id': dataTestId = 'color-picker-input',\n ...props\n }: ColorPickerProps,\n forwardedRef: ForwardedRef<HTMLDivElement>,\n) => {\n const [managedFormat, setManagedFormat] = useState<ColorFormat>(defaultFormat);\n const activeFormat = useMemo(() => currentFormat ?? managedFormat, [currentFormat, managedFormat]);\n\n return (\n <div className={styles.root} data-picker-type=\"custom-color\" data-test-id={dataTestId} ref={forwardedRef}>\n {Children.map(children, (child) => (\n <ColorPickerSlot\n {...props}\n onColorChange={(color: RgbaColor) => {\n onColorChange(getColorWithName(color, activeFormat));\n }}\n currentColor={currentColor}\n currentFormat={activeFormat}\n setCurrentFormat={(currentFormat: ColorFormat) => {\n setManagedFormat(currentFormat);\n onFormatChange(currentFormat);\n onColorChange(getColorWithName(currentColor, currentFormat));\n }}\n >\n {child}\n </ColorPickerSlot>\n ))}\n </div>\n );\n};\nColorPickerRoot.displayName = 'ColorPicker';\n\ntype ColorPickerSlotProps = ColorPickerProps & {\n currentFormat?: ColorFormat;\n setCurrentFormat?: (format: ColorFormat) => void;\n};\nconst ColorPickerSlot = ({ children, ...props }: ColorPickerSlotProps) => <RadixSlot {...props}>{children}</RadixSlot>;\n\nexport const ForwardedRefColorPicker = forwardRef<HTMLDivElement, ColorPickerProps>(ColorPickerRoot);\n\nexport const ColorPicker = {\n Root: ForwardedRefColorPicker,\n Values: ForwardedRefColorValueInput,\n Gradient: ForwardedRefColorGradientInput,\n Input: ForwardedRefColorPickerInput,\n};\n\nColorPicker.Root.displayName = 'ColorPicker.Root';\nColorPicker.Values.displayName = 'ColorPicker.Values';\nColorPicker.Gradient.displayName = 'ColorPicker.Gradient';\nColorPicker.Input.displayName = 'ColorPicker.Input';\n"],"names":["ColorPickerRoot","children","currentColor","DEFAULT_COLOR","onColorChange","currentFormat","onFormatChange","defaultFormat","DEFAULT_FORMAT","dataTestId","props","forwardedRef","managedFormat","setManagedFormat","useState","activeFormat","useMemo","jsx","styles","Children","child","ColorPickerSlot","color","getColorWithName","RadixSlot","ForwardedRefColorPicker","forwardRef","ColorPicker","ForwardedRefColorValueInput","ForwardedRefColorGradientInput","ForwardedRefColorPickerInput"],"mappings":";;;;;;;;AA4CO,MAAMA,IAAkB,CAC3B;AAAA,EACI,UAAAC;AAAA,EACA,cAAAC,IAAeC;AAAA,EACf,eAAAC,IAAgB,MAAM;AAAA,EAAC;AAAA,EACvB,eAAAC;AAAA,EACA,gBAAAC,IAAiB,MAAM;AAAA,EAAC;AAAA,EACxB,eAAAC,IAAgBC;AAAA,EAChB,gBAAgBC,IAAa;AAAA,EAC7B,GAAGC;AACP,GACAC,MACC;AACD,QAAM,CAACC,GAAeC,CAAgB,IAAIC,EAAsBP,CAAa,GACvEQ,IAAeC,EAAQ,MAAMX,KAAiBO,GAAe,CAACP,GAAeO,CAAa,CAAC;AAEjG,SACK,gBAAAK,EAAA,OAAA,EAAI,WAAWC,EAAO,MAAM,oBAAiB,gBAAe,gBAAcT,GAAY,KAAKE,GACvF,UAAAQ,EAAS,IAAIlB,GAAU,CAACmB,MACrB,gBAAAH;AAAA,IAACI;AAAA,IAAA;AAAA,MACI,GAAGX;AAAA,MACJ,eAAe,CAACY,MAAqB;AACnB,QAAAlB,EAAAmB,EAAiBD,GAAOP,CAAY,CAAC;AAAA,MACvD;AAAA,MACA,cAAAb;AAAA,MACA,eAAea;AAAA,MACf,kBAAkB,CAACV,MAA+B;AAC9C,QAAAQ,EAAiBR,CAAa,GAC9BC,EAAeD,CAAa,GACdD,EAAAmB,EAAiBrB,GAAcG,CAAa,CAAC;AAAA,MAC/D;AAAA,MAEC,UAAAe;AAAA,IAAA;AAAA,EAER,CAAA,GACL;AAER;AACApB,EAAgB,cAAc;AAM9B,MAAMqB,IAAkB,CAAC,EAAE,UAAApB,GAAU,GAAGS,EAAM,MAA6B,gBAAAO,EAAAO,GAAA,EAAW,GAAGd,GAAQ,UAAAT,GAAS,GAE7FwB,IAA0BC,EAA6C1B,CAAe,GAEtF2B,IAAc;AAAA,EACvB,MAAMF;AAAA,EACN,QAAQG;AAAA,EACR,UAAUC;AAAA,EACV,OAAOC;AACX;AAEAH,EAAY,KAAK,cAAc;AAC/BA,EAAY,OAAO,cAAc;AACjCA,EAAY,SAAS,cAAc;AACnCA,EAAY,MAAM,cAAc;"}
@@ -1,21 +1,18 @@
1
- const o = "_root_kjbh5_5", t = "_input_kjbh5_59", s = "_slot_kjbh5_82", _ = "_iconSuccess_kjbh5_132", n = "_iconError_kjbh5_141", c = "_loadingStatus_kjbh5_155", i = "_spin_kjbh5_1", r = {
1
+ const o = "_root_kjbh5_5", t = "_input_kjbh5_59", s = "_slot_kjbh5_82", c = "_iconSuccess_kjbh5_132", n = "_iconError_kjbh5_141", _ = "_loadingStatus_kjbh5_155", r = {
2
2
  root: o,
3
3
  input: t,
4
4
  slot: s,
5
- iconSuccess: _,
5
+ iconSuccess: c,
6
6
  iconError: n,
7
- loadingStatus: c,
8
- spin: i,
9
- "tw-dark": "_tw-dark_kjbh5_187"
7
+ loadingStatus: _
10
8
  };
11
9
  export {
12
10
  r as default,
13
11
  n as iconError,
14
- _ as iconSuccess,
12
+ c as iconSuccess,
15
13
  t as input,
16
- c as loadingStatus,
14
+ _ as loadingStatus,
17
15
  o as root,
18
- s as slot,
19
- i as spin
16
+ s as slot
20
17
  };
21
18
  //# sourceMappingURL=fondue-components73.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"fondue-components73.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;"}
1
+ {"version":3,"file":"fondue-components73.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;"}
@@ -1,20 +1,20 @@
1
- const o = "_root_25qs7_5", t = "_colorName_25qs7_56", c = "_button_25qs7_60", s = "_colorIndicator_25qs7_73", _ = "_actions_25qs7_80", r = "_clear_25qs7_90", a = "_caret_25qs7_103", n = {
1
+ const o = "_root_18mav_5", t = "_colorName_18mav_56", c = "_button_18mav_60", a = "_colorIndicator_18mav_73", _ = "_actions_18mav_92", r = "_clear_18mav_102", n = "_caret_18mav_115", s = {
2
2
  root: o,
3
3
  colorName: t,
4
4
  button: c,
5
- colorIndicator: s,
5
+ colorIndicator: a,
6
6
  actions: _,
7
7
  clear: r,
8
- caret: a
8
+ caret: n
9
9
  };
10
10
  export {
11
11
  _ as actions,
12
12
  c as button,
13
- a as caret,
13
+ n as caret,
14
14
  r as clear,
15
- s as colorIndicator,
15
+ a as colorIndicator,
16
16
  t as colorName,
17
- n as default,
17
+ s as default,
18
18
  o as root
19
19
  };
20
20
  //# sourceMappingURL=fondue-components77.js.map
@@ -3,7 +3,7 @@ import { IconCross as j } from "@frontify/fondue-icons";
3
3
  import * as d from "@radix-ui/react-dialog";
4
4
  import { createContext as q, forwardRef as l, useRef as B, useContext as z } from "react";
5
5
  import { useSyncRefs as E } from "./fondue-components43.js";
6
- import { addAutoFocusAttribute as L, addShowFocusRing as $ } from "./fondue-components44.js";
6
+ import { addShowFocusRing as L, addAutoFocusAttribute as $ } from "./fondue-components44.js";
7
7
  import { useFondueTheme as k, ThemeProvider as G } from "./fondue-components28.js";
8
8
  import n from "./fondue-components45.js";
9
9
  const p = q({ isModal: !1 }), f = ({ children: t, ...o }) => /* @__PURE__ */ e(p.Provider, { value: { isModal: o.modal ?? !1 }, children: /* @__PURE__ */ e(d.Root, { ...o, children: t }) });
@@ -11,7 +11,7 @@ f.displayName = "Dialog.Root";
11
11
  const y = ({ asChild: t = !0, children: o, "data-test-id": a = "fondue-dialog-trigger", ...i }, r) => /* @__PURE__ */ e(
12
12
  d.Trigger,
13
13
  {
14
- onMouseDown: L,
14
+ onMouseDown: $,
15
15
  "data-auto-focus-visible": "true",
16
16
  "data-auto-focus-trigger": !0,
17
17
  "data-test-id": a,
@@ -57,7 +57,7 @@ const I = ({ children: t, showUnderlay: o }) => {
57
57
  },
58
58
  ref: c,
59
59
  className: n.content,
60
- onFocus: $,
60
+ onFocus: L,
61
61
  onOpenAutoFocus: H,
62
62
  "data-dialog-padding": i,
63
63
  "data-dialog-rounded": T,
package/dist/index.d.ts CHANGED
@@ -24,11 +24,11 @@ export declare const Accordion: {
24
24
  displayName: string;
25
25
  };
26
26
  Item: {
27
- ({ "data-test-id": dataTestId, children, disabled, onClick, value, }: AccordionItemProps): JSX_2.Element;
27
+ ({ "data-test-id": dataTestId, children, disabled, value, }: AccordionItemProps): JSX_2.Element;
28
28
  displayName: string;
29
29
  };
30
30
  Header: {
31
- ({ children }: AccordionHeaderProps): JSX_2.Element;
31
+ ({ onClick, children }: AccordionHeaderProps): JSX_2.Element;
32
32
  displayName: string;
33
33
  };
34
34
  Trigger: {
@@ -63,6 +63,10 @@ declare type AccordionContentProps = {
63
63
  };
64
64
 
65
65
  declare type AccordionHeaderProps = {
66
+ /**
67
+ * Click callback for this item.
68
+ */
69
+ onClick?: MouseEventHandler<HTMLDivElement>;
66
70
  /**
67
71
  * Children of the Accordion header. This should contain `Accordion.Trigger`
68
72
  */
@@ -81,10 +85,6 @@ declare type AccordionItemProps = {
81
85
  * @default false
82
86
  */
83
87
  disabled?: boolean;
84
- /**
85
- * Click callback for this item.
86
- */
87
- onClick?: MouseEventHandler<HTMLDivElement>;
88
88
  /**
89
89
  * A string value for the accordion item. All items within an accordion should use a unique value.
90
90
  */
@@ -353,7 +353,15 @@ declare type ColorPickerProps = {
353
353
  */
354
354
  onColorChange?: (color: RgbaColor) => void;
355
355
  /**
356
- * The default format to use for the color input
356
+ * The active color format in the color picker
357
+ */
358
+ currentFormat?: ColorFormat;
359
+ /**
360
+ * Event handler called when the color format changes
361
+ */
362
+ onFormatChange?: (format: ColorFormat) => void;
363
+ /**
364
+ * The default format to use for the color input when not controlled externally
357
365
  * @default "HEX"
358
366
  */
359
367
  defaultFormat?: ColorFormat;