@frontify/fondue 12.0.0-beta.2 → 12.0.0-beta.4
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/components/Button/Button.es.js +44 -43
- package/dist/components/Button/Button.es.js.map +1 -1
- package/dist/components/EditableText/EditableText.d.ts +2 -0
- package/dist/components/EditableText/EditableText.es.js +40 -40
- package/dist/components/EditableText/EditableText.es.js.map +1 -1
- package/dist/components/EditableText/lib/helper.d.ts +1 -0
- package/dist/components/EditableText/lib/helper.es.js +6 -5
- package/dist/components/EditableText/lib/helper.es.js.map +1 -1
- package/dist/components/OrderableList/OrderableList.es.js +34 -32
- package/dist/components/OrderableList/OrderableList.es.js.map +1 -1
- package/dist/components/RichTextEditor/RichTextEditor.es.js +46 -42
- package/dist/components/RichTextEditor/RichTextEditor.es.js.map +1 -1
- package/dist/components/RichTextEditor/helper.d.ts +1 -0
- package/dist/components/RichTextEditor/helper.es.js +8 -0
- package/dist/components/RichTextEditor/helper.es.js.map +1 -0
- package/dist/components/Switch/Switch.es.js +59 -42
- package/dist/components/Switch/Switch.es.js.map +1 -1
- package/dist/components/TextInput/TextInput.es.js +2 -2
- package/dist/components/TextInput/TextInput.es.js.map +1 -1
- package/dist/components/Tooltip/Tooltip.d.ts +3 -1
- package/dist/components/Tooltip/Tooltip.es.js +44 -39
- package/dist/components/Tooltip/Tooltip.es.js.map +1 -1
- package/dist/components/Tree/Node.es.js +37 -36
- package/dist/components/Tree/Node.es.js.map +1 -1
- package/dist/extractedThirdPartyStyles.css +8 -0
- package/dist/index.cjs.js +4 -4
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.umd.js +4 -4
- package/dist/index.umd.js.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +1 -1
- package/tailwind.config.js +73 -72
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import i, { useEffect as
|
|
2
|
-
import { Plate as
|
|
3
|
-
import { useMemoizedId as
|
|
4
|
-
import { debounce as
|
|
5
|
-
import { Toolbar as
|
|
6
|
-
import { RichTextEditorContext as
|
|
7
|
-
import { useEditorState as
|
|
8
|
-
import { useEditorResize as
|
|
1
|
+
import i, { useEffect as _, useCallback as v } from "react";
|
|
2
|
+
import { Plate as x } from "@udecode/plate";
|
|
3
|
+
import { useMemoizedId as I } from "../../hooks/useMemoizedId.es.js";
|
|
4
|
+
import { debounce as V } from "../../utilities/debounce.es.js";
|
|
5
|
+
import { Toolbar as W } from "./components/Toolbar/Toolbar.es.js";
|
|
6
|
+
import { RichTextEditorContext as w } from "./context/RichTextEditorContext.es.js";
|
|
7
|
+
import { useEditorState as z } from "./hooks/useEditorState.es.js";
|
|
8
|
+
import { useEditorResize as D } from "./hooks/useEditorResize.es.js";
|
|
9
9
|
import "../../foundation/Icon/Generated/IconAdobeCreativeCloud.es.js";
|
|
10
10
|
import "../../foundation/Icon/Generated/IconAdobeCreativeCloud12.es.js";
|
|
11
11
|
import "../../foundation/Icon/Generated/IconAdobeCreativeCloud16.es.js";
|
|
@@ -1644,63 +1644,67 @@ import "../../foundation/Icon/Generated/IconWorkflowShapes24.es.js";
|
|
|
1644
1644
|
import "../../foundation/Icon/Generated/IconWorkflowShapes32.es.js";
|
|
1645
1645
|
import "../../foundation/Icon/IconsMap.es.js";
|
|
1646
1646
|
import { TextStyles as u } from "./utils/textStyles.es.js";
|
|
1647
|
-
import { PaddingSizes as
|
|
1648
|
-
import { defaultActions as
|
|
1647
|
+
import { PaddingSizes as G } from "./types.es.js";
|
|
1648
|
+
import { defaultActions as L } from "./utils/actions.es.js";
|
|
1649
1649
|
import "slate";
|
|
1650
|
-
import { ON_SAVE_DELAY_IN_MS as
|
|
1650
|
+
import { ON_SAVE_DELAY_IN_MS as M } from "./utils/constants.es.js";
|
|
1651
1651
|
import { defaultDesignTokens as E } from "./utils/defaultDesignTokens.es.js";
|
|
1652
1652
|
import { parseRawValue as J } from "./utils/parseRawValue.es.js";
|
|
1653
1653
|
import { EditorPositioningWrapper as j } from "./EditorPositioningWrapper/index.es.js";
|
|
1654
1654
|
import { getEditorConfig as F } from "./utils/editorConfig.es.js";
|
|
1655
1655
|
import "./EditorActions/Plugins/index.es.js";
|
|
1656
1656
|
import { GeneratePlugins as H } from "./EditorActions/GeneratePlugins.es.js";
|
|
1657
|
+
import { forceTabOutOfActiveElement as K } from "./helper.es.js";
|
|
1657
1658
|
import { Position as Y } from "./EditorPositioningWrapper/types.es.js";
|
|
1658
|
-
const
|
|
1659
|
+
const Wx = ({
|
|
1659
1660
|
id: P,
|
|
1660
1661
|
value: g,
|
|
1661
|
-
placeholder:
|
|
1662
|
-
readonly:
|
|
1663
|
-
clear:
|
|
1664
|
-
designTokens:
|
|
1665
|
-
actions: n =
|
|
1666
|
-
onTextChange:
|
|
1667
|
-
onBlur:
|
|
1668
|
-
padding: A =
|
|
1669
|
-
position:
|
|
1662
|
+
placeholder: b = "",
|
|
1663
|
+
readonly: N = !1,
|
|
1664
|
+
clear: O = !1,
|
|
1665
|
+
designTokens: t = E,
|
|
1666
|
+
actions: n = L,
|
|
1667
|
+
onTextChange: f,
|
|
1668
|
+
onBlur: a,
|
|
1669
|
+
padding: A = G.None,
|
|
1670
|
+
position: R = Y.FLOATING,
|
|
1670
1671
|
plugins: c
|
|
1671
1672
|
}) => {
|
|
1672
|
-
const r =
|
|
1673
|
-
placeholder:
|
|
1674
|
-
readOnly:
|
|
1675
|
-
onBlur: () =>
|
|
1676
|
-
className: A
|
|
1673
|
+
const r = I(P), { localValue: m } = z(r, O), { editorRef: S, editorWidth: l } = D(), h = {
|
|
1674
|
+
placeholder: b,
|
|
1675
|
+
readOnly: N,
|
|
1676
|
+
onBlur: () => a && a(JSON.stringify(m.current)),
|
|
1677
|
+
className: A,
|
|
1678
|
+
onKeyDown: (o) => {
|
|
1679
|
+
o.code === "Tab" && K();
|
|
1680
|
+
}
|
|
1677
1681
|
};
|
|
1678
|
-
|
|
1679
|
-
for (const
|
|
1680
|
-
o
|
|
1681
|
-
}, [
|
|
1682
|
-
const s =
|
|
1683
|
-
|
|
1684
|
-
},
|
|
1685
|
-
s(
|
|
1686
|
-
}, [s, m]), d = j[
|
|
1687
|
-
return /* @__PURE__ */ i.createElement(
|
|
1688
|
-
value: { designTokens:
|
|
1682
|
+
_(() => {
|
|
1683
|
+
for (const o of Object.values(u).filter((T) => T !== u.ELEMENT_PARAGRAPH))
|
|
1684
|
+
t[o] || (t[o] = E[o]);
|
|
1685
|
+
}, [t]);
|
|
1686
|
+
const s = V((o) => {
|
|
1687
|
+
f && f(JSON.stringify(o));
|
|
1688
|
+
}, M), y = v((o) => {
|
|
1689
|
+
s(o), m.current = o;
|
|
1690
|
+
}, [s, m]), d = j[R], p = H(r, c), e = p && n.length === 0 && c, C = e ? p.create() : F();
|
|
1691
|
+
return /* @__PURE__ */ i.createElement(w.Provider, {
|
|
1692
|
+
value: { designTokens: t, PositioningWrapper: d }
|
|
1689
1693
|
}, /* @__PURE__ */ i.createElement(d.PlateWrapper, {
|
|
1690
1694
|
ref: S
|
|
1691
|
-
}, /* @__PURE__ */ i.createElement(
|
|
1695
|
+
}, /* @__PURE__ */ i.createElement(x, {
|
|
1692
1696
|
id: r,
|
|
1693
1697
|
initialValue: J(g),
|
|
1694
|
-
onChange:
|
|
1698
|
+
onChange: y,
|
|
1695
1699
|
editableProps: h,
|
|
1696
|
-
plugins:
|
|
1697
|
-
}, e && p.toolbar(l), !e && /* @__PURE__ */ i.createElement(
|
|
1700
|
+
plugins: C
|
|
1701
|
+
}, e && p.toolbar(l), !e && /* @__PURE__ */ i.createElement(W, {
|
|
1698
1702
|
editorId: r,
|
|
1699
1703
|
actions: n,
|
|
1700
1704
|
editorWidth: l
|
|
1701
1705
|
}))));
|
|
1702
1706
|
};
|
|
1703
1707
|
export {
|
|
1704
|
-
|
|
1708
|
+
Wx as RichTextEditor
|
|
1705
1709
|
};
|
|
1706
1710
|
//# sourceMappingURL=RichTextEditor.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RichTextEditor.es.js","sources":["../../../src/components/RichTextEditor/RichTextEditor.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport React, { FC, useCallback, useEffect } from 'react';\nimport { Plate, TNode } from '@udecode/plate';\nimport { useMemoizedId } from '@hooks/useMemoizedId';\nimport { debounce } from '@utilities/debounce';\nimport { EditableProps } from 'slate-react/dist/components/editable';\nimport { Toolbar } from './components/Toolbar/Toolbar';\nimport { RichTextEditorContext } from './context/RichTextEditorContext';\nimport { useEditorResize, useEditorState } from './hooks';\nimport { DesignTokens, PaddingSizes } from './types';\nimport { EditorActions, defaultActions } from './utils/actions';\nimport { ON_SAVE_DELAY_IN_MS } from './utils';\nimport { defaultDesignTokens } from './utils/defaultDesignTokens';\nimport { parseRawValue } from './utils/parseRawValue';\nimport { TextStyles } from './utils/textStyles';\nimport { EditorPositioningWrapper } from './EditorPositioningWrapper';\nimport { Position } from './EditorPositioningWrapper';\nimport { getEditorConfig } from './utils/editorConfig';\nimport { GeneratePlugins, PluginComposer } from './EditorActions';\n\nexport type RichTextEditorProps = {\n id?: string;\n placeholder?: string;\n value?: string;\n onTextChange?: (value: string) => void;\n onBlur?: (value: string) => void;\n readonly?: boolean;\n clear?: boolean;\n designTokens?: DesignTokens;\n actions?: EditorActions[][];\n padding?: PaddingSizes;\n position?: Position;\n plugins?: PluginComposer;\n};\n\nexport const RichTextEditor: FC<RichTextEditorProps> = ({\n id,\n value: initialValue,\n placeholder = '',\n readonly = false,\n clear = false,\n designTokens = defaultDesignTokens,\n actions = defaultActions,\n onTextChange,\n onBlur,\n padding = PaddingSizes.None,\n position = Position.FLOATING,\n plugins,\n}) => {\n const editorId = useMemoizedId(id);\n const { localValue } = useEditorState(editorId, clear);\n const { editorRef, editorWidth } = useEditorResize();\n\n const editableProps: EditableProps = {\n placeholder,\n readOnly: readonly,\n onBlur: () => onBlur && onBlur(JSON.stringify(localValue.current)),\n className: padding,\n };\n\n useEffect(() => {\n for (const element of Object.values(TextStyles).filter(\n (textStyle) => textStyle !== TextStyles.ELEMENT_PARAGRAPH,\n )) {\n if (!designTokens[element]) {\n designTokens[element] = defaultDesignTokens[element];\n }\n }\n }, [designTokens]);\n\n const debouncedOnChange = debounce((value: TNode[]) => {\n onTextChange && onTextChange(JSON.stringify(value));\n }, ON_SAVE_DELAY_IN_MS);\n\n const onChange = useCallback(\n (value) => {\n debouncedOnChange(value);\n localValue.current = value;\n },\n [debouncedOnChange, localValue],\n );\n\n const PositioningWrapper = EditorPositioningWrapper[position];\n\n const config = GeneratePlugins(editorId, plugins);\n const isNew = config && actions.length === 0 && plugins;\n const editorConfig = isNew ? config.create() : getEditorConfig();\n\n return (\n <RichTextEditorContext.Provider value={{ designTokens, PositioningWrapper }}>\n <PositioningWrapper.PlateWrapper ref={editorRef}>\n <Plate\n id={editorId}\n initialValue={parseRawValue(initialValue)}\n onChange={onChange}\n editableProps={editableProps}\n plugins={editorConfig}\n >\n {isNew && config.toolbar(editorWidth)}\n {!isNew && <Toolbar editorId={editorId} actions={actions} editorWidth={editorWidth} />}\n </Plate>\n </PositioningWrapper.PlateWrapper>\n </RichTextEditorContext.Provider>\n );\n};\n"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"RichTextEditor.es.js","sources":["../../../src/components/RichTextEditor/RichTextEditor.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport React, { FC, useCallback, useEffect } from 'react';\nimport { Plate, TNode } from '@udecode/plate';\nimport { useMemoizedId } from '@hooks/useMemoizedId';\nimport { debounce } from '@utilities/debounce';\nimport { EditableProps } from 'slate-react/dist/components/editable';\nimport { Toolbar } from './components/Toolbar/Toolbar';\nimport { RichTextEditorContext } from './context/RichTextEditorContext';\nimport { useEditorResize, useEditorState } from './hooks';\nimport { DesignTokens, PaddingSizes } from './types';\nimport { EditorActions, defaultActions } from './utils/actions';\nimport { ON_SAVE_DELAY_IN_MS } from './utils';\nimport { defaultDesignTokens } from './utils/defaultDesignTokens';\nimport { parseRawValue } from './utils/parseRawValue';\nimport { TextStyles } from './utils/textStyles';\nimport { EditorPositioningWrapper } from './EditorPositioningWrapper';\nimport { Position } from './EditorPositioningWrapper';\nimport { getEditorConfig } from './utils/editorConfig';\nimport { GeneratePlugins, PluginComposer } from './EditorActions';\nimport { forceTabOutOfActiveElement } from './helper';\n\nexport type RichTextEditorProps = {\n id?: string;\n placeholder?: string;\n value?: string;\n onTextChange?: (value: string) => void;\n onBlur?: (value: string) => void;\n readonly?: boolean;\n clear?: boolean;\n designTokens?: DesignTokens;\n actions?: EditorActions[][];\n padding?: PaddingSizes;\n position?: Position;\n plugins?: PluginComposer;\n};\n\nexport const RichTextEditor: FC<RichTextEditorProps> = ({\n id,\n value: initialValue,\n placeholder = '',\n readonly = false,\n clear = false,\n designTokens = defaultDesignTokens,\n actions = defaultActions,\n onTextChange,\n onBlur,\n padding = PaddingSizes.None,\n position = Position.FLOATING,\n plugins,\n}) => {\n const editorId = useMemoizedId(id);\n const { localValue } = useEditorState(editorId, clear);\n const { editorRef, editorWidth } = useEditorResize();\n\n const editableProps: EditableProps = {\n placeholder,\n readOnly: readonly,\n onBlur: () => onBlur && onBlur(JSON.stringify(localValue.current)),\n className: padding,\n onKeyDown: (event) => {\n if (event.code === 'Tab') {\n // Forcing a blur event because of accessibility\n forceTabOutOfActiveElement();\n }\n },\n };\n\n useEffect(() => {\n for (const element of Object.values(TextStyles).filter(\n (textStyle) => textStyle !== TextStyles.ELEMENT_PARAGRAPH,\n )) {\n if (!designTokens[element]) {\n designTokens[element] = defaultDesignTokens[element];\n }\n }\n }, [designTokens]);\n\n const debouncedOnChange = debounce((value: TNode[]) => {\n onTextChange && onTextChange(JSON.stringify(value));\n }, ON_SAVE_DELAY_IN_MS);\n\n const onChange = useCallback(\n (value) => {\n debouncedOnChange(value);\n localValue.current = value;\n },\n [debouncedOnChange, localValue],\n );\n\n const PositioningWrapper = EditorPositioningWrapper[position];\n\n const config = GeneratePlugins(editorId, plugins);\n const isNew = config && actions.length === 0 && plugins;\n const editorConfig = isNew ? config.create() : getEditorConfig();\n\n return (\n <RichTextEditorContext.Provider value={{ designTokens, PositioningWrapper }}>\n <PositioningWrapper.PlateWrapper ref={editorRef}>\n <Plate\n id={editorId}\n initialValue={parseRawValue(initialValue)}\n onChange={onChange}\n editableProps={editableProps}\n plugins={editorConfig}\n >\n {isNew && config.toolbar(editorWidth)}\n {!isNew && <Toolbar editorId={editorId} actions={actions} editorWidth={editorWidth} />}\n </Plate>\n </PositioningWrapper.PlateWrapper>\n </RichTextEditorContext.Provider>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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,IACA;AAAA,IACA,SAAS;AAAA,EAAA,GAER,KAAS,EAAO,QAAQ,CAAW,GACnC,CAAC,KAAU,kBAAA,cAAA,GAAA;AAAA,IAAQ;AAAA,IAAoB;AAAA,IAAkB;AAAA,EAAA,CAA0B,CACxF,CACJ,CACJ;AAER;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const forceTabOutOfActiveElement: () => void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helper.es.js","sources":["../../../src/components/RichTextEditor/helper.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nexport const forceTabOutOfActiveElement = () => {\n (document.activeElement as HTMLElement)?.blur();\n};\n"],"names":[],"mappings":"AAEO,MAAM,IAA6B,MAAM;AAAzC;AACF,gBAAS,kBAAT,UAAwC;AAC7C;"}
|
|
@@ -1,57 +1,74 @@
|
|
|
1
|
-
import r, { useMemo as
|
|
1
|
+
import r, { useMemo as i } from "react";
|
|
2
2
|
import { merge as n } from "../../utilities/merge.es.js";
|
|
3
|
-
import { useFocusRing as
|
|
4
|
-
import { FOCUS_STYLE as
|
|
5
|
-
import { useMemoizedId as
|
|
6
|
-
import { InputLabel as
|
|
7
|
-
var
|
|
8
|
-
const
|
|
9
|
-
Small: "tw-w-
|
|
10
|
-
Medium: "tw-w-
|
|
11
|
-
Large: "tw-w-
|
|
12
|
-
},
|
|
13
|
-
Small:
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
3
|
+
import { useFocusRing as M } from "@react-aria/focus";
|
|
4
|
+
import { FOCUS_STYLE as S } from "../../utilities/focusStyle.es.js";
|
|
5
|
+
import { useMemoizedId as E } from "../../hooks/useMemoizedId.es.js";
|
|
6
|
+
import { InputLabel as L } from "../InputLabel/InputLabel.es.js";
|
|
7
|
+
var T = /* @__PURE__ */ ((s) => (s.Small = "Small", s.Medium = "Medium", s.Large = "Large", s))(T || {});
|
|
8
|
+
const W = {
|
|
9
|
+
Small: "tw-w-[22px] tw-h-3",
|
|
10
|
+
Medium: "tw-w-[30px] tw-h-4",
|
|
11
|
+
Large: "tw-w-[38px] tw-h-5"
|
|
12
|
+
}, w = {
|
|
13
|
+
Small: {
|
|
14
|
+
dimensions: "tw-w-3 tw-h-3",
|
|
15
|
+
activeWidth: "group-active:tw-w-[14px]",
|
|
16
|
+
activeTranslation: "tw-translate-x-[9px]"
|
|
17
|
+
},
|
|
18
|
+
Medium: {
|
|
19
|
+
dimensions: "tw-w-4 tw-h-4",
|
|
20
|
+
activeWidth: "group-active:tw-w-[18px]",
|
|
21
|
+
activeTranslation: "tw-translate-x-[13px]"
|
|
22
|
+
},
|
|
23
|
+
Large: {
|
|
24
|
+
dimensions: "tw-w-5 tw-h-5",
|
|
25
|
+
activeWidth: "group-active:tw-w-[22px]",
|
|
26
|
+
activeTranslation: "tw-translate-x-[17px]"
|
|
27
|
+
}
|
|
28
|
+
}, O = ({
|
|
29
|
+
id: s,
|
|
30
|
+
name: p,
|
|
31
|
+
label: c,
|
|
32
|
+
disabled: a,
|
|
33
|
+
onChange: x,
|
|
22
34
|
size: t = "Medium",
|
|
23
|
-
on:
|
|
24
|
-
hug:
|
|
25
|
-
tooltip:
|
|
35
|
+
on: e = !1,
|
|
36
|
+
hug: m = !1,
|
|
37
|
+
tooltip: v
|
|
26
38
|
}) => {
|
|
27
|
-
const
|
|
28
|
-
const
|
|
29
|
-
return n([
|
|
30
|
-
}, [
|
|
39
|
+
const d = E(s), { isFocusVisible: u, focusProps: g } = M(), f = i(() => n(["tw-group tw-border tw-inline-flex tw-rounded-full tw-shrink-0 tw-p-0 tw-transition-colors", a ? "tw-bg-box-disabled tw-border-line tw-pointer-events-none" : e ? "tw-bg-text-weak tw-border-line-xx-strong hover:tw-bg-text" : "tw-bg-box-neutral tw-border-line-x-strong hover:tw-bg-box-neutral-hover", W[t], u && S]), [e, a, t, u]), C = i(() => {
|
|
40
|
+
const o = "tw-relative tw-self-center tw-transition-transform", l = e && w[t].activeTranslation;
|
|
41
|
+
return n([o, w[t].dimensions, l]);
|
|
42
|
+
}, [e, t]), h = i(() => {
|
|
43
|
+
const o = "tw-border tw-bg-base tw-rounded-full tw-absolute tw-block tw-self-center tw-transition-width tw-duration-75", l = e ? "tw-right-0" : "tw-left-0 -tw-translate-x-px", b = a ? "tw-border-line-strong" : n(["tw-bg-base tw-border-line-xx-strong", w[t].activeWidth]);
|
|
44
|
+
return n([o, w[t].dimensions, l, b]);
|
|
45
|
+
}, [e, a, t]), k = i(() => n(["tw-gap-2 tw-items-center tw-justify-between", m ? "tw-inline-flex" : "tw-flex"]), [m]);
|
|
31
46
|
return /* @__PURE__ */ r.createElement("div", {
|
|
32
|
-
className:
|
|
47
|
+
className: k,
|
|
33
48
|
"data-test-id": "switch-container"
|
|
34
|
-
},
|
|
49
|
+
}, c && /* @__PURE__ */ r.createElement(L, {
|
|
35
50
|
clickable: !0,
|
|
36
|
-
htmlFor:
|
|
37
|
-
disabled:
|
|
38
|
-
tooltip:
|
|
39
|
-
},
|
|
51
|
+
htmlFor: d,
|
|
52
|
+
disabled: a,
|
|
53
|
+
tooltip: v
|
|
54
|
+
}, c), /* @__PURE__ */ r.createElement("button", {
|
|
40
55
|
...g,
|
|
41
|
-
id:
|
|
42
|
-
disabled:
|
|
43
|
-
name:
|
|
56
|
+
id: d,
|
|
57
|
+
disabled: a,
|
|
58
|
+
name: p,
|
|
44
59
|
"data-test-id": "switch",
|
|
45
60
|
className: f,
|
|
46
|
-
value:
|
|
47
|
-
onClick:
|
|
61
|
+
value: e.toString(),
|
|
62
|
+
onClick: x,
|
|
48
63
|
type: "button"
|
|
49
64
|
}, /* @__PURE__ */ r.createElement("div", {
|
|
50
|
-
className:
|
|
51
|
-
}
|
|
65
|
+
className: C
|
|
66
|
+
}, /* @__PURE__ */ r.createElement("div", {
|
|
67
|
+
className: h
|
|
68
|
+
}))));
|
|
52
69
|
};
|
|
53
70
|
export {
|
|
54
|
-
|
|
55
|
-
|
|
71
|
+
O as Switch,
|
|
72
|
+
T as SwitchSize
|
|
56
73
|
};
|
|
57
74
|
//# sourceMappingURL=Switch.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Switch.es.js","sources":["../../../src/components/Switch/Switch.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport React, { FC, MouseEvent, useMemo } from 'react';\nimport { merge } from '@utilities/merge';\nimport { useFocusRing } from '@react-aria/focus';\nimport { FOCUS_STYLE } from '@utilities/focusStyle';\nimport { useMemoizedId } from '@hooks/useMemoizedId';\nimport { InputLabel, InputLabelTooltipProps } from '@components/InputLabel/InputLabel';\n\nexport enum SwitchSize {\n Small = 'Small',\n Medium = 'Medium',\n Large = 'Large',\n}\n\nconst
|
|
1
|
+
{"version":3,"file":"Switch.es.js","sources":["../../../src/components/Switch/Switch.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport React, { FC, MouseEvent, useMemo } from 'react';\nimport { merge } from '@utilities/merge';\nimport { useFocusRing } from '@react-aria/focus';\nimport { FOCUS_STYLE } from '@utilities/focusStyle';\nimport { useMemoizedId } from '@hooks/useMemoizedId';\nimport { InputLabel, InputLabelTooltipProps } from '@components/InputLabel/InputLabel';\n\nexport enum SwitchSize {\n Small = 'Small',\n Medium = 'Medium',\n Large = 'Large',\n}\n\nconst trackSizeClasses: Record<SwitchSize, string> = {\n [SwitchSize.Small]: 'tw-w-[22px] tw-h-3',\n [SwitchSize.Medium]: 'tw-w-[30px] tw-h-4',\n [SwitchSize.Large]: 'tw-w-[38px] tw-h-5',\n};\n\nconst dotSizeClasses: Record<SwitchSize, Record<'dimensions' | 'activeWidth' | 'activeTranslation', string>> = {\n [SwitchSize.Small]: {\n dimensions: 'tw-w-3 tw-h-3',\n activeWidth: 'group-active:tw-w-[14px]',\n activeTranslation: 'tw-translate-x-[9px]',\n },\n [SwitchSize.Medium]: {\n dimensions: 'tw-w-4 tw-h-4',\n activeWidth: 'group-active:tw-w-[18px]',\n activeTranslation: 'tw-translate-x-[13px]',\n },\n [SwitchSize.Large]: {\n dimensions: 'tw-w-5 tw-h-5',\n activeWidth: 'group-active:tw-w-[22px]',\n activeTranslation: 'tw-translate-x-[17px]',\n },\n};\n\nexport type SwitchProps = {\n id?: string;\n on?: boolean;\n disabled?: boolean;\n label?: string;\n name?: string;\n size?: SwitchSize;\n hug?: boolean;\n tooltip?: InputLabelTooltipProps;\n onChange?: (e: MouseEvent) => void;\n};\n\nexport const Switch: FC<SwitchProps> = ({\n id: propId,\n name,\n label,\n disabled,\n onChange,\n size = SwitchSize.Medium,\n on = false,\n hug = false,\n tooltip,\n}) => {\n const id = useMemoizedId(propId);\n const { isFocusVisible, focusProps } = useFocusRing();\n\n // The track on which the dot moves\n const trackClasses = useMemo(() => {\n const baseClasses = 'tw-group tw-border tw-inline-flex tw-rounded-full tw-shrink-0 tw-p-0 tw-transition-colors';\n\n const valueClasses = on\n ? 'tw-bg-text-weak tw-border-line-xx-strong hover:tw-bg-text'\n : 'tw-bg-box-neutral tw-border-line-x-strong hover:tw-bg-box-neutral-hover';\n\n const disabledClasses = disabled ? 'tw-bg-box-disabled tw-border-line tw-pointer-events-none' : valueClasses;\n\n return merge([baseClasses, disabledClasses, trackSizeClasses[size], isFocusVisible && FOCUS_STYLE]);\n }, [on, disabled, size, isFocusVisible]);\n\n // Responsible for the left-right translation\n const dotWrapperClasses = useMemo(() => {\n const baseClasses = 'tw-relative tw-self-center tw-transition-transform';\n\n const valueClasses = on && dotSizeClasses[size].activeTranslation;\n\n return merge([baseClasses, dotSizeClasses[size].dimensions, valueClasses]);\n }, [on, size]);\n\n // Responsible for dot styling and width animation on hover\n const dotClasses = useMemo(() => {\n const baseClasses =\n 'tw-border tw-bg-base tw-rounded-full tw-absolute tw-block tw-self-center tw-transition-width tw-duration-75';\n\n const valueClasses = on ? 'tw-right-0' : 'tw-left-0 -tw-translate-x-px';\n\n const disabledStateClasses = disabled\n ? 'tw-border-line-strong'\n : merge(['tw-bg-base tw-border-line-xx-strong', dotSizeClasses[size].activeWidth]);\n\n return merge([baseClasses, dotSizeClasses[size].dimensions, valueClasses, disabledStateClasses]);\n }, [on, disabled, size]);\n\n // Wraps the InputLabel instance and switch element\n const containerClasses = useMemo(() => {\n return merge(['tw-gap-2 tw-items-center tw-justify-between', hug ? 'tw-inline-flex' : 'tw-flex']);\n }, [hug]);\n\n return (\n <div className={containerClasses} data-test-id=\"switch-container\">\n {label && (\n <InputLabel clickable={true} htmlFor={id} disabled={disabled} tooltip={tooltip}>\n {label}\n </InputLabel>\n )}\n <button\n {...focusProps}\n id={id}\n disabled={disabled}\n name={name}\n data-test-id=\"switch\"\n className={trackClasses}\n value={on.toString()}\n onClick={onChange}\n type=\"button\"\n >\n <div className={dotWrapperClasses}>\n <div className={dotClasses} />\n </div>\n </button>\n </div>\n );\n};\n"],"names":[],"mappings":";;;;;;AASY,IAAA,sBAAA,MACA,GAAA,QAAA,SACC,EAAA,SAAA,UACD,EAAA,QAAA,SAHA,IAAA,KAAA,CAAA,CAAA;AAMZ,MAAM,IAA+C;AAAA,EACjD,AAAC,OAAmB;AAAA,EACpB,AAAC,QAAoB;AAAA,EACrB,AAAC,OAAmB;AACxB,GAEM,IAAyG;AAAA,EAC3G,AAAC,OAAmB;AAAA,IAChB,YAAY;AAAA,IACZ,aAAa;AAAA,IACb,mBAAmB;AAAA,EACvB;AAAA,EACA,AAAC,QAAoB;AAAA,IACjB,YAAY;AAAA,IACZ,aAAa;AAAA,IACb,mBAAmB;AAAA,EACvB;AAAA,EACA,AAAC,OAAmB;AAAA,IAChB,YAAY;AAAA,IACZ,aAAa;AAAA,IACb,mBAAmB;AAAA,EACvB;AACJ,GAca,IAA0B,CAAC;AAAA,EACpC,IAAI;AAAA,EACJ;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,UAAO;AAAA,EACP,QAAK;AA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BAAA,cAAA,OAAA;AAAA,IAAI,WAAW;AAAA,EAAA,CAAY,CAChC,CACJ,CACJ;AAER;"}
|
|
@@ -1682,10 +1682,10 @@ const LV = ({
|
|
|
1682
1682
|
return /* @__PURE__ */ t.createElement("div", {
|
|
1683
1683
|
...O,
|
|
1684
1684
|
className: i([
|
|
1685
|
-
"tw-flex tw-items-center tw-h-9 tw-gap-2 tw-px-3 tw-border
|
|
1685
|
+
"tw-flex tw-items-center tw-h-9 tw-gap-2 tw-px-3 tw-border tw-transition tw-rounded tw-text-s tw-font-sans tw-relative tw-bg-white dark:tw-bg-transparent",
|
|
1686
1686
|
V ? "tw-border-dashed" : "tw-border-solid",
|
|
1687
1687
|
o || u ? "tw-border-black-5 tw-bg-black-5 dark:tw-bg-black-90 dark:tw-border-black-90" : i([
|
|
1688
|
-
"focus-within:tw-border-black-90",
|
|
1688
|
+
"focus-within:tw-border-black-90 hover:tw-border-black-90",
|
|
1689
1689
|
J[d],
|
|
1690
1690
|
L && n
|
|
1691
1691
|
])
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextInput.es.js","sources":["../../../src/components/TextInput/TextInput.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { LoadingCircle, LoadingCircleSize } from '@components/LoadingCircle';\nimport { useCopy } from '@hooks/useCopy';\nimport { useMemoizedId } from '@hooks/useMemoizedId';\nimport { useFocusRing } from '@react-aria/focus';\nimport { FOCUS_STYLE } from '@utilities/focusStyle';\nimport { merge } from '@utilities/merge';\nimport { Validation, validationClassMap } from '@utilities/validation';\nimport React, { FC, FocusEvent, KeyboardEvent, ReactNode, useEffect, useRef, useState } from 'react';\nimport { IconCheckMark, IconClipboard, IconCross, IconCrossCircle, IconEye, IconEyeOff } from '@foundation/Icon';\n\nexport enum TextInputType {\n Text = 'text',\n Password = 'password',\n Number = 'number',\n}\n\nexport type TextInputBaseProps = {\n id?: string;\n type?: TextInputType;\n decorator?: ReactNode;\n dotted?: boolean;\n clearable?: boolean;\n placeholder?: string;\n required?: boolean;\n disabled?: boolean;\n autocomplete?: boolean;\n readonly?: boolean;\n validation?: Validation;\n copyable?: boolean;\n value?: string;\n onChange?: (value: string) => void;\n onEnterPressed?: (event: KeyboardEvent<HTMLInputElement>) => void;\n onBlur?: (event: FocusEvent<HTMLInputElement>) => void;\n onClear?: () => void;\n size?: number;\n spellcheck?: boolean;\n focusOnMount?: boolean;\n};\n\nexport type TextInputProps =\n | ({\n type?: TextInputType.Text;\n obfuscated?: false;\n } & TextInputBaseProps)\n | ({\n type?: TextInputType.Number;\n obfuscated?: false;\n min?: number;\n max?: number;\n } & TextInputBaseProps)\n | ({\n type: TextInputType.Password;\n obfuscated?: boolean;\n } & TextInputBaseProps);\n\nexport const TextInput: FC<TextInputProps> = ({\n id: propId,\n type = TextInputType.Text,\n decorator,\n validation = Validation.Default,\n clearable = false,\n placeholder,\n required,\n obfuscated,\n disabled = false,\n autocomplete = false,\n dotted = false,\n value = '',\n copyable = false,\n onChange,\n onEnterPressed,\n onBlur,\n onClear,\n size,\n spellcheck,\n readonly,\n focusOnMount,\n}) => {\n const { isFocusVisible, focusProps } = useFocusRing({ within: true, isTextInput: true });\n const { isFocusVisible: clearButtonIsFocusVisible, focusProps: clearButtonFocusProps } = useFocusRing();\n const { isFocusVisible: passwordButtonIsFocusVisible, focusProps: passwordButtonFocusProps } = useFocusRing();\n const { isFocusVisible: copyButtonIsFocusVisible, focusProps: copyButtonFocusProps } = useFocusRing();\n\n const { copy, status } = useCopy();\n\n const inputElement = useRef<HTMLInputElement | null>(null);\n const [isObfuscated, setIsObfuscated] = useState(\n typeof obfuscated === 'boolean' ? obfuscated : type === TextInputType.Password,\n );\n\n useEffect(() => {\n setTimeout(() => {\n focusOnMount && inputElement.current?.focus();\n }, 0);\n }, [focusOnMount]);\n\n useEffect(() => {\n if (typeof obfuscated === 'boolean') {\n setIsObfuscated(obfuscated);\n }\n }, [obfuscated]);\n\n const onKeyDown = (event: KeyboardEvent<HTMLInputElement>) => {\n if (event.key === 'Enter') {\n onEnterPressed && onEnterPressed(event);\n }\n };\n\n const getInputType = () => {\n if (type === TextInputType.Password) {\n return isObfuscated ? TextInputType.Password : TextInputType.Text;\n }\n return type;\n };\n\n const spellcheckProp = typeof spellcheck === 'boolean' ? { spellCheck: spellcheck } : null;\n\n return (\n <div\n {...focusProps}\n className={merge([\n 'tw-flex tw-items-center tw-h-9 tw-gap-2 tw-px-3 tw-border hover:tw-border-black-90 tw-transition tw-rounded tw-text-s tw-font-sans tw-relative tw-bg-white dark:tw-bg-transparent',\n dotted ? 'tw-border-dashed' : 'tw-border-solid',\n disabled || readonly\n ? 'tw-border-black-5 tw-bg-black-5 dark:tw-bg-black-90 dark:tw-border-black-90'\n : merge([\n 'focus-within:tw-border-black-90',\n validationClassMap[validation],\n isFocusVisible && FOCUS_STYLE,\n ]),\n ])}\n >\n {decorator && (\n <div\n className={merge([\n 'tw-flex tw-items-center tw-justify-center tw-pl-1',\n disabled ? 'tw-text-black-60' : 'tw-text-black-80',\n ])}\n data-test-id=\"decorator\"\n >\n {decorator}\n </div>\n )}\n <input\n id={useMemoizedId(propId)}\n ref={inputElement}\n className={merge([\n 'tw-w-full tw-grow tw-border-none tw-outline-none tw-bg-transparent tw-hide-input-arrows',\n disabled || readonly\n ? 'tw-text-black-40 tw-placeholder-black-30 dark:tw-text-black-30 dark:tw-placeholder-black-40'\n : 'tw-text-black tw-placeholder-black-60 dark:tw-text-white',\n ])}\n onClick={() => inputElement.current?.focus()}\n onChange={(event) => onChange && onChange(event.currentTarget.value)}\n onBlur={onBlur}\n onKeyDown={onKeyDown}\n placeholder={placeholder}\n value={value}\n type={getInputType()}\n required={required}\n readOnly={readonly}\n disabled={disabled}\n autoComplete={autocomplete ? 'on' : 'off'}\n size={size}\n data-test-id=\"text-input\"\n {...spellcheckProp}\n />\n {`${value}`.length > 0 && clearable && (\n <button\n className={merge([\n 'tw-flex tw-items-center tw-justify-center tw-transition-colors tw-rounded',\n disabled ? 'tw-cursor-default tw-text-black-40' : 'tw-text-black-60 hover:tw-text-black-100',\n clearButtonIsFocusVisible && FOCUS_STYLE,\n ])}\n onClick={() => {\n inputElement.current?.focus();\n inputElement.current?.setAttribute('value', '');\n\n onChange && onChange('');\n onClear && onClear();\n }}\n data-test-id=\"clear-icon\"\n title=\"Clear text input\"\n aria-label=\"clear text input\"\n disabled={disabled}\n type=\"button\"\n {...clearButtonFocusProps}\n >\n <IconCross />\n </button>\n )}\n {type === TextInputType.Password && (\n <button\n className={merge([\n 'tw-flex tw-items-center tw-justify-center tw-transition-colors tw-rounded',\n disabled ? 'tw-cursor-default tw-text-black-40' : 'tw-text-black-60 hover:tw-text-black-100',\n passwordButtonIsFocusVisible && FOCUS_STYLE,\n ])}\n onClick={() => setIsObfuscated(!isObfuscated)}\n data-test-id=\"visibility-icon\"\n title=\"Toggle text visibility\"\n type=\"button\"\n aria-label={`${isObfuscated ? 'unveil' : 'obfuscate'} text input`}\n disabled={disabled}\n {...passwordButtonFocusProps}\n >\n {isObfuscated ? <IconEye /> : <IconEyeOff />}\n </button>\n )}\n {validation === Validation.Loading && (\n <span className=\"tw-absolute tw-top-[-0.55rem] tw-right-[-0.55rem] tw-bg-white tw-rounded-full tw-p-[2px] tw-border tw-border-black-10\">\n <LoadingCircle size={LoadingCircleSize.ExtraSmall} />\n </span>\n )}\n {copyable && (\n <button\n className={merge([\n 'tw-flex tw-items-center tw-justify-center tw-transition-colors tw-rounded',\n disabled ? 'tw-cursor-default tw-text-black-40' : 'tw-text-black-60 hover:tw-text-black-100',\n copyButtonIsFocusVisible && FOCUS_STYLE,\n ])}\n onClick={() => copy(value)}\n data-test-id=\"copy-icon\"\n title=\"Copy input text\"\n disabled={disabled}\n type=\"button\"\n {...copyButtonFocusProps}\n >\n {status === 'error' && (\n <span className=\"tw-text-box-negative-strong\">\n <IconCrossCircle />\n </span>\n )}\n {status === 'idle' && <IconClipboard />}\n {status === 'success' && (\n <span className=\"tw-text-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AA;AAAA,IAAK,WAAU;AAAA,EAAA,GACX,kBAAA,cAAA,GAAA;AAAA,IAAc,MAAM,EAAkB;AAAA,EAAY,CAAA,CACvD,GAEH,KACI,kBAAA,cAAA,UAAA;AAAA,IACG,WAAW,EAAM;AAAA,MACb;AAAA,MACA,IAAW,uCAAuC;AAAA,MAClD,KAA4B;AAAA,IAAA,CAC/B;AAAA,IACD,SAAS,MAAM,EAAK,CAAK;AAAA,IACzB,gBAAa;AAAA,IACb,OAAM;AAAA,IACN;AAAA,IACA,MAAK;AAAA,IACJ,GAAG;AAAA,EAEH,GAAA,MAAW,WACP,kBAAA,cAAA,QAAA;AAAA,IAAK,WAAU;AAAA,EAAA,GACZ,kBAAA,cAAC,IAAgB,IAAA,CACrB,GAEH,MAAW,UAAU,kBAAA,cAAC,GAAc,IAAA,GACpC,MAAW,aACP,kBAAA,cAAA,QAAA;AAAA,IAAK,WAAU;AAAA,EAAA,GACX,kBAAA,cAAA,GAAA,IAAc,CACnB,CAER,CAER;AAER;"}
|
|
1
|
+
{"version":3,"file":"TextInput.es.js","sources":["../../../src/components/TextInput/TextInput.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { LoadingCircle, LoadingCircleSize } from '@components/LoadingCircle';\nimport { useCopy } from '@hooks/useCopy';\nimport { useMemoizedId } from '@hooks/useMemoizedId';\nimport { useFocusRing } from '@react-aria/focus';\nimport { FOCUS_STYLE } from '@utilities/focusStyle';\nimport { merge } from '@utilities/merge';\nimport { Validation, validationClassMap } from '@utilities/validation';\nimport React, { FC, FocusEvent, KeyboardEvent, ReactNode, useEffect, useRef, useState } from 'react';\nimport { IconCheckMark, IconClipboard, IconCross, IconCrossCircle, IconEye, IconEyeOff } from '@foundation/Icon';\n\nexport enum TextInputType {\n Text = 'text',\n Password = 'password',\n Number = 'number',\n}\n\nexport type TextInputBaseProps = {\n id?: string;\n type?: TextInputType;\n decorator?: ReactNode;\n dotted?: boolean;\n clearable?: boolean;\n placeholder?: string;\n required?: boolean;\n disabled?: boolean;\n autocomplete?: boolean;\n readonly?: boolean;\n validation?: Validation;\n copyable?: boolean;\n value?: string;\n onChange?: (value: string) => void;\n onEnterPressed?: (event: KeyboardEvent<HTMLInputElement>) => void;\n onBlur?: (event: FocusEvent<HTMLInputElement>) => void;\n onClear?: () => void;\n size?: number;\n spellcheck?: boolean;\n focusOnMount?: boolean;\n};\n\nexport type TextInputProps =\n | ({\n type?: TextInputType.Text;\n obfuscated?: false;\n } & TextInputBaseProps)\n | ({\n type?: TextInputType.Number;\n obfuscated?: false;\n min?: number;\n max?: number;\n } & TextInputBaseProps)\n | ({\n type: TextInputType.Password;\n obfuscated?: boolean;\n } & TextInputBaseProps);\n\nexport const TextInput: FC<TextInputProps> = ({\n id: propId,\n type = TextInputType.Text,\n decorator,\n validation = Validation.Default,\n clearable = false,\n placeholder,\n required,\n obfuscated,\n disabled = false,\n autocomplete = false,\n dotted = false,\n value = '',\n copyable = false,\n onChange,\n onEnterPressed,\n onBlur,\n onClear,\n size,\n spellcheck,\n readonly,\n focusOnMount,\n}) => {\n const { isFocusVisible, focusProps } = useFocusRing({ within: true, isTextInput: true });\n const { isFocusVisible: clearButtonIsFocusVisible, focusProps: clearButtonFocusProps } = useFocusRing();\n const { isFocusVisible: passwordButtonIsFocusVisible, focusProps: passwordButtonFocusProps } = useFocusRing();\n const { isFocusVisible: copyButtonIsFocusVisible, focusProps: copyButtonFocusProps } = useFocusRing();\n\n const { copy, status } = useCopy();\n\n const inputElement = useRef<HTMLInputElement | null>(null);\n const [isObfuscated, setIsObfuscated] = useState(\n typeof obfuscated === 'boolean' ? obfuscated : type === TextInputType.Password,\n );\n\n useEffect(() => {\n setTimeout(() => {\n focusOnMount && inputElement.current?.focus();\n }, 0);\n }, [focusOnMount]);\n\n useEffect(() => {\n if (typeof obfuscated === 'boolean') {\n setIsObfuscated(obfuscated);\n }\n }, [obfuscated]);\n\n const onKeyDown = (event: KeyboardEvent<HTMLInputElement>) => {\n if (event.key === 'Enter') {\n onEnterPressed && onEnterPressed(event);\n }\n };\n\n const getInputType = () => {\n if (type === TextInputType.Password) {\n return isObfuscated ? TextInputType.Password : TextInputType.Text;\n }\n return type;\n };\n\n const spellcheckProp = typeof spellcheck === 'boolean' ? { spellCheck: spellcheck } : null;\n\n return (\n <div\n {...focusProps}\n className={merge([\n 'tw-flex tw-items-center tw-h-9 tw-gap-2 tw-px-3 tw-border tw-transition tw-rounded tw-text-s tw-font-sans tw-relative tw-bg-white dark:tw-bg-transparent',\n dotted ? 'tw-border-dashed' : 'tw-border-solid',\n disabled || readonly\n ? 'tw-border-black-5 tw-bg-black-5 dark:tw-bg-black-90 dark:tw-border-black-90'\n : merge([\n 'focus-within:tw-border-black-90 hover:tw-border-black-90',\n validationClassMap[validation],\n isFocusVisible && FOCUS_STYLE,\n ]),\n ])}\n >\n {decorator && (\n <div\n className={merge([\n 'tw-flex tw-items-center tw-justify-center tw-pl-1',\n disabled ? 'tw-text-black-60' : 'tw-text-black-80',\n ])}\n data-test-id=\"decorator\"\n >\n {decorator}\n </div>\n )}\n <input\n id={useMemoizedId(propId)}\n ref={inputElement}\n className={merge([\n 'tw-w-full tw-grow tw-border-none tw-outline-none tw-bg-transparent tw-hide-input-arrows',\n disabled || readonly\n ? 'tw-text-black-40 tw-placeholder-black-30 dark:tw-text-black-30 dark:tw-placeholder-black-40'\n : 'tw-text-black tw-placeholder-black-60 dark:tw-text-white',\n ])}\n onClick={() => inputElement.current?.focus()}\n onChange={(event) => onChange && onChange(event.currentTarget.value)}\n onBlur={onBlur}\n onKeyDown={onKeyDown}\n placeholder={placeholder}\n value={value}\n type={getInputType()}\n required={required}\n readOnly={readonly}\n disabled={disabled}\n autoComplete={autocomplete ? 'on' : 'off'}\n size={size}\n data-test-id=\"text-input\"\n {...spellcheckProp}\n />\n {`${value}`.length > 0 && clearable && (\n <button\n className={merge([\n 'tw-flex tw-items-center tw-justify-center tw-transition-colors tw-rounded',\n disabled ? 'tw-cursor-default tw-text-black-40' : 'tw-text-black-60 hover:tw-text-black-100',\n clearButtonIsFocusVisible && FOCUS_STYLE,\n ])}\n onClick={() => {\n inputElement.current?.focus();\n inputElement.current?.setAttribute('value', '');\n\n onChange && onChange('');\n onClear && onClear();\n }}\n data-test-id=\"clear-icon\"\n title=\"Clear text input\"\n aria-label=\"clear text input\"\n disabled={disabled}\n type=\"button\"\n {...clearButtonFocusProps}\n >\n <IconCross />\n </button>\n )}\n {type === TextInputType.Password && (\n <button\n className={merge([\n 'tw-flex tw-items-center tw-justify-center tw-transition-colors tw-rounded',\n disabled ? 'tw-cursor-default tw-text-black-40' : 'tw-text-black-60 hover:tw-text-black-100',\n passwordButtonIsFocusVisible && FOCUS_STYLE,\n ])}\n onClick={() => setIsObfuscated(!isObfuscated)}\n data-test-id=\"visibility-icon\"\n title=\"Toggle text visibility\"\n type=\"button\"\n aria-label={`${isObfuscated ? 'unveil' : 'obfuscate'} text input`}\n disabled={disabled}\n {...passwordButtonFocusProps}\n >\n {isObfuscated ? <IconEye /> : <IconEyeOff />}\n </button>\n )}\n {validation === Validation.Loading && (\n <span className=\"tw-absolute tw-top-[-0.55rem] tw-right-[-0.55rem] tw-bg-white tw-rounded-full tw-p-[2px] tw-border tw-border-black-10\">\n <LoadingCircle size={LoadingCircleSize.ExtraSmall} />\n </span>\n )}\n {copyable && (\n <button\n className={merge([\n 'tw-flex tw-items-center tw-justify-center tw-transition-colors tw-rounded',\n disabled ? 'tw-cursor-default tw-text-black-40' : 'tw-text-black-60 hover:tw-text-black-100',\n copyButtonIsFocusVisible && FOCUS_STYLE,\n ])}\n onClick={() => copy(value)}\n data-test-id=\"copy-icon\"\n title=\"Copy input text\"\n disabled={disabled}\n type=\"button\"\n {...copyButtonFocusProps}\n >\n {status === 'error' && (\n <span className=\"tw-text-box-negative-strong\">\n <IconCrossCircle />\n </span>\n )}\n {status === 'idle' && <IconClipboard />}\n {status === 'success' && (\n <span className=\"tw-text-box-positive-strong\">\n <IconCheckMark />\n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,EAAA,GACX,kBAAA,cAAA,GAAA;AAAA,IAAc,MAAM,EAAkB;AAAA,EAAY,CAAA,CACvD,GAEH,KACI,kBAAA,cAAA,UAAA;AAAA,IACG,WAAW,EAAM;AAAA,MACb;AAAA,MACA,IAAW,uCAAuC;AAAA,MAClD,KAA4B;AAAA,IAAA,CAC/B;AAAA,IACD,SAAS,MAAM,EAAK,CAAK;AAAA,IACzB,gBAAa;AAAA,IACb,OAAM;AAAA,IACN;AAAA,IACA,MAAK;AAAA,IACJ,GAAG;AAAA,EAEH,GAAA,MAAW,WACP,kBAAA,cAAA,QAAA;AAAA,IAAK,WAAU;AAAA,EAAA,GACZ,kBAAA,cAAC,IAAgB,IAAA,CACrB,GAEH,MAAW,UAAU,kBAAA,cAAC,GAAc,IAAA,GACpC,MAAW,aACP,kBAAA,cAAA,QAAA;AAAA,IAAK,WAAU;AAAA,EAAA,GACX,kBAAA,cAAA,GAAA,IAAc,CACnB,CAER,CAER;AAER;"}
|
|
@@ -21,6 +21,8 @@ export declare type TooltipProps = PropsWithChildren<{
|
|
|
21
21
|
withArrow?: boolean;
|
|
22
22
|
hoverDelay?: number;
|
|
23
23
|
open?: boolean;
|
|
24
|
+
disabled?: boolean;
|
|
25
|
+
hidden?: boolean;
|
|
24
26
|
}>;
|
|
25
27
|
export declare enum TooltipPosition {
|
|
26
28
|
Top = "Top",
|
|
@@ -33,4 +35,4 @@ export declare enum TooltipAlignment {
|
|
|
33
35
|
Middle = "Middle",
|
|
34
36
|
End = "End"
|
|
35
37
|
}
|
|
36
|
-
export declare const Tooltip: ({ content, tooltipIcon, heading, headingIcon, linkUrl, linkLabel, brightHeader, buttons, children, position, alignment, withArrow, flip, triggerElement, hoverDelay, open, }: TooltipProps) => JSX.Element;
|
|
38
|
+
export declare const Tooltip: ({ content, tooltipIcon, heading, headingIcon, linkUrl, linkLabel, brightHeader, buttons, children, position, alignment, withArrow, flip, triggerElement, hoverDelay, open, disabled, hidden, }: TooltipProps) => JSX.Element;
|