@noya-app/noya-designsystem 0.0.4 → 0.0.5

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.
@@ -5,13 +5,13 @@ CLI tsup v8.0.1
5
5
  CLI Target: esnext
6
6
  CJS Build start
7
7
  ESM Build start
8
- CJS dist/index.js 789.43 KB
9
- CJS dist/index.js.map 1.15 MB
10
- CJS ⚡️ Build success in 159ms
11
- ESM dist/index.mjs 752.96 KB
12
- ESM dist/index.mjs.map 1.15 MB
13
- ESM ⚡️ Build success in 160ms
8
+ CJS dist/index.js 787.15 KB
9
+ CJS dist/index.js.map 1.12 MB
10
+ CJS ⚡️ Build success in 112ms
11
+ ESM dist/index.mjs 750.46 KB
12
+ ESM dist/index.mjs.map 1.12 MB
13
+ ESM ⚡️ Build success in 114ms
14
14
  DTS Build start
15
- DTS ⚡️ Build success in 5396ms
15
+ DTS ⚡️ Build success in 5221ms
16
16
  DTS dist/index.d.ts 48.78 KB
17
17
  DTS dist/index.d.mts 48.78 KB
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @noya-app/noya-designsystem
2
2
 
3
+ ## 0.0.5
4
+
5
+ ### Patch Changes
6
+
7
+ - Add noya-utils as dep
8
+
3
9
  ## 0.0.4
4
10
 
5
11
  ### Patch Changes
package/dist/index.js CHANGED
@@ -10525,115 +10525,8 @@ var Dialog = (0, import_react10.forwardRef)(function Dialog2({
10525
10525
  ));
10526
10526
  });
10527
10527
 
10528
- // ../noya-utils/dist/index.mjs
10529
- var __defProp3 = Object.defineProperty;
10530
- var __export2 = (target, all) => {
10531
- for (var name in all)
10532
- __defProp3(target, name, { get: all[name], enumerable: true });
10533
- };
10534
- var clamp = (number, min = 0, max = 1) => {
10535
- return number > max ? max : number < min ? min : number;
10536
- };
10537
- function range(start, end, step) {
10538
- if (end === void 0) {
10539
- end = start;
10540
- start = 0;
10541
- }
10542
- step = step ?? (start < end ? 1 : -1);
10543
- let index = -1;
10544
- let length = Math.max(Math.ceil((end - start) / (step || 1)), 0);
10545
- const result = Array(length);
10546
- while (length--) {
10547
- result[++index] = start;
10548
- start += step;
10549
- }
10550
- return result;
10551
- }
10552
- function chunkBy(values, belongInSameGroup) {
10553
- if (values.length === 0)
10554
- return [];
10555
- const result = [];
10556
- let start = 0;
10557
- const end = values.length;
10558
- for (let i = start + 1; i < end; i++) {
10559
- const prev = values[i - 1];
10560
- const next = values[i];
10561
- if (!belongInSameGroup(prev, next)) {
10562
- result.push(values.slice(start, i));
10563
- start = i;
10564
- }
10565
- }
10566
- result.push(values.slice(start, end));
10567
- return result;
10568
- }
10569
- function invert(record) {
10570
- return Object.fromEntries(
10571
- Object.entries(record).map(([type, extension]) => [extension, type])
10572
- );
10573
- }
10574
- var FILE_TYPE_TO_EXTENSION = {
10575
- "image/png": "png",
10576
- "image/jpeg": "jpg",
10577
- "image/webp": "webp",
10578
- "image/svg+xml": "svg",
10579
- "application/pdf": "pdf",
10580
- "application/zip": "zip"
10581
- };
10582
- var FILE_EXTENSION_TO_TYPE = invert(FILE_TYPE_TO_EXTENSION);
10583
- function memoize(f) {
10584
- const intermediateCache = /* @__PURE__ */ new Map();
10585
- const cache = /* @__PURE__ */ new Map();
10586
- let intermediateCacheIndex = 0;
10587
- return (...values) => {
10588
- let key = "";
10589
- for (const value of values) {
10590
- if (!intermediateCache.has(value)) {
10591
- intermediateCache.set(value, `${intermediateCacheIndex++}`);
10592
- }
10593
- key += intermediateCache.get(value) + ":";
10594
- }
10595
- if (!cache.has(key)) {
10596
- cache.set(key, f(...values));
10597
- }
10598
- return cache.get(key);
10599
- };
10600
- }
10601
- function unique(array) {
10602
- return [...new Set(array)];
10603
- }
10604
- var root = typeof window !== "undefined" ? window : global;
10605
- function partition(array, predicate) {
10606
- const left = [];
10607
- const right = [];
10608
- for (const item of array) {
10609
- if (predicate(item)) {
10610
- left.push(item);
10611
- } else {
10612
- right.push(item);
10613
- }
10614
- }
10615
- return [left, right];
10616
- }
10617
- var delimitedPath_exports = {};
10618
- __export2(delimitedPath_exports, {
10619
- basename: () => basename,
10620
- dirname: () => dirname,
10621
- join: () => join,
10622
- sep: () => sep
10623
- });
10624
- var sep = "/";
10625
- function basename(filename) {
10626
- return filename.slice(filename.lastIndexOf(sep) + 1);
10627
- }
10628
- function dirname(filename) {
10629
- const base2 = basename(filename);
10630
- return filename.slice(0, -(base2.length + 1));
10631
- }
10632
- function join(components) {
10633
- return components.filter((component) => !!component).join(sep);
10634
- }
10635
-
10636
10528
  // src/components/InputField.tsx
