@webstudio-is/sdk-components-react-radix 0.195.0 → 0.197.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 (88) hide show
  1. package/lib/__generated__/select.props.js +6 -0
  2. package/lib/__generated__/tabs.props.js +2 -2
  3. package/lib/accordion.template.js +95 -0
  4. package/lib/accordion.ws.js +53 -205
  5. package/lib/checkbox.template.js +63 -0
  6. package/lib/checkbox.ws.js +22 -119
  7. package/lib/collapsible.template.js +16 -0
  8. package/lib/collapsible.ws.js +21 -71
  9. package/lib/dialog.template.js +119 -0
  10. package/lib/dialog.ws.js +60 -237
  11. package/lib/label.template.js +23 -0
  12. package/lib/label.ws.js +12 -36
  13. package/lib/metas.js +48 -50
  14. package/lib/navigation-menu.template.js +283 -0
  15. package/lib/navigation-menu.ws.js +54 -420
  16. package/lib/popover.template.js +33 -0
  17. package/lib/popover.ws.js +19 -79
  18. package/lib/radio-group.template.js +66 -0
  19. package/lib/radio-group.ws.js +27 -125
  20. package/lib/select.template.js +121 -0
  21. package/lib/select.ws.js +61 -262
  22. package/lib/shared/preset-styles.js +38 -0
  23. package/lib/shared/proxy.js +5 -0
  24. package/lib/shared/styles.js +51 -0
  25. package/lib/shared/theme.js +162 -0
  26. package/lib/sheet.template.js +129 -0
  27. package/lib/switch.js +1 -1
  28. package/lib/switch.template.js +63 -0
  29. package/lib/switch.ws.js +22 -106
  30. package/lib/tabs.template.js +66 -0
  31. package/lib/tabs.ws.js +36 -131
  32. package/lib/templates.js +28 -0
  33. package/lib/tooltip.template.js +33 -0
  34. package/lib/tooltip.ws.js +24 -84
  35. package/lib/types/__generated__/accordion.props.d.ts +1 -1
  36. package/lib/types/__generated__/checkbox.props.d.ts +1 -1
  37. package/lib/types/__generated__/collapsible.props.d.ts +1 -1
  38. package/lib/types/__generated__/dialog.props.d.ts +1 -1
  39. package/lib/types/__generated__/label.props.d.ts +1 -1
  40. package/lib/types/__generated__/navigation-menu.props.d.ts +1 -1
  41. package/lib/types/__generated__/popover.props.d.ts +1 -1
  42. package/lib/types/__generated__/radio-group.props.d.ts +1 -1
  43. package/lib/types/__generated__/select.props.d.ts +1 -1
  44. package/lib/types/__generated__/switch.props.d.ts +1 -1
  45. package/lib/types/__generated__/tabs.props.d.ts +1 -1
  46. package/lib/types/__generated__/tooltip.props.d.ts +1 -1
  47. package/lib/types/accordion.template.d.ts +10 -0
  48. package/lib/types/accordion.ws.d.ts +1 -1
  49. package/lib/types/checkbox.d.ts +1 -1
  50. package/lib/types/checkbox.template.d.ts +2 -0
  51. package/lib/types/checkbox.ws.d.ts +1 -1
  52. package/lib/types/collapsible.template.d.ts +2 -0
  53. package/lib/types/collapsible.ws.d.ts +1 -1
  54. package/lib/types/dialog.template.d.ts +10 -0
  55. package/lib/types/dialog.ws.d.ts +1 -9
  56. package/lib/types/label.template.d.ts +10 -0
  57. package/lib/types/label.ws.d.ts +1 -1
  58. package/lib/types/metas.d.ts +0 -1
  59. package/lib/types/navigation-menu.template.d.ts +2 -0
  60. package/lib/types/navigation-menu.ws.d.ts +1 -1
  61. package/lib/types/popover.template.d.ts +10 -0
  62. package/lib/types/popover.ws.d.ts +1 -9
  63. package/lib/types/radio-group.template.d.ts +2 -0
  64. package/lib/types/radio-group.ws.d.ts +1 -1
  65. package/lib/types/select.template.d.ts +2 -0
  66. package/lib/types/select.ws.d.ts +1 -1
  67. package/lib/types/shared/preset-styles.d.ts +2 -0
  68. package/lib/types/shared/proxy.d.ts +17 -0
  69. package/lib/types/shared/styles.d.ts +2 -0
  70. package/lib/types/shared/theme.d.ts +212 -0
  71. package/lib/types/{sheet.ws.d.ts → sheet.template.d.ts} +2 -2
  72. package/lib/types/switch.template.d.ts +2 -0
  73. package/lib/types/switch.ws.d.ts +1 -1
  74. package/lib/types/tabs.template.d.ts +2 -0
  75. package/lib/types/tabs.ws.d.ts +1 -1
  76. package/lib/types/templates.d.ts +13 -0
  77. package/lib/types/tooltip.template.d.ts +10 -0
  78. package/lib/types/tooltip.ws.d.ts +1 -9
  79. package/package.json +26 -23
  80. package/lib/sheet.ws.js +0 -217
  81. package/lib/theme/__generated__/tailwind-theme.js +0 -503
  82. package/lib/theme/styles.js +0 -52
  83. package/lib/theme/tailwind-classes.js +0 -474
  84. package/lib/types/__generated__/sheet.props.d.ts +0 -8
  85. package/lib/types/theme/__generated__/tailwind-theme.d.ts +0 -26
  86. package/lib/types/theme/styles.d.ts +0 -278
  87. package/lib/types/theme/tailwind-classes.d.ts +0 -104
  88. package/lib/types/theme/tailwind-colors.d.ts +0 -31
