@noya-app/noya-designsystem 0.1.59 → 0.1.61

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
@@ -220,6 +220,7 @@ import { useEffect as useEffect3, useRef as useRef4 } from "react";
220
220
 
221
221
  // ../noya-react-utils/src/hooks/useIsomorphicLayoutEffect.ts
222
222
  import * as React5 from "react";
223
+ var useIsomorphicLayoutEffect = typeof window !== "undefined" ? React5.useLayoutEffect : React5.useEffect;
223
224
 
224
225
  // ../noya-react-utils/src/hooks/useLateReference.ts
225
226
  import { useCallback as useCallback5, useLayoutEffect as useLayoutEffect2, useRef as useRef5 } from "react";
@@ -296,12 +297,12 @@ import { isShallowEqual } from "@noya-app/noya-utils";
296
297
  import { useRef as useRef7 } from "react";
297
298
 
298
299
  // ../noya-react-utils/src/hooks/useStableCallback.ts
299
- import { useCallback as useCallback9, useLayoutEffect as useLayoutEffect3, useRef as useRef8 } from "react";
300
+ import { useCallback as useCallback9, useRef as useRef8 } from "react";
300
301
  var noop2 = () => {
301
302
  };
302
303
  function useStableCallback(callback) {
303
304
  const callbackRef = useRef8(callback || noop2);
304
- useLayoutEffect3(() => {
305
+ useIsomorphicLayoutEffect(() => {
305
306
  callbackRef.current = callback || noop2;
306
307
  }, [callback]);
307
308
  return useCallback9(
@@ -725,7 +726,7 @@ var Tooltip = React10.memo(function Tooltip2({
725
726
 
726
727
  // src/components/Button.tsx
727
728
  var variantStyles = {
728
- normal: "bg-input-background text-text hover:bg-input-background-light active:bg-active-background min-w-[31px]",
729
+ normal: "bg-button-background text-button-text hover:bg-button-background-hover active:bg-button-background-active min-w-[31px]",
729
730
  primary: "bg-primary text-white hover:bg-primary-light active:bg-primary min-w-[31px]",
730
731
  secondary: "bg-secondary text-white hover:bg-secondary-light active:bg-secondary min-w-[31px]",
731
732
  secondaryBright: "bg-[#0ab557] text-white hover:opacity-80 active:opacity-90",
@@ -763,7 +764,7 @@ var Button = forwardRef4(function Button2({
763
764
  "no-underline leading-[1] relative border-0 outline-none select-none text-left rounded flex items-center justify-center [&>*]:pointer-events-none [-webkit-app-region:no-drag] focus:ring-2 focus:ring-primary focus:shadow-[0_0_0_1px_var(--n-popover-background)_inset] transition-all",
764
765
  disabled ? "opacity-25" : "",
765
766
  !className?.includes("flex") ? "flex-none" : "",
766
- active ? "bg-primary-pastel text-primary hover:bg-primary-pastel-light min-w-[31px]" : variantStyles[variant],
767
+ active ? "bg-button-background-active text-button-text-active hover:bg-button-background-active-hover min-w-[31px]" : variantStyles[variant],
767
768
  sizeStyles[variant === "thin" ? "thin" : variant === "floating" && size2 !== "small" ? "floating" : variant === "none" ? "none" : size2]
768
769
  );
769
770
  const buttonClassName = useMemo4(() => {
@@ -1065,7 +1066,7 @@ import React16, {
1065
1066
  forwardRef as forwardRef7,
1066
1067
  useCallback as useCallback11,
1067
1068
  useEffect as useEffect10,
1068
- useLayoutEffect as useLayoutEffect4,
1069
+ useLayoutEffect as useLayoutEffect3,
1069
1070
  useRef as useRef10,
1070
1071
  useState as useState11
1071
1072
  } from "react";
@@ -1189,7 +1190,7 @@ var SubmittableTextInput = forwardRef7(function SubmittableTextInput2({
1189
1190
  const userDidEdit = useRef10(false);
1190
1191
  const isSubmitTriggeredByEscapeKey = useRef10(false);
1191
1192
  const [internalValue, setInternalValue] = useState11("");
1192
- useLayoutEffect4(() => {
1193
+ useLayoutEffect3(() => {
1193
1194
  setInternalValue(value);
1194
1195
  }, [value]);
1195
1196
  const handleSubmit = useCallback11(() => {
@@ -3141,7 +3142,7 @@ import React34, {
3141
3142
  isValidElement as isValidElement2,
3142
3143
  useCallback as useCallback16,
3143
3144
  useEffect as useEffect14,
3144
- useLayoutEffect as useLayoutEffect5,
3145
+ useLayoutEffect as useLayoutEffect4,
3145
3146
  useRef as useRef14,
3146
3147
  useState as useState17
3147
3148
  } from "react";
@@ -3181,7 +3182,7 @@ var PresenceChild = ({
3181
3182
  willChange: "opacity",
3182
3183
  backfaceVisibility: "hidden"
3183
3184
  };
3184
- useLayoutEffect5(() => {
3185
+ useLayoutEffect4(() => {
3185
3186
  let rafId;
3186
3187
  if (isPresent && animationState !== "entered") {
3187
3188
  if (isInitialMount.current && skipInitialAnimation) {
@@ -3382,7 +3383,7 @@ var colorSchemeStyles = {
3382
3383
  secondary: "text-secondary"
3383
3384
  };
3384
3385
  var Checkbox = React37.memo(
3385
- React37.forwardRef(function Checkbox2({ className, style: style2, colorScheme = "secondary", ...props }, ref) {
3386
+ React37.forwardRef(function Checkbox2({ className, style: style2, colorScheme = "primary", ...props }, ref) {
3386
3387
  const { fieldId: id } = useLabel({ fieldId: props.id });
3387
3388
  return /* @__PURE__ */ React37.createElement(
3388
3389
  "div",
@@ -3407,10 +3408,10 @@ var Checkbox = React37.memo(
3407
3408
  m-0
3408
3409
  rounded
3409
3410
  bg-input-background
3410
-
3411
3411
  border
3412
3412
  border-divider
3413
3413
  disabled:opacity-50
3414
+ cursor-pointer
3414
3415
  disabled:cursor-not-allowed
3415
3416
  focus:ring-2
3416
3417
  focus:ring-primary
@@ -4202,6 +4203,10 @@ var getGridSize = (size2) => {
4202
4203
  minColumnWidth: "220px",
4203
4204
  gap: 30
4204
4205
  },
4206
+ mediumLarge: {
4207
+ minColumnWidth: "250px",
4208
+ gap: 35
4209
+ },
4205
4210
  large: {
4206
4211
  minColumnWidth: "280px",
4207
4212
  gap: 40
@@ -4439,7 +4444,7 @@ import React49, {
4439
4444
  useCallback as useCallback23,
4440
4445
  useContext as useContext11,
4441
4446
  useImperativeHandle as useImperativeHandle4,
4442
- useLayoutEffect as useLayoutEffect6,
4447
+ useLayoutEffect as useLayoutEffect5,
4443
4448
  useMemo as useMemo21,
4444
4449
  useRef as useRef19
4445
4450
  } from "react";
@@ -5158,7 +5163,7 @@ function ListViewEditableRowTitle({
5158
5163
  onKeyDown
5159
5164
  }) {
5160
5165
  const inputRef = useRef19(null);
5161
- useLayoutEffect6(() => {
5166
+ useLayoutEffect5(() => {
5162
5167
  const element = inputRef.current;
5163
5168
  if (!element || !autoFocus) return;
5164
5169
  element.focus();
@@ -5482,7 +5487,7 @@ var VirtualizedListInner = forwardRefGeneric(function VirtualizedListInner2({
5482
5487
  listRef.current?.scrollToItem(index);
5483
5488
  }
5484
5489
  }));
5485
- useLayoutEffect6(() => {
5490
+ useLayoutEffect5(() => {
5486
5491
  listRef.current?.resetAfterIndex(0);
5487
5492
  }, [
5488
5493
  // When items change, we need to re-render the virtualized list,
@@ -6116,6 +6121,7 @@ var pyMap = {
6116
6121
  xs: "py-0.5",
6117
6122
  small: "py-0.5",
6118
6123
  medium: "py-1",
6124
+ mediumLarge: "py-1.5",
6119
6125
  large: "py-2",
6120
6126
  xl: "py-3"
6121
6127
  };
@@ -6124,6 +6130,7 @@ var thumbnailSizeMap = {
6124
6130
  xs: "w-5 h-5",
6125
6131
  small: "w-5 h-5",
6126
6132
  medium: "w-8 h-8",
6133
+ mediumLarge: "w-12 h-12",
6127
6134
  large: "w-16 h-16",
6128
6135
  xl: "w-24 h-24"
6129
6136
  };
@@ -6132,6 +6139,7 @@ var rowGapMap = {
6132
6139
  xs: "gap-2",
6133
6140
  small: "gap-2",
6134
6141
  medium: "gap-3",
6142
+ mediumLarge: "gap-3",
6135
6143
  large: "gap-3",
6136
6144
  xl: "gap-4"
6137
6145
  };
@@ -6140,6 +6148,7 @@ var fontStyleMap = {
6140
6148
  xs: "font-medium text-list-small",
6141
6149
  small: "font-medium text-list-small",
6142
6150
  medium: "font-medium",
6151
+ mediumLarge: "font-medium",
6143
6152
  large: "font-medium",
6144
6153
  xl: "font-medium text-heading4 text-text"
6145
6154
  };
@@ -7099,11 +7108,8 @@ var Divider = memo20(function Divider2({
7099
7108
  "div",
7100
7109
  {
7101
7110
  className: cx(
7102
- `
7103
- h-px min-h-px
7104
- ${variant === "strong" ? "bg-divider-strong" : variant === "subtle" ? "bg-divider-subtle" : "bg-divider"}
7105
- self-stretch
7106
- `,
7111
+ `h-px min-h-px self-stretch`,
7112
+ variant === "strong" ? "bg-divider-strong" : variant === "subtle" ? "bg-divider-subtle" : "bg-divider",
7107
7113
  className
7108
7114
  ),
7109
7115
  style: {
@@ -7125,12 +7131,11 @@ var DividerVertical = memo20(function DividerVertical2({
7125
7131
  return /* @__PURE__ */ React57.createElement(
7126
7132
  "div",
7127
7133
  {
7128
- className: cx(`
7129
- w-px min-w-px
7130
- ${variant === "strong" ? "bg-divider-strong" : variant === "subtle" ? "bg-divider-subtle" : "bg-divider"}
7131
- self-stretch
7132
- ${className}
7133
- `),
7134
+ className: cx(
7135
+ `w-px min-w-px self-stretch`,
7136
+ variant === "strong" ? "bg-divider-strong" : variant === "subtle" ? "bg-divider-subtle" : "bg-divider",
7137
+ className
7138
+ ),
7134
7139
  style: {
7135
7140
  marginTop: `-${overflow}px`,
7136
7141
  marginBottom: `-${overflow}px`,
@@ -7954,14 +7959,14 @@ function useImageData(ref) {
7954
7959
  }
7955
7960
 
7956
7961
  // src/hooks/useObjectURL.ts
7957
- import { useLayoutEffect as useLayoutEffect7, useMemo as useMemo26 } from "react";
7962
+ import { useLayoutEffect as useLayoutEffect6, useMemo as useMemo26 } from "react";
7958
7963
  function useObjectURL(object) {
7959
7964
  const objectURL = useMemo26(() => {
7960
7965
  if (object instanceof Blob) return URL.createObjectURL(object);
7961
7966
  const bytes = object instanceof Uint8Array ? object : object !== void 0 ? new Uint8Array(object) : new Uint8Array();
7962
7967
  return URL.createObjectURL(new Blob([bytes]));
7963
7968
  }, [object]);
7964
- useLayoutEffect7(() => {
7969
+ useLayoutEffect6(() => {
7965
7970
  return () => URL.revokeObjectURL(objectURL);
7966
7971
  }, [objectURL]);
7967
7972
  return objectURL;
@@ -11197,6 +11202,7 @@ var iconSizeMap = {
11197
11202
  xs: 12,
11198
11203
  small: 12,
11199
11204
  medium: "max(15px, 20%)",
11205
+ mediumLarge: "max(15px, 20%)",
11200
11206
  large: "max(15px, 20%)",
11201
11207
  xl: "max(15px, 20%)"
11202
11208
  };
@@ -11451,7 +11457,7 @@ var SegmentedControlItem = forwardRef26(function SegmentedControlItem2({
11451
11457
  "font-sans text-button relative flex-1 appearance-none text-segmented-control-item focus:outline-none transition-colors",
11452
11458
  variant === "tabs" ? "font-semibold" : "font-normal",
11453
11459
  variant === "tabs" ? "" : colorScheme === "secondary" ? "focus:ring-2 focus:ring-secondary focus:ring-offset-1" : "focus:ring-2 focus:ring-primary focus:ring-offset-1",
11454
- variant === "tabs" ? "aria-checked:text-primary" : 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",
11460
+ variant === "tabs" ? "aria-checked:text-primary" : colorScheme === "secondary" ? "aria-checked:bg-secondary aria-checked:text-white" : colorScheme === "primary" ? "aria-checked:bg-primary aria-checked:text-white" : "aria-checked:bg-segmented-control-item-active-background aria-checked:text-segmented-control-item-active-text",
11455
11461
  "focus:z-interactable",
11456
11462
  variant === "default" ? "px-1 rounded aria-checked:shadow-segment" : "px-1.5 border-y-2 border-y-transparent aria-checked:border-b-primary",
11457
11463
  variant === "default" && "border-r border-divider last:border-r-0 aria-checked:border-r-transparent [&:has(+[aria-checked=true])]:border-r-transparent",
@@ -11561,7 +11567,8 @@ var SelectionToolbarContainer = memo33(
11561
11567
  zIndex: 1e3,
11562
11568
  opacity: size2 ? 1 : 0,
11563
11569
  transition: "opacity 0.2s ease-in-out",
11564
- ["--n-input-background"]: "transparent"
11570
+ [cssVarNames.colors.inputBackground]: "transparent",
11571
+ [cssVarNames.colors.buttonBackground]: "transparent"
11565
11572
  }
11566
11573
  },
11567
11574
  /* @__PURE__ */ React80.createElement(
@@ -11762,7 +11769,6 @@ var THUMB_WIDTH = 8;
11762
11769
  var thumbStyle = {
11763
11770
  width: THUMB_WIDTH
11764
11771
  };
11765
- var insetEndStyles2 = getInsetEndStyles();
11766
11772
  var Slider = memo34(function Slider2({
11767
11773
  style: style2,
11768
11774
  className,
@@ -11781,37 +11787,16 @@ var Slider = memo34(function Slider2({
11781
11787
  () => [Math.min(Math.max(value, min), max)],
11782
11788
  [value, min, max]
11783
11789
  );
11784
- const { label, fieldId: id } = useLabel({
11785
- label: props.label,
11790
+ const { fieldId: id } = useLabel({
11786
11791
  fieldId: props.id
11787
11792
  });
11788
- const labelPosition = useLabelPosition();
11789
11793
  const handleValueChange = useCallback31(
11790
11794
  (arrayValue2) => {
11791
11795
  onValueChange(arrayValue2[0]);
11792
11796
  },
11793
11797
  [onValueChange]
11794
11798
  );
11795
- const percentage = useMemo38(() => {
11796
- const rawPercent = (arrayValue[0] - min) / (max - min);
11797
- const adjustedPercent = rawPercent * (100 - THUMB_WIDTH * 100 / 300) + THUMB_WIDTH * 50 / 300;
11798
- return {
11799
- raw: rawPercent * 100,
11800
- adjusted: adjustedPercent
11801
- };
11802
- }, [arrayValue, min, max]);
11803
- const trackFillStyle = useMemo38(
11804
- () => ({
11805
- clipPath: `inset(0 ${100 - percentage.adjusted}% 0 0)`
11806
- }),
11807
- [percentage.adjusted]
11808
- );
11809
- const labelStyle = useMemo38(
11810
- () => ({
11811
- clipPath: `inset(0 ${100 - percentage.raw}% 0 0)`
11812
- }),
11813
- [percentage.raw]
11814
- );
11799
+ const ratio = (arrayValue[0] - min) / (max - min);
11815
11800
  return /* @__PURE__ */ React82.createElement(
11816
11801
  RadixSlider.Root,
11817
11802
  {
@@ -11822,7 +11807,7 @@ var Slider = memo34(function Slider2({
11822
11807
  value: arrayValue,
11823
11808
  onValueChange: handleValueChange,
11824
11809
  className: cx(
11825
- "flex relative items-center select-none touch-none h-input-height rounded overflow-hidden flex-grow max-h-input-height",
11810
+ "flex relative items-center select-none touch-none h-input-height rounded flex-grow max-h-input-height cursor-pointer",
11826
11811
  className
11827
11812
  ),
11828
11813
  style: style2,
@@ -11830,24 +11815,33 @@ var Slider = memo34(function Slider2({
11830
11815
  onBlur,
11831
11816
  disabled: readOnly
11832
11817
  },
11833
- /* @__PURE__ */ React82.createElement(RadixSlider.Track, { className: "flex-grow h-full rounded overflow-hidden bg-input-background" }, label && labelPosition === "inset" && /* @__PURE__ */ React82.createElement("div", { className: insetEndStyles2 }, /* @__PURE__ */ React82.createElement(Label, { htmlFor: id, className: "text-text-disabled" }, label)), /* @__PURE__ */ React82.createElement(
11818
+ /* @__PURE__ */ React82.createElement("div", { className: "relative flex-grow h-[3px] overflow-hidden" }, /* @__PURE__ */ React82.createElement(
11834
11819
  "div",
11835
11820
  {
11836
- style: trackFillStyle,
11837
- className: cx(
11838
- "absolute inset-0 w-full h-full rounded overflow-hidden bg-primary-pastel",
11839
- colorScheme === "primary" && "bg-primary",
11840
- colorScheme === "secondary" && "bg-secondary"
11841
- )
11821
+ className: "absolute h-full rounded-l bg-primary",
11822
+ style: {
11823
+ left: 0,
11824
+ width: `calc(${ratio * 100}% - ${ratio * 8}px - 2px)`
11825
+ }
11826
+ }
11827
+ ), /* @__PURE__ */ React82.createElement(
11828
+ "div",
11829
+ {
11830
+ className: "absolute h-full rounded-r bg-input-background",
11831
+ style: {
11832
+ right: 0,
11833
+ width: `calc(100% - ${ratio * 100}% + ${ratio * 8}px - 10px)`
11834
+ }
11842
11835
  }
11843
11836
  )),
11844
- label && labelPosition === "inset" && colorScheme !== void 0 && /* @__PURE__ */ React82.createElement("div", { className: insetEndStyles2 }, /* @__PURE__ */ React82.createElement(Label, { className: "text-white overflow-hidden", style: labelStyle }, label)),
11845
11837
  /* @__PURE__ */ React82.createElement(
11846
11838
  RadixSlider.Thumb,
11847
11839
  {
11848
11840
  style: thumbStyle,
11849
11841
  className: cx(
11850
- "block h-input-height rounded border border-solid bg-slider-thumb-background transition-colors focus:border-primary focus:border-2 outline-none",
11842
+ "block h-[21px] rounded-sm bg-slider-thumb-background shadow-sliderThumb transition-colors focus:outline-primary focus:outline-2",
11843
+ "cursor-ew-resize",
11844
+ // "outline-none outline outline-2 outline-offset-[0px] outline-background",
11851
11845
  colorScheme === void 0 && "border-slider-border",
11852
11846
  colorScheme === "primary" && "border-primary",
11853
11847
  colorScheme === "secondary" && "border-secondary"
@@ -12078,10 +12072,10 @@ function useWindowSize() {
12078
12072
  }
12079
12073
 
12080
12074
  // src/components/workspace/DrawerWorkspaceLayout.tsx
12081
- import React87, { memo as memo36, useLayoutEffect as useLayoutEffect10, useRef as useRef26, useState as useState30 } from "react";
12075
+ import React87, { memo as memo36, useLayoutEffect as useLayoutEffect9, useRef as useRef26, useState as useState30 } from "react";
12082
12076
 
12083
12077
  // src/hooks/usePreservePanelSize.tsx
12084
- import { useLayoutEffect as useLayoutEffect9, useRef as useRef25 } from "react";
12078
+ import { useLayoutEffect as useLayoutEffect8, useRef as useRef25 } from "react";
12085
12079
  var EDITOR_PANEL_GROUP_ID = "editor-panel-group";
12086
12080
  var LEFT_SIDEBAR_ID = "editor-left-sidebar";
12087
12081
  var RIGHT_SIDEBAR_ID = "editor-right-sidebar";
@@ -12089,7 +12083,7 @@ var CONTENT_AREA_ID = "editor-content-area";
12089
12083
  function usePreservePanelSize(panelGroupRef, setPanelLayoutState) {
12090
12084
  const windowSize = useWindowSize();
12091
12085
  const layoutRef = useRef25();
12092
- useLayoutEffect9(() => {
12086
+ useLayoutEffect8(() => {
12093
12087
  const panelGroup = document.querySelector(
12094
12088
  `[data-panel-group-id="${EDITOR_PANEL_GROUP_ID}"]`
12095
12089
  );
@@ -12132,7 +12126,7 @@ function usePreservePanelSize(panelGroupRef, setPanelLayoutState) {
12132
12126
  panelGroupObserver.disconnect();
12133
12127
  };
12134
12128
  }, [panelGroupRef, setPanelLayoutState]);
12135
- useLayoutEffect9(() => {
12129
+ useLayoutEffect8(() => {
12136
12130
  if (!layoutRef.current) return;
12137
12131
  const {
12138
12132
  windowWidth: oldWindowWidth,
@@ -12229,7 +12223,7 @@ var DrawerWorkspaceLayout = memo36(function DrawerWorkspaceLayout2({
12229
12223
  }) {
12230
12224
  const portalContainer = useRef26(null);
12231
12225
  const [mounted, setMounted] = useState30(false);
12232
- useLayoutEffect10(() => {
12226
+ useLayoutEffect9(() => {
12233
12227
  if (mounted) return;
12234
12228
  setMounted(true);
12235
12229
  handleChangeLayoutState({
@@ -12851,6 +12845,7 @@ var LabeledRow = memo40(function LabeledRow2({
12851
12845
  // src/components/BaseToolbar.tsx
12852
12846
  import React92 from "react";
12853
12847
  var toolbarStyle = {
12848
+ [cssVarNames.colors.buttonBackground]: "transparent",
12854
12849
  [cssVarNames.colors.inputBackground]: "transparent"
12855
12850
  };
12856
12851
  function BaseToolbar({