@noya-app/noya-designsystem 0.1.53 → 0.1.54

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
@@ -2178,7 +2178,7 @@ var getMenuItemKey = (item, index) => {
2178
2178
  }
2179
2179
  };
2180
2180
  var CHECKBOX_WIDTH = 15;
2181
- var CHECKBOX_RIGHT_INSET = 8;
2181
+ var CHECKBOX_RIGHT_INSET = 6;
2182
2182
  var CHECKBOX_INDENT_WIDTH = 6;
2183
2183
  var styles = {
2184
2184
  separatorStyle: "h-px bg-divider mx-3 my-1",
@@ -2281,7 +2281,6 @@ import { ChevronRightIcon } from "@noya-app/noya-icons";
2281
2281
  import React24 from "react";
2282
2282
 
2283
2283
  // src/components/internal/SelectItem.tsx
2284
- import { CheckIcon } from "@noya-app/noya-icons";
2285
2284
  import React23, { useCallback as useCallback14 } from "react";
2286
2285
  var SelectItem = React23.forwardRef(
2287
2286
  ({
@@ -2321,7 +2320,7 @@ var SelectItem = React23.forwardRef(
2321
2320
  )
2322
2321
  },
2323
2322
  /* @__PURE__ */ React23.createElement(Spacer.Horizontal, { size: CHECKBOX_INDENT_WIDTH }),
2324
- Components4.ItemIndicator && /* @__PURE__ */ React23.createElement(Components4.ItemIndicator, { ...styles.itemIndicator }, /* @__PURE__ */ React23.createElement(CheckIcon, null)),
2323
+ Components4.ItemIndicator && /* @__PURE__ */ React23.createElement(Components4.ItemIndicator, { ...styles.itemIndicator }, /* @__PURE__ */ React23.createElement(Checkmark, null)),
2325
2324
  icon && /* @__PURE__ */ React23.createElement(React23.Fragment, null, renderIcon(icon), /* @__PURE__ */ React23.createElement(Spacer.Horizontal, { size: 8 })),
2326
2325
  children,
2327
2326
  shortcut && /* @__PURE__ */ React23.createElement(React23.Fragment, null, /* @__PURE__ */ React23.createElement(Spacer.Horizontal, null), /* @__PURE__ */ React23.createElement(Spacer.Horizontal, { size: 24 }), /* @__PURE__ */ React23.createElement(KeyboardShortcut, { shortcut }))
@@ -2342,10 +2341,34 @@ var SelectItem = React23.forwardRef(
2342
2341
  onSelect: handleSelectItem,
2343
2342
  ...props
2344
2343
  },
2345
- /* @__PURE__ */ React23.createElement("div", { className: "flex flex-1 items-center" }, indented && /* @__PURE__ */ React23.createElement(Spacer.Horizontal, { size: CHECKBOX_INDENT_WIDTH }), checked ? /* @__PURE__ */ React23.createElement("div", { ...styles.itemIndicator }, /* @__PURE__ */ React23.createElement(CheckIcon, null)) : indented ? /* @__PURE__ */ React23.createElement(Spacer.Horizontal, { size: CHECKBOX_WIDTH - CHECKBOX_RIGHT_INSET }) : null, icon && /* @__PURE__ */ React23.createElement(React23.Fragment, null, renderIcon(icon), /* @__PURE__ */ React23.createElement(Spacer.Horizontal, { size: 8 })), /* @__PURE__ */ React23.createElement(Components4.ItemText, null, children), shortcut && /* @__PURE__ */ React23.createElement(React23.Fragment, null, /* @__PURE__ */ React23.createElement(Spacer.Horizontal, null), /* @__PURE__ */ React23.createElement(Spacer.Horizontal, { size: 24 }), /* @__PURE__ */ React23.createElement(KeyboardShortcut, { shortcut })))
2344
+ /* @__PURE__ */ React23.createElement("div", { className: "flex flex-1 items-center" }, indented && /* @__PURE__ */ React23.createElement(Spacer.Horizontal, { size: CHECKBOX_INDENT_WIDTH }), checked ? /* @__PURE__ */ React23.createElement("div", { ...styles.itemIndicator }, /* @__PURE__ */ React23.createElement(Checkmark, null)) : indented ? /* @__PURE__ */ React23.createElement(Spacer.Horizontal, { size: CHECKBOX_WIDTH - CHECKBOX_RIGHT_INSET }) : null, icon && /* @__PURE__ */ React23.createElement(React23.Fragment, null, renderIcon(icon), /* @__PURE__ */ React23.createElement(Spacer.Horizontal, { size: 8 })), /* @__PURE__ */ React23.createElement(Components4.ItemText, null, children), shortcut && /* @__PURE__ */ React23.createElement(React23.Fragment, null, /* @__PURE__ */ React23.createElement(Spacer.Horizontal, null), /* @__PURE__ */ React23.createElement(Spacer.Horizontal, { size: 24 }), /* @__PURE__ */ React23.createElement(KeyboardShortcut, { shortcut })))
2346
2345
  ));
2347
2346
  }
