@noya-app/noya-designsystem 0.0.4 → 0.0.6

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/index.mjs CHANGED
@@ -10432,115 +10432,8 @@ var Dialog = forwardRef4(function Dialog2({
10432
10432
  ));
10433
10433
  });
10434
10434
 
10435
- // ../noya-utils/dist/index.mjs
10436
- var __defProp3 = Object.defineProperty;
10437
- var __export2 = (target, all) => {
10438
- for (var name in all)
10439
- __defProp3(target, name, { get: all[name], enumerable: true });
10440
- };
10441
- var clamp = (number, min = 0, max = 1) => {
10442
- return number > max ? max : number < min ? min : number;
10443
- };
10444
- function range(start, end, step) {
10445
- if (end === void 0) {
10446
- end = start;
10447
- start = 0;
10448
- }
10449
- step = step ?? (start < end ? 1 : -1);
10450
- let index = -1;
10451
- let length = Math.max(Math.ceil((end - start) / (step || 1)), 0);
10452
- const result = Array(length);
10453
- while (length--) {
10454
- result[++index] = start;
10455
- start += step;
10456
- }
10457
- return result;
10458
- }
10459
- function chunkBy(values, belongInSameGroup) {
10460
- if (values.length === 0)
10461
- return [];
10462
- const result = [];
10463
- let start = 0;
10464
- const end = values.length;
10465
- for (let i = start + 1; i < end; i++) {
10466
- const prev = values[i - 1];
10467
- const next = values[i];
10468
- if (!belongInSameGroup(prev, next)) {
10469
- result.push(values.slice(start, i));
10470
- start = i;
10471
- }
10472
- }
10473
- result.push(values.slice(start, end));
10474
- return result;
10475
- }
10476
- function invert(record) {
10477
- return Object.fromEntries(
10478
- Object.entries(record).map(([type, extension]) => [extension, type])
10479
- );
10480
- }
10481
- var FILE_TYPE_TO_EXTENSION = {
10482
- "image/png": "png",
10483
- "image/jpeg": "jpg",
10484
- "image/webp": "webp",
10485
- "image/svg+xml": "svg",
10486
- "application/pdf": "pdf",
10487
- "application/zip": "zip"
10488
- };
10489
- var FILE_EXTENSION_TO_TYPE = invert(FILE_TYPE_TO_EXTENSION);
10490
- function memoize(f) {
10491
- const intermediateCache = /* @__PURE__ */ new Map();
10492
- const cache = /* @__PURE__ */ new Map();
10493
- let intermediateCacheIndex = 0;
10494
- return (...values) => {
10495
- let key = "";
10496
- for (const value of values) {
10497
- if (!intermediateCache.has(value)) {
10498
- intermediateCache.set(value, `${intermediateCacheIndex++}`);
10499
- }
10500
- key += intermediateCache.get(value) + ":";
10501
- }
10502
- if (!cache.has(key)) {
10503
- cache.set(key, f(...values));
10504
- }
10505
- return cache.get(key);
10506
- };
10507
- }
10508
- function unique(array) {
10509
- return [...new Set(array)];
10510
- }
10511
- var root = typeof window !== "undefined" ? window : global;
10512
- function partition(array, predicate) {
10513
- const left = [];
10514
- const right = [];
10515
- for (const item of array) {
10516
- if (predicate(item)) {
10517
- left.push(item);
10518
- } else {
10519
- right.push(item);
10520
- }
10521
- }
10522
- return [left, right];
10523
- }
10524
- var delimitedPath_exports = {};
10525
- __export2(delimitedPath_exports, {
10526
- basename: () => basename,
10527
- dirname: () => dirname,
10528
- join: () => join,
10529
- sep: () => sep
10530
- });
10531
- var sep = "/";
10532
- function basename(filename) {
10533
- return filename.slice(filename.lastIndexOf(sep) + 1);
10534
- }
10535
- function dirname(filename) {
10536
- const base2 = basename(filename);
10537
- return filename.slice(0, -(base2.length + 1));
10538
- }
10539
- function join(components) {
10540
- return components.filter((component) => !!component).join(sep);
10541
- }
10542
-
10543
10435
  // src/components/InputField.tsx
10436
+ import { memoize } from "@noya-app/noya-utils";
10544
10437
  import React13, {
10545
10438
  Children as Children3,
10546
10439
  createContext as createContext2,
@@ -10722,9 +10615,9 @@ function useKeyboardShortcuts(shortcuts, options = {}) {
10722
10615
  invokedWithinInput
10723
10616
  });
10724
10617
  };
10725
- listenerElement == null ? void 0 : listenerElement.addEventListener(eventName, handler);
10618
+ listenerElement?.addEventListener(eventName, handler);
10726
10619
  return () => {
10727
- listenerElement == null ? void 0 : listenerElement.removeEventListener(eventName, handler);
10620
+ listenerElement?.removeEventListener(eventName, handler);
10728
10621
  };
10729
10622
  }, [eventName]);
10730
10623
  }
