@lateralus-ai/shipping-ui 2.0.0-dev.10 → 2.0.0-dev.12
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/components/Tabs.tsx +2 -2
- package/src/primitives/Button.tsx +16 -11
- package/src/utils/cn.ts +28 -1
package/package.json
CHANGED
package/src/components/Tabs.tsx
CHANGED
|
@@ -107,8 +107,8 @@ export const TabsTrigger = forwardRef<
|
|
|
107
107
|
type === "pills" &&
|
|
108
108
|
appearance === "solid" && [
|
|
109
109
|
"min-h-9 rounded-full px-3 py-1 text-caption-2-em",
|
|
110
|
-
"bg-transparent text-display-on-light-
|
|
111
|
-
"hover:bg-grey-900/[0.04]",
|
|
110
|
+
"bg-transparent text-display-on-light-tertiary",
|
|
111
|
+
"hover:bg-grey-900/[0.04] hover:text-display-on-light-primary",
|
|
112
112
|
"data-[state=active]:bg-blue-600 data-[state=active]:text-white",
|
|
113
113
|
"data-[state=active]:hover:bg-blue-600",
|
|
114
114
|
],
|
|
@@ -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
|
|
package/src/utils/cn.ts
CHANGED
|
@@ -1,6 +1,33 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { extendTailwindMerge } from "tailwind-merge";
|
|
2
2
|
import { type ClassValue, clsx } from "clsx";
|
|
3
3
|
|
|
4
|
+
/**
|
|
5
|
+
* Custom fontSize keys from tailwind-theme.ts (tailwind-merge@1.x API).
|
|
6
|
+
* Without this, twMerge treats e.g. text-caption-2-em as the same group as
|
|
7
|
+
* text-display-on-light-primary and drops the font-size class.
|
|
8
|
+
*/
|
|
9
|
+
const fontSizeTokens = [
|
|
10
|
+
"title",
|
|
11
|
+
"title-em",
|
|
12
|
+
"heading",
|
|
13
|
+
"subheader",
|
|
14
|
+
"subheader-em",
|
|
15
|
+
"body",
|
|
16
|
+
"body-em",
|
|
17
|
+
"caption-1",
|
|
18
|
+
"caption-1-em",
|
|
19
|
+
"caption-2",
|
|
20
|
+
"caption-2-em",
|
|
21
|
+
"footnote",
|
|
22
|
+
"footnote-em",
|
|
23
|
+
] as const;
|
|
24
|
+
|
|
25
|
+
const twMerge = extendTailwindMerge({
|
|
26
|
+
classGroups: {
|
|
27
|
+
"font-size": [{ text: [...fontSizeTokens] }],
|
|
28
|
+
},
|
|
29
|
+
});
|
|
30
|
+
|
|
4
31
|
/**
|
|
5
32
|
* Merges the tailwind clases (using twMerge). Conditionally removes false values
|
|
6
33
|
* @param inputs The tailwind classes to merge
|