@frontify/fondue-components 19.2.0 → 19.3.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.
- package/dist/fondue-components.js +10 -8
- package/dist/fondue-components.js.map +1 -1
- package/dist/fondue-components10.js +3 -3
- package/dist/fondue-components10.js.map +1 -1
- package/dist/fondue-components11.js +3 -3
- package/dist/fondue-components11.js.map +1 -1
- package/dist/fondue-components12.js +2 -2
- package/dist/fondue-components12.js.map +1 -1
- package/dist/fondue-components13.js +3 -3
- package/dist/fondue-components13.js.map +1 -1
- package/dist/fondue-components14.js +2 -2
- package/dist/fondue-components14.js.map +1 -1
- package/dist/fondue-components15.js +2 -2
- package/dist/fondue-components15.js.map +1 -1
- package/dist/fondue-components16.js +1 -1
- package/dist/fondue-components16.js.map +1 -1
- package/dist/fondue-components17.js +1 -1
- package/dist/fondue-components17.js.map +1 -1
- package/dist/fondue-components18.js +1 -1
- package/dist/fondue-components18.js.map +1 -1
- package/dist/fondue-components19.js +1 -1
- package/dist/fondue-components19.js.map +1 -1
- package/dist/fondue-components20.js +2 -2
- package/dist/fondue-components20.js.map +1 -1
- package/dist/fondue-components21.js +2 -2
- package/dist/fondue-components21.js.map +1 -1
- package/dist/fondue-components22.js +8 -8
- package/dist/fondue-components22.js.map +1 -1
- package/dist/fondue-components23.js +1 -1
- package/dist/fondue-components23.js.map +1 -1
- package/dist/fondue-components24.js +2 -2
- package/dist/fondue-components24.js.map +1 -1
- package/dist/fondue-components25.js +63 -62
- package/dist/fondue-components25.js.map +1 -1
- package/dist/fondue-components26.js +77 -70
- package/dist/fondue-components26.js.map +1 -1
- package/dist/fondue-components27.js +2 -2
- package/dist/fondue-components27.js.map +1 -1
- package/dist/fondue-components28.js +3 -12
- package/dist/fondue-components28.js.map +1 -1
- package/dist/fondue-components29.js +101 -10
- package/dist/fondue-components29.js.map +1 -1
- package/dist/fondue-components3.js +93 -73
- package/dist/fondue-components3.js.map +1 -1
- package/dist/fondue-components30.js +12 -55
- package/dist/fondue-components30.js.map +1 -1
- package/dist/fondue-components31.js +55 -14
- package/dist/fondue-components31.js.map +1 -1
- package/dist/fondue-components32.js +20 -7
- package/dist/fondue-components32.js.map +1 -1
- package/dist/fondue-components33.js +7 -6
- package/dist/fondue-components33.js.map +1 -1
- package/dist/fondue-components34.js +7 -32
- package/dist/fondue-components34.js.map +1 -1
- package/dist/fondue-components35.js +32 -5
- package/dist/fondue-components35.js.map +1 -1
- package/dist/fondue-components36.js +5 -12
- package/dist/fondue-components36.js.map +1 -1
- package/dist/fondue-components37.js +10 -153
- package/dist/fondue-components37.js.map +1 -1
- package/dist/fondue-components38.js +59 -22
- package/dist/fondue-components38.js.map +1 -1
- package/dist/fondue-components39.js +17 -17
- package/dist/fondue-components39.js.map +1 -1
- package/dist/fondue-components4.js +33 -32
- package/dist/fondue-components4.js.map +1 -1
- package/dist/fondue-components40.js +112 -15
- package/dist/fondue-components40.js.map +1 -1
- package/dist/fondue-components41.js +19 -30
- package/dist/fondue-components41.js.map +1 -1
- package/dist/fondue-components42.js +32 -62
- package/dist/fondue-components42.js.map +1 -1
- package/dist/fondue-components43.js +53 -121
- package/dist/fondue-components43.js.map +1 -1
- package/dist/fondue-components44.js +129 -20
- package/dist/fondue-components44.js.map +1 -1
- package/dist/fondue-components45.js +21 -45
- package/dist/fondue-components45.js.map +1 -1
- package/dist/fondue-components46.js +45 -8
- package/dist/fondue-components46.js.map +1 -1
- package/dist/fondue-components47.js +8 -13
- package/dist/fondue-components47.js.map +1 -1
- package/dist/fondue-components48.js +13 -15
- package/dist/fondue-components48.js.map +1 -1
- package/dist/fondue-components49.js +14 -4
- package/dist/fondue-components49.js.map +1 -1
- package/dist/fondue-components5.js +2 -2
- package/dist/fondue-components5.js.map +1 -1
- package/dist/fondue-components50.js +5 -60
- package/dist/fondue-components50.js.map +1 -1
- package/dist/fondue-components51.js +59 -17
- package/dist/fondue-components51.js.map +1 -1
- package/dist/fondue-components52.js +18 -19
- package/dist/fondue-components52.js.map +1 -1
- package/dist/fondue-components53.js +18 -4
- package/dist/fondue-components53.js.map +1 -1
- package/dist/fondue-components54.js +3 -13
- package/dist/fondue-components54.js.map +1 -1
- package/dist/fondue-components55.js +13 -3
- package/dist/fondue-components55.js.map +1 -1
- package/dist/fondue-components56.js +3 -17
- package/dist/fondue-components56.js.map +1 -1
- package/dist/fondue-components57.js +19 -35
- package/dist/fondue-components57.js.map +1 -1
- package/dist/fondue-components58.js +35 -5
- package/dist/fondue-components58.js.map +1 -1
- package/dist/fondue-components59.js +4 -12
- package/dist/fondue-components59.js.map +1 -1
- package/dist/fondue-components6.js +4 -4
- package/dist/fondue-components6.js.map +1 -1
- package/dist/fondue-components60.js +12 -4
- package/dist/fondue-components60.js.map +1 -1
- package/dist/fondue-components61.js +4 -24
- package/dist/fondue-components61.js.map +1 -1
- package/dist/fondue-components62.js +24 -16
- package/dist/fondue-components62.js.map +1 -1
- package/dist/fondue-components63.js +16 -150
- package/dist/fondue-components63.js.map +1 -1
- package/dist/fondue-components64.js +151 -19
- package/dist/fondue-components64.js.map +1 -1
- package/dist/fondue-components65.js +19 -77
- package/dist/fondue-components65.js.map +1 -1
- package/dist/fondue-components66.js +77 -8
- package/dist/fondue-components66.js.map +1 -1
- package/dist/fondue-components67.js +8 -35
- package/dist/fondue-components67.js.map +1 -1
- package/dist/fondue-components68.js +34 -70
- package/dist/fondue-components68.js.map +1 -1
- package/dist/fondue-components69.js +70 -10
- package/dist/fondue-components69.js.map +1 -1
- package/dist/fondue-components7.js +36 -30
- package/dist/fondue-components7.js.map +1 -1
- package/dist/fondue-components70.js +8 -10
- package/dist/fondue-components70.js.map +1 -1
- package/dist/fondue-components71.js +12 -12
- package/dist/fondue-components71.js.map +1 -1
- package/dist/fondue-components72.js +12 -20
- package/dist/fondue-components72.js.map +1 -1
- package/dist/fondue-components73.js +21 -29
- package/dist/fondue-components73.js.map +1 -1
- package/dist/fondue-components74.js +33 -55
- package/dist/fondue-components74.js.map +1 -1
- package/dist/fondue-components75.js +55 -14
- package/dist/fondue-components75.js.map +1 -1
- package/dist/fondue-components76.js +14 -25
- package/dist/fondue-components76.js.map +1 -1
- package/dist/fondue-components77.js +24 -13
- package/dist/fondue-components77.js.map +1 -1
- package/dist/fondue-components78.js +14 -6
- package/dist/fondue-components78.js.map +1 -1
- package/dist/fondue-components79.js +21 -5
- package/dist/fondue-components79.js.map +1 -1
- package/dist/fondue-components8.js +5 -5
- package/dist/fondue-components8.js.map +1 -1
- package/dist/fondue-components80.js +6 -4
- package/dist/fondue-components80.js.map +1 -1
- package/dist/fondue-components81.js +6 -4
- package/dist/fondue-components81.js.map +1 -1
- package/dist/fondue-components82.js +5 -2
- package/dist/fondue-components82.js.map +1 -1
- package/dist/fondue-components83.js +4 -16
- package/dist/fondue-components83.js.map +1 -1
- package/dist/fondue-components84.js +2 -40
- package/dist/fondue-components84.js.map +1 -1
- package/dist/fondue-components85.js +43 -0
- package/dist/fondue-components85.js.map +1 -0
- package/dist/fondue-components86.js +20 -0
- package/dist/fondue-components86.js.map +1 -0
- package/dist/fondue-components9.js +37 -32
- package/dist/fondue-components9.js.map +1 -1
- package/dist/index.d.ts +125 -50
- package/dist/style.css +1 -1
- package/package.json +60 -60
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fondue-components59.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"fondue-components59.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsx as r } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef as y } from "react";
|
|
3
|
-
import { cn as x } from "./fondue-
|
|
4
|
-
import { buttonStyles as S } from "./fondue-
|
|
5
|
-
import { iconStyles as k } from "./fondue-
|
|
6
|
-
import { textStyles as B } from "./fondue-
|
|
3
|
+
import { cn as x } from "./fondue-components37.js";
|
|
4
|
+
import { buttonStyles as S } from "./fondue-components38.js";
|
|
5
|
+
import { iconStyles as k } from "./fondue-components39.js";
|
|
6
|
+
import { textStyles as B } from "./fondue-components40.js";
|
|
7
7
|
const C = y(
|
|
8
8
|
({
|
|
9
9
|
children: f,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fondue-components6.js","sources":["../src/components/Button/Button.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { forwardRef, type ForwardedRef, type MouseEvent, type ReactNode } from 'react';\n\nimport { cn } from '#/utilities/styleUtilities';\n\nimport { buttonStyles } from './styles/buttonStyles';\nimport { iconStyles } from './styles/iconStyles';\nimport { textStyles } from './styles/textStyles';\n\ntype ButtonRounding = 'medium' | 'full';\n\ntype ButtonStyle = 'default' | 'positive' | 'negative' | 'danger' | 'loud';\n\ntype ButtonSize = 'small' | 'medium' | 'large';\n\ntype ButtonType = 'button' | 'submit' | 'reset';\n\ntype ButtonEmphasis = 'default' | 'weak' | 'strong';\n\ntype ButtonAspect = 'default' | 'square';\n\nexport type ButtonProps = {\n /**\n * @default \"button\"\n */\n type?: ButtonType;\n /**\n * @default null\n */\n title?: string;\n /**\n * @default \"default\"\n */\n variant?: ButtonStyle;\n /**\n * @default \"strong\"\n */\n emphasis?: ButtonEmphasis;\n /**\n * @default \"medium\"\n */\n size?: ButtonSize;\n /**\n * @default \"medium\"\n */\n rounding?: ButtonRounding;\n /**\n * @default false\n */\n disabled?: boolean;\n /**\n * @default \"default\"\n */\n aspect?: ButtonAspect;\n /**\n * @default true\n */\n hugWidth?: boolean;\n children?: ReactNode;\n onPress?: (event?: MouseEvent<HTMLButtonElement>) => void;\n form?: string;\n 'aria-label'?: string;\n 'aria-describedby'?: string;\n 'data-test-id'?: string;\n className?: string;\n};\n\nexport const Button = forwardRef<HTMLButtonElement | null, ButtonProps>(\n (\n {\n children,\n type = 'button',\n variant,\n size = 'medium',\n form,\n 'data-test-id': dataTestId = 'fondue-button',\n className = '',\n onPress = () => {},\n hugWidth = true,\n ...props\n }: ButtonProps,\n ref: ForwardedRef<HTMLButtonElement | null>,\n ) => {\n return (\n <button\n ref={ref}\n type={type}\n form={form}\n data-test-id={dataTestId}\n className={cn(\n buttonStyles({ size, variant, hugWidth, ...props }),\n textStyles({ variant, ...props }),\n iconStyles({ variant, ...props }),\n className,\n )}\n {...props}\n onClick={(event) => {\n // @ts-expect-error - Allows other components who use Button as a trigger to pass an action\n // eslint-disable-next-line @typescript-eslint/no-unsafe-call\n props.onClick?.(event);\n onPress?.(event);\n }}\n >\n {children}\n </button>\n );\n },\n);\n\nButton.displayName = 'Button';\n"],"names":["Button","forwardRef","children","type","variant","size","form","dataTestId","className","onPress","hugWidth","props","ref","jsx","cn","buttonStyles","textStyles","iconStyles","event","_a"],"mappings":";;;;;;AAoEO,MAAMA,IAASC;AAAA,EAClB,CACI;AAAA,IACI,UAAAC;AAAA,IACA,MAAAC,IAAO;AAAA,IACP,SAAAC;AAAA,IACA,MAAAC,IAAO;AAAA,IACP,MAAAC;AAAA,IACA,gBAAgBC,IAAa;AAAA,IAC7B,WAAAC,IAAY;AAAA,IACZ,SAAAC,IAAU,MAAM;AAAA,IAAC;AAAA,IACjB,UAAAC,IAAW;AAAA,IACX,GAAGC;AAAA,
|
|
1
|
+
{"version":3,"file":"fondue-components6.js","sources":["../src/components/Button/Button.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { forwardRef, type ForwardedRef, type MouseEvent, type ReactNode } from 'react';\n\nimport { cn } from '#/utilities/styleUtilities';\n\nimport { buttonStyles } from './styles/buttonStyles';\nimport { iconStyles } from './styles/iconStyles';\nimport { textStyles } from './styles/textStyles';\n\ntype ButtonRounding = 'medium' | 'full';\n\ntype ButtonStyle = 'default' | 'positive' | 'negative' | 'danger' | 'loud';\n\ntype ButtonSize = 'small' | 'medium' | 'large';\n\ntype ButtonType = 'button' | 'submit' | 'reset';\n\ntype ButtonEmphasis = 'default' | 'weak' | 'strong';\n\ntype ButtonAspect = 'default' | 'square';\n\nexport type ButtonProps = {\n /**\n * @default \"button\"\n */\n type?: ButtonType;\n /**\n * @default null\n */\n title?: string;\n /**\n * @default \"default\"\n */\n variant?: ButtonStyle;\n /**\n * @default \"strong\"\n */\n emphasis?: ButtonEmphasis;\n /**\n * @default \"medium\"\n */\n size?: ButtonSize;\n /**\n * @default \"medium\"\n */\n rounding?: ButtonRounding;\n /**\n * @default false\n */\n disabled?: boolean;\n /**\n * @default \"default\"\n */\n aspect?: ButtonAspect;\n /**\n * @default true\n */\n hugWidth?: boolean;\n children?: ReactNode;\n onPress?: (event?: MouseEvent<HTMLButtonElement>) => void;\n form?: string;\n 'aria-label'?: string;\n 'aria-describedby'?: string;\n 'data-test-id'?: string;\n className?: string;\n};\n\nexport const Button = forwardRef<HTMLButtonElement | null, ButtonProps>(\n (\n {\n children,\n type = 'button',\n variant,\n size = 'medium',\n form,\n 'data-test-id': dataTestId = 'fondue-button',\n className = '',\n onPress = () => {},\n hugWidth = true,\n ...props\n }: ButtonProps,\n ref: ForwardedRef<HTMLButtonElement | null>,\n ) => {\n return (\n <button\n ref={ref}\n type={type}\n form={form}\n data-test-id={dataTestId}\n className={cn(\n buttonStyles({ size, variant, hugWidth, ...props }),\n textStyles({ variant, ...props }),\n iconStyles({ variant, ...props }),\n className,\n )}\n {...props}\n onClick={(event) => {\n // @ts-expect-error - Allows other components who use Button as a trigger to pass an action\n // eslint-disable-next-line @typescript-eslint/no-unsafe-call\n props.onClick?.(event);\n onPress?.(event);\n }}\n >\n {children}\n </button>\n );\n },\n);\n\nButton.displayName = 'Button';\n"],"names":["Button","forwardRef","children","type","variant","size","form","dataTestId","className","onPress","hugWidth","props","ref","jsx","cn","buttonStyles","textStyles","iconStyles","event","_a"],"mappings":";;;;;;AAoEO,MAAMA,IAASC;AAAA,EAClB,CACI;AAAA,IACI,UAAAC;AAAA,IACA,MAAAC,IAAO;AAAA,IACP,SAAAC;AAAA,IACA,MAAAC,IAAO;AAAA,IACP,MAAAC;AAAA,IACA,gBAAgBC,IAAa;AAAA,IAC7B,WAAAC,IAAY;AAAA,IACZ,SAAAC,IAAU,MAAM;AAAA,IAAC;AAAA,IACjB,UAAAC,IAAW;AAAA,IACX,GAAGC;AAAA,EAAA,GAEPC,MAGI,gBAAAC;AAAA,IAAC;AAAA,IAAA;AAAA,MACG,KAAAD;AAAA,MACA,MAAAT;AAAA,MACA,MAAAG;AAAA,MACA,gBAAcC;AAAA,MACd,WAAWO;AAAA,QACPC,EAAa,EAAE,MAAAV,GAAM,SAAAD,GAAS,UAAAM,GAAU,GAAGC,GAAO;AAAA,QAClDK,EAAW,EAAE,SAAAZ,GAAS,GAAGO,GAAO;AAAA,QAChCM,EAAW,EAAE,SAAAb,GAAS,GAAGO,GAAO;AAAA,QAChCH;AAAA,MAAA;AAAA,MAEH,GAAGG;AAAA,MACJ,SAAS,CAACO,MAAU;;AAGhB,SAAAC,IAAAR,EAAM,YAAN,QAAAQ,EAAA,KAAAR,GAAgBO,IAChBT,KAAA,QAAAA,EAAUS;AAAA,MACd;AAAA,MAEC,UAAAhB;AAAA,IAAA;AAAA,EAAA;AAIjB;AAEAF,EAAO,cAAc;"}
|
|
@@ -1,8 +1,16 @@
|
|
|
1
|
-
const o = "
|
|
2
|
-
root: o
|
|
1
|
+
const o = "_root_hkznm_4", r = "_viewport_hkznm_12", t = "_scrollbar_hkznm_43", _ = "_thumb_hkznm_75", n = "_corner_hkznm_93", c = {
|
|
2
|
+
root: o,
|
|
3
|
+
viewport: r,
|
|
4
|
+
scrollbar: t,
|
|
5
|
+
thumb: _,
|
|
6
|
+
corner: n
|
|
3
7
|
};
|
|
4
8
|
export {
|
|
5
|
-
|
|
6
|
-
|
|
9
|
+
n as corner,
|
|
10
|
+
c as default,
|
|
11
|
+
o as root,
|
|
12
|
+
t as scrollbar,
|
|
13
|
+
_ as thumb,
|
|
14
|
+
r as viewport
|
|
7
15
|
};
|
|
8
16
|
//# sourceMappingURL=fondue-components60.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fondue-components60.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"fondue-components60.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;"}
|
|
@@ -1,28 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
prop: e,
|
|
4
|
-
defaultProp: n,
|
|
5
|
-
onChange: s = () => {
|
|
6
|
-
}
|
|
7
|
-
}) => {
|
|
8
|
-
const [o, c] = b({ defaultProp: n, onChange: s }), t = e !== void 0, i = t ? e : o, r = f(() => s, [s]), a = d(
|
|
9
|
-
(l) => {
|
|
10
|
-
if (t) {
|
|
11
|
-
const u = typeof l == "function" ? l(e) : l;
|
|
12
|
-
u !== e && r(u);
|
|
13
|
-
} else
|
|
14
|
-
c(l);
|
|
15
|
-
},
|
|
16
|
-
[t, e, c, r]
|
|
17
|
-
);
|
|
18
|
-
return [i, a];
|
|
19
|
-
}, b = ({ defaultProp: e, onChange: n }) => {
|
|
20
|
-
const s = v(e), [o] = s, c = S(o), t = f(() => n, [n]);
|
|
21
|
-
return m(() => {
|
|
22
|
-
c.current !== o && (t == null || t(o), c.current = o);
|
|
23
|
-
}, [o, c, t]), s;
|
|
1
|
+
const o = "_root_5sic9_5", t = {
|
|
2
|
+
root: o
|
|
24
3
|
};
|
|
25
4
|
export {
|
|
26
|
-
|
|
5
|
+
t as default,
|
|
6
|
+
o as root
|
|
27
7
|
};
|
|
28
8
|
//# sourceMappingURL=fondue-components61.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fondue-components61.js","sources":[
|
|
1
|
+
{"version":3,"file":"fondue-components61.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;"}
|
|
@@ -1,20 +1,28 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import { useMemo as f, useCallback as d, useState as v, useRef as m, useEffect as S } from "react";
|
|
2
|
+
const U = ({
|
|
3
|
+
prop: s,
|
|
4
|
+
defaultProp: c,
|
|
5
|
+
onChange: t = () => {
|
|
6
|
+
}
|
|
7
|
+
}) => {
|
|
8
|
+
const [n, o] = b({ defaultProp: c, onChange: t }), e = s !== void 0, i = e ? s : n, r = f(() => t, [t]), a = d(
|
|
9
|
+
(l) => {
|
|
10
|
+
if (e) {
|
|
11
|
+
const u = typeof l == "function" ? l(s) : l;
|
|
12
|
+
u !== s && r(u);
|
|
13
|
+
} else
|
|
14
|
+
o(l);
|
|
15
|
+
},
|
|
16
|
+
[e, s, o, r]
|
|
17
|
+
);
|
|
18
|
+
return [i, a];
|
|
19
|
+
}, b = ({ defaultProp: s, onChange: c }) => {
|
|
20
|
+
const [t, n] = v(s), o = m(t), e = f(() => c, [c]);
|
|
21
|
+
return S(() => {
|
|
22
|
+
o.current !== t && (e == null || e(t), o.current = t);
|
|
23
|
+
}, [t, o, e]), [t, n];
|
|
9
24
|
};
|
|
10
25
|
export {
|
|
11
|
-
|
|
12
|
-
n as default,
|
|
13
|
-
e as item,
|
|
14
|
-
a as itemLabel,
|
|
15
|
-
i as itemLabelActive,
|
|
16
|
-
o as itemLabelInactive,
|
|
17
|
-
t as root,
|
|
18
|
-
c as separator
|
|
26
|
+
U as useControllableState
|
|
19
27
|
};
|
|
20
28
|
//# sourceMappingURL=fondue-components62.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fondue-components62.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"fondue-components62.js","sources":["../src/hooks/useControllableState.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type Dispatch, type SetStateAction, useCallback, useMemo, useState, useRef, useEffect } from 'react';\n\n// Radix UI handy hook for handling controlled and uncontrolled state\n// Source: https://github.com/radix-ui/primitives/blob/main/packages/react/use-controllable-state/src/useControllableState.tsx\n\ntype UseControllableStateParams<TValue> = {\n prop?: TValue;\n defaultProp?: TValue;\n onChange?: (state: TValue) => void;\n};\n\ntype SetStateFn<T> = (prevState?: T) => T;\n\nexport const useControllableState = <TValue>({\n prop,\n defaultProp,\n onChange = () => {},\n}: UseControllableStateParams<TValue>) => {\n const [uncontrolledProp, setUncontrolledProp] = useUncontrolledState({ defaultProp, onChange });\n const isControlled = prop !== undefined;\n const value = isControlled ? prop : uncontrolledProp;\n const handleChange = useMemo(() => onChange, [onChange]);\n\n const setValue: Dispatch<SetStateAction<TValue | undefined>> = useCallback(\n (nextValue) => {\n if (isControlled) {\n const setter = nextValue as SetStateFn<TValue>;\n const value = typeof nextValue === 'function' ? setter(prop) : nextValue;\n if (value !== prop) {\n handleChange(value as TValue);\n }\n } else {\n setUncontrolledProp(nextValue);\n }\n },\n [isControlled, prop, setUncontrolledProp, handleChange],\n );\n\n return [value, setValue] as const;\n};\n\nconst useUncontrolledState = <TValue>({ defaultProp, onChange }: Omit<UseControllableStateParams<TValue>, 'prop'>) => {\n const [value, setValue] = useState<TValue | undefined>(defaultProp);\n const prevValueRef = useRef(value);\n const handleChange = useMemo(() => onChange, [onChange]);\n\n useEffect(() => {\n if (prevValueRef.current !== value) {\n handleChange?.(value as TValue);\n prevValueRef.current = value;\n }\n }, [value, prevValueRef, handleChange]);\n\n return [value, setValue] as const;\n};\n"],"names":["useControllableState","prop","defaultProp","onChange","uncontrolledProp","setUncontrolledProp","useUncontrolledState","isControlled","value","handleChange","useMemo","setValue","useCallback","nextValue","useState","prevValueRef","useRef","useEffect"],"mappings":";AAeO,MAAMA,IAAuB,CAAS;AAAA,EACzC,MAAAC;AAAA,EACA,aAAAC;AAAA,EACA,UAAAC,IAAW,MAAM;AAAA,EAAC;AACtB,MAA0C;AACtC,QAAM,CAACC,GAAkBC,CAAmB,IAAIC,EAAqB,EAAE,aAAAJ,GAAa,UAAAC,GAAU,GACxFI,IAAeN,MAAS,QACxBO,IAAQD,IAAeN,IAAOG,GAC9BK,IAAeC,EAAQ,MAAMP,GAAU,CAACA,CAAQ,CAAC,GAEjDQ,IAAyDC;AAAA,IAC3D,CAACC,MAAc;AACX,UAAIN,GAAc;AAEd,cAAMC,IAAQ,OAAOK,KAAc,aADpBA,EACwCZ,CAAI,IAAIY;AAC/D,QAAIL,MAAUP,KACVQ,EAAaD,CAAe;AAAA,MAEpC;AACI,QAAAH,EAAoBQ,CAAS;AAAA,IAErC;AAAA,IACA,CAACN,GAAcN,GAAMI,GAAqBI,CAAY;AAAA,EAAA;AAG1D,SAAO,CAACD,GAAOG,CAAQ;AAC3B,GAEML,IAAuB,CAAS,EAAE,aAAAJ,GAAa,UAAAC,QAAiE;AAClH,QAAM,CAACK,GAAOG,CAAQ,IAAIG,EAA6BZ,CAAW,GAC5Da,IAAeC,EAAOR,CAAK,GAC3BC,IAAeC,EAAQ,MAAMP,GAAU,CAACA,CAAQ,CAAC;AAEvD,SAAAc,EAAU,MAAM;AACZ,IAAIF,EAAa,YAAYP,MACzBC,KAAA,QAAAA,EAAeD,IACfO,EAAa,UAAUP;AAAA,EAE/B,GAAG,CAACA,GAAOO,GAAcN,CAAY,CAAC,GAE/B,CAACD,GAAOG,CAAQ;AAC3B;"}
|
|
@@ -1,154 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
import { SelectMenu as re } from "./fondue-components65.js";
|
|
10
|
-
import t from "./fondue-components67.js";
|
|
11
|
-
import { useSelectData as ae } from "./fondue-components68.js";
|
|
12
|
-
const L = ({
|
|
13
|
-
children: O,
|
|
14
|
-
onSelect: i,
|
|
15
|
-
value: v,
|
|
16
|
-
defaultValue: F,
|
|
17
|
-
placeholder: M = "",
|
|
18
|
-
status: s = "neutral",
|
|
19
|
-
disabled: f,
|
|
20
|
-
"data-test-id": r = "fondue-select-combobox",
|
|
21
|
-
alignMenu: P = "start",
|
|
22
|
-
side: k = "bottom",
|
|
23
|
-
id: y,
|
|
24
|
-
viewportCollisionPadding: z = "compact",
|
|
25
|
-
getAsyncItems: c,
|
|
26
|
-
...a
|
|
27
|
-
}, D) => {
|
|
28
|
-
const { inputSlots: H, menuSlots: V, items: u, filterText: $, clearButton: h, getItemByValue: p, setFilterText: b, asyncItemStatus: C } = ae(O, c), [j, x] = _(!1), {
|
|
29
|
-
getInputProps: d,
|
|
30
|
-
getToggleButtonProps: E,
|
|
31
|
-
getMenuProps: T,
|
|
32
|
-
getItemProps: q,
|
|
33
|
-
reset: w,
|
|
34
|
-
selectedItem: l,
|
|
35
|
-
isOpen: S,
|
|
36
|
-
highlightedIndex: G,
|
|
37
|
-
inputValue: m
|
|
38
|
-
} = Y({
|
|
39
|
-
items: u,
|
|
40
|
-
selectedItem: p(v),
|
|
41
|
-
defaultSelectedItem: p(F),
|
|
42
|
-
defaultHighlightedIndex: 0,
|
|
43
|
-
toggleButtonId: y,
|
|
44
|
-
labelId: "aria-labelledby" in a ? a["aria-labelledby"] : void 0,
|
|
45
|
-
onSelectedItemChange: ({ selectedItem: e }) => {
|
|
46
|
-
i == null || i((e == null ? void 0 : e.value) ?? null);
|
|
47
|
-
},
|
|
48
|
-
onInputValueChange: ({ inputValue: e }) => {
|
|
49
|
-
b(e);
|
|
50
|
-
},
|
|
51
|
-
onIsOpenChange: () => {
|
|
52
|
-
x(!1), b("");
|
|
53
|
-
},
|
|
54
|
-
onHighlightedIndexChange: () => {
|
|
55
|
-
x(!0);
|
|
56
|
-
},
|
|
57
|
-
itemToString: (e) => e ? e.label : ""
|
|
58
|
-
}), n = A(!1), J = ee(
|
|
59
|
-
() => !c && !u.find((e) => e.label.toLowerCase().includes(m.toLowerCase())),
|
|
60
|
-
[m, u, c]
|
|
61
|
-
), K = (e) => {
|
|
62
|
-
var N, R;
|
|
63
|
-
e.target.dataset.showFocusRing = "false", n.current = !1, (l == null ? void 0 : l.label.toLocaleLowerCase()) !== m.toLocaleLowerCase() && w(), d().onBlur && ((R = (N = d()).onBlur) == null || R.call(N, e));
|
|
64
|
-
}, I = J || !!C.error || s === "error";
|
|
65
|
-
return /* @__PURE__ */ g(B.Root, { open: S, children: [
|
|
66
|
-
/* @__PURE__ */ o(B.Anchor, { asChild: !0, children: /* @__PURE__ */ g("div", { ref: D, className: t.root, "data-status": I ? "error" : s, children: [
|
|
67
|
-
/* @__PURE__ */ o(
|
|
68
|
-
"input",
|
|
69
|
-
{
|
|
70
|
-
...d({
|
|
71
|
-
"aria-label": "aria-label" in a ? a["aria-label"] : void 0
|
|
72
|
-
}),
|
|
73
|
-
"data-test-id": r,
|
|
74
|
-
placeholder: M,
|
|
75
|
-
className: t.input,
|
|
76
|
-
disabled: f,
|
|
77
|
-
onMouseDown: (e) => {
|
|
78
|
-
n.current = !0, e.currentTarget.dataset.showFocusRing = "false";
|
|
79
|
-
},
|
|
80
|
-
onFocus: (e) => {
|
|
81
|
-
n.current || (e.target.dataset.showFocusRing = "true");
|
|
82
|
-
},
|
|
83
|
-
onBlur: K
|
|
84
|
-
}
|
|
85
|
-
),
|
|
86
|
-
H,
|
|
87
|
-
h && /* @__PURE__ */ o(
|
|
88
|
-
X,
|
|
89
|
-
{
|
|
90
|
-
onClick: (e) => {
|
|
91
|
-
e.stopPropagation(), w();
|
|
92
|
-
},
|
|
93
|
-
className: t.clear,
|
|
94
|
-
role: "button",
|
|
95
|
-
children: h
|
|
96
|
-
}
|
|
97
|
-
),
|
|
98
|
-
C.isLoading && S ? /* @__PURE__ */ o(te, { name: "right", "data-test-id": `${r}-right-slot`, children: /* @__PURE__ */ o(oe, { size: "x-small", "data-test-id": `${r}-loading-circle` }) }) : null,
|
|
99
|
-
/* @__PURE__ */ g("div", { className: t.icons, children: [
|
|
100
|
-
/* @__PURE__ */ o(
|
|
101
|
-
"button",
|
|
102
|
-
{
|
|
103
|
-
"aria-label": "toggle menu",
|
|
104
|
-
...E(),
|
|
105
|
-
type: "button",
|
|
106
|
-
disabled: f,
|
|
107
|
-
onMouseDown: () => {
|
|
108
|
-
n.current = !0;
|
|
109
|
-
},
|
|
110
|
-
children: /* @__PURE__ */ o(Q, { size: 16, className: t.caret })
|
|
111
|
-
}
|
|
112
|
-
),
|
|
113
|
-
s === "success" ? /* @__PURE__ */ o(
|
|
114
|
-
U,
|
|
115
|
-
{
|
|
116
|
-
size: 16,
|
|
117
|
-
className: t.iconSuccess,
|
|
118
|
-
"data-test-id": `${r}-success-icon`
|
|
119
|
-
}
|
|
120
|
-
) : null,
|
|
121
|
-
I ? /* @__PURE__ */ o(
|
|
122
|
-
W,
|
|
123
|
-
{
|
|
124
|
-
size: 16,
|
|
125
|
-
className: t.iconError,
|
|
126
|
-
"data-test-id": `${r}-error-icon`
|
|
127
|
-
}
|
|
128
|
-
) : null
|
|
129
|
-
] })
|
|
130
|
-
] }) }),
|
|
131
|
-
/* @__PURE__ */ o(
|
|
132
|
-
re,
|
|
133
|
-
{
|
|
134
|
-
align: P,
|
|
135
|
-
side: k,
|
|
136
|
-
highlightedIndex: G,
|
|
137
|
-
filterText: $,
|
|
138
|
-
getMenuProps: T,
|
|
139
|
-
getItemProps: q,
|
|
140
|
-
selectedItem: l,
|
|
141
|
-
hasInteractedSinceOpening: j,
|
|
142
|
-
viewportCollisionPadding: z,
|
|
143
|
-
children: V
|
|
144
|
-
}
|
|
145
|
-
)
|
|
146
|
-
] });
|
|
1
|
+
const t = "_root_1yzu4_5", e = "_item_1yzu4_30", a = "_itemLabel_1yzu4_50", i = "_itemLabelActive_1yzu4_70", o = "_itemLabelInactive_1yzu4_100", _ = "_activeIndicator_1yzu4_130", c = "_separator_1yzu4_227", n = {
|
|
2
|
+
root: t,
|
|
3
|
+
item: e,
|
|
4
|
+
itemLabel: a,
|
|
5
|
+
itemLabelActive: i,
|
|
6
|
+
itemLabelInactive: o,
|
|
7
|
+
activeIndicator: _,
|
|
8
|
+
separator: c
|
|
147
9
|
};
|
|
148
|
-
L.displayName = "Select.Combobox";
|
|
149
|
-
const pe = Z(L);
|
|
150
10
|
export {
|
|
151
|
-
|
|
152
|
-
|
|
11
|
+
_ as activeIndicator,
|
|
12
|
+
n as default,
|
|
13
|
+
e as item,
|
|
14
|
+
a as itemLabel,
|
|
15
|
+
i as itemLabelActive,
|
|
16
|
+
o as itemLabelInactive,
|
|
17
|
+
t as root,
|
|
18
|
+
c as separator
|
|
153
19
|
};
|
|
154
20
|
//# sourceMappingURL=fondue-components63.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fondue-components63.js","sources":["../src/components/Select/Combobox.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { IconCaretDown, IconCheckMark, IconExclamationMarkTriangle } from '@frontify/fondue-icons';\nimport * as RadixPopover from '@radix-ui/react-popover';\nimport { Slot as RadixSlot } from '@radix-ui/react-slot';\nimport { useCombobox } from 'downshift';\nimport { forwardRef, useMemo, useRef, useState, type FocusEvent, type ForwardedRef, type ReactNode } from 'react';\n\nimport { LoadingCircle } from '#/components/LoadingCircle/LoadingCircle.tsx';\nimport { ForwardedRefSelectSlot } from '#/components/Select/SelectSlot.tsx';\nimport { type CommonAriaProps } from '#/helpers/aria';\n\nimport { SelectMenu, type SelectMenuViewportCollisionPadding } from './SelectMenu';\nimport styles from './styles/select.module.scss';\nimport { type AsyncItemsFetcher, useSelectData } from './useSelectData';\n\nexport type ComboboxProps = {\n /**\n * Children of the Combobox component. This can contain the `Select.Slot` components for the label, decorators, clear action and menu.\n */\n children?: ReactNode;\n /**\n * Callback function that is called when an item is selected.\n */\n onSelect?: (selectedValue: string | null) => void;\n /**\n * The active value in the combobox component. This is used to control the combobox externally.\n */\n value?: string | null;\n /**\n * The default value of the combobox component. Used for uncontrolled usages.\n */\n defaultValue?: string;\n /**\n * The placeholder in the combobox component.\n */\n placeholder?: string;\n /**\n * Status of the text input\n * @default \"neutral\"\n */\n status?: 'neutral' | 'success' | 'error';\n /**\n * Disables the combobox component.\n */\n disabled?: boolean;\n /**\n * The alignment of the menu.\n * @default \"start\"\n */\n alignMenu?: 'start' | 'center' | 'end' /**\n * Defines the preferred side of the combobox. It will not be respected if there are collisions with the viewport.\n * @default \"bottom\"\n */;\n side?: 'left' | 'right' | 'bottom' | 'top';\n /**\n * Id of the combobox component\n */\n id?: string;\n /**\n * The data test id of the combobox component.\n */\n 'data-test-id'?: string;\n /**\n * Define the minimum distance between the select menu and the viewport edge\n * @default 'compact'\n */\n viewportCollisionPadding?: SelectMenuViewportCollisionPadding;\n /**\n * Function to fetch items asynchronously.\n */\n getAsyncItems?: AsyncItemsFetcher;\n} & CommonAriaProps;\n\nexport const SelectCombobox = (\n {\n children,\n onSelect,\n value,\n defaultValue,\n placeholder = '',\n status = 'neutral',\n disabled,\n 'data-test-id': dataTestId = 'fondue-select-combobox',\n alignMenu = 'start',\n side = 'bottom',\n id,\n viewportCollisionPadding = 'compact',\n getAsyncItems,\n ...props\n }: ComboboxProps,\n forwardedRef: ForwardedRef<HTMLDivElement>,\n) => {\n const { inputSlots, menuSlots, items, filterText, clearButton, getItemByValue, setFilterText, asyncItemStatus } =\n useSelectData(children, getAsyncItems);\n\n const [hasInteractedSinceOpening, setHasInteractedSinceOpening] = useState(false);\n\n const {\n getInputProps,\n getToggleButtonProps,\n getMenuProps,\n getItemProps,\n reset,\n selectedItem,\n isOpen,\n highlightedIndex,\n inputValue,\n } = useCombobox({\n items,\n selectedItem: getItemByValue(value),\n defaultSelectedItem: getItemByValue(defaultValue),\n defaultHighlightedIndex: 0,\n toggleButtonId: id,\n labelId: 'aria-labelledby' in props ? props['aria-labelledby'] : undefined,\n onSelectedItemChange: ({ selectedItem }) => {\n onSelect?.(selectedItem?.value ?? null);\n },\n onInputValueChange: ({ inputValue }) => {\n setFilterText(inputValue);\n },\n onIsOpenChange: () => {\n setHasInteractedSinceOpening(false);\n setFilterText('');\n },\n onHighlightedIndexChange: () => {\n setHasInteractedSinceOpening(true);\n },\n itemToString: (item) => (item ? item.label : ''),\n });\n\n const wasClicked = useRef(false);\n\n const valueInvalid = useMemo(\n () => !getAsyncItems && !items.find((item) => item.label.toLowerCase().includes(inputValue.toLowerCase())),\n [inputValue, items, getAsyncItems],\n );\n\n const onBlurHandler = (blurEvent: FocusEvent<HTMLInputElement, Element>) => {\n blurEvent.target.dataset.showFocusRing = 'false';\n wasClicked.current = false;\n\n const selectedItemNullOrOutdated = selectedItem?.label.toLocaleLowerCase() !== inputValue.toLocaleLowerCase();\n\n if (selectedItemNullOrOutdated) {\n // if there is no selection or\n // the existing selected value is not the same as the input value (old),\n // reset the input\n reset();\n }\n\n if (getInputProps().onBlur) {\n getInputProps().onBlur?.(blurEvent);\n }\n };\n const hasError = valueInvalid || !!asyncItemStatus.error || status === 'error';\n\n return (\n <RadixPopover.Root open={isOpen}>\n <RadixPopover.Anchor asChild>\n <div ref={forwardedRef} className={styles.root} data-status={hasError ? 'error' : status}>\n <input\n {...getInputProps({\n 'aria-label': 'aria-label' in props ? props['aria-label'] : undefined,\n })}\n data-test-id={dataTestId}\n placeholder={placeholder}\n className={styles.input}\n disabled={disabled}\n onMouseDown={(mouseEvent) => {\n wasClicked.current = true;\n mouseEvent.currentTarget.dataset.showFocusRing = 'false';\n }}\n onFocus={(focusEvent) => {\n if (!wasClicked.current) {\n focusEvent.target.dataset.showFocusRing = 'true';\n }\n }}\n onBlur={onBlurHandler}\n />\n {inputSlots}\n {clearButton && (\n <RadixSlot\n onClick={(event) => {\n event.stopPropagation();\n reset();\n }}\n className={styles.clear}\n role=\"button\"\n >\n {clearButton}\n </RadixSlot>\n )}\n {asyncItemStatus.isLoading && isOpen ? (\n <ForwardedRefSelectSlot name=\"right\" data-test-id={`${dataTestId}-right-slot`}>\n <LoadingCircle size=\"x-small\" data-test-id={`${dataTestId}-loading-circle`} />\n </ForwardedRefSelectSlot>\n ) : null}\n <div className={styles.icons}>\n <button\n aria-label=\"toggle menu\"\n {...getToggleButtonProps()}\n type=\"button\"\n disabled={disabled}\n onMouseDown={() => {\n wasClicked.current = true;\n }}\n >\n <IconCaretDown size={16} className={styles.caret} />\n </button>\n {status === 'success' ? (\n <IconCheckMark\n size={16}\n className={styles.iconSuccess}\n data-test-id={`${dataTestId}-success-icon`}\n />\n ) : null}\n {hasError ? (\n <IconExclamationMarkTriangle\n size={16}\n className={styles.iconError}\n data-test-id={`${dataTestId}-error-icon`}\n />\n ) : null}\n </div>\n </div>\n </RadixPopover.Anchor>\n\n <SelectMenu\n align={alignMenu}\n side={side}\n highlightedIndex={highlightedIndex}\n filterText={filterText}\n getMenuProps={getMenuProps}\n getItemProps={getItemProps}\n selectedItem={selectedItem}\n hasInteractedSinceOpening={hasInteractedSinceOpening}\n viewportCollisionPadding={viewportCollisionPadding}\n >\n {menuSlots}\n </SelectMenu>\n </RadixPopover.Root>\n );\n};\nSelectCombobox.displayName = 'Select.Combobox';\n\nexport const ForwardedRefCombobox = forwardRef<HTMLDivElement, ComboboxProps>(SelectCombobox);\n"],"names":["SelectCombobox","children","onSelect","value","defaultValue","placeholder","status","disabled","dataTestId","alignMenu","side","id","viewportCollisionPadding","getAsyncItems","props","forwardedRef","inputSlots","menuSlots","items","filterText","clearButton","getItemByValue","setFilterText","asyncItemStatus","useSelectData","hasInteractedSinceOpening","setHasInteractedSinceOpening","useState","getInputProps","getToggleButtonProps","getMenuProps","getItemProps","reset","selectedItem","isOpen","highlightedIndex","inputValue","useCombobox","item","wasClicked","useRef","valueInvalid","useMemo","onBlurHandler","blurEvent","_b","_a","hasError","jsxs","RadixPopover","jsx","styles","mouseEvent","focusEvent","RadixSlot","event","ForwardedRefSelectSlot","LoadingCircle","IconCaretDown","IconCheckMark","IconExclamationMarkTriangle","SelectMenu","ForwardedRefCombobox","forwardRef"],"mappings":";;;;;;;;;;;AA0EO,MAAMA,IAAiB,CAC1B;AAAA,EACI,UAAAC;AAAA,EACA,UAAAC;AAAA,EACA,OAAAC;AAAA,EACA,cAAAC;AAAA,EACA,aAAAC,IAAc;AAAA,EACd,QAAAC,IAAS;AAAA,EACT,UAA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,QACA,cAAAC;AAAA,QACA,cAAAE;AAAA,QACA,2BAAAR;AAAA,QACA,0BAAAb;AAAA,QAEC,UAAAK;AAAA,MAAA;AAAA,IAAA;AAAA,EACL,GACJ;AAER;AACAjB,EAAe,cAAc;AAEhB,MAAA8D,KAAuBC,EAA0C/D,CAAc;"}
|
|
1
|
+
{"version":3,"file":"fondue-components63.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;"}
|
|
@@ -1,22 +1,154 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { IconCheckMark as
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
1
|
+
import { jsxs as g, jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { IconCaretDown as Q, IconCheckMark as U, IconExclamationMarkTriangle as W } from "@frontify/fondue-icons";
|
|
3
|
+
import * as B from "@radix-ui/react-popover";
|
|
4
|
+
import { Slot as X } from "@radix-ui/react-slot";
|
|
5
|
+
import { useCombobox as Y } from "downshift";
|
|
6
|
+
import { forwardRef as Z, useState as _, useRef as A, useMemo as ee } from "react";
|
|
7
|
+
import { LoadingCircle as oe } from "./fondue-components18.js";
|
|
8
|
+
import { ForwardedRefSelectSlot as te } from "./fondue-components67.js";
|
|
9
|
+
import { SelectMenu as re } from "./fondue-components66.js";
|
|
10
|
+
import t from "./fondue-components68.js";
|
|
11
|
+
import { useSelectData as ae } from "./fondue-components69.js";
|
|
12
|
+
const L = ({
|
|
13
|
+
children: O,
|
|
14
|
+
onSelect: i,
|
|
15
|
+
value: v,
|
|
16
|
+
defaultValue: F,
|
|
17
|
+
placeholder: M = "",
|
|
18
|
+
status: s = "neutral",
|
|
19
|
+
disabled: f,
|
|
20
|
+
"data-test-id": r = "fondue-select-combobox",
|
|
21
|
+
alignMenu: P = "start",
|
|
22
|
+
side: k = "bottom",
|
|
23
|
+
id: y,
|
|
24
|
+
viewportCollisionPadding: z = "compact",
|
|
25
|
+
getAsyncItems: c,
|
|
26
|
+
...a
|
|
27
|
+
}, D) => {
|
|
28
|
+
const { inputSlots: H, menuSlots: V, items: u, filterText: $, clearButton: h, getItemByValue: p, setFilterText: b, asyncItemStatus: C } = ae(O, c), [j, x] = _(!1), {
|
|
29
|
+
getInputProps: d,
|
|
30
|
+
getToggleButtonProps: E,
|
|
31
|
+
getMenuProps: T,
|
|
32
|
+
getItemProps: q,
|
|
33
|
+
reset: w,
|
|
34
|
+
selectedItem: l,
|
|
35
|
+
isOpen: S,
|
|
36
|
+
highlightedIndex: G,
|
|
37
|
+
inputValue: m
|
|
38
|
+
} = Y({
|
|
39
|
+
items: u,
|
|
40
|
+
selectedItem: p(v),
|
|
41
|
+
defaultSelectedItem: p(F),
|
|
42
|
+
defaultHighlightedIndex: 0,
|
|
43
|
+
toggleButtonId: y,
|
|
44
|
+
labelId: "aria-labelledby" in a ? a["aria-labelledby"] : void 0,
|
|
45
|
+
onSelectedItemChange: ({ selectedItem: e }) => {
|
|
46
|
+
i == null || i((e == null ? void 0 : e.value) ?? null);
|
|
47
|
+
},
|
|
48
|
+
onInputValueChange: ({ inputValue: e }) => {
|
|
49
|
+
b(e);
|
|
50
|
+
},
|
|
51
|
+
onIsOpenChange: () => {
|
|
52
|
+
x(!1), b("");
|
|
53
|
+
},
|
|
54
|
+
onHighlightedIndexChange: () => {
|
|
55
|
+
x(!0);
|
|
56
|
+
},
|
|
57
|
+
itemToString: (e) => e ? e.label : ""
|
|
58
|
+
}), n = A(!1), J = ee(
|
|
59
|
+
() => !c && !u.find((e) => e.label.toLowerCase().includes(m.toLowerCase())),
|
|
60
|
+
[m, u, c]
|
|
61
|
+
), K = (e) => {
|
|
62
|
+
var N, R;
|
|
63
|
+
e.target.dataset.showFocusRing = "false", n.current = !1, (l == null ? void 0 : l.label.toLocaleLowerCase()) !== m.toLocaleLowerCase() && w(), d().onBlur && ((R = (N = d()).onBlur) == null || R.call(N, e));
|
|
64
|
+
}, I = J || !!C.error || s === "error";
|
|
65
|
+
return /* @__PURE__ */ g(B.Root, { open: S, children: [
|
|
66
|
+
/* @__PURE__ */ o(B.Anchor, { asChild: !0, children: /* @__PURE__ */ g("div", { ref: D, className: t.root, "data-status": I ? "error" : s, children: [
|
|
67
|
+
/* @__PURE__ */ o(
|
|
68
|
+
"input",
|
|
69
|
+
{
|
|
70
|
+
...d({
|
|
71
|
+
"aria-label": "aria-label" in a ? a["aria-label"] : void 0
|
|
72
|
+
}),
|
|
73
|
+
"data-test-id": r,
|
|
74
|
+
placeholder: M,
|
|
75
|
+
className: t.input,
|
|
76
|
+
disabled: f,
|
|
77
|
+
onMouseDown: (e) => {
|
|
78
|
+
n.current = !0, e.currentTarget.dataset.showFocusRing = "false";
|
|
79
|
+
},
|
|
80
|
+
onFocus: (e) => {
|
|
81
|
+
n.current || (e.target.dataset.showFocusRing = "true");
|
|
82
|
+
},
|
|
83
|
+
onBlur: K
|
|
84
|
+
}
|
|
85
|
+
),
|
|
86
|
+
H,
|
|
87
|
+
h ? /* @__PURE__ */ o(
|
|
88
|
+
X,
|
|
89
|
+
{
|
|
90
|
+
onClick: (e) => {
|
|
91
|
+
e.stopPropagation(), w();
|
|
92
|
+
},
|
|
93
|
+
className: t.clear,
|
|
94
|
+
role: "button",
|
|
95
|
+
children: h
|
|
96
|
+
}
|
|
97
|
+
) : null,
|
|
98
|
+
C.isLoading && S ? /* @__PURE__ */ o(te, { name: "right", "data-test-id": `${r}-right-slot`, children: /* @__PURE__ */ o(oe, { size: "x-small", "data-test-id": `${r}-loading-circle` }) }) : null,
|
|
99
|
+
/* @__PURE__ */ g("div", { className: t.icons, children: [
|
|
100
|
+
/* @__PURE__ */ o(
|
|
101
|
+
"button",
|
|
102
|
+
{
|
|
103
|
+
"aria-label": "toggle menu",
|
|
104
|
+
...E(),
|
|
105
|
+
type: "button",
|
|
106
|
+
disabled: f,
|
|
107
|
+
onMouseDown: () => {
|
|
108
|
+
n.current = !0;
|
|
109
|
+
},
|
|
110
|
+
children: /* @__PURE__ */ o(Q, { size: 16, className: t.caret })
|
|
111
|
+
}
|
|
112
|
+
),
|
|
113
|
+
s === "success" ? /* @__PURE__ */ o(
|
|
114
|
+
U,
|
|
115
|
+
{
|
|
116
|
+
size: 16,
|
|
117
|
+
className: t.iconSuccess,
|
|
118
|
+
"data-test-id": `${r}-success-icon`
|
|
119
|
+
}
|
|
120
|
+
) : null,
|
|
121
|
+
I ? /* @__PURE__ */ o(
|
|
122
|
+
W,
|
|
123
|
+
{
|
|
124
|
+
size: 16,
|
|
125
|
+
className: t.iconError,
|
|
126
|
+
"data-test-id": `${r}-error-icon`
|
|
127
|
+
}
|
|
128
|
+
) : null
|
|
129
|
+
] })
|
|
130
|
+
] }) }),
|
|
131
|
+
/* @__PURE__ */ o(
|
|
132
|
+
re,
|
|
133
|
+
{
|
|
134
|
+
align: P,
|
|
135
|
+
side: k,
|
|
136
|
+
highlightedIndex: G,
|
|
137
|
+
filterText: $,
|
|
138
|
+
getMenuProps: T,
|
|
139
|
+
getItemProps: q,
|
|
140
|
+
selectedItem: l,
|
|
141
|
+
hasInteractedSinceOpening: j,
|
|
142
|
+
viewportCollisionPadding: z,
|
|
143
|
+
children: V
|
|
144
|
+
}
|
|
145
|
+
)
|
|
146
|
+
] });
|
|
147
|
+
};
|
|
148
|
+
L.displayName = "Select.Combobox";
|
|
149
|
+
const pe = Z(L);
|
|
16
150
|
export {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
o as SelectItem,
|
|
20
|
-
s as SelectItemGroup
|
|
151
|
+
pe as ForwardedRefCombobox,
|
|
152
|
+
L as SelectCombobox
|
|
21
153
|
};
|
|
22
154
|
//# sourceMappingURL=fondue-components64.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fondue-components64.js","sources":["../src/components/Select/SelectItem.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { IconCheckMark } from '@frontify/fondue-icons';\nimport { forwardRef, type ForwardedRef, type ReactNode } from 'react';\n\nimport styles from './styles/select.module.scss';\n\nexport type SelectItemProps = {\n /**\n * The value of the select item.\n */\n value: string;\n /**\n * The data test id of the select item.\n */\n 'data-test-id'?: string;\n} & (\n | {\n /**\n * The label of the select item. Required when the child is not a string.\n */\n label: string;\n /**\n * The children of the select item. This can be a custom component or a string.\n */\n children?: ReactNode;\n }\n | {\n label?: string;\n children: string;\n }\n);\n\nexport const SelectItem = (\n { 'data-test-id': dataTestId = 'fondue-select-item', ...props }: SelectItemProps,\n forwardedRef?: ForwardedRef<HTMLLIElement>,\n) => {\n return (\n <li data-test-id={dataTestId} ref={forwardedRef} {...props}>\n <div className={styles.itemValue}>{props.children}</div>\n <IconCheckMark className={styles.checkmarkIcon} />\n </li>\n );\n};\nSelectItem.displayName = 'Select.Item';\n\nexport const ForwardedRefSelectItem = forwardRef<HTMLLIElement, SelectItemProps>(SelectItem);\n\nexport type SelectItemGroupProps = {\n /**\n * The children of the select item group. This can contain multiple `Select.Item` components.\n */\n children: ReactNode;\n /**\n * The internal group ID of the select item group.\n */\n groupId: string;\n /**\n * The groups heading\n */\n heading?: string;\n /**\n * The data test id of the select item group.\n */\n 'data-test-id'?: string;\n};\n\nexport const SelectItemGroup = (\n { children, groupId, heading, 'data-test-id': dataTestId = 'fondue-select-item-group' }: SelectItemGroupProps,\n forwardedRef?: ForwardedRef<HTMLDivElement>,\n) => {\n return (\n <div data-test-id={dataTestId} className={styles.group} ref={forwardedRef} key={groupId}>\n {heading ? (\n <div className={styles.groupHeading}>\n <span>{heading}</span>\n </div>\n ) : null}\n {children}\n </div>\n );\n};\nSelectItemGroup.displayName = 'Select.Group';\n\nexport const ForwardedRefSelectItemGroup = forwardRef<HTMLDivElement, SelectItemGroupProps>(SelectItemGroup);\n"],"names":["SelectItem","dataTestId","props","forwardedRef","jsx","styles","IconCheckMark","ForwardedRefSelectItem","forwardRef","SelectItemGroup","children","groupId","heading","jsxs","ForwardedRefSelectItemGroup"],"mappings":";;;;AAiCa,MAAAA,IAAa,CACtB,EAAE,gBAAgBC,IAAa,sBAAsB,GAAGC,EAAM,GAC9DC,wBAGK,MAAG,EAAA,gBAAcF,GAAY,KAAKE,GAAe,GAAGD,GACjD,UAAA;AAAA,EAAA,gBAAAE,EAAC,OAAI,EAAA,WAAWC,EAAO,WAAY,YAAM,UAAS;AAAA,EACjD,gBAAAD,EAAAE,GAAA,EAAc,WAAWD,EAAO,cAAe,CAAA;AAAA,GACpD;AAGRL,EAAW,cAAc;AAEZ,MAAAO,IAAyBC,EAA2CR,CAAU,GAqB9ES,IAAkB,CAC3B,EAAE,UAAAC,GAAU,SAAAC,GAAS,SAAAC,GAAS,gBAAgBX,IAAa,2BAA2B,GACtFE,MAGI,gBAAAU,EAAC,SAAI,gBAAcZ,GAAY,WAAWI,EAAO,OAAO,KAAKF,GACxD,UAAA;AAAA,EACGS,IAAA,gBAAAR,EAAC,SAAI,WAAWC,EAAO,cACnB,UAAC,gBAAAD,EAAA,QAAA,EAAM,UAAQQ,EAAA,CAAA,EAAA,CACnB,IACA;AAAA,EACHF;AAAA,EAAA,GAN2EC,CAOhF;AAGRF,EAAgB,cAAc;AAEjB,MAAAK,IAA8BN,EAAiDC,CAAe;"}
|
|
1
|
+
{"version":3,"file":"fondue-components64.js","sources":["../src/components/Select/Combobox.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { IconCaretDown, IconCheckMark, IconExclamationMarkTriangle } from '@frontify/fondue-icons';\nimport * as RadixPopover from '@radix-ui/react-popover';\nimport { Slot as RadixSlot } from '@radix-ui/react-slot';\nimport { useCombobox } from 'downshift';\nimport { forwardRef, useMemo, useRef, useState, type FocusEvent, type ForwardedRef, type ReactNode } from 'react';\n\nimport { LoadingCircle } from '#/components/LoadingCircle/LoadingCircle.tsx';\nimport { ForwardedRefSelectSlot } from '#/components/Select/SelectSlot.tsx';\nimport { type CommonAriaProps } from '#/helpers/aria';\n\nimport { SelectMenu, type SelectMenuViewportCollisionPadding } from './SelectMenu';\nimport styles from './styles/select.module.scss';\nimport { type AsyncItemsFetcher, useSelectData } from './useSelectData';\n\nexport type ComboboxProps = {\n /**\n * Children of the Combobox component. This can contain the `Select.Slot` components for the label, decorators, clear action and menu.\n */\n children?: ReactNode;\n /**\n * Callback function that is called when an item is selected.\n */\n onSelect?: (selectedValue: string | null) => void;\n /**\n * The active value in the combobox component. This is used to control the combobox externally.\n */\n value?: string | null;\n /**\n * The default value of the combobox component. Used for uncontrolled usages.\n */\n defaultValue?: string;\n /**\n * The placeholder in the combobox component.\n */\n placeholder?: string;\n /**\n * Status of the text input\n * @default \"neutral\"\n */\n status?: 'neutral' | 'success' | 'error';\n /**\n * Disables the combobox component.\n */\n disabled?: boolean;\n /**\n * The alignment of the menu.\n * @default \"start\"\n */\n alignMenu?: 'start' | 'center' | 'end' /**\n * Defines the preferred side of the combobox. It will not be respected if there are collisions with the viewport.\n * @default \"bottom\"\n */;\n side?: 'left' | 'right' | 'bottom' | 'top';\n /**\n * Id of the combobox component\n */\n id?: string;\n /**\n * The data test id of the combobox component.\n */\n 'data-test-id'?: string;\n /**\n * Define the minimum distance between the select menu and the viewport edge\n * @default 'compact'\n */\n viewportCollisionPadding?: SelectMenuViewportCollisionPadding;\n /**\n * Function to fetch items asynchronously.\n */\n getAsyncItems?: AsyncItemsFetcher;\n} & CommonAriaProps;\n\nexport const SelectCombobox = (\n {\n children,\n onSelect,\n value,\n defaultValue,\n placeholder = '',\n status = 'neutral',\n disabled,\n 'data-test-id': dataTestId = 'fondue-select-combobox',\n alignMenu = 'start',\n side = 'bottom',\n id,\n viewportCollisionPadding = 'compact',\n getAsyncItems,\n ...props\n }: ComboboxProps,\n forwardedRef: ForwardedRef<HTMLDivElement>,\n) => {\n const { inputSlots, menuSlots, items, filterText, clearButton, getItemByValue, setFilterText, asyncItemStatus } =\n useSelectData(children, getAsyncItems);\n\n const [hasInteractedSinceOpening, setHasInteractedSinceOpening] = useState(false);\n\n const {\n getInputProps,\n getToggleButtonProps,\n getMenuProps,\n getItemProps,\n reset,\n selectedItem,\n isOpen,\n highlightedIndex,\n inputValue,\n } = useCombobox({\n items,\n selectedItem: getItemByValue(value),\n defaultSelectedItem: getItemByValue(defaultValue),\n defaultHighlightedIndex: 0,\n toggleButtonId: id,\n labelId: 'aria-labelledby' in props ? props['aria-labelledby'] : undefined,\n onSelectedItemChange: ({ selectedItem }) => {\n onSelect?.(selectedItem?.value ?? null);\n },\n onInputValueChange: ({ inputValue }) => {\n setFilterText(inputValue);\n },\n onIsOpenChange: () => {\n setHasInteractedSinceOpening(false);\n setFilterText('');\n },\n onHighlightedIndexChange: () => {\n setHasInteractedSinceOpening(true);\n },\n itemToString: (item) => (item ? item.label : ''),\n });\n\n const wasClicked = useRef(false);\n\n const valueInvalid = useMemo(\n () => !getAsyncItems && !items.find((item) => item.label.toLowerCase().includes(inputValue.toLowerCase())),\n [inputValue, items, getAsyncItems],\n );\n\n const onBlurHandler = (blurEvent: FocusEvent<HTMLInputElement, Element>) => {\n blurEvent.target.dataset.showFocusRing = 'false';\n wasClicked.current = false;\n\n const selectedItemNullOrOutdated = selectedItem?.label.toLocaleLowerCase() !== inputValue.toLocaleLowerCase();\n\n if (selectedItemNullOrOutdated) {\n // if there is no selection or\n // the existing selected value is not the same as the input value (old),\n // reset the input\n reset();\n }\n\n if (getInputProps().onBlur) {\n getInputProps().onBlur?.(blurEvent);\n }\n };\n const hasError = valueInvalid || !!asyncItemStatus.error || status === 'error';\n\n return (\n <RadixPopover.Root open={isOpen}>\n <RadixPopover.Anchor asChild>\n <div ref={forwardedRef} className={styles.root} data-status={hasError ? 'error' : status}>\n <input\n {...getInputProps({\n 'aria-label': 'aria-label' in props ? props['aria-label'] : undefined,\n })}\n data-test-id={dataTestId}\n placeholder={placeholder}\n className={styles.input}\n disabled={disabled}\n onMouseDown={(mouseEvent) => {\n wasClicked.current = true;\n mouseEvent.currentTarget.dataset.showFocusRing = 'false';\n }}\n onFocus={(focusEvent) => {\n if (!wasClicked.current) {\n focusEvent.target.dataset.showFocusRing = 'true';\n }\n }}\n onBlur={onBlurHandler}\n />\n {inputSlots}\n {clearButton ? (\n <RadixSlot\n onClick={(event) => {\n event.stopPropagation();\n reset();\n }}\n className={styles.clear}\n role=\"button\"\n >\n {clearButton}\n </RadixSlot>\n ) : null}\n {asyncItemStatus.isLoading && isOpen ? (\n <ForwardedRefSelectSlot name=\"right\" data-test-id={`${dataTestId}-right-slot`}>\n <LoadingCircle size=\"x-small\" data-test-id={`${dataTestId}-loading-circle`} />\n </ForwardedRefSelectSlot>\n ) : null}\n <div className={styles.icons}>\n <button\n aria-label=\"toggle menu\"\n {...getToggleButtonProps()}\n type=\"button\"\n disabled={disabled}\n onMouseDown={() => {\n wasClicked.current = true;\n }}\n >\n <IconCaretDown size={16} className={styles.caret} />\n </button>\n {status === 'success' ? (\n <IconCheckMark\n size={16}\n className={styles.iconSuccess}\n data-test-id={`${dataTestId}-success-icon`}\n />\n ) : null}\n {hasError ? (\n <IconExclamationMarkTriangle\n size={16}\n className={styles.iconError}\n data-test-id={`${dataTestId}-error-icon`}\n />\n ) : null}\n </div>\n </div>\n </RadixPopover.Anchor>\n\n <SelectMenu\n align={alignMenu}\n side={side}\n highlightedIndex={highlightedIndex}\n filterText={filterText}\n getMenuProps={getMenuProps}\n getItemProps={getItemProps}\n selectedItem={selectedItem}\n hasInteractedSinceOpening={hasInteractedSinceOpening}\n viewportCollisionPadding={viewportCollisionPadding}\n >\n {menuSlots}\n </SelectMenu>\n </RadixPopover.Root>\n );\n};\nSelectCombobox.displayName = 'Select.Combobox';\n\nexport const ForwardedRefCombobox = forwardRef<HTMLDivElement, ComboboxProps>(SelectCombobox);\n"],"names":["SelectCombobox","children","onSelect","value","defaultValue","placeholder","status","disabled","dataTestId","alignMenu","side","id","viewportCollisionPadding","getAsyncItems","props","forwardedRef","inputSlots","menuSlots","items","filterText","clearButton","getItemByValue","setFilterText","asyncItemStatus","useSelectData","hasInteractedSinceOpening","setHasInteractedSinceOpening","useState","getInputProps","getToggleButtonProps","getMenuProps","getItemProps","reset","selectedItem","isOpen","highlightedIndex","inputValue","useCombobox","item","wasClicked","useRef","valueInvalid","useMemo","onBlurHandler","blurEvent","_b","_a","hasError","jsxs","RadixPopover","jsx","styles","mouseEvent","focusEvent","RadixSlot","event","ForwardedRefSelectSlot","LoadingCircle","IconCaretDown","IconCheckMark","IconExclamationMarkTriangle","SelectMenu","ForwardedRefCombobox","forwardRef"],"mappings":";;;;;;;;;;;AA0EO,MAAMA,IAAiB,CAC1B;AAAA,EACI,UAAAC;AAAA,EACA,UAAAC;AAAA,EACA,OAAAC;AAAA,EACA,cAAAC;AAAA,EACA,aAAAC,IAAc;AAAA,EACd,QAAAC,IAAS;AAAA,EACT,UAAAC;AAAA,EACA,gBAAgBC,IAAa;AAAA,EAC7B,WAAAC,IAAY;AAAA,EACZ,MAAAC,IAAO;AAAA,EACP,IAAAC;AAAA,EACA,0BAAAC,IAA2B;AAAA,EAC3B,eAAAC;AAAA,EACA,GAAGC;AACP,GACAC,MACC;AACD,QAAM,EAAE,YAAAC,GAAY,WAAAC,GAAW,OAAAC,GAAO,YAAAC,GAAY,aAAAC,GAAa,gBAAAC,GAAgB,eAAAC,GAAe,iBAAAC,EAAA,IAC1FC,GAAcvB,GAAUY,CAAa,GAEnC,CAACY,GAA2BC,CAA4B,IAAIC,EAAS,EAAK,GAE1E;AAAA,IACF,eAAAC;AAAA,IACA,sBAAAC;AAAA,IACA,cAAAC;AAAA,IACA,cAAAC;AAAA,IACA,OAAAC;AAAA,IACA,cAAAC;AAAA,IACA,QAAAC;AAAA,IACA,kBAAAC;AAAA,IACA,YAAAC;AAAA,EAAA,IACAC,EAAY;AAAA,IACZ,OAAAnB;AAAA,IACA,cAAcG,EAAelB,CAAK;AAAA,IAClC,qBAAqBkB,EAAejB,CAAY;AAAA,IAChD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