boreal-ui 0.0.58 → 0.0.59
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/core/boreal-ui.css +6 -1
- package/dist/next/{CommandPalette-BjWNxV19.cjs → CommandPalette-CJhd23B2.cjs} +2 -2
- package/dist/next/{CommandPalette-BjWNxV19.cjs.map → CommandPalette-CJhd23B2.cjs.map} +1 -1
- package/dist/next/{CommandPalette-Cqvf4Biz.js → CommandPalette-GeFIL9EG.js} +2 -2
- package/dist/next/{CommandPalette-Cqvf4Biz.js.map → CommandPalette-GeFIL9EG.js.map} +1 -1
- package/dist/next/CommandPalette.cjs.js +1 -1
- package/dist/next/CommandPalette.js +1 -1
- package/dist/next/{TagInput-luTKMQg-.js → TagInput-BBDft9tw.js} +2 -2
- package/dist/next/{TagInput-luTKMQg-.js.map → TagInput-BBDft9tw.js.map} +1 -1
- package/dist/next/{TagInput-CPco8A19.cjs → TagInput-BdKQoh2d.cjs} +2 -2
- package/dist/next/{TagInput-CPco8A19.cjs.map → TagInput-BdKQoh2d.cjs.map} +1 -1
- package/dist/next/TagInput.cjs.js +1 -1
- package/dist/next/TagInput.js +1 -1
- package/dist/next/{TextInput-bmBWt-F6.cjs → TextInput-DPArjoEr.cjs} +25 -25
- package/dist/next/{TextInput-bmBWt-F6.cjs.map → TextInput-DPArjoEr.cjs.map} +1 -1
- package/dist/next/{TextInput-C8rQAwus.js → TextInput-dwn3uD65.js} +25 -25
- package/dist/next/{TextInput-C8rQAwus.js.map → TextInput-dwn3uD65.js.map} +1 -1
- package/dist/next/TextInput.cjs.js +1 -1
- package/dist/next/TextInput.js +1 -1
- package/dist/next/boreal-ui.css +70 -65
- package/dist/next/index.cjs.js +3 -3
- package/dist/next/index.js +3 -3
- package/package.json +1 -1
package/dist/core/boreal-ui.css
CHANGED
|
@@ -10567,7 +10567,12 @@ a:hover {
|
|
|
10567
10567
|
.textInput_icon_container {
|
|
10568
10568
|
display: flex;
|
|
10569
10569
|
box-sizing: border-box;
|
|
10570
|
-
margin: 0.
|
|
10570
|
+
margin: 0.5rem;
|
|
10571
|
+
}
|
|
10572
|
+
@media (width <= 319.98px) {
|
|
10573
|
+
.textInput_icon_container {
|
|
10574
|
+
margin: 0.1rem;
|
|
10575
|
+
}
|
|
10571
10576
|
}
|
|
10572
10577
|
.textInput_icon_container svg {
|
|
10573
10578
|
width: 1em;
|
|
@@ -6,7 +6,7 @@ const classNames = require("./classNames-BcWMx052.cjs");
|
|
|
6
6
|
const capitalize = require("./capitalize-DoV-nOmN.cjs");
|
|
7
7
|
const borealStyleConfig = require("./boreal-style-config-Rr5d5Qts.cjs");
|
|
8
8
|
;/* empty css */
|
|
9
|
-
const TextInput = require("./TextInput-
|
|
9
|
+
const TextInput = require("./TextInput-DPArjoEr.cjs");
|
|
10
10
|
const CommandPaletteBase = ({
|
|
11
11
|
commands,
|
|
12
12
|
placeholder = "Search...",
|
|
@@ -312,4 +312,4 @@ const CommandPalette = (props) => /* @__PURE__ */ require$$2.jsx(
|
|
|
312
312
|
);
|
|
313
313
|
CommandPalette.displayName = "CommandPalette";
|
|
314
314
|
exports.CommandPalette = CommandPalette;
|
|
315
|
-
//# sourceMappingURL=CommandPalette-
|
|
315
|
+
//# sourceMappingURL=CommandPalette-CJhd23B2.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CommandPalette-BjWNxV19.cjs","sources":["../../src/components/CommandPalette/CommandPaletteBase.tsx","../../src/components/CommandPalette/next/CommandPalette.tsx"],"sourcesContent":["import React, {\r\n useEffect,\r\n useRef,\r\n useState,\r\n useCallback,\r\n KeyboardEvent,\r\n} from \"react\";\r\nimport ReactDOM from \"react-dom\";\r\nimport { combineClassNames } from \"../../utils/classNames\";\r\nimport type { CommandPaletteProps } from \"./CommandPalette.types\";\r\nimport { capitalize } from \"../../utils/capitalize\";\r\nimport {\r\n getDefaultRounding,\r\n getDefaultShadow,\r\n getDefaultTheme,\r\n} from \"../../config/boreal-style-config\";\r\n\r\nexport interface CommandPaletteBaseProps extends CommandPaletteProps {\r\n classMap: Record<string, string>;\r\n TextInputComponent: React.ElementType;\r\n}\r\n\r\nconst CommandPaletteBase: React.FC<CommandPaletteBaseProps> = ({\r\n commands,\r\n placeholder = \"Search...\",\r\n isOpen,\r\n onClose,\r\n asyncSearch,\r\n debounceMs = 300,\r\n theme = getDefaultTheme(),\r\n rounding = getDefaultRounding(),\r\n shadow = getDefaultShadow(),\r\n state = \"\",\r\n classMap,\r\n TextInputComponent,\r\n \"data-testid\": testId = \"command-palette\",\r\n className,\r\n}) => {\r\n const [query, setQuery] = useState(\"\");\r\n const [activeIndex, setActiveIndex] = useState<number>(-1);\r\n const inputRef = useRef<HTMLInputElement>(null);\r\n const [mounted, setMounted] = useState(false);\r\n const [portalElement, setPortalElement] = useState<HTMLElement | null>(null);\r\n const [asyncResults, setAsyncResults] = useState<typeof commands>([]);\r\n const [isLoading, setIsLoading] = useState(false);\r\n const debounceRef = useRef<ReturnType<typeof setTimeout> | null>(null);\r\n const prevFocusRef = useRef<HTMLElement | null>(null);\r\n\r\n const filtered = asyncSearch\r\n ? asyncResults\r\n : commands.filter((cmd) =>\r\n cmd.label.toLowerCase().includes(query.toLowerCase())\r\n );\r\n\r\n useEffect(() => {\r\n if (filtered.length === 0) {\r\n setActiveIndex(-1);\r\n } else if (activeIndex < 0 || activeIndex >= filtered.length) {\r\n setActiveIndex(0);\r\n }\r\n }, [filtered, activeIndex]);\r\n\r\n useEffect(() => {\r\n if (!asyncSearch) return;\r\n\r\n if (debounceRef.current) clearTimeout(debounceRef.current);\r\n\r\n const q = query.trim();\r\n if (!q) {\r\n setAsyncResults([]);\r\n setIsLoading(false);\r\n return;\r\n }\r\n\r\n setIsLoading(true);\r\n debounceRef.current = setTimeout(() => {\r\n asyncSearch(q)\r\n .then((results) => {\r\n setAsyncResults(results);\r\n setIsLoading(false);\r\n })\r\n .catch(() => {\r\n setAsyncResults([]);\r\n setIsLoading(false);\r\n });\r\n }, debounceMs);\r\n\r\n return () => {\r\n if (debounceRef.current) clearTimeout(debounceRef.current);\r\n };\r\n }, [query, asyncSearch, debounceMs]);\r\n\r\n useEffect(() => {\r\n if (!isOpen) return;\r\n\r\n setMounted(true);\r\n prevFocusRef.current = (document.activeElement as HTMLElement) ?? null;\r\n\r\n const portal =\r\n document.getElementById(\"widget-portal\") ||\r\n (() => {\r\n const el = document.createElement(\"div\");\r\n el.id = \"widget-portal\";\r\n document.body.appendChild(el);\r\n return el;\r\n })();\r\n\r\n setPortalElement(portal);\r\n document.body.classList.add(\"noScroll\");\r\n\r\n return () => {\r\n document.body.classList.remove(\"noScroll\");\r\n setQuery(\"\");\r\n setActiveIndex(-1);\r\n setMounted(false);\r\n prevFocusRef.current?.focus?.();\r\n };\r\n }, [isOpen]);\r\n\r\n useEffect(() => {\r\n if (isOpen && inputRef.current) inputRef.current.focus();\r\n }, [isOpen]);\r\n\r\n const handleKeyDown = useCallback(\r\n (e: KeyboardEvent<HTMLInputElement>) => {\r\n if (e.key === \"ArrowDown\") {\r\n if (filtered.length === 0) return;\r\n e.preventDefault();\r\n setActiveIndex((prev) => (prev + 1) % filtered.length);\r\n } else if (e.key === \"ArrowUp\") {\r\n if (filtered.length === 0) return;\r\n e.preventDefault();\r\n setActiveIndex(\r\n (prev) => (prev - 1 + filtered.length) % filtered.length\r\n );\r\n } else if (e.key === \"Enter\") {\r\n if (activeIndex >= 0 && filtered[activeIndex]) {\r\n filtered[activeIndex].action();\r\n onClose();\r\n }\r\n } else if (e.key === \"Escape\") {\r\n onClose();\r\n }\r\n },\r\n [filtered, activeIndex, onClose]\r\n );\r\n\r\n const handleContainerKeyDown = useCallback(\r\n (e: KeyboardEvent<HTMLDivElement>) => {\r\n if (e.key === \"Escape\") onClose();\r\n },\r\n [onClose]\r\n );\r\n\r\n if (!isOpen || !mounted || !portalElement) return null;\r\n\r\n const listId = `${testId}-list`;\r\n\r\n return ReactDOM.createPortal(\r\n <div\r\n className={classMap.overlay}\r\n onClick={onClose}\r\n data-testid={`${testId}-overlay`}\r\n >\r\n <div\r\n className={combineClassNames(\r\n classMap.command_palette,\r\n classMap[theme],\r\n classMap[state],\r\n shadow && classMap[`shadow${capitalize(shadow)}`],\r\n rounding && classMap[`round${capitalize(rounding)}`],\r\n className\r\n )}\r\n onClick={(e) => e.stopPropagation()}\r\n onKeyDown={handleContainerKeyDown}\r\n role=\"dialog\"\r\n aria-modal=\"true\"\r\n aria-label=\"Command palette\"\r\n data-testid={testId}\r\n >\r\n <TextInputComponent\r\n ref={inputRef}\r\n type=\"text\"\r\n value={query}\r\n onChange={(e: React.ChangeEvent<HTMLInputElement>) =>\r\n setQuery(e.target.value)\r\n }\r\n onKeyDown={handleKeyDown}\r\n placeholder={placeholder}\r\n theme={theme}\r\n state={state}\r\n shadow={\"none\"}\r\n rounding={rounding}\r\n className={classMap.input}\r\n data-testid={`${testId}-input`}\r\n role=\"combobox\"\r\n aria-autocomplete=\"list\"\r\n aria-haspopup=\"listbox\"\r\n aria-expanded={filtered.length > 0}\r\n aria-controls={listId}\r\n aria-activedescendant={\r\n activeIndex >= 0 ? `cmd-${activeIndex}` : undefined\r\n }\r\n />\r\n\r\n <ul\r\n id={listId}\r\n className={classMap.list}\r\n role=\"listbox\"\r\n aria-label=\"Command suggestions\"\r\n aria-busy={isLoading || undefined}\r\n >\r\n {isLoading ? (\r\n <li\r\n className={combineClassNames(classMap.item, classMap.empty)}\r\n role=\"option\"\r\n aria-disabled=\"true\"\r\n aria-selected=\"false\"\r\n >\r\n Searching…\r\n </li>\r\n ) : filtered.length > 0 ? (\r\n filtered.map((cmd, index) => (\r\n <li\r\n key={`${cmd.label}-${index}`}\r\n id={`cmd-${index}`}\r\n role=\"option\"\r\n aria-selected={index === activeIndex}\r\n className={combineClassNames(\r\n classMap.item,\r\n classMap[theme],\r\n index === activeIndex && classMap.active\r\n )}\r\n onClick={() => {\r\n cmd.action();\r\n onClose();\r\n }}\r\n >\r\n {cmd.icon && (\r\n <span className={classMap.icon} aria-hidden=\"true\">\r\n {cmd.icon}\r\n </span>\r\n )}\r\n {cmd.label}\r\n </li>\r\n ))\r\n ) : (\r\n <li\r\n role=\"option\"\r\n aria-selected=\"false\"\r\n aria-disabled=\"true\"\r\n className={combineClassNames(classMap.item, classMap.empty)}\r\n >\r\n No matching results\r\n </li>\r\n )}\r\n </ul>\r\n </div>\r\n </div>,\r\n portalElement\r\n );\r\n};\r\nCommandPaletteBase.displayName = \"CommandPaletteBase\";\r\nexport default CommandPaletteBase;\r\n","\"use client\";\r\n\r\nimport React from \"react\";\r\nimport CommandPaletteBase from \"../CommandPaletteBase\";\r\nimport styles from \"./CommandPalette.module.scss\";\r\nimport { TextInput } from \"@/index.next\";\r\nimport { CommandPaletteProps } from \"../CommandPalette.types\";\r\n\r\nconst CommandPalette: React.FC<CommandPaletteProps> = (props) => (\r\n <CommandPaletteBase\r\n {...props}\r\n classMap={styles}\r\n TextInputComponent={TextInput}\r\n />\r\n);\r\nCommandPalette.displayName = \"CommandPalette\";\r\nexport default CommandPalette;\r\n"],"names":["getDefaultTheme","getDefaultRounding","getDefaultShadow","useState","useRef","useEffect","useCallback","jsx","jsxs","combineClassNames","capitalize","TextInput"],"mappings":";;;;;;;;;AAsBA,MAAM,qBAAwD,CAAC;AAAA,EAC7D;AAAA,EACA,cAAc;AAAA,EACd;AAAA,EACA;AAAA,EACA;AAAA,EACA,aAAa;AAAA,EACb,QAAQA,kBAAAA,gBAAA;AAAA,EACR,WAAWC,kBAAAA,mBAAA;AAAA,EACX,SAASC,kBAAAA,iBAAA;AAAA,EACT,QAAQ;AAAA,EACR;AAAA,EACA;AAAA,EACA,eAAe,SAAS;AAAA,EACxB;AACF,MAAM;AACJ,QAAM,CAAC,OAAO,QAAQ,IAAIC,MAAAA,SAAS,EAAE;AACrC,QAAM,CAAC,aAAa,cAAc,IAAIA,MAAAA,SAAiB,EAAE;AACzD,QAAM,WAAWC,MAAAA,OAAyB,IAAI;AAC9C,Q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A,MACF;AAAA,IAAA;AAAA,IAEF;AAAA,EAAA;AAEJ;AACA,mBAAmB,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AC9PjC,MAAM,iBAAgD,CAAC,UACrDF,2BAAAA;AAAAA,EAAC;AAAA,EAAA;AAAA,IACE,GAAG;AAAA,IACJ,UAAU;AAAA,IACV,oBAAoBI,UAAAA;AAAAA,EAAA;AACtB;AAEF,eAAe,cAAc;;"}
|
|
1
|
+
{"version":3,"file":"CommandPalette-CJhd23B2.cjs","sources":["../../src/components/CommandPalette/CommandPaletteBase.tsx","../../src/components/CommandPalette/next/CommandPalette.tsx"],"sourcesContent":["import React, {\r\n useEffect,\r\n useRef,\r\n useState,\r\n useCallback,\r\n KeyboardEvent,\r\n} from \"react\";\r\nimport ReactDOM from \"react-dom\";\r\nimport { combineClassNames } from \"../../utils/classNames\";\r\nimport type { CommandPaletteProps } from \"./CommandPalette.types\";\r\nimport { capitalize } from \"../../utils/capitalize\";\r\nimport {\r\n getDefaultRounding,\r\n getDefaultShadow,\r\n getDefaultTheme,\r\n} from \"../../config/boreal-style-config\";\r\n\r\nexport interface CommandPaletteBaseProps extends CommandPaletteProps {\r\n classMap: Record<string, string>;\r\n TextInputComponent: React.ElementType;\r\n}\r\n\r\nconst CommandPaletteBase: React.FC<CommandPaletteBaseProps> = ({\r\n commands,\r\n placeholder = \"Search...\",\r\n isOpen,\r\n onClose,\r\n asyncSearch,\r\n debounceMs = 300,\r\n theme = getDefaultTheme(),\r\n rounding = getDefaultRounding(),\r\n shadow = getDefaultShadow(),\r\n state = \"\",\r\n classMap,\r\n TextInputComponent,\r\n \"data-testid\": testId = \"command-palette\",\r\n className,\r\n}) => {\r\n const [query, setQuery] = useState(\"\");\r\n const [activeIndex, setActiveIndex] = useState<number>(-1);\r\n const inputRef = useRef<HTMLInputElement>(null);\r\n const [mounted, setMounted] = useState(false);\r\n const [portalElement, setPortalElement] = useState<HTMLElement | null>(null);\r\n const [asyncResults, setAsyncResults] = useState<typeof commands>([]);\r\n const [isLoading, setIsLoading] = useState(false);\r\n const debounceRef = useRef<ReturnType<typeof setTimeout> | null>(null);\r\n const prevFocusRef = useRef<HTMLElement | null>(null);\r\n\r\n const filtered = asyncSearch\r\n ? asyncResults\r\n : commands.filter((cmd) =>\r\n cmd.label.toLowerCase().includes(query.toLowerCase())\r\n );\r\n\r\n useEffect(() => {\r\n if (filtered.length === 0) {\r\n setActiveIndex(-1);\r\n } else if (activeIndex < 0 || activeIndex >= filtered.length) {\r\n setActiveIndex(0);\r\n }\r\n }, [filtered, activeIndex]);\r\n\r\n useEffect(() => {\r\n if (!asyncSearch) return;\r\n\r\n if (debounceRef.current) clearTimeout(debounceRef.current);\r\n\r\n const q = query.trim();\r\n if (!q) {\r\n setAsyncResults([]);\r\n setIsLoading(false);\r\n return;\r\n }\r\n\r\n setIsLoading(true);\r\n debounceRef.current = setTimeout(() => {\r\n asyncSearch(q)\r\n .then((results) => {\r\n setAsyncResults(results);\r\n setIsLoading(false);\r\n })\r\n .catch(() => {\r\n setAsyncResults([]);\r\n setIsLoading(false);\r\n });\r\n }, debounceMs);\r\n\r\n return () => {\r\n if (debounceRef.current) clearTimeout(debounceRef.current);\r\n };\r\n }, [query, asyncSearch, debounceMs]);\r\n\r\n useEffect(() => {\r\n if (!isOpen) return;\r\n\r\n setMounted(true);\r\n prevFocusRef.current = (document.activeElement as HTMLElement) ?? null;\r\n\r\n const portal =\r\n document.getElementById(\"widget-portal\") ||\r\n (() => {\r\n const el = document.createElement(\"div\");\r\n el.id = \"widget-portal\";\r\n document.body.appendChild(el);\r\n return el;\r\n })();\r\n\r\n setPortalElement(portal);\r\n document.body.classList.add(\"noScroll\");\r\n\r\n return () => {\r\n document.body.classList.remove(\"noScroll\");\r\n setQuery(\"\");\r\n setActiveIndex(-1);\r\n setMounted(false);\r\n prevFocusRef.current?.focus?.();\r\n };\r\n }, [isOpen]);\r\n\r\n useEffect(() => {\r\n if (isOpen && inputRef.current) inputRef.current.focus();\r\n }, [isOpen]);\r\n\r\n const handleKeyDown = useCallback(\r\n (e: KeyboardEvent<HTMLInputElement>) => {\r\n if (e.key === \"ArrowDown\") {\r\n if (filtered.length === 0) return;\r\n e.preventDefault();\r\n setActiveIndex((prev) => (prev + 1) % filtered.length);\r\n } else if (e.key === \"ArrowUp\") {\r\n if (filtered.length === 0) return;\r\n e.preventDefault();\r\n setActiveIndex(\r\n (prev) => (prev - 1 + filtered.length) % filtered.length\r\n );\r\n } else if (e.key === \"Enter\") {\r\n if (activeIndex >= 0 && filtered[activeIndex]) {\r\n filtered[activeIndex].action();\r\n onClose();\r\n }\r\n } else if (e.key === \"Escape\") {\r\n onClose();\r\n }\r\n },\r\n [filtered, activeIndex, onClose]\r\n );\r\n\r\n const handleContainerKeyDown = useCallback(\r\n (e: KeyboardEvent<HTMLDivElement>) => {\r\n if (e.key === \"Escape\") onClose();\r\n },\r\n [onClose]\r\n );\r\n\r\n if (!isOpen || !mounted || !portalElement) return null;\r\n\r\n const listId = `${testId}-list`;\r\n\r\n return ReactDOM.createPortal(\r\n <div\r\n className={classMap.overlay}\r\n onClick={onClose}\r\n data-testid={`${testId}-overlay`}\r\n >\r\n <div\r\n className={combineClassNames(\r\n classMap.command_palette,\r\n classMap[theme],\r\n classMap[state],\r\n shadow && classMap[`shadow${capitalize(shadow)}`],\r\n rounding && classMap[`round${capitalize(rounding)}`],\r\n className\r\n )}\r\n onClick={(e) => e.stopPropagation()}\r\n onKeyDown={handleContainerKeyDown}\r\n role=\"dialog\"\r\n aria-modal=\"true\"\r\n aria-label=\"Command palette\"\r\n data-testid={testId}\r\n >\r\n <TextInputComponent\r\n ref={inputRef}\r\n type=\"text\"\r\n value={query}\r\n onChange={(e: React.ChangeEvent<HTMLInputElement>) =>\r\n setQuery(e.target.value)\r\n }\r\n onKeyDown={handleKeyDown}\r\n placeholder={placeholder}\r\n theme={theme}\r\n state={state}\r\n shadow={\"none\"}\r\n rounding={rounding}\r\n className={classMap.input}\r\n data-testid={`${testId}-input`}\r\n role=\"combobox\"\r\n aria-autocomplete=\"list\"\r\n aria-haspopup=\"listbox\"\r\n aria-expanded={filtered.length > 0}\r\n aria-controls={listId}\r\n aria-activedescendant={\r\n activeIndex >= 0 ? `cmd-${activeIndex}` : undefined\r\n }\r\n />\r\n\r\n <ul\r\n id={listId}\r\n className={classMap.list}\r\n role=\"listbox\"\r\n aria-label=\"Command suggestions\"\r\n aria-busy={isLoading || undefined}\r\n >\r\n {isLoading ? (\r\n <li\r\n className={combineClassNames(classMap.item, classMap.empty)}\r\n role=\"option\"\r\n aria-disabled=\"true\"\r\n aria-selected=\"false\"\r\n >\r\n Searching…\r\n </li>\r\n ) : filtered.length > 0 ? (\r\n filtered.map((cmd, index) => (\r\n <li\r\n key={`${cmd.label}-${index}`}\r\n id={`cmd-${index}`}\r\n role=\"option\"\r\n aria-selected={index === activeIndex}\r\n className={combineClassNames(\r\n classMap.item,\r\n classMap[theme],\r\n index === activeIndex && classMap.active\r\n )}\r\n onClick={() => {\r\n cmd.action();\r\n onClose();\r\n }}\r\n >\r\n {cmd.icon && (\r\n <span className={classMap.icon} aria-hidden=\"true\">\r\n {cmd.icon}\r\n </span>\r\n )}\r\n {cmd.label}\r\n </li>\r\n ))\r\n ) : (\r\n <li\r\n role=\"option\"\r\n aria-selected=\"false\"\r\n aria-disabled=\"true\"\r\n className={combineClassNames(classMap.item, classMap.empty)}\r\n >\r\n No matching results\r\n </li>\r\n )}\r\n </ul>\r\n </div>\r\n </div>,\r\n portalElement\r\n );\r\n};\r\nCommandPaletteBase.displayName = \"CommandPaletteBase\";\r\nexport default CommandPaletteBase;\r\n","\"use client\";\r\n\r\nimport React from \"react\";\r\nimport CommandPaletteBase from \"../CommandPaletteBase\";\r\nimport styles from \"./CommandPalette.module.scss\";\r\nimport { TextInput } from \"@/index.next\";\r\nimport { CommandPaletteProps } from \"../CommandPalette.types\";\r\n\r\nconst CommandPalette: React.FC<CommandPaletteProps> = (props) => (\r\n <CommandPaletteBase\r\n {...props}\r\n classMap={styles}\r\n TextInputComponent={TextInput}\r\n />\r\n);\r\nCommandPalette.displayName = \"CommandPalette\";\r\nexport default CommandPalette;\r\n"],"names":["getDefaultTheme","getDefaultRounding","getDefaultShadow","useState","useRef","useEffect","useCallback","jsx","jsxs","combineClassNames","capitalize","TextInput"],"mappings":";;;;;;;;;AAsBA,MAAM,qBAAwD,CAAC;AAAA,EAC7D;AAAA,EACA,cAAc;AAAA,EACd;AAAA,EACA;AAAA,EACA;AAAA,EACA,aAAa;AAAA,EACb,QAAQA,kBAAAA,gBAAA;AAAA,EACR,WAAWC,kBAAAA,mBAAA;AAAA,EACX,SAASC,kBAAAA,iBAAA;AAAA,EACT,QAAQ;AAAA,EACR;AAAA,EACA;AAAA,EACA,eAAe,SAAS;AAAA,EACxB;AACF,MAAM;AACJ,QAAM,CAAC,OAAO,QAAQ,IAAIC,MAAAA,SAAS,EAAE;AACrC,QAAM,CAAC,aAAa,cAAc,IAAIA,MAAAA,SAAiB,EAAE;AACzD,QAAM,WAAWC,MAAAA,OAAyB,IAAI;AAC9C,QAAM,CAAC,SAAS,UAAU,IAAID,MAAAA,SAAS,KAAK;AAC5C,QAAM,CAAC,eAAe,gBAAgB,IAAIA,MAAAA,SAA6B,IAAI;AAC3E,QAAM,CAAC,cAAc,eAAe,IAAIA,MAAAA,SAA0B,CAAA,CAAE;AACpE,QAAM,CAAC,WAAW,YAAY,IAAIA,MAAAA,SAAS,KAAK;AAChD,QAAM,cAAcC,MAAAA,OAA6C,IAAI;AACrE,QAAM,eAAeA,MAAAA,OAA2B,IAAI;AAEpD,QAAM,WAAW,cACb,eACA,SAAS;AAAA,IAAO,CAAC,QACf,IAAI,MAAM,cAAc,SAAS,MAAM,YAAA,CAAa;AAAA,EAAA;AAG1DC,QAAAA,UAAU,MAAM;AACd,QAAI,SAAS,WAAW,GAAG;AACzB,qBAAe,EAAE;AAAA,I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,KAAK;AAAA,sBAChB,MAAK;AAAA,sBACL,iBAAe,UAAU;AAAA,sBACzB,WAAWC,WAAAA;AAAAA,wBACT,SAAS;AAAA,wBACT,SAAS,KAAK;AAAA,wBACd,UAAU,eAAe,SAAS;AAAA,sBAAA;AAAA,sBAEpC,SAAS,MAAM;AACb,4BAAI,OAAA;AACJ,gCAAA;AAAA,sBACF;AAAA,sBAEC,UAAA;AAAA,wBAAA,IAAI,uCACF,QAAA,EAAK,WAAW,SAAS,MAAM,eAAY,QACzC,UAAA,IAAI,KAAA,CACP;AAAA,wBAED,IAAI;AAAA,sBAAA;AAAA,oBAAA;AAAA,oBAnBA,GAAG,IAAI,KAAK,IAAI,KAAK;AAAA,kBAAA,CAqB7B,IAEDF,2BAAAA;AAAAA,oBAAC;AAAA,oBAAA;AAAA,sBACC,MAAK;AAAA,sBACL,iBAAc;AAAA,sBACd,iBAAc;AAAA,sBACd,WAAWE,WAAAA,kBAAkB,SAAS,MAAM,SAAS,KAAK;AAAA,sBAC3D,UAAA;AAAA,oBAAA;AAAA,kBAAA;AAAA,gBAED;AAAA,cAAA;AAAA,YAEJ;AAAA,UAAA;AAAA,QAAA;AAAA,MACF;AAAA,IAAA;AAAA,IAEF;AAAA,EAAA;AAEJ;AACA,mBAAmB,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AC9PjC,MAAM,iBAAgD,CAAC,UACrDF,2BAAAA;AAAAA,EAAC;AAAA,EAAA;AAAA,IACE,GAAG;AAAA,IACJ,UAAU;AAAA,IACV,oBAAoBI,UAAAA;AAAAA,EAAA;AACtB;AAEF,eAAe,cAAc;;"}
|
|
@@ -5,7 +5,7 @@ import { c as combineClassNames } from "./classNames-AS8QjFq7.js";
|
|
|
5
5
|
import { c as capitalize } from "./capitalize-C0TSQSPh.js";
|
|
6
6
|
import { a as getDefaultRounding, d as getDefaultTheme, b as getDefaultShadow } from "./boreal-style-config-BILmxkZG.js";
|
|
7
7
|
/* empty css */
|
|
8
|
-
import { T as TextInput } from "./TextInput-
|
|
8
|
+
import { T as TextInput } from "./TextInput-dwn3uD65.js";
|
|
9
9
|
const CommandPaletteBase = ({
|
|
10
10
|
commands,
|
|
11
11
|
placeholder = "Search...",
|
|
@@ -313,4 +313,4 @@ CommandPalette.displayName = "CommandPalette";
|
|
|
313
313
|
export {
|
|
314
314
|
CommandPalette as C
|
|
315
315
|
};
|
|
316
|
-
//# sourceMappingURL=CommandPalette-
|
|
316
|
+
//# sourceMappingURL=CommandPalette-GeFIL9EG.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CommandPalette-Cqvf4Biz.js","sources":["../../src/components/CommandPalette/CommandPaletteBase.tsx","../../src/components/CommandPalette/next/CommandPalette.tsx"],"sourcesContent":["import React, {\r\n useEffect,\r\n useRef,\r\n useState,\r\n useCallback,\r\n KeyboardEvent,\r\n} from \"react\";\r\nimport ReactDOM from \"react-dom\";\r\nimport { combineClassNames } from \"../../utils/classNames\";\r\nimport type { CommandPaletteProps } from \"./CommandPalette.types\";\r\nimport { capitalize } from \"../../utils/capitalize\";\r\nimport {\r\n getDefaultRounding,\r\n getDefaultShadow,\r\n getDefaultTheme,\r\n} from \"../../config/boreal-style-config\";\r\n\r\nexport interface CommandPaletteBaseProps extends CommandPaletteProps {\r\n classMap: Record<string, string>;\r\n TextInputComponent: React.ElementType;\r\n}\r\n\r\nconst CommandPaletteBase: React.FC<CommandPaletteBaseProps> = ({\r\n commands,\r\n placeholder = \"Search...\",\r\n isOpen,\r\n onClose,\r\n asyncSearch,\r\n debounceMs = 300,\r\n theme = getDefaultTheme(),\r\n rounding = getDefaultRounding(),\r\n shadow = getDefaultShadow(),\r\n state = \"\",\r\n classMap,\r\n TextInputComponent,\r\n \"data-testid\": testId = \"command-palette\",\r\n className,\r\n}) => {\r\n const [query, setQuery] = useState(\"\");\r\n const [activeIndex, setActiveIndex] = useState<number>(-1);\r\n const inputRef = useRef<HTMLInputElement>(null);\r\n const [mounted, setMounted] = useState(false);\r\n const [portalElement, setPortalElement] = useState<HTMLElement | null>(null);\r\n const [asyncResults, setAsyncResults] = useState<typeof commands>([]);\r\n const [isLoading, setIsLoading] = useState(false);\r\n const debounceRef = useRef<ReturnType<typeof setTimeout> | null>(null);\r\n const prevFocusRef = useRef<HTMLElement | null>(null);\r\n\r\n const filtered = asyncSearch\r\n ? asyncResults\r\n : commands.filter((cmd) =>\r\n cmd.label.toLowerCase().includes(query.toLowerCase())\r\n );\r\n\r\n useEffect(() => {\r\n if (filtered.length === 0) {\r\n setActiveIndex(-1);\r\n } else if (activeIndex < 0 || activeIndex >= filtered.length) {\r\n setActiveIndex(0);\r\n }\r\n }, [filtered, activeIndex]);\r\n\r\n useEffect(() => {\r\n if (!asyncSearch) return;\r\n\r\n if (debounceRef.current) clearTimeout(debounceRef.current);\r\n\r\n const q = query.trim();\r\n if (!q) {\r\n setAsyncResults([]);\r\n setIsLoading(false);\r\n return;\r\n }\r\n\r\n setIsLoading(true);\r\n debounceRef.current = setTimeout(() => {\r\n asyncSearch(q)\r\n .then((results) => {\r\n setAsyncResults(results);\r\n setIsLoading(false);\r\n })\r\n .catch(() => {\r\n setAsyncResults([]);\r\n setIsLoading(false);\r\n });\r\n }, debounceMs);\r\n\r\n return () => {\r\n if (debounceRef.current) clearTimeout(debounceRef.current);\r\n };\r\n }, [query, asyncSearch, debounceMs]);\r\n\r\n useEffect(() => {\r\n if (!isOpen) return;\r\n\r\n setMounted(true);\r\n prevFocusRef.current = (document.activeElement as HTMLElement) ?? null;\r\n\r\n const portal =\r\n document.getElementById(\"widget-portal\") ||\r\n (() => {\r\n const el = document.createElement(\"div\");\r\n el.id = \"widget-portal\";\r\n document.body.appendChild(el);\r\n return el;\r\n })();\r\n\r\n setPortalElement(portal);\r\n document.body.classList.add(\"noScroll\");\r\n\r\n return () => {\r\n document.body.classList.remove(\"noScroll\");\r\n setQuery(\"\");\r\n setActiveIndex(-1);\r\n setMounted(false);\r\n prevFocusRef.current?.focus?.();\r\n };\r\n }, [isOpen]);\r\n\r\n useEffect(() => {\r\n if (isOpen && inputRef.current) inputRef.current.focus();\r\n }, [isOpen]);\r\n\r\n const handleKeyDown = useCallback(\r\n (e: KeyboardEvent<HTMLInputElement>) => {\r\n if (e.key === \"ArrowDown\") {\r\n if (filtered.length === 0) return;\r\n e.preventDefault();\r\n setActiveIndex((prev) => (prev + 1) % filtered.length);\r\n } else if (e.key === \"ArrowUp\") {\r\n if (filtered.length === 0) return;\r\n e.preventDefault();\r\n setActiveIndex(\r\n (prev) => (prev - 1 + filtered.length) % filtered.length\r\n );\r\n } else if (e.key === \"Enter\") {\r\n if (activeIndex >= 0 && filtered[activeIndex]) {\r\n filtered[activeIndex].action();\r\n onClose();\r\n }\r\n } else if (e.key === \"Escape\") {\r\n onClose();\r\n }\r\n },\r\n [filtered, activeIndex, onClose]\r\n );\r\n\r\n const handleContainerKeyDown = useCallback(\r\n (e: KeyboardEvent<HTMLDivElement>) => {\r\n if (e.key === \"Escape\") onClose();\r\n },\r\n [onClose]\r\n );\r\n\r\n if (!isOpen || !mounted || !portalElement) return null;\r\n\r\n const listId = `${testId}-list`;\r\n\r\n return ReactDOM.createPortal(\r\n <div\r\n className={classMap.overlay}\r\n onClick={onClose}\r\n data-testid={`${testId}-overlay`}\r\n >\r\n <div\r\n className={combineClassNames(\r\n classMap.command_palette,\r\n classMap[theme],\r\n classMap[state],\r\n shadow && classMap[`shadow${capitalize(shadow)}`],\r\n rounding && classMap[`round${capitalize(rounding)}`],\r\n className\r\n )}\r\n onClick={(e) => e.stopPropagation()}\r\n onKeyDown={handleContainerKeyDown}\r\n role=\"dialog\"\r\n aria-modal=\"true\"\r\n aria-label=\"Command palette\"\r\n data-testid={testId}\r\n >\r\n <TextInputComponent\r\n ref={inputRef}\r\n type=\"text\"\r\n value={query}\r\n onChange={(e: React.ChangeEvent<HTMLInputElement>) =>\r\n setQuery(e.target.value)\r\n }\r\n onKeyDown={handleKeyDown}\r\n placeholder={placeholder}\r\n theme={theme}\r\n state={state}\r\n shadow={\"none\"}\r\n rounding={rounding}\r\n className={classMap.input}\r\n data-testid={`${testId}-input`}\r\n role=\"combobox\"\r\n aria-autocomplete=\"list\"\r\n aria-haspopup=\"listbox\"\r\n aria-expanded={filtered.length > 0}\r\n aria-controls={listId}\r\n aria-activedescendant={\r\n activeIndex >= 0 ? `cmd-${activeIndex}` : undefined\r\n }\r\n />\r\n\r\n <ul\r\n id={listId}\r\n className={classMap.list}\r\n role=\"listbox\"\r\n aria-label=\"Command suggestions\"\r\n aria-busy={isLoading || undefined}\r\n >\r\n {isLoading ? (\r\n <li\r\n className={combineClassNames(classMap.item, classMap.empty)}\r\n role=\"option\"\r\n aria-disabled=\"true\"\r\n aria-selected=\"false\"\r\n >\r\n Searching…\r\n </li>\r\n ) : filtered.length > 0 ? (\r\n filtered.map((cmd, index) => (\r\n <li\r\n key={`${cmd.label}-${index}`}\r\n id={`cmd-${index}`}\r\n role=\"option\"\r\n aria-selected={index === activeIndex}\r\n className={combineClassNames(\r\n classMap.item,\r\n classMap[theme],\r\n index === activeIndex && classMap.active\r\n )}\r\n onClick={() => {\r\n cmd.action();\r\n onClose();\r\n }}\r\n >\r\n {cmd.icon && (\r\n <span className={classMap.icon} aria-hidden=\"true\">\r\n {cmd.icon}\r\n </span>\r\n )}\r\n {cmd.label}\r\n </li>\r\n ))\r\n ) : (\r\n <li\r\n role=\"option\"\r\n aria-selected=\"false\"\r\n aria-disabled=\"true\"\r\n className={combineClassNames(classMap.item, classMap.empty)}\r\n >\r\n No matching results\r\n </li>\r\n )}\r\n </ul>\r\n </div>\r\n </div>,\r\n portalElement\r\n );\r\n};\r\nCommandPaletteBase.displayName = \"CommandPaletteBase\";\r\nexport default CommandPaletteBase;\r\n","\"use client\";\r\n\r\nimport React from \"react\";\r\nimport CommandPaletteBase from \"../CommandPaletteBase\";\r\nimport styles from \"./CommandPalette.module.scss\";\r\nimport { TextInput } from \"@/index.next\";\r\nimport { CommandPaletteProps } from \"../CommandPalette.types\";\r\n\r\nconst CommandPalette: React.FC<CommandPaletteProps> = (props) => (\r\n <CommandPaletteBase\r\n {...props}\r\n classMap={styles}\r\n TextInputComponent={TextInput}\r\n />\r\n);\r\nCommandPalette.displayName = \"CommandPalette\";\r\nexport default CommandPalette;\r\n"],"names":[],"mappings":";;;;;;;;AAsBA,MAAM,qBAAwD,CAAC;AAAA,EAC7D;AAAA,EACA,cAAc;AAAA,EACd;AAAA,EACA;AAAA,EACA;AAAA,EACA,aAAa;AAAA,EACb,QAAQ,gBAAA;AAAA,EACR,WAAW,mBAAA;AAAA,EACX,SAAS,iBAAA;AAAA,EACT,QAAQ;AAAA,EACR;AAAA,EACA;AAAA,EACA,eAAe,SAAS;AAAA,EACxB;AACF,MAAM;AACJ,QAAM,CAAC,OAAO,QAAQ,IAAI,SAAS,EAAE;AACrC,QAAM,CAAC,aAAa,cAAc,IAAI,SAAiB,EAAE;AACzD,QAAM,WAAW,OAAyB,IAAI;AAC9C,QAAM,CAAC,SAAS,UAAU,IAAI,SAAS,KAAK;AAC5C,QAAM,CAAC,eAAe,gBAAgB,IAAI,SAA6B,IAAI;AAC3E,QAAM,CAAC,cAAc,eAAe,IAAI,SAA0B,CAAA,CAAE;AACpE,QAAM,CAAC,WAAW,YAAY,IAAI,SAAS,KAAK;AAChD,QAAM,cAAc,OAA6C,IAAI;AACrE,QAAM,eAAe,OAA2B,IAAI;AAEpD,QAAM,WAAW,cACb,eACA,SAAS;AAAA,IAAO,CAAC,QACf,IAAI,MAAM,cAAc,SAAS,MAAM,YAAA,CAAa;AAAA,EAAA;AAG1D,YAAU,MAAM;AACd,QAAI,SAAS,WAAW,GAAG;AACzB,qBAAe,EAAE;AAAA,IACnB,WAAW,cAAc,KAAK,eAAe,SAAS,QAAQ;AAC5D,qBAAe,CAAC;AAAA,IAClB;AAAA,EACF,GAAG,CAAC,UAAU,WAAW,CAAC;AAE1B,YAAU,M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AAA,EAAK,WAAW,SAAS,MAAM,eAAY,QACzC,UAAA,IAAI,KAAA,CACP;AAAA,wBAED,IAAI;AAAA,sBAAA;AAAA,oBAAA;AAAA,oBAnBA,GAAG,IAAI,KAAK,IAAI,KAAK;AAAA,kBAAA,CAqB7B,IAED;AAAA,oBAAC;AAAA,oBAAA;AAAA,sBACC,MAAK;AAAA,sBACL,iBAAc;AAAA,sBACd,iBAAc;AAAA,sBACd,WAAW,kBAAkB,SAAS,MAAM,SAAS,KAAK;AAAA,sBAC3D,UAAA;AAAA,oBAAA;AAAA,kBAAA;AAAA,gBAED;AAAA,cAAA;AAAA,YAEJ;AAAA,UAAA;AAAA,QAAA;AAAA,MACF;AAAA,IAAA;AAAA,IAEF;AAAA,EAAA;AAEJ;AACA,mBAAmB,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AC9PjC,MAAM,iBAAgD,CAAC,UACrD;AAAA,EAAC;AAAA,EAAA;AAAA,IACE,GAAG;AAAA,IACJ,UAAU;AAAA,IACV,oBAAoB;AAAA,EAAA;AACtB;AAEF,eAAe,cAAc;"}
|
|
1
|
+
{"version":3,"file":"CommandPalette-GeFIL9EG.js","sources":["../../src/components/CommandPalette/CommandPaletteBase.tsx","../../src/components/CommandPalette/next/CommandPalette.tsx"],"sourcesContent":["import React, {\r\n useEffect,\r\n useRef,\r\n useState,\r\n useCallback,\r\n KeyboardEvent,\r\n} from \"react\";\r\nimport ReactDOM from \"react-dom\";\r\nimport { combineClassNames } from \"../../utils/classNames\";\r\nimport type { CommandPaletteProps } from \"./CommandPalette.types\";\r\nimport { capitalize } from \"../../utils/capitalize\";\r\nimport {\r\n getDefaultRounding,\r\n getDefaultShadow,\r\n getDefaultTheme,\r\n} from \"../../config/boreal-style-config\";\r\n\r\nexport interface CommandPaletteBaseProps extends CommandPaletteProps {\r\n classMap: Record<string, string>;\r\n TextInputComponent: React.ElementType;\r\n}\r\n\r\nconst CommandPaletteBase: React.FC<CommandPaletteBaseProps> = ({\r\n commands,\r\n placeholder = \"Search...\",\r\n isOpen,\r\n onClose,\r\n asyncSearch,\r\n debounceMs = 300,\r\n theme = getDefaultTheme(),\r\n rounding = getDefaultRounding(),\r\n shadow = getDefaultShadow(),\r\n state = \"\",\r\n classMap,\r\n TextInputComponent,\r\n \"data-testid\": testId = \"command-palette\",\r\n className,\r\n}) => {\r\n const [query, setQuery] = useState(\"\");\r\n const [activeIndex, setActiveIndex] = useState<number>(-1);\r\n const inputRef = useRef<HTMLInputElement>(null);\r\n const [mounted, setMounted] = useState(false);\r\n const [portalElement, setPortalElement] = useState<HTMLElement | null>(null);\r\n const [asyncResults, setAsyncResults] = useState<typeof commands>([]);\r\n const [isLoading, setIsLoading] = useState(false);\r\n const debounceRef = useRef<ReturnType<typeof setTimeout> | null>(null);\r\n const prevFocusRef = useRef<HTMLElement | null>(null);\r\n\r\n const filtered = asyncSearch\r\n ? asyncResults\r\n : commands.filter((cmd) =>\r\n cmd.label.toLowerCase().includes(query.toLowerCase())\r\n );\r\n\r\n useEffect(() => {\r\n if (filtered.length === 0) {\r\n setActiveIndex(-1);\r\n } else if (activeIndex < 0 || activeIndex >= filtered.length) {\r\n setActiveIndex(0);\r\n }\r\n }, [filtered, activeIndex]);\r\n\r\n useEffect(() => {\r\n if (!asyncSearch) return;\r\n\r\n if (debounceRef.current) clearTimeout(debounceRef.current);\r\n\r\n const q = query.trim();\r\n if (!q) {\r\n setAsyncResults([]);\r\n setIsLoading(false);\r\n return;\r\n }\r\n\r\n setIsLoading(true);\r\n debounceRef.current = setTimeout(() => {\r\n asyncSearch(q)\r\n .then((results) => {\r\n setAsyncResults(results);\r\n setIsLoading(false);\r\n })\r\n .catch(() => {\r\n setAsyncResults([]);\r\n setIsLoading(false);\r\n });\r\n }, debounceMs);\r\n\r\n return () => {\r\n if (debounceRef.current) clearTimeout(debounceRef.current);\r\n };\r\n }, [query, asyncSearch, debounceMs]);\r\n\r\n useEffect(() => {\r\n if (!isOpen) return;\r\n\r\n setMounted(true);\r\n prevFocusRef.current = (document.activeElement as HTMLElement) ?? null;\r\n\r\n const portal =\r\n document.getElementById(\"widget-portal\") ||\r\n (() => {\r\n const el = document.createElement(\"div\");\r\n el.id = \"widget-portal\";\r\n document.body.appendChild(el);\r\n return el;\r\n })();\r\n\r\n setPortalElement(portal);\r\n document.body.classList.add(\"noScroll\");\r\n\r\n return () => {\r\n document.body.classList.remove(\"noScroll\");\r\n setQuery(\"\");\r\n setActiveIndex(-1);\r\n setMounted(false);\r\n prevFocusRef.current?.focus?.();\r\n };\r\n }, [isOpen]);\r\n\r\n useEffect(() => {\r\n if (isOpen && inputRef.current) inputRef.current.focus();\r\n }, [isOpen]);\r\n\r\n const handleKeyDown = useCallback(\r\n (e: KeyboardEvent<HTMLInputElement>) => {\r\n if (e.key === \"ArrowDown\") {\r\n if (filtered.length === 0) return;\r\n e.preventDefault();\r\n setActiveIndex((prev) => (prev + 1) % filtered.length);\r\n } else if (e.key === \"ArrowUp\") {\r\n if (filtered.length === 0) return;\r\n e.preventDefault();\r\n setActiveIndex(\r\n (prev) => (prev - 1 + filtered.length) % filtered.length\r\n );\r\n } else if (e.key === \"Enter\") {\r\n if (activeIndex >= 0 && filtered[activeIndex]) {\r\n filtered[activeIndex].action();\r\n onClose();\r\n }\r\n } else if (e.key === \"Escape\") {\r\n onClose();\r\n }\r\n },\r\n [filtered, activeIndex, onClose]\r\n );\r\n\r\n const handleContainerKeyDown = useCallback(\r\n (e: KeyboardEvent<HTMLDivElement>) => {\r\n if (e.key === \"Escape\") onClose();\r\n },\r\n [onClose]\r\n );\r\n\r\n if (!isOpen || !mounted || !portalElement) return null;\r\n\r\n const listId = `${testId}-list`;\r\n\r\n return ReactDOM.createPortal(\r\n <div\r\n className={classMap.overlay}\r\n onClick={onClose}\r\n data-testid={`${testId}-overlay`}\r\n >\r\n <div\r\n className={combineClassNames(\r\n classMap.command_palette,\r\n classMap[theme],\r\n classMap[state],\r\n shadow && classMap[`shadow${capitalize(shadow)}`],\r\n rounding && classMap[`round${capitalize(rounding)}`],\r\n className\r\n )}\r\n onClick={(e) => e.stopPropagation()}\r\n onKeyDown={handleContainerKeyDown}\r\n role=\"dialog\"\r\n aria-modal=\"true\"\r\n aria-label=\"Command palette\"\r\n data-testid={testId}\r\n >\r\n <TextInputComponent\r\n ref={inputRef}\r\n type=\"text\"\r\n value={query}\r\n onChange={(e: React.ChangeEvent<HTMLInputElement>) =>\r\n setQuery(e.target.value)\r\n }\r\n onKeyDown={handleKeyDown}\r\n placeholder={placeholder}\r\n theme={theme}\r\n state={state}\r\n shadow={\"none\"}\r\n rounding={rounding}\r\n className={classMap.input}\r\n data-testid={`${testId}-input`}\r\n role=\"combobox\"\r\n aria-autocomplete=\"list\"\r\n aria-haspopup=\"listbox\"\r\n aria-expanded={filtered.length > 0}\r\n aria-controls={listId}\r\n aria-activedescendant={\r\n activeIndex >= 0 ? `cmd-${activeIndex}` : undefined\r\n }\r\n />\r\n\r\n <ul\r\n id={listId}\r\n className={classMap.list}\r\n role=\"listbox\"\r\n aria-label=\"Command suggestions\"\r\n aria-busy={isLoading || undefined}\r\n >\r\n {isLoading ? (\r\n <li\r\n className={combineClassNames(classMap.item, classMap.empty)}\r\n role=\"option\"\r\n aria-disabled=\"true\"\r\n aria-selected=\"false\"\r\n >\r\n Searching…\r\n </li>\r\n ) : filtered.length > 0 ? (\r\n filtered.map((cmd, index) => (\r\n <li\r\n key={`${cmd.label}-${index}`}\r\n id={`cmd-${index}`}\r\n role=\"option\"\r\n aria-selected={index === activeIndex}\r\n className={combineClassNames(\r\n classMap.item,\r\n classMap[theme],\r\n index === activeIndex && classMap.active\r\n )}\r\n onClick={() => {\r\n cmd.action();\r\n onClose();\r\n }}\r\n >\r\n {cmd.icon && (\r\n <span className={classMap.icon} aria-hidden=\"true\">\r\n {cmd.icon}\r\n </span>\r\n )}\r\n {cmd.label}\r\n </li>\r\n ))\r\n ) : (\r\n <li\r\n role=\"option\"\r\n aria-selected=\"false\"\r\n aria-disabled=\"true\"\r\n className={combineClassNames(classMap.item, classMap.empty)}\r\n >\r\n No matching results\r\n </li>\r\n )}\r\n </ul>\r\n </div>\r\n </div>,\r\n portalElement\r\n );\r\n};\r\nCommandPaletteBase.displayName = \"CommandPaletteBase\";\r\nexport default CommandPaletteBase;\r\n","\"use client\";\r\n\r\nimport React from \"react\";\r\nimport CommandPaletteBase from \"../CommandPaletteBase\";\r\nimport styles from \"./CommandPalette.module.scss\";\r\nimport { TextInput } from \"@/index.next\";\r\nimport { CommandPaletteProps } from \"../CommandPalette.types\";\r\n\r\nconst CommandPalette: React.FC<CommandPaletteProps> = (props) => (\r\n <CommandPaletteBase\r\n {...props}\r\n classMap={styles}\r\n TextInputComponent={TextInput}\r\n />\r\n);\r\nCommandPalette.displayName = \"CommandPalette\";\r\nexport default CommandPalette;\r\n"],"names":[],"mappings":";;;;;;;;AAsBA,MAAM,qBAAwD,CAAC;AAAA,EAC7D;AAAA,EACA,cAAc;AAAA,EACd;AAAA,EACA;AAAA,EACA;AAAA,EACA,aAAa;AAAA,EACb,QAAQ,gBAAA;AAAA,EACR,WAAW,mBAAA;AAAA,EACX,SAAS,iBAAA;AAAA,EACT,QAAQ;AAAA,EACR;AAAA,EACA;AAAA,EACA,eAAe,SAAS;AAAA,EACxB;AACF,MAAM;AACJ,QAAM,CAAC,OAAO,QAAQ,IAAI,SAAS,EAAE;AACrC,QAAM,CAAC,aAAa,cAAc,IAAI,SAAiB,EAAE;AACzD,QAAM,WAAW,OAAyB,IAAI;AAC9C,QAAM,CAAC,SAAS,UAAU,IAAI,SAAS,KAAK;AAC5C,QAAM,CAAC,eAAe,gBAAgB,IAAI,SAA6B,IAAI;AAC3E,QAAM,CAAC,cAAc,eAAe,IAAI,SAA0B,CAAA,CAAE;AACpE,QAAM,CAAC,WAAW,YAAY,IAAI,SAAS,KAAK;AAChD,QAAM,cAAc,OAA6C,IAAI;AACrE,QAAM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} from "./TextInput-
|
|
4
|
+
import { T as TextInput } from "./TextInput-dwn3uD65.js";
|
|
5
5
|
import { useId, useState, useRef, useEffect, useMemo } from "react";
|
|
6
6
|
import { C as CloseIcon } from "./CloseIcon-C3eQm4EK.js";
|
|
7
7
|
import { c as combineClassNames } from "./classNames-AS8QjFq7.js";
|
|
@@ -361,4 +361,4 @@ TagInput.displayName = "TagInput";
|
|
|
361
361
|
export {
|
|
362
362
|
TagInput as T
|
|
363
363
|
};
|
|
364
|
-
//# sourceMappingURL=TagInput-
|
|
364
|
+
//# sourceMappingURL=TagInput-BBDft9tw.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TagInput-luTKMQg-.js","sources":["../../src/components/TagInput/TagInputBase.tsx","../../src/components/TagInput/next/TagInput.tsx"],"sourcesContent":["import React, {\r\n useId,\r\n useState,\r\n KeyboardEvent,\r\n useMemo,\r\n useEffect,\r\n useRef,\r\n} from \"react\";\r\nimport { TagInputBaseProps } from \"./TagInput.types\";\r\nimport { CloseIcon } from \"../../Icons\";\r\nimport { combineClassNames } from \"../../utils/classNames\";\r\nimport { capitalize } from \"../../utils/capitalize\";\r\nimport {\r\n getDefaultRounding,\r\n getDefaultShadow,\r\n getDefaultSize,\r\n getDefaultTheme,\r\n} from \"../../config/boreal-style-config\";\r\n\r\nconst TagInputBase: React.FC<TagInputBaseProps> = ({\r\n tags = [],\r\n onChange,\r\n fetchSuggestions,\r\n debounceMs = 300,\r\n placeholder = \"Add a tag...\",\r\n theme = getDefaultTheme(),\r\n state = \"\",\r\n size = getDefaultSize(),\r\n rounding = getDefaultRounding(),\r\n shadow = getDefaultShadow(),\r\n \"data-testid\": testId = \"tag-input\",\r\n ariaDescription = \"Type a tag and press Enter or comma to add. Use arrow keys to navigate suggestions; Enter to select; Escape to close. Backspace removes the last tag when the field is empty.\",\r\n classMap,\r\n IconButton,\r\n TextInput,\r\n}) => {\r\n const uid = useId();\r\n const inputId = `${testId}-input-${uid}`;\r\n const descId = `${testId}-desc-${uid}`;\r\n const labelId = `${testId}-label-${uid}`;\r\n const listboxId = `${testId}-listbox-${uid}`;\r\n const statusId = `${testId}-status-${uid}`;\r\n\r\n const [inputValue, setInputValue] = useState(\"\");\r\n const [tagList, setTagList] = useState<string[]>(tags);\r\n const [lastAction, setLastAction] = useState<string>(\"\");\r\n const [suggestions, setSuggestions] = useState<string[]>([]);\r\n const [open, setOpen] = useState(false);\r\n const [activeIndex, setActiveIndex] = useState<number>(-1);\r\n\r\n const debounceRef = useRef<ReturnType<typeof setTimeout> | null>(null);\r\n\r\n const hasTag = (val: string) =>\r\n tagList.some((t) => t.toLowerCase() === val.toLowerCase());\r\n\r\n useEffect(() => {\r\n if (!fetchSuggestions) {\r\n setSuggestions([]);\r\n setOpen(false);\r\n return;\r\n }\r\n if (debounceRef.current) clearTimeout(debounceRef.current);\r\n\r\n const query = inputValue.trim();\r\n if (!query) {\r\n setSuggestions([]);\r\n setOpen(false);\r\n setActiveIndex(-1);\r\n return;\r\n }\r\n\r\n debounceRef.current = setTimeout(async () => {\r\n try {\r\n const result = await fetchSuggestions(query);\r\n setSuggestions(result || []);\r\n setOpen((result?.length ?? 0) > 0);\r\n setActiveIndex((result?.length ?? 0) > 0 ? 0 : -1);\r\n } catch {\r\n setSuggestions([]);\r\n setOpen(false);\r\n setActiveIndex(-1);\r\n }\r\n }, debounceMs);\r\n\r\n return () => {\r\n if (debounceRef.current) clearTimeout(debounceRef.current);\r\n };\r\n }, [inputValue, fetchSuggestions, debounceMs]);\r\n\r\n const addTag = (raw: string) => {\r\n const newTag = raw.trim();\r\n if (!newTag || hasTag(newTag)) return false;\r\n const updated = [...tagList, newTag];\r\n setTagList(updated);\r\n onChange?.(updated);\r\n setLastAction(`Added tag ${newTag}.`);\r\n return true;\r\n };\r\n\r\n const removeTag = (tag: string) => {\r\n const updated = tagList.filter((t) => t !== tag);\r\n setTagList(updated);\r\n onChange?.(updated);\r\n setLastAction(`Removed tag ${tag}.`);\r\n };\r\n\r\n const handleKeyDown = (event: KeyboardEvent<HTMLInputElement>) => {\r\n const { key } = event;\r\n\r\n if (open && suggestions.length > 0) {\r\n if (key === \"ArrowDown\") {\r\n event.preventDefault();\r\n setActiveIndex((i) => (i + 1) % suggestions.length);\r\n return;\r\n }\r\n if (key === \"ArrowUp\") {\r\n event.preventDefault();\r\n setActiveIndex(\r\n (i) => (i - 1 + suggestions.length) % suggestions.length,\r\n );\r\n return;\r\n }\r\n if (key === \"Enter\") {\r\n event.preventDefault();\r\n const choice = suggestions[activeIndex];\r\n if (choice && addTag(choice)) {\r\n setInputValue(\"\");\r\n }\r\n setSuggestions([]);\r\n setOpen(false);\r\n setActiveIndex(-1);\r\n return;\r\n }\r\n if (key === \"Escape\") {\r\n event.preventDefault();\r\n setSuggestions([]);\r\n setOpen(false);\r\n setActiveIndex(-1);\r\n return;\r\n }\r\n }\r\n\r\n if (key === \"Enter\" || key === \",\") {\r\n event.preventDefault();\r\n if (addTag(inputValue)) setInputValue(\"\");\r\n setSuggestions([]);\r\n setOpen(false);\r\n setActiveIndex(-1);\r\n return;\r\n }\r\n\r\n if (key === \"Backspace\" && inputValue === \"\" && tagList.length > 0) {\r\n const last = tagList[tagList.length - 1];\r\n removeTag(last);\r\n }\r\n };\r\n\r\n const wrapperClass = useMemo(\r\n () =>\r\n combineClassNames(\r\n classMap.tagInput,\r\n classMap[theme],\r\n classMap[state],\r\n classMap[size],\r\n ),\r\n [classMap, theme, state, size],\r\n );\r\n\r\n const tagClass = useMemo(\r\n () =>\r\n combineClassNames(\r\n classMap.tag,\r\n shadow && classMap[`shadow${capitalize(shadow)}`],\r\n rounding && classMap[`round${capitalize(rounding)}`],\r\n ),\r\n [classMap, shadow, rounding],\r\n );\r\n\r\n const handleSuggestionClick = (suggestion: string) => {\r\n if (addTag(suggestion)) setInputValue(\"\");\r\n setSuggestions([]);\r\n setOpen(false);\r\n setActiveIndex(-1);\r\n };\r\n\r\n const activeOptionId =\r\n open && activeIndex >= 0 ? `${listboxId}-opt-${activeIndex}` : undefined;\r\n\r\n return (\r\n <div\r\n className={wrapperClass}\r\n role=\"group\"\r\n aria-labelledby={labelId}\r\n aria-describedby={`${descId} ${statusId}`}\r\n data-testid={testId}\r\n >\r\n <label id={labelId} className=\"sr_only\">\r\n Tag Input\r\n </label>\r\n <div\r\n id={descId}\r\n className=\"sr_only\"\r\n data-testid={`${testId}-description`}\r\n >\r\n {ariaDescription}\r\n </div>\r\n\r\n <ul className={classMap.tagContainer} data-testid={`${testId}-list`}>\r\n {tagList.map((tag, index) => (\r\n <li\r\n key={`${tag}-${index}`}\r\n className={tagClass}\r\n role=\"listitem\"\r\n data-testid={`${testId}-tag-${index}`}\r\n >\r\n <span className={classMap.tagLabel}>{tag}</span>\r\n <IconButton\r\n type=\"button\"\r\n aria-label={`Remove tag ${tag}`}\r\n className={classMap.removeButton}\r\n onClick={() => removeTag(tag)}\r\n data-testid={`${testId}-remove-${index}`}\r\n icon={CloseIcon}\r\n size=\"small\"\r\n theme=\"clear\"\r\n shadow=\"none\"\r\n iconClassName={classMap.removeButtonIcon}\r\n />\r\n </li>\r\n ))}\r\n </ul>\r\n\r\n <div className={classMap.inputWrapper}>\r\n <TextInput\r\n id={inputId}\r\n type=\"text\"\r\n theme={theme}\r\n state={state}\r\n rounding={rounding}\r\n shadow={shadow}\r\n className={classMap.input}\r\n value={inputValue}\r\n placeholder={tagList.length === 0 ? placeholder : \"\"}\r\n onChange={(e: { target: { value: string } }) =>\r\n setInputValue(e.target.value)\r\n }\r\n onKeyDown={handleKeyDown}\r\n autoComplete=\"off\"\r\n role=\"combobox\"\r\n aria-autocomplete=\"list\"\r\n aria-expanded={open}\r\n aria-controls={listboxId}\r\n aria-activedescendant={activeOptionId}\r\n aria-label=\"Add new tag\"\r\n aria-describedby={`${descId} ${statusId}`}\r\n data-testid={`${testId}-input`}\r\n />\r\n </div>\r\n\r\n {open && suggestions.length > 0 && (\r\n <ul\r\n className={classMap.suggestionList}\r\n role=\"listbox\"\r\n id={listboxId}\r\n aria-label=\"Tag suggestions\"\r\n data-testid={`${testId}-suggestions`}\r\n >\r\n {suggestions.map((suggestion, index) => (\r\n <li\r\n key={`${suggestion}-${index}`}\r\n id={`${listboxId}-opt-${index}`}\r\n className={combineClassNames(\r\n classMap.suggestionItem,\r\n index === activeIndex && (classMap.active || \"\"),\r\n )}\r\n role=\"option\"\r\n aria-selected={index === activeIndex}\r\n onMouseDown={(e) => e.preventDefault()}\r\n onClick={() => handleSuggestionClick(suggestion)}\r\n data-testid={`${testId}-suggestion-${index}`}\r\n >\r\n {suggestion}\r\n </li>\r\n ))}\r\n </ul>\r\n )}\r\n\r\n <div id={statusId} aria-live=\"polite\" className=\"sr_only\">\r\n {open && suggestions.length > 0\r\n ? `${suggestions.length} suggestion${suggestions.length === 1 ? \"\" : \"s\"} available.`\r\n : \"\"}\r\n {lastAction}\r\n </div>\r\n </div>\r\n );\r\n};\r\n\r\nTagInputBase.displayName = \"TagInputBase\";\r\nexport default TagInputBase;\r\n","\"use client\";\r\n\r\nimport React from \"react\";\r\nimport styles from \"./TagInput.module.scss\";\r\nimport { IconButton, TextInput } from \"@/index.next\";\r\nimport TagInputBase from \"../TagInputBase\";\r\nimport { TagInputProps } from \"../TagInput.types\";\r\n\r\nconst TagInput: React.FC<TagInputProps> = (props) => {\r\n return (\r\n <TagInputBase\r\n {...props}\r\n classMap={styles}\r\n IconButton={IconButton}\r\n TextInput={TextInput}\r\n />\r\n );\r\n};\r\nTagInput.displayName = \"TagInput\";\r\nexport default TagInput;\r\n"],"names":["IconButton","TextInput","tag"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmBA,MAAM,eAA4C,CAAC;AAAA,EACjD,OAAO,CAAA;AAAA,EACP;AAAA,EACA;AAAA,EACA,aAAa;AAAA,EACb,cAAc;AAAA,EACd,QAAQ,gBAAA;AAAA,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c;ACjS3B,MAAM,WAAoC,CAAC,UAAU;AACnD,SACE;AAAA,IAAC;AAAA,IAAA;AAAA,MACE,GAAG;AAAA,MACJ,UAAU;AAAA,MACV;AAAA,MACA;AAAA,IAAA;AAAA,EAAA;AAGN;AACA,SAAS,cAAc;"}
|
|
1
|
+
{"version":3,"file":"TagInput-BBDft9tw.js","sources":["../../src/components/TagInput/TagInputBase.tsx","../../src/components/TagInput/next/TagInput.tsx"],"sourcesContent":["import React, {\r\n useId,\r\n useState,\r\n KeyboardEvent,\r\n useMemo,\r\n useEffect,\r\n useRef,\r\n} from \"react\";\r\nimport { TagInputBaseProps } from \"./TagInput.types\";\r\nimport { CloseIcon } from \"../../Icons\";\r\nimport { combineClassNames } from \"../../utils/classNames\";\r\nimport { capitalize } from \"../../utils/capitalize\";\r\nimport {\r\n getDefaultRounding,\r\n getDefaultShadow,\r\n getDefaultSize,\r\n getDefaultTheme,\r\n} from \"../../config/boreal-style-config\";\r\n\r\nconst TagInputBase: React.FC<TagInputBaseProps> = ({\r\n tags = [],\r\n onChange,\r\n fetchSuggestions,\r\n debounceMs = 300,\r\n placeholder = \"Add a tag...\",\r\n theme = getDefaultTheme(),\r\n state = \"\",\r\n size = getDefaultSize(),\r\n rounding = getDefaultRounding(),\r\n shadow = getDefaultShadow(),\r\n \"data-testid\": testId = \"tag-input\",\r\n ariaDescription = \"Type a tag and press Enter or comma to add. Use arrow keys to navigate suggestions; Enter to select; Escape to close. Backspace removes the last tag when the field is empty.\",\r\n classMap,\r\n IconButton,\r\n TextInput,\r\n}) => {\r\n const uid = useId();\r\n const inputId = `${testId}-input-${uid}`;\r\n const descId = `${testId}-desc-${uid}`;\r\n const labelId = `${testId}-label-${uid}`;\r\n const listboxId = `${testId}-listbox-${uid}`;\r\n const statusId = `${testId}-status-${uid}`;\r\n\r\n const [inputValue, setInputValue] = useState(\"\");\r\n const [tagList, setTagList] = useState<string[]>(tags);\r\n const [lastAction, setLastAction] = useState<string>(\"\");\r\n const [suggestions, setSuggestions] = useState<string[]>([]);\r\n const [open, setOpen] = useState(false);\r\n const [activeIndex, setActiveIndex] = useState<number>(-1);\r\n\r\n const debounceRef = useRef<ReturnType<typeof setTimeout> | null>(null);\r\n\r\n const hasTag = (val: string) =>\r\n tagList.some((t) => t.toLowerCase() === val.toLowerCase());\r\n\r\n useEffect(() => {\r\n if (!fetchSuggestions) {\r\n setSuggestions([]);\r\n setOpen(false);\r\n return;\r\n }\r\n if (debounceRef.current) clearTimeout(debounceRef.current);\r\n\r\n const query = inputValue.trim();\r\n if (!query) {\r\n setSuggestions([]);\r\n setOpen(false);\r\n setActiveIndex(-1);\r\n return;\r\n }\r\n\r\n debounceRef.current = setTimeout(async () => {\r\n try {\r\n const result = await fetchSuggestions(query);\r\n setSuggestions(result || []);\r\n setOpen((result?.length ?? 0) > 0);\r\n setActiveIndex((result?.length ?? 0) > 0 ? 0 : -1);\r\n } catch {\r\n setSuggestions([]);\r\n setOpen(false);\r\n setActiveIndex(-1);\r\n }\r\n }, debounceMs);\r\n\r\n return () => {\r\n if (debounceRef.current) clearTimeout(debounceRef.current);\r\n };\r\n }, [inputValue, fetchSuggestions, debounceMs]);\r\n\r\n const addTag = (raw: string) => {\r\n const newTag = raw.trim();\r\n if (!newTag || hasTag(newTag)) return false;\r\n const updated = [...tagList, newTag];\r\n setTagList(updated);\r\n onChange?.(updated);\r\n setLastAction(`Added tag ${newTag}.`);\r\n return true;\r\n };\r\n\r\n const removeTag = (tag: string) => {\r\n const updated = tagList.filter((t) => t !== tag);\r\n setTagList(updated);\r\n onChange?.(updated);\r\n setLastAction(`Removed tag ${tag}.`);\r\n };\r\n\r\n const handleKeyDown = (event: KeyboardEvent<HTMLInputElement>) => {\r\n const { key } = event;\r\n\r\n if (open && suggestions.length > 0) {\r\n if (key === \"ArrowDown\") {\r\n event.preventDefault();\r\n setActiveIndex((i) => (i + 1) % suggestions.length);\r\n return;\r\n }\r\n if (key === \"ArrowUp\") {\r\n event.preventDefault();\r\n setActiveIndex(\r\n (i) => (i - 1 + suggestions.length) % suggestions.length,\r\n );\r\n return;\r\n }\r\n if (key === \"Enter\") {\r\n event.preventDefault();\r\n const choice = suggestions[activeIndex];\r\n if (choice && addTag(choice)) {\r\n setInputValue(\"\");\r\n }\r\n setSuggestions([]);\r\n setOpen(false);\r\n setActiveIndex(-1);\r\n return;\r\n }\r\n if (key === \"Escape\") {\r\n event.preventDefault();\r\n setSuggestions([]);\r\n setOpen(false);\r\n setActiveIndex(-1);\r\n return;\r\n }\r\n }\r\n\r\n if (key === \"Enter\" || key === \",\") {\r\n event.preventDefault();\r\n if (addTag(inputValue)) setInputValue(\"\");\r\n setSuggestions([]);\r\n setOpen(false);\r\n setActiveIndex(-1);\r\n return;\r\n }\r\n\r\n if (key === \"Backspace\" && inputValue === \"\" && tagList.length > 0) {\r\n const last = tagList[tagList.length - 1];\r\n removeTag(last);\r\n }\r\n };\r\n\r\n const wrapperClass = useMemo(\r\n () =>\r\n combineClassNames(\r\n classMap.tagInput,\r\n classMap[theme],\r\n classMap[state],\r\n classMap[size],\r\n ),\r\n [classMap, theme, state, size],\r\n );\r\n\r\n const tagClass = useMemo(\r\n () =>\r\n combineClassNames(\r\n classMap.tag,\r\n shadow && classMap[`shadow${capitalize(shadow)}`],\r\n rounding && classMap[`round${capitalize(rounding)}`],\r\n ),\r\n [classMap, shadow, rounding],\r\n );\r\n\r\n const handleSuggestionClick = (suggestion: string) => {\r\n if (addTag(suggestion)) setInputValue(\"\");\r\n setSuggestions([]);\r\n setOpen(false);\r\n setActiveIndex(-1);\r\n };\r\n\r\n const activeOptionId =\r\n open && activeIndex >= 0 ? `${listboxId}-opt-${activeIndex}` : undefined;\r\n\r\n return (\r\n <div\r\n className={wrapperClass}\r\n role=\"group\"\r\n aria-labelledby={labelId}\r\n aria-describedby={`${descId} ${statusId}`}\r\n data-testid={testId}\r\n >\r\n <label id={labelId} className=\"sr_only\">\r\n Tag Input\r\n </label>\r\n <div\r\n id={descId}\r\n className=\"sr_only\"\r\n data-testid={`${testId}-description`}\r\n >\r\n {ariaDescription}\r\n </div>\r\n\r\n <ul className={classMap.tagContainer} data-testid={`${testId}-list`}>\r\n {tagList.map((tag, index) => (\r\n <li\r\n key={`${tag}-${index}`}\r\n className={tagClass}\r\n role=\"listitem\"\r\n data-testid={`${testId}-tag-${index}`}\r\n >\r\n <span className={classMap.tagLabel}>{tag}</span>\r\n <IconButton\r\n type=\"button\"\r\n aria-label={`Remove tag ${tag}`}\r\n className={classMap.removeButton}\r\n onClick={() => removeTag(tag)}\r\n data-testid={`${testId}-remove-${index}`}\r\n icon={CloseIcon}\r\n size=\"small\"\r\n theme=\"clear\"\r\n shadow=\"none\"\r\n iconClassName={classMap.removeButtonIcon}\r\n />\r\n </li>\r\n ))}\r\n </ul>\r\n\r\n <div className={classMap.inputWrapper}>\r\n <TextInput\r\n id={inputId}\r\n type=\"text\"\r\n theme={theme}\r\n state={state}\r\n rounding={rounding}\r\n shadow={shadow}\r\n className={classMap.input}\r\n value={inputValue}\r\n placeholder={tagList.length === 0 ? placeholder : \"\"}\r\n onChange={(e: { target: { value: string } }) =>\r\n setInputValue(e.target.value)\r\n }\r\n onKeyDown={handleKeyDown}\r\n autoComplete=\"off\"\r\n role=\"combobox\"\r\n aria-autocomplete=\"list\"\r\n aria-expanded={open}\r\n aria-controls={listboxId}\r\n aria-activedescendant={activeOptionId}\r\n aria-label=\"Add new tag\"\r\n aria-describedby={`${descId} ${statusId}`}\r\n data-testid={`${testId}-input`}\r\n />\r\n </div>\r\n\r\n {open && suggestions.length > 0 && (\r\n <ul\r\n className={classMap.suggestionList}\r\n role=\"listbox\"\r\n id={listboxId}\r\n aria-label=\"Tag suggestions\"\r\n data-testid={`${testId}-suggestions`}\r\n >\r\n {suggestions.map((suggestion, index) => (\r\n <li\r\n key={`${suggestion}-${index}`}\r\n id={`${listboxId}-opt-${index}`}\r\n className={combineClassNames(\r\n classMap.suggestionItem,\r\n index === activeIndex && (classMap.active || \"\"),\r\n )}\r\n role=\"option\"\r\n aria-selected={index === activeIndex}\r\n onMouseDown={(e) => e.preventDefault()}\r\n onClick={() => handleSuggestionClick(suggestion)}\r\n data-testid={`${testId}-suggestion-${index}`}\r\n >\r\n {suggestion}\r\n </li>\r\n ))}\r\n </ul>\r\n )}\r\n\r\n <div id={statusId} aria-live=\"polite\" className=\"sr_only\">\r\n {open && suggestions.length > 0\r\n ? `${suggestions.length} suggestion${suggestions.length === 1 ? \"\" : \"s\"} available.`\r\n : \"\"}\r\n {lastAction}\r\n </div>\r\n </div>\r\n );\r\n};\r\n\r\nTagInputBase.displayName = \"TagInputBase\";\r\nexport default TagInputBase;\r\n","\"use client\";\r\n\r\nimport React from \"react\";\r\nimport styles from \"./TagInput.module.scss\";\r\nimport { IconButton, TextInput } from \"@/index.next\";\r\nimport TagInputBase from \"../TagInputBase\";\r\nimport { TagInputProps } from \"../TagInput.types\";\r\n\r\nconst TagInput: React.FC<TagInputProps> = (props) => {\r\n return (\r\n <TagInputBase\r\n {...props}\r\n classMap={styles}\r\n IconButton={IconButton}\r\n TextInput={TextInput}\r\n />\r\n );\r\n};\r\nTagInput.displayName = \"TagInput\";\r\nexport default TagInput;\r\n"],"names":["IconButton","TextInput","tag"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmBA,MAAM,eAA4C,CAAC;AAAA,EACjD,OAAO,CAAA;AAAA,EACP;AAAA,EACA;AAAA,EACA,aAAa;AAAA,EACb,cAAc;AAAA,EACd,QAAQ,gBAAA;AAAA,EACR,QAAQ;AAAA,EACR,OAAO,eAAA;AAAA,EACP,WAAW,mBAAA;AAAA,EACX,SAAS,iBAAA;AAAA,EACT,eAAe,SAAS;AAAA,EACxB,kBAAkB;AAAA,EAClB;AAAA,EACA,YAAAA;AAAA,EACA,WAAAC;AACF,MAAM;AACJ,QAAM,MAAM,MAAA;AACZ,QAAM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$2 = require("react/jsx-runtime");
|
|
3
3
|
;/* empty css */
|
|
4
4
|
const IconButton = require("./IconButton-aF7cTy19.cjs");
|
|
5
|
-
const TextInput = require("./TextInput-
|
|
5
|
+
const TextInput = require("./TextInput-DPArjoEr.cjs");
|
|
6
6
|
const React = require("react");
|
|
7
7
|
const CloseIcon = require("./CloseIcon-7hy4qJ9o.cjs");
|
|
8
8
|
const classNames = require("./classNames-BcWMx052.cjs");
|
|
@@ -360,4 +360,4 @@ const TagInput = (props) => {
|
|
|
360
360
|
};
|
|
361
361
|
TagInput.displayName = "TagInput";
|
|
362
362
|
exports.TagInput = TagInput;
|
|
363
|
-
//# sourceMappingURL=TagInput-
|
|
363
|
+
//# sourceMappingURL=TagInput-BdKQoh2d.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TagInput-CPco8A19.cjs","sources":["../../src/components/TagInput/TagInputBase.tsx","../../src/components/TagInput/next/TagInput.tsx"],"sourcesContent":["import React, {\r\n useId,\r\n useState,\r\n KeyboardEvent,\r\n useMemo,\r\n useEffect,\r\n useRef,\r\n} from \"react\";\r\nimport { TagInputBaseProps } from \"./TagInput.types\";\r\nimport { CloseIcon } from \"../../Icons\";\r\nimport { combineClassNames } from \"../../utils/classNames\";\r\nimport { capitalize } from \"../../utils/capitalize\";\r\nimport {\r\n getDefaultRounding,\r\n getDefaultShadow,\r\n getDefaultSize,\r\n getDefaultTheme,\r\n} from \"../../config/boreal-style-config\";\r\n\r\nconst TagInputBase: React.FC<TagInputBaseProps> = ({\r\n tags = [],\r\n onChange,\r\n fetchSuggestions,\r\n debounceMs = 300,\r\n placeholder = \"Add a tag...\",\r\n theme = getDefaultTheme(),\r\n state = \"\",\r\n size = getDefaultSize(),\r\n rounding = getDefaultRounding(),\r\n shadow = getDefaultShadow(),\r\n \"data-testid\": testId = \"tag-input\",\r\n ariaDescription = \"Type a tag and press Enter or comma to add. Use arrow keys to navigate suggestions; Enter to select; Escape to close. Backspace removes the last tag when the field is empty.\",\r\n classMap,\r\n IconButton,\r\n TextInput,\r\n}) => {\r\n const uid = useId();\r\n const inputId = `${testId}-input-${uid}`;\r\n const descId = `${testId}-desc-${uid}`;\r\n const labelId = `${testId}-label-${uid}`;\r\n const listboxId = `${testId}-listbox-${uid}`;\r\n const statusId = `${testId}-status-${uid}`;\r\n\r\n const [inputValue, setInputValue] = useState(\"\");\r\n const [tagList, setTagList] = useState<string[]>(tags);\r\n const [lastAction, setLastAction] = useState<string>(\"\");\r\n const [suggestions, setSuggestions] = useState<string[]>([]);\r\n const [open, setOpen] = useState(false);\r\n const [activeIndex, setActiveIndex] = useState<number>(-1);\r\n\r\n const debounceRef = useRef<ReturnType<typeof setTimeout> | null>(null);\r\n\r\n const hasTag = (val: string) =>\r\n tagList.some((t) => t.toLowerCase() === val.toLowerCase());\r\n\r\n useEffect(() => {\r\n if (!fetchSuggestions) {\r\n setSuggestions([]);\r\n setOpen(false);\r\n return;\r\n }\r\n if (debounceRef.current) clearTimeout(debounceRef.current);\r\n\r\n const query = inputValue.trim();\r\n if (!query) {\r\n setSuggestions([]);\r\n setOpen(false);\r\n setActiveIndex(-1);\r\n return;\r\n }\r\n\r\n debounceRef.current = setTimeout(async () => {\r\n try {\r\n const result = await fetchSuggestions(query);\r\n setSuggestions(result || []);\r\n setOpen((result?.length ?? 0) > 0);\r\n setActiveIndex((result?.length ?? 0) > 0 ? 0 : -1);\r\n } catch {\r\n setSuggestions([]);\r\n setOpen(false);\r\n setActiveIndex(-1);\r\n }\r\n }, debounceMs);\r\n\r\n return () => {\r\n if (debounceRef.current) clearTimeout(debounceRef.current);\r\n };\r\n }, [inputValue, fetchSuggestions, debounceMs]);\r\n\r\n const addTag = (raw: string) => {\r\n const newTag = raw.trim();\r\n if (!newTag || hasTag(newTag)) return false;\r\n const updated = [...tagList, newTag];\r\n setTagList(updated);\r\n onChange?.(updated);\r\n setLastAction(`Added tag ${newTag}.`);\r\n return true;\r\n };\r\n\r\n const removeTag = (tag: string) => {\r\n const updated = tagList.filter((t) => t !== tag);\r\n setTagList(updated);\r\n onChange?.(updated);\r\n setLastAction(`Removed tag ${tag}.`);\r\n };\r\n\r\n const handleKeyDown = (event: KeyboardEvent<HTMLInputElement>) => {\r\n const { key } = event;\r\n\r\n if (open && suggestions.length > 0) {\r\n if (key === \"ArrowDown\") {\r\n event.preventDefault();\r\n setActiveIndex((i) => (i + 1) % suggestions.length);\r\n return;\r\n }\r\n if (key === \"ArrowUp\") {\r\n event.preventDefault();\r\n setActiveIndex(\r\n (i) => (i - 1 + suggestions.length) % suggestions.length,\r\n );\r\n return;\r\n }\r\n if (key === \"Enter\") {\r\n event.preventDefault();\r\n const choice = suggestions[activeIndex];\r\n if (choice && addTag(choice)) {\r\n setInputValue(\"\");\r\n }\r\n setSuggestions([]);\r\n setOpen(false);\r\n setActiveIndex(-1);\r\n return;\r\n }\r\n if (key === \"Escape\") {\r\n event.preventDefault();\r\n setSuggestions([]);\r\n setOpen(false);\r\n setActiveIndex(-1);\r\n return;\r\n }\r\n }\r\n\r\n if (key === \"Enter\" || key === \",\") {\r\n event.preventDefault();\r\n if (addTag(inputValue)) setInputValue(\"\");\r\n setSuggestions([]);\r\n setOpen(false);\r\n setActiveIndex(-1);\r\n return;\r\n }\r\n\r\n if (key === \"Backspace\" && inputValue === \"\" && tagList.length > 0) {\r\n const last = tagList[tagList.length - 1];\r\n removeTag(last);\r\n }\r\n };\r\n\r\n const wrapperClass = useMemo(\r\n () =>\r\n combineClassNames(\r\n classMap.tagInput,\r\n classMap[theme],\r\n classMap[state],\r\n classMap[size],\r\n ),\r\n [classMap, theme, state, size],\r\n );\r\n\r\n const tagClass = useMemo(\r\n () =>\r\n combineClassNames(\r\n classMap.tag,\r\n shadow && classMap[`shadow${capitalize(shadow)}`],\r\n rounding && classMap[`round${capitalize(rounding)}`],\r\n ),\r\n [classMap, shadow, rounding],\r\n );\r\n\r\n const handleSuggestionClick = (suggestion: string) => {\r\n if (addTag(suggestion)) setInputValue(\"\");\r\n setSuggestions([]);\r\n setOpen(false);\r\n setActiveIndex(-1);\r\n };\r\n\r\n const activeOptionId =\r\n open && activeIndex >= 0 ? `${listboxId}-opt-${activeIndex}` : undefined;\r\n\r\n return (\r\n <div\r\n className={wrapperClass}\r\n role=\"group\"\r\n aria-labelledby={labelId}\r\n aria-describedby={`${descId} ${statusId}`}\r\n data-testid={testId}\r\n >\r\n <label id={labelId} className=\"sr_only\">\r\n Tag Input\r\n </label>\r\n <div\r\n id={descId}\r\n className=\"sr_only\"\r\n data-testid={`${testId}-description`}\r\n >\r\n {ariaDescription}\r\n </div>\r\n\r\n <ul className={classMap.tagContainer} data-testid={`${testId}-list`}>\r\n {tagList.map((tag, index) => (\r\n <li\r\n key={`${tag}-${index}`}\r\n className={tagClass}\r\n role=\"listitem\"\r\n data-testid={`${testId}-tag-${index}`}\r\n >\r\n <span className={classMap.tagLabel}>{tag}</span>\r\n <IconButton\r\n type=\"button\"\r\n aria-label={`Remove tag ${tag}`}\r\n className={classMap.removeButton}\r\n onClick={() => removeTag(tag)}\r\n data-testid={`${testId}-remove-${index}`}\r\n icon={CloseIcon}\r\n size=\"small\"\r\n theme=\"clear\"\r\n shadow=\"none\"\r\n iconClassName={classMap.removeButtonIcon}\r\n />\r\n </li>\r\n ))}\r\n </ul>\r\n\r\n <div className={classMap.inputWrapper}>\r\n <TextInput\r\n id={inputId}\r\n type=\"text\"\r\n theme={theme}\r\n state={state}\r\n rounding={rounding}\r\n shadow={shadow}\r\n className={classMap.input}\r\n value={inputValue}\r\n placeholder={tagList.length === 0 ? placeholder : \"\"}\r\n onChange={(e: { target: { value: string } }) =>\r\n setInputValue(e.target.value)\r\n }\r\n onKeyDown={handleKeyDown}\r\n autoComplete=\"off\"\r\n role=\"combobox\"\r\n aria-autocomplete=\"list\"\r\n aria-expanded={open}\r\n aria-controls={listboxId}\r\n aria-activedescendant={activeOptionId}\r\n aria-label=\"Add new tag\"\r\n aria-describedby={`${descId} ${statusId}`}\r\n data-testid={`${testId}-input`}\r\n />\r\n </div>\r\n\r\n {open && suggestions.length > 0 && (\r\n <ul\r\n className={classMap.suggestionList}\r\n role=\"listbox\"\r\n id={listboxId}\r\n aria-label=\"Tag suggestions\"\r\n data-testid={`${testId}-suggestions`}\r\n >\r\n {suggestions.map((suggestion, index) => (\r\n <li\r\n key={`${suggestion}-${index}`}\r\n id={`${listboxId}-opt-${index}`}\r\n className={combineClassNames(\r\n classMap.suggestionItem,\r\n index === activeIndex && (classMap.active || \"\"),\r\n )}\r\n role=\"option\"\r\n aria-selected={index === activeIndex}\r\n onMouseDown={(e) => e.preventDefault()}\r\n onClick={() => handleSuggestionClick(suggestion)}\r\n data-testid={`${testId}-suggestion-${index}`}\r\n >\r\n {suggestion}\r\n </li>\r\n ))}\r\n </ul>\r\n )}\r\n\r\n <div id={statusId} aria-live=\"polite\" className=\"sr_only\">\r\n {open && suggestions.length > 0\r\n ? `${suggestions.length} suggestion${suggestions.length === 1 ? \"\" : \"s\"} available.`\r\n : \"\"}\r\n {lastAction}\r\n </div>\r\n </div>\r\n );\r\n};\r\n\r\nTagInputBase.displayName = \"TagInputBase\";\r\nexport default TagInputBase;\r\n","\"use client\";\r\n\r\nimport React from \"react\";\r\nimport styles from \"./TagInput.module.scss\";\r\nimport { IconButton, TextInput } from \"@/index.next\";\r\nimport TagInputBase from \"../TagInputBase\";\r\nimport { TagInputProps } from \"../TagInput.types\";\r\n\r\nconst TagInput: React.FC<TagInputProps> = (props) => {\r\n return (\r\n <TagInputBase\r\n {...props}\r\n classMap={styles}\r\n IconButton={IconButton}\r\n TextInput={TextInput}\r\n />\r\n );\r\n};\r\nTagInput.displayName = \"TagInput\";\r\nexport default TagInput;\r\n"],"names":["getDefaultTheme","getDefaultSize","getDefaultRounding","getDefaultShadow","IconButton","TextInput","useId","useState","useRef","useEffect","tag","useMemo","combineClassNames","capitalize","jsxs","jsx","CloseIcon"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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Aa,CAAC,MAAM,EAAE,eAAA;AAAA,gBACtB,SAAS,MAAM,sBAAsB,UAAU;AAAA,gBAC/C,eAAa,GAAG,MAAM,eAAe,KAAK;AAAA,gBAEzC,UAAA;AAAA,cAAA;AAAA,cAZI,GAAG,UAAU,IAAI,KAAK;AAAA,YAAA,CAc9B;AAAA,UAAA;AAAA,QAAA;AAAA,wCAIJ,OAAA,EAAI,IAAI,UAAU,aAAU,UAAS,WAAU,WAC7C,UAAA;AAAA,UAAA,QAAQ,YAAY,SAAS,IAC1B,GAAG,YAAY,MAAM,cAAc,YAAY,WAAW,IAAI,KAAK,GAAG,gBACtE;AAAA,UACH;AAAA,QAAA,EAAA,CACH;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGN;AAEA,aAAa,cAAc;ACjS3B,MAAM,WAAoC,CAAC,UAAU;AACnD,SACEG,2BAAAA;AAAAA,IAAC;AAAA,IAAA;AAAA,MACE,GAAG;AAAA,MACJ,UAAU;AAAA,MAAA,YACVX,WAAAA;AAAAA,MAAA,WACAC,UAAAA;AAAAA,IAAA;AAAA,EAAA;AAGN;AACA,SAAS,cAAc;;"}
|
|
1
|
+
{"version":3,"file":"TagInput-BdKQoh2d.cjs","sources":["../../src/components/TagInput/TagInputBase.tsx","../../src/components/TagInput/next/TagInput.tsx"],"sourcesContent":["import React, {\r\n useId,\r\n useState,\r\n KeyboardEvent,\r\n useMemo,\r\n useEffect,\r\n useRef,\r\n} from \"react\";\r\nimport { TagInputBaseProps } from \"./TagInput.types\";\r\nimport { CloseIcon } from \"../../Icons\";\r\nimport { combineClassNames } from \"../../utils/classNames\";\r\nimport { capitalize } from \"../../utils/capitalize\";\r\nimport {\r\n getDefaultRounding,\r\n getDefaultShadow,\r\n getDefaultSize,\r\n getDefaultTheme,\r\n} from \"../../config/boreal-style-config\";\r\n\r\nconst TagInputBase: React.FC<TagInputBaseProps> = ({\r\n tags = [],\r\n onChange,\r\n fetchSuggestions,\r\n debounceMs = 300,\r\n placeholder = \"Add a tag...\",\r\n theme = getDefaultTheme(),\r\n state = \"\",\r\n size = getDefaultSize(),\r\n rounding = getDefaultRounding(),\r\n shadow = getDefaultShadow(),\r\n \"data-testid\": testId = \"tag-input\",\r\n ariaDescription = \"Type a tag and press Enter or comma to add. Use arrow keys to navigate suggestions; Enter to select; Escape to close. Backspace removes the last tag when the field is empty.\",\r\n classMap,\r\n IconButton,\r\n TextInput,\r\n}) => {\r\n const uid = useId();\r\n const inputId = `${testId}-input-${uid}`;\r\n const descId = `${testId}-desc-${uid}`;\r\n const labelId = `${testId}-label-${uid}`;\r\n const listboxId = `${testId}-listbox-${uid}`;\r\n const statusId = `${testId}-status-${uid}`;\r\n\r\n const [inputValue, setInputValue] = useState(\"\");\r\n const [tagList, setTagList] = useState<string[]>(tags);\r\n const [lastAction, setLastAction] = useState<string>(\"\");\r\n const [suggestions, setSuggestions] = useState<string[]>([]);\r\n const [open, setOpen] = useState(false);\r\n const [activeIndex, setActiveIndex] = useState<number>(-1);\r\n\r\n const debounceRef = useRef<ReturnType<typeof setTimeout> | null>(null);\r\n\r\n const hasTag = (val: string) =>\r\n tagList.some((t) => t.toLowerCase() === val.toLowerCase());\r\n\r\n useEffect(() => {\r\n if (!fetchSuggestions) {\r\n setSuggestions([]);\r\n setOpen(false);\r\n return;\r\n }\r\n if (debounceRef.current) clearTimeout(debounceRef.current);\r\n\r\n const query = inputValue.trim();\r\n if (!query) {\r\n setSuggestions([]);\r\n setOpen(false);\r\n setActiveIndex(-1);\r\n return;\r\n }\r\n\r\n debounceRef.current = setTimeout(async () => {\r\n try {\r\n const result = await fetchSuggestions(query);\r\n setSuggestions(result || []);\r\n setOpen((result?.length ?? 0) > 0);\r\n setActiveIndex((result?.length ?? 0) > 0 ? 0 : -1);\r\n } catch {\r\n setSuggestions([]);\r\n setOpen(false);\r\n setActiveIndex(-1);\r\n }\r\n }, debounceMs);\r\n\r\n return () => {\r\n if (debounceRef.current) clearTimeout(debounceRef.current);\r\n };\r\n }, [inputValue, fetchSuggestions, debounceMs]);\r\n\r\n const addTag = (raw: string) => {\r\n const newTag = raw.trim();\r\n if (!newTag || hasTag(newTag)) return false;\r\n const updated = [...tagList, newTag];\r\n setTagList(updated);\r\n onChange?.(updated);\r\n setLastAction(`Added tag ${newTag}.`);\r\n return true;\r\n };\r\n\r\n const removeTag = (tag: string) => {\r\n const updated = tagList.filter((t) => t !== tag);\r\n setTagList(updated);\r\n onChange?.(updated);\r\n setLastAction(`Removed tag ${tag}.`);\r\n };\r\n\r\n const handleKeyDown = (event: KeyboardEvent<HTMLInputElement>) => {\r\n const { key } = event;\r\n\r\n if (open && suggestions.length > 0) {\r\n if (key === \"ArrowDown\") {\r\n event.preventDefault();\r\n setActiveIndex((i) => (i + 1) % suggestions.length);\r\n return;\r\n }\r\n if (key === \"ArrowUp\") {\r\n event.preventDefault();\r\n setActiveIndex(\r\n (i) => (i - 1 + suggestions.length) % suggestions.length,\r\n );\r\n return;\r\n }\r\n if (key === \"Enter\") {\r\n event.preventDefault();\r\n const choice = suggestions[activeIndex];\r\n if (choice && addTag(choice)) {\r\n setInputValue(\"\");\r\n }\r\n setSuggestions([]);\r\n setOpen(false);\r\n setActiveIndex(-1);\r\n return;\r\n }\r\n if (key === \"Escape\") {\r\n event.preventDefault();\r\n setSuggestions([]);\r\n setOpen(false);\r\n setActiveIndex(-1);\r\n return;\r\n }\r\n }\r\n\r\n if (key === \"Enter\" || key === \",\") {\r\n event.preventDefault();\r\n if (addTag(inputValue)) setInputValue(\"\");\r\n setSuggestions([]);\r\n setOpen(false);\r\n setActiveIndex(-1);\r\n return;\r\n }\r\n\r\n if (key === \"Backspace\" && inputValue === \"\" && tagList.length > 0) {\r\n const last = tagList[tagList.length - 1];\r\n removeTag(last);\r\n }\r\n };\r\n\r\n const wrapperClass = useMemo(\r\n () =>\r\n combineClassNames(\r\n classMap.tagInput,\r\n classMap[theme],\r\n classMap[state],\r\n classMap[size],\r\n ),\r\n [classMap, theme, state, size],\r\n );\r\n\r\n const tagClass = useMemo(\r\n () =>\r\n combineClassNames(\r\n classMap.tag,\r\n shadow && classMap[`shadow${capitalize(shadow)}`],\r\n rounding && classMap[`round${capitalize(rounding)}`],\r\n ),\r\n [classMap, shadow, rounding],\r\n );\r\n\r\n const handleSuggestionClick = (suggestion: string) => {\r\n if (addTag(suggestion)) setInputValue(\"\");\r\n setSuggestions([]);\r\n setOpen(false);\r\n setActiveIndex(-1);\r\n };\r\n\r\n const activeOptionId =\r\n open && activeIndex >= 0 ? `${listboxId}-opt-${activeIndex}` : undefined;\r\n\r\n return (\r\n <div\r\n className={wrapperClass}\r\n role=\"group\"\r\n aria-labelledby={labelId}\r\n aria-describedby={`${descId} ${statusId}`}\r\n data-testid={testId}\r\n >\r\n <label id={labelId} className=\"sr_only\">\r\n Tag Input\r\n </label>\r\n <div\r\n id={descId}\r\n className=\"sr_only\"\r\n data-testid={`${testId}-description`}\r\n >\r\n {ariaDescription}\r\n </div>\r\n\r\n <ul className={classMap.tagContainer} data-testid={`${testId}-list`}>\r\n {tagList.map((tag, index) => (\r\n <li\r\n key={`${tag}-${index}`}\r\n className={tagClass}\r\n role=\"listitem\"\r\n data-testid={`${testId}-tag-${index}`}\r\n >\r\n <span className={classMap.tagLabel}>{tag}</span>\r\n <IconButton\r\n type=\"button\"\r\n aria-label={`Remove tag ${tag}`}\r\n className={classMap.removeButton}\r\n onClick={() => removeTag(tag)}\r\n data-testid={`${testId}-remove-${index}`}\r\n icon={CloseIcon}\r\n size=\"small\"\r\n theme=\"clear\"\r\n shadow=\"none\"\r\n iconClassName={classMap.removeButtonIcon}\r\n />\r\n </li>\r\n ))}\r\n </ul>\r\n\r\n <div className={classMap.inputWrapper}>\r\n <TextInput\r\n id={inputId}\r\n type=\"text\"\r\n theme={theme}\r\n state={state}\r\n rounding={rounding}\r\n shadow={shadow}\r\n className={classMap.input}\r\n value={inputValue}\r\n placeholder={tagList.length === 0 ? placeholder : \"\"}\r\n onChange={(e: { target: { value: string } }) =>\r\n setInputValue(e.target.value)\r\n }\r\n onKeyDown={handleKeyDown}\r\n autoComplete=\"off\"\r\n role=\"combobox\"\r\n aria-autocomplete=\"list\"\r\n aria-expanded={open}\r\n aria-controls={listboxId}\r\n aria-activedescendant={activeOptionId}\r\n aria-label=\"Add new tag\"\r\n aria-describedby={`${descId} ${statusId}`}\r\n data-testid={`${testId}-input`}\r\n />\r\n </div>\r\n\r\n {open && suggestions.length > 0 && (\r\n <ul\r\n className={classMap.suggestionList}\r\n role=\"listbox\"\r\n id={listboxId}\r\n aria-label=\"Tag suggestions\"\r\n data-testid={`${testId}-suggestions`}\r\n >\r\n {suggestions.map((suggestion, index) => (\r\n <li\r\n key={`${suggestion}-${index}`}\r\n id={`${listboxId}-opt-${index}`}\r\n className={combineClassNames(\r\n classMap.suggestionItem,\r\n index === activeIndex && (classMap.active || \"\"),\r\n )}\r\n role=\"option\"\r\n aria-selected={index === activeIndex}\r\n onMouseDown={(e) => e.preventDefault()}\r\n onClick={() => handleSuggestionClick(suggestion)}\r\n data-testid={`${testId}-suggestion-${index}`}\r\n >\r\n {suggestion}\r\n </li>\r\n ))}\r\n </ul>\r\n )}\r\n\r\n <div id={statusId} aria-live=\"polite\" className=\"sr_only\">\r\n {open && suggestions.length > 0\r\n ? `${suggestions.length} suggestion${suggestions.length === 1 ? \"\" : \"s\"} available.`\r\n : \"\"}\r\n {lastAction}\r\n </div>\r\n </div>\r\n );\r\n};\r\n\r\nTagInputBase.displayName = \"TagInputBase\";\r\nexport default TagInputBase;\r\n","\"use client\";\r\n\r\nimport React from \"react\";\r\nimport styles from \"./TagInput.module.scss\";\r\nimport { IconButton, TextInput } from \"@/index.next\";\r\nimport TagInputBase from \"../TagInputBase\";\r\nimport { TagInputProps } from \"../TagInput.types\";\r\n\r\nconst TagInput: React.FC<TagInputProps> = (props) => {\r\n return (\r\n <TagInputBase\r\n {...props}\r\n classMap={styles}\r\n IconButton={IconButton}\r\n TextInput={TextInput}\r\n />\r\n );\r\n};\r\nTagInput.displayName = \"TagInput\";\r\nexport default TagInput;\r\n"],"names":["getDefaultTheme","getDefaultSize","getDefaultRounding","getDefaultShadow","IconButton","TextInput","useId","useState","useRef","useEffect","tag","useMemo","combineClassNames","capitalize","jsxs","jsx","CloseIcon"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmBA,MAAM,eAA4C,CAAC;AAAA,EACjD,OAAO,CAAA;AAAA,EACP;AAAA,EACA;AAAA,EACA,aAAa;AAAA,EACb,cAAc;AAAA,EACd,QAAQA,kBAAAA,gBAAA;AAAA,EACR,QAAQ;AAAA,EACR,OAAOC,kBAAAA,eAAA;AAAA,EACP,WAAWC,kBAAAA,mBAAA;AAAA,EACX,SAASC,kBAAAA,iBAAA;AAAA,EACT,eAAe,SAAS;AAAA,EACxB,kBAAkB;AAAA,EAClB;AAAA,EACA,YAAAC;AAAA,EACA,WAAAC;AACF,MAAM;AACJ,QAAM,MAAMC,MAAAA,MAAA;AACZ,QAAM,UAAU,GAAG,MAAM,UAAU,GAAG;AACtC,QAAM,SAAS,GAAG,MAAM,SAAS,GAAG;AACpC,QAAM,UAAU,GAAG,MAAM,UAAU,GAAG;AACtC,QAAM,YAAY,GAAG,MAAM,YAAY,GAAG;AAC1C,QAAM,WAAW,GAAG,MAAM,WAAW,GAAG;AAExC,QAAM,CAAC,YAAY,aAAa,IAAIC,MAAAA,SAAS,EAAE;AAC/C,QAAM,CAAC,SAAS,UAAU,IAAIA,MAAAA,SAAmB,IAAI;AACrD,QAAM,CAAC,YAAY,aAAa,IAAIA,MAAAA,SAAiB,EAAE;AACvD,QAAM,CAAC,aAAa,cAAc,IAAIA,MAAAA,SAAmB,CAAA,CAAE;AAC3D,QAAM,CAAC,MAAM,OAAO,IAAIA,MAAAA,SAAS,KAAK;AACtC,QAAM,CAAC,aAAa,cAAc,IAAIA,MAAAA,SAAiB,EAAE;A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A,cAAA;AAAA,gBAEC,IAAI,GAAG,SAAS,QAAQ,KAAK;AAAA,gBAC7B,WAAWH,WAAAA;AAAAA,kBACT,SAAS;AAAA,kBACT,UAAU,gBAAgB,SAAS,UAAU;AAAA,gBAAA;AAAA,gBAE/C,MAAK;AAAA,gBACL,iBAAe,UAAU;AAAA,gBACzB,aAAa,CAAC,MAAM,EAAE,eAAA;AAAA,gBACtB,SAAS,MAAM,sBAAsB,UAAU;AAAA,gBAC/C,eAAa,GAAG,MAAM,eAAe,KAAK;AAAA,gBAEzC,UAAA;AAAA,cAAA;AAAA,cAZI,GAAG,UAAU,IAAI,KAAK;AAAA,YAAA,CAc9B;AAAA,UAAA;AAAA,QAAA;AAAA,wCAIJ,OAAA,EAAI,IAAI,UAAU,aAAU,UAAS,WAAU,WAC7C,UAAA;AAAA,UAAA,QAAQ,YAAY,SAAS,IAC1B,GAAG,YAAY,MAAM,cAAc,YAAY,WAAW,IAAI,KAAK,GAAG,gBACtE;AAAA,UACH;AAAA,QAAA,EAAA,CACH;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGN;AAEA,aAAa,cAAc;ACjS3B,MAAM,WAAoC,CAAC,UAAU;AACnD,SACEG,2BAAAA;AAAAA,IAAC;AAAA,IAAA;AAAA,MACE,GAAG;AAAA,MACJ,UAAU;AAAA,MAAA,YACVX,WAAAA;AAAAA,MAAA,WACAC,UAAAA;AAAAA,IAAA;AAAA,EAAA;AAGN;AACA,SAAS,cAAc;;"}
|
package/dist/next/TagInput.js
CHANGED
|
@@ -97,30 +97,30 @@ const EyeSlashIcon = (props) => /* @__PURE__ */ require$$2.jsxs(
|
|
|
97
97
|
]
|
|
98
98
|
}
|
|
99
99
|
);
|
|
100
|
-
const container = "
|
|
101
|
-
const roundNone = "
|
|
102
|
-
const roundSmall = "
|
|
103
|
-
const roundMedium = "
|
|
104
|
-
const roundLarge = "
|
|
105
|
-
const roundFull = "
|
|
106
|
-
const shadowNone = "
|
|
107
|
-
const shadowLight = "
|
|
108
|
-
const shadowMedium = "
|
|
109
|
-
const shadowStrong = "
|
|
110
|
-
const shadowIntense = "
|
|
111
|
-
const textInput = "
|
|
112
|
-
const iconContainer = "
|
|
113
|
-
const togglePassword = "
|
|
114
|
-
const success = "
|
|
115
|
-
const error = "
|
|
116
|
-
const warning = "
|
|
117
|
-
const primary = "
|
|
118
|
-
const outline = "
|
|
119
|
-
const secondary = "
|
|
120
|
-
const tertiary = "
|
|
121
|
-
const quaternary = "
|
|
122
|
-
const clear = "
|
|
123
|
-
const disabled = "
|
|
100
|
+
const container = "_container_1o1xb_85";
|
|
101
|
+
const roundNone = "_roundNone_1o1xb_123";
|
|
102
|
+
const roundSmall = "_roundSmall_1o1xb_130";
|
|
103
|
+
const roundMedium = "_roundMedium_1o1xb_137";
|
|
104
|
+
const roundLarge = "_roundLarge_1o1xb_144";
|
|
105
|
+
const roundFull = "_roundFull_1o1xb_151";
|
|
106
|
+
const shadowNone = "_shadowNone_1o1xb_158";
|
|
107
|
+
const shadowLight = "_shadowLight_1o1xb_162";
|
|
108
|
+
const shadowMedium = "_shadowMedium_1o1xb_166";
|
|
109
|
+
const shadowStrong = "_shadowStrong_1o1xb_170";
|
|
110
|
+
const shadowIntense = "_shadowIntense_1o1xb_174";
|
|
111
|
+
const textInput = "_textInput_1o1xb_178";
|
|
112
|
+
const iconContainer = "_iconContainer_1o1xb_207";
|
|
113
|
+
const togglePassword = "_togglePassword_1o1xb_229";
|
|
114
|
+
const success = "_success_1o1xb_248";
|
|
115
|
+
const error = "_error_1o1xb_252";
|
|
116
|
+
const warning = "_warning_1o1xb_256";
|
|
117
|
+
const primary = "_primary_1o1xb_260";
|
|
118
|
+
const outline = "_outline_1o1xb_270";
|
|
119
|
+
const secondary = "_secondary_1o1xb_277";
|
|
120
|
+
const tertiary = "_tertiary_1o1xb_294";
|
|
121
|
+
const quaternary = "_quaternary_1o1xb_311";
|
|
122
|
+
const clear = "_clear_1o1xb_328";
|
|
123
|
+
const disabled = "_disabled_1o1xb_349";
|
|
124
124
|
const styles = {
|
|
125
125
|
container,
|
|
126
126
|
roundNone,
|
|
@@ -307,4 +307,4 @@ const TextInput = React.forwardRef((props, ref) => {
|
|
|
307
307
|
});
|
|
308
308
|
TextInput.displayName = "TextInput";
|
|
309
309
|
exports.TextInput = TextInput;
|
|
310
|
-
//# sourceMappingURL=TextInput-
|
|
310
|
+
//# sourceMappingURL=TextInput-DPArjoEr.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextInput-bmBWt-F6.cjs","sources":["../../src/Icons/EyeIcon.tsx","../../src/Icons/EyeSlashIcon.tsx","../../src/components/TextInput/TextInputBase.tsx","../../src/components/TextInput/next/TextInput.tsx"],"sourcesContent":["const EyeIcon: React.FC<React.SVGProps<SVGSVGElement>> = (props) => (\r\n <svg\r\n width=\"24px\"\r\n height=\"24px\"\r\n viewBox=\"0 0 24 24\"\r\n fill=\"none\"\r\n xmlns=\"http://www.w3.org/2000/svg\"\r\n color=\"currentColor\"\r\n strokeWidth=\"1.5\"\r\n {...props}\r\n >\r\n <path\r\n d=\"M3 13C6.6 5 17.4 5 21 13\"\r\n stroke=\"currentColor\"\r\n strokeWidth=\"1.5\"\r\n strokeLinecap=\"round\"\r\n strokeLinejoin=\"round\"\r\n ></path>\r\n <path\r\n d=\"M12 17C10.3431 17 9 15.6569 9 14C9 12.3431 10.3431 11 12 11C13.6569 11 15 12.3431 15 14C15 15.6569 13.6569 17 12 17Z\"\r\n fill=\"currentColor\"\r\n stroke=\"currentColor\"\r\n strokeWidth=\"1.5\"\r\n strokeLinecap=\"round\"\r\n strokeLinejoin=\"round\"\r\n ></path>\r\n </svg>\r\n);\r\n\r\nexport default EyeIcon;\r\n","const EyeSlashIcon: React.FC<React.SVGProps<SVGSVGElement>> = (props) => (\r\n <svg\r\n width=\"24px\"\r\n height=\"24px\"\r\n viewBox=\"0 0 24 24\"\r\n strokeWidth=\"1.5\"\r\n fill=\"none\"\r\n xmlns=\"http://www.w3.org/2000/svg\"\r\n color=\"currentColor\"\r\n {...props}\r\n >\r\n <path\r\n d=\"M19.5 16L17.0248 12.6038\"\r\n stroke=\"currentColor\"\r\n strokeWidth=\"1.5\"\r\n strokeLinecap=\"round\"\r\n strokeLinejoin=\"round\"\r\n ></path>\r\n <path\r\n d=\"M12 17.5V14\"\r\n stroke=\"currentColor\"\r\n strokeWidth=\"1.5\"\r\n strokeLinecap=\"round\"\r\n strokeLinejoin=\"round\"\r\n ></path>\r\n <path\r\n d=\"M4.5 16L6.96895 12.6124\"\r\n stroke=\"currentColor\"\r\n strokeWidth=\"1.5\"\r\n strokeLinecap=\"round\"\r\n strokeLinejoin=\"round\"\r\n ></path>\r\n <path\r\n d=\"M3 8C6.6 16 17.4 16 21 8\"\r\n stroke=\"currentColor\"\r\n strokeWidth=\"1.5\"\r\n strokeLinecap=\"round\"\r\n strokeLinejoin=\"round\"\r\n ></path>\r\n </svg>\r\n);\r\n\r\nexport default EyeSlashIcon;\r\n","import {\r\n forwardRef,\r\n useState,\r\n useId,\r\n InputHTMLAttributes,\r\n useMemo,\r\n} from \"react\";\r\nimport { EyeIcon, EyeSlashIcon } from \"../../Icons\";\r\nimport { TextInputBaseProps } from \"./TextInput.types\";\r\nimport { combineClassNames } from \"../../utils/classNames\";\r\nimport { capitalize } from \"../../utils/capitalize\";\r\nimport {\r\n getDefaultRounding,\r\n getDefaultShadow,\r\n getDefaultTheme,\r\n} from \"../../config/boreal-style-config\";\r\n\r\nconst TextInputBase = forwardRef<HTMLInputElement, TextInputBaseProps>(\r\n (\r\n {\r\n icon: Icon,\r\n title,\r\n titlePosition = \"top\",\r\n placeholder = \"Enter text\",\r\n password = false,\r\n readOnly = false,\r\n ariaLabel,\r\n ariaDescription,\r\n theme = getDefaultTheme(),\r\n rounding = getDefaultRounding(),\r\n shadow = getDefaultShadow(),\r\n state = \"\",\r\n disabled = false,\r\n autocomplete = false,\r\n \"data-testid\": testId = \"text-input\",\r\n classMap,\r\n outline = false,\r\n IconButton,\r\n className = \"\",\r\n ...rest\r\n },\r\n ref,\r\n ) => {\r\n const [showPassword, setShowPassword] = useState(false);\r\n\r\n const autoId = useId();\r\n const {\r\n id: idProp,\r\n required,\r\n autoComplete: autoCompleteProp,\r\n type: typeProp,\r\n ...restInput\r\n } = rest as InputHTMLAttributes<HTMLInputElement>;\r\n const inputId = idProp || autoId;\r\n\r\n const inputType = password\r\n ? showPassword\r\n ? \"text\"\r\n : \"password\"\r\n : typeProp || \"text\";\r\n\r\n const descId = ariaDescription ? `${inputId}-description` : undefined;\r\n const isError = state === \"error\";\r\n\r\n const computedAutoComplete =\r\n autoCompleteProp ??\r\n (autocomplete ? (password ? \"current-password\" : \"on\") : \"off\");\r\n\r\n const togglePasswordVisibility = () => setShowPassword((prev) => !prev);\r\n\r\n const hasTitle = Boolean(title);\r\n\r\n const layoutClasses = useMemo(() => {\r\n const posClass = hasTitle\r\n ? classMap[`title${capitalize(titlePosition)}`]\r\n : undefined;\r\n\r\n return combineClassNames(classMap.layout, posClass);\r\n }, [classMap, hasTitle, titlePosition]);\r\n\r\n const titleClasses = useMemo(\r\n () => combineClassNames(classMap.title, classMap.titleOverlay),\r\n [classMap],\r\n );\r\n\r\n const titleNode = hasTitle ? (\r\n <div className={titleClasses} data-testid={`${testId}-title`}>\r\n {title}\r\n </div>\r\n ) : null;\r\n\r\n const wrapperClass = useMemo(\r\n () =>\r\n combineClassNames(\r\n classMap.container,\r\n classMap[theme],\r\n classMap[state],\r\n outline && classMap.outline,\r\n disabled && classMap.disabled,\r\n shadow && classMap[`shadow${capitalize(shadow)}`],\r\n rounding && classMap[`round${capitalize(rounding)}`],\r\n className,\r\n ),\r\n [classMap, theme, state, outline, disabled, shadow, rounding, className],\r\n );\r\n\r\n const inputClasses = useMemo(\r\n () => combineClassNames(classMap.textInput, outline && classMap.outline),\r\n [classMap, outline],\r\n );\r\n\r\n const iconClasses = useMemo(\r\n () =>\r\n combineClassNames(\r\n classMap.iconContainer,\r\n classMap[theme],\r\n disabled && classMap.disabled,\r\n ),\r\n [classMap, theme, disabled],\r\n );\r\n const computedAriaLabel = hasTitle ? undefined : ariaLabel || placeholder;\r\n\r\n const computedPlaceholder =\r\n hasTitle && titlePosition === \"overlay\" ? \" \" : placeholder;\r\n\r\n return (\r\n <div className={layoutClasses} data-testid={`${testId}-layout`}>\r\n {(titlePosition === \"top\" || titlePosition === \"left\") && titleNode}\r\n\r\n <div className={wrapperClass} data-testid={testId}>\r\n {Icon && (\r\n <div\r\n className={iconClasses}\r\n aria-hidden=\"true\"\r\n data-testid={`${testId}-icon`}\r\n >\r\n <Icon aria-hidden=\"true\" />\r\n </div>\r\n )}\r\n\r\n <input\r\n ref={ref}\r\n id={inputId}\r\n type={inputType}\r\n className={inputClasses}\r\n placeholder={computedPlaceholder}\r\n aria-label={computedAriaLabel}\r\n aria-describedby={descId}\r\n aria-disabled={disabled || undefined}\r\n aria-invalid={isError || undefined}\r\n aria-required={required || undefined}\r\n aria-readonly={readOnly || undefined}\r\n autoComplete={computedAutoComplete}\r\n readOnly={readOnly}\r\n disabled={disabled}\r\n required={required}\r\n data-testid={`${testId}-input`}\r\n {...restInput}\r\n />\r\n {hasTitle && titlePosition === \"overlay\" && (\r\n <label\r\n className={classMap.titleOverlayLabel}\r\n htmlFor={inputId}\r\n data-testid={`${testId}-overlay-title`}\r\n >\r\n {title}\r\n </label>\r\n )}\r\n\r\n {password && (\r\n <IconButton\r\n type=\"button\"\r\n className={classMap.togglePassword}\r\n onClick={togglePasswordVisibility}\r\n theme=\"clear\"\r\n shadow=\"none\"\r\n aria-label={showPassword ? \"Hide password\" : \"Show password\"}\r\n aria-pressed={showPassword}\r\n data-testid={`${testId}-password-toggle`}\r\n icon={showPassword ? EyeSlashIcon : EyeIcon}\r\n />\r\n )}\r\n\r\n {ariaDescription && (\r\n <span\r\n id={descId}\r\n className=\"sr_only\"\r\n data-testid={`${testId}-description`}\r\n >\r\n {ariaDescription}\r\n </span>\r\n )}\r\n </div>\r\n\r\n {(titlePosition === \"bottom\" || titlePosition === \"right\") && titleNode}\r\n </div>\r\n );\r\n },\r\n);\r\n\r\nTextInputBase.displayName = \"TextInputBase\";\r\nexport default TextInputBase;\r\n","\"use client\";\r\n\r\nimport { forwardRef } from \"react\";\r\nimport styles from \"./TextInput.module.scss\";\r\nimport { TextInputProps } from \"../TextInput.types\";\r\nimport TextInputBase from \"../TextInputBase\";\r\nimport { IconButton } from \"@/index.next\";\r\n\r\nconst TextInput = forwardRef<HTMLInputElement, TextInputProps>((props, ref) => {\r\n return (\r\n <TextInputBase\r\n {...props}\r\n IconButton={IconButton}\r\n ref={ref}\r\n classMap={styles}\r\n />\r\n );\r\n});\r\n\r\nTextInput.displayName = \"TextInput\";\r\nexport default TextInput;\r\n"],"names":["jsxs","jsx","forwardRef","getDefaultTheme","getDefaultRounding","getDefaultShadow","disabled","outline","IconButton","useState","useId","useMemo","capitalize","combineClassNames"],"mappings":";;;;;;;;AAAA,MAAM,UAAmD,CAAC,UACxDA,2BAAAA;AAAAA,EAAC;AAAA,EAAA;AAAA,IACC,OAAM;AAAA,IACN,QAAO;AAAA,IACP,SAAQ;AAAA,IACR,MAAK;AAAA,IACL,OAAM;AAAA,IACN,OAAM;AAAA,IACN,aAAY;AAAA,IACX,GAAG;AAAA,IAEJ,UAAA;AAAA,MAAAC,2BAAAA;AAAAA,QAAC;AAAA,QAAA;AAAA,UACC,GAAE;AAAA,UACF,QAAO;AAAA,UACP,aAAY;AAAA,UACZ,eAAc;AAAA,UACd,gBAAe;AAAA,QAAA;AAAA,MAAA;AAAA,MAEjBA,2BAAAA;AAAAA,QAAC;AAAA,QAAA;AAAA,UACC,GAAE;AAAA,UACF,MAAK;AAAA,UACL,QAAO;AAAA,UACP,aAAY;AAAA,UACZ,eAAc;AAAA,UACd,gBAAe;AAAA,QAAA;AAAA,MAAA;AAAA,IAChB;AAAA,EAAA;AACH;AC1BF,MAAM,eAAwD,CAAC,UAC7DD,2BAAAA;AAAAA,EAAC;AA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x","../../src/components/TextInput/TextInputBase.tsx","../../src/components/TextInput/next/TextInput.tsx"],"sourcesContent":["const EyeIcon: React.FC<React.SVGProps<SVGSVGElement>> = (props) => (\r\n <svg\r\n width=\"24px\"\r\n height=\"24px\"\r\n viewBox=\"0 0 24 24\"\r\n fill=\"none\"\r\n xmlns=\"http://www.w3.org/2000/svg\"\r\n color=\"currentColor\"\r\n strokeWidth=\"1.5\"\r\n {...props}\r\n >\r\n <path\r\n d=\"M3 13C6.6 5 17.4 5 21 13\"\r\n stroke=\"currentColor\"\r\n strokeWidth=\"1.5\"\r\n strokeLinecap=\"round\"\r\n strokeLinejoin=\"round\"\r\n ></path>\r\n <path\r\n d=\"M12 17C10.3431 17 9 15.6569 9 14C9 12.3431 10.3431 11 12 11C13.6569 11 15 12.3431 15 14C15 15.6569 13.6569 17 12 17Z\"\r\n fill=\"currentColor\"\r\n stroke=\"currentColor\"\r\n strokeWidth=\"1.5\"\r\n strokeLinecap=\"round\"\r\n strokeLinejoin=\"round\"\r\n ></path>\r\n </svg>\r\n);\r\n\r\nexport default EyeIcon;\r\n","const EyeSlashIcon: React.FC<React.SVGProps<SVGSVGElement>> = (props) => (\r\n <svg\r\n width=\"24px\"\r\n height=\"24px\"\r\n viewBox=\"0 0 24 24\"\r\n strokeWidth=\"1.5\"\r\n fill=\"none\"\r\n xmlns=\"http://www.w3.org/2000/svg\"\r\n color=\"currentColor\"\r\n {...props}\r\n >\r\n <path\r\n d=\"M19.5 16L17.0248 12.6038\"\r\n stroke=\"currentColor\"\r\n strokeWidth=\"1.5\"\r\n strokeLinecap=\"round\"\r\n strokeLinejoin=\"round\"\r\n ></path>\r\n <path\r\n d=\"M12 17.5V14\"\r\n stroke=\"currentColor\"\r\n strokeWidth=\"1.5\"\r\n strokeLinecap=\"round\"\r\n strokeLinejoin=\"round\"\r\n ></path>\r\n <path\r\n d=\"M4.5 16L6.96895 12.6124\"\r\n stroke=\"currentColor\"\r\n strokeWidth=\"1.5\"\r\n strokeLinecap=\"round\"\r\n strokeLinejoin=\"round\"\r\n ></path>\r\n <path\r\n d=\"M3 8C6.6 16 17.4 16 21 8\"\r\n stroke=\"currentColor\"\r\n strokeWidth=\"1.5\"\r\n strokeLinecap=\"round\"\r\n strokeLinejoin=\"round\"\r\n ></path>\r\n </svg>\r\n);\r\n\r\nexport default EyeSlashIcon;\r\n","import {\r\n forwardRef,\r\n useState,\r\n useId,\r\n InputHTMLAttributes,\r\n useMemo,\r\n} from \"react\";\r\nimport { EyeIcon, EyeSlashIcon } from \"../../Icons\";\r\nimport { TextInputBaseProps } from \"./TextInput.types\";\r\nimport { combineClassNames } from \"../../utils/classNames\";\r\nimport { capitalize } from \"../../utils/capitalize\";\r\nimport {\r\n getDefaultRounding,\r\n getDefaultShadow,\r\n getDefaultTheme,\r\n} from \"../../config/boreal-style-config\";\r\n\r\nconst TextInputBase = forwardRef<HTMLInputElement, TextInputBaseProps>(\r\n (\r\n {\r\n icon: Icon,\r\n title,\r\n titlePosition = \"top\",\r\n placeholder = \"Enter text\",\r\n password = false,\r\n readOnly = false,\r\n ariaLabel,\r\n ariaDescription,\r\n theme = getDefaultTheme(),\r\n rounding = getDefaultRounding(),\r\n shadow = getDefaultShadow(),\r\n state = \"\",\r\n disabled = false,\r\n autocomplete = false,\r\n \"data-testid\": testId = \"text-input\",\r\n classMap,\r\n outline = false,\r\n IconButton,\r\n className = \"\",\r\n ...rest\r\n },\r\n ref,\r\n ) => {\r\n const [showPassword, setShowPassword] = useState(false);\r\n\r\n const autoId = useId();\r\n const {\r\n id: idProp,\r\n required,\r\n autoComplete: autoCompleteProp,\r\n type: typeProp,\r\n ...restInput\r\n } = rest as InputHTMLAttributes<HTMLInputElement>;\r\n const inputId = idProp || autoId;\r\n\r\n const inputType = password\r\n ? showPassword\r\n ? \"text\"\r\n : \"password\"\r\n : typeProp || \"text\";\r\n\r\n const descId = ariaDescription ? `${inputId}-description` : undefined;\r\n const isError = state === \"error\";\r\n\r\n const computedAutoComplete =\r\n autoCompleteProp ??\r\n (autocomplete ? (password ? \"current-password\" : \"on\") : \"off\");\r\n\r\n const togglePasswordVisibility = () => setShowPassword((prev) => !prev);\r\n\r\n const hasTitle = Boolean(title);\r\n\r\n const layoutClasses = useMemo(() => {\r\n const posClass = hasTitle\r\n ? classMap[`title${capitalize(titlePosition)}`]\r\n : undefined;\r\n\r\n return combineClassNames(classMap.layout, posClass);\r\n }, [classMap, hasTitle, titlePosition]);\r\n\r\n const titleClasses = useMemo(\r\n () => combineClassNames(classMap.title, classMap.titleOverlay),\r\n [classMap],\r\n );\r\n\r\n const titleNode = hasTitle ? (\r\n <div className={titleClasses} data-testid={`${testId}-title`}>\r\n {title}\r\n </div>\r\n ) : null;\r\n\r\n const wrapperClass = useMemo(\r\n () =>\r\n combineClassNames(\r\n classMap.container,\r\n classMap[theme],\r\n classMap[state],\r\n outline && classMap.outline,\r\n disabled && classMap.disabled,\r\n shadow && classMap[`shadow${capitalize(shadow)}`],\r\n rounding && classMap[`round${capitalize(rounding)}`],\r\n className,\r\n ),\r\n [classMap, theme, state, outline, disabled, shadow, rounding, className],\r\n );\r\n\r\n const inputClasses = useMemo(\r\n () => combineClassNames(classMap.textInput, outline && classMap.outline),\r\n [classMap, outline],\r\n );\r\n\r\n const iconClasses = useMemo(\r\n () =>\r\n combineClassNames(\r\n classMap.iconContainer,\r\n classMap[theme],\r\n disabled && classMap.disabled,\r\n ),\r\n [classMap, theme, disabled],\r\n );\r\n const computedAriaLabel = hasTitle ? undefined : ariaLabel || placeholder;\r\n\r\n const computedPlaceholder =\r\n hasTitle && titlePosition === \"overlay\" ? \" \" : placeholder;\r\n\r\n return (\r\n <div className={layoutClasses} data-testid={`${testId}-layout`}>\r\n {(titlePosition === \"top\" || titlePosition === \"left\") && titleNode}\r\n\r\n <div className={wrapperClass} data-testid={testId}>\r\n {Icon && (\r\n <div\r\n className={iconClasses}\r\n aria-hidden=\"true\"\r\n data-testid={`${testId}-icon`}\r\n >\r\n <Icon aria-hidden=\"true\" />\r\n </div>\r\n )}\r\n\r\n <input\r\n ref={ref}\r\n id={inputId}\r\n type={inputType}\r\n className={inputClasses}\r\n placeholder={computedPlaceholder}\r\n aria-label={computedAriaLabel}\r\n aria-describedby={descId}\r\n aria-disabled={disabled || undefined}\r\n aria-invalid={isError || undefined}\r\n aria-required={required || undefined}\r\n aria-readonly={readOnly || undefined}\r\n autoComplete={computedAutoComplete}\r\n readOnly={readOnly}\r\n disabled={disabled}\r\n required={required}\r\n data-testid={`${testId}-input`}\r\n {...restInput}\r\n />\r\n {hasTitle && titlePosition === \"overlay\" && (\r\n <label\r\n className={classMap.titleOverlayLabel}\r\n htmlFor={inputId}\r\n data-testid={`${testId}-overlay-title`}\r\n >\r\n {title}\r\n </label>\r\n )}\r\n\r\n {password && (\r\n <IconButton\r\n type=\"button\"\r\n className={classMap.togglePassword}\r\n onClick={togglePasswordVisibility}\r\n theme=\"clear\"\r\n shadow=\"none\"\r\n aria-label={showPassword ? \"Hide password\" : \"Show password\"}\r\n aria-pressed={showPassword}\r\n data-testid={`${testId}-password-toggle`}\r\n icon={showPassword ? EyeSlashIcon : EyeIcon}\r\n />\r\n )}\r\n\r\n {ariaDescription && (\r\n <span\r\n id={descId}\r\n className=\"sr_only\"\r\n data-testid={`${testId}-description`}\r\n >\r\n {ariaDescription}\r\n </span>\r\n )}\r\n </div>\r\n\r\n {(titlePosition === \"bottom\" || titlePosition === \"right\") && titleNode}\r\n </div>\r\n );\r\n },\r\n);\r\n\r\nTextInputBase.displayName = \"TextInputBase\";\r\nexport default TextInputBase;\r\n","\"use client\";\r\n\r\nimport { forwardRef } from \"react\";\r\nimport styles from \"./TextInput.module.scss\";\r\nimport { TextInputProps } from \"../TextInput.types\";\r\nimport TextInputBase from \"../TextInputBase\";\r\nimport { IconButton } from \"@/index.next\";\r\n\r\nconst TextInput = forwardRef<HTMLInputElement, TextInputProps>((props, ref) => {\r\n return (\r\n <TextInputBase\r\n {...props}\r\n IconButton={IconButton}\r\n ref={ref}\r\n classMap={styles}\r\n />\r\n );\r\n});\r\n\r\nTextInput.displayName = \"TextInput\";\r\nexport default TextInput;\r\n"],"names":["jsxs","jsx","forwardRef","getDefaultTheme","getDefaultRounding","getDefaultShadow","disabled","outline","IconButton","useState","useId","useMemo","capitalize","combineClassNames"],"mappings":";;;;;;;;AAAA,MAAM,UAAmD,CAAC,UACxDA,2BAAAA;AAAAA,EAAC;AAAA,EAAA;AAAA,IACC,OAAM;AAAA,IACN,QAAO;AAAA,IACP,SAAQ;AAAA,IACR,MAAK;AAAA,IACL,OAAM;AAAA,IACN,OAAM;AAAA,IACN,aAAY;AAAA,IACX,GAAG;AAAA,IAEJ,UAAA;AAAA,MAAAC,2BAAAA;AAAAA,QAAC;AAAA,QAAA;AAAA,UACC,GAAE;AAAA,UACF,QAAO;AAAA,UACP,aAAY;AAAA,UACZ,eAAc;AAAA,UACd,gBAAe;AAAA,QAAA;AAAA,MAAA;AAAA,MAEjBA,2BAAAA;AAAAA,QAAC;AAAA,QAAA;AAAA,UACC,GAAE;AAAA,UACF,MAAK;AAAA,UACL,QAAO;AAAA,UACP,aAAY;AAAA,UACZ,eAAc;AAAA,UACd,gBAAe;AAAA,QAAA;AAAA,MAAA;AAAA,IAChB;AAAA,EAAA;AACH;AC1BF,MAAM,eAAwD,CAAC,UAC7DD,2BAAAA;AAAAA,EAAC;AAAA,EAAA;AAAA,IACC,OAAM;AAAA,IACN,QAAO;AAAA,IACP,SAAQ;AAAA,IACR,aAAY;AAAA,IACZ,MAAK;AAAA,IACL,OAAM;AAAA,IACN,OAAM;AAAA,IACL,GAAG;AAAA,IAEJ,UAAA;AAAA,MAAAC,2BAAAA;AAAAA,QAAC;AAAA,QAAA;AAAA,UACC,GAAE;AAAA,UACF,QAAO;AAAA,UACP,aAAY;AAAA,UACZ,eAAc;AAAA,UACd,gBAAe;AAAA,QAAA;AAAA,MAAA;AAAA,MAEjBA,2BAAAA;AAAAA,QAAC;AAAA,QAAA;AAAA,UACC,GAAE;AAAA,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AAAA,UAAA;AAAA,YACC,MAAK;AAAA,YACL,WAAW,SAAS;AAAA,YACpB,SAAS;AAAA,YACT,OAAM;AAAA,YACN,QAAO;AAAA,YACP,cAAY,eAAe,kBAAkB;AAAA,YAC7C,gBAAc;AAAA,YACd,eAAa,GAAG,MAAM;AAAA,YACtB,MAAM,eAAe,eAAe;AAAA,UAAA;AAAA,QAAA;AAAA,QAIvC,mBACCP,2BAAAA;AAAAA,UAAC;AAAA,UAAA;AAAA,YACC,IAAI;AAAA,YACJ,WAAU;AAAA,YACV,eAAa,GAAG,MAAM;AAAA,YAErB,UAAA;AAAA,UAAA;AAAA,QAAA;AAAA,MACH,GAEJ;AAAA,OAEE,kBAAkB,YAAY,kBAAkB,YAAY;AAAA,IAAA,GAChE;AAAA,EAEJ;AACF;AAEA,cAAc,cAAc;AChM5B,MAAM,YAAYC,MAAAA,WAA6C,CAAC,OAAO,QAAQ;AAC7E,SACED,2BAAAA;AAAAA,IAAC;AAAA,IAAA;AAAA,MACE,GAAG;AAAA,MAAA,YACJO,WAAAA;AAAAA,MACA;AAAA,MACA,UAAU;AAAA,IAAA;AAAA,EAAA;AAGhB,CAAC;AAED,UAAU,cAAc;;"}
|
|
@@ -96,30 +96,30 @@ const EyeSlashIcon = (props) => /* @__PURE__ */ jsxs(
|
|
|
96
96
|
]
|
|
97
97
|
}
|
|
98
98
|
);
|
|
99
|
-
const container = "
|
|
100
|
-
const roundNone = "
|
|
101
|
-
const roundSmall = "
|
|
102
|
-
const roundMedium = "
|
|
103
|
-
const roundLarge = "
|
|
104
|
-
const roundFull = "
|
|
105
|
-
const shadowNone = "
|
|
106
|
-
const shadowLight = "
|
|
107
|
-
const shadowMedium = "
|
|
108
|
-
const shadowStrong = "
|
|
109
|
-
const shadowIntense = "
|
|
110
|
-
const textInput = "
|
|
111
|
-
const iconContainer = "
|
|
112
|
-
const togglePassword = "
|
|
113
|
-
const success = "
|
|
114
|
-
const error = "
|
|
115
|
-
const warning = "
|
|
116
|
-
const primary = "
|
|
117
|
-
const outline = "
|
|
118
|
-
const secondary = "
|
|
119
|
-
const tertiary = "
|
|
120
|
-
const quaternary = "
|
|
121
|
-
const clear = "
|
|
122
|
-
const disabled = "
|
|
99
|
+
const container = "_container_1o1xb_85";
|
|
100
|
+
const roundNone = "_roundNone_1o1xb_123";
|
|
101
|
+
const roundSmall = "_roundSmall_1o1xb_130";
|
|
102
|
+
const roundMedium = "_roundMedium_1o1xb_137";
|
|
103
|
+
const roundLarge = "_roundLarge_1o1xb_144";
|
|
104
|
+
const roundFull = "_roundFull_1o1xb_151";
|
|
105
|
+
const shadowNone = "_shadowNone_1o1xb_158";
|
|
106
|
+
const shadowLight = "_shadowLight_1o1xb_162";
|
|
107
|
+
const shadowMedium = "_shadowMedium_1o1xb_166";
|
|
108
|
+
const shadowStrong = "_shadowStrong_1o1xb_170";
|
|
109
|
+
const shadowIntense = "_shadowIntense_1o1xb_174";
|
|
110
|
+
const textInput = "_textInput_1o1xb_178";
|
|
111
|
+
const iconContainer = "_iconContainer_1o1xb_207";
|
|
112
|
+
const togglePassword = "_togglePassword_1o1xb_229";
|
|
113
|
+
const success = "_success_1o1xb_248";
|
|
114
|
+
const error = "_error_1o1xb_252";
|
|
115
|
+
const warning = "_warning_1o1xb_256";
|
|
116
|
+
const primary = "_primary_1o1xb_260";
|
|
117
|
+
const outline = "_outline_1o1xb_270";
|
|
118
|
+
const secondary = "_secondary_1o1xb_277";
|
|
119
|
+
const tertiary = "_tertiary_1o1xb_294";
|
|
120
|
+
const quaternary = "_quaternary_1o1xb_311";
|
|
121
|
+
const clear = "_clear_1o1xb_328";
|
|
122
|
+
const disabled = "_disabled_1o1xb_349";
|
|
123
123
|
const styles = {
|
|
124
124
|
container,
|
|
125
125
|
roundNone,
|
|
@@ -308,4 +308,4 @@ TextInput.displayName = "TextInput";
|
|
|
308
308
|
export {
|
|
309
309
|
TextInput as T
|
|
310
310
|
};
|
|
311
|
-
//# sourceMappingURL=TextInput-
|
|
311
|
+
//# sourceMappingURL=TextInput-dwn3uD65.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextInput-C8rQAwus.js","sources":["../../src/Icons/EyeIcon.tsx","../../src/Icons/EyeSlashIcon.tsx","../../src/components/TextInput/TextInputBase.tsx","../../src/components/TextInput/next/TextInput.tsx"],"sourcesContent":["const EyeIcon: React.FC<React.SVGProps<SVGSVGElement>> = (props) => (\r\n <svg\r\n width=\"24px\"\r\n height=\"24px\"\r\n viewBox=\"0 0 24 24\"\r\n fill=\"none\"\r\n xmlns=\"http://www.w3.org/2000/svg\"\r\n color=\"currentColor\"\r\n strokeWidth=\"1.5\"\r\n {...props}\r\n >\r\n <path\r\n d=\"M3 13C6.6 5 17.4 5 21 13\"\r\n stroke=\"currentColor\"\r\n strokeWidth=\"1.5\"\r\n strokeLinecap=\"round\"\r\n strokeLinejoin=\"round\"\r\n ></path>\r\n <path\r\n d=\"M12 17C10.3431 17 9 15.6569 9 14C9 12.3431 10.3431 11 12 11C13.6569 11 15 12.3431 15 14C15 15.6569 13.6569 17 12 17Z\"\r\n fill=\"currentColor\"\r\n stroke=\"currentColor\"\r\n strokeWidth=\"1.5\"\r\n strokeLinecap=\"round\"\r\n strokeLinejoin=\"round\"\r\n ></path>\r\n </svg>\r\n);\r\n\r\nexport default EyeIcon;\r\n","const EyeSlashIcon: React.FC<React.SVGProps<SVGSVGElement>> = (props) => (\r\n <svg\r\n width=\"24px\"\r\n height=\"24px\"\r\n viewBox=\"0 0 24 24\"\r\n strokeWidth=\"1.5\"\r\n fill=\"none\"\r\n xmlns=\"http://www.w3.org/2000/svg\"\r\n color=\"currentColor\"\r\n {...props}\r\n >\r\n <path\r\n d=\"M19.5 16L17.0248 12.6038\"\r\n stroke=\"currentColor\"\r\n strokeWidth=\"1.5\"\r\n strokeLinecap=\"round\"\r\n strokeLinejoin=\"round\"\r\n ></path>\r\n <path\r\n d=\"M12 17.5V14\"\r\n stroke=\"currentColor\"\r\n strokeWidth=\"1.5\"\r\n strokeLinecap=\"round\"\r\n strokeLinejoin=\"round\"\r\n ></path>\r\n <path\r\n d=\"M4.5 16L6.96895 12.6124\"\r\n stroke=\"currentColor\"\r\n strokeWidth=\"1.5\"\r\n strokeLinecap=\"round\"\r\n strokeLinejoin=\"round\"\r\n ></path>\r\n <path\r\n d=\"M3 8C6.6 16 17.4 16 21 8\"\r\n stroke=\"currentColor\"\r\n strokeWidth=\"1.5\"\r\n strokeLinecap=\"round\"\r\n strokeLinejoin=\"round\"\r\n ></path>\r\n </svg>\r\n);\r\n\r\nexport default EyeSlashIcon;\r\n","import {\r\n forwardRef,\r\n useState,\r\n useId,\r\n InputHTMLAttributes,\r\n useMemo,\r\n} from \"react\";\r\nimport { EyeIcon, EyeSlashIcon } from \"../../Icons\";\r\nimport { TextInputBaseProps } from \"./TextInput.types\";\r\nimport { combineClassNames } from \"../../utils/classNames\";\r\nimport { capitalize } from \"../../utils/capitalize\";\r\nimport {\r\n getDefaultRounding,\r\n getDefaultShadow,\r\n getDefaultTheme,\r\n} from \"../../config/boreal-style-config\";\r\n\r\nconst TextInputBase = forwardRef<HTMLInputElement, TextInputBaseProps>(\r\n (\r\n {\r\n icon: Icon,\r\n title,\r\n titlePosition = \"top\",\r\n placeholder = \"Enter text\",\r\n password = false,\r\n readOnly = false,\r\n ariaLabel,\r\n ariaDescription,\r\n theme = getDefaultTheme(),\r\n rounding = getDefaultRounding(),\r\n shadow = getDefaultShadow(),\r\n state = \"\",\r\n disabled = false,\r\n autocomplete = false,\r\n \"data-testid\": testId = \"text-input\",\r\n classMap,\r\n outline = false,\r\n IconButton,\r\n className = \"\",\r\n ...rest\r\n },\r\n ref,\r\n ) => {\r\n const [showPassword, setShowPassword] = useState(false);\r\n\r\n const autoId = useId();\r\n const {\r\n id: idProp,\r\n required,\r\n autoComplete: autoCompleteProp,\r\n type: typeProp,\r\n ...restInput\r\n } = rest as InputHTMLAttributes<HTMLInputElement>;\r\n const inputId = idProp || autoId;\r\n\r\n const inputType = password\r\n ? showPassword\r\n ? \"text\"\r\n : \"password\"\r\n : typeProp || \"text\";\r\n\r\n const descId = ariaDescription ? `${inputId}-description` : undefined;\r\n const isError = state === \"error\";\r\n\r\n const computedAutoComplete =\r\n autoCompleteProp ??\r\n (autocomplete ? (password ? \"current-password\" : \"on\") : \"off\");\r\n\r\n const togglePasswordVisibility = () => setShowPassword((prev) => !prev);\r\n\r\n const hasTitle = Boolean(title);\r\n\r\n const layoutClasses = useMemo(() => {\r\n const posClass = hasTitle\r\n ? classMap[`title${capitalize(titlePosition)}`]\r\n : undefined;\r\n\r\n return combineClassNames(classMap.layout, posClass);\r\n }, [classMap, hasTitle, titlePosition]);\r\n\r\n const titleClasses = useMemo(\r\n () => combineClassNames(classMap.title, classMap.titleOverlay),\r\n [classMap],\r\n );\r\n\r\n const titleNode = hasTitle ? (\r\n <div className={titleClasses} data-testid={`${testId}-title`}>\r\n {title}\r\n </div>\r\n ) : null;\r\n\r\n const wrapperClass = useMemo(\r\n () =>\r\n combineClassNames(\r\n classMap.container,\r\n classMap[theme],\r\n classMap[state],\r\n outline && classMap.outline,\r\n disabled && classMap.disabled,\r\n shadow && classMap[`shadow${capitalize(shadow)}`],\r\n rounding && classMap[`round${capitalize(rounding)}`],\r\n className,\r\n ),\r\n [classMap, theme, state, outline, disabled, shadow, rounding, className],\r\n );\r\n\r\n const inputClasses = useMemo(\r\n () => combineClassNames(classMap.textInput, outline && classMap.outline),\r\n [classMap, outline],\r\n );\r\n\r\n const iconClasses = useMemo(\r\n () =>\r\n combineClassNames(\r\n classMap.iconContainer,\r\n classMap[theme],\r\n disabled && classMap.disabled,\r\n ),\r\n [classMap, theme, disabled],\r\n );\r\n const computedAriaLabel = hasTitle ? undefined : ariaLabel || placeholder;\r\n\r\n const computedPlaceholder =\r\n hasTitle && titlePosition === \"overlay\" ? \" \" : placeholder;\r\n\r\n return (\r\n <div className={layoutClasses} data-testid={`${testId}-layout`}>\r\n {(titlePosition === \"top\" || titlePosition === \"left\") && titleNode}\r\n\r\n <div className={wrapperClass} data-testid={testId}>\r\n {Icon && (\r\n <div\r\n className={iconClasses}\r\n aria-hidden=\"true\"\r\n data-testid={`${testId}-icon`}\r\n >\r\n <Icon aria-hidden=\"true\" />\r\n </div>\r\n )}\r\n\r\n <input\r\n ref={ref}\r\n id={inputId}\r\n type={inputType}\r\n className={inputClasses}\r\n placeholder={computedPlaceholder}\r\n aria-label={computedAriaLabel}\r\n aria-describedby={descId}\r\n aria-disabled={disabled || undefined}\r\n aria-invalid={isError || undefined}\r\n aria-required={required || undefined}\r\n aria-readonly={readOnly || undefined}\r\n autoComplete={computedAutoComplete}\r\n readOnly={readOnly}\r\n disabled={disabled}\r\n required={required}\r\n data-testid={`${testId}-input`}\r\n {...restInput}\r\n />\r\n {hasTitle && titlePosition === \"overlay\" && (\r\n <label\r\n className={classMap.titleOverlayLabel}\r\n htmlFor={inputId}\r\n data-testid={`${testId}-overlay-title`}\r\n >\r\n {title}\r\n </label>\r\n )}\r\n\r\n {password && (\r\n <IconButton\r\n type=\"button\"\r\n className={classMap.togglePassword}\r\n onClick={togglePasswordVisibility}\r\n theme=\"clear\"\r\n shadow=\"none\"\r\n aria-label={showPassword ? \"Hide password\" : \"Show password\"}\r\n aria-pressed={showPassword}\r\n data-testid={`${testId}-password-toggle`}\r\n icon={showPassword ? EyeSlashIcon : EyeIcon}\r\n />\r\n )}\r\n\r\n {ariaDescription && (\r\n <span\r\n id={descId}\r\n className=\"sr_only\"\r\n data-testid={`${testId}-description`}\r\n >\r\n {ariaDescription}\r\n </span>\r\n )}\r\n </div>\r\n\r\n {(titlePosition === \"bottom\" || titlePosition === \"right\") && titleNode}\r\n </div>\r\n );\r\n },\r\n);\r\n\r\nTextInputBase.displayName = \"TextInputBase\";\r\nexport default TextInputBase;\r\n","\"use client\";\r\n\r\nimport { forwardRef } from \"react\";\r\nimport styles from \"./TextInput.module.scss\";\r\nimport { TextInputProps } from \"../TextInput.types\";\r\nimport TextInputBase from \"../TextInputBase\";\r\nimport { IconButton } from \"@/index.next\";\r\n\r\nconst TextInput = forwardRef<HTMLInputElement, TextInputProps>((props, ref) => {\r\n return (\r\n <TextInputBase\r\n {...props}\r\n IconButton={IconButton}\r\n ref={ref}\r\n classMap={styles}\r\n />\r\n );\r\n});\r\n\r\nTextInput.displayName = \"TextInput\";\r\nexport default TextInput;\r\n"],"names":["disabled","outline","IconButton"],"mappings":";;;;;;;AAAA,MAAM,UAAmD,CAAC,UACxD;AAAA,EAAC;AAAA,EAAA;AAAA,IACC,OAAM;AAAA,IACN,QAAO;AAAA,IACP,SAAQ;AAAA,IACR,MAAK;AAAA,IACL,OAAM;AAAA,IACN,OAAM;AAAA,IACN,aAAY;AAAA,IACX,GAAG;AAAA,IAEJ,UAAA;AAAA,MAAA;AAAA,QAAC;AAAA,QAAA;AAAA,UACC,GAAE;AAAA,UACF,QAAO;AAAA,UACP,aAAY;AAAA,UACZ,eAAc;AAAA,UACd,gBAAe;AAAA,QAAA;AAAA,MAAA;AAAA,MAEjB;AAAA,QAAC;AAAA,QAAA;AAAA,UACC,GAAE;AAAA,UACF,MAAK;AAAA,UACL,QAAO;AAAA,UACP,aAAY;AAAA,UACZ,eAAc;AAAA,UACd,gBAAe;AAAA,QAAA;AAAA,MAAA;AAAA,IAChB;AAAA,EAAA;AACH;AC1BF,MAAM,eAAwD,CAAC,UAC7D;AAAA,EAAC;AAAA,EAAA;AAAA,IACC,OAAM;AAAA,IACN,QAAO;AAAA,IACP,SAAQ;AAAA,IACR,aAAY;AAAA,IACZ,MAAK;AAAA,IACL,OAAM;AAAA,IACN,OAAM;AAAA,IACL,GAAG;AAAA,IAEJ,UAAA;AAAA,MAAA;AAAA,QAAC;AAAA,QAAA;AAAA,UACC,GAAE;AAAA,UACF,QAAO;AAAA,UACP,aAAY;AAAA,UACZ,eAAc;AAAA,UACd,gBAAe;AAAA,QAAA;AAAA,MAAA;AAAA,MAEjB;AAAA,QAAC;AAAA,QAAA;AAAA,UACC,GAAE;AA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,QAIvC,mBACC;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,IAAI;AAAA,YACJ,WAAU;AAAA,YACV,eAAa,GAAG,MAAM;AAAA,YAErB,UAAA;AAAA,UAAA;AAAA,QAAA;AAAA,MACH,GAEJ;AAAA,OAEE,kBAAkB,YAAY,kBAAkB,YAAY;AAAA,IAAA,GAChE;AAAA,EAEJ;AACF;AAEA,cAAc,cAAc;AChM5B,MAAM,YAAY,WAA6C,CAAC,OAAO,QAAQ;AAC7E,SACE;AAAA,IAAC;AAAA,IAAA;AAAA,MACE,GAAG;AAAA,MACJ;AAAA,MACA;AAAA,MACA,UAAU;AAAA,IAAA;AAAA,EAAA;AAGhB,CAAC;AAED,UAAU,cAAc;"}
|
|
1
|
+
{"version":3,"file":"TextInput-dwn3uD65.js","sources":["../../src/Icons/EyeIcon.tsx","../../src/Icons/EyeSlashIcon.tsx","../../src/components/TextInput/TextInputBase.tsx","../../src/components/TextInput/next/TextInput.tsx"],"sourcesContent":["const EyeIcon: React.FC<React.SVGProps<SVGSVGElement>> = (props) => (\r\n <svg\r\n width=\"24px\"\r\n height=\"24px\"\r\n viewBox=\"0 0 24 24\"\r\n fill=\"none\"\r\n xmlns=\"http://www.w3.org/2000/svg\"\r\n color=\"currentColor\"\r\n strokeWidth=\"1.5\"\r\n {...props}\r\n >\r\n <path\r\n d=\"M3 13C6.6 5 17.4 5 21 13\"\r\n stroke=\"currentColor\"\r\n strokeWidth=\"1.5\"\r\n strokeLinecap=\"round\"\r\n strokeLinejoin=\"round\"\r\n ></path>\r\n <path\r\n d=\"M12 17C10.3431 17 9 15.6569 9 14C9 12.3431 10.3431 11 12 11C13.6569 11 15 12.3431 15 14C15 15.6569 13.6569 17 12 17Z\"\r\n fill=\"currentColor\"\r\n stroke=\"currentColor\"\r\n strokeWidth=\"1.5\"\r\n strokeLinecap=\"round\"\r\n strokeLinejoin=\"round\"\r\n ></path>\r\n </svg>\r\n);\r\n\r\nexport default EyeIcon;\r\n","const EyeSlashIcon: React.FC<React.SVGProps<SVGSVGElement>> = (props) => (\r\n <svg\r\n width=\"24px\"\r\n height=\"24px\"\r\n viewBox=\"0 0 24 24\"\r\n strokeWidth=\"1.5\"\r\n fill=\"none\"\r\n xmlns=\"http://www.w3.org/2000/svg\"\r\n color=\"currentColor\"\r\n {...props}\r\n >\r\n <path\r\n d=\"M19.5 16L17.0248 12.6038\"\r\n stroke=\"currentColor\"\r\n strokeWidth=\"1.5\"\r\n strokeLinecap=\"round\"\r\n strokeLinejoin=\"round\"\r\n ></path>\r\n <path\r\n d=\"M12 17.5V14\"\r\n stroke=\"currentColor\"\r\n strokeWidth=\"1.5\"\r\n strokeLinecap=\"round\"\r\n strokeLinejoin=\"round\"\r\n ></path>\r\n <path\r\n d=\"M4.5 16L6.96895 12.6124\"\r\n stroke=\"currentColor\"\r\n strokeWidth=\"1.5\"\r\n strokeLinecap=\"round\"\r\n strokeLinejoin=\"round\"\r\n ></path>\r\n <path\r\n d=\"M3 8C6.6 16 17.4 16 21 8\"\r\n stroke=\"currentColor\"\r\n strokeWidth=\"1.5\"\r\n strokeLinecap=\"round\"\r\n strokeLinejoin=\"round\"\r\n ></path>\r\n </svg>\r\n);\r\n\r\nexport default EyeSlashIcon;\r\n","import {\r\n forwardRef,\r\n useState,\r\n useId,\r\n InputHTMLAttributes,\r\n useMemo,\r\n} from \"react\";\r\nimport { EyeIcon, EyeSlashIcon } from \"../../Icons\";\r\nimport { TextInputBaseProps } from \"./TextInput.types\";\r\nimport { combineClassNames } from \"../../utils/classNames\";\r\nimport { capitalize } from \"../../utils/capitalize\";\r\nimport {\r\n getDefaultRounding,\r\n getDefaultShadow,\r\n getDefaultTheme,\r\n} from \"../../config/boreal-style-config\";\r\n\r\nconst TextInputBase = forwardRef<HTMLInputElement, TextInputBaseProps>(\r\n (\r\n {\r\n icon: Icon,\r\n title,\r\n titlePosition = \"top\",\r\n placeholder = \"Enter text\",\r\n password = false,\r\n readOnly = false,\r\n ariaLabel,\r\n ariaDescription,\r\n theme = getDefaultTheme(),\r\n rounding = getDefaultRounding(),\r\n shadow = getDefaultShadow(),\r\n state = \"\",\r\n disabled = false,\r\n autocomplete = false,\r\n \"data-testid\": testId = \"text-input\",\r\n classMap,\r\n outline = false,\r\n IconButton,\r\n className = \"\",\r\n ...rest\r\n },\r\n ref,\r\n ) => {\r\n const [showPassword, setShowPassword] = useState(false);\r\n\r\n const autoId = useId();\r\n const {\r\n id: idProp,\r\n required,\r\n autoComplete: autoCompleteProp,\r\n type: typeProp,\r\n ...restInput\r\n } = rest as InputHTMLAttributes<HTMLInputElement>;\r\n const inputId = idProp || autoId;\r\n\r\n const inputType = password\r\n ? showPassword\r\n ? \"text\"\r\n : \"password\"\r\n : typeProp || \"text\";\r\n\r\n const descId = ariaDescription ? `${inputId}-description` : undefined;\r\n const isError = state === \"error\";\r\n\r\n const computedAutoComplete =\r\n autoCompleteProp ??\r\n (autocomplete ? (password ? \"current-password\" : \"on\") : \"off\");\r\n\r\n const togglePasswordVisibility = () => setShowPassword((prev) => !prev);\r\n\r\n const hasTitle = Boolean(title);\r\n\r\n const layoutClasses = useMemo(() => {\r\n const posClass = hasTitle\r\n ? classMap[`title${capitalize(titlePosition)}`]\r\n : undefined;\r\n\r\n return combineClassNames(classMap.layout, posClass);\r\n }, [classMap, hasTitle, titlePosition]);\r\n\r\n const titleClasses = useMemo(\r\n () => combineClassNames(classMap.title, classMap.titleOverlay),\r\n [classMap],\r\n );\r\n\r\n const titleNode = hasTitle ? (\r\n <div className={titleClasses} data-testid={`${testId}-title`}>\r\n {title}\r\n </div>\r\n ) : null;\r\n\r\n const wrapperClass = useMemo(\r\n () =>\r\n combineClassNames(\r\n classMap.container,\r\n classMap[theme],\r\n classMap[state],\r\n outline && classMap.outline,\r\n disabled && classMap.disabled,\r\n shadow && classMap[`shadow${capitalize(shadow)}`],\r\n rounding && classMap[`round${capitalize(rounding)}`],\r\n className,\r\n ),\r\n [classMap, theme, state, outline, disabled, shadow, rounding, className],\r\n );\r\n\r\n const inputClasses = useMemo(\r\n () => combineClassNames(classMap.textInput, outline && classMap.outline),\r\n [classMap, outline],\r\n );\r\n\r\n const iconClasses = useMemo(\r\n () =>\r\n combineClassNames(\r\n classMap.iconContainer,\r\n classMap[theme],\r\n disabled && classMap.disabled,\r\n ),\r\n [classMap, theme, disabled],\r\n );\r\n const computedAriaLabel = hasTitle ? undefined : ariaLabel || placeholder;\r\n\r\n const computedPlaceholder =\r\n hasTitle && titlePosition === \"overlay\" ? \" \" : placeholder;\r\n\r\n return (\r\n <div className={layoutClasses} data-testid={`${testId}-layout`}>\r\n {(titlePosition === \"top\" || titlePosition === \"left\") && titleNode}\r\n\r\n <div className={wrapperClass} data-testid={testId}>\r\n {Icon && (\r\n <div\r\n className={iconClasses}\r\n aria-hidden=\"true\"\r\n data-testid={`${testId}-icon`}\r\n >\r\n <Icon aria-hidden=\"true\" />\r\n </div>\r\n )}\r\n\r\n <input\r\n ref={ref}\r\n id={inputId}\r\n type={inputType}\r\n className={inputClasses}\r\n placeholder={computedPlaceholder}\r\n aria-label={computedAriaLabel}\r\n aria-describedby={descId}\r\n aria-disabled={disabled || undefined}\r\n aria-invalid={isError || undefined}\r\n aria-required={required || undefined}\r\n aria-readonly={readOnly || undefined}\r\n autoComplete={computedAutoComplete}\r\n readOnly={readOnly}\r\n disabled={disabled}\r\n required={required}\r\n data-testid={`${testId}-input`}\r\n {...restInput}\r\n />\r\n {hasTitle && titlePosition === \"overlay\" && (\r\n <label\r\n className={classMap.titleOverlayLabel}\r\n htmlFor={inputId}\r\n data-testid={`${testId}-overlay-title`}\r\n >\r\n {title}\r\n </label>\r\n )}\r\n\r\n {password && (\r\n <IconButton\r\n type=\"button\"\r\n className={classMap.togglePassword}\r\n onClick={togglePasswordVisibility}\r\n theme=\"clear\"\r\n shadow=\"none\"\r\n aria-label={showPassword ? \"Hide password\" : \"Show password\"}\r\n aria-pressed={showPassword}\r\n data-testid={`${testId}-password-toggle`}\r\n icon={showPassword ? EyeSlashIcon : EyeIcon}\r\n />\r\n )}\r\n\r\n {ariaDescription && (\r\n <span\r\n id={descId}\r\n className=\"sr_only\"\r\n data-testid={`${testId}-description`}\r\n >\r\n {ariaDescription}\r\n </span>\r\n )}\r\n </div>\r\n\r\n {(titlePosition === \"bottom\" || titlePosition === \"right\") && titleNode}\r\n </div>\r\n );\r\n },\r\n);\r\n\r\nTextInputBase.displayName = \"TextInputBase\";\r\nexport default TextInputBase;\r\n","\"use client\";\r\n\r\nimport { forwardRef } from \"react\";\r\nimport styles from \"./TextInput.module.scss\";\r\nimport { TextInputProps } from \"../TextInput.types\";\r\nimport TextInputBase from \"../TextInputBase\";\r\nimport { IconButton } from \"@/index.next\";\r\n\r\nconst TextInput = forwardRef<HTMLInputElement, TextInputProps>((props, ref) => {\r\n return (\r\n <TextInputBase\r\n {...props}\r\n IconButton={IconButton}\r\n ref={ref}\r\n classMap={styles}\r\n />\r\n );\r\n});\r\n\r\nTextInput.displayName = \"TextInput\";\r\nexport default TextInput;\r\n"],"names":["disabled","outline","IconButton"],"mappings":";;;;;;;AAAA,MAAM,UAAmD,CAAC,UACxD;AAAA,EAAC;AAAA,EAAA;AAAA,IACC,OAAM;AAAA,IACN,QAAO;AAAA,IACP,SAAQ;AAAA,IACR,MAAK;AAAA,IACL,OAAM;AAAA,IACN,OAAM;AAAA,IACN,aAAY;AAAA,IACX,GAAG;AAAA,IAEJ,UAAA;AAAA,MAAA;AAAA,QAAC;AAAA,QAAA;AAAA,UACC,GAAE;AAAA,UACF,QAAO;AAAA,UACP,aAAY;AAAA,UACZ,eAAc;AAAA,UACd,gBAAe;AAAA,QAAA;AAAA,MAAA;AAAA,MAEjB;AAAA,QAAC;AAAA,QAAA;AAAA,UACC,GAAE;AAAA,UACF,MAAK;AAAA,UACL,QAAO;AAAA,UACP,aAAY;AAAA,UACZ,eAAc;AAAA,UACd,gBAAe;AAAA,QAAA;AAAA,MAAA;AAAA,IAChB;AAAA,EAAA;AACH;AC1BF,MAAM,eAAw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C;AAAA,UAAA;AAAA,YACC,WAAW,SAAS;AAAA,YACpB,SAAS;AAAA,YACT,eAAa,GAAG,MAAM;AAAA,YAErB,UAAA;AAAA,UAAA;AAAA,QAAA;AAAA,QAIJ,YACC;AAAA,UAACE;AAAA,UAAA;AAAA,YACC,MAAK;AAAA,YACL,WAAW,SAAS;AAAA,YACpB,SAAS;AAAA,YACT,OAAM;AAAA,YACN,QAAO;AAAA,YACP,cAAY,eAAe,kBAAkB;AAAA,YAC7C,gBAAc;AAAA,YACd,eAAa,GAAG,MAAM;AAAA,YACtB,MAAM,eAAe,eAAe;AAAA,UAAA;AAAA,QAAA;AAAA,QAIvC,mBACC;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,IAAI;AAAA,YACJ,WAAU;AAAA,YACV,eAAa,GAAG,MAAM;AAAA,YAErB,UAAA;AAAA,UAAA;AAAA,QAAA;AAAA,MACH,GAEJ;AAAA,OAEE,kBAAkB,YAAY,kBAAkB,YAAY;AAAA,IAAA,GAChE;AAAA,EAEJ;AACF;AAEA,cAAc,cAAc;AChM5B,MAAM,YAAY,WAA6C,CAAC,OAAO,QAAQ;AAC7E,SACE;AAAA,IAAC;AAAA,IAAA;AAAA,MACE,GAAG;AAAA,MACJ;AAAA,MACA;AAAA,MACA,UAAU;AAAA,IAAA;AAAA,EAAA;AAGhB,CAAC;AAED,UAAU,cAAc;"}
|
package/dist/next/TextInput.js
CHANGED
package/dist/next/boreal-ui.css
CHANGED
|
@@ -10547,7 +10547,7 @@ a:hover {
|
|
|
10547
10547
|
* $breakpoints map:
|
|
10548
10548
|
* Use this map to loop over breakpoints or access named values.
|
|
10549
10549
|
*/
|
|
10550
|
-
.
|
|
10550
|
+
._container_1o1xb_85 {
|
|
10551
10551
|
display: inline-flex;
|
|
10552
10552
|
justify-content: space-between;
|
|
10553
10553
|
align-items: center;
|
|
@@ -10557,20 +10557,20 @@ a:hover {
|
|
|
10557
10557
|
max-width: 400px;
|
|
10558
10558
|
background: transparent;
|
|
10559
10559
|
}
|
|
10560
|
-
.
|
|
10560
|
+
._container_1o1xb_85:focus-within {
|
|
10561
10561
|
outline: 2px solid var(--focus-outline-color, var(--primary-color));
|
|
10562
10562
|
outline-offset: 3px;
|
|
10563
10563
|
border-radius: 10px;
|
|
10564
10564
|
}
|
|
10565
10565
|
@media (width <= 319.98px) {
|
|
10566
|
-
.
|
|
10566
|
+
._container_1o1xb_85 {
|
|
10567
10567
|
padding: 0.5rem;
|
|
10568
10568
|
height: 35px;
|
|
10569
10569
|
width: 95%;
|
|
10570
10570
|
max-width: none;
|
|
10571
10571
|
}
|
|
10572
10572
|
}
|
|
10573
|
-
.
|
|
10573
|
+
._container_1o1xb_85 input {
|
|
10574
10574
|
width: 100%;
|
|
10575
10575
|
padding: 4px;
|
|
10576
10576
|
border: none;
|
|
@@ -10578,69 +10578,69 @@ a:hover {
|
|
|
10578
10578
|
background-color: transparent;
|
|
10579
10579
|
color: var(--text-color-primary);
|
|
10580
10580
|
}
|
|
10581
|
-
.
|
|
10581
|
+
._container_1o1xb_85 input:hover {
|
|
10582
10582
|
background-color: transparent;
|
|
10583
10583
|
}
|
|
10584
|
-
.
|
|
10584
|
+
._container_1o1xb_85 input:focus, ._container_1o1xb_85 input:focus-within {
|
|
10585
10585
|
outline: none;
|
|
10586
10586
|
}
|
|
10587
10587
|
|
|
10588
|
-
.
|
|
10588
|
+
._roundNone_1o1xb_123 {
|
|
10589
10589
|
border-radius: var(--border-radius-none);
|
|
10590
10590
|
}
|
|
10591
|
-
.
|
|
10591
|
+
._roundNone_1o1xb_123 input {
|
|
10592
10592
|
border-radius: var(--border-radius-none);
|
|
10593
10593
|
}
|
|
10594
10594
|
|
|
10595
|
-
.
|
|
10595
|
+
._roundSmall_1o1xb_130 {
|
|
10596
10596
|
border-radius: var(--border-radius-sm);
|
|
10597
10597
|
}
|
|
10598
|
-
.
|
|
10598
|
+
._roundSmall_1o1xb_130 input {
|
|
10599
10599
|
border-radius: var(--border-radius-sm);
|
|
10600
10600
|
}
|
|
10601
10601
|
|
|
10602
|
-
.
|
|
10602
|
+
._roundMedium_1o1xb_137 {
|
|
10603
10603
|
border-radius: var(--border-radius-md);
|
|
10604
10604
|
}
|
|
10605
|
-
.
|
|
10605
|
+
._roundMedium_1o1xb_137 input {
|
|
10606
10606
|
border-radius: var(--border-radius-md);
|
|
10607
10607
|
}
|
|
10608
10608
|
|
|
10609
|
-
.
|
|
10609
|
+
._roundLarge_1o1xb_144 {
|
|
10610
10610
|
border-radius: var(--border-radius-lg);
|
|
10611
10611
|
}
|
|
10612
|
-
.
|
|
10612
|
+
._roundLarge_1o1xb_144 input {
|
|
10613
10613
|
border-radius: var(--border-radius-lg);
|
|
10614
10614
|
}
|
|
10615
10615
|
|
|
10616
|
-
.
|
|
10616
|
+
._roundFull_1o1xb_151 {
|
|
10617
10617
|
border-radius: var(--border-radius-full);
|
|
10618
10618
|
}
|
|
10619
|
-
.
|
|
10619
|
+
._roundFull_1o1xb_151 input {
|
|
10620
10620
|
border-radius: var(--border-radius-full);
|
|
10621
10621
|
}
|
|
10622
10622
|
|
|
10623
|
-
.
|
|
10623
|
+
._shadowNone_1o1xb_158 {
|
|
10624
10624
|
box-shadow: var(--box-shadow-none);
|
|
10625
10625
|
}
|
|
10626
10626
|
|
|
10627
|
-
.
|
|
10627
|
+
._shadowLight_1o1xb_162 {
|
|
10628
10628
|
box-shadow: var(--box-shadow-light);
|
|
10629
10629
|
}
|
|
10630
10630
|
|
|
10631
|
-
.
|
|
10631
|
+
._shadowMedium_1o1xb_166 {
|
|
10632
10632
|
box-shadow: var(--box-shadow-medium);
|
|
10633
10633
|
}
|
|
10634
10634
|
|
|
10635
|
-
.
|
|
10635
|
+
._shadowStrong_1o1xb_170 {
|
|
10636
10636
|
box-shadow: var(--box-shadow-heavy);
|
|
10637
10637
|
}
|
|
10638
10638
|
|
|
10639
|
-
.
|
|
10639
|
+
._shadowIntense_1o1xb_174 {
|
|
10640
10640
|
box-shadow: var(--box-shadow-intense);
|
|
10641
10641
|
}
|
|
10642
10642
|
|
|
10643
|
-
.
|
|
10643
|
+
._textInput_1o1xb_178 {
|
|
10644
10644
|
outline: none;
|
|
10645
10645
|
flex: 1;
|
|
10646
10646
|
margin: 8px;
|
|
@@ -10652,41 +10652,46 @@ a:hover {
|
|
|
10652
10652
|
font-family: "Lora", arial, sans-serif;
|
|
10653
10653
|
min-height: 2.5rem;
|
|
10654
10654
|
}
|
|
10655
|
-
.
|
|
10655
|
+
._textInput_1o1xb_178::placeholder {
|
|
10656
10656
|
color: var(--text-color-primary);
|
|
10657
10657
|
opacity: 0.8;
|
|
10658
10658
|
}
|
|
10659
|
-
.
|
|
10659
|
+
._textInput_1o1xb_178:focus-visible {
|
|
10660
10660
|
outline: 2px solid var(--focus-outline-color, var(--primary-color));
|
|
10661
10661
|
outline-offset: 2px;
|
|
10662
10662
|
border-radius: 20px;
|
|
10663
10663
|
}
|
|
10664
10664
|
@media (width <= 319.98px) {
|
|
10665
|
-
.
|
|
10665
|
+
._textInput_1o1xb_178 {
|
|
10666
10666
|
width: 100%;
|
|
10667
10667
|
font-size: 16.2px;
|
|
10668
10668
|
margin: 4px;
|
|
10669
10669
|
}
|
|
10670
10670
|
}
|
|
10671
10671
|
|
|
10672
|
-
.
|
|
10672
|
+
._iconContainer_1o1xb_207 {
|
|
10673
10673
|
display: flex;
|
|
10674
10674
|
box-sizing: border-box;
|
|
10675
|
-
margin: 0.
|
|
10675
|
+
margin: 0.5rem;
|
|
10676
10676
|
}
|
|
10677
|
-
.
|
|
10677
|
+
@media (width <= 319.98px) {
|
|
10678
|
+
._iconContainer_1o1xb_207 {
|
|
10679
|
+
margin: 0.1rem;
|
|
10680
|
+
}
|
|
10681
|
+
}
|
|
10682
|
+
._iconContainer_1o1xb_207 svg {
|
|
10678
10683
|
width: 1em;
|
|
10679
10684
|
height: 1em;
|
|
10680
10685
|
color: var(--text-color-primary);
|
|
10681
10686
|
}
|
|
10682
10687
|
@media (width <= 319.98px) {
|
|
10683
|
-
.
|
|
10688
|
+
._iconContainer_1o1xb_207 svg {
|
|
10684
10689
|
width: 15px;
|
|
10685
10690
|
height: 15px;
|
|
10686
10691
|
}
|
|
10687
10692
|
}
|
|
10688
10693
|
|
|
10689
|
-
.
|
|
10694
|
+
._togglePassword_1o1xb_229 {
|
|
10690
10695
|
padding: 4px;
|
|
10691
10696
|
box-sizing: border-box;
|
|
10692
10697
|
background: transparent;
|
|
@@ -10694,150 +10699,150 @@ a:hover {
|
|
|
10694
10699
|
color: inherit;
|
|
10695
10700
|
cursor: pointer;
|
|
10696
10701
|
}
|
|
10697
|
-
.
|
|
10702
|
+
._togglePassword_1o1xb_229:focus-visible {
|
|
10698
10703
|
outline: 2px solid var(--focus-outline-color, var(--primary-color));
|
|
10699
10704
|
outline-offset: 2px;
|
|
10700
10705
|
border-radius: 6px;
|
|
10701
10706
|
}
|
|
10702
10707
|
@media (width <= 319.98px) {
|
|
10703
|
-
.
|
|
10708
|
+
._togglePassword_1o1xb_229 {
|
|
10704
10709
|
margin-top: 4px;
|
|
10705
10710
|
}
|
|
10706
10711
|
}
|
|
10707
10712
|
|
|
10708
|
-
.
|
|
10713
|
+
._success_1o1xb_248 {
|
|
10709
10714
|
border: 2px solid var(--success-color);
|
|
10710
10715
|
}
|
|
10711
10716
|
|
|
10712
|
-
.
|
|
10717
|
+
._error_1o1xb_252 {
|
|
10713
10718
|
border: 2px solid var(--error-color);
|
|
10714
10719
|
}
|
|
10715
10720
|
|
|
10716
|
-
.
|
|
10721
|
+
._warning_1o1xb_256 {
|
|
10717
10722
|
border: 2px solid var(--warning-color);
|
|
10718
10723
|
}
|
|
10719
10724
|
|
|
10720
|
-
.
|
|
10725
|
+
._primary_1o1xb_260 {
|
|
10721
10726
|
background-color: var(--primary-color);
|
|
10722
10727
|
color: var(--text-color-primary);
|
|
10723
10728
|
}
|
|
10724
|
-
.
|
|
10729
|
+
._primary_1o1xb_260 ._textInput_1o1xb_178::placeholder {
|
|
10725
10730
|
color: var(--text-color-primary);
|
|
10726
10731
|
}
|
|
10727
|
-
.
|
|
10732
|
+
._primary_1o1xb_260 ._iconContainer_1o1xb_207 svg {
|
|
10728
10733
|
color: var(--text-color-primary);
|
|
10729
10734
|
}
|
|
10730
|
-
.
|
|
10735
|
+
._primary_1o1xb_260._outline_1o1xb_270 {
|
|
10731
10736
|
background-color: transparent;
|
|
10732
10737
|
color: var(--text-color-primary);
|
|
10733
10738
|
box-shadow: none;
|
|
10734
10739
|
border: 2px solid var(--primary-color);
|
|
10735
10740
|
}
|
|
10736
10741
|
|
|
10737
|
-
.
|
|
10742
|
+
._secondary_1o1xb_277 {
|
|
10738
10743
|
background-color: var(--secondary-color);
|
|
10739
10744
|
color: var(--text-color-secondary);
|
|
10740
10745
|
}
|
|
10741
|
-
.
|
|
10746
|
+
._secondary_1o1xb_277 ._textInput_1o1xb_178::placeholder {
|
|
10742
10747
|
color: var(--text-color-secondary);
|
|
10743
10748
|
}
|
|
10744
|
-
.
|
|
10749
|
+
._secondary_1o1xb_277 ._iconContainer_1o1xb_207 svg {
|
|
10745
10750
|
color: var(--text-color-secondary);
|
|
10746
10751
|
}
|
|
10747
|
-
.
|
|
10752
|
+
._secondary_1o1xb_277._outline_1o1xb_270 {
|
|
10748
10753
|
background-color: transparent;
|
|
10749
10754
|
color: var(--text-color-secondary);
|
|
10750
10755
|
box-shadow: none;
|
|
10751
10756
|
border: 2px solid var(--secondary-color);
|
|
10752
10757
|
}
|
|
10753
10758
|
|
|
10754
|
-
.
|
|
10759
|
+
._tertiary_1o1xb_294 {
|
|
10755
10760
|
background-color: var(--tertiary-color);
|
|
10756
10761
|
color: var(--text-color-primary);
|
|
10757
10762
|
}
|
|
10758
|
-
.
|
|
10763
|
+
._tertiary_1o1xb_294 ._textInput_1o1xb_178::placeholder {
|
|
10759
10764
|
color: var(--text-color-primary);
|
|
10760
10765
|
}
|
|
10761
|
-
.
|
|
10766
|
+
._tertiary_1o1xb_294 ._iconContainer_1o1xb_207 svg {
|
|
10762
10767
|
color: var(--text-color-primary);
|
|
10763
10768
|
}
|
|
10764
|
-
.
|
|
10769
|
+
._tertiary_1o1xb_294._outline_1o1xb_270 {
|
|
10765
10770
|
background-color: transparent;
|
|
10766
10771
|
color: var(--text-color-primary);
|
|
10767
10772
|
box-shadow: none;
|
|
10768
10773
|
border: 2px solid var(--tertiary-color);
|
|
10769
10774
|
}
|
|
10770
10775
|
|
|
10771
|
-
.
|
|
10776
|
+
._quaternary_1o1xb_311 {
|
|
10772
10777
|
background-color: var(--quaternary-color);
|
|
10773
10778
|
color: var(--text-color-primary);
|
|
10774
10779
|
}
|
|
10775
|
-
.
|
|
10780
|
+
._quaternary_1o1xb_311 ._textInput_1o1xb_178::placeholder {
|
|
10776
10781
|
color: var(--text-color-primary);
|
|
10777
10782
|
}
|
|
10778
|
-
.
|
|
10783
|
+
._quaternary_1o1xb_311 ._iconContainer_1o1xb_207 svg {
|
|
10779
10784
|
color: var(--text-color-primary);
|
|
10780
10785
|
}
|
|
10781
|
-
.
|
|
10786
|
+
._quaternary_1o1xb_311._outline_1o1xb_270 {
|
|
10782
10787
|
background-color: transparent;
|
|
10783
10788
|
color: var(--text-color-primary);
|
|
10784
10789
|
box-shadow: none;
|
|
10785
10790
|
border: 2px solid var(--quaternary-color);
|
|
10786
10791
|
}
|
|
10787
10792
|
|
|
10788
|
-
.
|
|
10793
|
+
._clear_1o1xb_328 {
|
|
10789
10794
|
background-color: transparent;
|
|
10790
10795
|
color: var(--text-color-primary);
|
|
10791
10796
|
}
|
|
10792
|
-
.
|
|
10797
|
+
._clear_1o1xb_328 ._textInput_1o1xb_178::placeholder {
|
|
10793
10798
|
color: var(--text-color-primary);
|
|
10794
10799
|
}
|
|
10795
|
-
.
|
|
10800
|
+
._clear_1o1xb_328 ._iconContainer_1o1xb_207 svg {
|
|
10796
10801
|
color: var(--text-color-primary);
|
|
10797
10802
|
}
|
|
10798
|
-
.
|
|
10803
|
+
._clear_1o1xb_328._outline_1o1xb_270 {
|
|
10799
10804
|
background-color: transparent;
|
|
10800
10805
|
color: var(--text-color-primary);
|
|
10801
10806
|
box-shadow: none;
|
|
10802
10807
|
border: 2px solid var(--text-color-primary);
|
|
10803
10808
|
}
|
|
10804
10809
|
|
|
10805
|
-
.
|
|
10810
|
+
._clear_1o1xb_328 ._textInput_1o1xb_178 {
|
|
10806
10811
|
border: none;
|
|
10807
10812
|
}
|
|
10808
10813
|
|
|
10809
|
-
.
|
|
10814
|
+
._disabled_1o1xb_349 {
|
|
10810
10815
|
cursor: not-allowed;
|
|
10811
10816
|
pointer-events: none;
|
|
10812
10817
|
opacity: 0.6;
|
|
10813
10818
|
background-color: rgba(184, 184, 184, 0.8666666667);
|
|
10814
10819
|
}
|
|
10815
|
-
.
|
|
10820
|
+
._disabled_1o1xb_349 ._textInput_1o1xb_178 {
|
|
10816
10821
|
background-color: transparent;
|
|
10817
10822
|
}
|
|
10818
10823
|
|
|
10819
10824
|
@media (prefers-reduced-motion: reduce) {
|
|
10820
|
-
.
|
|
10821
|
-
.
|
|
10825
|
+
._container_1o1xb_85,
|
|
10826
|
+
._container_1o1xb_85 * {
|
|
10822
10827
|
transition: none !important;
|
|
10823
10828
|
animation: none !important;
|
|
10824
10829
|
}
|
|
10825
10830
|
}
|
|
10826
10831
|
@media (forced-colors: active) {
|
|
10827
|
-
.
|
|
10832
|
+
._container_1o1xb_85 {
|
|
10828
10833
|
background: Canvas;
|
|
10829
10834
|
color: CanvasText;
|
|
10830
10835
|
border: 1px solid ButtonText;
|
|
10831
10836
|
}
|
|
10832
|
-
.
|
|
10837
|
+
._textInput_1o1xb_178 {
|
|
10833
10838
|
color: CanvasText;
|
|
10834
10839
|
background: Canvas;
|
|
10835
10840
|
}
|
|
10836
|
-
.
|
|
10841
|
+
._textInput_1o1xb_178::placeholder {
|
|
10837
10842
|
color: CanvasText;
|
|
10838
10843
|
}
|
|
10839
|
-
.
|
|
10840
|
-
.
|
|
10844
|
+
._textInput_1o1xb_178:focus-visible,
|
|
10845
|
+
._container_1o1xb_85:focus-within {
|
|
10841
10846
|
outline: 2px solid Highlight !important;
|
|
10842
10847
|
outline-offset: 2px !important;
|
|
10843
10848
|
}
|
package/dist/next/index.cjs.js
CHANGED
|
@@ -8,12 +8,12 @@ const borealStyleConfig = require("./boreal-style-config-Rr5d5Qts.cjs");
|
|
|
8
8
|
const Button = require("./Button-DPoX7ahh.cjs");
|
|
9
9
|
const IconButton = require("./IconButton-aF7cTy19.cjs");
|
|
10
10
|
const STT = require("./STT-GyAuX3-m.cjs");
|
|
11
|
-
const TextInput = require("./TextInput-
|
|
11
|
+
const TextInput = require("./TextInput-DPArjoEr.cjs");
|
|
12
12
|
const TextArea = require("./TextArea-rwkjK4Rf.cjs");
|
|
13
13
|
const Select = require("./Select-BDse5K69.cjs");
|
|
14
14
|
const Footer = require("./Footer-2VxzlCzU.cjs");
|
|
15
15
|
const FileUpload = require("./FileUpload-Cj99fQhe.cjs");
|
|
16
|
-
const TagInput = require("./TagInput-
|
|
16
|
+
const TagInput = require("./TagInput-BdKQoh2d.cjs");
|
|
17
17
|
const RadioButton = require("./RadioButton-D6oyNmVU.cjs");
|
|
18
18
|
const Slider = require("./Slider-g41Qvh6s.cjs");
|
|
19
19
|
const Checkbox = require("./Checkbox-hA321207.cjs");
|
|
@@ -50,7 +50,7 @@ const Dropdown = require("./Dropdown-IW2Ph6-e.cjs");
|
|
|
50
50
|
const Divider = require("./Divider-cx8e80sS.cjs");
|
|
51
51
|
const MetricBox = require("./MetricBox-7AdEqlvh.cjs");
|
|
52
52
|
const EmptyState = require("./EmptyState-BS6-CuHp.cjs");
|
|
53
|
-
const CommandPalette = require("./CommandPalette-
|
|
53
|
+
const CommandPalette = require("./CommandPalette-CJhd23B2.cjs");
|
|
54
54
|
const NotificationCenter = require("./NotificationCenter-CzdOOnWg.cjs");
|
|
55
55
|
const Sidebar = require("./Sidebar-CBC-Gu5d.cjs");
|
|
56
56
|
const Card = require("./Card-CTHQTLQ2.cjs");
|
package/dist/next/index.js
CHANGED
|
@@ -7,12 +7,12 @@ import { s } from "./boreal-style-config-BILmxkZG.js";
|
|
|
7
7
|
import { B } from "./Button-DhH3Gy0J.js";
|
|
8
8
|
import { I } from "./IconButton-Ct3YtlG9.js";
|
|
9
9
|
import { S } from "./STT-CFFr1_Ls.js";
|
|
10
|
-
import { T as T2 } from "./TextInput-
|
|
10
|
+
import { T as T2 } from "./TextInput-dwn3uD65.js";
|
|
11
11
|
import { T as T3 } from "./TextArea-n9HgwyJE.js";
|
|
12
12
|
import { S as S2 } from "./Select-1sLV4ar_.js";
|
|
13
13
|
import { F, U } from "./Footer-DMT3GtKq.js";
|
|
14
14
|
import { F as F2 } from "./FileUpload-St2eEaTn.js";
|
|
15
|
-
import { T as T4 } from "./TagInput-
|
|
15
|
+
import { T as T4 } from "./TagInput-BBDft9tw.js";
|
|
16
16
|
import { R } from "./RadioButton-CEvIACkL.js";
|
|
17
17
|
import { S as S3 } from "./Slider-wAbg8hOH.js";
|
|
18
18
|
import { C } from "./Checkbox-DBidsakA.js";
|
|
@@ -49,7 +49,7 @@ import { D as D3 } from "./Dropdown-BjxT8ivq.js";
|
|
|
49
49
|
import { D as D4 } from "./Divider-kiaQzYbi.js";
|
|
50
50
|
import { M as M4 } from "./MetricBox-ozSXEeEf.js";
|
|
51
51
|
import { E } from "./EmptyState-D_Gcrj_3.js";
|
|
52
|
-
import { C as C4 } from "./CommandPalette-
|
|
52
|
+
import { C as C4 } from "./CommandPalette-GeFIL9EG.js";
|
|
53
53
|
import { N as N2 } from "./NotificationCenter-BIuKaeXk.js";
|
|
54
54
|
import { S as S7 } from "./Sidebar-oJzZMxwu.js";
|
|
55
55
|
import { C as C5 } from "./Card-DhCmEAPL.js";
|