10529
+ var import_noya_utils = require("@noya-app/noya-utils");
10637
10530
  var import_react19 = __toESM(require("react"));
10638
10531
  var import_styled_components13 = __toESM(require("styled-components"));
10639
10532
 
@@ -10804,9 +10697,9 @@ function useKeyboardShortcuts(shortcuts, options = {}) {
10804
10697
  invokedWithinInput
10805
10698
  });
10806
10699
  };
10807
- listenerElement == null ? void 0 : listenerElement.addEventListener(eventName, handler);
10700
+ listenerElement?.addEventListener(eventName, handler);
10808
10701
  return () => {
10809
- listenerElement == null ? void 0 : listenerElement.removeEventListener(eventName, handler);
10702
+ listenerElement?.removeEventListener(eventName, handler);
10810
10703
  };
10811
10704
  }, [eventName]);
10812
10705
  }
@@ -11025,13 +10918,13 @@ function createKey(key) {
11025
10918
  function withSeparatorElements(elements2, separator) {
11026
10919
  const childrenArray = import_react12.Children.toArray(elements2);
11027
10920
  for (let i = childrenArray.length - 1; i > 0; i--) {
11028
- let sep2 = typeof separator === "function" ? separator() : (0, import_react12.isValidElement)(separator) ? (0, import_react12.cloneElement)(separator, { key: createKey(i) }) : separator;
11029
- if ((0, import_react12.isValidElement)(sep2) && sep2.key == null) {
11030
- sep2 = (0, import_react12.cloneElement)(sep2, { key: createKey(i) });
10921
+ let sep = typeof separator === "function" ? separator() : (0, import_react12.isValidElement)(separator) ? (0, import_react12.cloneElement)(separator, { key: createKey(i) }) : separator;
10922
+ if ((0, import_react12.isValidElement)(sep) && sep.key == null) {
10923
+ sep = (0, import_react12.cloneElement)(sep, { key: createKey(i) });
11031
10924
  }
11032
- if (!sep2 || typeof sep2 === "boolean")
10925
+ if (!sep || typeof sep === "boolean")
11033
10926
  continue;
11034
- childrenArray.splice(i, 0, sep2);
10927
+ childrenArray.splice(i, 0, sep);
11035
10928
  }
11036
10929
  return childrenArray;
11037
10930
  }
@@ -11717,7 +11610,7 @@ var InputFieldButton = (0, import_react19.memo)(function InputFieldButton2({
11717
11610
  children
11718
11611
  ));
11719
11612
  });
11720
- var createCrossSVGString = memoize(
11613
+ var createCrossSVGString = (0, import_noya_utils.memoize)(
11721
11614
  (color) => `<svg width='15' height='15' viewBox='0 0 15 15' fill='${color}' xmlns='http://www.w3.org/2000/svg'>
11722
11615
  <path d='M0.877075 7.49988C0.877075 3.84219 3.84222 0.877045 7.49991 0.877045C11.1576 0.877045 14.1227 3.84219 14.1227 7.49988C14.1227 11.1575 11.1576 14.1227 7.49991 14.1227C3.84222 14.1227 0.877075 11.1575 0.877075 7.49988ZM7.49991 1.82704C4.36689 1.82704 1.82708 4.36686 1.82708 7.49988C1.82708 10.6329 4.36689 13.1727 7.49991 13.1727C10.6329 13.1727 13.1727 10.6329 13.1727 7.49988C13.1727 4.36686 10.6329 1.82704 7.49991 1.82704ZM9.85358 5.14644C10.0488 5.3417 10.0488 5.65829 9.85358 5.85355L8.20713 7.49999L9.85358 9.14644C10.0488 9.3417 10.0488 9.65829 9.85358 9.85355C9.65832 10.0488 9.34173 10.0488 9.14647 9.85355L7.50002 8.2071L5.85358 9.85355C5.65832 10.0488 5.34173 10.0488 5.14647 9.85355C4.95121 9.65829 4.95121 9.3417 5.14647 9.14644L6.79292 7.49999L5.14647 5.85355C4.95121 5.65829 4.95121 5.3417 5.14647 5.14644C5.34173 4.95118 5.65832 4.95118 5.85358 5.14644L7.50002 6.79289L9.14647 5.14644C9.34173 4.95118 9.65832 4.95118 9.85358 5.14644Z' fill-rule='evenodd' clip-rule='evenodd'></path>
11723
11616
  </svg>`
@@ -12477,13 +12370,13 @@ var import_react29 = __toESM(require("react"));
12477
12370
  var import_styled_components20 = __toESM(require("styled-components"));
12478
12371
 
12479
12372
  // ../noya-file-format/dist/index.mjs
12480
- var __defProp4 = Object.defineProperty;
12481
- var __export3 = (target, all) => {
12373
+ var __defProp3 = Object.defineProperty;
12374
+ var __export2 = (target, all) => {
12482
12375
  for (var name in all)
12483
- __defProp4(target, name, { get: all[name], enumerable: true });
12376
+ __defProp3(target, name, { get: all[name], enumerable: true });
12484
12377
  };
12485
12378
  var types_exports = {};
12486
- __export3(types_exports, {
12379
+ __export2(types_exports, {
12487
12380
  AnimationType: () => AnimationType,
12488
12381
  BlendMode: () => BlendMode,
12489
12382
  BlurType: () => BlurType,
@@ -13453,6 +13346,7 @@ var GridView;
13453
13346
  })(GridView || (GridView = {}));
13454
13347
 
13455
13348
  // src/components/InputFieldWithCompletions.tsx
13349
+ var import_noya_utils4 = require("@noya-app/noya-utils");
13456
13350
  var import_react37 = __toESM(require("react"));
13457
13351
  var import_styled_components26 = __toESM(require("styled-components"));
13458
13352
 
@@ -13528,6 +13422,7 @@ function mergeRanges(ranges) {
13528
13422
  }
13529
13423
 
13530
13424
  // src/components/ListView.tsx
13425
+ var import_noya_utils3 = require("@noya-app/noya-utils");
13531
13426
  var import_react_compose_refs2 = require("@radix-ui/react-compose-refs");
13532
13427
  var import_react35 = __toESM(require("react"));
13533
13428
  var import_react_virtualized = require("react-virtualized");
@@ -13535,6 +13430,7 @@ var import_react_window = require("react-window");
13535
13430
  var import_styled_components24 = __toESM(require("styled-components"));
13536
13431
 
13537
13432
  // src/hooks/mergeEventHandlers.ts
13433
+ var import_noya_utils2 = require("@noya-app/noya-utils");
13538
13434
  var import_primitive = require("@radix-ui/primitive");
13539
13435
  function composeAllEventHandlers(...handlers) {
13540
13436
  const [first, ...rest] = handlers;
@@ -13544,7 +13440,7 @@ function composeAllEventHandlers(...handlers) {
13544
13440
  );
13545
13441
  }
13546
13442
  function mergeEventHandlers(...handlerMaps) {
13547
- const eventNames = unique(handlerMaps.map(Object.keys).flat());
13443
+ const eventNames = (0, import_noya_utils2.unique)(handlerMaps.map(Object.keys).flat());
13548
13444
  return Object.fromEntries(
13549
13445
  eventNames.map((eventName) => {
13550
13446
  const handlers = handlerMaps.flatMap((handlerMap) => {
@@ -14255,7 +14151,7 @@ var ListViewRootInner = (0, import_react35.forwardRef)(function ListViewRootInne
14255
14151
  keyExtractor: getKey,
14256
14152
  renderItem: renderWrappedChild
14257
14153
  }
14258
- ) : range(0, data.length).map(renderWrappedChild)
14154
+ ) : (0, import_noya_utils3.range)(0, data.length).map(renderWrappedChild)
14259
14155
  )
14260
14156
  )
14261
14157
  );
@@ -14390,9 +14286,9 @@ var Italic = ({ children }) => /* @__PURE__ */ import_react36.default.createElem
14390
14286
 
14391
14287
  // src/components/InputFieldWithCompletions.tsx
14392
14288
  function filterWithGroupedSections(items, query) {
14393
- const sections = chunkBy(items, (a, b) => b.type !== "sectionHeader");
14289
+ const sections = (0, import_noya_utils4.chunkBy)(items, (a, b) => b.type !== "sectionHeader");
14394
14290
  return sections.flatMap((section) => {
14395
- const [headers, regular] = partition(
14291
+ const [headers, regular] = (0, import_noya_utils4.partition)(
14396
14292
  section,
14397
14293
  (item) => item.type === "sectionHeader"
14398
14294
  );
@@ -14533,7 +14429,7 @@ var InputFieldWithCompletions = (0, import_react37.memo)(
14533
14429
  () => filterWithGroupedSections(items, filter),
14534
14430
  [items, filter]
14535
14431
  );
14536
- const [normalItems, sectionHeaderItems] = partition(
14432
+ const [normalItems, sectionHeaderItems] = (0, import_noya_utils4.partition)(
14537
14433
  filteredItems,
14538
14434
  (item) => item.type !== "sectionHeader"
14539
14435
  );
@@ -14872,6 +14768,7 @@ var LabeledElementView = (0, import_react39.memo)(function LabeledElementView2({
14872
14768
  });
14873
14769
 
14874
14770
  // src/components/Progress.tsx
14771
+ var import_noya_utils5 = require("@noya-app/noya-utils");
14875
14772
  var ProgressPrimitive = __toESM(require("@radix-ui/react-progress"));
14876
14773
  var import_react40 = __toESM(require("react"));
14877
14774
  var import_styled_components29 = __toESM(require("styled-components"));
@@ -14882,7 +14779,7 @@ function Progress({
14882
14779
  flex,
14883
14780
  variant = "normal"
14884
14781
  }) {
14885
- const clampedValue = clamp(value, 0, 100);
14782
+ const clampedValue = (0, import_noya_utils5.clamp)(value, 0, 100);
14886
14783
  return /* @__PURE__ */ import_react40.default.createElement(ProgressRoot, { value: clampedValue, style: { width, flex, height } }, /* @__PURE__ */ import_react40.default.createElement(
14887
14784
  ProgressIndicator,
14888
14785
  {
@@ -15013,6 +14910,7 @@ var RadioGroup;
15013
14910
  })(RadioGroup || (RadioGroup = {}));
15014
14911
 
15015
14912
  // src/components/Select.tsx
14913
+ var import_noya_utils6 = require("@noya-app/noya-utils");
15016
14914
  var import_react43 = __toESM(require("react"));
15017
14915
  var import_styled_components31 = __toESM(require("styled-components"));
15018
14916
  var SelectContext = (0, import_react43.createContext)(void 0);
@@ -15030,7 +14928,7 @@ var SelectOption = (0, import_react43.memo)(function SelectOption2({
15030
14928
  }, [addListener, onSelect, removeListener, value]);
15031
14929
  return /* @__PURE__ */ import_react43.default.createElement("option", { value }, title ?? value);
15032
14930
  });
15033
- var createChevronSVGString = memoize(
14931
+ var createChevronSVGString = (0, import_noya_utils6.memoize)(
15034
14932
  (color) => `
15035
14933
  <svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 15 15' fill='${color}'>
15036
14934
  <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>