@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.
- package/dist/fondue-components.js +46 -50
- package/dist/fondue-components.js.map +1 -1
- package/dist/fondue-components10.js +27 -24
- package/dist/fondue-components10.js.map +1 -1
- package/dist/fondue-components11.js +86 -104
- package/dist/fondue-components11.js.map +1 -1
- package/dist/fondue-components12.js +2 -2
- package/dist/fondue-components13.js +82 -79
- package/dist/fondue-components13.js.map +1 -1
- package/dist/fondue-components14.js +2 -2
- package/dist/fondue-components15.js +2 -2
- package/dist/fondue-components16.js +2 -2
- package/dist/fondue-components17.js +36 -56
- package/dist/fondue-components17.js.map +1 -1
- package/dist/fondue-components18.js +16 -34
- package/dist/fondue-components18.js.map +1 -1
- package/dist/fondue-components19.js +73 -18
- package/dist/fondue-components19.js.map +1 -1
- package/dist/fondue-components20.js +36 -18
- package/dist/fondue-components20.js.map +1 -1
- package/dist/fondue-components21.js +50 -71
- package/dist/fondue-components21.js.map +1 -1
- package/dist/fondue-components22.js +138 -36
- package/dist/fondue-components22.js.map +1 -1
- package/dist/fondue-components23.js +50 -50
- package/dist/fondue-components23.js.map +1 -1
- package/dist/fondue-components24.js +33 -138
- package/dist/fondue-components24.js.map +1 -1
- package/dist/fondue-components25.js +193 -52
- package/dist/fondue-components25.js.map +1 -1
- package/dist/fondue-components26.js +137 -29
- package/dist/fondue-components26.js.map +1 -1
- package/dist/fondue-components27.js +127 -170
- package/dist/fondue-components27.js.map +1 -1
- package/dist/fondue-components28.js +30 -134
- package/dist/fondue-components28.js.map +1 -1
- package/dist/fondue-components29.js +63 -130
- package/dist/fondue-components29.js.map +1 -1
- package/dist/fondue-components3.js +1 -1
- package/dist/fondue-components30.js +101 -31
- package/dist/fondue-components30.js.map +1 -1
- package/dist/fondue-components31.js +29 -63
- package/dist/fondue-components31.js.map +1 -1
- package/dist/fondue-components32.js +52 -98
- package/dist/fondue-components32.js.map +1 -1
- package/dist/fondue-components33.js +20 -12
- package/dist/fondue-components33.js.map +1 -1
- package/dist/fondue-components34.js +23 -56
- package/dist/fondue-components34.js.map +1 -1
- package/dist/fondue-components35.js +7 -20
- package/dist/fondue-components35.js.map +1 -1
- package/dist/fondue-components36.js +6 -7
- package/dist/fondue-components36.js.map +1 -1
- package/dist/fondue-components37.js +32 -7
- package/dist/fondue-components37.js.map +1 -1
- package/dist/fondue-components38.js +5 -32
- package/dist/fondue-components38.js.map +1 -1
- package/dist/fondue-components39.js +12 -5
- package/dist/fondue-components39.js.map +1 -1
- package/dist/fondue-components4.js +35 -31
- package/dist/fondue-components4.js.map +1 -1
- package/dist/fondue-components40.js +153 -18
- package/dist/fondue-components40.js.map +1 -1
- package/dist/fondue-components41.js +22 -59
- package/dist/fondue-components41.js.map +1 -1
- package/dist/fondue-components42.js +19 -19
- package/dist/fondue-components42.js.map +1 -1
- package/dist/fondue-components43.js +15 -112
- package/dist/fondue-components43.js.map +1 -1
- package/dist/fondue-components44.js +30 -19
- package/dist/fondue-components44.js.map +1 -1
- package/dist/fondue-components45.js +54 -32
- package/dist/fondue-components45.js.map +1 -1
- package/dist/fondue-components46.js +125 -47
- package/dist/fondue-components46.js.map +1 -1
- package/dist/fondue-components47.js +20 -129
- package/dist/fondue-components47.js.map +1 -1
- package/dist/fondue-components48.js +53 -21
- package/dist/fondue-components48.js.map +1 -1
- package/dist/fondue-components49.js +8 -53
- package/dist/fondue-components49.js.map +1 -1
- package/dist/fondue-components5.js +2 -2
- package/dist/fondue-components50.js +13 -8
- package/dist/fondue-components50.js.map +1 -1
- package/dist/fondue-components51.js +15 -13
- package/dist/fondue-components51.js.map +1 -1
- package/dist/fondue-components52.js +4 -14
- package/dist/fondue-components52.js.map +1 -1
- package/dist/fondue-components53.js +60 -5
- package/dist/fondue-components53.js.map +1 -1
- package/dist/fondue-components54.js +17 -58
- package/dist/fondue-components54.js.map +1 -1
- package/dist/fondue-components55.js +19 -18
- package/dist/fondue-components55.js.map +1 -1
- package/dist/fondue-components56.js +4 -18
- package/dist/fondue-components56.js.map +1 -1
- package/dist/fondue-components57.js +13 -3
- package/dist/fondue-components57.js.map +1 -1
- package/dist/fondue-components58.js +3 -11
- package/dist/fondue-components58.js.map +1 -1
- package/dist/fondue-components59.js +17 -3
- package/dist/fondue-components59.js.map +1 -1
- package/dist/fondue-components6.js +4 -4
- package/dist/fondue-components60.js +10 -17
- package/dist/fondue-components60.js.map +1 -1
- package/dist/fondue-components61.js +35 -11
- package/dist/fondue-components61.js.map +1 -1
- package/dist/fondue-components62.js +4 -36
- package/dist/fondue-components62.js.map +1 -1
- package/dist/fondue-components63.js +13 -35
- package/dist/fondue-components63.js.map +1 -1
- package/dist/fondue-components64.js +1 -1
- package/dist/fondue-components65.js +24 -12
- package/dist/fondue-components65.js.map +1 -1
- package/dist/fondue-components66.js +16 -4
- package/dist/fondue-components66.js.map +1 -1
- package/dist/fondue-components67.js +150 -23
- package/dist/fondue-components67.js.map +1 -1
- package/dist/fondue-components68.js +19 -17
- package/dist/fondue-components68.js.map +1 -1
- package/dist/fondue-components69.js +75 -148
- package/dist/fondue-components69.js.map +1 -1
- package/dist/fondue-components7.js +2 -2
- package/dist/fondue-components70.js +8 -19
- package/dist/fondue-components70.js.map +1 -1
- package/dist/fondue-components71.js +36 -77
- package/dist/fondue-components71.js.map +1 -1
- package/dist/fondue-components72.js +71 -8
- package/dist/fondue-components72.js.map +1 -1
- package/dist/fondue-components73.js +10 -36
- package/dist/fondue-components73.js.map +1 -1
- package/dist/fondue-components74.js +12 -70
- package/dist/fondue-components74.js.map +1 -1
- package/dist/fondue-components75.js +12 -10
- package/dist/fondue-components75.js.map +1 -1
- package/dist/fondue-components76.js +22 -12
- package/dist/fondue-components76.js.map +1 -1
- package/dist/fondue-components77.js +34 -13
- package/dist/fondue-components77.js.map +1 -1
- package/dist/fondue-components78.js +10 -22
- package/dist/fondue-components78.js.map +1 -1
- package/dist/fondue-components79.js +67 -33
- package/dist/fondue-components79.js.map +1 -1
- package/dist/fondue-components8.js +5 -5
- package/dist/fondue-components80.js +11 -7
- package/dist/fondue-components80.js.map +1 -1
- package/dist/fondue-components81.js +25 -67
- package/dist/fondue-components81.js.map +1 -1
- package/dist/fondue-components82.js +18 -14
- package/dist/fondue-components82.js.map +1 -1
- package/dist/fondue-components83.js +21 -23
- package/dist/fondue-components83.js.map +1 -1
- package/dist/fondue-components84.js +6 -18
- package/dist/fondue-components84.js.map +1 -1
- package/dist/fondue-components85.js +19 -22
- package/dist/fondue-components85.js.map +1 -1
- package/dist/fondue-components86.js +6 -8
- package/dist/fondue-components86.js.map +1 -1
- package/dist/fondue-components87.js +3 -5
- package/dist/fondue-components87.js.map +1 -1
- package/dist/fondue-components88.js +5 -2
- package/dist/fondue-components88.js.map +1 -1
- package/dist/fondue-components89.js +15 -3
- package/dist/fondue-components89.js.map +1 -1
- package/dist/fondue-components9.js +92 -88
- package/dist/fondue-components9.js.map +1 -1
- package/dist/fondue-components90.js +2 -5
- package/dist/fondue-components90.js.map +1 -1
- package/dist/fondue-components91.js +39 -16
- package/dist/fondue-components91.js.map +1 -1
- package/dist/fondue-components92.js +20 -39
- package/dist/fondue-components92.js.map +1 -1
- package/dist/index.d.ts +58 -118
- package/dist/style.css +1 -1
- package/package.json +10 -7
- package/dist/fondue-components93.js +0 -9
- package/dist/fondue-components93.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fondue-components30.js","sources":["../src/components/Text/Text.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type ReactNode, forwardRef, type ForwardedRef, type HTMLAttributeAnchorTarget } from 'react';\n\nimport { type CommonAriaProps } from '#/helpers/aria';\nimport { cn } from '#/utilities/styleUtilities';\n\nimport styles from './styles/text.module.scss';\n\ntype TextWeight = 'default' | 'strong' | 'x-strong';\ntype TextSize = 'x-small' | 'small' | 'medium' | 'large';\ntype TextColor = 'default' | 'weak' | 'x-weak' | 'disabled' | 'negative' | 'positive' | 'warning' | 'interactive';\ntype BoxColor = 'neutral' | 'selected' | 'disabled' | 'positive' | 'negative' | 'warning';\n\ntype TagType = 'a' | 'abbr' | 'address' | 'em' | 'label' | 'li' | 'span' | 'strong' | 'time' | 'p';\n\nexport type TextProps<TTag extends TagType = 'span'> = CommonAriaProps &\n TagProps<TTag> & {\n /**\n * Id of the element\n */\n id?: string;\n /**\n * Size of the text\n *\n * @default 'medium'\n */\n size?: TextSize;\n /**\n * Weight of the font\n *\n * @default 'default'\n */\n weight?: TextWeight;\n /**\n * The html element used to render\n *\n * @default 'span'\n */\n as?: TTag;\n /**\n * Color of the text\n *\n * @default 'default'\n */\n color?: TextColor;\n /**\n * The texts color when used within a box\n *\n * @description optional color prop that uses the inverse box color when accessibility contrast is needed\n **/\n boxColor?: BoxColor;\n className?: string;\n children?: ReactNode;\n };\n\ntype TagPropMap = {\n a: { href?: string; target: HTMLAttributeAnchorTarget; rel?: string; title?: string };\n abbr: { title?: string };\n address: object;\n em: object;\n label: { for?: string };\n li: { value?: string };\n p: object;\n span: object;\n strong: object;\n time: { dateTime?: string };\n};\ntype TagProps<TTag extends TagType> = TagPropMap[TTag];\n\ntype TextElementMap = {\n a: HTMLAnchorElement;\n abbr: HTMLElement;\n address: HTMLElement;\n em: HTMLElement;\n label: HTMLLabelElement;\n li: HTMLLIElement;\n p: HTMLParagraphElement;\n span: HTMLSpanElement;\n strong: HTMLElement;\n time: HTMLTimeElement;\n};\ntype TextElementType<TTag extends TagType> = TextElementMap[TTag];\n\nexport const Text = forwardRef(\n (\n {\n children,\n as: Tag = 'span',\n size = 'medium',\n weight = 'default',\n color = 'default',\n boxColor,\n className,\n ...props\n },\n ref,\n ) => (\n <Tag\n data-test-id=\"text\"\n className={cn([\n styles.root,\n styles[`size-${size}`],\n styles[`weight-${weight}`],\n styles[boxColor ? `color-box-${boxColor}` : `color-${color}`],\n className,\n ])}\n // @ts-expect-error ref can not be inferred properly by TS\n ref={ref}\n {...props}\n >\n {children}\n </Tag>\n ),\n) as (<TTag extends TagType = 'span'>(\n props: TextProps<TTag> & { ref?: ForwardedRef<TextElementType<TTag>> },\n) => JSX.Element) & { displayName: string };\n\nText.displayName = 'FondueText';\n"],"names":["Text","forwardRef","children","Tag","size","weight","color","boxColor","className","props","ref","jsx","cn","styles"],"mappings":";;;;AAoFO,MAAMA,IAAOC;AAAA,EAChB,CACI;AAAA,IACI,UAAAC;AAAA,IACA,IAAIC,IAAM;AAAA,IACV,MAAAC,IAAO;AAAA,IACP,QAAAC,IAAS;AAAA,IACT,OAAAC,IAAQ;AAAA,IACR,UAAAC;AAAA,IACA,WAAAC;AAAA,IACA,GAAGC;AAAA,EAAA,GAEPC,MAEA,gBAAAC;AAAA,IAACR;AAAA,IAAA;AAAA,MACG,gBAAa;AAAA,MACb,WAAWS,EAAG;AAAA,QACVC,EAAO;AAAA,QACPA,EAAO,QAAQT,CAAI,EAAE;AAAA,QACrBS,EAAO,UAAUR,CAAM,EAAE;AAAA,QACzBQ,EAAON,IAAW,aAAaA,CAAQ,KAAK,SAASD,CAAK,EAAE;AAAA,QAC5DE;AAAA,MAAA,CACH;AAAA,MAED,KAAAE;AAAA,MACC,GAAGD;AAAA,MAEH,UAAAP;AAAA,IAAA;AAAA,EAAA;AAGb;AAIAF,EAAK,cAAc;"}
|
|
1
|
+
{"version":3,"file":"fondue-components30.js","sources":["../src/components/Textarea/Textarea.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { IconCheckMark, IconCross, IconExclamationMarkTriangle } from '@frontify/fondue-icons';\nimport {\n useEffect,\n useRef,\n useState,\n type ChangeEventHandler,\n type CSSProperties,\n type FocusEventHandler,\n type KeyboardEventHandler,\n type ReactElement,\n type SyntheticEvent,\n} from 'react';\n\nimport styles from './styles/textarea.module.scss';\n\nexport type ExtraAction = {\n icon: ReactElement;\n title: string;\n callback: () => void;\n};\n\ntype Status = 'default' | 'loading' | 'success' | 'error';\n\ntype TextareaProps = {\n /**\n * The id of the textarea\n */\n id?: string;\n /**\n * If `true`, Textarea will have `autoComplete` functionality\n */\n autocomplete?: boolean;\n /**\n * If `true`, component rendered is a auto sizing Textarea\n */\n autosize?: boolean;\n /**\n * Render `clear` button to clear input on click\n */\n clearable?: boolean;\n /**\n * A `ReactElement` that will be rendered at the start of the `Textarea`\n */\n decorator?: ReactElement;\n /**\n * Initial value\n */\n defaultValue?: string;\n disabled?: boolean;\n /**\n * Collection of extra actions the input can preform\n */\n extraActions?: ExtraAction[];\n /**\n * If `true`, Textarea will be focused on mount\n */\n focusOnMount?: boolean;\n /**\n * If autosize is false, this is used as rows property for default textarea\n * @default 1\n */\n minRows?: number;\n /**\n * If `autosize` is `false`, this property is ignored\n */\n maxRows?: number;\n /**\n * Event handler called when the textarea value changes\n */\n onChange?: ChangeEventHandler<HTMLTextAreaElement>;\n /**\n * Event handler called when the text input is blurred\n */\n onBlur?: FocusEventHandler<HTMLTextAreaElement>;\n /**\n * Event handler called when the text input is focused\n */\n onFocus?: FocusEventHandler<HTMLTextAreaElement>;\n /**\n * Event handler called when a key is pressed\n */\n onKeyDown?: KeyboardEventHandler<HTMLTextAreaElement>;\n /**\n * Event handler called when Enter is pressed\n */\n onEnterPressed?: KeyboardEventHandler<HTMLTextAreaElement>;\n /**\n * Event handler called when a key is released\n */\n onKeyUp?: KeyboardEventHandler<HTMLTextAreaElement>;\n /**\n * Event handler called when the text inside of text input is selected\n */\n onSelect?: (event: SyntheticEvent<HTMLTextAreaElement>) => void;\n /**\n * If `true`, Textarea will be required\n */\n required?: boolean;\n /**\n * The test id of the textarea\n */\n 'data-test-id'?: string;\n placeholder?: string;\n readOnly?: boolean;\n resizable?: boolean;\n selectable?: boolean;\n /**\n * The current status of the input. It will trigger the corresponding icon to be appended to the Textarea.\n * @default 'default'\n */\n status?: Status;\n value?: string;\n};\n\nexport const Textarea = ({\n 'data-test-id': dataTestId = 'fondue-textarea',\n autocomplete,\n autosize,\n clearable,\n decorator,\n defaultValue,\n disabled,\n extraActions,\n focusOnMount,\n minRows: rows = 1,\n maxRows,\n onEnterPressed,\n readOnly,\n resizable,\n selectable = true,\n status = 'default',\n value: inputValue,\n ...props\n}: TextareaProps) => {\n const ref = useRef<HTMLTextAreaElement>(null);\n const wasClicked = useRef(false);\n\n const [value, setValue] = useState(inputValue ?? defaultValue ?? '');\n\n const hasTools = extraActions?.length !== undefined || clearable || ['success', 'error'].includes(status);\n\n const clear = () => {\n setValue('');\n };\n\n const handleKeyDown: KeyboardEventHandler<HTMLTextAreaElement> = (event) => {\n if (event.key === 'Enter') {\n onEnterPressed?.(event);\n }\n props.onKeyDown?.(event);\n };\n\n useEffect(() => {\n setValue(inputValue ?? defaultValue ?? '');\n }, [defaultValue, inputValue]);\n\n useEffect(() => {\n if (focusOnMount) {\n ref.current?.focus();\n }\n }, [focusOnMount]);\n\n return (\n <div\n className={styles.root}\n data-autosize={autosize}\n data-clearable={clearable}\n data-disabled={disabled || readOnly}\n data-has-decorator={decorator ? true : false}\n data-has-tools={hasTools}\n data-replicated-value={value}\n data-resizable={resizable}\n data-status={status}\n data-max-rows={!!maxRows}\n data-test-id={dataTestId}\n style={{ '--max-rows': `${maxRows}` } as CSSProperties}\n >\n {decorator ? <div className={styles.decorator}>{decorator}</div> : null}\n <textarea\n {...props}\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 props.onFocus?.(focusEvent);\n }}\n onBlur={(blurEvent) => {\n blurEvent.target.dataset.showFocusRing = 'false';\n wasClicked.current = false;\n props.onBlur?.(blurEvent);\n }}\n autoComplete={autocomplete ? 'on' : 'off'}\n className={styles.textarea}\n disabled={disabled}\n onKeyDown={handleKeyDown}\n onInput={(event) => setValue(event.currentTarget.value)}\n onSelect={(event) => {\n if (!selectable) {\n event.currentTarget.selectionStart = event.currentTarget.selectionEnd;\n }\n }}\n readOnly={readOnly}\n ref={ref}\n rows={rows}\n value={value}\n ></textarea>\n {status === 'loading' && <div className={styles.loadingStatus} data-test-id={`${dataTestId}-loader`} />}\n {hasTools && (\n <div className={styles.tools}>\n {status === 'success' && (\n <div className={styles.success}>\n <IconCheckMark size={20} />\n </div>\n )}\n {status === 'error' && (\n <div className={styles[status]}>\n <IconExclamationMarkTriangle size={20} />\n </div>\n )}\n {extraActions?.map(({ icon, title, callback }) => (\n <button\n className={styles.toolsButton}\n disabled={disabled || readOnly}\n key={title}\n onClick={callback}\n title={title}\n >\n {icon}\n </button>\n ))}\n {clearable && (\n <button className={styles.toolsButton} onClick={clear} disabled={disabled || readOnly}>\n <IconCross size={20} fill=\"currentColor\" />\n </button>\n )}\n </div>\n )}\n </div>\n );\n};\n"],"names":["Textarea","dataTestId","autocomplete","autosize","clearable","decorator","defaultValue","disabled","extraActions","focusOnMount","rows","maxRows","onEnterPressed","readOnly","resizable","selectable","status","inputValue","props","ref","useRef","wasClicked","value","setValue","useState","hasTools","clear","handleKeyDown","event","_a","useEffect","jsxs","styles","jsx","mouseEvent","focusEvent","blurEvent","IconCheckMark","IconExclamationMarkTriangle","icon","title","callback","IconCross"],"mappings":";;;;AAoHO,MAAMA,IAAW,CAAC;AAAA,EACrB,gBAAgBC,IAAa;AAAA,EAC7B,cAAAC;AAAA,EACA,UAAAC;AAAA,EACA,WAAAC;AAAA,EACA,WAAAC;AAAA,EACA,cAAAC;AAAA,EACA,UAAAC;AAAA,EACA,cAAAC;AAAA,EACA,cAAAC;AAAA,EACA,SAASC,IAAO;AAAA,EAChB,SAAAC;AAAA,EACA,gBAAAC;AAAA,EACA,UAAAC;AAAA,EACA,WAAAC;AAAA,EACA,YAAAC,IAAa;AAAA,EACb,QAAAC,IAAS;AAAA,EACT,OAAOC;AAAA,EACP,GAAGC;AACP,MAAqB;AACjB,QAAMC,IAAMC,EAA4B,IAAI,GACtCC,IAAaD,EAAO,EAAK,GAEzB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YM;AAAA,cAEtB,SAAS4B;AAAA,cACT,OAAAD;AAAA,cAEC,UAAAD;AAAA,YAAA;AAAA,YAJIC;AAAA,UAAA;AAAA,UAOZpC,KACG,gBAAA6B,EAAC,UAAA,EAAO,WAAWD,EAAO,aAAa,SAASN,GAAO,UAAUnB,KAAYM,GACzE,UAAA,gBAAAoB,EAACS,GAAA,EAAU,MAAM,IAAI,MAAK,gBAAe,EAAA,CAC7C;AAAA,QAAA,EAAA,CAER;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAIhB;"}
|
|
@@ -1,68 +1,34 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { IconCheckMark as h, IconExclamationMarkTriangle as S } from "@frontify/fondue-icons";
|
|
3
|
-
import { forwardRef as f, useRef as T } from "react";
|
|
4
|
-
import { cn as u } from "./fondue-components40.js";
|
|
5
|
-
import { LoadingCircle as v } from "./fondue-components19.js";
|
|
1
|
+
import { jsx as m } from "react/jsx-runtime";
|
|
6
2
|
import a from "./fondue-components84.js";
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
"
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
n.current || (o.target.dataset.showFocusRing = "true"), (l = r.onFocus) == null || l.call(r, o);
|
|
33
|
-
},
|
|
34
|
-
onBlur: (o) => {
|
|
35
|
-
var l;
|
|
36
|
-
o.target.dataset.showFocusRing = "false", n.current = !1, (l = r.onBlur) == null || l.call(r, o);
|
|
37
|
-
},
|
|
38
|
-
ref: w,
|
|
39
|
-
className: a.input,
|
|
40
|
-
"aria-invalid": e === "error",
|
|
41
|
-
"aria-errormessage": e === "error" ? N : void 0
|
|
42
|
-
}
|
|
43
|
-
)
|
|
44
|
-
] }),
|
|
45
|
-
e === "success" ? /* @__PURE__ */ t(h, { size: 16, className: a.iconSuccess, "data-test-id": `${s}-success-icon` }) : null,
|
|
46
|
-
e === "error" ? /* @__PURE__ */ t(
|
|
47
|
-
S,
|
|
48
|
-
{
|
|
49
|
-
size: 16,
|
|
50
|
-
className: a.iconError,
|
|
51
|
-
"data-test-id": `${s}-error-icon`
|
|
52
|
-
}
|
|
53
|
-
) : null,
|
|
54
|
-
i
|
|
55
|
-
] });
|
|
3
|
+
import { Slot as p } from "@radix-ui/react-slot";
|
|
4
|
+
import { createContext as u, useContext as x, useMemo as f } from "react";
|
|
5
|
+
import { enUS as n } from "./fondue-components85.js";
|
|
6
|
+
const o = u({
|
|
7
|
+
theme: "light",
|
|
8
|
+
dir: "ltr",
|
|
9
|
+
translations: n
|
|
10
|
+
});
|
|
11
|
+
o.displayName = "ThemeContext";
|
|
12
|
+
const g = () => x(o), y = ({
|
|
13
|
+
children: s,
|
|
14
|
+
theme: e = "light",
|
|
15
|
+
dir: t = "ltr",
|
|
16
|
+
translations: r = n,
|
|
17
|
+
asChild: l = !1
|
|
18
|
+
}) => {
|
|
19
|
+
const i = l ? p : "div", c = f(
|
|
20
|
+
() => ({
|
|
21
|
+
theme: e,
|
|
22
|
+
dir: t,
|
|
23
|
+
translations: r
|
|
24
|
+
}),
|
|
25
|
+
[t, e, r]
|
|
26
|
+
);
|
|
27
|
+
return /* @__PURE__ */ m(o.Provider, { value: c, children: /* @__PURE__ */ m(i, { dir: t, className: a[e], children: s }) });
|
|
56
28
|
};
|
|
57
|
-
x.displayName = "TextField.Root";
|
|
58
|
-
const F = ({ name: i, className: c, ...e }, s) => /* @__PURE__ */ t("div", { "data-slot": !0, "data-name": i, ...e, ref: s, className: u(a.slot, c) });
|
|
59
|
-
F.displayName = "TextField.Slot";
|
|
60
|
-
const g = f(x), k = f(F), R = g;
|
|
61
|
-
R.Root = g;
|
|
62
|
-
R.Slot = k;
|
|
63
29
|
export {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
30
|
+
o as ThemeContext,
|
|
31
|
+
y as ThemeProvider,
|
|
32
|
+
g as useFondueTheme
|
|
67
33
|
};
|
|
68
34
|
//# sourceMappingURL=fondue-components31.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fondue-components31.js","sources":["../src/components/
|
|
1
|
+
{"version":3,"file":"fondue-components31.js","sources":["../src/components/ThemeProvider/ThemeProvider.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport styles from '@frontify/fondue-tokens/theme-tokens';\nimport { Slot } from '@radix-ui/react-slot';\nimport { createContext, useContext, useMemo, type ReactNode } from 'react';\n\nimport { enUS, type Translations } from '../../locales';\n\ntype AvailableTheme = keyof typeof styles;\n\ntype ThemeProviderProps = {\n children: ReactNode;\n /**\n * The theme to apply\n * @default \"light\"\n * */\n theme?: AvailableTheme;\n /**\n * Direction to apply to the theme\n * @default \"ltr\"\n */\n dir?: 'ltr' | 'rtl';\n /**\n * Translations object to use for component strings.\n * Import from '@frontify/fondue/components/locales' or provide your own.\n * Must be a complete Translations object.\n * @default \"enUS\"\n * @example\n * ```tsx\n * import { deDE } from '@frontify/fondue/components/locales';\n * <ThemeProvider translations={deDE}>...</ThemeProvider>\n * ```\n */\n translations?: Translations;\n /**\n * Change the default rendered element for the one passed as a child, merging their props and behavior.\n * @default false\n */\n asChild?: boolean;\n};\n\ntype ThemeContextValue = {\n theme: AvailableTheme;\n dir: 'ltr' | 'rtl';\n translations: Translations;\n};\n\nexport const ThemeContext = createContext<ThemeContextValue>({\n theme: 'light',\n dir: 'ltr',\n translations: enUS,\n});\nThemeContext.displayName = 'ThemeContext';\n\nexport const useFondueTheme = () => {\n return useContext(ThemeContext);\n};\n\nexport const ThemeProvider = ({\n children,\n theme = 'light',\n dir = 'ltr',\n translations = enUS,\n asChild = false,\n}: ThemeProviderProps) => {\n const Comp = asChild ? Slot : 'div';\n\n const contextValue = useMemo(\n () => ({\n theme,\n dir,\n translations,\n }),\n [dir, theme, translations],\n );\n\n return (\n <ThemeContext.Provider value={contextValue}>\n <Comp dir={dir} className={styles[theme]}>\n {children}\n </Comp>\n </ThemeContext.Provider>\n );\n};\n"],"names":["ThemeContext","createContext","enUS","useFondueTheme","useContext","ThemeProvider","children","theme","dir","translations","asChild","Comp","Slot","contextValue","useMemo","jsx","styles"],"mappings":";;;;;AA+CO,MAAMA,IAAeC,EAAiC;AAAA,EACzD,OAAO;AAAA,EACP,KAAK;AAAA,EACL,cAAcC;AAClB,CAAC;AACDF,EAAa,cAAc;AAEpB,MAAMG,IAAiB,MACnBC,EAAWJ,CAAY,GAGrBK,IAAgB,CAAC;AAAA,EAC1B,UAAAC;AAAA,EACA,OAAAC,IAAQ;AAAA,EACR,KAAAC,IAAM;AAAA,EACN,cAAAC,IAAeP;AAAA,EACf,SAAAQ,IAAU;AACd,MAA0B;AACtB,QAAMC,IAAOD,IAAUE,IAAO,OAExBC,IAAeC;AAAA,IACjB,OAAO;AAAA,MACH,OAAAP;AAAA,MACA,KAAAC;AAAA,MACA,cAAAC;AAAA,IAAA;AAAA,IAEJ,CAACD,GAAKD,GAAOE,CAAY;AAAA,EAAA;AAG7B,SACI,gBAAAM,EAACf,EAAa,UAAb,EAAsB,OAAOa,GAC1B,UAAA,gBAAAE,EAACJ,GAAA,EAAK,KAAAH,GAAU,WAAWQ,EAAOT,CAAK,GAClC,UAAAD,GACL,GACJ;AAER;"}
|
|
@@ -1,106 +1,60 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
g(f ?? u ?? "");
|
|
33
|
-
}, [u, f]), B(() => {
|
|
34
|
-
var a;
|
|
35
|
-
N && ((a = C.current) == null || a.focus());
|
|
36
|
-
}, [N]), /* @__PURE__ */ z(
|
|
37
|
-
"div",
|
|
1
|
+
import { jsx as o, jsxs as y } from "react/jsx-runtime";
|
|
2
|
+
import * as r from "@radix-ui/react-tooltip";
|
|
3
|
+
import { forwardRef as l } from "react";
|
|
4
|
+
import { cn as R } from "./fondue-components39.js";
|
|
5
|
+
import { useFondueTheme as N, ThemeProvider as x } from "./fondue-components31.js";
|
|
6
|
+
import s from "./fondue-components86.js";
|
|
7
|
+
const p = ({ children: t, enterDelay: e = 700, open: i, onOpenChange: n }) => /* @__PURE__ */ o(r.Provider, { children: /* @__PURE__ */ o(r.Root, { delayDuration: e, open: i, onOpenChange: n, children: t }) });
|
|
8
|
+
p.displayName = "Tooltip.Root";
|
|
9
|
+
const m = ({ asChild: t = !1, children: e, "data-test-id": i = "fondue-tooltip-trigger" }, n) => /* @__PURE__ */ o(
|
|
10
|
+
r.Trigger,
|
|
11
|
+
{
|
|
12
|
+
"data-tooltip-trigger": !0,
|
|
13
|
+
"data-test-id": i,
|
|
14
|
+
type: t ? void 0 : "button",
|
|
15
|
+
asChild: t,
|
|
16
|
+
ref: n,
|
|
17
|
+
children: e
|
|
18
|
+
}
|
|
19
|
+
);
|
|
20
|
+
m.displayName = "Tooltip.Trigger";
|
|
21
|
+
const f = ({
|
|
22
|
+
children: t,
|
|
23
|
+
className: e,
|
|
24
|
+
maxWidth: i,
|
|
25
|
+
"data-test-id": n = "fondue-tooltip-content",
|
|
26
|
+
padding: c = "spacious",
|
|
27
|
+
side: g
|
|
28
|
+
}, u) => {
|
|
29
|
+
const { theme: T, dir: d } = N(), h = (a) => !a || d === "ltr" ? a : a === "left" ? "right" : a === "right" ? "left" : a;
|
|
30
|
+
return /* @__PURE__ */ o(r.Portal, { children: /* @__PURE__ */ o(x, { theme: T, dir: d, children: /* @__PURE__ */ y(
|
|
31
|
+
r.Content,
|
|
38
32
|
{
|
|
39
|
-
|
|
40
|
-
"data-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
"data-status": s,
|
|
48
|
-
"data-max-rows": !!k,
|
|
49
|
-
"data-test-id": w,
|
|
50
|
-
style: { "--max-rows": `${k}` },
|
|
33
|
+
"data-test-id": n,
|
|
34
|
+
"data-tooltip-spacing": c,
|
|
35
|
+
className: R(s.root, e),
|
|
36
|
+
style: { maxWidth: i },
|
|
37
|
+
collisionPadding: 16,
|
|
38
|
+
sideOffset: 8,
|
|
39
|
+
ref: u,
|
|
40
|
+
side: h(g),
|
|
51
41
|
children: [
|
|
52
|
-
|
|
53
|
-
/* @__PURE__ */ o(
|
|
54
|
-
"textarea",
|
|
55
|
-
{
|
|
56
|
-
...t,
|
|
57
|
-
onMouseDown: (a) => {
|
|
58
|
-
h.current = !0, a.currentTarget.dataset.showFocusRing = "false";
|
|
59
|
-
},
|
|
60
|
-
onFocus: (a) => {
|
|
61
|
-
var e;
|
|
62
|
-
h.current || (a.target.dataset.showFocusRing = "true"), (e = t.onFocus) == null || e.call(t, a);
|
|
63
|
-
},
|
|
64
|
-
onBlur: (a) => {
|
|
65
|
-
var e;
|
|
66
|
-
a.target.dataset.showFocusRing = "false", h.current = !1, (e = t.onBlur) == null || e.call(t, a);
|
|
67
|
-
},
|
|
68
|
-
autoComplete: D ? "on" : "off",
|
|
69
|
-
className: l.textarea,
|
|
70
|
-
disabled: n,
|
|
71
|
-
onKeyDown: j,
|
|
72
|
-
onInput: (a) => g(a.currentTarget.value),
|
|
73
|
-
onSelect: (a) => {
|
|
74
|
-
I || (a.currentTarget.selectionStart = a.currentTarget.selectionEnd);
|
|
75
|
-
},
|
|
76
|
-
readOnly: r,
|
|
77
|
-
ref: C,
|
|
78
|
-
rows: S,
|
|
79
|
-
value: v
|
|
80
|
-
}
|
|
81
|
-
),
|
|
82
|
-
s === "loading" && /* @__PURE__ */ o("div", { className: l.loadingStatus, "data-test-id": `${w}-loader` }),
|
|
83
|
-
T && /* @__PURE__ */ z("div", { className: l.tools, children: [
|
|
84
|
-
s === "success" && /* @__PURE__ */ o("div", { className: l.success, children: /* @__PURE__ */ o($, { size: 20 }) }),
|
|
85
|
-
s === "error" && /* @__PURE__ */ o("div", { className: l[s], children: /* @__PURE__ */ o(b, { size: 20 }) }),
|
|
86
|
-
c == null ? void 0 : c.map(({ icon: a, title: e, callback: M }) => /* @__PURE__ */ o(
|
|
87
|
-
"button",
|
|
88
|
-
{
|
|
89
|
-
className: l.toolsButton,
|
|
90
|
-
disabled: n || r,
|
|
91
|
-
onClick: M,
|
|
92
|
-
title: e,
|
|
93
|
-
children: a
|
|
94
|
-
},
|
|
95
|
-
e
|
|
96
|
-
)),
|
|
97
|
-
i && /* @__PURE__ */ o("button", { className: l.toolsButton, onClick: K, disabled: n || r, children: /* @__PURE__ */ o(q, { size: 20, fill: "currentColor" }) })
|
|
98
|
-
] })
|
|
42
|
+
t,
|
|
43
|
+
/* @__PURE__ */ o(r.Arrow, { "aria-hidden": "true", className: s.arrow })
|
|
99
44
|
]
|
|
100
45
|
}
|
|
101
|
-
);
|
|
46
|
+
) }) });
|
|
47
|
+
};
|
|
48
|
+
f.displayName = "Tooltip.Content";
|
|
49
|
+
const A = {
|
|
50
|
+
Root: p,
|
|
51
|
+
Trigger: l(m),
|
|
52
|
+
Content: l(f)
|
|
102
53
|
};
|
|
103
54
|
export {
|
|
104
|
-
|
|
55
|
+
A as Tooltip,
|
|
56
|
+
f as TooltipContent,
|
|
57
|
+
p as TooltipRoot,
|
|
58
|
+
m as TooltipTrigger
|
|
105
59
|
};
|
|
106
60
|
//# sourceMappingURL=fondue-components32.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fondue-components32.js","sources":["../src/components/Textarea/Textarea.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { IconCheckMark, IconCross, IconExclamationMarkTriangle } from '@frontify/fondue-icons';\nimport {\n useEffect,\n useRef,\n useState,\n type ChangeEventHandler,\n type CSSProperties,\n type FocusEventHandler,\n type KeyboardEventHandler,\n type ReactElement,\n type SyntheticEvent,\n} from 'react';\n\nimport styles from './styles/textarea.module.scss';\n\nexport type ExtraAction = {\n icon: ReactElement;\n title: string;\n callback: () => void;\n};\n\ntype Status = 'default' | 'loading' | 'success' | 'error';\n\ntype TextareaProps = {\n /**\n * The id of the textarea\n */\n id?: string;\n /**\n * If `true`, Textarea will have `autoComplete` functionality\n */\n autocomplete?: boolean;\n /**\n * If `true`, component rendered is a auto sizing Textarea\n */\n autosize?: boolean;\n /**\n * Render `clear` button to clear input on click\n */\n clearable?: boolean;\n /**\n * A `ReactElement` that will be rendered at the start of the `Textarea`\n */\n decorator?: ReactElement;\n /**\n * Initial value\n */\n defaultValue?: string;\n disabled?: boolean;\n /**\n * Collection of extra actions the input can preform\n */\n extraActions?: ExtraAction[];\n /**\n * If `true`, Textarea will be focused on mount\n */\n focusOnMount?: boolean;\n /**\n * If autosize is false, this is used as rows property for default textarea\n * @default 1\n */\n minRows?: number;\n /**\n * If `autosize` is `false`, this property is ignored\n */\n maxRows?: number;\n /**\n * Event handler called when the textarea value changes\n */\n onChange?: ChangeEventHandler<HTMLTextAreaElement>;\n /**\n * Event handler called when the text input is blurred\n */\n onBlur?: FocusEventHandler<HTMLTextAreaElement>;\n /**\n * Event handler called when the text input is focused\n */\n onFocus?: FocusEventHandler<HTMLTextAreaElement>;\n /**\n * Event handler called when a key is pressed\n */\n onKeyDown?: KeyboardEventHandler<HTMLTextAreaElement>;\n /**\n * Event handler called when Enter is pressed\n */\n onEnterPressed?: KeyboardEventHandler<HTMLTextAreaElement>;\n /**\n * Event handler called when a key is released\n */\n onKeyUp?: KeyboardEventHandler<HTMLTextAreaElement>;\n /**\n * Event handler called when the text inside of text input is selected\n */\n onSelect?: (event: SyntheticEvent<HTMLTextAreaElement>) => void;\n /**\n * If `true`, Textarea will be required\n */\n required?: boolean;\n /**\n * The test id of the textarea\n */\n 'data-test-id'?: string;\n placeholder?: string;\n readOnly?: boolean;\n resizable?: boolean;\n selectable?: boolean;\n /**\n * The current status of the input. It will trigger the corresponding icon to be appended to the Textarea.\n * @default 'default'\n */\n status?: Status;\n value?: string;\n};\n\nexport const Textarea = ({\n 'data-test-id': dataTestId = 'fondue-textarea',\n autocomplete,\n autosize,\n clearable,\n decorator,\n defaultValue,\n disabled,\n extraActions,\n focusOnMount,\n minRows: rows = 1,\n maxRows,\n onEnterPressed,\n readOnly,\n resizable,\n selectable = true,\n status = 'default',\n value: inputValue,\n ...props\n}: TextareaProps) => {\n const ref = useRef<HTMLTextAreaElement>(null);\n const wasClicked = useRef(false);\n\n const [value, setValue] = useState(inputValue ?? defaultValue ?? '');\n\n const hasTools = extraActions?.length !== undefined || clearable || ['success', 'error'].includes(status);\n\n const clear = () => {\n setValue('');\n };\n\n const handleKeyDown: KeyboardEventHandler<HTMLTextAreaElement> = (event) => {\n if (event.key === 'Enter') {\n onEnterPressed?.(event);\n }\n props.onKeyDown?.(event);\n };\n\n useEffect(() => {\n setValue(inputValue ?? defaultValue ?? '');\n }, [defaultValue, inputValue]);\n\n useEffect(() => {\n if (focusOnMount) {\n ref.current?.focus();\n }\n }, [focusOnMount]);\n\n return (\n <div\n className={styles.root}\n data-autosize={autosize}\n data-clearable={clearable}\n data-disabled={disabled || readOnly}\n data-has-decorator={decorator ? true : false}\n data-has-tools={hasTools}\n data-replicated-value={value}\n data-resizable={resizable}\n data-status={status}\n data-max-rows={!!maxRows}\n data-test-id={dataTestId}\n style={{ '--max-rows': `${maxRows}` } as CSSProperties}\n >\n {decorator ? <div className={styles.decorator}>{decorator}</div> : null}\n <textarea\n {...props}\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 props.onFocus?.(focusEvent);\n }}\n onBlur={(blurEvent) => {\n blurEvent.target.dataset.showFocusRing = 'false';\n wasClicked.current = false;\n props.onBlur?.(blurEvent);\n }}\n autoComplete={autocomplete ? 'on' : 'off'}\n className={styles.textarea}\n disabled={disabled}\n onKeyDown={handleKeyDown}\n onInput={(event) => setValue(event.currentTarget.value)}\n onSelect={(event) => {\n if (!selectable) {\n event.currentTarget.selectionStart = event.currentTarget.selectionEnd;\n }\n }}\n readOnly={readOnly}\n ref={ref}\n rows={rows}\n value={value}\n ></textarea>\n {status === 'loading' && <div className={styles.loadingStatus} data-test-id={`${dataTestId}-loader`} />}\n {hasTools && (\n <div className={styles.tools}>\n {status === 'success' && (\n <div className={styles.success}>\n <IconCheckMark size={20} />\n </div>\n )}\n {status === 'error' && (\n <div className={styles[status]}>\n <IconExclamationMarkTriangle size={20} />\n </div>\n )}\n {extraActions?.map(({ icon, title, callback }) => (\n <button\n className={styles.toolsButton}\n disabled={disabled || readOnly}\n key={title}\n onClick={callback}\n title={title}\n >\n {icon}\n </button>\n ))}\n {clearable && (\n <button className={styles.toolsButton} onClick={clear} disabled={disabled || readOnly}>\n <IconCross size={20} fill=\"currentColor\" />\n </button>\n )}\n </div>\n )}\n </div>\n );\n};\n"],"names":["Textarea","dataTestId","autocomplete","autosize","clearable","decorator","defaultValue","disabled","extraActions","focusOnMount","rows","maxRows","onEnterPressed","readOnly","resizable","selectable","status","inputValue","props","ref","useRef","wasClicked","value","setValue","useState","hasTools","clear","handleKeyDown","event","_a","useEffect","jsxs","styles","jsx","mouseEvent","focusEvent","blurEvent","IconCheckMark","IconExclamationMarkTriangle","icon","title","callback","IconCross"],"mappings":";;;;AAoHO,MAAMA,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UAAAhB,MAAW,aACR,gBAAAiB,EAAC,OAAA,EAAI,WAAWD,EAAO,SACnB,UAAA,gBAAAC,EAACI,GAAA,EAAc,MAAM,GAAA,CAAI,EAAA,CAC7B;AAAA,UAEHrB,MAAW,WACR,gBAAAiB,EAAC,OAAA,EAAI,WAAWD,EAAOhB,CAAM,GACzB,UAAA,gBAAAiB,EAACK,GAAA,EAA4B,MAAM,GAAA,CAAI,GAC3C;AAAA,UAEH9B,KAAA,gBAAAA,EAAc,IAAI,CAAC,EAAE,MAAA+B,GAAM,OAAAC,GAAO,UAAAC,QAC/B,gBAAAR;AAAA,YAAC;AAAA,YAAA;AAAA,cACG,WAAWD,EAAO;AAAA,cAClB,UAAUzB,KAAYM;AAAA,cAEtB,SAAS4B;AAAA,cACT,OAAAD;AAAA,cAEC,UAAAD;AAAA,YAAA;AAAA,YAJIC;AAAA,UAAA;AAAA,UAOZpC,KACG,gBAAA6B,EAAC,UAAA,EAAO,WAAWD,EAAO,aAAa,SAASN,GAAO,UAAUnB,KAAYM,GACzE,UAAA,gBAAAoB,EAACS,GAAA,EAAU,MAAM,IAAI,MAAK,gBAAe,EAAA,CAC7C;AAAA,QAAA,EAAA,CAER;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAIhB;"}
|
|
1
|
+
{"version":3,"file":"fondue-components32.js","sources":["../src/components/Tooltip/Tooltip.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport * as RadixTooltip from '@radix-ui/react-tooltip';\nimport { forwardRef, type ForwardedRef, type ReactElement, type ReactNode } from 'react';\n\nimport { cn } from '#/utilities/styleUtilities';\n\nimport { ThemeProvider, useFondueTheme } from '../ThemeProvider/ThemeProvider';\n\nimport styles from './styles/tooltip.module.scss';\n\nexport type TooltipRootProps = {\n /**\n * Sets the open state of the tooltip.\n */\n open?: boolean;\n /**\n * Callback that is called when the open state of the tooltip changes.\n */\n onOpenChange?: (open: boolean) => void;\n /**\n * The delay in milliseconds before the tooltip appears.\n * @default 700\n */\n enterDelay?: number;\n children: Array<ReactElement<TooltipTriggerProps | TooltipContentProps>>;\n};\n\nexport const TooltipRoot = ({ children, enterDelay = 700, open, onOpenChange }: TooltipRootProps) => {\n return (\n <RadixTooltip.Provider>\n <RadixTooltip.Root delayDuration={enterDelay} open={open} onOpenChange={onOpenChange}>\n {children}\n </RadixTooltip.Root>\n </RadixTooltip.Provider>\n );\n};\nTooltipRoot.displayName = 'Tooltip.Root';\n\nexport type TooltipTriggerProps = {\n /**\n * Change the default rendered element for the one passed as a child, merging their props and behavior.\n * @default false\n */\n asChild?: boolean;\n children: ReactNode;\n 'data-test-id'?: string;\n};\n\nexport const TooltipTrigger = (\n { asChild = false, children, 'data-test-id': dataTestId = 'fondue-tooltip-trigger' }: TooltipTriggerProps,\n ref: ForwardedRef<HTMLButtonElement>,\n) => {\n return (\n <RadixTooltip.Trigger\n data-tooltip-trigger\n data-test-id={dataTestId}\n type={!asChild ? 'button' : undefined}\n asChild={asChild}\n ref={ref}\n >\n {children}\n </RadixTooltip.Trigger>\n );\n};\nTooltipTrigger.displayName = 'Tooltip.Trigger';\n\nexport type TooltipContentProps = {\n /**\n * @default \"spacious\"\n */\n padding?: 'spacious' | 'compact';\n /**\n * Defines the preferred side of the tooltip. It will not be respected if there are collisions with the viewport.\n */\n side?: 'top' | 'right' | 'bottom' | 'left';\n maxWidth?: string;\n className?: string;\n children: ReactNode;\n 'data-test-id'?: string;\n};\n\nexport const TooltipContent = (\n {\n children,\n className,\n maxWidth,\n 'data-test-id': dataTestId = 'fondue-tooltip-content',\n padding = 'spacious',\n side,\n }: TooltipContentProps,\n ref: ForwardedRef<HTMLDivElement>,\n) => {\n const { theme, dir } = useFondueTheme();\n\n const getAdjustedSide = (side?: 'top' | 'right' | 'bottom' | 'left') => {\n if (!side || dir === 'ltr') {\n return side;\n }\n\n if (side === 'left') {\n return 'right';\n }\n if (side === 'right') {\n return 'left';\n }\n\n return side;\n };\n\n return (\n <RadixTooltip.Portal>\n <ThemeProvider theme={theme} dir={dir}>\n <RadixTooltip.Content\n data-test-id={dataTestId}\n data-tooltip-spacing={padding}\n className={cn(styles.root, className)}\n style={{ maxWidth }}\n collisionPadding={16}\n sideOffset={8}\n ref={ref}\n side={getAdjustedSide(side)}\n >\n {children}\n <RadixTooltip.Arrow aria-hidden=\"true\" className={styles.arrow} />\n </RadixTooltip.Content>\n </ThemeProvider>\n </RadixTooltip.Portal>\n );\n};\nTooltipContent.displayName = 'Tooltip.Content';\n\nexport const Tooltip = {\n Root: TooltipRoot,\n Trigger: forwardRef<HTMLButtonElement, TooltipTriggerProps>(TooltipTrigger),\n Content: forwardRef<HTMLDivElement, TooltipContentProps>(TooltipContent),\n};\n"],"names":["TooltipRoot","children","enterDelay","open","onOpenChange","jsx","RadixTooltip","TooltipTrigger","asChild","dataTestId","ref","TooltipContent","className","maxWidth","padding","side","theme","dir","useFondueTheme","getAdjustedSide","ThemeProvider","jsxs","cn","styles","Tooltip","forwardRef"],"mappings":";;;;;;AA4BO,MAAMA,IAAc,CAAC,EAAE,UAAAC,GAAU,YAAAC,IAAa,KAAK,MAAAC,GAAM,cAAAC,QAExD,gBAAAC,EAACC,EAAa,UAAb,EACG,UAAA,gBAAAD,EAACC,EAAa,MAAb,EAAkB,eAAeJ,GAAY,MAAAC,GAAY,cAAAC,GACrD,UAAAH,GACL,GACJ;AAGRD,EAAY,cAAc;AAYnB,MAAMO,IAAiB,CAC1B,EAAE,SAAAC,IAAU,IAAO,UAAAP,GAAU,gBAAgBQ,IAAa,yBAAA,GAC1DC,MAGI,gBAAAL;AAAA,EAACC,EAAa;AAAA,EAAb;AAAA,IACG,wBAAoB;AAAA,IACpB,gBAAcG;AAAA,IACd,MAAOD,IAAqB,SAAX;AAAA,IACjB,SAAAA;AAAA,IACA,KAAAE;AAAA,IAEC,UAAAT;AAAA,EAAA;AAAA;AAIbM,EAAe,cAAc;AAiBtB,MAAMI,IAAiB,CAC1B;AAAA,EACI,UAAAV;AAAA,EACA,WAAAW;AAAA,EACA,UAAAC;AAAA,EACA,gBAAgBJ,IAAa;AAAA,EAC7B,SAAAK,IAAU;AAAA,EACV,MAAAC;AACJ,GACAL,MACC;AACD,QAAM,EAAE,OAAAM,GAAO,KAAAC,EAAA,IAAQC,EAAA,GAEjBC,IAAkB,CAACJ,MACjB,CAACA,KAAQE,MAAQ,QACVF,IAGPA,MAAS,SACF,UAEPA,MAAS,UACF,SAGJA;AAGX,2BACKT,EAAa,QAAb,EACG,UAAA,gBAAAD,EAACe,GAAA,EAAc,OAAAJ,GAAc,KAAAC,GACzB,UAAA,gBAAAI;AAAA,IAACf,EAAa;AAAA,IAAb;AAAA,MACG,gBAAcG;AAAA,MACd,wBAAsBK;AAAA,MACtB,WAAWQ,EAAGC,EAAO,MAAMX,CAAS;AAAA,MACpC,OAAO,EAAE,UAAAC,EAAA;AAAA,MACT,kBAAkB;AAAA,MAClB,YAAY;AAAA,MACZ,KAAAH;AAAA,MACA,MAAMS,EAAgBJ,CAAI;AAAA,MAEzB,UAAA;AAAA,QAAAd;AAAA,QACD,gBAAAI,EAACC,EAAa,OAAb,EAAmB,eAAY,QAAO,WAAWiB,EAAO,MAAA,CAAO;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA,GAExE,EAAA,CACJ;AAER;AACAZ,EAAe,cAAc;AAEtB,MAAMa,IAAU;AAAA,EACnB,MAAMxB;AAAA,EACN,SAASyB,EAAmDlB,CAAc;AAAA,EAC1E,SAASkB,EAAgDd,CAAc;AAC3E;"}
|
|
@@ -1,16 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
const o = "_root_12wzh_2", c = "_accordionItem_12wzh_23", n = "_accordionTrigger_12wzh_29", r = "_accordionHeader_12wzh_34", t = "_accordionSlot_12wzh_42", e = "_accordionCaret_12wzh_69", a = "_accordionTriggerContent_12wzh_77", i = "_accordionContent_12wzh_82", d = "_accordionContentText_12wzh_111", _ = {
|
|
2
|
+
root: o,
|
|
3
|
+
accordionItem: c,
|
|
4
|
+
accordionTrigger: n,
|
|
5
|
+
accordionHeader: r,
|
|
6
|
+
accordionSlot: t,
|
|
7
|
+
accordionCaret: e,
|
|
8
|
+
accordionTriggerContent: a,
|
|
9
|
+
accordionContent: i,
|
|
10
|
+
accordionContentText: d
|
|
10
11
|
};
|
|
11
12
|
export {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
e as accordionCaret,
|
|
14
|
+
i as accordionContent,
|
|
15
|
+
d as accordionContentText,
|
|
16
|
+
r as accordionHeader,
|
|
17
|
+
c as accordionItem,
|
|
18
|
+
t as accordionSlot,
|
|
19
|
+
n as accordionTrigger,
|
|
20
|
+
a as accordionTriggerContent,
|
|
21
|
+
_ as default,
|
|
22
|
+
o as root
|
|
15
23
|
};
|
|
16
24
|
//# sourceMappingURL=fondue-components33.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fondue-components33.js","sources":[
|
|
1
|
+
{"version":3,"file":"fondue-components33.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;"}
|
|
@@ -1,60 +1,27 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
className: e,
|
|
24
|
-
maxWidth: i,
|
|
25
|
-
"data-test-id": n = "fondue-tooltip-content",
|
|
26
|
-
padding: c = "spacious",
|
|
27
|
-
side: g
|
|
28
|
-
}, u) => {
|
|
29
|
-
const { theme: T, dir: d } = N(), h = (a) => !a || d === "ltr" ? a : a === "left" ? "right" : a === "right" ? "left" : a;
|
|
30
|
-
return /* @__PURE__ */ o(r.Portal, { children: /* @__PURE__ */ o(x, { theme: T, dir: d, children: /* @__PURE__ */ y(
|
|
31
|
-
r.Content,
|
|
32
|
-
{
|
|
33
|
-
"data-test-id": n,
|
|
34
|
-
"data-tooltip-spacing": c,
|
|
35
|
-
className: R(s.root, e),
|
|
36
|
-
style: { maxWidth: i },
|
|
37
|
-
collisionPadding: 16,
|
|
38
|
-
sideOffset: 8,
|
|
39
|
-
ref: u,
|
|
40
|
-
side: h(g),
|
|
41
|
-
children: [
|
|
42
|
-
t,
|
|
43
|
-
/* @__PURE__ */ o(r.Arrow, { "aria-hidden": "true", className: s.arrow })
|
|
44
|
-
]
|
|
45
|
-
}
|
|
46
|
-
) }) });
|
|
47
|
-
};
|
|
48
|
-
f.displayName = "Tooltip.Content";
|
|
49
|
-
const A = {
|
|
50
|
-
Root: p,
|
|
51
|
-
Trigger: l(m),
|
|
52
|
-
Content: l(f)
|
|
1
|
+
import { useContext as i, useCallback as u } from "react";
|
|
2
|
+
import { ThemeContext as c } from "./fondue-components31.js";
|
|
3
|
+
const d = () => {
|
|
4
|
+
const { translations: r } = i(c);
|
|
5
|
+
return {
|
|
6
|
+
/** Translation function */
|
|
7
|
+
t: u(
|
|
8
|
+
(o, e) => {
|
|
9
|
+
const n = r[o];
|
|
10
|
+
if (n === void 0)
|
|
11
|
+
return process.env.NODE_ENV !== "production" && console.warn(`[Fondue] Translation key "${o}" not found`), o;
|
|
12
|
+
if (typeof n != "string")
|
|
13
|
+
return process.env.NODE_ENV !== "production" && console.warn(`[Fondue] Translation value for key "${o}" is not a string`), o;
|
|
14
|
+
let t = n;
|
|
15
|
+
if (e)
|
|
16
|
+
for (const [s, a] of Object.entries(e))
|
|
17
|
+
t = t.replaceAll(`\${${s}}`, a);
|
|
18
|
+
return t;
|
|
19
|
+
},
|
|
20
|
+
[r]
|
|
21
|
+
)
|
|
22
|
+
};
|
|
53
23
|
};
|
|
54
24
|
export {
|
|
55
|
-
|
|
56
|
-
f as TooltipContent,
|
|
57
|
-
p as TooltipRoot,
|
|
58
|
-
m as TooltipTrigger
|
|
25
|
+
d as useTranslation
|
|
59
26
|
};
|
|
60
27
|
//# sourceMappingURL=fondue-components34.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fondue-components34.js","sources":["../src/
|
|
1
|
+
{"version":3,"file":"fondue-components34.js","sources":["../src/hooks/useTranslation.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { useCallback, useContext } from 'react';\n\nimport { ThemeContext } from '../components/ThemeProvider/ThemeProvider';\n\n/**\n * Hook to access translation functionality.\n *\n * @returns Object containing translation function\n *\n * @example\n * ```tsx\n * const { t } = useTranslation();\n *\n * // Simple translation\n * const label = t('ColorPicker_selectColor');\n *\n * // Translation with variables\n * const sortLabel = t('Table_sortByAscending', { column: 'Name' });\n * ```\n */\nexport const useTranslation = () => {\n const { translations } = useContext(ThemeContext);\n\n /**\n * Translates a key to its localized string value.\n * Keys follow the format ComponentName_localLabelName[_moreLocalLabelName]\n * and support variable interpolation using ${variable} syntax.\n *\n * @param key - The translation key (e.g., 'ColorPicker_selectColor')\n * @param variables - Optional variables to interpolate into the translation\n * @returns The translated string, or the key itself if translation is not found\n */\n const t = useCallback(\n (key: keyof typeof translations, variables?: Record<string, string>): string => {\n // Direct lookup for flat keys\n const value = translations[key];\n\n if (value === undefined) {\n if (process.env.NODE_ENV !== 'production') {\n console.warn(`[Fondue] Translation key \"${key}\" not found`);\n }\n return key;\n }\n\n if (typeof value !== 'string') {\n if (process.env.NODE_ENV !== 'production') {\n console.warn(`[Fondue] Translation value for key \"${key}\" is not a string`);\n }\n return key;\n }\n\n let text = value;\n\n // Variable interpolation: replace ${variable} with actual values\n if (variables) {\n for (const [varKey, varValue] of Object.entries(variables)) {\n text = text.replaceAll(`\\${${varKey}}`, varValue);\n }\n }\n\n return text;\n },\n [translations],\n );\n\n return {\n /** Translation function */\n t,\n };\n};\n"],"names":["useTranslation","translations","useContext","ThemeContext","useCallback","key","variables","value","text","varKey","varValue"],"mappings":";;AAsBO,MAAMA,IAAiB,MAAM;AAChC,QAAM,EAAE,cAAAC,EAAA,IAAiBC,EAAWC,CAAY;AA4ChD,SAAO;AAAA;AAAA,IAEH,GAnCMC;AAAA,MACN,CAACC,GAAgCC,MAA+C;AAE5E,cAAMC,IAAQN,EAAaI,CAAG;AAE9B,YAAIE,MAAU;AACV,iBAAI,QAAQ,IAAI,aAAa,gBACzB,QAAQ,KAAK,6BAA6BF,CAAG,aAAa,GAEvDA;AAGX,YAAI,OAAOE,KAAU;AACjB,iBAAI,QAAQ,IAAI,aAAa,gBACzB,QAAQ,KAAK,uCAAuCF,CAAG,mBAAmB,GAEvEA;AAGX,YAAIG,IAAOD;AAGX,YAAID;AACA,qBAAW,CAACG,GAAQC,CAAQ,KAAK,OAAO,QAAQJ,CAAS;AACrD,YAAAE,IAAOA,EAAK,WAAW,MAAMC,CAAM,KAAKC,CAAQ;AAIxD,eAAOF;AAAA,MACX;AAAA,MACA,CAACP,CAAY;AAAA,IAAA;AAAA,EAKb;AAER;"}
|
|
@@ -1,24 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
accordionCaret: d,
|
|
8
|
-
accordionTriggerContent: e,
|
|
9
|
-
accordionContent: a,
|
|
10
|
-
accordionContentText: i
|
|
1
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import s from "./fondue-components87.js";
|
|
3
|
+
import { colorToCss as e } from "./fondue-components88.js";
|
|
4
|
+
const a = ["default", "positive", "highlight", "warning", "negative"], i = (t) => typeof t == "string" && a.includes(t), p = ({ status: t }) => {
|
|
5
|
+
const o = i(t) ? { "data-status": t } : { style: { backgroundColor: typeof t == "string" ? t : e(t) || "transparent" } };
|
|
6
|
+
return /* @__PURE__ */ r("div", { "data-test-id": "badge-status", className: s.root, ...o });
|
|
11
7
|
};
|
|
12
8
|
export {
|
|
13
|
-
|
|
14
|
-
a as accordionContent,
|
|
15
|
-
i as accordionContentText,
|
|
16
|
-
n as accordionHeader,
|
|
17
|
-
c as accordionItem,
|
|
18
|
-
r as accordionSlot,
|
|
19
|
-
t as accordionTrigger,
|
|
20
|
-
e as accordionTriggerContent,
|
|
21
|
-
_ as default,
|
|
22
|
-
o as root
|
|
9
|
+
p as BadgeStatus
|
|
23
10
|
};
|
|
24
11
|
//# sourceMappingURL=fondue-components35.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fondue-components35.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"fondue-components35.js","sources":["../src/components/Badge/BadgeStatus.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport styles from './styles/badgestatus.module.scss';\nimport { type RgbaColor } from './types';\nimport { colorToCss } from './utils';\n\ntype BadgeStatusType = 'default' | 'positive' | 'highlight' | 'warning' | 'negative';\n\nconst badgeStatusMap = ['default', 'positive', 'highlight', 'warning', 'negative'];\n\nexport type BadgeStatusProps = { status: BadgeStatusType } | { status: RgbaColor | string };\n\nconst isBadgeStatusType = (value: RgbaColor | string): value is BadgeStatusType =>\n typeof value === 'string' && badgeStatusMap.includes(value);\n\nexport const BadgeStatus = ({ status }: BadgeStatusProps) => {\n const colorProps = isBadgeStatusType(status)\n ? { 'data-status': status }\n : { style: { backgroundColor: typeof status === 'string' ? status : colorToCss(status) || 'transparent' } };\n\n return <div data-test-id=\"badge-status\" className={styles.root} {...colorProps}></div>;\n};\n"],"names":["badgeStatusMap","isBadgeStatusType","value","BadgeStatus","status","colorProps","colorToCss","jsx","styles"],"mappings":";;;AAQA,MAAMA,IAAiB,CAAC,WAAW,YAAY,aAAa,WAAW,UAAU,GAI3EC,IAAoB,CAACC,MACvB,OAAOA,KAAU,YAAYF,EAAe,SAASE,CAAK,GAEjDC,IAAc,CAAC,EAAE,QAAAC,QAA+B;AACzD,QAAMC,IAAaJ,EAAkBG,CAAM,IACrC,EAAE,eAAeA,EAAA,IACjB,EAAE,OAAO,EAAE,iBAAiB,OAAOA,KAAW,WAAWA,IAASE,EAAWF,CAAM,KAAK,gBAAc;AAE5G,SAAO,gBAAAG,EAAC,SAAI,gBAAa,gBAAe,WAAWC,EAAO,MAAO,GAAGH,GAAY;AACpF;"}
|