@traefik-labs/faency 13.0.0 → 13.1.1
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/Badge/Badge.cjs +1 -5
- package/dist/components/Badge/Badge.cjs.map +1 -1
- package/dist/components/Badge/Badge.js +2 -6
- package/dist/components/Badge/Badge.js.map +1 -1
- package/dist/components/Button/Button.cjs +1 -2
- package/dist/components/Button/Button.cjs.map +1 -1
- package/dist/components/Button/Button.js +2 -3
- package/dist/components/Button/Button.js.map +1 -1
- package/dist/components/CodeBlock/CodeBlock.cjs +8 -3
- package/dist/components/CodeBlock/CodeBlock.cjs.map +1 -1
- package/dist/components/CodeBlock/CodeBlock.js +9 -4
- package/dist/components/CodeBlock/CodeBlock.js.map +1 -1
- package/dist/components/CodeBlock/CodeBlock.vanilla.cjs +8 -3
- package/dist/components/CodeBlock/CodeBlock.vanilla.cjs.map +1 -1
- package/dist/components/CodeBlock/CodeBlock.vanilla.js +9 -4
- package/dist/components/CodeBlock/CodeBlock.vanilla.js.map +1 -1
- package/dist/components/CodeBlock/prism-extend.cjs +1 -0
- package/dist/components/CodeBlock/prism-extend.cjs.map +1 -1
- package/dist/components/CodeBlock/prism-extend.js +1 -0
- package/dist/components/CodeBlock/prism-extend.js.map +1 -1
- package/dist/components/TextField/TextField.cjs +2 -2
- package/dist/components/TextField/TextField.cjs.map +1 -1
- package/dist/components/TextField/TextField.js +2 -2
- package/dist/components/TextField/TextField.js.map +1 -1
- package/dist/components/TextField/TextField.vanilla.cjs +2 -2
- package/dist/components/TextField/TextField.vanilla.cjs.map +1 -1
- package/dist/components/TextField/TextField.vanilla.js +2 -2
- package/dist/components/TextField/TextField.vanilla.js.map +1 -1
- package/dist/index.d.ts +9 -0
- package/dist/styles/themeContext.cjs +2 -1
- package/dist/styles/themeContext.cjs.map +1 -1
- package/dist/styles/themeContext.js +3 -2
- package/dist/styles/themeContext.js.map +1 -1
- package/dist/utils/useIsomorphicLayoutEffect.cjs +6 -0
- package/dist/utils/useIsomorphicLayoutEffect.cjs.map +1 -0
- package/dist/utils/useIsomorphicLayoutEffect.js +6 -0
- package/dist/utils/useIsomorphicLayoutEffect.js.map +1 -0
- package/package.json +15 -15
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CodeBlock.vanilla.js","names":[],"sources":["../../../components/CodeBlock/CodeBlock.vanilla.tsx"],"sourcesContent":["import { CheckIcon, CopyIcon } from '@radix-ui/react-icons';\nimport { assignInlineVars } from '@vanilla-extract/dynamic';\nimport { Highlight, Language, themes } from 'prism-react-renderer';\nimport React, {
|
|
1
|
+
{"version":3,"file":"CodeBlock.vanilla.js","names":[],"sources":["../../../components/CodeBlock/CodeBlock.vanilla.tsx"],"sourcesContent":["import { CheckIcon, CopyIcon } from '@radix-ui/react-icons';\nimport { assignInlineVars } from '@vanilla-extract/dynamic';\nimport { Highlight, Language, themes } from 'prism-react-renderer';\nimport React, { forwardRef, HTMLAttributes, useCallback, useRef, useState } from 'react';\n\nimport { CSSProps, processCSSProp } from '../../styles/cssProps';\nimport { useVanillaExtractTheme } from '../../styles/themeContext';\nimport { useIsomorphicLayoutEffect } from '../../utils/useIsomorphicLayoutEffect';\nimport { AccessibleIcon } from '../AccessibleIcon';\nimport { ButtonVanilla } from '../Button';\nimport {\n codeContent,\n codeContentBottomPadding,\n codeContentTopPadding,\n copyButtonWrapperBottomLeft,\n copyButtonWrapperBottomRight,\n copyButtonWrapperTop,\n copyButtonWrapperTopLeft,\n pre,\n preNoBorder,\n} from './CodeBlock.vanilla.css';\nimport type {\n CodeBlockCopyButtonAlign,\n CodeBlockCopyErrorHandler,\n CodeBlockLanguage,\n} from './index';\nimport { Prism } from './prism-extend';\n\nexport interface CodeBlockVanillaProps\n extends Omit<HTMLAttributes<HTMLPreElement>, 'css'>, CSSProps {\n lang?: CodeBlockLanguage;\n code: string;\n copyable?: boolean;\n copyText?: string;\n copiedText?: string;\n copyButtonAlign?: CodeBlockCopyButtonAlign;\n onCopy?: () => void;\n onCopyError?: CodeBlockCopyErrorHandler;\n noBorder?: boolean;\n wrapText?: boolean;\n colorScheme?: 'light' | 'dark';\n maxHeight?: number | string;\n}\n\nexport const CodeBlockVanilla = forwardRef<HTMLPreElement, CodeBlockVanillaProps>(\n (\n {\n lang = 'text',\n code,\n copyable = false,\n copyText,\n copiedText,\n copyButtonAlign = 'top right',\n onCopy,\n onCopyError,\n noBorder,\n wrapText = false,\n colorScheme,\n maxHeight = 424,\n css,\n style,\n className,\n ...props\n },\n ref,\n ) => {\n const { colors, resolvedTheme } = useVanillaExtractTheme();\n const effectiveScheme = colorScheme ?? resolvedTheme;\n const prismTheme = effectiveScheme === 'dark' ? themes.nightOwl : themes.nightOwlLight;\n\n const isBottom = copyButtonAlign.includes('bottom');\n const isLeft = copyButtonAlign.includes('left');\n\n const { style: cssStyles, vars } = processCSSProp(css, colors);\n const containerStyles = {\n position: 'relative' as const,\n ...cssStyles,\n ...assignInlineVars(vars),\n };\n\n const [copied, setCopied] = useState(false);\n\n const preRef = useRef<HTMLPreElement | null>(\n null,\n ) as React.MutableRefObject<HTMLPreElement | null>;\n const buttonWrapperRef = useRef<HTMLDivElement>(null);\n\n const setPreRef = useCallback(\n (node: HTMLPreElement | null) => {\n preRef.current = node;\n if (typeof ref === 'function') ref(node);\n else if (ref) (ref as React.MutableRefObject<HTMLPreElement | null>).current = node;\n },\n [ref],\n );\n\n useIsomorphicLayoutEffect(() => {\n if (!copyable) return;\n const pre = preRef.current;\n const wrapper = buttonWrapperRef.current;\n if (!pre || !wrapper) return;\n\n const borderH = noBorder ? 0 : 2;\n\n const update = () => {\n if (!isLeft) {\n const vScrollbar = Math.max(0, pre.offsetWidth - pre.clientWidth - borderH);\n wrapper.style.right = `${16 + vScrollbar}px`;\n }\n if (isBottom) {\n const hScrollbar = Math.max(0, pre.offsetHeight - pre.clientHeight - borderH);\n wrapper.style.bottom = `${8 + hScrollbar}px`;\n }\n };\n\n update();\n const observer = new ResizeObserver(update);\n observer.observe(pre);\n return () => observer.disconnect();\n }, [copyable, isBottom, isLeft, noBorder]);\n\n const handleCopy = async () => {\n try {\n try {\n await navigator.clipboard.writeText(code);\n } catch (error) {\n // clipboard write failed (e.g. permission denied) — leave UI unchanged unless a fallback handled it\n if ((await onCopyError?.(error, code)) !== true) return;\n }\n setCopied(true);\n onCopy?.();\n setTimeout(() => setCopied(false), 1500);\n } catch {\n // onCopyError or onCopy threw — leave UI unchanged\n }\n };\n\n const buttonPositionClass = isBottom\n ? isLeft\n ? copyButtonWrapperBottomLeft\n : copyButtonWrapperBottomRight\n : isLeft\n ? copyButtonWrapperTopLeft\n : copyButtonWrapperTop;\n\n const copyButton = copyable ? (\n <ButtonVanilla\n variant=\"secondary\"\n ghost\n size=\"small\"\n type=\"button\"\n onClick={handleCopy}\n css={{\n color: '$hiContrast',\n gap: '$1',\n backgroundColor: '$codeBlockCopyButtonBg',\n height: '32px',\n }}\n >\n <AccessibleIcon label={copied ? 'Copied' : 'Copy'}>\n {copied ? <CheckIcon /> : <CopyIcon />}\n </AccessibleIcon>\n {copied ? copiedText : copyText}\n </ButtonVanilla>\n ) : null;\n\n return (\n <Highlight\n theme={prismTheme}\n code={code}\n language={(Prism.languages[lang] != null ? lang : 'text') as Language}\n >\n {({\n className: highlightClass,\n style: highlightStyle,\n tokens,\n getLineProps,\n getTokenProps,\n }) => (\n <div style={containerStyles}>\n <pre\n ref={setPreRef}\n className={[pre, noBorder ? preNoBorder : '', highlightClass, className]\n .filter(Boolean)\n .join(' ')}\n style={{\n maxHeight,\n ...highlightStyle,\n backgroundColor: 'inherit',\n ...style,\n }}\n {...props}\n >\n <div\n className={[\n codeContent,\n copyable && isLeft && isBottom ? codeContentBottomPadding : '',\n copyable && isLeft && !isBottom ? codeContentTopPadding : '',\n ]\n .filter(Boolean)\n .join(' ')}\n >\n {tokens.map((line, i) => (\n <div\n key={i}\n {...getLineProps({ line })}\n style={\n wrapText ? { whiteSpace: 'pre-wrap', wordBreak: 'break-all' } : undefined\n }\n >\n {line.map((token, key) => (\n <span key={key} {...getTokenProps({ token })} />\n ))}\n </div>\n ))}\n </div>\n </pre>\n {copyButton && (\n <div ref={buttonWrapperRef} className={buttonPositionClass}>\n {copyButton}\n </div>\n )}\n </div>\n )}\n </Highlight>\n );\n },\n);\n\nCodeBlockVanilla.displayName = 'CodeBlockVanilla';\n"],"mappings":";;;;;;;;;;;;;AA4CA,IAAa,mBAAmB,YAE5B,EACE,OAAO,QACP,MACA,WAAW,OACX,UACA,YACA,kBAAkB,aAClB,QACA,aACA,UACA,WAAW,OACX,aACA,YAAY,KACZ,KACA,OACA,WACA,GAAG,SAEL,QACG;CACH,MAAM,EAAE,QAAQ,kBAAkB,uBAAuB;CAEzD,MAAM,cADkB,eAAe,mBACA,SAAS,OAAO,WAAW,OAAO;CAEzE,MAAM,WAAW,gBAAgB,SAAS,QAAQ;CAClD,MAAM,SAAS,gBAAgB,SAAS,MAAM;CAE9C,MAAM,EAAE,OAAO,WAAW,SAAS,eAAe,KAAK,MAAM;CAC7D,MAAM,kBAAkB;EACtB,UAAU;EACV,GAAG;EACH,GAAG,iBAAiB,IAAI;CAC1B;CAEA,MAAM,CAAC,QAAQ,aAAa,SAAS,KAAK;CAE1C,MAAM,SAAS,OACb,IACF;CACA,MAAM,mBAAmB,OAAuB,IAAI;CAEpD,MAAM,YAAY,aACf,SAAgC;EAC/B,OAAO,UAAU;EACjB,IAAI,OAAO,QAAQ,YAAY,IAAI,IAAI;OAClC,IAAI,KAAK,IAAuD,UAAU;CACjF,GACA,CAAC,GAAG,CACN;CAEA,gCAAgC;EAC9B,IAAI,CAAC,UAAU;EACf,MAAM,MAAM,OAAO;EACnB,MAAM,UAAU,iBAAiB;EACjC,IAAI,CAAC,OAAO,CAAC,SAAS;EAEtB,MAAM,UAAU,WAAW,IAAI;EAE/B,MAAM,eAAe;GACnB,IAAI,CAAC,QAAQ;IACX,MAAM,aAAa,KAAK,IAAI,GAAG,IAAI,cAAc,IAAI,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c;KAAI;KAAgB;IAAS,CAAC,CACrE,OAAO,OAAO,CAAC,CACf,KAAK,GAAG;IACX,OAAO;KACL;KACA,GAAG;KACH,iBAAiB;KACjB,GAAG;IACL;IACA,GAAI;IAEJ,UAAA,oBAAC,OAAD;KACE,WAAW;MACT;MACA,YAAY,UAAU,WAAW,2BAA2B;MAC5D,YAAY,UAAU,CAAC,WAAW,wBAAwB;KAC5D,CAAC,CACE,OAAO,OAAO,CAAC,CACf,KAAK,GAAG;KAEV,UAAA,OAAO,KAAK,MAAM,MACjB,oBAAC,OAAD;MAEE,GAAI,aAAa,EAAE,KAAK,CAAC;MACzB,OACE,WAAW;OAAE,YAAY;OAAY,WAAW;MAAY,IAAI,KAAA;MAGjE,UAAA,KAAK,KAAK,OAAO,QAChB,oBAAC,QAAD,EAAgB,GAAI,cAAc,EAAE,MAAM,CAAC,EAAI,GAApC,GAAoC,CAChD;KACE,GATE,CASF,CACN;IACE,CAAA;GACF,CAAA,GACJ,cACC,oBAAC,OAAD;IAAK,KAAK;IAAkB,WAAW;IACpC,UAAA;GACE,CAAA,CAEJ;;CAEE,CAAA;AAEf,CACF;AAEA,iBAAiB,cAAc"}
|
|
@@ -18,6 +18,7 @@ require("prismjs/components/prism-scala.js");
|
|
|
18
18
|
require("prismjs/components/prism-shell-session.js");
|
|
19
19
|
require("prismjs/components/prism-toml.js");
|
|
20
20
|
// components/CodeBlock/prism-extend.ts
|
|
21
|
+
prismjs.default.manual = true;
|
|
21
22
|
for (const [key, value] of Object.entries(prismjs.default.languages)) if (typeof value !== "function" && !(key in prism_react_renderer.Prism.languages)) prism_react_renderer.Prism.languages[key] = value;
|
|
22
23
|
prism_react_renderer.Prism.languages.text = { text: /[\s\S]+/ };
|
|
23
24
|
Object.defineProperty(exports, "Prism", {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prism-extend.cjs","names":["Prism"],"sources":["../../../components/CodeBlock/prism-extend.ts"],"sourcesContent":["/* eslint-disable simple-import-sort/imports */\n// prismjs must be imported first: in the browser it sets window.Prism so language\n// components below can use it as their global Prism reference.\nimport { Prism } from 'prism-react-renderer';\nimport prismjs from 'prismjs';\nimport 'prismjs/components/prism-bash.js';\nimport 'prismjs/components/prism-csharp.js';\nimport 'prismjs/components/prism-docker.js';\nimport 'prismjs/components/prism-hcl.js';\nimport 'prismjs/components/prism-http.js';\nimport 'prismjs/components/prism-ini.js';\nimport 'prismjs/components/prism-java.js';\nimport 'prismjs/components/prism-markup-templating.js';\nimport 'prismjs/components/prism-php.js';\nimport 'prismjs/components/prism-powershell.js';\nimport 'prismjs/components/prism-protobuf.js';\nimport 'prismjs/components/prism-ruby.js';\nimport 'prismjs/components/prism-scala.js';\nimport 'prismjs/components/prism-shell-session.js';\nimport 'prismjs/components/prism-toml.js';\n\n// Copy newly registered grammars from prismjs into prism-react-renderer's Prism.\n// Language component IIFEs register on prismjs's window.Prism, not on PrismRR.\nfor (const [key, value] of Object.entries(prismjs.languages)) {\n if (typeof value !== 'function' && !(key in Prism.languages)) {\n (Prism.languages as Record<string, unknown>)[key] = value;\n }\n}\n\n// 'text' grammar: tokenizes everything as a plain token so prism-react-renderer\n// receives proper Token objects instead of raw strings (which lack a .type field).\nPrism.languages.text = { text: /[\\s\\S]+/ };\n\nexport { Prism };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"prism-extend.cjs","names":["Prism"],"sources":["../../../components/CodeBlock/prism-extend.ts"],"sourcesContent":["/* eslint-disable simple-import-sort/imports */\n// prismjs must be imported first: in the browser it sets window.Prism so language\n// components below can use it as their global Prism reference.\nimport { Prism } from 'prism-react-renderer';\nimport prismjs from 'prismjs';\nimport 'prismjs/components/prism-bash.js';\nimport 'prismjs/components/prism-csharp.js';\nimport 'prismjs/components/prism-docker.js';\nimport 'prismjs/components/prism-hcl.js';\nimport 'prismjs/components/prism-http.js';\nimport 'prismjs/components/prism-ini.js';\nimport 'prismjs/components/prism-java.js';\nimport 'prismjs/components/prism-markup-templating.js';\nimport 'prismjs/components/prism-php.js';\nimport 'prismjs/components/prism-powershell.js';\nimport 'prismjs/components/prism-protobuf.js';\nimport 'prismjs/components/prism-ruby.js';\nimport 'prismjs/components/prism-scala.js';\nimport 'prismjs/components/prism-shell-session.js';\nimport 'prismjs/components/prism-toml.js';\n\n// In the browser, prismjs schedules highlightAll() for the next frame on load, which would rewrite\n// every code[class*=\"language-\"] element on the consumer's page. It reads `manual` in that callback,\n// so setting it synchronously here is enough.\nprismjs.manual = true;\n\n// Copy newly registered grammars from prismjs into prism-react-renderer's Prism.\n// Language component IIFEs register on prismjs's window.Prism, not on PrismRR.\nfor (const [key, value] of Object.entries(prismjs.languages)) {\n if (typeof value !== 'function' && !(key in Prism.languages)) {\n (Prism.languages as Record<string, unknown>)[key] = value;\n }\n}\n\n// 'text' grammar: tokenizes everything as a plain token so prism-react-renderer\n// receives proper Token objects instead of raw strings (which lack a .type field).\nPrism.languages.text = { text: /[\\s\\S]+/ };\n\nexport { Prism };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAwBA,QAAA,QAAA,SAAiB;AAIjB,KAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,QAAA,QAAQ,SAAS,GACzD,IAAI,OAAO,UAAU,cAAc,EAAE,OAAOA,qBAAAA,MAAM,YAChD,qBAAA,MAAO,UAAsC,OAAO;AAMxD,qBAAA,MAAM,UAAU,OAAO,EAAE,MAAM,UAAU"}
|
|
@@ -16,6 +16,7 @@ import "prismjs/components/prism-scala.js";
|
|
|
16
16
|
import "prismjs/components/prism-shell-session.js";
|
|
17
17
|
import "prismjs/components/prism-toml.js";
|
|
18
18
|
// components/CodeBlock/prism-extend.ts
|
|
19
|
+
prismjs.manual = true;
|
|
19
20
|
for (const [key, value] of Object.entries(prismjs.languages)) if (typeof value !== "function" && !(key in Prism.languages)) Prism.languages[key] = value;
|
|
20
21
|
Prism.languages.text = { text: /[\s\S]+/ };
|
|
21
22
|
export { Prism };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prism-extend.js","names":[],"sources":["../../../components/CodeBlock/prism-extend.ts"],"sourcesContent":["/* eslint-disable simple-import-sort/imports */\n// prismjs must be imported first: in the browser it sets window.Prism so language\n// components below can use it as their global Prism reference.\nimport { Prism } from 'prism-react-renderer';\nimport prismjs from 'prismjs';\nimport 'prismjs/components/prism-bash.js';\nimport 'prismjs/components/prism-csharp.js';\nimport 'prismjs/components/prism-docker.js';\nimport 'prismjs/components/prism-hcl.js';\nimport 'prismjs/components/prism-http.js';\nimport 'prismjs/components/prism-ini.js';\nimport 'prismjs/components/prism-java.js';\nimport 'prismjs/components/prism-markup-templating.js';\nimport 'prismjs/components/prism-php.js';\nimport 'prismjs/components/prism-powershell.js';\nimport 'prismjs/components/prism-protobuf.js';\nimport 'prismjs/components/prism-ruby.js';\nimport 'prismjs/components/prism-scala.js';\nimport 'prismjs/components/prism-shell-session.js';\nimport 'prismjs/components/prism-toml.js';\n\n// Copy newly registered grammars from prismjs into prism-react-renderer's Prism.\n// Language component IIFEs register on prismjs's window.Prism, not on PrismRR.\nfor (const [key, value] of Object.entries(prismjs.languages)) {\n if (typeof value !== 'function' && !(key in Prism.languages)) {\n (Prism.languages as Record<string, unknown>)[key] = value;\n }\n}\n\n// 'text' grammar: tokenizes everything as a plain token so prism-react-renderer\n// receives proper Token objects instead of raw strings (which lack a .type field).\nPrism.languages.text = { text: /[\\s\\S]+/ };\n\nexport { Prism };\n"],"mappings":";;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"prism-extend.js","names":[],"sources":["../../../components/CodeBlock/prism-extend.ts"],"sourcesContent":["/* eslint-disable simple-import-sort/imports */\n// prismjs must be imported first: in the browser it sets window.Prism so language\n// components below can use it as their global Prism reference.\nimport { Prism } from 'prism-react-renderer';\nimport prismjs from 'prismjs';\nimport 'prismjs/components/prism-bash.js';\nimport 'prismjs/components/prism-csharp.js';\nimport 'prismjs/components/prism-docker.js';\nimport 'prismjs/components/prism-hcl.js';\nimport 'prismjs/components/prism-http.js';\nimport 'prismjs/components/prism-ini.js';\nimport 'prismjs/components/prism-java.js';\nimport 'prismjs/components/prism-markup-templating.js';\nimport 'prismjs/components/prism-php.js';\nimport 'prismjs/components/prism-powershell.js';\nimport 'prismjs/components/prism-protobuf.js';\nimport 'prismjs/components/prism-ruby.js';\nimport 'prismjs/components/prism-scala.js';\nimport 'prismjs/components/prism-shell-session.js';\nimport 'prismjs/components/prism-toml.js';\n\n// In the browser, prismjs schedules highlightAll() for the next frame on load, which would rewrite\n// every code[class*=\"language-\"] element on the consumer's page. It reads `manual` in that callback,\n// so setting it synchronously here is enough.\nprismjs.manual = true;\n\n// Copy newly registered grammars from prismjs into prism-react-renderer's Prism.\n// Language component IIFEs register on prismjs's window.Prism, not on PrismRR.\nfor (const [key, value] of Object.entries(prismjs.languages)) {\n if (typeof value !== 'function' && !(key in Prism.languages)) {\n (Prism.languages as Record<string, unknown>)[key] = value;\n }\n}\n\n// 'text' grammar: tokenizes everything as a plain token so prism-react-renderer\n// receives proper Token objects instead of raw strings (which lack a .type field).\nPrism.languages.text = { text: /[\\s\\S]+/ };\n\nexport { Prism };\n"],"mappings":";;;;;;;;;;;;;;;;;;AAwBA,QAAQ,SAAS;AAIjB,KAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,QAAQ,SAAS,GACzD,IAAI,OAAO,UAAU,cAAc,EAAE,OAAO,MAAM,YAChD,MAAO,UAAsC,OAAO;AAMxD,MAAM,UAAU,OAAO,EAAE,MAAM,UAAU"}
|
|
@@ -83,8 +83,8 @@ var TextField = react.default.forwardRef(({ state, clearable, label: LabelOrComp
|
|
|
83
83
|
const togglePasswordVisibility = react.default.useCallback(() => {
|
|
84
84
|
setInnerType((prevInnerType) => prevInnerType === "password" ? void 0 : "password");
|
|
85
85
|
}, [setInnerType]);
|
|
86
|
-
const EndAdornmentWrapper =
|
|
87
|
-
const PasswordVisibilityToggleIcon =
|
|
86
|
+
const EndAdornmentWrapper = hasAdornmentGroup ? AdornmentGroup : react.default.Fragment;
|
|
87
|
+
const PasswordVisibilityToggleIcon = isPasswordVisible ? StyledEyeClosedIcon : StyledEyeOpenIcon;
|
|
88
88
|
const passwordAction = react.default.useMemo(() => isPasswordVisible ? "Hide password" : "Show password", [isPasswordVisible]);
|
|
89
89
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_Box.Box, {
|
|
90
90
|
css,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextField.cjs","names":["styled","ExclamationTriangleIcon","EyeOpenIcon","EyeClosedIcon","CrossCircledIcon","React","Label","Box","Input","Tooltip"],"sources":["../../../components/TextField/TextField.tsx"],"sourcesContent":["import {\n CrossCircledIcon,\n ExclamationTriangleIcon,\n EyeClosedIcon,\n EyeOpenIcon,\n} from '@radix-ui/react-icons';\nimport React from 'react';\n\nimport { styled } from '../../stitches.config';\nimport { Box } from '../Box';\nimport { Input, InputHandle, InputProps, InputVariants } from '../Input';\nimport { Label } from '../Label';\nimport { Tooltip } from '../Tooltip';\n\n// TYPES\nexport interface TextFieldLabelProps {\n variant: 'invalid' | 'subtle' | 'contrast' | 'default';\n htmlFor?: string;\n}\nexport type TextFieldProps = InputProps & {\n type?: string;\n clearable?: boolean;\n label?: string | ((props: TextFieldLabelProps) => JSX.Element);\n};\n\nexport type TextFieldVariants = InputVariants;\n\n// COMPONENTS\nconst AdornmentGroup = styled('div', {\n display: 'flex',\n flexDirection: 'row',\n alignItems: 'center',\n});\n\nconst StyledExclamationTriangleIcon = styled(ExclamationTriangleIcon, {\n '& + *': {\n marginLeft: '$1',\n },\n});\n\nconst StyledEyeOpenIcon = styled(EyeOpenIcon, {\n '@hover': {\n '&:hover': {\n cursor: 'pointer',\n },\n },\n});\n\nconst StyledEyeClosedIcon = styled(EyeClosedIcon, {\n '@hover': {\n '&:hover': {\n cursor: 'pointer',\n },\n },\n});\n\nconst StyledCrossCircledIcon = styled(CrossCircledIcon, {\n '@hover': {\n '&:hover': {\n cursor: 'pointer',\n },\n },\n});\n\nexport const TextField = React.forwardRef<React.ElementRef<typeof Input>, TextFieldProps>(\n (\n {\n state,\n clearable,\n label: LabelOrComponent,\n id,\n type,\n disabled,\n readOnly,\n onBlur,\n onFocus,\n css,\n ...props\n },\n forwardedRef
|
|
1
|
+
{"version":3,"file":"TextField.cjs","names":["styled","ExclamationTriangleIcon","EyeOpenIcon","EyeClosedIcon","CrossCircledIcon","React","Label","Box","Input","Tooltip"],"sources":["../../../components/TextField/TextField.tsx"],"sourcesContent":["import {\n CrossCircledIcon,\n ExclamationTriangleIcon,\n EyeClosedIcon,\n EyeOpenIcon,\n} from '@radix-ui/react-icons';\nimport React from 'react';\n\nimport { styled } from '../../stitches.config';\nimport { Box } from '../Box';\nimport { Input, InputHandle, InputProps, InputVariants } from '../Input';\nimport { Label } from '../Label';\nimport { Tooltip } from '../Tooltip';\n\n// TYPES\nexport interface TextFieldLabelProps {\n variant: 'invalid' | 'subtle' | 'contrast' | 'default';\n htmlFor?: string;\n}\nexport type TextFieldProps = InputProps & {\n type?: string;\n clearable?: boolean;\n label?: string | ((props: TextFieldLabelProps) => JSX.Element);\n};\n\nexport type TextFieldVariants = InputVariants;\n\n// COMPONENTS\nconst AdornmentGroup = styled('div', {\n display: 'flex',\n flexDirection: 'row',\n alignItems: 'center',\n});\n\nconst StyledExclamationTriangleIcon = styled(ExclamationTriangleIcon, {\n '& + *': {\n marginLeft: '$1',\n },\n});\n\nconst StyledEyeOpenIcon = styled(EyeOpenIcon, {\n '@hover': {\n '&:hover': {\n cursor: 'pointer',\n },\n },\n});\n\nconst StyledEyeClosedIcon = styled(EyeClosedIcon, {\n '@hover': {\n '&:hover': {\n cursor: 'pointer',\n },\n },\n});\n\nconst StyledCrossCircledIcon = styled(CrossCircledIcon, {\n '@hover': {\n '&:hover': {\n cursor: 'pointer',\n },\n },\n});\n\nexport const TextField = React.forwardRef<React.ElementRef<typeof Input>, TextFieldProps>(\n (\n {\n state,\n clearable,\n label: LabelOrComponent,\n id,\n type,\n disabled,\n readOnly,\n onBlur,\n onFocus,\n css,\n ...props\n },\n forwardedRef,\n ) => {\n const inputRef = React.useRef<InputHandle | null>(null);\n React.useImperativeHandle(forwardedRef, () => inputRef.current as InputHandle);\n\n const [inputHasFocus, setInputHasFocus] = React.useState(false);\n const [innerType, setInnerType] = React.useState(type);\n const isPasswordVisible = React.useMemo(() => innerType !== 'password', [innerType]);\n\n const invalid = React.useMemo(() => state === 'invalid', [state]);\n\n const labelVariant = React.useMemo(() => {\n if (disabled) {\n return 'subtle';\n }\n if (invalid) {\n return 'invalid';\n }\n if (inputHasFocus) {\n return 'contrast';\n }\n return 'default';\n }, [invalid, disabled, inputHasFocus]);\n\n const LabelNode = React.useMemo(() => {\n if (LabelOrComponent === undefined || LabelOrComponent === null) {\n return null;\n }\n if (typeof LabelOrComponent === 'string') {\n return (\n <Label variant={labelVariant} htmlFor={id}>\n {LabelOrComponent}\n </Label>\n );\n }\n return <LabelOrComponent variant={labelVariant} htmlFor={id} />;\n }, [LabelOrComponent, labelVariant, id]);\n\n const isPasswordType = React.useMemo(() => type === 'password', [type]);\n\n const typeOrInnerType = React.useMemo(\n () => (isPasswordType ? innerType : type),\n [isPasswordType, type, innerType],\n );\n\n const hasInnerAdornment = React.useMemo(\n () => clearable || isPasswordType || invalid,\n [clearable, isPasswordType, invalid],\n );\n\n const hasAdornmentGroup = React.useMemo(\n () => (clearable && invalid) || (clearable && isPasswordType) || (invalid && isPasswordType),\n [clearable, invalid, isPasswordType],\n );\n\n const clearDisabled = React.useMemo(() => readOnly || disabled, [readOnly, disabled]);\n\n const handleClear = React.useCallback(() => {\n const { current } = inputRef;\n if (current) {\n current.clear();\n }\n }, [inputRef]);\n\n const handleFocus = React.useCallback(\n (e: React.FocusEvent<HTMLInputElement>) => {\n if (onFocus) {\n onFocus(e);\n }\n setInputHasFocus(true);\n },\n [onFocus, setInputHasFocus],\n );\n\n const handleBlur = React.useCallback(\n (e: React.FocusEvent<HTMLInputElement>) => {\n if (onBlur) {\n onBlur(e);\n }\n setInputHasFocus(false);\n },\n [onBlur, setInputHasFocus],\n );\n\n const togglePasswordVisibility = React.useCallback(() => {\n setInnerType((prevInnerType) => (prevInnerType === 'password' ? undefined : 'password'));\n }, [setInnerType]);\n\n const EndAdornmentWrapper = hasAdornmentGroup ? AdornmentGroup : React.Fragment;\n\n const PasswordVisibilityToggleIcon = isPasswordVisible\n ? StyledEyeClosedIcon\n : StyledEyeOpenIcon;\n\n const passwordAction = React.useMemo(\n () => (isPasswordVisible ? 'Hide password' : 'Show password'),\n [isPasswordVisible],\n );\n\n return (\n <Box css={css}>\n {LabelNode}\n <Input\n id={id}\n ref={inputRef}\n endAdornment={\n hasInnerAdornment && (\n <EndAdornmentWrapper>\n {invalid && <StyledExclamationTriangleIcon role=\"alert\" aria-label=\"Invalid\" />}\n {isPasswordType && (\n <Tooltip content={passwordAction}>\n <PasswordVisibilityToggleIcon\n aria-label={passwordAction}\n onClick={togglePasswordVisibility}\n />\n </Tooltip>\n )}\n {clearable && !clearDisabled && (\n <Tooltip content=\"Clear\">\n <StyledCrossCircledIcon aria-label=\"Clear\" onClick={handleClear} />\n </Tooltip>\n )}\n </EndAdornmentWrapper>\n )\n }\n state={state}\n type={typeOrInnerType}\n disabled={disabled}\n readOnly={readOnly}\n onFocus={handleFocus}\n onBlur={handleBlur}\n {...props}\n />\n </Box>\n );\n },\n);\n"],"mappings":";;;;;;;;;;;AA4BA,IAAM,iBAAiBA,wBAAAA,OAAO,OAAO;CACnC,SAAS;CACT,eAAe;CACf,YAAY;AACd,CAAC;AAED,IAAM,gCAAgCA,wBAAAA,OAAOC,sBAAAA,yBAAyB,EACpE,SAAS,EACP,YAAY,KACd,EACF,CAAC;AAED,IAAM,oBAAoBD,wBAAAA,OAAOE,sBAAAA,aAAa,EAC5C,UAAU,EACR,WAAW,EACT,QAAQ,UACV,EACF,EACF,CAAC;AAED,IAAM,sBAAsBF,wBAAAA,OAA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cACE,qBACE,iBAAA,GAAA,kBAAA,KAAA,CAAC,qBAAD,EAAA,UAAA;IACG,WAAW,iBAAA,GAAA,kBAAA,IAAA,CAAC,+BAAD;KAA+B,MAAK;KAAQ,cAAW;IAAW,CAAA;IAC7E,kBACC,iBAAA,GAAA,kBAAA,IAAA,CAACC,gBAAAA,SAAD;KAAS,SAAS;KAChB,UAAA,iBAAA,GAAA,kBAAA,IAAA,CAAC,8BAAD;MACE,cAAY;MACZ,SAAS;KACV,CAAA;IACM,CAAA;IAEV,aAAa,CAAC,iBACb,iBAAA,GAAA,kBAAA,IAAA,CAACA,gBAAAA,SAAD;KAAS,SAAQ;KACf,UAAA,iBAAA,GAAA,kBAAA,IAAA,CAAC,wBAAD;MAAwB,cAAW;MAAQ,SAAS;KAAc,CAAA;IAC3D,CAAA;GAEQ,EAAA,CAAA;GAGlB;GACP,MAAM;GACI;GACA;GACV,SAAS;GACT,QAAQ;GACR,GAAI;EACL,CAAA,CACE;;AAET,CACF"}
|
|
@@ -81,8 +81,8 @@ var TextField = React.forwardRef(({ state, clearable, label: LabelOrComponent, i
|
|
|
81
81
|
const togglePasswordVisibility = React.useCallback(() => {
|
|
82
82
|
setInnerType((prevInnerType) => prevInnerType === "password" ? void 0 : "password");
|
|
83
83
|
}, [setInnerType]);
|
|
84
|
-
const EndAdornmentWrapper =
|
|
85
|
-
const PasswordVisibilityToggleIcon =
|
|
84
|
+
const EndAdornmentWrapper = hasAdornmentGroup ? AdornmentGroup : React.Fragment;
|
|
85
|
+
const PasswordVisibilityToggleIcon = isPasswordVisible ? StyledEyeClosedIcon : StyledEyeOpenIcon;
|
|
86
86
|
const passwordAction = React.useMemo(() => isPasswordVisible ? "Hide password" : "Show password", [isPasswordVisible]);
|
|
87
87
|
return /* @__PURE__ */ jsxs(Box, {
|
|
88
88
|
css,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextField.js","names":[],"sources":["../../../components/TextField/TextField.tsx"],"sourcesContent":["import {\n CrossCircledIcon,\n ExclamationTriangleIcon,\n EyeClosedIcon,\n EyeOpenIcon,\n} from '@radix-ui/react-icons';\nimport React from 'react';\n\nimport { styled } from '../../stitches.config';\nimport { Box } from '../Box';\nimport { Input, InputHandle, InputProps, InputVariants } from '../Input';\nimport { Label } from '../Label';\nimport { Tooltip } from '../Tooltip';\n\n// TYPES\nexport interface TextFieldLabelProps {\n variant: 'invalid' | 'subtle' | 'contrast' | 'default';\n htmlFor?: string;\n}\nexport type TextFieldProps = InputProps & {\n type?: string;\n clearable?: boolean;\n label?: string | ((props: TextFieldLabelProps) => JSX.Element);\n};\n\nexport type TextFieldVariants = InputVariants;\n\n// COMPONENTS\nconst AdornmentGroup = styled('div', {\n display: 'flex',\n flexDirection: 'row',\n alignItems: 'center',\n});\n\nconst StyledExclamationTriangleIcon = styled(ExclamationTriangleIcon, {\n '& + *': {\n marginLeft: '$1',\n },\n});\n\nconst StyledEyeOpenIcon = styled(EyeOpenIcon, {\n '@hover': {\n '&:hover': {\n cursor: 'pointer',\n },\n },\n});\n\nconst StyledEyeClosedIcon = styled(EyeClosedIcon, {\n '@hover': {\n '&:hover': {\n cursor: 'pointer',\n },\n },\n});\n\nconst StyledCrossCircledIcon = styled(CrossCircledIcon, {\n '@hover': {\n '&:hover': {\n cursor: 'pointer',\n },\n },\n});\n\nexport const TextField = React.forwardRef<React.ElementRef<typeof Input>, TextFieldProps>(\n (\n {\n state,\n clearable,\n label: LabelOrComponent,\n id,\n type,\n disabled,\n readOnly,\n onBlur,\n onFocus,\n css,\n ...props\n },\n forwardedRef
|
|
1
|
+
{"version":3,"file":"TextField.js","names":[],"sources":["../../../components/TextField/TextField.tsx"],"sourcesContent":["import {\n CrossCircledIcon,\n ExclamationTriangleIcon,\n EyeClosedIcon,\n EyeOpenIcon,\n} from '@radix-ui/react-icons';\nimport React from 'react';\n\nimport { styled } from '../../stitches.config';\nimport { Box } from '../Box';\nimport { Input, InputHandle, InputProps, InputVariants } from '../Input';\nimport { Label } from '../Label';\nimport { Tooltip } from '../Tooltip';\n\n// TYPES\nexport interface TextFieldLabelProps {\n variant: 'invalid' | 'subtle' | 'contrast' | 'default';\n htmlFor?: string;\n}\nexport type TextFieldProps = InputProps & {\n type?: string;\n clearable?: boolean;\n label?: string | ((props: TextFieldLabelProps) => JSX.Element);\n};\n\nexport type TextFieldVariants = InputVariants;\n\n// COMPONENTS\nconst AdornmentGroup = styled('div', {\n display: 'flex',\n flexDirection: 'row',\n alignItems: 'center',\n});\n\nconst StyledExclamationTriangleIcon = styled(ExclamationTriangleIcon, {\n '& + *': {\n marginLeft: '$1',\n },\n});\n\nconst StyledEyeOpenIcon = styled(EyeOpenIcon, {\n '@hover': {\n '&:hover': {\n cursor: 'pointer',\n },\n },\n});\n\nconst StyledEyeClosedIcon = styled(EyeClosedIcon, {\n '@hover': {\n '&:hover': {\n cursor: 'pointer',\n },\n },\n});\n\nconst StyledCrossCircledIcon = styled(CrossCircledIcon, {\n '@hover': {\n '&:hover': {\n cursor: 'pointer',\n },\n },\n});\n\nexport const TextField = React.forwardRef<React.ElementRef<typeof Input>, TextFieldProps>(\n (\n {\n state,\n clearable,\n label: LabelOrComponent,\n id,\n type,\n disabled,\n readOnly,\n onBlur,\n onFocus,\n css,\n ...props\n },\n forwardedRef,\n ) => {\n const inputRef = React.useRef<InputHandle | null>(null);\n React.useImperativeHandle(forwardedRef, () => inputRef.current as InputHandle);\n\n const [inputHasFocus, setInputHasFocus] = React.useState(false);\n const [innerType, setInnerType] = React.useState(type);\n const isPasswordVisible = React.useMemo(() => innerType !== 'password', [innerType]);\n\n const invalid = React.useMemo(() => state === 'invalid', [state]);\n\n const labelVariant = React.useMemo(() => {\n if (disabled) {\n return 'subtle';\n }\n if (invalid) {\n return 'invalid';\n }\n if (inputHasFocus) {\n return 'contrast';\n }\n return 'default';\n }, [invalid, disabled, inputHasFocus]);\n\n const LabelNode = React.useMemo(() => {\n if (LabelOrComponent === undefined || LabelOrComponent === null) {\n return null;\n }\n if (typeof LabelOrComponent === 'string') {\n return (\n <Label variant={labelVariant} htmlFor={id}>\n {LabelOrComponent}\n </Label>\n );\n }\n return <LabelOrComponent variant={labelVariant} htmlFor={id} />;\n }, [LabelOrComponent, labelVariant, id]);\n\n const isPasswordType = React.useMemo(() => type === 'password', [type]);\n\n const typeOrInnerType = React.useMemo(\n () => (isPasswordType ? innerType : type),\n [isPasswordType, type, innerType],\n );\n\n const hasInnerAdornment = React.useMemo(\n () => clearable || isPasswordType || invalid,\n [clearable, isPasswordType, invalid],\n );\n\n const hasAdornmentGroup = React.useMemo(\n () => (clearable && invalid) || (clearable && isPasswordType) || (invalid && isPasswordType),\n [clearable, invalid, isPasswordType],\n );\n\n const clearDisabled = React.useMemo(() => readOnly || disabled, [readOnly, disabled]);\n\n const handleClear = React.useCallback(() => {\n const { current } = inputRef;\n if (current) {\n current.clear();\n }\n }, [inputRef]);\n\n const handleFocus = React.useCallback(\n (e: React.FocusEvent<HTMLInputElement>) => {\n if (onFocus) {\n onFocus(e);\n }\n setInputHasFocus(true);\n },\n [onFocus, setInputHasFocus],\n );\n\n const handleBlur = React.useCallback(\n (e: React.FocusEvent<HTMLInputElement>) => {\n if (onBlur) {\n onBlur(e);\n }\n setInputHasFocus(false);\n },\n [onBlur, setInputHasFocus],\n );\n\n const togglePasswordVisibility = React.useCallback(() => {\n setInnerType((prevInnerType) => (prevInnerType === 'password' ? undefined : 'password'));\n }, [setInnerType]);\n\n const EndAdornmentWrapper = hasAdornmentGroup ? AdornmentGroup : React.Fragment;\n\n const PasswordVisibilityToggleIcon = isPasswordVisible\n ? StyledEyeClosedIcon\n : StyledEyeOpenIcon;\n\n const passwordAction = React.useMemo(\n () => (isPasswordVisible ? 'Hide password' : 'Show password'),\n [isPasswordVisible],\n );\n\n return (\n <Box css={css}>\n {LabelNode}\n <Input\n id={id}\n ref={inputRef}\n endAdornment={\n hasInnerAdornment && (\n <EndAdornmentWrapper>\n {invalid && <StyledExclamationTriangleIcon role=\"alert\" aria-label=\"Invalid\" />}\n {isPasswordType && (\n <Tooltip content={passwordAction}>\n <PasswordVisibilityToggleIcon\n aria-label={passwordAction}\n onClick={togglePasswordVisibility}\n />\n </Tooltip>\n )}\n {clearable && !clearDisabled && (\n <Tooltip content=\"Clear\">\n <StyledCrossCircledIcon aria-label=\"Clear\" onClick={handleClear} />\n </Tooltip>\n )}\n </EndAdornmentWrapper>\n )\n }\n state={state}\n type={typeOrInnerType}\n disabled={disabled}\n readOnly={readOnly}\n onFocus={handleFocus}\n onBlur={handleBlur}\n {...props}\n />\n </Box>\n );\n },\n);\n"],"mappings":";;;;;;;;;AA4BA,IAAM,iBAAiB,OAAO,OAAO;CACnC,SAAS;CACT,eAAe;CACf,YAAY;AACd,CAAC;AAED,IAAM,gCAAgC,OAAO,yBAAyB,EACpE,SAAS,EACP,YAAY,KACd,EACF,CAAC;AAED,IAAM,oBAAoB,OAAO,aAAa,EAC5C,UAAU,EACR,WAAW,EACT,QAAQ,UACV,EACF,EACF,CAAC;AAED,IAAM,sBAAsB,OAAO,eAAe,EAChD,UAAU,EACR,WAAW,EACT,QAAQ,UACV,EACF,EACF,CAAC;AAED,IAAM,yBAAyB,OAAO,kBAAkB,EACtD,UAAU,EACR,WAAW,EACT,QAAQ,UACV,EACF,EACF,CAAC;AAED,IAAa,YAAY,MAAM,YAE3B,EACE,OACA,WACA,OAAO,kBACP,IACA,MACA,UACA,UACA,QACA,SACA,KACA,GAAG,SAEL,iBACG;CACH,MAAM,WAAW,MAAM,OAA2B,IAAI;CACtD,MAAM,oBAAoB,oBAAoB,SAAS,OAAsB;CAE7E,MAAM,CAAC,eAAe,oBAAoB,MAAM,SAAS,KAAK;CAC9D,MAAM,CAAC,WAAW,gBAAgB,MAAM,SAAS,IAAI;CACrD,MAAM,oBAAoB,MAAM,cAAc,cAAc,YAAY,CAAC,SAAS,CAAC;CAEnF,MAAM,UAAU,MAAM,cAAc,UAAU,WAAW,CAAC,KAAK,CAAC;CAEhE,MAAM,eAAe,MAAM,c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AAc,kBAAmB,kBAAkB,aAAa,KAAA,IAAY,UAAW;CACzF,GAAG,CAAC,YAAY,CAAC;CAEjB,MAAM,sBAAsB,oBAAoB,iBAAiB,MAAM;CAEvE,MAAM,+BAA+B,oBACjC,sBACA;CAEJ,MAAM,iBAAiB,MAAM,cACpB,oBAAoB,kBAAkB,iBAC7C,CAAC,iBAAiB,CACpB;CAEA,OACE,qBAAC,KAAD;EAAU;EAAV,UAAA,CACG,WACD,oBAAC,OAAD;GACM;GACJ,KAAK;GACL,cACE,qBACE,qBAAC,qBAAD,EAAA,UAAA;IACG,WAAW,oBAAC,+BAAD;KAA+B,MAAK;KAAQ,cAAW;IAAW,CAAA;IAC7E,kBACC,oBAAC,SAAD;KAAS,SAAS;KAChB,UAAA,oBAAC,8BAAD;MACE,cAAY;MACZ,SAAS;KACV,CAAA;IACM,CAAA;IAEV,aAAa,CAAC,iBACb,oBAAC,SAAD;KAAS,SAAQ;KACf,UAAA,oBAAC,wBAAD;MAAwB,cAAW;MAAQ,SAAS;KAAc,CAAA;IAC3D,CAAA;GAEQ,EAAA,CAAA;GAGlB;GACP,MAAM;GACI;GACA;GACV,SAAS;GACT,QAAQ;GACR,GAAI;EACL,CAAA,CACE;;AAET,CACF"}
|
|
@@ -83,8 +83,8 @@ var TextFieldVanilla = react.default.forwardRef(({ state, clearable, label: Labe
|
|
|
83
83
|
const togglePasswordVisibility = react.default.useCallback(() => {
|
|
84
84
|
setInnerType((prevInnerType) => prevInnerType === "password" ? void 0 : "password");
|
|
85
85
|
}, [setInnerType]);
|
|
86
|
-
const EndAdornmentWrapper =
|
|
87
|
-
const PasswordVisibilityToggleIcon =
|
|
86
|
+
const EndAdornmentWrapper = hasAdornmentGroup ? AdornmentGroup : react.default.Fragment;
|
|
87
|
+
const PasswordVisibilityToggleIcon = isPasswordVisible ? StyledEyeClosedIcon : StyledEyeOpenIcon;
|
|
88
88
|
const passwordAction = react.default.useMemo(() => isPasswordVisible ? "Hide password" : "Show password", [isPasswordVisible]);
|
|
89
89
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_Box_vanilla.BoxVanilla, {
|
|
90
90
|
css,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextField.vanilla.cjs","names":["styled","ExclamationTriangleIcon","EyeOpenIcon","EyeClosedIcon","CrossCircledIcon","React","LabelVanilla","BoxVanilla","InputVanilla","Tooltip"],"sources":["../../../components/TextField/TextField.vanilla.tsx"],"sourcesContent":["import {\n CrossCircledIcon,\n ExclamationTriangleIcon,\n EyeClosedIcon,\n EyeOpenIcon,\n} from '@radix-ui/react-icons';\nimport React from 'react';\n\nimport { styled } from '../../stitches.config';\nimport { BoxVanilla } from '../Box';\nimport { InputVanilla, InputVanillaHandle, InputVanillaProps } from '../Input';\nimport { LabelVanilla } from '../Label';\nimport { Tooltip } from '../Tooltip';\n\n// TYPES\nexport interface TextFieldLabelProps {\n variant: 'invalid' | 'subtle' | 'contrast' | 'default';\n htmlFor?: string;\n}\n\nexport type TextFieldVanillaProps = InputVanillaProps & {\n type?: string;\n clearable?: boolean;\n label?: string | ((props: TextFieldLabelProps) => JSX.Element);\n};\n\n// COMPONENTS\nconst AdornmentGroup = styled('div', {\n display: 'flex',\n flexDirection: 'row',\n alignItems: 'center',\n});\n\nconst StyledExclamationTriangleIcon = styled(ExclamationTriangleIcon, {\n '& + *': {\n marginLeft: '$1',\n },\n});\n\nconst StyledEyeOpenIcon = styled(EyeOpenIcon, {\n '@hover': {\n '&:hover': {\n cursor: 'pointer',\n },\n },\n});\n\nconst StyledEyeClosedIcon = styled(EyeClosedIcon, {\n '@hover': {\n '&:hover': {\n cursor: 'pointer',\n },\n },\n});\n\nconst StyledCrossCircledIcon = styled(CrossCircledIcon, {\n '@hover': {\n '&:hover': {\n cursor: 'pointer',\n },\n },\n});\n\nexport const TextFieldVanilla = React.forwardRef<\n React.ElementRef<typeof InputVanilla>,\n TextFieldVanillaProps\n>(\n (\n {\n state,\n clearable,\n label: LabelOrComponent,\n id,\n type,\n disabled,\n readOnly,\n onBlur,\n onFocus,\n css,\n ...props\n },\n forwardedRef,\n ) => {\n const inputRef = React.useRef<InputVanillaHandle | null>(null);\n React.useImperativeHandle(forwardedRef, () => inputRef.current as InputVanillaHandle);\n\n const [inputHasFocus, setInputHasFocus] = React.useState(false);\n const [innerType, setInnerType] = React.useState(type);\n const isPasswordVisible = React.useMemo(() => innerType !== 'password', [innerType]);\n\n const invalid = React.useMemo(() => state === 'invalid', [state]);\n\n const labelVariant = React.useMemo(() => {\n if (disabled) {\n return 'subtle';\n }\n if (invalid) {\n return 'invalid';\n }\n if (inputHasFocus) {\n return 'contrast';\n }\n return 'default';\n }, [invalid, disabled, inputHasFocus]);\n\n const LabelNode = React.useMemo(() => {\n if (LabelOrComponent === undefined || LabelOrComponent === null) {\n return null;\n }\n if (typeof LabelOrComponent === 'string') {\n return (\n <LabelVanilla variant={labelVariant} htmlFor={id}>\n {LabelOrComponent}\n </LabelVanilla>\n );\n }\n return <LabelOrComponent variant={labelVariant} htmlFor={id} />;\n }, [LabelOrComponent, labelVariant, id]);\n\n const isPasswordType = React.useMemo(() => type === 'password', [type]);\n\n const typeOrInnerType = React.useMemo(\n () => (isPasswordType ? innerType : type),\n [isPasswordType, type, innerType],\n );\n\n const hasInnerAdornment = React.useMemo(\n () => clearable || isPasswordType || invalid,\n [clearable, isPasswordType, invalid],\n );\n\n const hasAdornmentGroup = React.useMemo(\n () => (clearable && invalid) || (clearable && isPasswordType) || (invalid && isPasswordType),\n [clearable, invalid, isPasswordType],\n );\n\n const clearDisabled = React.useMemo(() => readOnly || disabled, [readOnly, disabled]);\n\n const handleClear = React.useCallback(() => {\n const { current } = inputRef;\n if (current) {\n current.clear();\n }\n }, [inputRef]);\n\n const handleFocus = React.useCallback(\n (e: React.FocusEvent<HTMLInputElement>) => {\n if (onFocus) {\n onFocus(e);\n }\n setInputHasFocus(true);\n },\n [onFocus, setInputHasFocus],\n );\n\n const handleBlur = React.useCallback(\n (e: React.FocusEvent<HTMLInputElement>) => {\n if (onBlur) {\n onBlur(e);\n }\n setInputHasFocus(false);\n },\n [onBlur, setInputHasFocus],\n );\n\n const togglePasswordVisibility = React.useCallback(() => {\n setInnerType((prevInnerType) => (prevInnerType === 'password' ? undefined : 'password'));\n }, [setInnerType]);\n\n const EndAdornmentWrapper =
|
|
1
|
+
{"version":3,"file":"TextField.vanilla.cjs","names":["styled","ExclamationTriangleIcon","EyeOpenIcon","EyeClosedIcon","CrossCircledIcon","React","LabelVanilla","BoxVanilla","InputVanilla","Tooltip"],"sources":["../../../components/TextField/TextField.vanilla.tsx"],"sourcesContent":["import {\n CrossCircledIcon,\n ExclamationTriangleIcon,\n EyeClosedIcon,\n EyeOpenIcon,\n} from '@radix-ui/react-icons';\nimport React from 'react';\n\nimport { styled } from '../../stitches.config';\nimport { BoxVanilla } from '../Box';\nimport { InputVanilla, InputVanillaHandle, InputVanillaProps } from '../Input';\nimport { LabelVanilla } from '../Label';\nimport { Tooltip } from '../Tooltip';\n\n// TYPES\nexport interface TextFieldLabelProps {\n variant: 'invalid' | 'subtle' | 'contrast' | 'default';\n htmlFor?: string;\n}\n\nexport type TextFieldVanillaProps = InputVanillaProps & {\n type?: string;\n clearable?: boolean;\n label?: string | ((props: TextFieldLabelProps) => JSX.Element);\n};\n\n// COMPONENTS\nconst AdornmentGroup = styled('div', {\n display: 'flex',\n flexDirection: 'row',\n alignItems: 'center',\n});\n\nconst StyledExclamationTriangleIcon = styled(ExclamationTriangleIcon, {\n '& + *': {\n marginLeft: '$1',\n },\n});\n\nconst StyledEyeOpenIcon = styled(EyeOpenIcon, {\n '@hover': {\n '&:hover': {\n cursor: 'pointer',\n },\n },\n});\n\nconst StyledEyeClosedIcon = styled(EyeClosedIcon, {\n '@hover': {\n '&:hover': {\n cursor: 'pointer',\n },\n },\n});\n\nconst StyledCrossCircledIcon = styled(CrossCircledIcon, {\n '@hover': {\n '&:hover': {\n cursor: 'pointer',\n },\n },\n});\n\nexport const TextFieldVanilla = React.forwardRef<\n React.ElementRef<typeof InputVanilla>,\n TextFieldVanillaProps\n>(\n (\n {\n state,\n clearable,\n label: LabelOrComponent,\n id,\n type,\n disabled,\n readOnly,\n onBlur,\n onFocus,\n css,\n ...props\n },\n forwardedRef,\n ) => {\n const inputRef = React.useRef<InputVanillaHandle | null>(null);\n React.useImperativeHandle(forwardedRef, () => inputRef.current as InputVanillaHandle);\n\n const [inputHasFocus, setInputHasFocus] = React.useState(false);\n const [innerType, setInnerType] = React.useState(type);\n const isPasswordVisible = React.useMemo(() => innerType !== 'password', [innerType]);\n\n const invalid = React.useMemo(() => state === 'invalid', [state]);\n\n const labelVariant = React.useMemo(() => {\n if (disabled) {\n return 'subtle';\n }\n if (invalid) {\n return 'invalid';\n }\n if (inputHasFocus) {\n return 'contrast';\n }\n return 'default';\n }, [invalid, disabled, inputHasFocus]);\n\n const LabelNode = React.useMemo(() => {\n if (LabelOrComponent === undefined || LabelOrComponent === null) {\n return null;\n }\n if (typeof LabelOrComponent === 'string') {\n return (\n <LabelVanilla variant={labelVariant} htmlFor={id}>\n {LabelOrComponent}\n </LabelVanilla>\n );\n }\n return <LabelOrComponent variant={labelVariant} htmlFor={id} />;\n }, [LabelOrComponent, labelVariant, id]);\n\n const isPasswordType = React.useMemo(() => type === 'password', [type]);\n\n const typeOrInnerType = React.useMemo(\n () => (isPasswordType ? innerType : type),\n [isPasswordType, type, innerType],\n );\n\n const hasInnerAdornment = React.useMemo(\n () => clearable || isPasswordType || invalid,\n [clearable, isPasswordType, invalid],\n );\n\n const hasAdornmentGroup = React.useMemo(\n () => (clearable && invalid) || (clearable && isPasswordType) || (invalid && isPasswordType),\n [clearable, invalid, isPasswordType],\n );\n\n const clearDisabled = React.useMemo(() => readOnly || disabled, [readOnly, disabled]);\n\n const handleClear = React.useCallback(() => {\n const { current } = inputRef;\n if (current) {\n current.clear();\n }\n }, [inputRef]);\n\n const handleFocus = React.useCallback(\n (e: React.FocusEvent<HTMLInputElement>) => {\n if (onFocus) {\n onFocus(e);\n }\n setInputHasFocus(true);\n },\n [onFocus, setInputHasFocus],\n );\n\n const handleBlur = React.useCallback(\n (e: React.FocusEvent<HTMLInputElement>) => {\n if (onBlur) {\n onBlur(e);\n }\n setInputHasFocus(false);\n },\n [onBlur, setInputHasFocus],\n );\n\n const togglePasswordVisibility = React.useCallback(() => {\n setInnerType((prevInnerType) => (prevInnerType === 'password' ? undefined : 'password'));\n }, [setInnerType]);\n\n const EndAdornmentWrapper = hasAdornmentGroup ? AdornmentGroup : React.Fragment;\n\n const PasswordVisibilityToggleIcon = isPasswordVisible\n ? StyledEyeClosedIcon\n : StyledEyeOpenIcon;\n\n const passwordAction = React.useMemo(\n () => (isPasswordVisible ? 'Hide password' : 'Show password'),\n [isPasswordVisible],\n );\n\n return (\n <BoxVanilla css={css}>\n {LabelNode}\n <InputVanilla\n id={id}\n ref={inputRef}\n endAdornment={\n hasInnerAdornment && (\n <EndAdornmentWrapper>\n {invalid && <StyledExclamationTriangleIcon role=\"alert\" aria-label=\"Invalid\" />}\n {isPasswordType && (\n <Tooltip content={passwordAction}>\n <PasswordVisibilityToggleIcon\n aria-label={passwordAction}\n onClick={togglePasswordVisibility}\n />\n </Tooltip>\n )}\n {clearable && !clearDisabled && (\n <Tooltip content=\"Clear\">\n <StyledCrossCircledIcon aria-label=\"Clear\" onClick={handleClear} />\n </Tooltip>\n )}\n </EndAdornmentWrapper>\n )\n }\n state={state}\n type={typeOrInnerType}\n disabled={disabled}\n readOnly={readOnly}\n onFocus={handleFocus}\n onBlur={handleBlur}\n {...props}\n />\n </BoxVanilla>\n );\n },\n);\n\nTextFieldVanilla.displayName = 'TextFieldVanilla';\n"],"mappings":";;;;;;;;;;;AA2BA,IAAM,iBAAiBA,wBAAAA,OAAO,OAAO;CACnC,SAAS;CACT,eAAe;CACf,YAAY;AACd,CAAC;AAED,IAAM,gCAAgCA,wBAAAA,OAAOC,sBAAAA,yBAAyB,EACpE,SAAS,EACP,YAAY,KACd,EAC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pB;CAEA,OACE,iBAAA,GAAA,kBAAA,KAAA,CAACE,oBAAAA,YAAD;EAAiB;EAAjB,UAAA,CACG,WACD,iBAAA,GAAA,kBAAA,IAAA,CAACC,sBAAAA,cAAD;GACM;GACJ,KAAK;GACL,cACE,qBACE,iBAAA,GAAA,kBAAA,KAAA,CAAC,qBAAD,EAAA,UAAA;IACG,WAAW,iBAAA,GAAA,kBAAA,IAAA,CAAC,+BAAD;KAA+B,MAAK;KAAQ,cAAW;IAAW,CAAA;IAC7E,kBACC,iBAAA,GAAA,kBAAA,IAAA,CAACC,gBAAAA,SAAD;KAAS,SAAS;KAChB,UAAA,iBAAA,GAAA,kBAAA,IAAA,CAAC,8BAAD;MACE,cAAY;MACZ,SAAS;KACV,CAAA;IACM,CAAA;IAEV,aAAa,CAAC,iBACb,iBAAA,GAAA,kBAAA,IAAA,CAACA,gBAAAA,SAAD;KAAS,SAAQ;KACf,UAAA,iBAAA,GAAA,kBAAA,IAAA,CAAC,wBAAD;MAAwB,cAAW;MAAQ,SAAS;KAAc,CAAA;IAC3D,CAAA;GAEQ,EAAA,CAAA;GAGlB;GACP,MAAM;GACI;GACA;GACV,SAAS;GACT,QAAQ;GACR,GAAI;EACL,CAAA,CACS;;AAEhB,CACF;AAEA,iBAAiB,cAAc"}
|
|
@@ -81,8 +81,8 @@ var TextFieldVanilla = React.forwardRef(({ state, clearable, label: LabelOrCompo
|
|
|
81
81
|
const togglePasswordVisibility = React.useCallback(() => {
|
|
82
82
|
setInnerType((prevInnerType) => prevInnerType === "password" ? void 0 : "password");
|
|
83
83
|
}, [setInnerType]);
|
|
84
|
-
const EndAdornmentWrapper =
|
|
85
|
-
const PasswordVisibilityToggleIcon =
|
|
84
|
+
const EndAdornmentWrapper = hasAdornmentGroup ? AdornmentGroup : React.Fragment;
|
|
85
|
+
const PasswordVisibilityToggleIcon = isPasswordVisible ? StyledEyeClosedIcon : StyledEyeOpenIcon;
|
|
86
86
|
const passwordAction = React.useMemo(() => isPasswordVisible ? "Hide password" : "Show password", [isPasswordVisible]);
|
|
87
87
|
return /* @__PURE__ */ jsxs(BoxVanilla, {
|
|
88
88
|
css,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextField.vanilla.js","names":[],"sources":["../../../components/TextField/TextField.vanilla.tsx"],"sourcesContent":["import {\n CrossCircledIcon,\n ExclamationTriangleIcon,\n EyeClosedIcon,\n EyeOpenIcon,\n} from '@radix-ui/react-icons';\nimport React from 'react';\n\nimport { styled } from '../../stitches.config';\nimport { BoxVanilla } from '../Box';\nimport { InputVanilla, InputVanillaHandle, InputVanillaProps } from '../Input';\nimport { LabelVanilla } from '../Label';\nimport { Tooltip } from '../Tooltip';\n\n// TYPES\nexport interface TextFieldLabelProps {\n variant: 'invalid' | 'subtle' | 'contrast' | 'default';\n htmlFor?: string;\n}\n\nexport type TextFieldVanillaProps = InputVanillaProps & {\n type?: string;\n clearable?: boolean;\n label?: string | ((props: TextFieldLabelProps) => JSX.Element);\n};\n\n// COMPONENTS\nconst AdornmentGroup = styled('div', {\n display: 'flex',\n flexDirection: 'row',\n alignItems: 'center',\n});\n\nconst StyledExclamationTriangleIcon = styled(ExclamationTriangleIcon, {\n '& + *': {\n marginLeft: '$1',\n },\n});\n\nconst StyledEyeOpenIcon = styled(EyeOpenIcon, {\n '@hover': {\n '&:hover': {\n cursor: 'pointer',\n },\n },\n});\n\nconst StyledEyeClosedIcon = styled(EyeClosedIcon, {\n '@hover': {\n '&:hover': {\n cursor: 'pointer',\n },\n },\n});\n\nconst StyledCrossCircledIcon = styled(CrossCircledIcon, {\n '@hover': {\n '&:hover': {\n cursor: 'pointer',\n },\n },\n});\n\nexport const TextFieldVanilla = React.forwardRef<\n React.ElementRef<typeof InputVanilla>,\n TextFieldVanillaProps\n>(\n (\n {\n state,\n clearable,\n label: LabelOrComponent,\n id,\n type,\n disabled,\n readOnly,\n onBlur,\n onFocus,\n css,\n ...props\n },\n forwardedRef,\n ) => {\n const inputRef = React.useRef<InputVanillaHandle | null>(null);\n React.useImperativeHandle(forwardedRef, () => inputRef.current as InputVanillaHandle);\n\n const [inputHasFocus, setInputHasFocus] = React.useState(false);\n const [innerType, setInnerType] = React.useState(type);\n const isPasswordVisible = React.useMemo(() => innerType !== 'password', [innerType]);\n\n const invalid = React.useMemo(() => state === 'invalid', [state]);\n\n const labelVariant = React.useMemo(() => {\n if (disabled) {\n return 'subtle';\n }\n if (invalid) {\n return 'invalid';\n }\n if (inputHasFocus) {\n return 'contrast';\n }\n return 'default';\n }, [invalid, disabled, inputHasFocus]);\n\n const LabelNode = React.useMemo(() => {\n if (LabelOrComponent === undefined || LabelOrComponent === null) {\n return null;\n }\n if (typeof LabelOrComponent === 'string') {\n return (\n <LabelVanilla variant={labelVariant} htmlFor={id}>\n {LabelOrComponent}\n </LabelVanilla>\n );\n }\n return <LabelOrComponent variant={labelVariant} htmlFor={id} />;\n }, [LabelOrComponent, labelVariant, id]);\n\n const isPasswordType = React.useMemo(() => type === 'password', [type]);\n\n const typeOrInnerType = React.useMemo(\n () => (isPasswordType ? innerType : type),\n [isPasswordType, type, innerType],\n );\n\n const hasInnerAdornment = React.useMemo(\n () => clearable || isPasswordType || invalid,\n [clearable, isPasswordType, invalid],\n );\n\n const hasAdornmentGroup = React.useMemo(\n () => (clearable && invalid) || (clearable && isPasswordType) || (invalid && isPasswordType),\n [clearable, invalid, isPasswordType],\n );\n\n const clearDisabled = React.useMemo(() => readOnly || disabled, [readOnly, disabled]);\n\n const handleClear = React.useCallback(() => {\n const { current } = inputRef;\n if (current) {\n current.clear();\n }\n }, [inputRef]);\n\n const handleFocus = React.useCallback(\n (e: React.FocusEvent<HTMLInputElement>) => {\n if (onFocus) {\n onFocus(e);\n }\n setInputHasFocus(true);\n },\n [onFocus, setInputHasFocus],\n );\n\n const handleBlur = React.useCallback(\n (e: React.FocusEvent<HTMLInputElement>) => {\n if (onBlur) {\n onBlur(e);\n }\n setInputHasFocus(false);\n },\n [onBlur, setInputHasFocus],\n );\n\n const togglePasswordVisibility = React.useCallback(() => {\n setInnerType((prevInnerType) => (prevInnerType === 'password' ? undefined : 'password'));\n }, [setInnerType]);\n\n const EndAdornmentWrapper =
|
|
1
|
+
{"version":3,"file":"TextField.vanilla.js","names":[],"sources":["../../../components/TextField/TextField.vanilla.tsx"],"sourcesContent":["import {\n CrossCircledIcon,\n ExclamationTriangleIcon,\n EyeClosedIcon,\n EyeOpenIcon,\n} from '@radix-ui/react-icons';\nimport React from 'react';\n\nimport { styled } from '../../stitches.config';\nimport { BoxVanilla } from '../Box';\nimport { InputVanilla, InputVanillaHandle, InputVanillaProps } from '../Input';\nimport { LabelVanilla } from '../Label';\nimport { Tooltip } from '../Tooltip';\n\n// TYPES\nexport interface TextFieldLabelProps {\n variant: 'invalid' | 'subtle' | 'contrast' | 'default';\n htmlFor?: string;\n}\n\nexport type TextFieldVanillaProps = InputVanillaProps & {\n type?: string;\n clearable?: boolean;\n label?: string | ((props: TextFieldLabelProps) => JSX.Element);\n};\n\n// COMPONENTS\nconst AdornmentGroup = styled('div', {\n display: 'flex',\n flexDirection: 'row',\n alignItems: 'center',\n});\n\nconst StyledExclamationTriangleIcon = styled(ExclamationTriangleIcon, {\n '& + *': {\n marginLeft: '$1',\n },\n});\n\nconst StyledEyeOpenIcon = styled(EyeOpenIcon, {\n '@hover': {\n '&:hover': {\n cursor: 'pointer',\n },\n },\n});\n\nconst StyledEyeClosedIcon = styled(EyeClosedIcon, {\n '@hover': {\n '&:hover': {\n cursor: 'pointer',\n },\n },\n});\n\nconst StyledCrossCircledIcon = styled(CrossCircledIcon, {\n '@hover': {\n '&:hover': {\n cursor: 'pointer',\n },\n },\n});\n\nexport const TextFieldVanilla = React.forwardRef<\n React.ElementRef<typeof InputVanilla>,\n TextFieldVanillaProps\n>(\n (\n {\n state,\n clearable,\n label: LabelOrComponent,\n id,\n type,\n disabled,\n readOnly,\n onBlur,\n onFocus,\n css,\n ...props\n },\n forwardedRef,\n ) => {\n const inputRef = React.useRef<InputVanillaHandle | null>(null);\n React.useImperativeHandle(forwardedRef, () => inputRef.current as InputVanillaHandle);\n\n const [inputHasFocus, setInputHasFocus] = React.useState(false);\n const [innerType, setInnerType] = React.useState(type);\n const isPasswordVisible = React.useMemo(() => innerType !== 'password', [innerType]);\n\n const invalid = React.useMemo(() => state === 'invalid', [state]);\n\n const labelVariant = React.useMemo(() => {\n if (disabled) {\n return 'subtle';\n }\n if (invalid) {\n return 'invalid';\n }\n if (inputHasFocus) {\n return 'contrast';\n }\n return 'default';\n }, [invalid, disabled, inputHasFocus]);\n\n const LabelNode = React.useMemo(() => {\n if (LabelOrComponent === undefined || LabelOrComponent === null) {\n return null;\n }\n if (typeof LabelOrComponent === 'string') {\n return (\n <LabelVanilla variant={labelVariant} htmlFor={id}>\n {LabelOrComponent}\n </LabelVanilla>\n );\n }\n return <LabelOrComponent variant={labelVariant} htmlFor={id} />;\n }, [LabelOrComponent, labelVariant, id]);\n\n const isPasswordType = React.useMemo(() => type === 'password', [type]);\n\n const typeOrInnerType = React.useMemo(\n () => (isPasswordType ? innerType : type),\n [isPasswordType, type, innerType],\n );\n\n const hasInnerAdornment = React.useMemo(\n () => clearable || isPasswordType || invalid,\n [clearable, isPasswordType, invalid],\n );\n\n const hasAdornmentGroup = React.useMemo(\n () => (clearable && invalid) || (clearable && isPasswordType) || (invalid && isPasswordType),\n [clearable, invalid, isPasswordType],\n );\n\n const clearDisabled = React.useMemo(() => readOnly || disabled, [readOnly, disabled]);\n\n const handleClear = React.useCallback(() => {\n const { current } = inputRef;\n if (current) {\n current.clear();\n }\n }, [inputRef]);\n\n const handleFocus = React.useCallback(\n (e: React.FocusEvent<HTMLInputElement>) => {\n if (onFocus) {\n onFocus(e);\n }\n setInputHasFocus(true);\n },\n [onFocus, setInputHasFocus],\n );\n\n const handleBlur = React.useCallback(\n (e: React.FocusEvent<HTMLInputElement>) => {\n if (onBlur) {\n onBlur(e);\n }\n setInputHasFocus(false);\n },\n [onBlur, setInputHasFocus],\n );\n\n const togglePasswordVisibility = React.useCallback(() => {\n setInnerType((prevInnerType) => (prevInnerType === 'password' ? undefined : 'password'));\n }, [setInnerType]);\n\n const EndAdornmentWrapper = hasAdornmentGroup ? AdornmentGroup : React.Fragment;\n\n const PasswordVisibilityToggleIcon = isPasswordVisible\n ? StyledEyeClosedIcon\n : StyledEyeOpenIcon;\n\n const passwordAction = React.useMemo(\n () => (isPasswordVisible ? 'Hide password' : 'Show password'),\n [isPasswordVisible],\n );\n\n return (\n <BoxVanilla css={css}>\n {LabelNode}\n <InputVanilla\n id={id}\n ref={inputRef}\n endAdornment={\n hasInnerAdornment && (\n <EndAdornmentWrapper>\n {invalid && <StyledExclamationTriangleIcon role=\"alert\" aria-label=\"Invalid\" />}\n {isPasswordType && (\n <Tooltip content={passwordAction}>\n <PasswordVisibilityToggleIcon\n aria-label={passwordAction}\n onClick={togglePasswordVisibility}\n />\n </Tooltip>\n )}\n {clearable && !clearDisabled && (\n <Tooltip content=\"Clear\">\n <StyledCrossCircledIcon aria-label=\"Clear\" onClick={handleClear} />\n </Tooltip>\n )}\n </EndAdornmentWrapper>\n )\n }\n state={state}\n type={typeOrInnerType}\n disabled={disabled}\n readOnly={readOnly}\n onFocus={handleFocus}\n onBlur={handleBlur}\n {...props}\n />\n </BoxVanilla>\n );\n },\n);\n\nTextFieldVanilla.displayName = 'TextFieldVanilla';\n"],"mappings":";;;;;;;;;AA2BA,IAAM,iBAAiB,OAAO,OAAO;CACnC,SAAS;CACT,eAAe;CACf,YAAY;AACd,CAAC;AAED,IAAM,gCAAgC,OAAO,yBAAyB,EACpE,SAAS,EACP,YAAY,KACd,EACF,CAAC;AAED,IAAM,oBAAoB,OAAO,aAAa,EAC5C,UAAU,EACR,WAAW,EACT,QAAQ,UACV,EACF,EACF,CAAC;AAED,IAAM,sBAAsB,OAAO,eAAe,EAChD,UAAU,EACR,WAAW,EACT,QAAQ,UACV,EACF,EACF,CAAC;AAED,IAAM,yBAAyB,OAAO,kBAAkB,EACtD,U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AAI;EACL,CAAA,CACS;;AAEhB,CACF;AAEA,iBAAiB,cAAc"}
|
package/dist/index.d.ts
CHANGED
|
@@ -6480,6 +6480,13 @@ export declare const CodeBlock: default_2.ForwardRefExoticComponent<Omit<CodeBlo
|
|
|
6480
6480
|
|
|
6481
6481
|
declare type CodeBlockCopyButtonAlign = 'top' | 'top right' | 'top left' | 'bottom' | 'bottom right' | 'bottom left';
|
|
6482
6482
|
|
|
6483
|
+
/**
|
|
6484
|
+
* Called when writing to the clipboard fails (e.g. missing `clipboard-write` permission in an iframe).
|
|
6485
|
+
* Return or resolve to `true` when the copy was handled by a fallback: the copied state is shown and
|
|
6486
|
+
* `onCopy` is called, as for a successful copy.
|
|
6487
|
+
*/
|
|
6488
|
+
export declare type CodeBlockCopyErrorHandler = (error: unknown, code: string) => boolean | void | Promise<boolean | void>;
|
|
6489
|
+
|
|
6483
6490
|
export declare type CodeBlockLanguage = Language | 'bash' | 'csharp' | 'docker' | 'hcl' | 'http' | 'ini' | 'java' | 'php' | 'powershell' | 'protobuf' | 'ruby' | 'scala' | 'shell-session' | 'toml';
|
|
6484
6491
|
|
|
6485
6492
|
export declare type CodeBlockProps = {
|
|
@@ -6490,6 +6497,7 @@ export declare type CodeBlockProps = {
|
|
|
6490
6497
|
copiedText?: string;
|
|
6491
6498
|
copyButtonAlign?: CodeBlockCopyButtonAlign;
|
|
6492
6499
|
onCopy?: () => void;
|
|
6500
|
+
onCopyError?: CodeBlockCopyErrorHandler;
|
|
6493
6501
|
noBorder?: boolean;
|
|
6494
6502
|
wrapText?: boolean;
|
|
6495
6503
|
colorScheme?: 'light' | 'dark';
|
|
@@ -6507,6 +6515,7 @@ export declare interface CodeBlockVanillaProps extends Omit<HTMLAttributes<HTMLP
|
|
|
6507
6515
|
copiedText?: string;
|
|
6508
6516
|
copyButtonAlign?: CodeBlockCopyButtonAlign;
|
|
6509
6517
|
onCopy?: () => void;
|
|
6518
|
+
onCopyError?: CodeBlockCopyErrorHandler;
|
|
6510
6519
|
noBorder?: boolean;
|
|
6511
6520
|
wrapText?: boolean;
|
|
6512
6521
|
colorScheme?: 'light' | 'dark';
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
const require_runtime = require("../_virtual/_rolldown/runtime.cjs");
|
|
2
2
|
const require_index = require("../colors/index.cjs");
|
|
3
|
+
const require_useIsomorphicLayoutEffect = require("../utils/useIsomorphicLayoutEffect.cjs");
|
|
3
4
|
const require_themes_css = require("./themes.css.cjs");
|
|
4
5
|
let react = require("react");
|
|
5
6
|
react = require_runtime.__toESM(react, 1);
|
|
@@ -81,7 +82,7 @@ function VanillaExtractThemeProvider({ children, defaultTheme = "system", primar
|
|
|
81
82
|
...baseColors,
|
|
82
83
|
...semanticColors
|
|
83
84
|
};
|
|
84
|
-
|
|
85
|
+
require_useIsomorphicLayoutEffect.useIsomorphicLayoutEffect(() => {
|
|
85
86
|
const themeClass = require_themes_css.themes[resolvedTheme][appliedPrimaryColor];
|
|
86
87
|
Object.values(require_themes_css.themes.light).forEach((cls) => document.body.classList.remove(cls));
|
|
87
88
|
Object.values(require_themes_css.themes.dark).forEach((cls) => document.body.classList.remove(cls));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"themeContext.cjs","names":["createContext","useState","darkColors","lightColors","themes","useContext"],"sources":["../../styles/themeContext.tsx"],"sourcesContent":["import React, { createContext, useContext, useEffect,
|
|
1
|
+
{"version":3,"file":"themeContext.cjs","names":["createContext","useState","darkColors","lightColors","themes","useContext"],"sources":["../../styles/themeContext.tsx"],"sourcesContent":["import React, { createContext, useContext, useEffect, useState } from 'react';\n\nimport { darkColors, lightColors } from '../colors';\nimport { useIsomorphicLayoutEffect } from '../utils/useIsomorphicLayoutEffect';\nimport { PrimaryColor, themes } from './themes.css';\n\nexport type ThemeMode = 'light' | 'dark' | 'system';\nexport type { PrimaryColor };\n\ninterface ThemeContextValue {\n mode: ThemeMode;\n resolvedTheme: 'light' | 'dark';\n primaryColor: PrimaryColor;\n colors: typeof lightColors | typeof darkColors;\n setMode: (mode: ThemeMode) => void;\n setPrimaryColor: (color: PrimaryColor) => void;\n}\n\nconst ThemeContext = createContext<ThemeContextValue | undefined>(undefined);\n\ninterface VanillaExtractThemeProviderProps {\n children: React.ReactNode;\n defaultTheme?: ThemeMode;\n primaryColor?: PrimaryColor;\n forcedTheme?: 'light' | 'dark';\n}\n\nexport function VanillaExtractThemeProvider({\n children,\n defaultTheme = 'system',\n primaryColor = 'blue',\n forcedTheme,\n}: VanillaExtractThemeProviderProps) {\n const [mode, setMode] = useState<ThemeMode>(defaultTheme);\n const [appliedPrimaryColor, setPrimaryColor] = useState<PrimaryColor>(primaryColor);\n const [systemTheme, setSystemTheme] = useState<'light' | 'dark'>(() => {\n if (forcedTheme) {\n return forcedTheme;\n }\n if (typeof window !== 'undefined') {\n return window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';\n }\n return 'light';\n });\n\n useEffect(() => {\n setPrimaryColor(primaryColor);\n }, [primaryColor]);\n\n useEffect(() => {\n if (forcedTheme) {\n setSystemTheme(forcedTheme);\n return;\n }\n\n const mediaQuery = window.matchMedia('(prefers-color-scheme: dark)');\n setSystemTheme(mediaQuery.matches ? 'dark' : 'light');\n\n const handler = (e: MediaQueryListEvent) => {\n setSystemTheme(e.matches ? 'dark' : 'light');\n };\n\n mediaQuery.addEventListener('change', handler);\n return () => mediaQuery.removeEventListener('change', handler);\n }, [forcedTheme]);\n\n const resolvedTheme: 'light' | 'dark' = forcedTheme || (mode === 'system' ? systemTheme : mode);\n\n const baseColors = resolvedTheme === 'dark' ? darkColors : lightColors;\n\n const semanticColors =\n resolvedTheme === 'dark'\n ? {\n primary: darkColors[`${appliedPrimaryColor}9`],\n contentBg: darkColors['00dp'],\n hiContrast: 'white',\n loContrast: darkColors.deepBlue2,\n focusOutline: 'hsl(216, 100%, 64%)',\n divider: 'hsl(209, 29%, 19%)',\n background: '#0a0a0a',\n foreground: '#ffffff',\n muted: '#1a1a1a',\n mutedForeground: '#b4b4b4',\n card: '#1a1a1a',\n cardForeground: '#ffffff',\n popover: '#1a1a1a',\n popoverForeground: '#ffffff',\n border: '#3a3a3a',\n input: '#3a3a3a',\n accent: '#3b82f6',\n accentForeground: '#ffffff',\n destructive: '#dc2626',\n destructiveForeground: '#ffffff',\n ring: '#60a5fa',\n }\n : {\n primary: lightColors[`${appliedPrimaryColor}9`],\n contentBg: lightColors['00dp'],\n hiContrast: lightColors.deepBlue11,\n loContrast: 'white',\n focusOutline: 'hsl(216, 100%, 64%)',\n divider: 'hsl(207, 10%, 82%)',\n background: '#fcfcfc',\n foreground: '#1a1a1a',\n muted: '#f4f4f4',\n mutedForeground: '#646464',\n card: '#ffffff',\n cardForeground: '#1a1a1a',\n popover: '#ffffff',\n popoverForeground: '#1a1a1a',\n border: '#e3e3e3',\n input: '#e3e3e3',\n accent: '#60a5fa',\n accentForeground: '#ffffff',\n destructive: '#dc2626',\n destructiveForeground: '#ffffff',\n ring: '#3b82f6',\n };\n\n const colors = {\n ...baseColors,\n ...semanticColors,\n };\n\n // Apply the theme class synchronously before paint\n useIsomorphicLayoutEffect(() => {\n const themeClass = themes[resolvedTheme][appliedPrimaryColor];\n\n Object.values(themes.light).forEach((cls) => document.body.classList.remove(cls));\n Object.values(themes.dark).forEach((cls) => document.body.classList.remove(cls));\n\n document.body.classList.add(themeClass);\n\n return () => {\n document.body.classList.remove(themeClass);\n };\n }, [resolvedTheme, appliedPrimaryColor]);\n\n const contextValue: ThemeContextValue = {\n mode,\n resolvedTheme,\n primaryColor: appliedPrimaryColor,\n colors,\n setMode,\n setPrimaryColor,\n };\n\n return <ThemeContext.Provider value={contextValue}>{children}</ThemeContext.Provider>;\n}\n\nexport function useVanillaExtractTheme() {\n const context = useContext(ThemeContext);\n if (context === undefined) {\n throw new Error('useVanillaExtractTheme must be used within a VanillaExtractThemeProvider');\n }\n return context;\n}\n"],"mappings":";;;;;;;;AAkBA,IAAM,gBAAA,GAAeA,MAAAA,cAAAA,CAA6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EAClB,aAAa;EACb,uBAAuB;EACvB,MAAM;CACR,IACA;EACE,SAASC,cAAAA,YAAY,GAAG,oBAAoB;EAC5C,WAAWA,cAAAA,YAAY;EACvB,YAAYA,cAAAA,YAAY;EACxB,YAAY;EACZ,cAAc;EACd,SAAS;EACT,YAAY;EACZ,YAAY;EACZ,OAAO;EACP,iBAAiB;EACjB,MAAM;EACN,gBAAgB;EAChB,SAAS;EACT,mBAAmB;EACnB,QAAQ;EACR,OAAO;EACP,QAAQ;EACR,kBAAkB;EAClB,aAAa;EACb,uBAAuB;EACvB,MAAM;CACR;CAEN,MAAM,SAAS;EACb,GAAG;EACH,GAAG;CACL;CAGA,kCAAA,gCAAgC;EAC9B,MAAM,aAAaC,mBAAAA,OAAO,cAAc,CAAC;EAEzC,OAAO,OAAOA,mBAAAA,OAAO,KAAK,CAAC,CAAC,SAAS,QAAQ,SAAS,KAAK,UAAU,OAAO,GAAG,CAAC;EAChF,OAAO,OAAOA,mBAAAA,OAAO,IAAI,CAAC,CAAC,SAAS,QAAQ,SAAS,KAAK,UAAU,OAAO,GAAG,CAAC;EAE/E,SAAS,KAAK,UAAU,IAAI,UAAU;EAEtC,aAAa;GACX,SAAS,KAAK,UAAU,OAAO,UAAU;EAC3C;CACF,GAAG,CAAC,eAAe,mBAAmB,CAAC;CAEvC,MAAM,eAAkC;EACtC;EACA;EACA,cAAc;EACd;EACA;EACA;CACF;CAEA,OAAO,iBAAA,GAAA,kBAAA,IAAA,CAAC,aAAa,UAAd;EAAuB,OAAO;EAAe;CAAgC,CAAA;AACtF;AAEA,SAAgB,yBAAyB;CACvC,MAAM,WAAA,GAAUC,MAAAA,WAAAA,CAAW,YAAY;CACvC,IAAI,YAAY,KAAA,GACd,MAAM,IAAI,MAAM,0EAA0E;CAE5F,OAAO;AACT"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { darkColors, lightColors } from "../colors/index.js";
|
|
2
|
+
import { useIsomorphicLayoutEffect } from "../utils/useIsomorphicLayoutEffect.js";
|
|
2
3
|
import { themes } from "./themes.css.js";
|
|
3
|
-
import { createContext, useContext, useEffect,
|
|
4
|
+
import { createContext, useContext, useEffect, useState } from "react";
|
|
4
5
|
import { jsx } from "react/jsx-runtime";
|
|
5
6
|
// styles/themeContext.tsx
|
|
6
7
|
var ThemeContext = createContext(void 0);
|
|
@@ -79,7 +80,7 @@ function VanillaExtractThemeProvider({ children, defaultTheme = "system", primar
|
|
|
79
80
|
...baseColors,
|
|
80
81
|
...semanticColors
|
|
81
82
|
};
|
|
82
|
-
|
|
83
|
+
useIsomorphicLayoutEffect(() => {
|
|
83
84
|
const themeClass = themes[resolvedTheme][appliedPrimaryColor];
|
|
84
85
|
Object.values(themes.light).forEach((cls) => document.body.classList.remove(cls));
|
|
85
86
|
Object.values(themes.dark).forEach((cls) => document.body.classList.remove(cls));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"themeContext.js","names":[],"sources":["../../styles/themeContext.tsx"],"sourcesContent":["import React, { createContext, useContext, useEffect,
|
|
1
|
+
{"version":3,"file":"themeContext.js","names":[],"sources":["../../styles/themeContext.tsx"],"sourcesContent":["import React, { createContext, useContext, useEffect, useState } from 'react';\n\nimport { darkColors, lightColors } from '../colors';\nimport { useIsomorphicLayoutEffect } from '../utils/useIsomorphicLayoutEffect';\nimport { PrimaryColor, themes } from './themes.css';\n\nexport type ThemeMode = 'light' | 'dark' | 'system';\nexport type { PrimaryColor };\n\ninterface ThemeContextValue {\n mode: ThemeMode;\n resolvedTheme: 'light' | 'dark';\n primaryColor: PrimaryColor;\n colors: typeof lightColors | typeof darkColors;\n setMode: (mode: ThemeMode) => void;\n setPrimaryColor: (color: PrimaryColor) => void;\n}\n\nconst ThemeContext = createContext<ThemeContextValue | undefined>(undefined);\n\ninterface VanillaExtractThemeProviderProps {\n children: React.ReactNode;\n defaultTheme?: ThemeMode;\n primaryColor?: PrimaryColor;\n forcedTheme?: 'light' | 'dark';\n}\n\nexport function VanillaExtractThemeProvider({\n children,\n defaultTheme = 'system',\n primaryColor = 'blue',\n forcedTheme,\n}: VanillaExtractThemeProviderProps) {\n const [mode, setMode] = useState<ThemeMode>(defaultTheme);\n const [appliedPrimaryColor, setPrimaryColor] = useState<PrimaryColor>(primaryColor);\n const [systemTheme, setSystemTheme] = useState<'light' | 'dark'>(() => {\n if (forcedTheme) {\n return forcedTheme;\n }\n if (typeof window !== 'undefined') {\n return window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';\n }\n return 'light';\n });\n\n useEffect(() => {\n setPrimaryColor(primaryColor);\n }, [primaryColor]);\n\n useEffect(() => {\n if (forcedTheme) {\n setSystemTheme(forcedTheme);\n return;\n }\n\n const mediaQuery = window.matchMedia('(prefers-color-scheme: dark)');\n setSystemTheme(mediaQuery.matches ? 'dark' : 'light');\n\n const handler = (e: MediaQueryListEvent) => {\n setSystemTheme(e.matches ? 'dark' : 'light');\n };\n\n mediaQuery.addEventListener('change', handler);\n return () => mediaQuery.removeEventListener('change', handler);\n }, [forcedTheme]);\n\n const resolvedTheme: 'light' | 'dark' = forcedTheme || (mode === 'system' ? systemTheme : mode);\n\n const baseColors = resolvedTheme === 'dark' ? darkColors : lightColors;\n\n const semanticColors =\n resolvedTheme === 'dark'\n ? {\n primary: darkColors[`${appliedPrimaryColor}9`],\n contentBg: darkColors['00dp'],\n hiContrast: 'white',\n loContrast: darkColors.deepBlue2,\n focusOutline: 'hsl(216, 100%, 64%)',\n divider: 'hsl(209, 29%, 19%)',\n background: '#0a0a0a',\n foreground: '#ffffff',\n muted: '#1a1a1a',\n mutedForeground: '#b4b4b4',\n card: '#1a1a1a',\n cardForeground: '#ffffff',\n popover: '#1a1a1a',\n popoverForeground: '#ffffff',\n border: '#3a3a3a',\n input: '#3a3a3a',\n accent: '#3b82f6',\n accentForeground: '#ffffff',\n destructive: '#dc2626',\n destructiveForeground: '#ffffff',\n ring: '#60a5fa',\n }\n : {\n primary: lightColors[`${appliedPrimaryColor}9`],\n contentBg: lightColors['00dp'],\n hiContrast: lightColors.deepBlue11,\n loContrast: 'white',\n focusOutline: 'hsl(216, 100%, 64%)',\n divider: 'hsl(207, 10%, 82%)',\n background: '#fcfcfc',\n foreground: '#1a1a1a',\n muted: '#f4f4f4',\n mutedForeground: '#646464',\n card: '#ffffff',\n cardForeground: '#1a1a1a',\n popover: '#ffffff',\n popoverForeground: '#1a1a1a',\n border: '#e3e3e3',\n input: '#e3e3e3',\n accent: '#60a5fa',\n accentForeground: '#ffffff',\n destructive: '#dc2626',\n destructiveForeground: '#ffffff',\n ring: '#3b82f6',\n };\n\n const colors = {\n ...baseColors,\n ...semanticColors,\n };\n\n // Apply the theme class synchronously before paint\n useIsomorphicLayoutEffect(() => {\n const themeClass = themes[resolvedTheme][appliedPrimaryColor];\n\n Object.values(themes.light).forEach((cls) => document.body.classList.remove(cls));\n Object.values(themes.dark).forEach((cls) => document.body.classList.remove(cls));\n\n document.body.classList.add(themeClass);\n\n return () => {\n document.body.classList.remove(themeClass);\n };\n }, [resolvedTheme, appliedPrimaryColor]);\n\n const contextValue: ThemeContextValue = {\n mode,\n resolvedTheme,\n primaryColor: appliedPrimaryColor,\n colors,\n setMode,\n setPrimaryColor,\n };\n\n return <ThemeContext.Provider value={contextValue}>{children}</ThemeContext.Provider>;\n}\n\nexport function useVanillaExtractTheme() {\n const context = useContext(ThemeContext);\n if (context === undefined) {\n throw new Error('useVanillaExtractTheme must be used within a VanillaExtractThemeProvider');\n }\n return context;\n}\n"],"mappings":";;;;;;AAkBA,IAAM,eAAe,cAA6C,KAAA,CAAS;AAS3E,SAAgB,4BAA4B,EAC1C,UACA,eAAe,UACf,eAAe,QACf,eACmC;CACnC,MAAM,CAAC,MAAM,WAAW,SAAoB,YAAY;CACxD,MAAM,CAAC,qBAAqB,mBAAmB,SAAuB,YAAY;CAClF,MAAM,CAAC,aAAa,kBAAkB,eAAiC;EACrE,IAAI,aACF,OAAO;EAET,IAAI,OAAO,WAAW,aACpB,OAAO,OAAO,WA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cAAc,CAAC;EAEzC,OAAO,OAAO,OAAO,KAAK,CAAC,CAAC,SAAS,QAAQ,SAAS,KAAK,UAAU,OAAO,GAAG,CAAC;EAChF,OAAO,OAAO,OAAO,IAAI,CAAC,CAAC,SAAS,QAAQ,SAAS,KAAK,UAAU,OAAO,GAAG,CAAC;EAE/E,SAAS,KAAK,UAAU,IAAI,UAAU;EAEtC,aAAa;GACX,SAAS,KAAK,UAAU,OAAO,UAAU;EAC3C;CACF,GAAG,CAAC,eAAe,mBAAmB,CAAC;CAEvC,MAAM,eAAkC;EACtC;EACA;EACA,cAAc;EACd;EACA;EACA;CACF;CAEA,OAAO,oBAAC,aAAa,UAAd;EAAuB,OAAO;EAAe;CAAgC,CAAA;AACtF;AAEA,SAAgB,yBAAyB;CACvC,MAAM,UAAU,WAAW,YAAY;CACvC,IAAI,YAAY,KAAA,GACd,MAAM,IAAI,MAAM,0EAA0E;CAE5F,OAAO;AACT"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
let react = require("react");
|
|
2
|
+
// utils/useIsomorphicLayoutEffect.ts
|
|
3
|
+
var useIsomorphicLayoutEffect = typeof window !== "undefined" ? react.useLayoutEffect : react.useEffect;
|
|
4
|
+
exports.useIsomorphicLayoutEffect = useIsomorphicLayoutEffect;
|
|
5
|
+
|
|
6
|
+
//# sourceMappingURL=useIsomorphicLayoutEffect.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useIsomorphicLayoutEffect.cjs","names":["useLayoutEffect","useEffect"],"sources":["../../utils/useIsomorphicLayoutEffect.ts"],"sourcesContent":["import { useEffect, useLayoutEffect } from 'react';\n\n// React 18 warns when useLayoutEffect runs during server rendering, where it does nothing anyway.\nexport const useIsomorphicLayoutEffect =\n typeof window !== 'undefined' ? useLayoutEffect : useEffect;\n"],"mappings":";;AAGA,IAAa,4BACX,OAAO,WAAW,cAAcA,MAAAA,kBAAkBC,MAAAA"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { useEffect, useLayoutEffect } from "react";
|
|
2
|
+
// utils/useIsomorphicLayoutEffect.ts
|
|
3
|
+
var useIsomorphicLayoutEffect = typeof window !== "undefined" ? useLayoutEffect : useEffect;
|
|
4
|
+
export { useIsomorphicLayoutEffect };
|
|
5
|
+
|
|
6
|
+
//# sourceMappingURL=useIsomorphicLayoutEffect.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useIsomorphicLayoutEffect.js","names":[],"sources":["../../utils/useIsomorphicLayoutEffect.ts"],"sourcesContent":["import { useEffect, useLayoutEffect } from 'react';\n\n// React 18 warns when useLayoutEffect runs during server rendering, where it does nothing anyway.\nexport const useIsomorphicLayoutEffect =\n typeof window !== 'undefined' ? useLayoutEffect : useEffect;\n"],"mappings":";;AAGA,IAAa,4BACX,OAAO,WAAW,cAAc,kBAAkB"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@traefik-labs/faency",
|
|
3
3
|
"description": "Traefik Labs design system",
|
|
4
|
-
"version": "13.
|
|
4
|
+
"version": "13.1.1",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"traefiklabs",
|
|
@@ -95,16 +95,16 @@
|
|
|
95
95
|
"@babel/preset-env": "7.29.7",
|
|
96
96
|
"@babel/preset-react": "7.29.7",
|
|
97
97
|
"@babel/preset-typescript": "7.29.7",
|
|
98
|
-
"@eslint-react/eslint-plugin": "
|
|
98
|
+
"@eslint-react/eslint-plugin": "5.28.8",
|
|
99
99
|
"@eslint/js": "10.0.1",
|
|
100
100
|
"@semantic-release/commit-analyzer": "13.0.1",
|
|
101
101
|
"@semantic-release/github": "12.0.10",
|
|
102
102
|
"@semantic-release/npm": "13.2.0",
|
|
103
103
|
"@semantic-release/release-notes-generator": "14.1.1",
|
|
104
|
-
"@storybook/addon-docs": "10.6.
|
|
105
|
-
"@storybook/addon-links": "10.6.
|
|
106
|
-
"@storybook/builder-vite": "10.6.
|
|
107
|
-
"@storybook/react-vite": "10.6.
|
|
104
|
+
"@storybook/addon-docs": "10.6.5",
|
|
105
|
+
"@storybook/addon-links": "10.6.5",
|
|
106
|
+
"@storybook/builder-vite": "10.6.5",
|
|
107
|
+
"@storybook/react-vite": "10.6.5",
|
|
108
108
|
"@testing-library/dom": "10.4.2",
|
|
109
109
|
"@testing-library/jest-dom": "7.0.1",
|
|
110
110
|
"@testing-library/react": "16.3.3",
|
|
@@ -122,13 +122,13 @@
|
|
|
122
122
|
"babel-jest": "30.5.2",
|
|
123
123
|
"conventional-changelog-conventionalcommits": "9.3.1",
|
|
124
124
|
"cross-env": "10.1.0",
|
|
125
|
-
"eslint": "10.
|
|
125
|
+
"eslint": "10.14.0",
|
|
126
126
|
"eslint-config-prettier": "10.1.8",
|
|
127
127
|
"eslint-plugin-jsx-a11y": "6.10.2",
|
|
128
128
|
"eslint-plugin-prettier": "5.5.7",
|
|
129
129
|
"eslint-plugin-simple-import-sort": "14.0.0",
|
|
130
|
-
"eslint-plugin-storybook": "10.6.
|
|
131
|
-
"globals": "17.
|
|
130
|
+
"eslint-plugin-storybook": "10.6.5",
|
|
131
|
+
"globals": "17.14.0",
|
|
132
132
|
"husky": "9.1.7",
|
|
133
133
|
"jest": "30.5.2",
|
|
134
134
|
"jest-axe": "11.0.0",
|
|
@@ -139,18 +139,18 @@
|
|
|
139
139
|
"react": "18.3.1",
|
|
140
140
|
"react-dom": "18.3.1",
|
|
141
141
|
"semantic-release": "25.0.9",
|
|
142
|
-
"storybook": "10.6.
|
|
142
|
+
"storybook": "10.6.5",
|
|
143
143
|
"typescript": "5.8.3",
|
|
144
|
-
"typescript-eslint": "8.72.
|
|
144
|
+
"typescript-eslint": "8.72.1",
|
|
145
145
|
"vite": "8.3.5",
|
|
146
146
|
"vite-plugin-dts": "4.5.4"
|
|
147
147
|
},
|
|
148
148
|
"resolutions": {
|
|
149
|
-
"@typescript-eslint/tsconfig-utils": "8.72.
|
|
150
|
-
"@typescript-eslint/types": "8.72.
|
|
149
|
+
"@typescript-eslint/tsconfig-utils": "8.72.1",
|
|
150
|
+
"@typescript-eslint/types": "8.72.1",
|
|
151
151
|
"bundle-name": "4.1.1",
|
|
152
|
-
"magic-string@^1.1.0": "1.4.
|
|
153
|
-
"postcss": "8.5.
|
|
152
|
+
"magic-string@^1.1.0": "1.4.5",
|
|
153
|
+
"postcss": "8.5.32"
|
|
154
154
|
},
|
|
155
155
|
"publishConfig": {
|
|
156
156
|
"access": "public",
|