@@ -10948,13 +10841,13 @@ function createKey(key) {
10948
10841
  function withSeparatorElements(elements2, separator) {
10949
10842
  const childrenArray = Children.toArray(elements2);
10950
10843
  for (let i = childrenArray.length - 1; i > 0; i--) {
10951
- let sep2 = typeof separator === "function" ? separator() : isValidElement(separator) ? cloneElement(separator, { key: createKey(i) }) : separator;
10952
- if (isValidElement(sep2) && sep2.key == null) {
10953
- sep2 = cloneElement(sep2, { key: createKey(i) });
10844
+ let sep = typeof separator === "function" ? separator() : isValidElement(separator) ? cloneElement(separator, { key: createKey(i) }) : separator;
10845
+ if (isValidElement(sep) && sep.key == null) {
10846
+ sep = cloneElement(sep, { key: createKey(i) });
10954
10847
  }
10955
- if (!sep2 || typeof sep2 === "boolean")
10848
+ if (!sep || typeof sep === "boolean")
10956
10849
  continue;
10957
- childrenArray.splice(i, 0, sep2);
10850
+ childrenArray.splice(i, 0, sep);
10958
10851
  }
10959
10852
  return childrenArray;
10960
10853
  }
@@ -12415,13 +12308,13 @@ import React22, { forwardRef as forwardRef9, memo as memo14 } from "react";
12415
12308
  import styled18 from "styled-components";
12416
12309
 
12417
12310
  // ../noya-file-format/dist/index.mjs
12418
- var __defProp4 = Object.defineProperty;
12419
- var __export3 = (target, all) => {
12311
+ var __defProp3 = Object.defineProperty;
12312
+ var __export2 = (target, all) => {
12420
12313
  for (var name in all)
12421
- __defProp4(target, name, { get: all[name], enumerable: true });
12314
+ __defProp3(target, name, { get: all[name], enumerable: true });
12422
12315
  };
12423
12316
  var types_exports = {};
12424
- __export3(types_exports, {
12317
+ __export2(types_exports, {
12425
12318
  AnimationType: () => AnimationType,
12426
12319
  BlendMode: () => BlendMode,
12427
12320
  BlurType: () => BlurType,
@@ -13416,6 +13309,7 @@ var GridView;
13416
13309
  })(GridView || (GridView = {}));
13417
13310
 
13418
13311
  // src/components/InputFieldWithCompletions.tsx
13312
+ import { chunkBy, partition } from "@noya-app/noya-utils";
13419
13313
  import React29, {
13420
13314
  forwardRef as forwardRef13,
13421
13315
  memo as memo20,
@@ -13500,6 +13394,7 @@ function mergeRanges(ranges) {
13500
13394
  }
13501
13395
 
13502
13396
  // src/components/ListView.tsx
13397
+ import { range } from "@noya-app/noya-utils";
13503
13398
  import { composeRefs as composeRefs2 } from "@radix-ui/react-compose-refs";
13504
13399
  import React27, {
13505
13400
  Children as Children4,
@@ -13519,6 +13414,7 @@ import { VariableSizeList } from "react-window";
13519
13414
  import styled22 from "styled-components";
13520
13415
 
13521
13416
  // src/hooks/mergeEventHandlers.ts
13417
+ import { unique } from "@noya-app/noya-utils";
13522
13418
  import { composeEventHandlers } from "@radix-ui/primitive";
13523
13419
  function composeAllEventHandlers(...handlers) {
13524
13420
  const [first, ...rest] = handlers;
@@ -14884,6 +14780,7 @@ var LabeledElementView = memo22(function LabeledElementView2({
14884
14780
  });
14885
14781
 
14886
14782
  // src/components/Progress.tsx
14783
+ import { clamp } from "@noya-app/noya-utils";
14887
14784
  import * as ProgressPrimitive from "@radix-ui/react-progress";
14888
14785
  import React32 from "react";
14889
14786
  import styled27 from "styled-components";
@@ -15032,6 +14929,7 @@ var RadioGroup;
15032
14929
  })(RadioGroup || (RadioGroup = {}));
15033
14930
 
15034
14931
  // src/components/Select.tsx
14932
+ import { memoize as memoize2 } from "@noya-app/noya-utils";
15035
14933
  import React34, {
15036
14934
  createContext as createContext10,
15037
14935
  memo as memo24,
@@ -15057,7 +14955,7 @@ var SelectOption = memo24(function SelectOption2({
15057
14955
  }, [addListener, onSelect, removeListener, value]);
15058
14956
  return /* @__PURE__ */ React34.createElement("option", { value }, title ?? value);
15059
14957
  });
15060
- var createChevronSVGString = memoize(
14958
+ var createChevronSVGString = memoize2(
15061
14959
  (color) => `
15062
14960
  <svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 15 15' fill='${color}'>
15063
14961
  <path d='M3.13523 6.15803C3.3241 5.95657 3.64052 5.94637 3.84197 6.13523L7.5 9.56464L11.158 6.13523C11.3595 5.94637 11.6759 5.95657 11.8648 6.15803C12.0536 6.35949 12.0434 6.67591 11.842 6.86477L7.84197 10.6148C7.64964 10.7951 7.35036 10.7951 7.15803 10.6148L3.15803 6.86477C2.95657 6.67591 2.94637 6.35949 3.13523 6.15803Z'></path>