@@ -0,0 +1,66 @@
1
+ import { jsxs as l, jsx as o } from "react/jsx-runtime";
2
+ import { css as t, $ as a, PlaceholderValue as n } from "@webstudio-is/template";
3
+ import { DotIcon as m } from "@webstudio-is/icons/svg";
4
+ import { radix as e } from "./shared/proxy.js";
5
+ import { spacing as d, height as p, width as b, borderRadius as h, borderWidth as u, colors as i, boxShadow as f, opacity as w } from "./shared/theme.js";
6
+ const r = ({
7
+ value: c,
8
+ label: s
9
+ }) => /* @__PURE__ */ l(
10
+ e.Label,
11
+ {
12
+ "ws:style": t`
13
+ display: flex;
14
+ align-items: center;
15
+ gap: ${d[2]};
16
+ `,
17
+ children: [
18
+ /* @__PURE__ */ o(
19
+ e.RadioGroupItem,
20
+ {
21
+ value: c,
22
+ "ws:style": t`
23
+ aspect-ratio: 1 / 1;
24
+ height: ${p[4]};
25
+ width: ${b[4]};
26
+ border-radius: ${h.full};
27
+ border: ${u.DEFAULT} solid ${i.primary};
28
+ color: ${i.primary};
29
+ &:focus-visible {
30
+ outline: none;
31
+ box-shadow: ${f.ring};
32
+ }
33
+ &:disabled {
34
+ cursor: not-allowed;
35
+ opacity: ${w[50]};
36
+ }
37
+ `,
38
+ children: /* @__PURE__ */ o(e.RadioGroupIndicator, { children: /* @__PURE__ */ o(a.HtmlEmbed, { "ws:label": "Indicator Icon", code: m }) })
39
+ }
40
+ ),
41
+ /* @__PURE__ */ o(a.Text, { children: new n(s) })
42
+ ]
43
+ }
44
+ ), R = {
45
+ category: "radix",
46
+ order: 100,
47
+ description: "A set of checkable buttons—known as radio buttons—where no more than one of the buttons can be checked at a time.",
48
+ template: /* @__PURE__ */ l(
49
+ e.RadioGroup,
50
+ {
51
+ "ws:style": t`
52
+ display: flex;
53
+ flex-direction: column;
54
+ gap: ${d[2]};
55
+ `,
56
+ children: [
57
+ r({ value: "default", label: "Default" }),
58
+ r({ value: "comfortable", label: "Comfortable" }),
59
+ r({ value: "compact", label: "Compact" })
60
+ ]
61
+ }
62
+ )
63
+ };
64
+ export {
65
+ R as meta
66
+ };
@@ -1,77 +1,15 @@
1
- import { RadioCheckedIcon as p, ItemIcon as i, TriggerIcon as s, RadioDotIcon as l } from "@webstudio-is/icons/svg";
2
- import { defaultStates as o } from "@webstudio-is/react-sdk";
3
- import { div as d, button as u, span as m } from "@webstudio-is/sdk/normalize.css";
4
- import { flex as t, gap as n, items as y, aspect as b, h as f, w as h, rounded as G, border as a, text as R, focusVisible as I, outline as g, ring as v, disabled as k, cursor as x, opacity as q } from "./theme/tailwind-classes.js";
5
- import { buttonReset as V } from "./theme/styles.js";
6
- import { propsRadioGroup as C, propsRadioGroupItem as w, propsRadioGroupIndicator as S } from "./__generated__/radio-group.props.js";
7
- const e = ({
8
- value: r,
9
- label: c
10
- }) => ({
11
- type: "instance",
12
- component: "Label",
13
- // flex items-center space-x-2
14
- styles: [t(), y("center"), n(2)].flat(),
15
- children: [
16
- {
17
- type: "instance",
18
- component: "RadioGroupItem",
19
- props: [{ name: "value", type: "string", value: r }],
20
- // aspect-square h-4 w-4 rounded-full border border-primary text-primary ring-offset-background
21
- // focus:outline-none
22
- // focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2
23
- // disabled:cursor-not-allowed disabled:opacity-50
24
- styles: [
25
- b("square"),
26
- f(4),
27
- h(4),
28
- G("full"),
29
- a(),
30
- a("primary"),
31
- R("primary"),
32
- I(
33
- [g(), v("ring", 2, "background", 2)].flat()
34
- ),
35
- k([x("not-allowed"), q(50)].flat())
36
- ].flat(),
37
- children: [
38
- {
39
- type: "instance",
40
- component: "RadioGroupIndicator",
41
- children: [
42
- {
43
- type: "instance",
44
- component: "HtmlEmbed",
45
- label: "Indicator Icon",
46
- props: [
47
- {
48
- type: "string",
49
- name: "code",
50
- value: l
51
- }
52
- ],
53
- children: []
54
- }
55
- ]
56
- }
57
- ]
58
- },
59
- {
60
- type: "instance",
61
- component: "Text",
62
- children: [{ type: "text", value: c, placeholder: !0 }]
63
- }
64
- ]
65
- }), E = {
66
- category: "radix",
67
- order: 100,
1
+ import { RadioGroupIcon as t, ItemIcon as e, TriggerIcon as a } from "@webstudio-is/icons/svg";
2
+ import { defaultStates as o } from "@webstudio-is/sdk";
3
+ import { div as r, button as n, span as p } from "@webstudio-is/sdk/normalize.css";
4
+ import { buttonReset as s } from "./shared/preset-styles.js";
5
+ import { propsRadioGroup as i, propsRadioGroupItem as c, propsRadioGroupIndicator as d } from "./__generated__/radio-group.props.js";
6
+ const I = {
68
7
  type: "container",
69
8
  constraints: {
70
9
  relation: "descendant",
71
10
  component: { $eq: "RadioGroupItem" }
72
11
  },
73
- description: "A set of checkable buttons—known as radio buttons—where no more than one of the buttons can be checked at a time.",
74
- icon: p,
12
+ icon: t,
75
13
  states: [
76
14
  ...o,
77
15
  {
@@ -86,44 +24,9 @@ const e = ({
86
24
  }
87
25
  ],
88
26
  presetStyle: {
89
- div: d
90
- },
91
- template: [
92
- {
93
- type: "instance",
94
- component: "RadioGroup",
95
- variables: {
96
- radioGroupValue: { initialValue: "" }
97
- },
98
- // grid gap-2
99
- styles: [t(), t("col"), n(2)].flat(),
100
- props: [
101
- {
102
- type: "expression",
103
- name: "value",
104
- code: "radioGroupValue"
105
- },
106
- {
107
- name: "onValueChange",
108
- type: "action",
109
- value: [
110
- {
111
- type: "execute",
112
- args: ["value"],
113
- code: "radioGroupValue = value"
114
- }
115
- ]
116
- }
117
- ],
118
- children: [
119
- e({ value: "default", label: "Default" }),
120
- e({ value: "comfortable", label: "Comfortable" }),
121
- e({ value: "compact", label: "Compact" })
122
- ]
123
- }
124
- ]
125
- }, H = {
126
- category: "hidden",
27
+ div: r
28
+ }
29
+ }, y = {
127
30
  type: "container",
128
31
  constraints: [
129
32
  {
@@ -135,37 +38,36 @@ const e = ({
135
38
  component: { $eq: "RadioGroupIndicator" }
136
39
  }
137
40
  ],
138
- icon: i,
41
+ icon: e,
139
42
  states: o,
140
43
  presetStyle: {
141
- button: [u, V].flat()
44
+ button: [n, s].flat()
142
45
  }
143
- }, L = {
144
- category: "hidden",
46
+ }, f = {
145
47
  type: "container",
146
- icon: s,
48
+ icon: a,
147
49
  constraints: {
148
50
  relation: "ancestor",
149
51
  component: { $eq: "RadioGroupItem" }
150
52
  },
151
53
  states: o,
152
54
  presetStyle: {
153
- span: m
55
+ span: p
154
56
  }
155
- }, N = {
156
- props: C,
57
+ }, b = {
58
+ props: i,
157
59
  initialProps: ["id", "className", "name", "value", "required"]
158
- }, U = {
159
- props: w,
60
+ }, q = {
61
+ props: c,
160
62
  initialProps: ["value"]
161
- }, j = {
162
- props: S
63
+ }, g = {
64
+ props: d
163
65
  };
164
66
  export {
165
- E as metaRadioGroup,
166
- L as metaRadioGroupIndicator,
167
- H as metaRadioGroupItem,
168
- N as propsMetaRadioGroup,
169
- j as propsMetaRadioGroupIndicator,
170
- U as propsMetaRadioGroupItem
67
+ I as metaRadioGroup,
68
+ f as metaRadioGroupIndicator,
69
+ y as metaRadioGroupItem,
70
+ b as propsMetaRadioGroup,
71
+ g as propsMetaRadioGroupIndicator,
72
+ q as propsMetaRadioGroupItem
171
73
  };
@@ -0,0 +1,121 @@
1
+ import { jsxs as n, jsx as r } from "react/jsx-runtime";
2
+ import { css as i, $ as f, PlaceholderValue as w } from "@webstudio-is/template";
3
+ import { radix as o } from "./shared/proxy.js";
4
+ import { height as h, width as d, borderRadius as s, borderWidth as c, colors as e, spacing as t, fontSize as m, fontSizeLineHeight as $, boxShadow as a, opacity as g, zIndex as b } from "./shared/theme.js";
5
+ import { CheckMarkIcon as y } from "@webstudio-is/icons/svg";
6
+ const l = (u, p) => /* @__PURE__ */ n(
7
+ o.SelectItem,
8
+ {
9
+ value: u,
10
+ "ws:style": i`
11
+ position: relative;
12
+ display: flex;
13
+ width: ${d.full};
14
+ cursor: default;
15
+ user-select: none;
16
+ align-items: center;
17
+ border-radius: ${s.md};
18
+ padding: ${t[1.5]} ${t[2]} ${t[1.5]} ${t[8]};
19
+ font-size: ${m.sm};
20
+ line-height: ${$.sm};
21
+ outline: none;
22
+ &:focus {
23
+ background-color: ${e.accent};
24
+ color: ${e.accentForeground};
25
+ }
26
+ &[data-disabled] {
27
+ pointer-events: none;
28
+ opacity: ${g[50]};
29
+ }
30
+ `,
31
+ children: [
32
+ /* @__PURE__ */ r(
33
+ o.SelectItemIndicator,
34
+ {
35
+ "ws:style": i`
36
+ position: absolute;
37
+ left: ${t[2]};
38
+ display: flex;
39
+ height: ${h[3.5]};
40
+ width: ${d[3.5]};
41
+ align-items: center;
42
+ justify-content: center;
43
+ `,
44
+ children: /* @__PURE__ */ r(f.HtmlEmbed, { "ws:label": "Indicator Icon", code: y })
45
+ }
46
+ ),
47
+ /* @__PURE__ */ r(o.SelectItemText, { children: new w(p) })
48
+ ]
49
+ }
50
+ ), z = {
51
+ category: "radix",
52
+ description: "Use within a form to give your users a list of options to choose from.",
53
+ order: 10,
54
+ template: /* @__PURE__ */ n(o.Select, { children: [
55
+ /* @__PURE__ */ r(
56
+ o.SelectTrigger,
57
+ {
58
+ "ws:style": i`
59
+ display: flex;
60
+ height: ${h[10]};
61
+ width: ${d.full};
62
+ align-items: center;
63
+ justify-content: between;
64
+ border-radius: ${s.md};
65
+ border: ${c.DEFAULT} solid ${e.input};
66
+ background-color: ${e.background};
67
+ padding: ${t[2]} ${t[3]};
68
+ font-size: ${m.sm};
69
+ line-height: ${$.sm};
70
+ &::placeholder {
71
+ color: ${e.mutedForeground};
72
+ }
73
+ &:focus-visible {
74
+ outline: none;
75
+ box-shadow: ${a.ring};
76
+ }
77
+ &:disabled {
78
+ cursor: not-allowed;
79
+ opacity: ${g[50]};
80
+ }
81
+ `,
82
+ children: /* @__PURE__ */ r(o.SelectValue, { placeholder: "Theme" })
83
+ }
84
+ ),
85
+ /* @__PURE__ */ r(
86
+ o.SelectContent,
87
+ {
88
+ "ws:style": i`
89
+ position: relative;
90
+ z-index: ${b[50]};
91
+ min-width: 8rem;
92
+ overflow: hidden;
93
+ border-radius: ${s.md};
94
+ border: ${c.DEFAULT} solid ${e.border};
95
+ background-color: ${e.popover};
96
+ color: ${e.popoverForeground};
97
+ box-shadow: ${a.md};
98
+ `,
99
+ children: /* @__PURE__ */ n(
100
+ o.SelectViewport,
101
+ {
102
+ "ws:style": i`
103
+ padding: ${t[1]};
104
+ height: var(--radix-select-trigger-height);
105
+ width: ${d.full};
106
+ min-width: var(--radix-select-trigger-width);
107
+ `,
108
+ children: [
109
+ l("light", "Light"),
110
+ l("dark", "Dark"),
111
+ l("system", "System")
112
+ ]
113
+ }
114
+ )
115
+ }
116
+ )
117
+ ] })
118
+ };
119
+ export {
120
+ z as meta
121
+ };