@lateralus-ai/shipping-ui 2.0.0-dev.10 → 2.0.0-dev.11
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/dist/index.cjs +10 -10
- package/dist/index.esm.js +849 -840
- package/package.json +1 -1
- package/src/primitives/Button.tsx +16 -11
package/package.json
CHANGED
|
@@ -121,6 +121,8 @@ export const Button = ({
|
|
|
121
121
|
...props
|
|
122
122
|
}: ButtonProps) => {
|
|
123
123
|
const resolvedIcon = icon ?? startIcon;
|
|
124
|
+
const renderedIcon = renderIcon(resolvedIcon);
|
|
125
|
+
const hasIcon = renderedIcon != null;
|
|
124
126
|
const hasDropdown = Boolean(dropdownOptions?.length);
|
|
125
127
|
const dropdownDisabled = !dropdownOptions?.some((option) => !option.disabled);
|
|
126
128
|
const mainAppearance = getAppearance(disabled, forcedState);
|
|
@@ -135,11 +137,18 @@ export const Button = ({
|
|
|
135
137
|
dropdownAppearance,
|
|
136
138
|
forcedState,
|
|
137
139
|
);
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
140
|
+
|
|
141
|
+
/** Label-only: centered text. With start icon: gap between icon and label. */
|
|
142
|
+
const content = (
|
|
143
|
+
<span
|
|
144
|
+
className={cn(
|
|
145
|
+
"flex min-h-6 items-center justify-center",
|
|
146
|
+
hasIcon && "gap-2",
|
|
147
|
+
)}
|
|
148
|
+
>
|
|
149
|
+
{renderedIcon}
|
|
150
|
+
<span>{children}</span>
|
|
151
|
+
</span>
|
|
143
152
|
);
|
|
144
153
|
|
|
145
154
|
if (!hasDropdown) {
|
|
@@ -156,9 +165,7 @@ export const Button = ({
|
|
|
156
165
|
)}
|
|
157
166
|
{...props}
|
|
158
167
|
>
|
|
159
|
-
|
|
160
|
-
{label}
|
|
161
|
-
</span>
|
|
168
|
+
{content}
|
|
162
169
|
</button>
|
|
163
170
|
);
|
|
164
171
|
}
|
|
@@ -175,9 +182,7 @@ export const Button = ({
|
|
|
175
182
|
)}
|
|
176
183
|
{...props}
|
|
177
184
|
>
|
|
178
|
-
|
|
179
|
-
{label}
|
|
180
|
-
</span>
|
|
185
|
+
{content}
|
|
181
186
|
</button>
|
|
182
187
|
);
|
|
183
188
|
|