@webstudio-is/sdk-components-react-radix 0.87.0 → 0.88.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 (182) hide show
  1. package/lib/__generated__/accordion.props.js +0 -5
  2. package/lib/__generated__/button.props.js +0 -21
  3. package/lib/__generated__/checkbox.props.js +850 -0
  4. package/lib/__generated__/collapsible.props.js +0 -2
  5. package/lib/__generated__/dialog.props.js +0 -11
  6. package/lib/__generated__/label.props.js +0 -1
  7. package/lib/__generated__/navigation-menu.props.js +2104 -0
  8. package/lib/__generated__/popover.props.js +0 -3
  9. package/lib/__generated__/radio-group.props.js +1282 -0
  10. package/lib/__generated__/select.props.js +2962 -0
  11. package/lib/__generated__/sheet.props.js +0 -11
  12. package/lib/__generated__/switch.props.js +850 -0
  13. package/lib/__generated__/tabs.props.js +428 -5
  14. package/lib/__generated__/tooltip.props.js +0 -2
  15. package/lib/accordion.js +11 -4
  16. package/lib/accordion.ws.js +87 -72
  17. package/lib/checkbox.js +13 -0
  18. package/lib/checkbox.ws.js +151 -0
  19. package/lib/cjs/__generated__/accordion.props.js +0 -5
  20. package/lib/cjs/__generated__/button.props.js +0 -21
  21. package/lib/cjs/__generated__/checkbox.props.js +870 -0
  22. package/lib/cjs/__generated__/collapsible.props.js +0 -2
  23. package/lib/cjs/__generated__/dialog.props.js +0 -11
  24. package/lib/cjs/__generated__/label.props.js +0 -1
  25. package/lib/cjs/__generated__/navigation-menu.props.js +2124 -0
  26. package/lib/cjs/__generated__/popover.props.js +0 -3
  27. package/lib/cjs/__generated__/radio-group.props.js +1302 -0
  28. package/lib/cjs/__generated__/select.props.js +2982 -0
  29. package/lib/cjs/__generated__/sheet.props.js +0 -11
  30. package/lib/cjs/__generated__/switch.props.js +870 -0
  31. package/lib/cjs/__generated__/tabs.props.js +428 -5
  32. package/lib/cjs/__generated__/tooltip.props.js +0 -2
  33. package/lib/cjs/accordion.js +11 -4
  34. package/lib/cjs/accordion.ws.js +85 -71
  35. package/lib/cjs/{textarea.js → checkbox.js} +9 -6
  36. package/lib/cjs/checkbox.ws.js +172 -0
  37. package/lib/cjs/collapsible.ws.js +4 -1
  38. package/lib/cjs/components.js +27 -14
  39. package/lib/cjs/dialog.ws.js +17 -17
  40. package/lib/cjs/hooks.js +5 -1
  41. package/lib/cjs/label.ws.js +1 -1
  42. package/lib/cjs/metas.js +29 -14
  43. package/lib/cjs/navigation-menu.js +107 -0
  44. package/lib/cjs/navigation-menu.ws.js +513 -0
  45. package/lib/cjs/popover.ws.js +12 -9
  46. package/lib/cjs/props.js +27 -14
  47. package/lib/cjs/{button.js → radio-group.js} +10 -8
  48. package/lib/cjs/radio-group.ws.js +188 -0
  49. package/lib/cjs/select.js +81 -0
  50. package/lib/cjs/select.ws.js +349 -0
  51. package/lib/cjs/sheet.ws.js +87 -176
  52. package/lib/cjs/{input.js → switch.js} +8 -9
  53. package/lib/cjs/switch.ws.js +171 -0
  54. package/lib/cjs/tabs.js +2 -3
  55. package/lib/cjs/tabs.ws.js +13 -18
  56. package/lib/cjs/theme/styles.js +100 -0
  57. package/lib/cjs/theme/tailwind-classes.js +125 -16
  58. package/lib/cjs/theme/tailwind-colors.js +1 -0
  59. package/lib/cjs/tooltip.ws.js +11 -8
  60. package/lib/collapsible.ws.js +4 -1
  61. package/lib/components.js +44 -22
  62. package/lib/dialog.ws.js +17 -17
  63. package/lib/hooks.js +5 -1
  64. package/lib/label.ws.js +1 -1
  65. package/lib/metas.js +58 -24
  66. package/lib/navigation-menu.js +85 -0
  67. package/lib/navigation-menu.ws.js +500 -0
  68. package/lib/popover.ws.js +12 -9
  69. package/lib/props.js +56 -24
  70. package/lib/radio-group.js +11 -0
  71. package/lib/radio-group.ws.js +170 -0
  72. package/lib/select.js +73 -0
  73. package/lib/select.ws.js +337 -0
  74. package/lib/sheet.ws.js +88 -194
  75. package/lib/switch.js +7 -0
  76. package/lib/switch.ws.js +143 -0
  77. package/lib/tabs.js +3 -5
  78. package/lib/tabs.ws.js +14 -19
  79. package/lib/theme/styles.js +70 -0
  80. package/lib/theme/tailwind-classes.js +125 -16
  81. package/lib/theme/tailwind-colors.js +1 -0
  82. package/lib/tooltip.ws.js +11 -8
  83. package/lib/types/__generated__/checkbox.props.d.ts +3 -0
  84. package/lib/types/__generated__/navigation-menu.props.d.ts +8 -0
  85. package/lib/types/__generated__/radio-group.props.d.ts +4 -0
  86. package/lib/types/__generated__/select.props.d.ts +9 -0
  87. package/lib/types/__generated__/switch.props.d.ts +3 -0
  88. package/lib/types/checkbox.d.ts +6 -0
  89. package/lib/types/checkbox.stories.d.ts +11 -0
  90. package/lib/types/checkbox.ws.d.ts +5 -0
  91. package/lib/types/components.d.ts +5 -4
  92. package/lib/types/metas.d.ts +6 -4
  93. package/lib/types/navigation-menu.d.ts +15 -0
  94. package/lib/types/navigation-menu.ws.d.ts +15 -0
  95. package/lib/types/props.d.ts +5 -4
  96. package/lib/types/radio-group.d.ts +5 -0
  97. package/lib/types/radio-group.stories.d.ts +9 -0
  98. package/lib/types/radio-group.ws.d.ts +7 -0
  99. package/lib/types/select.d.ts +12 -0
  100. package/lib/types/select.ws.d.ts +17 -0
  101. package/lib/types/sheet.ws.d.ts +2 -15
  102. package/lib/types/switch.d.ts +4 -0
  103. package/lib/types/switch.stories.d.ts +9 -0
  104. package/lib/types/switch.ws.d.ts +5 -0
  105. package/lib/types/tabs.d.ts +3 -12
  106. package/lib/types/theme/radix-common-types.d.ts +3 -2
  107. package/lib/types/theme/styles.d.ts +215 -0
  108. package/lib/types/theme/tailwind-classes.d.ts +16 -6
  109. package/lib/types/theme/tailwind-colors.d.ts +1 -0
  110. package/lib/types/theme/tailwind-theme.d.ts +1 -1
  111. package/package.json +12 -7
  112. package/src/__generated__/accordion.props.ts +0 -5
  113. package/src/__generated__/button.props.ts +0 -21
  114. package/src/__generated__/checkbox.props.ts +948 -0
  115. package/src/__generated__/collapsible.props.ts +0 -2
  116. package/src/__generated__/dialog.props.ts +0 -11
  117. package/src/__generated__/label.props.ts +0 -1
  118. package/src/__generated__/navigation-menu.props.ts +2349 -0
  119. package/src/__generated__/popover.props.ts +0 -3
  120. package/src/__generated__/radio-group.props.ts +1429 -0
  121. package/src/__generated__/select.props.ts +3304 -0
  122. package/src/__generated__/sheet.props.ts +0 -11
  123. package/src/__generated__/switch.props.ts +948 -0
  124. package/src/__generated__/tabs.props.ts +477 -4
  125. package/src/__generated__/tooltip.props.ts +0 -2
  126. package/src/accordion.tsx +14 -7
  127. package/src/accordion.ws.ts +85 -70
  128. package/src/{textarea.stories.ts → checkbox.stories.ts} +6 -11
  129. package/src/checkbox.tsx +22 -0
  130. package/src/checkbox.ws.ts +151 -0
  131. package/src/collapsible.ws.ts +4 -1
  132. package/src/components.ts +25 -12
  133. package/src/dialog.ws.tsx +15 -16
  134. package/src/hooks.ts +4 -0
  135. package/src/label.ws.ts +1 -1
  136. package/src/metas.ts +36 -12
  137. package/src/navigation-menu.stories.tsx +21 -0
  138. package/src/navigation-menu.tsx +130 -0
  139. package/src/navigation-menu.ws.ts +523 -0
  140. package/src/popover.ws.tsx +12 -9
  141. package/src/props.ts +35 -12
  142. package/src/{input.stories.ts → radio-group.stories.ts} +6 -15
  143. package/src/radio-group.tsx +17 -0
  144. package/src/radio-group.ws.ts +174 -0
  145. package/src/select.stories.tsx +21 -0
  146. package/src/select.tsx +107 -0
  147. package/src/select.ws.ts +347 -0
  148. package/src/sheet.ws.tsx +89 -209
  149. package/src/{button.stories.ts → switch.stories.ts} +6 -19
  150. package/src/switch.tsx +10 -0
  151. package/src/switch.ws.ts +143 -0
  152. package/src/tabs.tsx +4 -17
  153. package/src/tabs.ws.ts +17 -19
  154. package/src/theme/radix-common-types.ts +3 -2
  155. package/src/theme/styles.ts +80 -0
  156. package/src/theme/tailwind-classes.ts +150 -14
  157. package/src/theme/tailwind-colors.ts +1 -0
  158. package/src/tooltip.ws.tsx +11 -8
  159. package/lib/button.js +0 -8
  160. package/lib/button.ws.js +0 -133
  161. package/lib/cjs/button.ws.js +0 -160
  162. package/lib/cjs/input.ws.js +0 -103
  163. package/lib/cjs/textarea.ws.js +0 -98
  164. package/lib/input.js +0 -8
  165. package/lib/input.ws.js +0 -75
  166. package/lib/textarea.js +0 -8
  167. package/lib/textarea.ws.js +0 -70
  168. package/lib/types/button.d.ts +0 -7
  169. package/lib/types/button.stories.d.ts +0 -20
  170. package/lib/types/button.ws.d.ts +0 -7
  171. package/lib/types/input.d.ts +0 -2
  172. package/lib/types/input.stories.d.ts +0 -20
  173. package/lib/types/input.ws.d.ts +0 -3
  174. package/lib/types/textarea.d.ts +0 -2
  175. package/lib/types/textarea.stories.d.ts +0 -14
  176. package/lib/types/textarea.ws.d.ts +0 -3
  177. package/src/button.tsx +0 -25
  178. package/src/button.ws.ts +0 -155
  179. package/src/input.tsx +0 -12
  180. package/src/input.ws.ts +0 -78
  181. package/src/textarea.tsx +0 -12
  182. package/src/textarea.ws.ts +0 -74
