@noya-app/noya-designsystem 0.1.46 → 0.1.47

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
@@ -3324,17 +3324,6 @@ var StyledDescription = forwardRef11(({ className, ...props }, ref) => /* @__PUR
3324
3324
  ...props
3325
3325
  }
3326
3326
  ));
3327
- var CloseButtonContainer = forwardRef11(({ className, ...props }, ref) => /* @__PURE__ */ React21.createElement(
3328
- "div",
3329
- {
3330
- ref,
3331
- className: cx(
3332
- `absolute top-dialog-padding right-dialog-padding z-[1] bg-popover-background p-[4px_6px] rounded-[2px] border border-[rgba(128,128,128,0.2)] `,
3333
- className
3334
- ),
3335
- ...props
3336
- }
3337
- ));
3338
3327
  var Dialog = forwardRef11(function Dialog2({
3339
3328
  children: children2,
3340
3329
  title,
@@ -3366,7 +3355,18 @@ var Dialog = forwardRef11(function Dialog2({
3366
3355
  onInteractOutside: (event) => event.preventDefault()
3367
3356
  }
3368
3357
  },
3369
- showCloseButton && /* @__PURE__ */ React21.createElement(CloseButtonContainer, null, /* @__PURE__ */ React21.createElement(DialogPrimitive.Close, { asChild: true }, /* @__PURE__ */ React21.createElement(IconButton, { iconName: "Cross1Icon" }))),
3358
+ showCloseButton && /* @__PURE__ */ React21.createElement(DialogPrimitive.Close, { asChild: true }, /* @__PURE__ */ React21.createElement(
3359
+ IconButton,
3360
+ {
3361
+ iconName: "Cross1Icon",
3362
+ className: "z-[1]",
3363
+ style: {
3364
+ position: "absolute",
3365
+ top: "var(--dialog-padding)",
3366
+ right: "var(--dialog-padding)"
3367
+ }
3368
+ }
3369
+ )),
3370
3370
  title && /* @__PURE__ */ React21.createElement(React21.Fragment, null, /* @__PURE__ */ React21.createElement(StyledTitle, null, title), /* @__PURE__ */ React21.createElement(Spacer.Vertical, { size: description ? 10 : 20 })),
3371
3371
  description && /* @__PURE__ */ React21.createElement(React21.Fragment, null, /* @__PURE__ */ React21.createElement(Spacer.Vertical, { size: 10 }), /* @__PURE__ */ React21.createElement(StyledDescription, null, description), /* @__PURE__ */ React21.createElement(Spacer.Vertical, { size: 20 })),
3372
3372
  children2
@@ -4556,6 +4556,23 @@ var DialogProvider = function DialogProvider2({
4556
4556
  });
4557
4557
  return promise;
4558
4558
  }, []);
4559
+ const openCustomDialog = useCallback15(
4560
+ (options) => {
4561
+ const { promise, resolve } = createDeferredPromise();
4562
+ setContents({
4563
+ type: "custom",
4564
+ title: options.title,
4565
+ description: options.description,
4566
+ children: options.children,
4567
+ resolve: () => {
4568
+ resolve();
4569
+ setContents(void 0);
4570
+ }
4571
+ });
4572
+ return promise;
4573
+ },
4574
+ []
4575
+ );
4559
4576
  const handleKeyDown = useCallback15(
4560
4577
  (event) => {
4561
4578
  if (event.key !== "Enter") return;
@@ -4576,11 +4593,12 @@ var DialogProvider = function DialogProvider2({
4576
4593
  {
4577
4594
  value: useMemo11(
4578
4595
  () => ({
4596
+ openDialog: openCustomDialog,
4579
4597
  openInputDialog: open,
4580
4598
  openConfirmationDialog: openConfirmation,
4581
4599
  containsElement
4582
4600
  }),
4583
- [containsElement, open, openConfirmation]
4601
+ [containsElement, open, openConfirmation, openCustomDialog]
4584
4602
  )
4585
4603
  },
4586
4604
  children2
@@ -4631,11 +4649,11 @@ var DialogProvider = function DialogProvider2({
4631
4649
  }
4632
4650
  },
4633
4651
  "OK"
4634
- )) : /* @__PURE__ */ React29.createElement(React29.Fragment, null, /* @__PURE__ */ React29.createElement(InputField.Root, null, /* @__PURE__ */ React29.createElement(
4652
+ )) : contents?.type === "custom" ? /* @__PURE__ */ React29.createElement(React29.Fragment, null, contents.children) : /* @__PURE__ */ React29.createElement(React29.Fragment, null, /* @__PURE__ */ React29.createElement(InputField.Root, null, /* @__PURE__ */ React29.createElement(
4635
4653
  InputField.Input,
4636
4654
  {
4637
4655
  ref: inputRef,
4638
- placeholder: contents?.placeholder,
4656
+ placeholder: contents?.type === "input" ? contents.placeholder : void 0,
4639
4657
  value: contents?.type === "input" ? contents.inputValue : "",
4640
4658
  onChange: (value) => {
4641
4659
  setContents(
@@ -4657,7 +4675,7 @@ var DialogProvider = function DialogProvider2({
4657
4675
  )))
4658
4676
  ));
4659
4677
  };
4660
- function useDialog() {
4678
+ function useDialogContext() {
4661
4679
  const value = useContext3(DialogContext);
4662
4680
  if (!value) {
4663
4681
  throw new Error("Missing DialogProvider");
@@ -4665,13 +4683,16 @@ function useDialog() {
4665
4683
  return value;
4666
4684
  }
4667
4685
  function useOpenInputDialog() {
4668
- return useDialog().openInputDialog;
4686
+ return useDialogContext().openInputDialog;
4669
4687
  }
4670
4688
  function useDialogContainsElement() {
4671
- return useDialog().containsElement;
4689
+ return useDialogContext().containsElement;
4672
4690
  }
4673
4691
  function useOpenConfirmationDialog() {
4674
- return useDialog().openConfirmationDialog;
4692
+ return useDialogContext().openConfirmationDialog;
4693
+ }
4694
+ function useOpenDialog() {
4695
+ return useDialogContext().openDialog;
4675
4696
  }
4676
4697
 
4677
4698
  // src/contexts/FloatingWindowContext.tsx
@@ -14563,7 +14584,7 @@ var SearchCompletionMenu = forwardRef16(function SearchCompletionMenu2({
14563
14584
  borderRadius: 0,
14564
14585
  outline: "none",
14565
14586
  boxShadow: "none",
14566
- backgroundColor: "white",
14587
+ backgroundColor: cssVars.colors.inputBackground,
14567
14588
  padding: "4px 12px"
14568
14589
  },
14569
14590
  onChange: setSearch,
@@ -16388,7 +16409,7 @@ var Switch = function Switch2({
16388
16409
  onChange(newValue);
16389
16410
  },
16390
16411
  className: cx(
16391
- "all-unset w-8 h-[19px] bg-active-background rounded-full relative cursor-pointer [webkit-tap-highlight-color:rgba(0,0,0,0)] focus:ring-2 focus:ring-primary focus:ring-offset-[1px] outline-none data-[state=checked]:bg-primary transition-all",
16412
+ "all-unset w-8 h-[19px] bg-active-background rounded-full relative cursor-pointer ring-offset-background [webkit-tap-highlight-color:rgba(0,0,0,0)] focus:ring-2 focus:ring-primary focus:ring-offset-[1px] outline-none data-[state=checked]:bg-primary transition-all",
16392
16413
  colorScheme === "secondary" && "data-[state=checked]:bg-secondary",
16393
16414
  "focus:z-interactable",
16394
16415
  className
@@ -17481,6 +17502,7 @@ export {
17481
17502
  useCurrentFloatingWindowInternal,
17482
17503
  useDesignSystemConfiguration,
17483
17504
  useDialogContainsElement,
17505
+ useDialogContext,
17484
17506
  useFloatingWindowManager,
17485
17507
  useGlobalInputBlur,
17486
17508
  useGlobalInputBlurListener,
@@ -17493,6 +17515,7 @@ export {
17493
17515
  useLabelPosition,
17494
17516
  useLabelWidth,
17495
17517
  useOpenConfirmationDialog,
17518
+ useOpenDialog,
17496
17519
  useOpenInputDialog,
17497
17520
  usePlatform,
17498
17521
  usePlatformModKey,