@snap-rail/ui 0.2.0 → 0.3.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",
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-toast";
8
+ import "@radix-ui/react-tooltip";
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",