@@ -0,0 +1,170 @@
1
+ import {
2
+ ItemIcon,
3
+ RadioCheckedIcon,
4
+ RadioDotIcon,
5
+ TriggerIcon
6
+ } from "@webstudio-is/icons/svg";
7
+ import {
8
+ defaultStates,
9
+ WsEmbedTemplate
10
+ } from "@webstudio-is/react-sdk";
11
+ import { button, div, span } from "@webstudio-is/react-sdk/css-normalize";
12
+ import * as tc from "./theme/tailwind-classes";
13
+ import { buttonReset } from "./theme/styles";
14
+ import {
15
+ propsRadioGroup,
16
+ propsRadioGroupIndicator,
17
+ propsRadioGroupItem
18
+ } from "./__generated__/radio-group.props";
19
+ const createRadioGroupItem = ({
20
+ value,
21
+ label
22
+ }) => ({
23
+ type: "instance",
24
+ component: "Label",
25
+ // flex items-center space-x-2
26
+ styles: [tc.flex(), tc.items("center"), tc.gap(2)].flat(),
27
+ children: [
28
+ {
29
+ type: "instance",
30
+ component: "RadioGroupItem",
31
+ props: [{ name: "value", type: "string", value }],
32
+ // aspect-square h-4 w-4 rounded-full border border-primary text-primary ring-offset-background
33
+ // focus:outline-none
34
+ // focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2
35
+ // disabled:cursor-not-allowed disabled:opacity-50
36
+ styles: [
37
+ tc.aspect("square"),
38
+ tc.h(4),
39
+ tc.w(4),
40
+ tc.rounded("full"),
41
+ tc.border(),
42
+ tc.border("primary"),
43
+ tc.text("primary"),
44
+ tc.focusVisible(
45
+ [tc.outline("none"), tc.ring("ring", 2, "background", 2)].flat()
46
+ ),
47
+ tc.disabled([tc.cursor("not-allowed"), tc.opacity(50)].flat())
48
+ ].flat(),
49
+ children: [
50
+ {
51
+ type: "instance",
52
+ component: "RadioGroupIndicator",
53
+ children: [
54
+ {
55
+ type: "instance",
56
+ component: "HtmlEmbed",
57
+ label: "Indicator Icon",
58
+ props: [
59
+ {
60
+ type: "string",
61
+ name: "code",
62
+ value: RadioDotIcon
63
+ }
64
+ ],
65
+ children: []
66
+ }
67
+ ]
68
+ }
69
+ ]
70
+ },
71
+ {
72
+ type: "instance",
73
+ component: "Text",
74
+ children: [{ type: "text", value: label }]
75
+ }
76
+ ]
77
+ });
78
+ const metaRadioGroup = {
79
+ category: "radix",
80
+ order: 100,
81
+ type: "container",
82
+ icon: RadioCheckedIcon,
83
+ states: [
84
+ ...defaultStates,
85
+ {
86
+ label: "Checked",
87
+ selector: "[data-state=checked]",
88
+ category: "component-states"
89
+ },
90
+ {
91
+ label: "Unchecked",
92
+ selector: "[data-state=unchecked]",
93
+ category: "component-states"
94
+ }
95
+ ],
96
+ presetStyle: {
97
+ div
98
+ },
99
+ template: [
100
+ {
101
+ type: "instance",
102
+ component: "RadioGroup",
103
+ dataSources: {
104
+ radioGroupValue: { type: "variable", initialValue: "" }
105
+ },
106
+ // grid gap-2
107
+ styles: [tc.flex(), tc.flex("col"), tc.gap(2)].flat(),
108
+ props: [
109
+ {
110
+ type: "dataSource",
111
+ name: "value",
112
+ dataSourceName: "radioGroupValue"
113
+ },
114
+ {
115
+ name: "onValueChange",
116
+ type: "action",
117
+ value: [
118
+ {
119
+ type: "execute",
120
+ args: ["value"],
121
+ code: `radioGroupValue = value`
122
+ }
123
+ ]
124
+ }
125
+ ],
126
+ children: [
127
+ createRadioGroupItem({ value: "default", label: "Default" }),
128
+ createRadioGroupItem({ value: "comfortable", label: "Comfortable" }),
129
+ createRadioGroupItem({ value: "compact", label: "Compact" })
130
+ ]
131
+ }
132
+ ]
133
+ };
134
+ const metaRadioGroupItem = {
135
+ category: "hidden",
136
+ type: "container",
137
+ icon: ItemIcon,
138
+ states: defaultStates,
139
+ presetStyle: {
140
+ button: [button, buttonReset].flat()
141
+ }
142
+ };
143
+ const metaRadioGroupIndicator = {
144
+ category: "hidden",
145
+ type: "container",
146
+ icon: TriggerIcon,
147
+ states: defaultStates,
148
+ presetStyle: {
149
+ span
150
+ }
151
+ };
152
+ const propsMetaRadioGroup = {
153
+ props: propsRadioGroup,
154
+ initialProps: ["id", "value", "name", "required"]
155
+ };
156
+ const propsMetaRadioGroupItem = {
157
+ props: propsRadioGroupItem,
158
+ initialProps: ["value"]
159
+ };
160
+ const propsMetaRadioGroupIndicator = {
161
+ props: propsRadioGroupIndicator
162
+ };
163
+ export {
164
+ metaRadioGroup,
165
+ metaRadioGroupIndicator,
166
+ metaRadioGroupItem,
167
+ propsMetaRadioGroup,
168
+ propsMetaRadioGroupIndicator,
169
+ propsMetaRadioGroupItem
170
+ };
package/lib/select.js ADDED
@@ -0,0 +1,73 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import {
3
+ forwardRef
4
+ } from "react";
5
+ import {
6
+ Root,
7
+ Value,
8
+ Trigger,
9
+ Content,
10
+ Item,
11
+ ItemIndicator,
12
+ ItemText,
13
+ Portal,
14
+ Viewport
15
+ } from "@radix-ui/react-select";
16
+ import { getClosestInstance } from "@webstudio-is/react-sdk";
17
+ const Select = forwardRef(({ value, ...props }, _ref) => {
18
+ if (value === "") {
19
+ value = void 0;
20
+ }
21
+ return /* @__PURE__ */ jsx(Root, { value, ...props });
22
+ });
23
+ const SelectTrigger = Trigger;
24
+ const SelectValue = Value;
25
+ const SelectContent = forwardRef((props, ref) => {
26
+ return /* @__PURE__ */ jsx(Portal, { children: /* @__PURE__ */ jsx(Content, { ref, ...props, position: "popper" }) });
27
+ });
28
+ const SelectViewport = Viewport;
29
+ const SelectItem = Item;
30
+ const SelectItemIndicator = ItemIndicator;
31
+ const SelectItemText = ItemText;
32
+ const namespace = "@webstudio-is/sdk-components-react-radix";
33
+ const hooksSelect = {
34
+ onNavigatorUnselect: (context, event) => {
35
+ for (const instance of event.instancePath) {
36
+ if (instance.component === `${namespace}:SelectContent`) {
37
+ const select = getClosestInstance(
38
+ event.instancePath,
39
+ instance,
40
+ `${namespace}:Select`
41
+ );
42
+ if (select) {
43
+ context.setPropVariable(select.id, "open", false);
44
+ }
45
+ }
46
+ }
47
+ },
48
+ onNavigatorSelect: (context, event) => {
49
+ for (const instance of event.instancePath) {
50
+ if (instance.component === `${namespace}:SelectContent`) {
51
+ const select = getClosestInstance(
52
+ event.instancePath,
53
+ instance,
54
+ `${namespace}:Select`
55
+ );
56
+ if (select) {
57
+ context.setPropVariable(select.id, "open", true);
58
+ }
59
+ }
60
+ }
61
+ }
62
+ };
63
+ export {
64
+ Select,
65
+ SelectContent,
66
+ SelectItem,
67
+ SelectItemIndicator,
68
+ SelectItemText,
69
+ SelectTrigger,
70
+ SelectValue,
71
+ SelectViewport,
72
+ hooksSelect
73
+ };
@@ -0,0 +1,337 @@
1
+ import {
2
+ SelectIcon,
3
+ TriggerIcon,
4
+ FormTextFieldIcon,
5
+ ContentIcon,
6
+ ItemIcon,
7
+ ViewportIcon,
8
+ TextIcon,
9
+ CheckMarkIcon
10
+ } from "@webstudio-is/icons/svg";
11
+ import { button, div, span } from "@webstudio-is/react-sdk/css-normalize";
12
+ import * as tc from "./theme/tailwind-classes";
13
+ import {
14
+ propsSelect,
15
+ propsSelectContent,
16
+ propsSelectItem,
17
+ propsSelectItemIndicator,
18
+ propsSelectItemText,
19
+ propsSelectTrigger,
20
+ propsSelectValue,
21
+ propsSelectViewport
22
+ } from "./__generated__/select.props";
23
+ const presetStyle = {
24
+ div
25
+ };
26
+ const createSelectItem = ({
27
+ props,
28
+ children
29
+ }) => ({
30
+ type: "instance",
31
+ component: "SelectItem",
32
+ props,
33
+ // relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none
34
+ // focus:bg-accent focus:text-accent-foreground
35
+ // data-[disabled]:pointer-events-none data-[disabled]:opacity-50
36
+ styles: [
37
+ tc.relative(),
38
+ tc.flex(),
39
+ tc.w("full"),
40
+ tc.cursor("default"),
41
+ tc.select("none"),
42
+ tc.items("center"),
43
+ tc.rounded("md"),
44
+ tc.py(1.5),
45
+ tc.pl(8),
46
+ tc.pr(2),
47
+ tc.text("sm"),
48
+ tc.outline("none"),
49
+ tc.focus([tc.bg("accent"), tc.text("accentForeground")].flat()),
50
+ tc.state(
51
+ [tc.pointerEvents("none"), tc.opacity(50)].flat(),
52
+ "[data-disabled]"
53
+ )
54
+ ].flat(),
55
+ children: [
56
+ {
57
+ type: "instance",
58
+ component: "SelectItemIndicator",
59
+ // absolute left-2 flex h-3.5 w-3.5 items-center justify-center
60
+ styles: [
61
+ tc.absolute(),
62
+ tc.left(2),
63
+ tc.flex(),
64
+ tc.h(3.5),
65
+ tc.w(3.5),
66
+ tc.items("center"),
67
+ tc.justify("center")
68
+ ].flat(),
69
+ children: [
70
+ {
71
+ type: "instance",
72
+ component: "HtmlEmbed",
73
+ label: "Indicator Icon",
74
+ props: [
75
+ {
76
+ type: "string",
77
+ name: "code",
78
+ value: CheckMarkIcon
79
+ }
80
+ ],
81
+ children: []
82
+ }
83
+ ]
84
+ },
85
+ {
86
+ type: "instance",
87
+ component: "SelectItemText",
88
+ children
89
+ }
90
+ ]
91
+ });
92
+ const metaSelect = {
93
+ category: "radix",
94
+ order: 10,
95
+ type: "container",
96
+ icon: SelectIcon,
97
+ stylable: false,
98
+ template: [
99
+ {
100
+ type: "instance",
101
+ component: "Select",
102
+ dataSources: {
103
+ selectValue: { type: "variable", initialValue: "" },
104
+ selectOpen: { type: "variable", initialValue: false }
105
+ },
106
+ props: [
107
+ {
108
+ name: "value",
109
+ type: "dataSource",
110
+ dataSourceName: "selectValue"
111
+ },
112
+ {
113
+ name: "onValueChange",
114
+ type: "action",
115
+ value: [
116
+ { type: "execute", args: ["value"], code: `selectValue = value` }
117
+ ]
118
+ },
119
+ {
120
+ name: "open",
121
+ type: "dataSource",
122
+ dataSourceName: "selectOpen"
123
+ },
124
+ {
125
+ name: "onOpenChange",
126
+ type: "action",
127
+ value: [
128
+ { type: "execute", args: ["open"], code: `selectOpen = open` }
129
+ ]
130
+ }
131
+ ],
132
+ children: [
133
+ {
134
+ type: "instance",
135
+ component: "SelectTrigger",
136
+ // flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background
137
+ // placeholder:text-muted-foreground
138
+ // focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2
139
+ // disabled:cursor-not-allowed disabled:opacity-50
140
+ styles: [
141
+ tc.flex(),
142
+ tc.h(10),
143
+ tc.w("full"),
144
+ tc.items("center"),
145
+ tc.justify("between"),
146
+ tc.rounded("md"),
147
+ tc.border(),
148
+ tc.border("input"),
149
+ tc.bg("background"),
150
+ tc.px(3),
151
+ tc.py(2),
152
+ tc.text("sm"),
153
+ tc.state([tc.text("mutedForeground")].flat(), "::placeholder"),
154
+ tc.focus(
155
+ [tc.outline("none"), tc.ring("ring", 2, "background", 2)].flat()
156
+ ),
157
+ tc.disabled([tc.cursor("not-allowed"), tc.opacity(50)].flat())
158
+ ].flat(),
159
+ children: [
160
+ {
161
+ type: "instance",
162
+ component: "SelectValue",
163
+ props: [{ name: "placeholder", type: "string", value: "Theme" }],
164
+ children: []
165
+ }
166
+ ]
167
+ },
168
+ {
169
+ type: "instance",
170
+ component: "SelectContent",
171
+ // relative z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md
172
+ // data-[state=open]:animate-in
173
+ // data-[state=closed]:animate-out data-[state=closed]:fade-out-0
174
+ // data-[state=open]:fade-in-0
175
+ // data-[state=closed]:zoom-out-95
176
+ // data-[state=open]:zoom-in-95
177
+ // data-[side=bottom]:slide-in-from-top-2
178
+ // data-[side=left]:slide-in-from-right-2
179
+ // data-[side=right]:slide-in-from-left-2
180
+ // data-[side=top]:slide-in-from-bottom-2
181
+ // position=popper
182
+ // data-[side=bottom]:translate-y-1
183
+ // data-[side=left]:-translate-x-1
184
+ // data-[side=right]:translate-x-1
185
+ // data-[side=top]:-translate-y-1
186
+ styles: [
187
+ tc.relative(),
188
+ tc.z(50),
189
+ tc.property("minWidth", "8rem"),
190
+ tc.overflow("hidden"),
191
+ tc.rounded("md"),
192
+ tc.border(),
193
+ tc.bg("popover"),
194
+ tc.text("popoverForeground"),
195
+ tc.shadow("md")
196
+ ].flat(),
197
+ children: [
198
+ {
199
+ type: "instance",
200
+ component: "SelectViewport",
201
+ // p-1
202
+ // position=popper
203
+ // h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]
204
+ styles: [
205
+ tc.p(1),
206
+ tc.property("height", "--radix-select-trigger-height"),
207
+ tc.w("full"),
208
+ tc.property("minWidth", "--radix-select-trigger-width")
209
+ ].flat(),
210
+ children: [
211
+ createSelectItem({
212
+ props: [{ name: "value", type: "string", value: "light" }],
213
+ children: [{ type: "text", value: "Light" }]
214
+ }),
215
+ createSelectItem({
216
+ props: [{ name: "value", type: "string", value: "dark" }],
217
+ children: [{ type: "text", value: "Dark" }]
218
+ }),
219
+ createSelectItem({
220
+ props: [{ name: "value", type: "string", value: "system" }],
221
+ children: [{ type: "text", value: "System" }]
222
+ })
223
+ ]
224
+ }
225
+ ]
226
+ }
227
+ ]
228
+ }
229
+ ]
230
+ };
231
+ const metaSelectTrigger = {
232
+ category: "hidden",
233
+ type: "container",
234
+ icon: TriggerIcon,
235
+ detachable: false,
236
+ presetStyle: {
237
+ button
238
+ }
239
+ };
240
+ const metaSelectValue = {
241
+ category: "hidden",
242
+ type: "container",
243
+ label: "Value",
244
+ icon: FormTextFieldIcon,
245
+ detachable: false,
246
+ presetStyle: {
247
+ span
248
+ }
249
+ };
250
+ const metaSelectContent = {
251
+ category: "hidden",
252
+ type: "container",
253
+ icon: ContentIcon,
254
+ detachable: false,
255
+ presetStyle
256
+ };
257
+ const metaSelectViewport = {
258
+ category: "hidden",
259
+ type: "container",
260
+ icon: ViewportIcon,
261
+ detachable: false,
262
+ presetStyle
263
+ };
264
+ const metaSelectItem = {
265
+ category: "hidden",
266
+ type: "container",
267
+ icon: ItemIcon,
268
+ requiredAncestors: ["SelectViewport"],
269
+ presetStyle
270
+ };
271
+ const metaSelectItemIndicator = {
272
+ category: "hidden",
273
+ type: "container",
274
+ label: "Indicator",
275
+ icon: CheckMarkIcon,
276
+ detachable: false,
277
+ requiredAncestors: ["SelectItem"],
278
+ presetStyle: {
279
+ span
280
+ }
281
+ };
282
+ const metaSelectItemText = {
283
+ category: "hidden",
284
+ type: "container",
285
+ label: "Item Text",
286
+ icon: TextIcon,
287
+ detachable: false,
288
+ requiredAncestors: ["SelectItem"],
289
+ presetStyle: {
290
+ span
291
+ }
292
+ };
293
+ const propsMetaSelect = {
294
+ props: propsSelect,
295
+ initialProps: ["value", "open", "name", "required"]
296
+ };
297
+ const propsMetaSelectTrigger = {
298
+ props: propsSelectTrigger
299
+ };
300
+ const propsMetaSelectValue = {
301
+ props: propsSelectValue,
302
+ initialProps: ["placeholder"]
303
+ };
304
+ const propsMetaSelectContent = {
305
+ props: propsSelectContent
306
+ };
307
+ const propsMetaSelectViewport = {
308
+ props: propsSelectViewport
309
+ };
310
+ const propsMetaSelectItem = {
311
+ props: propsSelectItem,
312
+ initialProps: ["value"]
313
+ };
314
+ const propsMetaSelectItemIndicator = {
315
+ props: propsSelectItemIndicator
316
+ };
317
+ const propsMetaSelectItemText = {
318
+ props: propsSelectItemText
319
+ };
320
+ export {
321
+ metaSelect,
322
+ metaSelectContent,
323
+ metaSelectItem,
324
+ metaSelectItemIndicator,
325
+ metaSelectItemText,
326
+ metaSelectTrigger,
327
+ metaSelectValue,
328
+ metaSelectViewport,
329
+ propsMetaSelect,
330
+ propsMetaSelectContent,
331
+ propsMetaSelectItem,
332
+ propsMetaSelectItemIndicator,
333
+ propsMetaSelectItemText,
334
+ propsMetaSelectTrigger,
335
+ propsMetaSelectValue,
336
+ propsMetaSelectViewport
337
+ };