@webstudio-is/sdk-components-react-radix 0.95.0 → 0.97.0

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.
Files changed (63) hide show
  1. package/lib/components.js +278 -35
  2. package/lib/hooks.js +475 -11
  3. package/lib/metas.js +4616 -58
  4. package/lib/props.js +23280 -57
  5. package/lib/types/theme/tailwind-classes.d.ts +4 -4
  6. package/package.json +9 -9
  7. package/lib/__generated__/accordion.props.js +0 -2619
  8. package/lib/__generated__/checkbox.props.js +0 -1080
  9. package/lib/__generated__/collapsible.props.js +0 -1026
  10. package/lib/__generated__/dialog.props.js +0 -2595
  11. package/lib/__generated__/label.props.js +0 -519
  12. package/lib/__generated__/navigation-menu.props.js +0 -2557
  13. package/lib/__generated__/popover.props.js +0 -558
  14. package/lib/__generated__/radio-group.props.js +0 -1623
  15. package/lib/__generated__/select.props.js +0 -3674
  16. package/lib/__generated__/sheet.props.js +0 -2614
  17. package/lib/__generated__/switch.props.js +0 -1080
  18. package/lib/__generated__/tabs.props.js +0 -2119
  19. package/lib/__generated__/tooltip.props.js +0 -569
  20. package/lib/accordion.js +0 -51
  21. package/lib/accordion.stories.js +0 -18
  22. package/lib/accordion.ws.js +0 -259
  23. package/lib/checkbox.js +0 -10
  24. package/lib/checkbox.stories.js +0 -19
  25. package/lib/checkbox.ws.js +0 -148
  26. package/lib/collapsible.js +0 -31
  27. package/lib/collapsible.stories.js +0 -18
  28. package/lib/collapsible.ws.js +0 -103
  29. package/lib/dialog.js +0 -53
  30. package/lib/dialog.stories.js +0 -18
  31. package/lib/dialog.ws.js +0 -289
  32. package/lib/label.js +0 -7
  33. package/lib/label.stories.js +0 -19
  34. package/lib/label.ws.js +0 -44
  35. package/lib/navigation-menu.js +0 -76
  36. package/lib/navigation-menu.stories.js +0 -18
  37. package/lib/navigation-menu.ws.js +0 -486
  38. package/lib/popover.js +0 -58
  39. package/lib/popover.stories.js +0 -18
  40. package/lib/popover.ws.js +0 -110
  41. package/lib/props-descriptions.js +0 -34
  42. package/lib/radio-group.js +0 -7
  43. package/lib/radio-group.stories.js +0 -19
  44. package/lib/radio-group.ws.js +0 -166
  45. package/lib/select.js +0 -65
  46. package/lib/select.stories.js +0 -18
  47. package/lib/select.ws.js +0 -321
  48. package/lib/sheet.js +0 -59
  49. package/lib/sheet.stories.js +0 -18
  50. package/lib/sheet.ws.js +0 -225
  51. package/lib/switch.js +0 -4
  52. package/lib/switch.stories.js +0 -19
  53. package/lib/switch.ws.js +0 -140
  54. package/lib/tabs.js +0 -38
  55. package/lib/tabs.stories.js +0 -18
  56. package/lib/tabs.ws.js +0 -169
  57. package/lib/theme/__generated__/tailwind-theme.js +0 -517
  58. package/lib/theme/styles.js +0 -63
  59. package/lib/theme/tailwind-classes.js +0 -651
  60. package/lib/theme/tailwind-colors.js +0 -23
  61. package/lib/tooltip.js +0 -55
  62. package/lib/tooltip.stories.js +0 -18
  63. package/lib/tooltip.ws.js +0 -111