2348
2347
  );
2348
+ function Checkmark() {
2349
+ return /* @__PURE__ */ React23.createElement(
2350
+ "svg",
2351
+ {
2352
+ viewBox: "0 0 15 15",
2353
+ fill: "none",
2354
+ xmlns: "http://www.w3.org/2000/svg",
2355
+ "aria-hidden": "true",
2356
+ width: 15,
2357
+ height: 15
2358
+ },
2359
+ /* @__PURE__ */ React23.createElement(
2360
+ "path",
2361
+ {
2362
+ className: "scale-90 origin-center",
2363
+ d: "M3 8L6 11L12 5",
2364
+ strokeWidth: "1.1",
2365
+ strokeLinecap: "round",
2366
+ strokeLinejoin: "round",
2367
+ stroke: "currentColor"
2368
+ }
2369
+ )
2370
+ );
2371
+ }
2349
2372
 
2350
2373
  // src/components/internal/MenuViewport.tsx
2351
2374
  var MenuViewport = ({
@@ -5681,9 +5704,9 @@ var ColorSwatch = forwardRef20(function ColorSwatch2({ color, size: size2 = "sma
5681
5704
  width: sizePx,
5682
5705
  height: sizePx,
5683
5706
  borderRadius: "4px",
5684
- outline: checked ? "2px solid rgba(0,0,0,0.2)" : "1px solid rgba(0,0,0,0.1)",
5707
+ outline: checked ? `2px solid ${cssVars.colors.primary}` : "1px solid rgba(0,0,0,0.1)",
5685
5708
  outlineOffset: -1,
5686
- boxShadow: checked ? `inset 0 0 0 2px rgba(0,0,0,0.2)` : void 0,
5709
+ boxShadow: checked ? `inset 0 0 0 2px ${cssVars.colors.background}` : void 0,
5687
5710
  ...style2
5688
5711
  }
5689
5712
  }
@@ -6096,7 +6119,7 @@ function useComboboxState(state) {
6096
6119
  }
6097
6120
 
6098
6121
  // src/components/ComboboxMenu.tsx
6099
- import { CheckIcon as CheckIcon2 } from "@noya-app/noya-icons";
6122
+ import { CheckIcon } from "@noya-app/noya-icons";
6100
6123
  import React50 from "react";
6101
6124
  var ComboboxMenu = memoGeneric(
6102
6125
  forwardRefGeneric(function ComboboxMenu2({
@@ -6149,7 +6172,7 @@ var ComboboxMenu = memoGeneric(
6149
6172
  }
6150
6173
  }
6151
6174
  },
6152
- /* @__PURE__ */ React50.createElement("div", { className: "flex flex-1 min-w-0 items-center" }, indented && /* @__PURE__ */ React50.createElement(Spacer.Horizontal, { size: CHECKBOX_INDENT_WIDTH }), item.checked ? /* @__PURE__ */ React50.createElement("div", { ...styles.itemIndicator }, /* @__PURE__ */ React50.createElement(CheckIcon2, null)) : indented ? /* @__PURE__ */ React50.createElement(
6175
+ /* @__PURE__ */ React50.createElement("div", { className: "flex flex-1 min-w-0 items-center" }, indented && /* @__PURE__ */ React50.createElement(Spacer.Horizontal, { size: CHECKBOX_INDENT_WIDTH }), item.checked ? /* @__PURE__ */ React50.createElement("div", { ...styles.itemIndicator }, /* @__PURE__ */ React50.createElement(CheckIcon, null)) : indented ? /* @__PURE__ */ React50.createElement(
6153
6176
  Spacer.Horizontal,
6154
6177
  {
6155
6178
  size: CHECKBOX_WIDTH - CHECKBOX_RIGHT_INSET
@@ -6874,14 +6897,14 @@ var ConnectedUsersMenuLayout = ({
6874
6897
  backgroundColor: isAssistantOpen ? colorFromString(currentUserId ?? "") : void 0
6875
6898
  }
6876
6899
  },
6877
- "AI",
6878
- /* @__PURE__ */ React55.createElement(Spacer.Horizontal, { size: 8 }),
6879
6900
  /* @__PURE__ */ React55.createElement(
6880
6901
  ChatBubbleWithDotsIcon,
6881
6902
  {
6882
6903
  color: isAssistantOpen ? void 0 : cssVars.colors.icon
6883
6904
  }
6884
- )
6905
+ ),
6906
+ /* @__PURE__ */ React55.createElement(Spacer.Horizontal, { inline: true, size: 6 }),
6907
+ "AI"
6885
6908
  )
6886
6909
  ));
6887
6910
  };
@@ -10973,12 +10996,15 @@ var SegmentedControlItem = forwardRef26(function SegmentedControlItem2({
10973
10996
  value: (value ?? "").toString(),
10974
10997
  disabled,
10975
10998
  className: cx(
10976
- "font-sans text-heading5 font-normal relative flex-1 appearance-none text-segmented-control-item rounded inline-flex gap-1.5 items-center justify-center align-middle text-center focus:outline-none transition-colors",
10999
+ "font-sans text-button font-normal relative flex-1 appearance-none text-segmented-control-item rounded inline-flex gap-1.5 items-center justify-center align-middle text-center focus:outline-none transition-colors",
10977
11000
  colorScheme === "secondary" ? "focus:ring-2 focus:ring-secondary focus:ring-offset-1" : "focus:ring-2 focus:ring-primary focus:ring-offset-1",
10978
11001
  colorScheme === "secondary" ? "aria-checked:bg-secondary aria-checked:text-white" : colorScheme === "primary" ? "aria-checked:bg-primary aria-checked:text-white" : "aria-checked:bg-background aria-checked:text-text",
10979
11002
  "focus:z-interactable",
10980
11003
  "aria-checked:shadow-segment",
10981
- "whitespace-pre",
11004
+ "whitespace-pre px-1",
11005
+ "border-r border-divider last:border-r-0",
11006
+ "aria-checked:border-r-transparent",
11007
+ "[&:has(+[aria-checked=true])]:border-r-transparent",
10982
11008
  className
10983
11009
  ),
10984
11010
  ...props
@@ -10988,15 +11014,6 @@ var SegmentedControlItem = forwardRef26(function SegmentedControlItem2({
10988
11014
  );
10989
11015
  return tooltip ? /* @__PURE__ */ React74.createElement(Tooltip, { content: tooltip }, itemElement) : itemElement;
10990
11016
  });
10991
- var Separator3 = ({ transparent }) => /* @__PURE__ */ React74.createElement(
10992
- "div",
10993
- {
10994
- className: cx(
10995
- "w-[1px] my-1 self-stretch bg-divider",
10996
- transparent && "bg-transparent"
10997
- )
10998
- }
10999
- );
11000
11017
  var SegmentedControl = memoGeneric(function SegmentedControl2({
11001
11018
  id: idProp,
11002
11019
  value,
@@ -11004,7 +11021,6 @@ var SegmentedControl = memoGeneric(function SegmentedControl2({
11004
11021
  colorScheme,
11005
11022
  allowEmpty,
11006
11023
  items,
11007
- separator: separator2 = true,
11008
11024
  className,
11009
11025
  style: style2
11010
11026
  }) {
@@ -11017,7 +11033,6 @@ var SegmentedControl = memoGeneric(function SegmentedControl2({
11017
11033
  },
11018
11034
  [allowEmpty, onValueChange]
11019
11035
  );
11020
- const selectedIndex = items.findIndex((item) => item?.value === value);
11021
11036
  return /* @__PURE__ */ React74.createElement(SegmentedControlContext.Provider, { value: contextValue }, /* @__PURE__ */ React74.createElement(
11022
11037
  ToggleGroupPrimitive2.Root,
11023
11038
  {
@@ -11026,17 +11041,15 @@ var SegmentedControl = memoGeneric(function SegmentedControl2({
11026
11041
  value,
11027
11042
  onValueChange: handleValueChange,
11028
11043
  className: cx(
11029
- `flex items-stretch flex-auto appearance-none relative outline-none min-h-input-height rounded bg-input-background py-[2px] px-[2px]`,
11044
+ `grid appearance-none relative outline-none min-h-input-height rounded bg-input-background py-0.5 px-0.5`,
11030
11045
  className
11031
11046
  ),
11032
- style: style2
11047
+ style: {
11048
+ ...style2,
11049
+ gridTemplateColumns: `repeat(${items.length}, 1fr)`
11050
+ }
11033
11051
  },
11034
- separator2 ? items.map((item, index) => {
11035
- const isLastItem = index === items.length - 1;
11036
- const currentValue = item?.value;
11037
- const showSeparator = currentValue !== value && (selectedIndex === 0 && selectedIndex !== index ? true : index !== selectedIndex - 1);
11038
- return /* @__PURE__ */ React74.createElement(React74.Fragment, { key: index }, /* @__PURE__ */ React74.createElement(SegmentedControlItem, { key: index, ...item }), !isLastItem && /* @__PURE__ */ React74.createElement(Separator3, { transparent: !showSeparator }));
11039
- }) : items.map((item, index) => /* @__PURE__ */ React74.createElement(SegmentedControlItem, { key: index, ...item }))
11052
+ items.map((item, index) => /* @__PURE__ */ React74.createElement(SegmentedControlItem, { key: index, ...item }))
11040
11053
  ));
11041
11054
  });
11042
11055
 
@@ -11353,7 +11366,7 @@ var Slider = memo34(function Slider2({
11353
11366
  {
11354
11367
  style: trackFillStyle,
11355
11368
  className: cx(
11356
- "absolute inset-0 w-full h-full rounded overflow-hidden",
11369
+ "absolute inset-0 w-full h-full rounded overflow-hidden bg-primary-pastel",
11357
11370
  colorScheme === "primary" && "bg-primary",
11358
11371
  colorScheme === "secondary" && "bg-secondary"
11359
11372
  )
@@ -12390,6 +12403,11 @@ function BaseToolbar({
12390
12403
  import { DropdownChevronIcon as DropdownChevronIcon4 } from "@noya-app/noya-icons";
12391
12404
  import { useKeyboardShortcuts as useKeyboardShortcuts4 } from "@noya-app/noya-keymap";
12392
12405
  import React87 from "react";
12406
+ var iconButtonStyle = {
12407
+ height: 27,
12408
+ width: 27,
12409
+ minWidth: 27
12410
+ };
12393
12411
  var ToolbarMenuDropdown = memoGeneric(function ToolbarMenuDropdown2({
12394
12412
  item,
12395
12413
  onSelectMenuItem
@@ -12407,7 +12425,7 @@ var ToolbarMenuDropdown = memoGeneric(function ToolbarMenuDropdown2({
12407
12425
  }
12408
12426
  }
12409
12427
  },
12410
- /* @__PURE__ */ React87.createElement(Button, { disabled: item.disabled, active: item.checked || open }, item.title, item.title && item.icon && /* @__PURE__ */ React87.createElement(Spacer.Horizontal, { inline: true, size: 6 }), item.icon && renderIcon(item.icon), /* @__PURE__ */ React87.createElement(Spacer.Horizontal, { size: 6 }), /* @__PURE__ */ React87.createElement(DropdownChevronIcon4, null))
12428
+ /* @__PURE__ */ React87.createElement(Button, { disabled: item.disabled, active: item.checked || open }, item.icon && renderIcon(item.icon), item.title && item.icon && /* @__PURE__ */ React87.createElement(Spacer.Horizontal, { inline: true, size: 6 }), item.title, /* @__PURE__ */ React87.createElement(Spacer.Horizontal, { inline: true, size: 6 }), /* @__PURE__ */ React87.createElement(DropdownChevronIcon4, null))
12411
12429
  );
12412
12430
  });
12413
12431
  var ToolbarMenuButton = memoGeneric(function ToolbarMenuButton2({
@@ -12419,18 +12437,47 @@ var ToolbarMenuButton = memoGeneric(function ToolbarMenuButton2({
12419
12437
  {
12420
12438
  disabled: item.disabled,
12421
12439
  active: item.checked,
12440
+ style: item.icon && !item.title ? iconButtonStyle : void 0,
12422
12441
  onClick: () => {
12423
12442
  if (onSelectMenuItem && item.value) {
12424
12443
  onSelectMenuItem(item.value);
12425
12444
  }
12426
12445
  }
12427
12446
  },
12428
- item.title,
12447
+ item.icon && renderIcon(item.icon),
12429
12448
  item.title && item.icon && /* @__PURE__ */ React87.createElement(Spacer.Horizontal, { inline: true, size: 6 }),
12430
- item.icon && renderIcon(item.icon)
12449
+ item.title
12431
12450
  );
12432
12451
  return item.tooltip ? /* @__PURE__ */ React87.createElement(Tooltip, { sideOffset: 10, content: item.tooltip }, content) : content;
12433
12452
  });
12453
+ var ToolbarMenuItem = memoGeneric(function ToolbarMenuItem2({
12454
+ item,
12455
+ onSelectMenuItem
12456
+ }) {
12457
+ if (item.type === "sectionHeader") return null;
12458
+ if (item.type === "separator") {
12459
+ return /* @__PURE__ */ React87.createElement(DividerVertical, { overflow: 4 });
12460
+ }
12461
+ if (isSelectableMenuItem(item)) {
12462
+ return /* @__PURE__ */ React87.createElement(ToolbarMenuButton, { item, onSelectMenuItem });
12463
+ }
12464
+ return /* @__PURE__ */ React87.createElement(ToolbarMenuDropdown, { item, onSelectMenuItem });
12465
+ });
12466
+ var ToolbarMenu = memoGeneric(function ToolbarMenu2({
12467
+ items,
12468
+ onSelectMenuItem
12469
+ }) {
12470
+ return /* @__PURE__ */ React87.createElement(React87.Fragment, null, items.map((item, i) => {
12471
+ return /* @__PURE__ */ React87.createElement(
12472
+ ToolbarMenuItem,
12473
+ {
12474
+ key: i,
12475
+ item,
12476
+ onSelectMenuItem
12477
+ }
12478
+ );
12479
+ }));
12480
+ });
12434
12481
  function Toolbar({
12435
12482
  children,
12436
12483
  logo,
@@ -12471,35 +12518,6 @@ function Toolbar({
12471
12518
  children
12472
12519
  );
12473
12520
  }
12474
- var ToolbarMenu = memoGeneric(function ToolbarMenu2({
12475
- items,
12476
- onSelectMenuItem
12477
- }) {
12478
- return /* @__PURE__ */ React87.createElement(React87.Fragment, null, items.map((item, i) => {
12479
- if (item.type === "sectionHeader") return null;
12480
- if (item.type === "separator") {
12481
- return /* @__PURE__ */ React87.createElement(DividerVertical, { key: i, overflow: 4 });
12482
- }
12483
- if (isSelectableMenuItem(item)) {
12484
- return /* @__PURE__ */ React87.createElement(
12485
- ToolbarMenuButton,
12486
- {
12487
- key: i,
12488
- item,
12489
- onSelectMenuItem
12490
- }
12491
- );
12492
- }
12493
- return /* @__PURE__ */ React87.createElement(
12494
- ToolbarMenuDropdown,
12495
- {
12496
- key: i,
12497
- item,
12498
- onSelectMenuItem
12499
- }
12500
- );
12501
- }));
12502
- });
12503
12521
  export {
12504
12522
  AIAssistantInput,
12505
12523
  AIAssistantLayout,
@@ -12614,6 +12632,7 @@ export {
12614
12632
  ToolbarMenu,
12615
12633
  ToolbarMenuButton,
12616
12634
  ToolbarMenuDropdown,
12635
+ ToolbarMenuItem,
12617
12636
  Tooltip,
12618
12637
  TreeView,
12619
12638
  UserAvatar,