@lmnto/h-mall-shared 1.0.24 → 1.0.25
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/package.json
CHANGED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import plugin from "tailwindcss/plugin";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Material Tailwind Checkbox/Radio/Switch rely on `peer-checked:*` and `group-hover:*`
|
|
5
|
+
* utilities (e.g. icon spans use `opacity-0 peer-checked:opacity-100`). In this
|
|
6
|
+
* project's Tailwind build those matchVariant rules were not emitted, leaving
|
|
7
|
+
* controls permanently invisible (`appearance-none` + `opacity-0`).
|
|
8
|
+
*/
|
|
9
|
+
const peerGroupVariantValues: Record<string, string> = {
|
|
10
|
+
first: ":first-child",
|
|
11
|
+
last: ":last-child",
|
|
12
|
+
only: ":only-child",
|
|
13
|
+
odd: ":nth-child(odd)",
|
|
14
|
+
even: ":nth-child(even)",
|
|
15
|
+
"first-of-type": ":first-of-type",
|
|
16
|
+
"last-of-type": ":last-of-type",
|
|
17
|
+
"only-of-type": ":only-of-type",
|
|
18
|
+
visited: ":visited",
|
|
19
|
+
target: ":target",
|
|
20
|
+
open: ":open",
|
|
21
|
+
default: ":default",
|
|
22
|
+
checked: ":checked",
|
|
23
|
+
indeterminate: ":indeterminate",
|
|
24
|
+
"placeholder-shown": ":placeholder-shown",
|
|
25
|
+
autofill: ":autofill",
|
|
26
|
+
optional: ":optional",
|
|
27
|
+
required: ":required",
|
|
28
|
+
valid: ":valid",
|
|
29
|
+
invalid: ":invalid",
|
|
30
|
+
"in-range": ":in-range",
|
|
31
|
+
"out-of-range": ":out-of-range",
|
|
32
|
+
"read-only": ":read-only",
|
|
33
|
+
empty: ":empty",
|
|
34
|
+
"focus-within": ":focus-within",
|
|
35
|
+
hover: ":hover",
|
|
36
|
+
focus: ":focus",
|
|
37
|
+
"focus-visible": ":focus-visible",
|
|
38
|
+
active: ":active",
|
|
39
|
+
enabled: ":enabled",
|
|
40
|
+
disabled: ":disabled",
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export const peerGroupVariantsPlugin = plugin(({ matchVariant }) => {
|
|
44
|
+
matchVariant("peer", (value) => `.peer${value} ~ &`, {
|
|
45
|
+
values: peerGroupVariantValues,
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
matchVariant("group", (value) => `.group${value} &`, {
|
|
49
|
+
values: peerGroupVariantValues,
|
|
50
|
+
});
|
|
51
|
+
});
|
package/tailwind.config.ts
CHANGED
|
@@ -3,6 +3,8 @@ import path from "node:path";
|
|
|
3
3
|
import withMT from "@material-tailwind/react/utils/withMT";
|
|
4
4
|
import type { Config } from "tailwindcss";
|
|
5
5
|
|
|
6
|
+
import { peerGroupVariantsPlugin } from "./tailwind-peer-group-variants.plugin";
|
|
7
|
+
|
|
6
8
|
export const sharedConfig: Config = {
|
|
7
9
|
// Absolute glob so when web-app imports this config, paths are not resolved from web-app/.
|
|
8
10
|
content: [path.join(__dirname, "shared/**/*.{js,ts,jsx,tsx,mdx}")],
|
|
@@ -231,7 +233,7 @@ export const sharedConfig: Config = {
|
|
|
231
233
|
},
|
|
232
234
|
},
|
|
233
235
|
},
|
|
234
|
-
plugins: [
|
|
236
|
+
plugins: [peerGroupVariantsPlugin],
|
|
235
237
|
};
|
|
236
238
|
|
|
237
239
|
export const sharedWithMT = withMT;
|