package/lib/tooltip.js DELETED
@@ -1,55 +0,0 @@
1
- "use strict";
2
- import { jsx } from "react/jsx-runtime";
3
- import * as TooltipPrimitive from "@radix-ui/react-tooltip";
4
- import { getClosestInstance } from "@webstudio-is/react-sdk";
5
- import {
6
- forwardRef,
7
- Children
8
- } from "react";
9
- export const Tooltip = forwardRef((props, _ref) => {
10
- return /* @__PURE__ */ jsx(TooltipPrimitive.Provider, { children: /* @__PURE__ */ jsx(TooltipPrimitive.Root, { ...props }) });
11
- });
12
- export const TooltipTrigger = forwardRef(({ children, ...props }, ref) => {
13
- const firstChild = Children.toArray(children)[0];
14
- return /* @__PURE__ */ jsx(TooltipPrimitive.Trigger, { asChild: true, ref, ...props, children: firstChild ?? /* @__PURE__ */ jsx("button", { children: "Add button or link" }) });
15
- });
16
- export const TooltipContent = forwardRef(({ sideOffset = 4, hideWhenDetached = true, ...props }, ref) => /* @__PURE__ */ jsx(TooltipPrimitive.Portal, { children: /* @__PURE__ */ jsx(
17
- TooltipPrimitive.Content,
18
- {
19
- ref,
20
- hideWhenDetached,
21
- sideOffset,
22
- ...props
23
- }
24
- ) }));
25
- const namespace = "@webstudio-is/sdk-components-react-radix";
26
- export const hooksTooltip = {
27
- onNavigatorUnselect: (context, event) => {
28
- for (const instance of event.instancePath) {
29
- if (instance.component === `${namespace}:TooltipContent`) {
30
- const tooltip = getClosestInstance(
31
- event.instancePath,
32
- instance,
33
- `${namespace}:Tooltip`
34
- );
35
- if (tooltip) {
36
- context.setPropVariable(tooltip.id, "open", false);
37
- }
38
- }
39
- }
40
- },
41
- onNavigatorSelect: (context, event) => {
42
- for (const instance of event.instancePath) {
43
- if (instance.component === `${namespace}:TooltipContent`) {
44
- const tooltip = getClosestInstance(
45
- event.instancePath,
46
- instance,
47
- `${namespace}:Tooltip`
48
- );
49
- if (tooltip) {
50
- context.setPropVariable(tooltip.id, "open", true);
51
- }
52
- }
53
- }
54
- }
55
- };
@@ -1,18 +0,0 @@
1
- "use strict";
2
- import { renderComponentTemplate } from "@webstudio-is/react-sdk";
3
- import { Tooltip as TooltipPrimitive } from "./tooltip";
4
- import * as baseComponents from "@webstudio-is/sdk-components-react";
5
- import * as baseMetas from "@webstudio-is/sdk-components-react/metas";
6
- import * as radixComponents from "./components";
7
- import * as radixMetas from "./metas";
8
- export default {
9
- title: "Components/Tooltip",
10
- component: TooltipPrimitive
11
- };
12
- export const Tooltip = {
13
- render: () => renderComponentTemplate({
14
- name: "Tooltip",
15
- components: { ...baseComponents, ...radixComponents },
16
- metas: { ...baseMetas, ...radixMetas }
17
- })
18
- };
package/lib/tooltip.ws.js DELETED
@@ -1,111 +0,0 @@
1
- "use strict";
2
- import { TooltipIcon, TriggerIcon, ContentIcon } from "@webstudio-is/icons/svg";
3
- import {
4
- } from "@webstudio-is/react-sdk";
5
- import { div } from "@webstudio-is/react-sdk/css-normalize";
6
- import * as tc from "./theme/tailwind-classes";
7
- import {
8
- propsTooltip,
9
- propsTooltipContent,
10
- propsTooltipTrigger
11
- } from "./__generated__/tooltip.props";
12
- import { getButtonStyles } from "./theme/styles";
13
- const presetStyle = {
14
- div
15
- };
16
- export const metaTooltipTrigger = {
17
- category: "hidden",
18
- detachable: false,
19
- type: "container",
20
- icon: TriggerIcon,
21
- stylable: false
22
- };
23
- export const metaTooltipContent = {
24
- category: "hidden",
25
- detachable: false,
26
- type: "container",
27
- presetStyle,
28
- icon: ContentIcon
29
- };
30
- export const metaTooltip = {
31
- category: "radix",
32
- order: 7,
33
- type: "container",
34
- icon: TooltipIcon,
35
- stylable: false,
36
- description: "Displays content that is related to the trigger, when the trigger is hovered with the mouse or focused with the keyboard. You are reading an example of a tooltip right now.",
37
- template: [
38
- {
39
- type: "instance",
40
- component: "Tooltip",
41
- dataSources: {
42
- tooltipOpen: { type: "variable", initialValue: false }
43
- },
44
- props: [
45
- {
46
- type: "dataSource",
47
- name: "open",
48
- dataSourceName: "tooltipOpen"
49
- },
50
- {
51
- name: "onOpenChange",
52
- type: "action",
53
- value: [
54
- { type: "execute", args: ["open"], code: `tooltipOpen = open` }
55
- ]
56
- }
57
- ],
58
- children: [
59
- {
60
- type: "instance",
61
- component: "TooltipTrigger",
62
- children: [
63
- {
64
- type: "instance",
65
- component: "Button",
66
- styles: getButtonStyles("outline"),
67
- children: [{ type: "text", value: "Button" }]
68
- }
69
- ]
70
- },
71
- {
72
- type: "instance",
73
- component: "TooltipContent",
74
- /**
75
- * z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md
76
- **/
77
- styles: [
78
- tc.z(50),
79
- tc.overflow("hidden"),
80
- tc.rounded("md"),
81
- tc.border(),
82
- tc.bg("popover"),
83
- tc.px(3),
84
- tc.py(1.5),
85
- tc.text("sm"),
86
- tc.text("popoverForeground"),
87
- tc.shadow("md")
88
- ].flat(),
89
- children: [
90
- {
91
- type: "instance",
92
- component: "Text",
93
- children: [{ type: "text", value: "The text you can edit" }]
94
- }
95
- ]
96
- }
97
- ]
98
- }
99
- ]
100
- };
101
- export const propsMetaTooltip = {
102
- props: propsTooltip,
103
- initialProps: ["open", "delayDuration", "disableHoverableContent"]
104
- };
105
- export const propsMetaTooltipTrigger = {
106
- props: propsTooltipTrigger
107
- };
108
- export const propsMetaTooltipContent = {
109
- props: propsTooltipContent,
110
- initialProps: ["side", "sideOffset", "align", "alignOffset"]
111
- };