@snap-rail/ui 0.2.0 → 0.4.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.
package/lib/contract.js CHANGED
@@ -158,10 +158,29 @@ const UI_COMPONENTS = {
158
158
  "touch-select.root",
159
159
  "touch-select.trigger",
160
160
  "touch-select.sheet",
161
- "touch-select.option"
161
+ "touch-select.options"
162
162
  ],
163
163
  props: ["invalid", "disabled"]
164
164
  },
165
+ combobox: {
166
+ parts: [
167
+ "combobox.root",
168
+ "combobox.anchor",
169
+ "combobox.list",
170
+ "combobox.option",
171
+ "combobox.empty"
172
+ ],
173
+ slots: ["empty"],
174
+ props: [
175
+ "value",
176
+ "options",
177
+ "size",
178
+ "invalid",
179
+ "disabled",
180
+ "loading",
181
+ "onInputValueChange"
182
+ ]
183
+ },
165
184
  checkbox: {
166
185
  parts: [
167
186
  "checkbox.root",
@@ -323,17 +342,6 @@ const UI_COMPONENTS = {
323
342
  ],
324
343
  slots: ["trigger", "content"]
325
344
  },
326
- toast: {
327
- parts: [
328
- "toast.root",
329
- "toast.title",
330
- "toast.description",
331
- "toast.action",
332
- "toast.close",
333
- "toast.viewport"
334
- ],
335
- slots: ["action"]
336
- },
337
345
  progress: { parts: [
338
346
  "progress.root",
339
347
  "progress.track",
package/lib/fallback.js CHANGED
@@ -1,21 +1,21 @@
1
1
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
2
  import "@radix-ui/react-separator";
3
3
  import { Slot } from "@radix-ui/react-slot";
4
+ import { Component, createContext, useContext, useSyncExternalStore } from "react";
5
+ import "@radix-ui/react-dropdown-menu";
6
+ import "@radix-ui/react-popover";
7
+ import "@radix-ui/react-tooltip";
8
+ import "sonner";
4
9
  import "@radix-ui/react-checkbox";
5
10
  import "@radix-ui/react-label";
6
11
  import "@radix-ui/react-radio-group";
7
12
  import "@radix-ui/react-select";
8
13
  import "@radix-ui/react-switch";
9
14
  import "@radix-ui/react-tabs";
10
- import { Component, createContext, useContext, useSyncExternalStore } from "react";
11
15
  import "@radix-ui/react-dialog";
12
16
  import "react-hook-form";
13
17
  import "@hookform/resolvers/zod";
14
18
  import "@radix-ui/react-scroll-area";
15
- import "@radix-ui/react-dropdown-menu";
16
- import "@radix-ui/react-popover";
17
- import "@radix-ui/react-toast";
18
- import "@radix-ui/react-tooltip";
19
19
  import "@radix-ui/react-slider";
20
20
  //#region lib/types/utils.js
21
21
  /**
@@ -28,7 +28,13 @@ import "@radix-ui/react-slider";
28
28
  function cn(...values) {
29
29
  return values.filter((value) => typeof value === "string" && value.length > 0).join(" ");
30
30
  }
31
- /** The anatomy attributes every semantic component renders. */
31
+ /**
32
+ * The anatomy attributes every semantic component renders. The identity is
33
+ * component-owned: components spread these AFTER caller props so a composite
34
+ * can never mask a host part (a masked `button.root` loses every skin rule
35
+ * and falls back to the UA default look). Composites tag their own wrappers
36
+ * instead of pushing `part()` into a child component's props.
37
+ */
32
38
  function part(component, name) {
33
39
  return {
34
40
  "data-snap-component": component,
@@ -87,7 +93,6 @@ function Button({ intent = "neutral", emphasis = "solid", size = "md", loading =
87
93
  loading && jsx(Spinner, {})
88
94
  ] });
89
95
  return jsx(Component, {
90
- ...part("button", "root"),
91
96
  ...type !== void 0 ? { type } : !asChild ? { type: "button" } : {},
92
97
  className: cn("snap-button", className),
93
98
  "data-intent": intent,
@@ -98,13 +103,13 @@ function Button({ intent = "neutral", emphasis = "solid", size = "md", loading =
98
103
  "aria-busy": loading || void 0,
99
104
  disabled: !asChild ? disabled === true || loading : void 0,
100
105
  ...props,
106
+ ...part("button", "root"),
101
107
  children: content
102
108
  });
103
109
  }
104
110
  /** A square glyph button with a mandatory accessible label. */
105
111
  function IconButton({ icon, label, active = false, intent = "neutral", emphasis = "ghost", size = "md", className, ...props }) {
106
112
  return jsx("button", {
107
- ...part("icon-button", "root"),
108
113
  type: "button",
109
114
  className: cn("snap-icon-button", className),
110
115
  "data-intent": intent,
@@ -114,6 +119,7 @@ function IconButton({ icon, label, active = false, intent = "neutral", emphasis
114
119
  "aria-label": label,
115
120
  "aria-pressed": active || void 0,
116
121
  ...props,
122
+ ...part("icon-button", "root"),
117
123
  children: jsx("span", {
118
124
  ...part("icon-button", "icon"),
119
125
  "aria-hidden": "true",
@@ -121,6 +127,39 @@ function IconButton({ icon, label, active = false, intent = "neutral", emphasis
121
127
  })
122
128
  });
123
129
  }
130
+ jsxs(Fragment, { children: [
131
+ jsx("circle", {
132
+ cx: "12",
133
+ cy: "12",
134
+ r: "10"
135
+ }),
136
+ jsx("path", { d: "M12 16v-4" }),
137
+ jsx("path", { d: "M12 8h.01" })
138
+ ] }), jsxs(Fragment, { children: [
139
+ jsx("circle", {
140
+ cx: "12",
141
+ cy: "12",
142
+ r: "10"
143
+ }),
144
+ jsx("path", { d: "M12 16v-4" }),
145
+ jsx("path", { d: "M12 8h.01" })
146
+ ] }), jsxs(Fragment, { children: [jsx("circle", {
147
+ cx: "12",
148
+ cy: "12",
149
+ r: "10"
150
+ }), jsx("path", { d: "m9 12 2 2 4-4" })] }), jsxs(Fragment, { children: [
151
+ jsx("path", { d: "m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3Z" }),
152
+ jsx("path", { d: "M12 9v4" }),
153
+ jsx("path", { d: "M12 17h.01" })
154
+ ] }), jsxs(Fragment, { children: [
155
+ jsx("circle", {
156
+ cx: "12",
157
+ cy: "12",
158
+ r: "10"
159
+ }),
160
+ jsx("path", { d: "m15 9-6 6" }),
161
+ jsx("path", { d: "m9 9 6 6" })
162
+ ] });
124
163
  //#endregion
125
164
  //#region lib/types/components/feedback.js
126
165
  /** A centered empty/zero-state block. */