unifyedx-storybook-new 0.1.30 → 0.1.31

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.
@@ -1096,11 +1096,6 @@
1096
1096
  box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);
1097
1097
  }
1098
1098
 
1099
- .ring-2 {
1100
- --tw-ring-shadow: var(--tw-ring-inset, ) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color, currentcolor);
1101
- box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);
1102
- }
1103
-
1104
1099
  .ring-black {
1105
1100
  --tw-ring-color: var(--color-black);
1106
1101
  }
@@ -1109,10 +1104,6 @@
1109
1104
  --tw-ring-color: var(--gray300);
1110
1105
  }
1111
1106
 
1112
- .ring-indigo-600 {
1113
- --tw-ring-color: var(--color-indigo-600);
1114
- }
1115
-
1116
1107
  .ring-red-500 {
1117
1108
  --tw-ring-color: var(--color-red-500);
1118
1109
  }
@@ -1191,11 +1182,6 @@
1191
1182
  transition-timing-function: var(--ease-out);
1192
1183
  }
1193
1184
 
1194
- .outline-none {
1195
- --tw-outline-style: none;
1196
- outline-style: none;
1197
- }
1198
-
1199
1185
  .select-none {
1200
1186
  -webkit-user-select: none;
1201
1187
  user-select: none;
@@ -1279,6 +1265,10 @@
1279
1265
  --tw-ring-color: var(--color-blue-500);
1280
1266
  }
1281
1267
 
1268
+ .focus\:ring-indigo-600:focus {
1269
+ --tw-ring-color: var(--color-indigo-600);
1270
+ }
1271
+
1282
1272
  .focus\:ring-offset-2:focus {
1283
1273
  --tw-ring-offset-width: 2px;
1284
1274
  --tw-ring-offset-shadow: var(--tw-ring-inset, ) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);
@@ -1311,6 +1301,11 @@
1311
1301
  font-size: var(--text-sm);
1312
1302
  line-height: var(--tw-leading, var(--text-sm--line-height));
1313
1303
  }
1304
+
1305
+ .sm\:leading-6 {
1306
+ --tw-leading: calc(var(--spacing) * 6);
1307
+ line-height: calc(var(--spacing) * 6);
1308
+ }
1314
1309
  }
1315
1310
  }
1316
1311
 
