@10x-media/fields 0.1.0-beta.9 → 4.0.0-alpha.2
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/CHANGELOG.md +12 -0
- package/README.md +9 -4
- package/dist/fields/color/client/ColorInput.js +17 -6
- package/dist/fields/color/client/ColorInput.js.map +1 -1
- package/dist/fields/color/client/ColorPickerPanel.js +18 -12
- package/dist/fields/color/client/ColorPickerPanel.js.map +1 -1
- package/dist/fields/color/client/colorField.css +131 -178
- package/dist/fields/color/client/icons.js +17 -24
- package/dist/fields/color/client/icons.js.map +1 -1
- package/dist/fields/color/colorField.js +5 -3
- package/dist/fields/color/colorField.js.map +1 -1
- package/dist/fields/color/server/colorCell.css +8 -9
- package/dist/fields/encrypted/components/EncryptedInput.js +44 -26
- package/dist/fields/encrypted/components/EncryptedInput.js.map +1 -1
- package/dist/fields/encrypted/components/EncryptedTextarea.js +29 -29
- package/dist/fields/encrypted/components/EncryptedTextarea.js.map +1 -1
- package/dist/fields/encrypted/components/EyeToggle.js +14 -35
- package/dist/fields/encrypted/components/EyeToggle.js.map +1 -1
- package/dist/fields/encrypted/components/ProtectedField.css +107 -159
- package/dist/fields/encrypted/components/ProtectedField.js +6 -2
- package/dist/fields/encrypted/components/ProtectedField.js.map +1 -1
- package/dist/fields/encrypted/components/RichTextRevealGate.js +3 -3
- package/dist/fields/encrypted/components/RichTextRevealGate.js.map +1 -1
- package/dist/fields/encrypted/components/WriteOnlyActions.js +58 -53
- package/dist/fields/encrypted/components/WriteOnlyActions.js.map +1 -1
- package/dist/fields/encrypted/components/WriteOnlyField.js +39 -21
- package/dist/fields/encrypted/components/WriteOnlyField.js.map +1 -1
- package/dist/fields/encrypted/components/facsimiles.js +70 -79
- package/dist/fields/encrypted/components/facsimiles.js.map +1 -1
- package/dist/fields/encrypted/components/placement.js.map +1 -1
- package/dist/fields/encrypted/encryptedField.js +25 -12
- package/dist/fields/encrypted/encryptedField.js.map +1 -1
- package/dist/fields/encrypted/{typescriptSchema.js → jsonSchema.js} +4 -4
- package/dist/fields/encrypted/jsonSchema.js.map +1 -0
- package/dist/fields/encrypted/queryRewrite.js +20 -0
- package/dist/fields/encrypted/queryRewrite.js.map +1 -1
- package/dist/fields/encrypted/validators.js +1 -1
- package/dist/fields/encrypted/validators.js.map +1 -1
- package/dist/fields/icon/adapters/tabler/generated/nodes.js +1 -1
- package/dist/fields/icon/adapters/tabler/generated/nodes.js.map +1 -1
- package/dist/fields/icon/client/IconDrawerContent.js +8 -6
- package/dist/fields/icon/client/IconDrawerContent.js.map +1 -1
- package/dist/fields/icon/client/IconFieldClient.js +15 -37
- package/dist/fields/icon/client/IconFieldClient.js.map +1 -1
- package/dist/fields/icon/client/icon-field.css +137 -233
- package/dist/fields/icon/codegen/sources/tabler.js +25 -6
- package/dist/fields/icon/codegen/sources/tabler.js.map +1 -1
- package/dist/fields/icon/layers/upload.js +3 -0
- package/dist/fields/icon/layers/upload.js.map +1 -1
- package/dist/fields/icon/react/createIcon.js +4 -4
- package/dist/fields/icon/react/createIcon.js.map +1 -1
- package/dist/fields/measurement/client/MeasurementInput.js +18 -32
- package/dist/fields/measurement/client/MeasurementInput.js.map +1 -1
- package/dist/fields/measurement/client/editModel.js +12 -3
- package/dist/fields/measurement/client/editModel.js.map +1 -1
- package/dist/fields/measurement/client/measurementField.css +58 -105
- package/dist/fields/measurement/server/getUserUnits.js +2 -1
- package/dist/fields/measurement/server/getUserUnits.js.map +1 -1
- package/dist/fields/phoneNumber/client/CountryPicker.js +14 -9
- package/dist/fields/phoneNumber/client/CountryPicker.js.map +1 -1
- package/dist/fields/phoneNumber/client/PhoneNumberField.d.ts +1 -1
- package/dist/fields/phoneNumber/client/PhoneNumberField.js +22 -4
- package/dist/fields/phoneNumber/client/PhoneNumberField.js.map +1 -1
- package/dist/fields/phoneNumber/client/phoneNumberField.css +109 -142
- package/dist/fields/phoneNumber/phoneNumberField.js +1 -1
- package/dist/fields/phoneNumber/phoneNumberField.js.map +1 -1
- package/dist/fields/phoneNumber/server/PhoneNumberCellServer.js +2 -1
- package/dist/fields/phoneNumber/server/PhoneNumberCellServer.js.map +1 -1
- package/dist/index.d.ts +3 -2
- package/dist/index.js +5 -4
- package/dist/index.js.map +1 -1
- package/dist/plugin/companionSelect.d.ts +12 -0
- package/dist/plugin/companionSelect.js +107 -0
- package/dist/plugin/companionSelect.js.map +1 -0
- package/package.json +15 -15
- package/dist/fields/encrypted/typescriptSchema.js.map +0 -1
|
@@ -4,7 +4,7 @@ import { useTranslation as useTranslation$1 } from "../../../translations/useTra
|
|
|
4
4
|
import { buildIconSearchIndex, searchIcons } from "../shared/search.js";
|
|
5
5
|
import { IconGridCell } from "./IconGridCell.js";
|
|
6
6
|
import { useRecentIcons } from "./useRecentIcons.js";
|
|
7
|
-
import { ReactSelect, SearchIcon } from "@payloadcms/ui";
|
|
7
|
+
import { Button, ReactSelect, SearchIcon } from "@payloadcms/ui";
|
|
8
8
|
import { useCallback, useDeferredValue, useEffect, useMemo, useRef, useState } from "react";
|
|
9
9
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
10
10
|
import { useVirtualizer } from "@tanstack/react-virtual";
|
|
@@ -147,10 +147,12 @@ const IconDrawerContent = ({ activeLibrary, adapterComponents, adapters, onLibra
|
|
|
147
147
|
children: [/* @__PURE__ */ jsx("nav", {
|
|
148
148
|
"aria-label": t(keys.iconCategories),
|
|
149
149
|
className: "tenx-icon-drawer__rail",
|
|
150
|
-
children: railItems.map((item) => /* @__PURE__ */ jsx(
|
|
151
|
-
|
|
150
|
+
children: railItems.map((item) => /* @__PURE__ */ jsx(Button, {
|
|
151
|
+
"aria-pressed": category === item.key,
|
|
152
|
+
buttonStyle: category === item.key ? "pill" : "ghost",
|
|
153
|
+
className: "tenx-icon-drawer__rail-item",
|
|
154
|
+
margin: false,
|
|
152
155
|
onClick: () => setCategory(item.key),
|
|
153
|
-
type: "button",
|
|
154
156
|
children: item.label
|
|
155
157
|
}, item.key))
|
|
156
158
|
}), /* @__PURE__ */ jsxs("div", {
|
|
@@ -165,14 +167,14 @@ const IconDrawerContent = ({ activeLibrary, adapterComponents, adapters, onLibra
|
|
|
165
167
|
/* @__PURE__ */ jsxs("div", {
|
|
166
168
|
className: "tenx-icon-drawer__header",
|
|
167
169
|
children: [/* @__PURE__ */ jsxs("div", {
|
|
168
|
-
className: "tenx-icon-drawer__search",
|
|
170
|
+
className: "tenx-icon-drawer__search form-input-group",
|
|
169
171
|
children: [/* @__PURE__ */ jsx("span", {
|
|
170
172
|
"aria-hidden": "true",
|
|
171
173
|
className: "tenx-icon-drawer__search-icon",
|
|
172
174
|
children: /* @__PURE__ */ jsx(SearchIcon, {})
|
|
173
175
|
}), /* @__PURE__ */ jsx("input", {
|
|
174
176
|
"aria-label": t(keys.searchIcons),
|
|
175
|
-
className: "tenx-icon-drawer__search-input",
|
|
177
|
+
className: "form-input tenx-icon-drawer__search-input",
|
|
176
178
|
onChange: (event) => setQuery(event.target.value),
|
|
177
179
|
placeholder: t(keys.searchIcons),
|
|
178
180
|
type: "text",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IconDrawerContent.js","names":["useTranslation"],"sources":["../../../../src/fields/icon/client/IconDrawerContent.tsx"],"sourcesContent":["'use client'\n\nimport { ReactSelect, SearchIcon } from '@payloadcms/ui'\nimport { useVirtualizer } from '@tanstack/react-virtual'\nimport type React from 'react'\nimport { useCallback, useDeferredValue, useEffect, useMemo, useRef, useState } from 'react'\nimport { keys } from '../../../translations'\nimport { useTranslation } from '../../../translations/useTranslation'\nimport type { IconManifest, IconMeta, IconNodeMap } from '../../../types'\nimport type { AdapterComponentsEntry } from '../shared/adapterComponents'\nimport { buildIconSearchIndex, searchIcons } from '../shared/search'\nimport { IconGridCell } from './IconGridCell'\nimport { useRecentIcons } from './useRecentIcons'\n\n// One fixed size drives both the column count and the virtualizer row height. With no\n// in-flow label to vary a cell's height, every cell is an identical square and the grid\n// stays aligned regardless of icon name length.\nconst CELL_SIZE = 64\nconst RECENT = '__recent__'\nconst ALL = '__all__'\n\nexport type IconDrawerContentProps = {\n\tactiveLibrary: string\n\tadapterComponents: Record<string, AdapterComponentsEntry>\n\t/** Libraries available for selection: registered adapters already intersected with `available`. */\n\tadapters: { label: string; slug: string }[]\n\tonLibraryChange: (slug: string) => void\n\tonSelect: (library: string, icon: IconMeta) => void\n\tselected: { library: string; name: string } | null\n\tslugPrefix: string\n}\n\nconst IconDrawerContent: React.FC<IconDrawerContentProps> = ({\n\tactiveLibrary,\n\tadapterComponents,\n\tadapters,\n\tonLibraryChange,\n\tonSelect,\n\tselected,\n\tslugPrefix,\n}) => {\n\tconst { i18n, t } = useTranslation()\n\tconst [manifests, setManifests] = useState<Map<string, IconManifest>>(() => new Map())\n\tconst [nodeMaps, setNodeMaps] = useState<Map<string, IconNodeMap>>(() => new Map())\n\tconst [query, setQuery] = useState('')\n\tconst deferredQuery = useDeferredValue(query)\n\tconst [category, setCategory] = useState<string>(ALL)\n\tconst { addRecent, recent } = useRecentIcons(activeLibrary)\n\n\tconst manifest = manifests.get(activeLibrary)\n\tconst entry = adapterComponents[activeLibrary]\n\tconst Assets = entry?.Assets\n\tconst NodesLoader = entry?.Nodes\n\tconst nodeMap = nodeMaps.get(activeLibrary)\n\t// Libraries with a Nodes loader render the grid from bulk node-data; the grid\n\t// waits for that data before showing cells, others (radix) render immediately.\n\tconst nodesPending = Boolean(NodesLoader) && !nodeMap\n\tconst loading = !manifest || nodesPending\n\n\tconst handleManifest = useCallback(\n\t\t(loaded: IconManifest) => {\n\t\t\tsetManifests((previous) => new Map(previous).set(activeLibrary, loaded))\n\t\t},\n\t\t[activeLibrary]\n\t)\n\n\tconst handleNodes = useCallback(\n\t\t(loaded: IconNodeMap) => {\n\t\t\tsetNodeMaps((previous) => new Map(previous).set(activeLibrary, loaded))\n\t\t},\n\t\t[activeLibrary]\n\t)\n\n\t// biome-ignore lint/correctness/useExhaustiveDependencies: activeLibrary is the trigger; the effect resets category and search when it changes\n\tuseEffect(() => {\n\t\tsetCategory(ALL)\n\t\tsetQuery('')\n\t}, [activeLibrary])\n\n\tconst byName = useMemo(\n\t\t() => new Map((manifest?.icons ?? []).map((icon) => [icon.name, icon])),\n\t\t[manifest]\n\t)\n\n\tconst categoryIcons = useMemo((): IconMeta[] => {\n\t\tif (!manifest) return []\n\t\tif (category === ALL) return manifest.icons\n\t\tif (category === RECENT) {\n\t\t\treturn recent\n\t\t\t\t.map((name) => byName.get(name))\n\t\t\t\t.filter((icon): icon is IconMeta => Boolean(icon))\n\t\t}\n\t\treturn manifest.icons.filter((icon) => icon.categories.includes(category))\n\t}, [byName, category, manifest, recent])\n\n\tconst index = useMemo(() => buildIconSearchIndex(categoryIcons), [categoryIcons])\n\tconst visible = useMemo(() => searchIcons(index, deferredQuery), [deferredQuery, index])\n\n\tconst gridRef = useRef<HTMLDivElement>(null)\n\tconst [gridWidth, setGridWidth] = useState(0)\n\tuseEffect(() => {\n\t\tconst element = gridRef.current\n\t\tif (!element) return\n\t\tconst observer = new ResizeObserver(() => setGridWidth(element.offsetWidth))\n\t\tobserver.observe(element)\n\t\tsetGridWidth(element.offsetWidth)\n\t\treturn () => observer.disconnect()\n\t}, [])\n\tconst columns = Math.max(3, Math.floor(gridWidth / CELL_SIZE))\n\tconst rowCount = Math.ceil(visible.length / columns)\n\t// Cell-box span of a full row (columns * CELL_SIZE), published to CSS as a custom property.\n\t// The header row and banner derive their width from this (inset to the button outlines in\n\t// icon-field.css) so the search, switcher, banner, and visible grid share one left and one\n\t// right edge. Sized only from CELL_SIZE.\n\tconst mainStyle = {\n\t\t'--tenx-icon-grid-width': `${columns * CELL_SIZE}px`,\n\t} as React.CSSProperties\n\n\tconst virtualizer = useVirtualizer({\n\t\tcount: rowCount,\n\t\testimateSize: () => CELL_SIZE,\n\t\tgetScrollElement: () => gridRef.current,\n\t\t// Cells are cheap inline SVG now, so a deeper overscan buys smoother fast scrolls.\n\t\toverscan: 8,\n\t})\n\n\tconst [focusIndex, setFocusIndex] = useState(0)\n\t// biome-ignore lint/correctness/useExhaustiveDependencies: reset focus whenever the visible set changes\n\tuseEffect(() => setFocusIndex(0), [activeLibrary, category, deferredQuery])\n\tconst cellRefs = useRef(new Map<number, HTMLButtonElement>())\n\tconst registerRef = useCallback((cellIndex: number, element: HTMLButtonElement | null) => {\n\t\tif (element) cellRefs.current.set(cellIndex, element)\n\t\telse cellRefs.current.delete(cellIndex)\n\t}, [])\n\n\tconst focusCell = useCallback(\n\t\t(cellIndex: number) => {\n\t\t\tvirtualizer.scrollToIndex(Math.floor(cellIndex / columns))\n\t\t\trequestAnimationFrame(() => cellRefs.current.get(cellIndex)?.focus())\n\t\t},\n\t\t[columns, virtualizer]\n\t)\n\n\tconst handleGridKeyDown = useCallback(\n\t\t(event: React.KeyboardEvent<HTMLDivElement>) => {\n\t\t\tconst max = visible.length - 1\n\t\t\tif (max < 0) return\n\t\t\tlet next: number | null = null\n\t\t\tif (event.key === 'ArrowRight') next = Math.min(focusIndex + 1, max)\n\t\t\telse if (event.key === 'ArrowLeft') next = Math.max(focusIndex - 1, 0)\n\t\t\telse if (event.key === 'ArrowDown') next = Math.min(focusIndex + columns, max)\n\t\t\telse if (event.key === 'ArrowUp') next = Math.max(focusIndex - columns, 0)\n\t\t\telse if (event.key === 'Home') next = 0\n\t\t\telse if (event.key === 'End') next = max\n\t\t\tif (next === null) return\n\t\t\tevent.preventDefault()\n\t\t\tsetFocusIndex(next)\n\t\t\tfocusCell(next)\n\t\t},\n\t\t[columns, focusCell, focusIndex, visible.length]\n\t)\n\n\tconst handleSelect = useCallback(\n\t\t(icon: IconMeta) => {\n\t\t\taddRecent(icon.name)\n\t\t\tonSelect(activeLibrary, icon)\n\t\t},\n\t\t[activeLibrary, addRecent, onSelect]\n\t)\n\n\tconst railItems = useMemo(\n\t\t(): { key: string; label: string }[] => [\n\t\t\t{ key: ALL, label: t(keys.allIcons) },\n\t\t\t{ key: RECENT, label: t(keys.recent) },\n\t\t\t...(manifest?.categories ?? []).map((name) => ({ key: name, label: name })),\n\t\t],\n\t\t[manifest, t]\n\t)\n\n\tconst libraryOptions = useMemo(\n\t\t() => adapters.map((adapter) => ({ label: adapter.label, value: adapter.slug })),\n\t\t[adapters]\n\t)\n\tconst librarySelectId = `${slugPrefix}-library`\n\n\t// The stored value points at a library that is no longer offered for selection; the\n\t// full explanation lives here, the trigger only carries a compact marker.\n\tconst selectedUnavailable =\n\t\tselected !== null && !adapters.some((adapter) => adapter.slug === selected.library)\n\n\t// A listbox must own option children, so the grid only claims role=\"listbox\" (with\n\t// its keyboard nav and label) once cells exist. While loading it is an aria-busy\n\t// container; when empty it is a plain container holding the \"no icons\" message.\n\tconst gridPopulated = !loading && visible.length > 0\n\tconst gridA11y: React.HTMLAttributes<HTMLDivElement> = gridPopulated\n\t\t? { 'aria-label': t(keys.iconGrid), onKeyDown: handleGridKeyDown, role: 'listbox' }\n\t\t: { 'aria-busy': loading || undefined }\n\n\treturn (\n\t\t<div className=\"tenx-icon-drawer\">\n\t\t\t{/* Sibling loaders keyed distinctly per library: a shared key collides (\"two children\n\t\t\t with the same key\") when both mount on open, while distinct keys keep the per-library remount. */}\n\t\t\t{Assets && !manifest ? (\n\t\t\t\t<Assets key={`assets-${activeLibrary}`} onReady={handleManifest} />\n\t\t\t) : null}\n\t\t\t{NodesLoader && !nodeMap ? (\n\t\t\t\t<NodesLoader key={`nodes-${activeLibrary}`} onReady={handleNodes} />\n\t\t\t) : null}\n\t\t\t<div className=\"tenx-icon-drawer__body\">\n\t\t\t\t<nav aria-label={t(keys.iconCategories)} className=\"tenx-icon-drawer__rail\">\n\t\t\t\t\t{railItems.map((item) => (\n\t\t\t\t\t\t<button\n\t\t\t\t\t\t\tclassName={\n\t\t\t\t\t\t\t\tcategory === item.key\n\t\t\t\t\t\t\t\t\t? 'tenx-icon-drawer__rail-item tenx-icon-drawer__rail-item--active'\n\t\t\t\t\t\t\t\t\t: 'tenx-icon-drawer__rail-item'\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tkey={item.key}\n\t\t\t\t\t\t\tonClick={() => setCategory(item.key)}\n\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{item.label}\n\t\t\t\t\t\t</button>\n\t\t\t\t\t))}\n\t\t\t\t</nav>\n\t\t\t\t<div className=\"tenx-icon-drawer__main\" style={mainStyle}>\n\t\t\t\t\t{selectedUnavailable ? (\n\t\t\t\t\t\t<div className=\"tenx-icon-drawer__banner\" role=\"status\">\n\t\t\t\t\t\t\t{t(keys.libraryUnavailable)}\n\t\t\t\t\t\t</div>\n\t\t\t\t\t) : null}\n\t\t\t\t\t<div className=\"tenx-icon-drawer__header\">\n\t\t\t\t\t\t{/* Bordered control mirrors Payload's list-view search: SearchIcon inside-left, borderless input. */}\n\t\t\t\t\t\t<div className=\"tenx-icon-drawer__search\">\n\t\t\t\t\t\t\t<span aria-hidden=\"true\" className=\"tenx-icon-drawer__search-icon\">\n\t\t\t\t\t\t\t\t<SearchIcon />\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t<input\n\t\t\t\t\t\t\t\taria-label={t(keys.searchIcons)}\n\t\t\t\t\t\t\t\tclassName=\"tenx-icon-drawer__search-input\"\n\t\t\t\t\t\t\t\tonChange={(event: React.ChangeEvent<HTMLInputElement>) =>\n\t\t\t\t\t\t\t\t\tsetQuery(event.target.value)\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tplaceholder={t(keys.searchIcons)}\n\t\t\t\t\t\t\t\ttype=\"text\"\n\t\t\t\t\t\t\t\tvalue={query}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t{/* adapters is the available-filtered set; the switcher shows only with 2+ libraries, fixed width beside the growing search */}\n\t\t\t\t\t\t{adapters.length > 1 ? (\n\t\t\t\t\t\t\t<div className=\"tenx-icon-drawer__switcher\">\n\t\t\t\t\t\t\t\t<label className=\"tenx-icon-drawer__sr-only\" htmlFor={librarySelectId}>\n\t\t\t\t\t\t\t\t\t{t(keys.fieldIconLibraryLabel)}\n\t\t\t\t\t\t\t\t</label>\n\t\t\t\t\t\t\t\t<ReactSelect\n\t\t\t\t\t\t\t\t\tinputId={librarySelectId}\n\t\t\t\t\t\t\t\t\tisClearable={false}\n\t\t\t\t\t\t\t\t\tonChange={(option) => {\n\t\t\t\t\t\t\t\t\t\tconst single = Array.isArray(option) ? option[0] : option\n\t\t\t\t\t\t\t\t\t\tif (single && typeof single.value === 'string') onLibraryChange(single.value)\n\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t\toptions={libraryOptions}\n\t\t\t\t\t\t\t\t\tvalue={libraryOptions.find((option) => option.value === activeLibrary)}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t) : null}\n\t\t\t\t\t</div>\n\t\t\t\t\t<div className=\"tenx-icon-drawer__grid\" ref={gridRef} {...gridA11y}>\n\t\t\t\t\t\t{loading ? (\n\t\t\t\t\t\t\t<div className=\"tenx-icon-drawer__loading\">\n\t\t\t\t\t\t\t\t{Array.from({ length: 24 }, (_, skeletonIndex) => (\n\t\t\t\t\t\t\t\t\t// biome-ignore lint/suspicious/noArrayIndexKey: fixed-count static placeholders that never reorder\n\t\t\t\t\t\t\t\t\t<span className=\"tenx-icon-placeholder\" key={`skeleton-${skeletonIndex}`} />\n\t\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t) : visible.length === 0 ? (\n\t\t\t\t\t\t\t<div className=\"tenx-icon-drawer__empty\">{t(keys.noIconsFound)}</div>\n\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\trole=\"presentation\"\n\t\t\t\t\t\t\t\tstyle={{ height: virtualizer.getTotalSize(), position: 'relative', width: '100%' }}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{virtualizer.getVirtualItems().map((row) => (\n\t\t\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\t\t\tclassName=\"tenx-icon-drawer__row\"\n\t\t\t\t\t\t\t\t\t\tdata-index={row.index}\n\t\t\t\t\t\t\t\t\t\tkey={row.key}\n\t\t\t\t\t\t\t\t\t\trole=\"presentation\"\n\t\t\t\t\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\t\t\t\t\tleft: 0,\n\t\t\t\t\t\t\t\t\t\t\tposition: 'absolute',\n\t\t\t\t\t\t\t\t\t\t\ttop: 0,\n\t\t\t\t\t\t\t\t\t\t\ttransform: `translateY(${row.start}px)`,\n\t\t\t\t\t\t\t\t\t\t\twidth: '100%',\n\t\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{visible\n\t\t\t\t\t\t\t\t\t\t\t.slice(row.index * columns, row.index * columns + columns)\n\t\t\t\t\t\t\t\t\t\t\t.map((icon, columnIndex) => {\n\t\t\t\t\t\t\t\t\t\t\t\tconst cellIndex = row.index * columns + columnIndex\n\t\t\t\t\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t\t\t\t\t<IconGridCell\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tcanvas={entry?.canvas}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tentry={entry}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tfocused={cellIndex === focusIndex}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\ticon={icon}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tindex={cellIndex}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tisSelected={\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tselected?.library === activeLibrary && selected.name === icon.name\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tkey={icon.name}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tlanguage={i18n.language}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tnodes={NodesLoader ? nodeMap?.[icon.name] : undefined}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tonSelect={handleSelect}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tregisterRef={registerRef}\n\t\t\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t\t})}\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t)}\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t\t<div className=\"tenx-icon-drawer__footer\">\n\t\t\t\t{t(keys.resultsCount, { count: visible.length })}\n\t\t\t</div>\n\t\t</div>\n\t)\n}\n\nexport default IconDrawerContent\n"],"mappings":";;;;;;;;;;;AAiBA,MAAM,YAAY;AAClB,MAAM,SAAS;AACf,MAAM,MAAM;AAaZ,MAAM,qBAAuD,EAC5D,eACA,mBACA,UACA,iBACA,UACA,UACA,iBACK;CACL,MAAM,EAAE,MAAM,MAAMA,iBAAe;CACnC,MAAM,CAAC,WAAW,gBAAgB,+BAA0C,IAAI,IAAI,CAAC;CACrF,MAAM,CAAC,UAAU,eAAe,+BAAyC,IAAI,IAAI,CAAC;CAClF,MAAM,CAAC,OAAO,YAAY,SAAS,EAAE;CACrC,MAAM,gBAAgB,iBAAiB,KAAK;CAC5C,MAAM,CAAC,UAAU,eAAe,SAAiB,GAAG;CACpD,MAAM,EAAE,WAAW,WAAW,eAAe,aAAa;CAE1D,MAAM,WAAW,UAAU,IAAI,aAAa;CAC5C,MAAM,QAAQ,kBAAkB;CAChC,MAAM,SAAS,OAAO;CACtB,MAAM,cAAc,OAAO;CAC3B,MAAM,UAAU,SAAS,IAAI,aAAa;CAI1C,MAAM,UAAU,CAAC,YADI,QAAQ,WAAW,KAAK,CAAC;CAG9C,MAAM,iBAAiB,aACrB,WAAyB;EACzB,cAAc,aAAa,IAA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A,IAEpE,oBAAC,OAAD;QACC,MAAK;QACL,OAAO;SAAE,QAAQ,YAAY,aAAa;SAAG,UAAU;SAAY,OAAO;QAAO;kBAEhF,YAAY,gBAAgB,EAAE,KAAK,QACnC,oBAAC,OAAD;SACC,WAAU;SACV,cAAY,IAAI;SAEhB,MAAK;SACL,OAAO;UACN,MAAM;UACN,UAAU;UACV,KAAK;UACL,WAAW,cAAc,IAAI,MAAM;UACnC,OAAO;SACR;mBAEC,QACC,MAAM,IAAI,QAAQ,SAAS,IAAI,QAAQ,UAAU,OAAO,EACxD,KAAK,MAAM,gBAAgB;UAC3B,MAAM,YAAY,IAAI,QAAQ,UAAU;UACxC,OACC,oBAAC,cAAD;WACC,QAAQ,OAAO;WACR;WACP,SAAS,cAAc;WACjB;WACN,OAAO;WACP,YACC,UAAU,YAAY,iBAAiB,SAAS,SAAS,KAAK;WAG/D,UAAU,KAAK;WACf,OAAO,cAAc,UAAU,KAAK,QAAQ,KAAA;WAC5C,UAAU;WACG;UACb,GALK,KAAK,IAKV;SAEH,CAAC;QACE,GAhCC,IAAI,GAgCL,CACL;OACG,CAAA;MAEF,CAAA;KACD;MACD;;GACL,oBAAC,OAAD;IAAK,WAAU;cACb,EAAE,KAAK,cAAc,EAAE,OAAO,QAAQ,OAAO,CAAC;GAC3C,CAAA;EACD;;AAEP"}
|
|
1
|
+
{"version":3,"file":"IconDrawerContent.js","names":["useTranslation"],"sources":["../../../../src/fields/icon/client/IconDrawerContent.tsx"],"sourcesContent":["'use client'\n\nimport { Button, ReactSelect, SearchIcon } from '@payloadcms/ui'\nimport { useVirtualizer } from '@tanstack/react-virtual'\nimport type React from 'react'\nimport { useCallback, useDeferredValue, useEffect, useMemo, useRef, useState } from 'react'\nimport { keys } from '../../../translations'\nimport { useTranslation } from '../../../translations/useTranslation'\nimport type { IconManifest, IconMeta, IconNodeMap } from '../../../types'\nimport type { AdapterComponentsEntry } from '../shared/adapterComponents'\nimport { buildIconSearchIndex, searchIcons } from '../shared/search'\nimport { IconGridCell } from './IconGridCell'\nimport { useRecentIcons } from './useRecentIcons'\n\n// One fixed size drives both the column count and the virtualizer row height. With no\n// in-flow label to vary a cell's height, every cell is an identical square and the grid\n// stays aligned regardless of icon name length.\nconst CELL_SIZE = 64\nconst RECENT = '__recent__'\nconst ALL = '__all__'\n\nexport type IconDrawerContentProps = {\n\tactiveLibrary: string\n\tadapterComponents: Record<string, AdapterComponentsEntry>\n\t/** Libraries available for selection: registered adapters already intersected with `available`. */\n\tadapters: { label: string; slug: string }[]\n\tonLibraryChange: (slug: string) => void\n\tonSelect: (library: string, icon: IconMeta) => void\n\tselected: { library: string; name: string } | null\n\tslugPrefix: string\n}\n\nconst IconDrawerContent: React.FC<IconDrawerContentProps> = ({\n\tactiveLibrary,\n\tadapterComponents,\n\tadapters,\n\tonLibraryChange,\n\tonSelect,\n\tselected,\n\tslugPrefix,\n}) => {\n\tconst { i18n, t } = useTranslation()\n\tconst [manifests, setManifests] = useState<Map<string, IconManifest>>(() => new Map())\n\tconst [nodeMaps, setNodeMaps] = useState<Map<string, IconNodeMap>>(() => new Map())\n\tconst [query, setQuery] = useState('')\n\tconst deferredQuery = useDeferredValue(query)\n\tconst [category, setCategory] = useState<string>(ALL)\n\tconst { addRecent, recent } = useRecentIcons(activeLibrary)\n\n\tconst manifest = manifests.get(activeLibrary)\n\tconst entry = adapterComponents[activeLibrary]\n\tconst Assets = entry?.Assets\n\tconst NodesLoader = entry?.Nodes\n\tconst nodeMap = nodeMaps.get(activeLibrary)\n\t// Libraries with a Nodes loader render the grid from bulk node-data; the grid\n\t// waits for that data before showing cells, others (radix) render immediately.\n\tconst nodesPending = Boolean(NodesLoader) && !nodeMap\n\tconst loading = !manifest || nodesPending\n\n\tconst handleManifest = useCallback(\n\t\t(loaded: IconManifest) => {\n\t\t\tsetManifests((previous) => new Map(previous).set(activeLibrary, loaded))\n\t\t},\n\t\t[activeLibrary]\n\t)\n\n\tconst handleNodes = useCallback(\n\t\t(loaded: IconNodeMap) => {\n\t\t\tsetNodeMaps((previous) => new Map(previous).set(activeLibrary, loaded))\n\t\t},\n\t\t[activeLibrary]\n\t)\n\n\t// biome-ignore lint/correctness/useExhaustiveDependencies: activeLibrary is the trigger; the effect resets category and search when it changes\n\tuseEffect(() => {\n\t\tsetCategory(ALL)\n\t\tsetQuery('')\n\t}, [activeLibrary])\n\n\tconst byName = useMemo(\n\t\t() => new Map((manifest?.icons ?? []).map((icon) => [icon.name, icon])),\n\t\t[manifest]\n\t)\n\n\tconst categoryIcons = useMemo((): IconMeta[] => {\n\t\tif (!manifest) return []\n\t\tif (category === ALL) return manifest.icons\n\t\tif (category === RECENT) {\n\t\t\treturn recent\n\t\t\t\t.map((name) => byName.get(name))\n\t\t\t\t.filter((icon): icon is IconMeta => Boolean(icon))\n\t\t}\n\t\treturn manifest.icons.filter((icon) => icon.categories.includes(category))\n\t}, [byName, category, manifest, recent])\n\n\tconst index = useMemo(() => buildIconSearchIndex(categoryIcons), [categoryIcons])\n\tconst visible = useMemo(() => searchIcons(index, deferredQuery), [deferredQuery, index])\n\n\tconst gridRef = useRef<HTMLDivElement>(null)\n\tconst [gridWidth, setGridWidth] = useState(0)\n\tuseEffect(() => {\n\t\tconst element = gridRef.current\n\t\tif (!element) return\n\t\tconst observer = new ResizeObserver(() => setGridWidth(element.offsetWidth))\n\t\tobserver.observe(element)\n\t\tsetGridWidth(element.offsetWidth)\n\t\treturn () => observer.disconnect()\n\t}, [])\n\tconst columns = Math.max(3, Math.floor(gridWidth / CELL_SIZE))\n\tconst rowCount = Math.ceil(visible.length / columns)\n\t// Cell-box span of a full row (columns * CELL_SIZE), published to CSS as a custom property.\n\t// The header row and banner derive their width from this (inset to the button outlines in\n\t// icon-field.css) so the search, switcher, banner, and visible grid share one left and one\n\t// right edge. Sized only from CELL_SIZE.\n\tconst mainStyle = {\n\t\t'--tenx-icon-grid-width': `${columns * CELL_SIZE}px`,\n\t} as React.CSSProperties\n\n\tconst virtualizer = useVirtualizer({\n\t\tcount: rowCount,\n\t\testimateSize: () => CELL_SIZE,\n\t\tgetScrollElement: () => gridRef.current,\n\t\t// Cells are cheap inline SVG now, so a deeper overscan buys smoother fast scrolls.\n\t\toverscan: 8,\n\t})\n\n\tconst [focusIndex, setFocusIndex] = useState(0)\n\t// biome-ignore lint/correctness/useExhaustiveDependencies: reset focus whenever the visible set changes\n\tuseEffect(() => setFocusIndex(0), [activeLibrary, category, deferredQuery])\n\tconst cellRefs = useRef(new Map<number, HTMLButtonElement>())\n\tconst registerRef = useCallback((cellIndex: number, element: HTMLButtonElement | null) => {\n\t\tif (element) cellRefs.current.set(cellIndex, element)\n\t\telse cellRefs.current.delete(cellIndex)\n\t}, [])\n\n\tconst focusCell = useCallback(\n\t\t(cellIndex: number) => {\n\t\t\tvirtualizer.scrollToIndex(Math.floor(cellIndex / columns))\n\t\t\trequestAnimationFrame(() => cellRefs.current.get(cellIndex)?.focus())\n\t\t},\n\t\t[columns, virtualizer]\n\t)\n\n\tconst handleGridKeyDown = useCallback(\n\t\t(event: React.KeyboardEvent<HTMLDivElement>) => {\n\t\t\tconst max = visible.length - 1\n\t\t\tif (max < 0) return\n\t\t\tlet next: number | null = null\n\t\t\tif (event.key === 'ArrowRight') next = Math.min(focusIndex + 1, max)\n\t\t\telse if (event.key === 'ArrowLeft') next = Math.max(focusIndex - 1, 0)\n\t\t\telse if (event.key === 'ArrowDown') next = Math.min(focusIndex + columns, max)\n\t\t\telse if (event.key === 'ArrowUp') next = Math.max(focusIndex - columns, 0)\n\t\t\telse if (event.key === 'Home') next = 0\n\t\t\telse if (event.key === 'End') next = max\n\t\t\tif (next === null) return\n\t\t\tevent.preventDefault()\n\t\t\tsetFocusIndex(next)\n\t\t\tfocusCell(next)\n\t\t},\n\t\t[columns, focusCell, focusIndex, visible.length]\n\t)\n\n\tconst handleSelect = useCallback(\n\t\t(icon: IconMeta) => {\n\t\t\taddRecent(icon.name)\n\t\t\tonSelect(activeLibrary, icon)\n\t\t},\n\t\t[activeLibrary, addRecent, onSelect]\n\t)\n\n\tconst railItems = useMemo(\n\t\t(): { key: string; label: string }[] => [\n\t\t\t{ key: ALL, label: t(keys.allIcons) },\n\t\t\t{ key: RECENT, label: t(keys.recent) },\n\t\t\t...(manifest?.categories ?? []).map((name) => ({ key: name, label: name })),\n\t\t],\n\t\t[manifest, t]\n\t)\n\n\tconst libraryOptions = useMemo(\n\t\t() => adapters.map((adapter) => ({ label: adapter.label, value: adapter.slug })),\n\t\t[adapters]\n\t)\n\tconst librarySelectId = `${slugPrefix}-library`\n\n\t// The stored value points at a library that is no longer offered for selection; the\n\t// full explanation lives here, the trigger only carries a compact marker.\n\tconst selectedUnavailable =\n\t\tselected !== null && !adapters.some((adapter) => adapter.slug === selected.library)\n\n\t// A listbox must own option children, so the grid only claims role=\"listbox\" (with\n\t// its keyboard nav and label) once cells exist. While loading it is an aria-busy\n\t// container; when empty it is a plain container holding the \"no icons\" message.\n\tconst gridPopulated = !loading && visible.length > 0\n\tconst gridA11y: React.HTMLAttributes<HTMLDivElement> = gridPopulated\n\t\t? { 'aria-label': t(keys.iconGrid), onKeyDown: handleGridKeyDown, role: 'listbox' }\n\t\t: { 'aria-busy': loading || undefined }\n\n\treturn (\n\t\t<div className=\"tenx-icon-drawer\">\n\t\t\t{/* Sibling loaders keyed distinctly per library: a shared key collides (\"two children\n\t\t\t with the same key\") when both mount on open, while distinct keys keep the per-library remount. */}\n\t\t\t{Assets && !manifest ? (\n\t\t\t\t<Assets key={`assets-${activeLibrary}`} onReady={handleManifest} />\n\t\t\t) : null}\n\t\t\t{NodesLoader && !nodeMap ? (\n\t\t\t\t<NodesLoader key={`nodes-${activeLibrary}`} onReady={handleNodes} />\n\t\t\t) : null}\n\t\t\t<div className=\"tenx-icon-drawer__body\">\n\t\t\t\t<nav aria-label={t(keys.iconCategories)} className=\"tenx-icon-drawer__rail\">\n\t\t\t\t\t{railItems.map((item) => (\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\taria-pressed={category === item.key}\n\t\t\t\t\t\t\tbuttonStyle={category === item.key ? 'pill' : 'ghost'}\n\t\t\t\t\t\t\tclassName=\"tenx-icon-drawer__rail-item\"\n\t\t\t\t\t\t\tkey={item.key}\n\t\t\t\t\t\t\tmargin={false}\n\t\t\t\t\t\t\tonClick={() => setCategory(item.key)}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{item.label}\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t))}\n\t\t\t\t</nav>\n\t\t\t\t<div className=\"tenx-icon-drawer__main\" style={mainStyle}>\n\t\t\t\t\t{selectedUnavailable ? (\n\t\t\t\t\t\t<div className=\"tenx-icon-drawer__banner\" role=\"status\">\n\t\t\t\t\t\t\t{t(keys.libraryUnavailable)}\n\t\t\t\t\t\t</div>\n\t\t\t\t\t) : null}\n\t\t\t\t\t<div className=\"tenx-icon-drawer__header\">\n\t\t\t\t\t\t<div className=\"tenx-icon-drawer__search form-input-group\">\n\t\t\t\t\t\t\t<span aria-hidden=\"true\" className=\"tenx-icon-drawer__search-icon\">\n\t\t\t\t\t\t\t\t<SearchIcon />\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t<input\n\t\t\t\t\t\t\t\taria-label={t(keys.searchIcons)}\n\t\t\t\t\t\t\t\tclassName=\"form-input tenx-icon-drawer__search-input\"\n\t\t\t\t\t\t\t\tonChange={(event: React.ChangeEvent<HTMLInputElement>) =>\n\t\t\t\t\t\t\t\t\tsetQuery(event.target.value)\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tplaceholder={t(keys.searchIcons)}\n\t\t\t\t\t\t\t\ttype=\"text\"\n\t\t\t\t\t\t\t\tvalue={query}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t{/* adapters is the available-filtered set; the switcher shows only with 2+ libraries, fixed width beside the growing search */}\n\t\t\t\t\t\t{adapters.length > 1 ? (\n\t\t\t\t\t\t\t<div className=\"tenx-icon-drawer__switcher\">\n\t\t\t\t\t\t\t\t<label className=\"tenx-icon-drawer__sr-only\" htmlFor={librarySelectId}>\n\t\t\t\t\t\t\t\t\t{t(keys.fieldIconLibraryLabel)}\n\t\t\t\t\t\t\t\t</label>\n\t\t\t\t\t\t\t\t<ReactSelect\n\t\t\t\t\t\t\t\t\tinputId={librarySelectId}\n\t\t\t\t\t\t\t\t\tisClearable={false}\n\t\t\t\t\t\t\t\t\tonChange={(option) => {\n\t\t\t\t\t\t\t\t\t\tconst single = Array.isArray(option) ? option[0] : option\n\t\t\t\t\t\t\t\t\t\tif (single && typeof single.value === 'string') onLibraryChange(single.value)\n\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t\toptions={libraryOptions}\n\t\t\t\t\t\t\t\t\tvalue={libraryOptions.find((option) => option.value === activeLibrary)}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t) : null}\n\t\t\t\t\t</div>\n\t\t\t\t\t<div className=\"tenx-icon-drawer__grid\" ref={gridRef} {...gridA11y}>\n\t\t\t\t\t\t{loading ? (\n\t\t\t\t\t\t\t<div className=\"tenx-icon-drawer__loading\">\n\t\t\t\t\t\t\t\t{Array.from({ length: 24 }, (_, skeletonIndex) => (\n\t\t\t\t\t\t\t\t\t// biome-ignore lint/suspicious/noArrayIndexKey: fixed-count static placeholders that never reorder\n\t\t\t\t\t\t\t\t\t<span className=\"tenx-icon-placeholder\" key={`skeleton-${skeletonIndex}`} />\n\t\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t) : visible.length === 0 ? (\n\t\t\t\t\t\t\t<div className=\"tenx-icon-drawer__empty\">{t(keys.noIconsFound)}</div>\n\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\trole=\"presentation\"\n\t\t\t\t\t\t\t\tstyle={{ height: virtualizer.getTotalSize(), position: 'relative', width: '100%' }}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{virtualizer.getVirtualItems().map((row) => (\n\t\t\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\t\t\tclassName=\"tenx-icon-drawer__row\"\n\t\t\t\t\t\t\t\t\t\tdata-index={row.index}\n\t\t\t\t\t\t\t\t\t\tkey={row.key}\n\t\t\t\t\t\t\t\t\t\trole=\"presentation\"\n\t\t\t\t\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\t\t\t\t\tleft: 0,\n\t\t\t\t\t\t\t\t\t\t\tposition: 'absolute',\n\t\t\t\t\t\t\t\t\t\t\ttop: 0,\n\t\t\t\t\t\t\t\t\t\t\ttransform: `translateY(${row.start}px)`,\n\t\t\t\t\t\t\t\t\t\t\twidth: '100%',\n\t\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{visible\n\t\t\t\t\t\t\t\t\t\t\t.slice(row.index * columns, row.index * columns + columns)\n\t\t\t\t\t\t\t\t\t\t\t.map((icon, columnIndex) => {\n\t\t\t\t\t\t\t\t\t\t\t\tconst cellIndex = row.index * columns + columnIndex\n\t\t\t\t\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t\t\t\t\t<IconGridCell\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tcanvas={entry?.canvas}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tentry={entry}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tfocused={cellIndex === focusIndex}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\ticon={icon}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tindex={cellIndex}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tisSelected={\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tselected?.library === activeLibrary && selected.name === icon.name\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tkey={icon.name}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tlanguage={i18n.language}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tnodes={NodesLoader ? nodeMap?.[icon.name] : undefined}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tonSelect={handleSelect}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tregisterRef={registerRef}\n\t\t\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t\t})}\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t)}\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t\t<div className=\"tenx-icon-drawer__footer\">\n\t\t\t\t{t(keys.resultsCount, { count: visible.length })}\n\t\t\t</div>\n\t\t</div>\n\t)\n}\n\nexport default IconDrawerContent\n"],"mappings":";;;;;;;;;;;AAiBA,MAAM,YAAY;AAClB,MAAM,SAAS;AACf,MAAM,MAAM;AAaZ,MAAM,qBAAuD,EAC5D,eACA,mBACA,UACA,iBACA,UACA,UACA,iBACK;CACL,MAAM,EAAE,MAAM,MAAMA,iBAAe;CACnC,MAAM,CAAC,WAAW,gBAAgB,+BAA0C,IAAI,IAAI,CAAC;CACrF,MAAM,CAAC,UAAU,eAAe,+BAAyC,IAAI,IAAI,CAAC;CAClF,MAAM,CAAC,OAAO,YAAY,SAAS,EAAE;CACrC,MAAM,gBAAgB,iBAAiB,KAAK;CAC5C,MAAM,CAAC,UAAU,eAAe,SAAiB,GAAG;CACpD,MAAM,EAAE,WAAW,WAAW,eAAe,aAAa;CAE1D,MAAM,WAAW,UAAU,IAAI,aAAa;CAC5C,MAAM,QAAQ,kBAAkB;CAChC,MAAM,SAAS,OAAO;CACtB,MAAM,cAAc,OAAO;CAC3B,MAAM,UAAU,SAAS,IAAI,aAAa;CAI1C,MAAM,UAAU,CAAC,YADI,QAAQ,WAAW,KAAK,CAAC;CAG9C,MAAM,iBAAiB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WAAW,IACtB,oBAAC,OAAD;QAAK,WAAU;kBAA2B,EAAE,KAAK,YAAY;OAAO,CAAA,IAEpE,oBAAC,OAAD;QACC,MAAK;QACL,OAAO;SAAE,QAAQ,YAAY,aAAa;SAAG,UAAU;SAAY,OAAO;QAAO;kBAEhF,YAAY,gBAAgB,EAAE,KAAK,QACnC,oBAAC,OAAD;SACC,WAAU;SACV,cAAY,IAAI;SAEhB,MAAK;SACL,OAAO;UACN,MAAM;UACN,UAAU;UACV,KAAK;UACL,WAAW,cAAc,IAAI,MAAM;UACnC,OAAO;SACR;mBAEC,QACC,MAAM,IAAI,QAAQ,SAAS,IAAI,QAAQ,UAAU,OAAO,EACxD,KAAK,MAAM,gBAAgB;UAC3B,MAAM,YAAY,IAAI,QAAQ,UAAU;UACxC,OACC,oBAAC,cAAD;WACC,QAAQ,OAAO;WACR;WACP,SAAS,cAAc;WACjB;WACN,OAAO;WACP,YACC,UAAU,YAAY,iBAAiB,SAAS,SAAS,KAAK;WAG/D,UAAU,KAAK;WACf,OAAO,cAAc,UAAU,KAAK,QAAQ,KAAA;WAC5C,UAAU;WACG;UACb,GALK,KAAK,IAKV;SAEH,CAAC;QACE,GAhCC,IAAI,GAgCL,CACL;OACG,CAAA;MAEF,CAAA;KACD;MACD;;GACL,oBAAC,OAAD;IAAK,WAAU;cACb,EAAE,KAAK,cAAc,EAAE,OAAO,QAAQ,OAAO,CAAC;GAC3C,CAAA;EACD;;AAEP"}
|
|
@@ -4,10 +4,10 @@ import { useTranslation as useTranslation$1 } from "../../../translations/useTra
|
|
|
4
4
|
import { resolveIconDisplay } from "../shared/iconLabel.js";
|
|
5
5
|
import { formatIconValue, resolveIconValue } from "../shared/value.js";
|
|
6
6
|
import { filterAvailableLibraries, pickInitialLibrary } from "./availableLibraries.js";
|
|
7
|
-
import { Drawer, FieldDescription, FieldError, FieldLabel, RenderCustomComponent,
|
|
7
|
+
import { CircledXIcon, Drawer, FieldDescription, FieldError, FieldLabel, RenderCustomComponent, WarningIcon, fieldBaseClass, formatDrawerSlug, useEditDepth, useField, useModal } from "@payloadcms/ui";
|
|
8
8
|
import { mergeFieldStyles } from "@payloadcms/ui/shared";
|
|
9
9
|
import React, { Suspense, useCallback, useMemo, useRef, useState } from "react";
|
|
10
|
-
import { Fragment
|
|
10
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
11
11
|
import "./icon-field.css";
|
|
12
12
|
//#region src/fields/icon/client/IconFieldClient.tsx
|
|
13
13
|
const IconDrawerContent = React.lazy(() => import("./IconDrawerContent.js"));
|
|
@@ -15,9 +15,9 @@ const IconDrawerContent = React.lazy(() => import("./IconDrawerContent.js"));
|
|
|
15
15
|
const PlaceholderGlyph = () => /* @__PURE__ */ jsxs("svg", {
|
|
16
16
|
"aria-hidden": "true",
|
|
17
17
|
fill: "currentColor",
|
|
18
|
-
height:
|
|
18
|
+
height: 16,
|
|
19
19
|
viewBox: "0 0 20 20",
|
|
20
|
-
width:
|
|
20
|
+
width: 16,
|
|
21
21
|
children: [
|
|
22
22
|
/* @__PURE__ */ jsx("rect", {
|
|
23
23
|
height: "6",
|
|
@@ -49,33 +49,6 @@ const PlaceholderGlyph = () => /* @__PURE__ */ jsxs("svg", {
|
|
|
49
49
|
})
|
|
50
50
|
]
|
|
51
51
|
});
|
|
52
|
-
const WarningIcon = () => /* @__PURE__ */ jsxs("svg", {
|
|
53
|
-
"aria-hidden": "true",
|
|
54
|
-
fill: "none",
|
|
55
|
-
height: 16,
|
|
56
|
-
viewBox: "0 0 16 16",
|
|
57
|
-
width: 16,
|
|
58
|
-
children: [
|
|
59
|
-
/* @__PURE__ */ jsx("path", {
|
|
60
|
-
d: "M8 1.75 15 14H1z",
|
|
61
|
-
stroke: "currentColor",
|
|
62
|
-
strokeLinejoin: "round",
|
|
63
|
-
strokeWidth: "1.4"
|
|
64
|
-
}),
|
|
65
|
-
/* @__PURE__ */ jsx("path", {
|
|
66
|
-
d: "M8 6.25v3.5",
|
|
67
|
-
stroke: "currentColor",
|
|
68
|
-
strokeLinecap: "round",
|
|
69
|
-
strokeWidth: "1.4"
|
|
70
|
-
}),
|
|
71
|
-
/* @__PURE__ */ jsx("circle", {
|
|
72
|
-
cx: "8",
|
|
73
|
-
cy: "11.75",
|
|
74
|
-
fill: "currentColor",
|
|
75
|
-
r: "0.85"
|
|
76
|
-
})
|
|
77
|
-
]
|
|
78
|
-
});
|
|
79
52
|
const IconField = (props) => {
|
|
80
53
|
const { adapterComponents, adapters, available, defaultLibrary, field, path: pathFromProps, readOnly, selectedMeta, showTextInput } = props;
|
|
81
54
|
const { i18n, t } = useTranslation$1();
|
|
@@ -121,7 +94,7 @@ const IconField = (props) => {
|
|
|
121
94
|
const glyphClass = `tenx-icon-field__glyph${hasGlyph ? "" : " tenx-icon-field__glyph--empty"}`;
|
|
122
95
|
const glyph = resolved && previewEntry ? /* @__PURE__ */ jsx(previewEntry.Icon, {
|
|
123
96
|
name: resolved.name,
|
|
124
|
-
size:
|
|
97
|
+
size: 16
|
|
125
98
|
}) : /* @__PURE__ */ jsx(PlaceholderGlyph, {});
|
|
126
99
|
const wrapperClasses = [
|
|
127
100
|
fieldBaseClass,
|
|
@@ -130,7 +103,12 @@ const IconField = (props) => {
|
|
|
130
103
|
showError ? "error" : null,
|
|
131
104
|
isDisabled ? "read-only" : null
|
|
132
105
|
].filter(Boolean).join(" ");
|
|
133
|
-
const controlClasses =
|
|
106
|
+
const controlClasses = [
|
|
107
|
+
"tenx-icon-field__control",
|
|
108
|
+
"form-input-group",
|
|
109
|
+
showError ? "form-input-group-error" : null,
|
|
110
|
+
isUnavailable ? "tenx-icon-field__control--warning" : null
|
|
111
|
+
].filter(Boolean).join(" ");
|
|
134
112
|
return /* @__PURE__ */ jsxs("div", {
|
|
135
113
|
className: wrapperClasses,
|
|
136
114
|
id: `field-${path.replace(/\./g, "__")}`,
|
|
@@ -159,7 +137,7 @@ const IconField = (props) => {
|
|
|
159
137
|
/* @__PURE__ */ jsxs("div", {
|
|
160
138
|
className: controlClasses,
|
|
161
139
|
children: [
|
|
162
|
-
showTextInput ? /* @__PURE__ */ jsxs(Fragment
|
|
140
|
+
showTextInput ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("button", {
|
|
163
141
|
"aria-expanded": isModalOpen(drawerSlug),
|
|
164
142
|
"aria-haspopup": "dialog",
|
|
165
143
|
"aria-label": t(keys.selectIcon),
|
|
@@ -170,7 +148,7 @@ const IconField = (props) => {
|
|
|
170
148
|
children: glyph
|
|
171
149
|
}), /* @__PURE__ */ jsx("input", {
|
|
172
150
|
"aria-label": t(keys.fieldIconLabel),
|
|
173
|
-
className: "tenx-icon-field__value tenx-icon-field__value--input",
|
|
151
|
+
className: "form-input tenx-icon-field__value tenx-icon-field__value--input",
|
|
174
152
|
onBlur: () => setEditing(false),
|
|
175
153
|
onChange: (event) => setValue(event.target.value || null),
|
|
176
154
|
onFocus: () => setEditing(true),
|
|
@@ -200,7 +178,7 @@ const IconField = (props) => {
|
|
|
200
178
|
isUnavailable ? /* @__PURE__ */ jsxs("span", {
|
|
201
179
|
className: "tenx-icon-field__marker",
|
|
202
180
|
title: t(keys.iconUnavailable),
|
|
203
|
-
children: [/* @__PURE__ */ jsx(WarningIcon, {}), /* @__PURE__ */ jsx("span", {
|
|
181
|
+
children: [/* @__PURE__ */ jsx(WarningIcon, { size: 16 }), /* @__PURE__ */ jsx("span", {
|
|
204
182
|
className: "tenx-icon-field__sr-only",
|
|
205
183
|
children: t(keys.iconUnavailable)
|
|
206
184
|
})]
|
|
@@ -213,7 +191,7 @@ const IconField = (props) => {
|
|
|
213
191
|
setEditing(false);
|
|
214
192
|
},
|
|
215
193
|
type: "button",
|
|
216
|
-
children: /* @__PURE__ */ jsx(
|
|
194
|
+
children: /* @__PURE__ */ jsx(CircledXIcon, { size: 24 })
|
|
217
195
|
}) : null
|
|
218
196
|
]
|
|
219
197
|
}),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IconFieldClient.js","names":["useTranslation"],"sources":["../../../../src/fields/icon/client/IconFieldClient.tsx"],"sourcesContent":["'use client'\n\nimport {\n\tDrawer,\n\tFieldDescription,\n\tFieldError,\n\tFieldLabel,\n\tfieldBaseClass,\n\tformatDrawerSlug,\n\tRenderCustomComponent,\n\tuseEditDepth,\n\tuseField,\n\tuseModal,\n\tXIcon,\n} from '@payloadcms/ui'\nimport { mergeFieldStyles } from '@payloadcms/ui/shared'\nimport type { TextFieldClientProps } from 'payload'\nimport React, { Suspense, useCallback, useMemo, useRef, useState } from 'react'\nimport { keys } from '../../../translations'\nimport { useTranslation } from '../../../translations/useTranslation'\nimport type { IconMeta } from '../../../types'\nimport type { AdapterComponentsEntry } from '../shared/adapterComponents'\nimport { resolveIconDisplay } from '../shared/iconLabel'\nimport { formatIconValue, resolveIconValue } from '../shared/value'\nimport { filterAvailableLibraries, pickInitialLibrary } from './availableLibraries'\nimport './icon-field.css'\n\nconst IconDrawerContent = React.lazy(() => import('./IconDrawerContent'))\n\n/** Muted grid glyph shown in the square when the field has no value: a picker affordance, not a value. */\nconst PlaceholderGlyph: React.FC = () => (\n\t<svg aria-hidden=\"true\" fill=\"currentColor\" height={20} viewBox=\"0 0 20 20\" width={20}>\n\t\t<rect height=\"6\" rx=\"1.5\" width=\"6\" x=\"3\" y=\"3\" />\n\t\t<rect height=\"6\" rx=\"1.5\" width=\"6\" x=\"11\" y=\"3\" />\n\t\t<rect height=\"6\" rx=\"1.5\" width=\"6\" x=\"3\" y=\"11\" />\n\t\t<rect height=\"6\" rx=\"1.5\" width=\"6\" x=\"11\" y=\"11\" />\n\t</svg>\n)\n\nconst WarningIcon: React.FC = () => (\n\t<svg aria-hidden=\"true\" fill=\"none\" height={16} viewBox=\"0 0 16 16\" width={16}>\n\t\t<path d=\"M8 1.75 15 14H1z\" stroke=\"currentColor\" strokeLinejoin=\"round\" strokeWidth=\"1.4\" />\n\t\t<path d=\"M8 6.25v3.5\" stroke=\"currentColor\" strokeLinecap=\"round\" strokeWidth=\"1.4\" />\n\t\t<circle cx=\"8\" cy=\"11.75\" fill=\"currentColor\" r=\"0.85\" />\n\t</svg>\n)\n\nexport type IconFieldClientExtraProps = {\n\tadapterComponents: Record<string, AdapterComponentsEntry>\n\tadapters: { label: string; slug: string }[]\n\tavailable: string[]\n\tdefaultLibrary: string\n\t/**\n\t * Manifest entry for the value this field rendered with, resolved server-side.\n\t * The trigger has only a stored value, so without this a library-supplied label\n\t * could not appear until the editor opened the drawer.\n\t */\n\tselectedMeta?: IconMeta | null\n\tshowTextInput: boolean\n}\n\nexport type IconFieldClientProps = IconFieldClientExtraProps & TextFieldClientProps\n\nexport const IconField: React.FC<IconFieldClientProps> = (props) => {\n\tconst {\n\t\tadapterComponents,\n\t\tadapters,\n\t\tavailable,\n\t\tdefaultLibrary,\n\t\tfield,\n\t\tpath: pathFromProps,\n\t\treadOnly,\n\t\tselectedMeta,\n\t\tshowTextInput,\n\t} = props\n\tconst { i18n, t } = useTranslation()\n\tconst editDepth = useEditDepth()\n\tconst { closeModal, isModalOpen, openModal } = useModal()\n\n\tconst {\n\t\tcustomComponents: { AfterInput, BeforeInput, Description, Error: ErrorComponent, Label } = {},\n\t\tdisabled,\n\t\tpath,\n\t\tsetValue,\n\t\tshowError,\n\t\tvalue,\n\t} = useField<string>({ potentiallyStalePath: pathFromProps })\n\n\tconst drawerSlug = formatDrawerSlug({ slug: `fields-icon-${path}`, depth: editDepth })\n\tconst isDisabled = Boolean(readOnly || disabled || field.admin?.readOnly)\n\tconst styles = useMemo(() => mergeFieldStyles(field), [field])\n\n\tconst resolved = value ? resolveIconValue(value, defaultLibrary) : null\n\tconst registeredSlugs = useMemo(\n\t\t() => new Set(adapters.map((adapter) => adapter.slug)),\n\t\t[adapters]\n\t)\n\tconst isUnavailable =\n\t\tresolved !== null &&\n\t\t(!registeredSlugs.has(resolved.library) || !available.includes(resolved.library))\n\tconst previewEntry = resolved ? adapterComponents[resolved.library] : undefined\n\tconst hasGlyph = Boolean(resolved && previewEntry)\n\n\t// Manifest entries by stored value, seeded with the server's answer for the value\n\t// this field rendered with and extended whenever the editor picks. A pick has to\n\t// relabel the trigger immediately, and the manifest only lives inside the drawer.\n\tconst knownMeta = useRef(new Map<string, IconMeta>())\n\tif (value && selectedMeta && !knownMeta.current.has(value)) {\n\t\tknownMeta.current.set(value, selectedMeta)\n\t}\n\tconst displayLabel = resolved\n\t\t? resolveIconDisplay({\n\t\t\t\tlanguage: i18n.language,\n\t\t\t\tmeta: value ? knownMeta.current.get(value) : undefined,\n\t\t\t\tname: resolved.name,\n\t\t\t}).label\n\t\t: ''\n\n\tconst availableAdapters = useMemo(\n\t\t() => filterAvailableLibraries(adapters, available),\n\t\t[adapters, available]\n\t)\n\tconst [activeLibrary, setActiveLibrary] = useState(() =>\n\t\tpickInitialLibrary({ available, defaultLibrary, selectedLibrary: resolved?.library ?? null })\n\t)\n\n\t// Text-input mode shows the raw `library:name` while focused for editing and the\n\t// formatted label otherwise, so the editor never has to read a colon-prefixed value.\n\tconst [editing, setEditing] = useState(false)\n\n\tconst handleSelect = useCallback(\n\t\t(library: string, icon: IconMeta) => {\n\t\t\tconst next = formatIconValue(library, icon.name)\n\t\t\tknownMeta.current.set(next, icon)\n\t\t\tsetValue(next)\n\t\t\tcloseModal(drawerSlug)\n\t\t},\n\t\t[closeModal, drawerSlug, setValue]\n\t)\n\n\tconst triggerDisabled = isDisabled || availableAdapters.length === 0\n\tconst glyphClass = `tenx-icon-field__glyph${hasGlyph ? '' : ' tenx-icon-field__glyph--empty'}`\n\tconst glyph =\n\t\tresolved && previewEntry ? (\n\t\t\t<previewEntry.Icon name={resolved.name} size={20} />\n\t\t) : (\n\t\t\t<PlaceholderGlyph />\n\t\t)\n\n\tconst wrapperClasses = [\n\t\tfieldBaseClass,\n\t\t'tenx-icon-field',\n\t\tfield.admin?.className,\n\t\tshowError ? 'error' : null,\n\t\tisDisabled ? 'read-only' : null,\n\t]\n\t\t.filter(Boolean)\n\t\t.join(' ')\n\n\tconst controlClasses = `tenx-icon-field__control${isUnavailable ? ' tenx-icon-field__control--warning' : ''}`\n\n\treturn (\n\t\t<div className={wrapperClasses} id={`field-${path.replace(/\\./g, '__')}`} style={styles}>\n\t\t\t<RenderCustomComponent\n\t\t\t\tCustomComponent={Label}\n\t\t\t\tFallback={\n\t\t\t\t\t<FieldLabel\n\t\t\t\t\t\tlabel={field.label}\n\t\t\t\t\t\tlocalized={field.localized}\n\t\t\t\t\t\tpath={path}\n\t\t\t\t\t\trequired={field.required}\n\t\t\t\t\t/>\n\t\t\t\t}\n\t\t\t/>\n\t\t\t<div className={`${fieldBaseClass}__wrap`}>\n\t\t\t\t<RenderCustomComponent\n\t\t\t\t\tCustomComponent={ErrorComponent}\n\t\t\t\t\tFallback={<FieldError path={path} showError={showError} />}\n\t\t\t\t/>\n\t\t\t\t{BeforeInput}\n\t\t\t\t<div className={controlClasses}>\n\t\t\t\t\t{showTextInput ? (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<button\n\t\t\t\t\t\t\t\taria-expanded={isModalOpen(drawerSlug)}\n\t\t\t\t\t\t\t\taria-haspopup=\"dialog\"\n\t\t\t\t\t\t\t\taria-label={t(keys.selectIcon)}\n\t\t\t\t\t\t\t\tclassName={glyphClass}\n\t\t\t\t\t\t\t\tdisabled={triggerDisabled}\n\t\t\t\t\t\t\t\tonClick={() => openModal(drawerSlug)}\n\t\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{glyph}\n\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t\t<input\n\t\t\t\t\t\t\t\taria-label={t(keys.fieldIconLabel)}\n\t\t\t\t\t\t\t\tclassName=\"tenx-icon-field__value tenx-icon-field__value--input\"\n\t\t\t\t\t\t\t\tonBlur={() => setEditing(false)}\n\t\t\t\t\t\t\t\tonChange={(event) => setValue(event.target.value || null)}\n\t\t\t\t\t\t\t\tonFocus={() => setEditing(true)}\n\t\t\t\t\t\t\t\tplaceholder={t(keys.textInputPlaceholder)}\n\t\t\t\t\t\t\t\treadOnly={isDisabled}\n\t\t\t\t\t\t\t\ttype=\"text\"\n\t\t\t\t\t\t\t\tvalue={editing ? (value ?? '') : displayLabel}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</>\n\t\t\t\t\t) : (\n\t\t\t\t\t\t<button\n\t\t\t\t\t\t\taria-expanded={isModalOpen(drawerSlug)}\n\t\t\t\t\t\t\taria-haspopup=\"dialog\"\n\t\t\t\t\t\t\tclassName=\"tenx-icon-field__open\"\n\t\t\t\t\t\t\tdisabled={triggerDisabled}\n\t\t\t\t\t\t\tonClick={() => openModal(drawerSlug)}\n\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<span aria-hidden=\"true\" className={glyphClass}>\n\t\t\t\t\t\t\t\t{glyph}\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t<span className=\"tenx-icon-field__value\">\n\t\t\t\t\t\t\t\t{resolved ? (\n\t\t\t\t\t\t\t\t\tdisplayLabel\n\t\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t\t<span className=\"tenx-icon-field__placeholder\">{t(keys.selectIcon)}</span>\n\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t</button>\n\t\t\t\t\t)}\n\t\t\t\t\t{isUnavailable ? (\n\t\t\t\t\t\t<span className=\"tenx-icon-field__marker\" title={t(keys.iconUnavailable)}>\n\t\t\t\t\t\t\t<WarningIcon />\n\t\t\t\t\t\t\t<span className=\"tenx-icon-field__sr-only\">{t(keys.iconUnavailable)}</span>\n\t\t\t\t\t\t</span>\n\t\t\t\t\t) : null}\n\t\t\t\t\t{value && !field.required && !isDisabled ? (\n\t\t\t\t\t\t<button\n\t\t\t\t\t\t\taria-label={t(keys.clearIcon)}\n\t\t\t\t\t\t\tclassName=\"tenx-icon-field__clear\"\n\t\t\t\t\t\t\tonClick={() => {\n\t\t\t\t\t\t\t\tsetValue(null)\n\t\t\t\t\t\t\t\tsetEditing(false)\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<XIcon />\n\t\t\t\t\t\t</button>\n\t\t\t\t\t) : null}\n\t\t\t\t</div>\n\t\t\t\t{AfterInput}\n\t\t\t\t<RenderCustomComponent\n\t\t\t\t\tCustomComponent={Description}\n\t\t\t\t\tFallback={<FieldDescription description={field.admin?.description} path={path} />}\n\t\t\t\t/>\n\t\t\t</div>\n\t\t\t<Drawer className=\"tenx-icon-drawer-modal\" slug={drawerSlug} title={t(keys.selectIcon)}>\n\t\t\t\t<Suspense fallback={<div className=\"tenx-icon-drawer__loading\" />}>\n\t\t\t\t\t<IconDrawerContent\n\t\t\t\t\t\tactiveLibrary={activeLibrary}\n\t\t\t\t\t\tadapterComponents={adapterComponents}\n\t\t\t\t\t\tadapters={availableAdapters}\n\t\t\t\t\t\tonLibraryChange={setActiveLibrary}\n\t\t\t\t\t\tonSelect={handleSelect}\n\t\t\t\t\t\tselected={resolved}\n\t\t\t\t\t\tslugPrefix={drawerSlug}\n\t\t\t\t\t/>\n\t\t\t\t</Suspense>\n\t\t\t</Drawer>\n\t\t</div>\n\t)\n}\n"],"mappings":";;;;;;;;;;;;AA2BA,MAAM,oBAAoB,MAAM,WAAW,OAAO,yBAAsB;;AAGxE,MAAM,yBACL,qBAAC,OAAD;CAAK,eAAY;CAAO,MAAK;CAAe,QAAQ;CAAI,SAAQ;CAAY,OAAO;WAAnF;EACC,oBAAC,QAAD;GAAM,QAAO;GAAI,IAAG;GAAM,OAAM;GAAI,GAAE;GAAI,GAAE;EAAK,CAAA;EACjD,oBAAC,QAAD;GAAM,QAAO;GAAI,IAAG;GAAM,OAAM;GAAI,GAAE;GAAK,GAAE;EAAK,CAAA;EAClD,oBAAC,QAAD;GAAM,QAAO;GAAI,IAAG;GAAM,OAAM;GAAI,GAAE;GAAI,GAAE;E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e;kBAAvE,CACC,oBAAC,aAAD,CAAc,CAAA,GACd,oBAAC,QAAD;SAAM,WAAU;mBAA4B,EAAE,KAAK,eAAe;QAAQ,CAAA,CACrE;YACH;OACH,SAAS,CAAC,MAAM,YAAY,CAAC,aAC7B,oBAAC,UAAD;QACC,cAAY,EAAE,KAAK,SAAS;QAC5B,WAAU;QACV,eAAe;SACd,SAAS,IAAI;SACb,WAAW,KAAK;QACjB;QACA,MAAK;kBAEL,oBAAC,OAAD,CAAQ,CAAA;OACD,CAAA,IACL;MACA;;KACJ;KACD,oBAAC,uBAAD;MACC,iBAAiB;MACjB,UAAU,oBAAC,kBAAD;OAAkB,aAAa,MAAM,OAAO;OAAmB;MAAO,CAAA;KAChF,CAAA;IACG;;GACL,oBAAC,QAAD;IAAQ,WAAU;IAAyB,MAAM;IAAY,OAAO,EAAE,KAAK,UAAU;cACpF,oBAAC,UAAD;KAAU,UAAU,oBAAC,OAAD,EAAK,WAAU,4BAA6B,CAAA;eAC/D,oBAAC,mBAAD;MACgB;MACI;MACnB,UAAU;MACV,iBAAiB;MACjB,UAAU;MACV,UAAU;MACV,YAAY;KACZ,CAAA;IACQ,CAAA;GACH,CAAA;EACJ;;AAEP"}
|
|
1
|
+
{"version":3,"file":"IconFieldClient.js","names":["useTranslation"],"sources":["../../../../src/fields/icon/client/IconFieldClient.tsx"],"sourcesContent":["'use client'\n\nimport {\n\tCircledXIcon,\n\tDrawer,\n\tFieldDescription,\n\tFieldError,\n\tFieldLabel,\n\tfieldBaseClass,\n\tformatDrawerSlug,\n\tRenderCustomComponent,\n\tuseEditDepth,\n\tuseField,\n\tuseModal,\n\tWarningIcon,\n} from '@payloadcms/ui'\nimport { mergeFieldStyles } from '@payloadcms/ui/shared'\nimport type { TextFieldClientProps } from 'payload'\nimport React, { Suspense, useCallback, useMemo, useRef, useState } from 'react'\nimport { keys } from '../../../translations'\nimport { useTranslation } from '../../../translations/useTranslation'\nimport type { IconMeta } from '../../../types'\nimport type { AdapterComponentsEntry } from '../shared/adapterComponents'\nimport { resolveIconDisplay } from '../shared/iconLabel'\nimport { formatIconValue, resolveIconValue } from '../shared/value'\nimport { filterAvailableLibraries, pickInitialLibrary } from './availableLibraries'\nimport './icon-field.css'\n\nconst IconDrawerContent = React.lazy(() => import('./IconDrawerContent'))\n\n/** Muted grid glyph shown in the square when the field has no value: a picker affordance, not a value. */\nconst PlaceholderGlyph: React.FC = () => (\n\t<svg aria-hidden=\"true\" fill=\"currentColor\" height={16} viewBox=\"0 0 20 20\" width={16}>\n\t\t<rect height=\"6\" rx=\"1.5\" width=\"6\" x=\"3\" y=\"3\" />\n\t\t<rect height=\"6\" rx=\"1.5\" width=\"6\" x=\"11\" y=\"3\" />\n\t\t<rect height=\"6\" rx=\"1.5\" width=\"6\" x=\"3\" y=\"11\" />\n\t\t<rect height=\"6\" rx=\"1.5\" width=\"6\" x=\"11\" y=\"11\" />\n\t</svg>\n)\n\nexport type IconFieldClientExtraProps = {\n\tadapterComponents: Record<string, AdapterComponentsEntry>\n\tadapters: { label: string; slug: string }[]\n\tavailable: string[]\n\tdefaultLibrary: string\n\t/**\n\t * Manifest entry for the value this field rendered with, resolved server-side.\n\t * The trigger has only a stored value, so without this a library-supplied label\n\t * could not appear until the editor opened the drawer.\n\t */\n\tselectedMeta?: IconMeta | null\n\tshowTextInput: boolean\n}\n\nexport type IconFieldClientProps = IconFieldClientExtraProps & TextFieldClientProps\n\nexport const IconField: React.FC<IconFieldClientProps> = (props) => {\n\tconst {\n\t\tadapterComponents,\n\t\tadapters,\n\t\tavailable,\n\t\tdefaultLibrary,\n\t\tfield,\n\t\tpath: pathFromProps,\n\t\treadOnly,\n\t\tselectedMeta,\n\t\tshowTextInput,\n\t} = props\n\tconst { i18n, t } = useTranslation()\n\tconst editDepth = useEditDepth()\n\tconst { closeModal, isModalOpen, openModal } = useModal()\n\n\tconst {\n\t\tcustomComponents: { AfterInput, BeforeInput, Description, Error: ErrorComponent, Label } = {},\n\t\tdisabled,\n\t\tpath,\n\t\tsetValue,\n\t\tshowError,\n\t\tvalue,\n\t} = useField<string>({ potentiallyStalePath: pathFromProps })\n\n\tconst drawerSlug = formatDrawerSlug({ slug: `fields-icon-${path}`, depth: editDepth })\n\tconst isDisabled = Boolean(readOnly || disabled || field.admin?.readOnly)\n\tconst styles = useMemo(() => mergeFieldStyles(field), [field])\n\n\tconst resolved = value ? resolveIconValue(value, defaultLibrary) : null\n\tconst registeredSlugs = useMemo(\n\t\t() => new Set(adapters.map((adapter) => adapter.slug)),\n\t\t[adapters]\n\t)\n\tconst isUnavailable =\n\t\tresolved !== null &&\n\t\t(!registeredSlugs.has(resolved.library) || !available.includes(resolved.library))\n\tconst previewEntry = resolved ? adapterComponents[resolved.library] : undefined\n\tconst hasGlyph = Boolean(resolved && previewEntry)\n\n\t// Manifest entries by stored value, seeded with the server's answer for the value\n\t// this field rendered with and extended whenever the editor picks. A pick has to\n\t// relabel the trigger immediately, and the manifest only lives inside the drawer.\n\tconst knownMeta = useRef(new Map<string, IconMeta>())\n\tif (value && selectedMeta && !knownMeta.current.has(value)) {\n\t\tknownMeta.current.set(value, selectedMeta)\n\t}\n\tconst displayLabel = resolved\n\t\t? resolveIconDisplay({\n\t\t\t\tlanguage: i18n.language,\n\t\t\t\tmeta: value ? knownMeta.current.get(value) : undefined,\n\t\t\t\tname: resolved.name,\n\t\t\t}).label\n\t\t: ''\n\n\tconst availableAdapters = useMemo(\n\t\t() => filterAvailableLibraries(adapters, available),\n\t\t[adapters, available]\n\t)\n\tconst [activeLibrary, setActiveLibrary] = useState(() =>\n\t\tpickInitialLibrary({ available, defaultLibrary, selectedLibrary: resolved?.library ?? null })\n\t)\n\n\t// Text-input mode shows the raw `library:name` while focused for editing and the\n\t// formatted label otherwise, so the editor never has to read a colon-prefixed value.\n\tconst [editing, setEditing] = useState(false)\n\n\tconst handleSelect = useCallback(\n\t\t(library: string, icon: IconMeta) => {\n\t\t\tconst next = formatIconValue(library, icon.name)\n\t\t\tknownMeta.current.set(next, icon)\n\t\t\tsetValue(next)\n\t\t\tcloseModal(drawerSlug)\n\t\t},\n\t\t[closeModal, drawerSlug, setValue]\n\t)\n\n\tconst triggerDisabled = isDisabled || availableAdapters.length === 0\n\tconst glyphClass = `tenx-icon-field__glyph${hasGlyph ? '' : ' tenx-icon-field__glyph--empty'}`\n\tconst glyph =\n\t\tresolved && previewEntry ? (\n\t\t\t<previewEntry.Icon name={resolved.name} size={16} />\n\t\t) : (\n\t\t\t<PlaceholderGlyph />\n\t\t)\n\n\tconst wrapperClasses = [\n\t\tfieldBaseClass,\n\t\t'tenx-icon-field',\n\t\tfield.admin?.className,\n\t\tshowError ? 'error' : null,\n\t\tisDisabled ? 'read-only' : null,\n\t]\n\t\t.filter(Boolean)\n\t\t.join(' ')\n\n\tconst controlClasses = [\n\t\t'tenx-icon-field__control',\n\t\t'form-input-group',\n\t\tshowError ? 'form-input-group-error' : null,\n\t\tisUnavailable ? 'tenx-icon-field__control--warning' : null,\n\t]\n\t\t.filter(Boolean)\n\t\t.join(' ')\n\n\treturn (\n\t\t<div className={wrapperClasses} id={`field-${path.replace(/\\./g, '__')}`} style={styles}>\n\t\t\t<RenderCustomComponent\n\t\t\t\tCustomComponent={Label}\n\t\t\t\tFallback={\n\t\t\t\t\t<FieldLabel\n\t\t\t\t\t\tlabel={field.label}\n\t\t\t\t\t\tlocalized={field.localized}\n\t\t\t\t\t\tpath={path}\n\t\t\t\t\t\trequired={field.required}\n\t\t\t\t\t/>\n\t\t\t\t}\n\t\t\t/>\n\t\t\t<div className={`${fieldBaseClass}__wrap`}>\n\t\t\t\t<RenderCustomComponent\n\t\t\t\t\tCustomComponent={ErrorComponent}\n\t\t\t\t\tFallback={<FieldError path={path} showError={showError} />}\n\t\t\t\t/>\n\t\t\t\t{BeforeInput}\n\t\t\t\t<div className={controlClasses}>\n\t\t\t\t\t{showTextInput ? (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<button\n\t\t\t\t\t\t\t\taria-expanded={isModalOpen(drawerSlug)}\n\t\t\t\t\t\t\t\taria-haspopup=\"dialog\"\n\t\t\t\t\t\t\t\taria-label={t(keys.selectIcon)}\n\t\t\t\t\t\t\t\tclassName={glyphClass}\n\t\t\t\t\t\t\t\tdisabled={triggerDisabled}\n\t\t\t\t\t\t\t\tonClick={() => openModal(drawerSlug)}\n\t\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{glyph}\n\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t\t<input\n\t\t\t\t\t\t\t\taria-label={t(keys.fieldIconLabel)}\n\t\t\t\t\t\t\t\tclassName=\"form-input tenx-icon-field__value tenx-icon-field__value--input\"\n\t\t\t\t\t\t\t\tonBlur={() => setEditing(false)}\n\t\t\t\t\t\t\t\tonChange={(event) => setValue(event.target.value || null)}\n\t\t\t\t\t\t\t\tonFocus={() => setEditing(true)}\n\t\t\t\t\t\t\t\tplaceholder={t(keys.textInputPlaceholder)}\n\t\t\t\t\t\t\t\treadOnly={isDisabled}\n\t\t\t\t\t\t\t\ttype=\"text\"\n\t\t\t\t\t\t\t\tvalue={editing ? (value ?? '') : displayLabel}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</>\n\t\t\t\t\t) : (\n\t\t\t\t\t\t<button\n\t\t\t\t\t\t\taria-expanded={isModalOpen(drawerSlug)}\n\t\t\t\t\t\t\taria-haspopup=\"dialog\"\n\t\t\t\t\t\t\tclassName=\"tenx-icon-field__open\"\n\t\t\t\t\t\t\tdisabled={triggerDisabled}\n\t\t\t\t\t\t\tonClick={() => openModal(drawerSlug)}\n\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<span aria-hidden=\"true\" className={glyphClass}>\n\t\t\t\t\t\t\t\t{glyph}\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t<span className=\"tenx-icon-field__value\">\n\t\t\t\t\t\t\t\t{resolved ? (\n\t\t\t\t\t\t\t\t\tdisplayLabel\n\t\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t\t<span className=\"tenx-icon-field__placeholder\">{t(keys.selectIcon)}</span>\n\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t</button>\n\t\t\t\t\t)}\n\t\t\t\t\t{isUnavailable ? (\n\t\t\t\t\t\t<span className=\"tenx-icon-field__marker\" title={t(keys.iconUnavailable)}>\n\t\t\t\t\t\t\t<WarningIcon size={16} />\n\t\t\t\t\t\t\t<span className=\"tenx-icon-field__sr-only\">{t(keys.iconUnavailable)}</span>\n\t\t\t\t\t\t</span>\n\t\t\t\t\t) : null}\n\t\t\t\t\t{value && !field.required && !isDisabled ? (\n\t\t\t\t\t\t<button\n\t\t\t\t\t\t\taria-label={t(keys.clearIcon)}\n\t\t\t\t\t\t\tclassName=\"tenx-icon-field__clear\"\n\t\t\t\t\t\t\tonClick={() => {\n\t\t\t\t\t\t\t\tsetValue(null)\n\t\t\t\t\t\t\t\tsetEditing(false)\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<CircledXIcon size={24} />\n\t\t\t\t\t\t</button>\n\t\t\t\t\t) : null}\n\t\t\t\t</div>\n\t\t\t\t{AfterInput}\n\t\t\t\t<RenderCustomComponent\n\t\t\t\t\tCustomComponent={Description}\n\t\t\t\t\tFallback={<FieldDescription description={field.admin?.description} path={path} />}\n\t\t\t\t/>\n\t\t\t</div>\n\t\t\t<Drawer className=\"tenx-icon-drawer-modal\" slug={drawerSlug} title={t(keys.selectIcon)}>\n\t\t\t\t<Suspense fallback={<div className=\"tenx-icon-drawer__loading\" />}>\n\t\t\t\t\t<IconDrawerContent\n\t\t\t\t\t\tactiveLibrary={activeLibrary}\n\t\t\t\t\t\tadapterComponents={adapterComponents}\n\t\t\t\t\t\tadapters={availableAdapters}\n\t\t\t\t\t\tonLibraryChange={setActiveLibrary}\n\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