@uniformdev/design-system 20.54.1-alpha.1 → 20.55.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/esm/index.js CHANGED
@@ -11257,21 +11257,16 @@ var LabelsQuickFilter = ({
11257
11257
  const filteredItems = useMemo6(() => {
11258
11258
  const searchLower = searchTerm.toLowerCase().trim();
11259
11259
  const matchesSearch = (item) => item.name.toLowerCase().includes(searchLower);
11260
- if (!searchTerm) {
11261
- return items;
11262
- }
11263
- const groupsWithMatchingChildren = new Set(
11264
- items.filter((item) => item.parent && matchesSearch(item)).map((item) => item.parent)
11265
- );
11266
- return items.filter((item) => {
11260
+ const filtered = !searchTerm ? [...items] : items.filter((item) => {
11267
11261
  if (matchesSearch(item)) {
11268
11262
  return true;
11269
11263
  }
11270
- if (item.isGroup && groupsWithMatchingChildren.has(item.id)) {
11264
+ if (item.isGroup && items.some((child) => child.parent === item.id && matchesSearch(child))) {
11271
11265
  return true;
11272
11266
  }
11273
11267
  return false;
11274
11268
  });
11269
+ return filtered.sort((a, b) => a.name.localeCompare(b.name));
11275
11270
  }, [items, searchTerm]);
11276
11271
  const handleToggle = (item) => {
11277
11272
  if (selectedIdsSet.has(item.id)) {
@@ -11300,6 +11295,7 @@ var LabelsQuickFilter = ({
11300
11295
  };
11301
11296
  const renderGroupItem = (group) => {
11302
11297
  const childItems = filteredItems.filter((item) => item.parent === group.id);
11298
+ const totalChildResults = childItems.length;
11303
11299
  if (childItems.length === 0) {
11304
11300
  return null;
11305
11301
  }
@@ -11349,24 +11345,42 @@ var LabelsQuickFilter = ({
11349
11345
  /* @__PURE__ */ jsx99(Icon, { icon: TbChevronRight2, iconColor: "currentColor", size: "1rem" })
11350
11346
  ] }),
11351
11347
  withoutPortal,
11352
- children: childItems.map((item) => {
11353
- var _a;
11354
- const isChildSelected = selectedIdsSet.has(item.id);
11355
- return /* @__PURE__ */ jsxs65(
11356
- SelectableMenuItem,
11357
- {
11358
- selectStyles: "checkbox-select",
11359
- hideOnClick: false,
11360
- onClick: () => handleToggle(item),
11361
- selected: isChildSelected,
11362
- children: [
11363
- /* @__PURE__ */ jsx99(Swatch, { variant: (_a = item.variant) != null ? _a : "swatch-default", size: "small" }),
11364
- /* @__PURE__ */ jsx99("span", { children: item.name })
11365
- ]
11366
- },
11367
- item.id
11368
- );
11369
- })
11348
+ children: /* @__PURE__ */ jsx99(
11349
+ VerticalRhythm,
11350
+ {
11351
+ gap: "0",
11352
+ css: (
11353
+ // if there are more than 5 child results, add a scrollbar
11354
+ // we do this because the user could potentially have a lot of child results
11355
+ // and this breaks the UI if the menu is too tall
11356
+ totalChildResults > 5 ? [
11357
+ scrollbarStyles,
11358
+ {
11359
+ maxHeight: "320px",
11360
+ overflowY: "auto"
11361
+ }
11362
+ ] : void 0
11363
+ ),
11364
+ children: childItems.map((item) => {
11365
+ var _a;
11366
+ const isChildSelected = selectedIdsSet.has(item.id);
11367
+ return /* @__PURE__ */ jsxs65(
11368
+ SelectableMenuItem,
11369
+ {
11370
+ selectStyles: "checkbox-select",
11371
+ hideOnClick: false,
11372
+ onClick: () => handleToggle(item),
11373
+ selected: isChildSelected,
11374
+ children: [
11375
+ /* @__PURE__ */ jsx99(Swatch, { variant: (_a = item.variant) != null ? _a : "swatch-default", size: "small" }),
11376
+ /* @__PURE__ */ jsx99("span", { children: item.name })
11377
+ ]
11378
+ },
11379
+ item.id
11380
+ );
11381
+ })
11382
+ }
11383
+ )
11370
11384
  },
11371
11385
  group.id
11372
11386
  );
package/dist/index.js CHANGED
@@ -13154,21 +13154,16 @@ var LabelsQuickFilter = ({
13154
13154
  const filteredItems = (0, import_react120.useMemo)(() => {
13155
13155
  const searchLower = searchTerm.toLowerCase().trim();
13156
13156
  const matchesSearch = (item) => item.name.toLowerCase().includes(searchLower);
13157
- if (!searchTerm) {
13158
- return items;
13159
- }
13160
- const groupsWithMatchingChildren = new Set(
13161
- items.filter((item) => item.parent && matchesSearch(item)).map((item) => item.parent)
13162
- );
13163
- return items.filter((item) => {
13157
+ const filtered = !searchTerm ? [...items] : items.filter((item) => {
13164
13158
  if (matchesSearch(item)) {
13165
13159
  return true;
13166
13160
  }
13167
- if (item.isGroup && groupsWithMatchingChildren.has(item.id)) {
13161
+ if (item.isGroup && items.some((child) => child.parent === item.id && matchesSearch(child))) {
13168
13162
  return true;
13169
13163
  }
13170
13164
  return false;
13171
13165
  });
13166
+ return filtered.sort((a, b) => a.name.localeCompare(b.name));
13172
13167
  }, [items, searchTerm]);
13173
13168
  const handleToggle = (item) => {
13174
13169
  if (selectedIdsSet.has(item.id)) {
@@ -13197,6 +13192,7 @@ var LabelsQuickFilter = ({
13197
13192
  };
13198
13193
  const renderGroupItem = (group) => {
13199
13194
  const childItems = filteredItems.filter((item) => item.parent === group.id);
13195
+ const totalChildResults = childItems.length;
13200
13196
  if (childItems.length === 0) {
13201
13197
  return null;
13202
13198
  }
@@ -13246,24 +13242,42 @@ var LabelsQuickFilter = ({
13246
13242
  /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(Icon, { icon: import_TbChevronRight2.TbChevronRight, iconColor: "currentColor", size: "1rem" })
13247
13243
  ] }),
13248
13244
  withoutPortal,
13249
- children: childItems.map((item) => {
13250
- var _a;
13251
- const isChildSelected = selectedIdsSet.has(item.id);
13252
- return /* @__PURE__ */ (0, import_jsx_runtime99.jsxs)(
13253
- SelectableMenuItem,
13254
- {
13255
- selectStyles: "checkbox-select",
13256
- hideOnClick: false,
13257
- onClick: () => handleToggle(item),
13258
- selected: isChildSelected,
13259
- children: [
13260
- /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(Swatch, { variant: (_a = item.variant) != null ? _a : "swatch-default", size: "small" }),
13261
- /* @__PURE__ */ (0, import_jsx_runtime99.jsx)("span", { children: item.name })
13262
- ]
13263
- },
13264
- item.id
13265
- );
13266
- })
13245
+ children: /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(
13246
+ VerticalRhythm,
13247
+ {
13248
+ gap: "0",
13249
+ css: (
13250
+ // if there are more than 5 child results, add a scrollbar
13251
+ // we do this because the user could potentially have a lot of child results
13252
+ // and this breaks the UI if the menu is too tall
13253
+ totalChildResults > 5 ? [
13254
+ scrollbarStyles,
13255
+ {
13256
+ maxHeight: "320px",
13257
+ overflowY: "auto"
13258
+ }
13259
+ ] : void 0
13260
+ ),
13261
+ children: childItems.map((item) => {
13262
+ var _a;
13263
+ const isChildSelected = selectedIdsSet.has(item.id);
13264
+ return /* @__PURE__ */ (0, import_jsx_runtime99.jsxs)(
13265
+ SelectableMenuItem,
13266
+ {
13267
+ selectStyles: "checkbox-select",
13268
+ hideOnClick: false,
13269
+ onClick: () => handleToggle(item),
13270
+ selected: isChildSelected,
13271
+ children: [
13272
+ /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(Swatch, { variant: (_a = item.variant) != null ? _a : "swatch-default", size: "small" }),
13273
+ /* @__PURE__ */ (0, import_jsx_runtime99.jsx)("span", { children: item.name })
13274
+ ]
13275
+ },
13276
+ item.id
13277
+ );
13278
+ })
13279
+ }
13280
+ )
13267
13281
  },
13268
13282
  group.id
13269
13283
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uniformdev/design-system",
3
- "version": "20.54.1-alpha.1+028680cba4",
3
+ "version": "20.55.1",
4
4
  "description": "Uniform design system components",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "exports": {
@@ -35,8 +35,8 @@
35
35
  "@storybook/react-vite": "10.1.0",
36
36
  "@types/react": "19.2.2",
37
37
  "@types/react-dom": "19.2.2",
38
- "@uniformdev/canvas": "^20.54.1-alpha.1+028680cba4",
39
- "@uniformdev/richtext": "^20.54.1-alpha.1+028680cba4",
38
+ "@uniformdev/canvas": "^20.55.1",
39
+ "@uniformdev/richtext": "^20.55.1",
40
40
  "autoprefixer": "10.4.21",
41
41
  "hygen": "6.2.11",
42
42
  "jsdom": "20.0.3",
@@ -88,5 +88,5 @@
88
88
  "publishConfig": {
89
89
  "access": "public"
90
90
  },
91
- "gitHead": "028680cba478a17da934cdb2ddebb777e2553455"
91
+ "gitHead": "44d778abd699dafbabda982cb3295be043ba3cb0"
92
92
  }