@@ -70328,7 +70328,6 @@ const AddUserGroupsRolesModal = ({
70328
70328
  function classNames(...classes) {
70329
70329
  return classes.filter(Boolean).join(" ");
70330
70330
  }
70331
- const toId = (v) => String(v);
70332
70331
  function MultiSelect({
70333
70332
  label,
70334
70333
  options = [],
@@ -70340,61 +70339,74 @@ function MultiSelect({
70340
70339
  placeholder = "Select options",
70341
70340
  error = null,
70342
70341
  displayLimit = 3,
70343
- // New prop
70344
- selectionLimit = -1
70345
- // New prop
70342
+ selectionLimit = -1,
70343
+ // NEW: search behavior
70344
+ searchMode = "client",
70345
+ // "client" | "server"
70346
+ onSearch,
70347
+ // (query: string) => void (required if searchMode==="server")
70348
+ serverLoading = false,
70349
+ minSearchChars = 2,
70350
+ // NEW: mappers (id/label keys)
70351
+ getOptionId = (o) => String(o.id),
70352
+ getOptionLabel = (o) => o.name
70346
70353
  }) {
70347
70354
  const labelId = useId$1();
70348
70355
  const errorId = useId$1();
70349
70356
  const [searchQuery, setSearchQuery] = useState("");
70357
+ const lastFiredQueryRef = useRef("");
70350
70358
  const optionsById = useMemo(() => {
70351
70359
  const m = /* @__PURE__ */ new Map();
70352
- for (const o of options) m.set(toId(o.id), o);
70360
+ for (const o of options) m.set(getOptionId(o), o);
70353
70361
  return m;
70354
- }, [options]);
70362
+ }, [options, getOptionId]);
70355
70363
  const selectedObjs = useMemo(() => {
70356
70364
  if (!Array.isArray(selected)) return [];
70357
70365
  return selected.map((v) => {
70358
- if (v && typeof v === "object") return optionsById.get(toId(v.id)) || null;
70359
- return optionsById.get(toId(v));
70366
+ if (v && typeof v === "object") {
70367
+ return optionsById.get(getOptionId(v)) || null;
70368
+ }
70369
+ return optionsById.get(String(v));
70360
70370
  }).filter(Boolean);
70361
- }, [selected, optionsById]);
70362
- const filteredOptions = useMemo(() => {
70363
- if (!searchQuery) {
70364
- return options;
70371
+ }, [selected, optionsById, getOptionId]);
70372
+ const clientFiltered = useMemo(() => {
70373
+ if (!searchQuery) return options;
70374
+ const q = searchQuery.toLowerCase();
70375
+ return options.filter((o) => getOptionLabel(o).toLowerCase().includes(q));
70376
+ }, [options, searchQuery, getOptionLabel]);
70377
+ useEffect(() => {
70378
+ if (searchMode !== "server") return;
70379
+ if (searchQuery.length >= minSearchChars && searchQuery !== lastFiredQueryRef.current) {
70380
+ lastFiredQueryRef.current = searchQuery;
70381
+ onSearch && onSearch(searchQuery);
70365
70382
  }
70366
- const lowerCaseQuery = searchQuery.toLowerCase();
70367
- return options.filter(
70368
- (option) => option.name.toLowerCase().includes(lowerCaseQuery)
70369
- );
70370
- }, [options, searchQuery]);
70383
+ }, [searchQuery, searchMode, minSearchChars, onSearch]);
70384
+ const filteredOptions = searchMode === "client" ? clientFiltered : options;
70371
70385
  const displayValue = () => {
70372
70386
  if (!selectedObjs.length) {
70373
- return /* @__PURE__ */ jsx("span", { className: " text-gray-500", children: placeholder });
70387
+ return /* @__PURE__ */ jsx("span", { className: "text-gray-500", children: placeholder });
70374
70388
  }
70375
70389
  const displayedChips = selectedObjs.slice(0, displayLimit);
70376
- const remainingCount = selectedObjs.length - displayLimit;
70377
- return /* @__PURE__ */ jsxs("div", { className: " flex flex-wrap gap-2", children: [
70390
+ const remaining = selectedObjs.length - displayLimit;
70391
+ return /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap gap-2", children: [
70378
70392
  displayedChips.map((o) => /* @__PURE__ */ jsx(
70379
70393
  "span",
70380
70394
  {
70381
- className: " px-2 py-1 text-xs font-medium text-blue-800 bg-blue-100 rounded-full",
70382
- children: o.name
70395
+ className: "px-2 py-1 text-xs font-medium text-blue-800 bg-blue-100 rounded-full",
70396
+ children: getOptionLabel(o)
70383
70397
  },
70384
- toId(o.id)
70398
+ getOptionId(o)
70385
70399
  )),
70386
- remainingCount > 0 && /* @__PURE__ */ jsxs("span", { className: " px-2 py-1 text-xs font-medium text-gray-600 bg-gray-200 rounded-full", children: [
70400
+ remaining > 0 && /* @__PURE__ */ jsxs("span", { className: "px-2 py-1 text-xs font-medium text-gray-600 bg-gray-200 rounded-full", children: [
70387
70401
  "+",
70388
- remainingCount,
70402
+ remaining,
70389
70403
  " more"
70390
70404
  ] })
70391
70405
  ] });
70392
70406
  };
70393
70407
  const handleChange = (nextObjs) => {
70394
- const ids = Array.from(new Set(nextObjs.map((o) => toId(o.id))));
70395
- if (selectionLimit !== -1 && ids.length > selectionLimit) {
70396
- return;
70397
- }
70408
+ const ids = Array.from(new Set(nextObjs.map((o) => getOptionId(o))));
70409
+ if (selectionLimit !== -1 && ids.length > selectionLimit) return;
70398
70410
  onChange(ids);
70399
70411
  };
70400
70412
  return /* @__PURE__ */ jsx(Listbox, { value: selectedObjs, onChange: handleChange, multiple: true, by: "id", children: ({ open }) => /* @__PURE__ */ jsxs("div", { children: [
@@ -70402,11 +70414,11 @@ function MultiSelect({
70402
70414
  Listbox.Label,
70403
70415
  {
70404
70416
  id: labelId,
70405
- className: " block text-sm font-medium leading-6 text-gray-900",
70417
+ className: "block text-sm font-medium leading-6 text-gray-900",
70406
70418
  children: label
70407
70419
  }
70408
70420
  ),
70409
- /* @__PURE__ */ jsxs("div", { className: " relative mt-2", children: [
70421
+ /* @__PURE__ */ jsxs("div", { className: "relative mt-2", children: [
70410
70422
  /* @__PURE__ */ jsxs(
70411
70423
  Listbox.Button,
70412
70424
  {
@@ -70415,12 +70427,12 @@ function MultiSelect({
70415
70427
  "aria-describedby": error ? errorId : void 0,
70416
70428
  onBlur,
70417
70429
  className: classNames(
70418
- " relative w-full min-h-[38px] cursor-default rounded-md bg-white py-1.5 pl-3 pr-10 text-left text-gray-900 shadow-sm ring-1 ring-inset focus: outline-none focus: ring-2 focus: ring-indigo-600 sm: text-sm sm: leading-6",
70419
- error ? " ring-red-500" : " ring-gray-300"
70430
+ "relative w-full min-h-[38px] cursor-default rounded-md bg-white py-1.5 pl-3 pr-10 text-left text-gray-900 shadow-sm ring-1 ring-inset focus:outline-none focus:ring-2 focus:ring-indigo-600 sm:text-sm sm:leading-6",
70431
+ error ? "ring-red-500" : "ring-gray-300"
70420
70432
  ),
70421
70433
  children: [
70422
- /* @__PURE__ */ jsx("span", { className: " block truncate", children: displayValue() }),
70423
- /* @__PURE__ */ jsx("span", { className: " absolute inset-y-0 right-0 flex items-center pr-2 pointer-events-none", children: /* @__PURE__ */ jsx(ChevronsUpDown, { className: " w-5 h-5 text-gray-400", "aria-hidden": "true" }) })
70434
+ /* @__PURE__ */ jsx("span", { className: "block truncate", children: displayValue() }),
70435
+ /* @__PURE__ */ jsx("span", { className: "absolute inset-y-0 right-0 flex items-center pr-2 pointer-events-none", children: /* @__PURE__ */ jsx(ChevronsUpDown, { className: "w-5 h-5 text-gray-400", "aria-hidden": "true" }) })
70424
70436
  ]
70425
70437
  }
70426
70438
  ),
@@ -70429,20 +70441,23 @@ function MultiSelect({
70429
70441
  {
70430
70442
  as: Fragment$1,
70431
70443
  show: open,
70432
- leave: " transition ease-in duration-100",
70433
- leaveFrom: " opacity-100",
70434
- leaveTo: " opacity-0",
70435
- children: /* @__PURE__ */ jsxs(Listbox.Options, { className: " absolute z-10 w-full py-1 mt-1 overflow-auto text-base bg-white rounded-md shadow-lg max-h-60 ring-1 ring-black ring-opacity-5 focus: outline-none sm: text-sm", children: [
70436
- /* @__PURE__ */ jsx("div", { className: " p-2 sticky top-0 bg-white z-20 shadow-sm", children: /* @__PURE__ */ jsx(
70444
+ leave: "transition ease-in duration-100",
70445
+ leaveFrom: "opacity-100",
70446
+ leaveTo: "opacity-0",
70447
+ children: /* @__PURE__ */ jsxs(Listbox.Options, { className: "absolute z-10 w-full py-1 mt-1 overflow-auto text-base bg-white rounded-md shadow-lg max-h-60 ring-1 ring-black ring-opacity-5 focus:outline-none sm:text-sm", children: [
70448
+ /* @__PURE__ */ jsx("div", { className: "p-2 sticky top-0 bg-white z-20 shadow-sm", children: /* @__PURE__ */ jsx(
70437
70449
  SearchBar,
70438
70450
  {
70439
70451
  value: searchQuery,
70440
70452
  onDebouncedChange: setSearchQuery,
70441
- placeholder: "Search options..."
70453
+ placeholder: searchMode === "server" ? `Search (min ${minSearchChars})…` : "Search options"
70442
70454
  }
70443
70455
  ) }),
70444
- filteredOptions.length === 0 ? /* @__PURE__ */ jsx("div", { className: " py-2 px-3 text-gray-500", children: "No options found." }) : filteredOptions.map((option) => {
70445
- const isSelected = selectedObjs.some((o) => toId(o.id) === toId(option.id));
70456
+ searchMode === "server" && serverLoading && /* @__PURE__ */ jsx("div", { className: "py-2 px-3 text-gray-500", children: "Loading…" }),
70457
+ filteredOptions.length === 0 && !serverLoading ? /* @__PURE__ */ jsx("div", { className: "py-2 px-3 text-gray-500", children: searchMode === "server" ? searchQuery.length < minSearchChars ? `Type at least ${minSearchChars} characters to search.` : "No results." : "No options found." }) : filteredOptions.map((option) => {
70458
+ const id = getOptionId(option);
70459
+ const labelText = getOptionLabel(option);
70460
+ const isSelected = selectedObjs.some((o) => getOptionId(o) === id);
70446
70461
  const isDisabled = selectionLimit !== -1 && selectedObjs.length >= selectionLimit && !isSelected;
70447
70462
  return /* @__PURE__ */ jsx(
70448
70463
  Listbox.Option,
@@ -70450,39 +70465,39 @@ function MultiSelect({
70450
70465
  value: option,
70451
70466
  disabled: isDisabled,
70452
70467
  className: ({ active }) => classNames(
70453
- isDisabled ? " text-gray-400 bg-white cursor-not-allowed" : active ? " bg-indigo-600 text-white" : " text-gray-900",
70454
- " relative cursor-default select-none py-2 pl-3 pr-9"
70468
+ isDisabled ? "text-gray-400 bg-white cursor-not-allowed" : active ? "bg-indigo-600 text-white" : "text-gray-900",
70469
+ "relative cursor-default select-none py-2 pl-3 pr-9"
70455
70470
  ),
70456
- children: ({ selected: isSelected2, active }) => /* @__PURE__ */ jsxs(Fragment, { children: [
70471
+ children: ({ selected: isSel, active }) => /* @__PURE__ */ jsxs(Fragment, { children: [
70457
70472
  /* @__PURE__ */ jsx(
70458
70473
  "span",
70459
70474
  {
70460
70475
  className: classNames(
70461
- isSelected2 ? " font-semibold" : " font-normal",
70462
- " block truncate"
70476
+ isSel ? "font-semibold" : "font-normal",
70477
+ "block truncate"
70463
70478
  ),
70464
- children: option.name
70479
+ children: labelText
70465
70480
  }
70466
70481
  ),
70467
- isSelected2 && /* @__PURE__ */ jsx(
70482
+ isSel && /* @__PURE__ */ jsx(
70468
70483
  "span",
70469
70484
  {
70470
70485
  className: classNames(
70471
- active ? " text-white" : " text-indigo-600",
70472
- " absolute inset-y-0 right-0 flex items-center pr-4"
70486
+ active ? "text-white" : "text-indigo-600",
70487
+ "absolute inset-y-0 right-0 flex items-center pr-4"
70473
70488
  ),
70474
- children: /* @__PURE__ */ jsx(Check, { className: " w-5 h-5", "aria-hidden": "true" })
70489
+ children: /* @__PURE__ */ jsx(Check, { className: "w-5 h-5", "aria-hidden": "true" })
70475
70490
  }
70476
70491
  )
70477
70492
  ] })
70478
70493
  },
70479
- toId(option.id)
70494
+ id
70480
70495
  );
70481
70496
  })
70482
70497
  ] })
70483
70498
  }
70484
70499
  ),
70485
- error && /* @__PURE__ */ jsx("p", { id: errorId, className: " mt-1 text-sm text-red-600", children: error })
70500
+ error && /* @__PURE__ */ jsx("p", { id: errorId, className: "mt-1 text-sm text-red-600", children: error })
70486
70501
  ] })
70487
70502
  ] }) });
70488
70503
  }
@@ -70490,8 +70505,8 @@ MultiSelect.propTypes = {
70490
70505
  label: PropTypes.string.isRequired,
70491
70506
  options: PropTypes.arrayOf(
70492
70507
  PropTypes.shape({
70493
- id: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired,
70494
- name: PropTypes.string.isRequired
70508
+ id: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
70509
+ name: PropTypes.string
70495
70510
  })
70496
70511
  ),
70497
70512
  selected: PropTypes.array,
@@ -70500,7 +70515,15 @@ MultiSelect.propTypes = {
70500
70515
  placeholder: PropTypes.string,
70501
70516
  error: PropTypes.string,
70502
70517
  displayLimit: PropTypes.number,
70503
- selectionLimit: PropTypes.number
70518
+ selectionLimit: PropTypes.number,
70519
+ // NEW
70520
+ searchMode: PropTypes.oneOf(["client", "server"]),
70521
+ onSearch: PropTypes.func,
70522
+ // required when searchMode="server"
70523
+ serverLoading: PropTypes.bool,
70524
+ minSearchChars: PropTypes.number,
70525
+ getOptionId: PropTypes.func,
70526
+ getOptionLabel: PropTypes.func
70504
70527
  };
70505
70528
  MultiSelect.defaultProps = {
70506
70529
  options: [],
@@ -70512,7 +70535,13 @@ MultiSelect.defaultProps = {
70512
70535
  },
70513
70536
  error: null,
70514
70537
  displayLimit: 3,
70515
- selectionLimit: -1
70538
+ selectionLimit: -1,
70539
+ searchMode: "client",
70540
+ onSearch: void 0,
70541
+ serverLoading: false,
70542
+ minSearchChars: 2,
70543
+ getOptionId: (o) => String(o.id),
70544
+ getOptionLabel: (o) => o.name
70516
70545
  };
70517
70546
 
70518
70547
  export { AddUserGroupsRolesModal, Avatar, AvatarGroup, Badge, Breadcrumbs, Button$1 as Button, Checkbox, DatePicker, DateRangePicker$1 as DateRangePicker, FileUploadModal, FullScreenLoader, GenericFilter, Input, Modal, MultiSelect, OptionsMenu, PageHeader, PageLayout, Pagination, RadioGroup, SearchBar, Select, Sidebar, Spinner, Textarea, ToggleSwitch, Tooltip, UnifyedCoreButton, WizardModal, adGroupsListSearchApi, axiosDelete, axiosGet, axiosPatch, axiosPost, axiosPut, cookies$1 as cookies, createHttpClient, directoryPermissionsApi, filePermissionsApi, gateWayUrl, gatewayBase, getBaseUrl, getSnapshot, http, localStore, myDriveGatewayBaseV2, provisioningBase, rbacBase, searchRolesApi, sessionStore, userSearchBase };