@web-portfolio/icons-sanity 3.0.4 → 3.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +36 -8
  2. package/dist/index.js +111 -70
  3. package/package.json +6 -5
package/README.md CHANGED
@@ -56,10 +56,9 @@ you from doing that again:
56
56
  alongside its label, category, and the exact string that got stored — so
57
57
  editors can confirm at a glance they picked the right one.
58
58
  - **Built entirely from Sanity UI.** `Card`, `Dialog`, `Badge`, `Select`,
59
- `TextInput`, `Tooltip` and `@sanity/icons`, sized off the Sanity UI space
60
- scale. It inherits your Studio's theme and light/dark scheme instead of
61
- fighting it, and respects `readOnly` fields and Studio's focus/presence
62
- tracking like a built-in input.
59
+ `TextInput`, sized off the Sanity UI space scale. It inherits your Studio's
60
+ theme and light/dark scheme instead of fighting it, and respects `readOnly`
61
+ fields and Studio's focus/presence tracking like a built-in input.
63
62
 
64
63
  ## Installation
65
64
 
@@ -72,10 +71,11 @@ pnpm add @web-portfolio/icons-sanity
72
71
  ```
73
72
 
74
73
  Peer dependencies:
75
- `sanity >=3`, `@sanity/ui >=2`, `@sanity/icons >=3`, `react >=18`,
76
- `styled-components >=6` (already present in any standard Sanity Studio v3
77
- project), plus `@web-portfolio/icons >=1.0.1`, which renders the icons this
78
- plugin picks — install it if your Studio doesn't already have it.
74
+ `sanity >=3`, `@sanity/ui >=2`, `react >=18`, `styled-components >=6`
75
+ (already present in any standard Sanity Studio project — this plugin is
76
+ tested against every Studio major from v3 through the current v6), plus
77
+ `@web-portfolio/icons >=1.0.1`, which renders the icons this plugin picks —
78
+ install it if your Studio doesn't already have it.
79
79
 
80
80
  ## Setup
81
81
 
@@ -231,6 +231,34 @@ schema.
231
231
 
232
232
  ## Changelog
233
233
 
234
+ **v3.1.0 — Sanity Studio v6 compatibility**
235
+ - **`@sanity/icons` is no longer a dependency.** It dropped its root barrel
236
+ export in v5.0.0 — `import {ImageIcon} from '@sanity/icons'` stopped
237
+ resolving — and Sanity Studio v6 (the current major) already installs
238
+ `@sanity/icons` ^5.2 for itself, so this plugin would fail to load in any
239
+ new v6 Studio. Its four UI-chrome icons (search, trash, warning, the "no
240
+ icon" placeholder) are now inlined instead — visually identical, zero
241
+ version dependency.
242
+ - **Fixed layout on `@sanity/ui` v4.** `Stack`'s `space` prop and `Grid`'s
243
+ `columns` prop were both removed there (in favor of `gap` and
244
+ `gridTemplateColumns`) — silently, with no error, just missing spacing and
245
+ a non-responsive icon grid. Both are replaced with plain CSS (`gap` via a
246
+ specificity override, a `minmax()`-based grid) that doesn't depend on which
247
+ major is installed.
248
+ - **`Tooltip` is no longer imported from `@sanity/ui`.** It moved to the
249
+ `@sanity/ui/tooltip` subpath in v4 — a subpath that doesn't exist in v2/v3
250
+ — so importing it from the root, as this plugin used to, resolves to
251
+ `undefined` on v4 and crashes the results grid the moment it renders. The
252
+ per-tile tooltip (showing an icon's raw registry name on hover) is now a
253
+ native `title` attribute instead; `aria-label` already carried the same
254
+ information for assistive tech.
255
+ - Verified against real installs of every Studio major still actively
256
+ maintained — v3, v4, v5, and v6 — not just against the changelogs above.
257
+ v6 in particular installs `@sanity/ui` 4.0.7 and `sanity` itself pulls in
258
+ React 19.2 and `@sanity/icons` 5.2, the exact combination the fixes above
259
+ target; the full test suite passes against that real combination, not just
260
+ this package's own (older) pinned dev dependencies.
261
+
234
262
  **Icon picker: grid fixes + reliable auto-focus**
235
263
  - **Fixed overlap:** grid tiles' icon row was sized off an unrelated Sanity UI
236
264
  theme token, which was shorter than the icon itself — the glyph visually
package/dist/index.js CHANGED
@@ -1,11 +1,38 @@
1
1
  import { definePlugin, defineType, set, unset } from "sanity";
2
- import { useCallback, useEffect, useMemo, useRef, useState } from "react";
3
- import { Badge, Box, Button, Card, Dialog, Flex, Grid, Select, Stack, Text, TextInput, Tooltip, rem } from "@sanity/ui";
4
- import { ImageIcon, SearchIcon, TrashIcon, WarningOutlineIcon } from "@sanity/icons";
2
+ import { forwardRef, useCallback, useEffect, useMemo, useRef, useState } from "react";
3
+ import { Badge, Box, Button, Card, Dialog, Flex, Grid, Select, Stack, Text, TextInput, rem } from "@sanity/ui";
4
+ import { jsx, jsxs } from "react/jsx-runtime";
5
5
  import { styled } from "styled-components";
6
6
  import { Icon } from "@web-portfolio/icons";
7
- import { jsx, jsxs } from "react/jsx-runtime";
8
- const metadata = {
7
+ /**
8
+ * Inlined rather than imported from `@sanity/icons`. That package dropped its
9
+ * root barrel export in v5 — `import {ImageIcon} from '@sanity/icons'` stops
10
+ * resolving entirely — and Sanity Studio v6 already pulls `@sanity/icons`
11
+ * ^5.2 as its own dependency, so any Studio on the current major would fail
12
+ * to load this plugin. These four are visually identical to their
13
+ * `@sanity/icons` counterparts (same viewBox, path data and stroke), just
14
+ * copied in so this plugin has no dependency on which major is installed.
15
+ */
16
+ function iconPath(d) {
17
+ return forwardRef(function IconSvg(props, ref) {
18
+ return /* @__PURE__ */ jsx("svg", {
19
+ width: "1em",
20
+ height: "1em",
21
+ viewBox: "0 0 25 25",
22
+ fill: "none",
23
+ xmlns: "http://www.w3.org/2000/svg",
24
+ ...props,
25
+ ref,
26
+ children: /* @__PURE__ */ jsx("path", {
27
+ d,
28
+ stroke: "currentColor",
29
+ strokeWidth: 1.2,
30
+ strokeLinejoin: "round"
31
+ })
32
+ });
33
+ });
34
+ }
35
+ const ImageIcon = iconPath("M5.5 15.5L8.79289 12.2071C9.18342 11.8166 9.81658 11.8166 10.2071 12.2071L12.8867 14.8867C13.2386 15.2386 13.7957 15.2782 14.1938 14.9796L15.1192 14.2856C15.3601 14.1049 15.6696 14.0424 15.9618 14.1154L19.5 15M5.5 6.5H19.5V18.5H5.5V6.5ZM15.5 10.5C15.5 11.0523 15.0523 11.5 14.5 11.5C13.9477 11.5 13.5 11.0523 13.5 10.5C13.5 9.94772 13.9477 9.5 14.5 9.5C15.0523 9.5 15.5 9.94772 15.5 10.5Z"), SearchIcon = iconPath("M15.0355 15.0355L20 20M16.5 11.5C16.5 14.2614 14.2614 16.5 11.5 16.5C8.73858 16.5 6.5 14.2614 6.5 11.5C6.5 8.73858 8.73858 6.5 11.5 6.5C14.2614 6.5 16.5 8.73858 16.5 11.5Z"), TrashIcon = iconPath("M5 6.5H20M10 6.5V4.5C10 3.94772 10.4477 3.5 11 3.5H14C14.5523 3.5 15 3.94772 15 4.5V6.5M12.5 9V17M15.5 9L15 17M9.5 9L10 17M18.5 6.5L17.571 18.5767C17.5309 19.0977 17.0965 19.5 16.574 19.5H8.42603C7.90349 19.5 7.46905 19.0977 7.42898 18.5767L6.5 6.5H18.5Z"), WarningOutlineIcon = iconPath("M12.5 9V13M12.5 16V14.5M14.2239 5.43058L20.727 16.486C21.5113 17.8192 20.55 19.5 19.0032 19.5H5.99683C4.45 19.5 3.48869 17.8192 4.27297 16.486L10.7761 5.43058C11.5494 4.11596 13.4506 4.11596 14.2239 5.43058Z"), metadata = {
9
36
  aarch64: {
10
37
  label: "Aarch64",
11
38
  tags: [
@@ -4822,6 +4849,30 @@ const metadata = {
4822
4849
  ],
4823
4850
  category: "original"
4824
4851
  },
4852
+ "verdict-check": {
4853
+ label: "Verdict Check",
4854
+ tags: [
4855
+ "check",
4856
+ "checkmark",
4857
+ "yes",
4858
+ "verdict",
4859
+ "tick",
4860
+ "comparison"
4861
+ ],
4862
+ category: "original"
4863
+ },
4864
+ "verdict-cross": {
4865
+ label: "Verdict Cross",
4866
+ tags: [
4867
+ "cross",
4868
+ "close",
4869
+ "no",
4870
+ "verdict",
4871
+ "x",
4872
+ "comparison"
4873
+ ],
4874
+ category: "original"
4875
+ },
4825
4876
  vertx: {
4826
4877
  label: "Vertx",
4827
4878
  tags: [
@@ -5194,22 +5245,28 @@ const metadata = {
5194
5245
  }
5195
5246
  }, PreviewFrame = styled(Card).withConfig({
5196
5247
  displayName: "PreviewFrame",
5197
- componentId: "sc-s8zqt7-0"
5248
+ componentId: "sc-7yumqh-0"
5198
5249
  })`flex-shrink:0;width:${({ theme }) => rem(28 + theme.sanity.space[3] * 2)};height:${({ theme }) => rem(28 + theme.sanity.space[3] * 2)};`, ResultsScroller = styled(Box).withConfig({
5199
5250
  displayName: "ResultsScroller",
5200
- componentId: "sc-s8zqt7-1"
5201
- })`max-height:${rem(400)};overflow-y:auto;overscroll-behavior:contain;`, IconTile = styled(Card).withConfig({
5251
+ componentId: "sc-7yumqh-1"
5252
+ })`max-height:${rem(400)};overflow-y:auto;overscroll-behavior:contain;`, VStack = styled(Stack).withConfig({
5253
+ displayName: "VStack",
5254
+ componentId: "sc-7yumqh-2"
5255
+ })`&&{gap:${({ theme, $space }) => rem(theme.sanity.space[$space])};}`, ResultsGrid = styled(Grid).withConfig({
5256
+ displayName: "ResultsGrid",
5257
+ componentId: "sc-7yumqh-3"
5258
+ })`grid-template-columns:repeat(auto-fill,minmax(${rem(88)},1fr));`, IconTile = styled(Card).withConfig({
5202
5259
  displayName: "IconTile",
5203
- componentId: "sc-s8zqt7-2"
5260
+ componentId: "sc-7yumqh-4"
5204
5261
  })`&&[data-as='button']{cursor:pointer;border:1px solid var(--card-border-color);min-width:0;overflow:hidden;}`, GlyphRow = styled(Flex).withConfig({
5205
5262
  displayName: "GlyphRow",
5206
- componentId: "sc-s8zqt7-3"
5263
+ componentId: "sc-7yumqh-5"
5207
5264
  })`height:${rem(37)};`, LabelRow = styled(Box).withConfig({
5208
5265
  displayName: "LabelRow",
5209
- componentId: "sc-s8zqt7-4"
5266
+ componentId: "sc-7yumqh-6"
5210
5267
  })`min-height:${rem(20)};`, CategorySelectBox = styled(Box).withConfig({
5211
5268
  displayName: "CategorySelectBox",
5212
- componentId: "sc-s8zqt7-5"
5269
+ componentId: "sc-7yumqh-7"
5213
5270
  })`width:${rem(180)};`;
5214
5271
  function matchesQuery(name, entry, query) {
5215
5272
  if (!query.trim()) return !0;
@@ -5282,8 +5339,8 @@ function IconPickerInput(props) {
5282
5339
  ref: elementProps?.ref,
5283
5340
  "aria-describedby": elementProps?.["aria-describedby"]
5284
5341
  };
5285
- return /* @__PURE__ */ jsxs(Stack, {
5286
- space: 3,
5342
+ return /* @__PURE__ */ jsxs(VStack, {
5343
+ $space: 3,
5287
5344
  children: [
5288
5345
  /* @__PURE__ */ jsxs(Flex, {
5289
5346
  align: "center",
@@ -5309,11 +5366,11 @@ function IconPickerInput(props) {
5309
5366
  children: jsx(hasUnknownValue ? WarningOutlineIcon : ImageIcon, {})
5310
5367
  })
5311
5368
  })
5312
- }), /* @__PURE__ */ jsxs(Stack, {
5313
- space: 3,
5369
+ }), /* @__PURE__ */ jsxs(VStack, {
5370
+ $space: 3,
5314
5371
  flex: 1,
5315
- children: [/* @__PURE__ */ jsxs(Stack, {
5316
- space: 2,
5372
+ children: [/* @__PURE__ */ jsxs(VStack, {
5373
+ $space: 2,
5317
5374
  children: [/* @__PURE__ */ jsxs(Flex, {
5318
5375
  align: "center",
5319
5376
  gap: 2,
@@ -5390,8 +5447,8 @@ function IconPickerInput(props) {
5390
5447
  }),
5391
5448
  children: /* @__PURE__ */ jsx(Box, {
5392
5449
  padding: 4,
5393
- children: /* @__PURE__ */ jsxs(Stack, {
5394
- space: 4,
5450
+ children: /* @__PURE__ */ jsxs(VStack, {
5451
+ $space: 4,
5395
5452
  children: [/* @__PURE__ */ jsxs(Flex, {
5396
5453
  gap: 2,
5397
5454
  children: [/* @__PURE__ */ jsx(Box, {
@@ -5424,8 +5481,8 @@ function IconPickerInput(props) {
5424
5481
  padding: 5,
5425
5482
  radius: 2,
5426
5483
  tone: "transparent",
5427
- children: /* @__PURE__ */ jsxs(Stack, {
5428
- space: 3,
5484
+ children: /* @__PURE__ */ jsxs(VStack, {
5485
+ $space: 3,
5429
5486
  children: [/* @__PURE__ */ jsx(Text, {
5430
5487
  align: "center",
5431
5488
  size: 1,
@@ -5438,57 +5495,41 @@ function IconPickerInput(props) {
5438
5495
  children: "Try a shorter term, or reset the category filter."
5439
5496
  })]
5440
5497
  })
5441
- }) : /* @__PURE__ */ jsx(ResultsScroller, { children: /* @__PURE__ */ jsxs(Stack, {
5442
- space: 3,
5443
- children: [/* @__PURE__ */ jsx(Grid, {
5444
- columns: [
5445
- 3,
5446
- 4,
5447
- 6
5448
- ],
5498
+ }) : /* @__PURE__ */ jsx(ResultsScroller, { children: /* @__PURE__ */ jsxs(VStack, {
5499
+ $space: 3,
5500
+ children: [/* @__PURE__ */ jsx(ResultsGrid, {
5449
5501
  gap: 2,
5450
5502
  children: visible.map((name) => {
5451
5503
  let entry = metadata[name], isSelected = name === value;
5452
- return /* @__PURE__ */ jsx(Tooltip, {
5453
- content: /* @__PURE__ */ jsx(Box, {
5454
- padding: 2,
5455
- children: /* @__PURE__ */ jsx(Text, {
5456
- size: 1,
5457
- children: name
5458
- })
5459
- }),
5460
- placement: "top",
5461
- delay: { open: 400 },
5462
- portal: !0,
5463
- children: /* @__PURE__ */ jsx(IconTile, {
5464
- forwardedAs: "button",
5465
- type: "button",
5466
- padding: 3,
5467
- radius: 2,
5468
- border: !0,
5469
- tone: isSelected ? "primary" : "default",
5470
- pressed: isSelected,
5471
- __unstable_focusRing: !0,
5472
- "aria-pressed": isSelected,
5473
- "aria-label": `${entry.label} (${name})`,
5474
- onClick: () => handleSelect(name),
5475
- children: /* @__PURE__ */ jsxs(Stack, {
5476
- space: 2,
5477
- children: [/* @__PURE__ */ jsx(GlyphRow, {
5478
- align: "center",
5479
- justify: "center",
5480
- children: /* @__PURE__ */ jsx(Icon, {
5481
- name,
5482
- size: 29
5483
- })
5484
- }), /* @__PURE__ */ jsx(LabelRow, { children: /* @__PURE__ */ jsx(Text, {
5485
- size: 0,
5486
- align: "center",
5487
- muted: !0,
5488
- textOverflow: "ellipsis",
5489
- children: entry.label
5490
- }) })]
5491
- })
5504
+ return /* @__PURE__ */ jsx(IconTile, {
5505
+ forwardedAs: "button",
5506
+ type: "button",
5507
+ padding: 3,
5508
+ radius: 2,
5509
+ border: !0,
5510
+ tone: isSelected ? "primary" : "default",
5511
+ pressed: isSelected,
5512
+ __unstable_focusRing: !0,
5513
+ title: name,
5514
+ "aria-pressed": isSelected,
5515
+ "aria-label": `${entry.label} (${name})`,
5516
+ onClick: () => handleSelect(name),
5517
+ children: /* @__PURE__ */ jsxs(VStack, {
5518
+ $space: 2,
5519
+ children: [/* @__PURE__ */ jsx(GlyphRow, {
5520
+ align: "center",
5521
+ justify: "center",
5522
+ children: /* @__PURE__ */ jsx(Icon, {
5523
+ name,
5524
+ size: 29
5525
+ })
5526
+ }), /* @__PURE__ */ jsx(LabelRow, { children: /* @__PURE__ */ jsx(Text, {
5527
+ size: 0,
5528
+ align: "center",
5529
+ muted: !0,
5530
+ textOverflow: "ellipsis",
5531
+ children: entry.label
5532
+ }) })]
5492
5533
  })
5493
5534
  }, name);
5494
5535
  })
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@web-portfolio/icons-sanity",
3
- "version": "3.0.4",
4
- "description": "Sanity Studio icon picker input, backed by the same bundled registry as @web-portfolio/icons.",
3
+ "version": "3.1.0",
4
+ "description": "Sanity Studio icon picker field with 633 bundled SVG icons — search by name, label, or tag, no SVG markup required.",
5
5
  "license": "MIT",
6
6
  "keywords": [
7
7
  "sanity",
@@ -11,7 +11,10 @@
11
11
  "icons",
12
12
  "cms",
13
13
  "custom input",
14
- "sanity field"
14
+ "sanity field",
15
+ "sanity-studio",
16
+ "svg-icons",
17
+ "schema-type"
15
18
  ],
16
19
  "homepage": "https://github.com/jatinrao/icons#readme",
17
20
  "bugs": {
@@ -52,7 +55,6 @@
52
55
  "link-watch": "plugin-kit link-watch"
53
56
  },
54
57
  "peerDependencies": {
55
- "@sanity/icons": ">=3",
56
58
  "@sanity/ui": ">=2",
57
59
  "@web-portfolio/icons": ">=1.0.1",
58
60
  "react": ">=18",
@@ -61,7 +63,6 @@
61
63
  },
62
64
  "devDependencies": {
63
65
  "@sanity/browserslist-config": "^1.0.5",
64
- "@sanity/icons": "^3.8.0",
65
66
  "@sanity/pkg-utils": "^12.3.2",
66
67
  "@sanity/plugin-kit": "^10.0.8",
67
68
  "@sanity/ui": "^2.10.0",