@okam/next-component 2.1.0 → 2.1.1
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/components/AdminBar/AdminBarContent.d.ts +3 -0
- package/components/AdminBar/AdminBarContent.js +14 -0
- package/components/AdminBar/AdminBarContent.mjs +14 -0
- package/components/AdminBar/index.js +14 -0
- package/components/AdminBar/index.mjs +15 -0
- package/components/Filter/index.js +54 -0
- package/components/Filter/index.mjs +55 -0
- package/components/Img/index.js +29 -0
- package/components/Img/index.mjs +30 -0
- package/components/Link/index.js +40 -0
- package/components/Link/index.mjs +41 -0
- package/hooks/useFilterState/index.js +50 -0
- package/hooks/useFilterState/index.mjs +50 -0
- package/hooks/useHash/index.js +25 -0
- package/hooks/useHash/index.mjs +25 -0
- package/hooks/useLink/index.js +118 -0
- package/hooks/useLink/index.mjs +118 -0
- package/hooks/useLink/interface.d.ts +61 -1
- package/hooks/useLink/interface.js +8 -0
- package/hooks/useLink/interface.mjs +8 -0
- package/index.d.ts +2 -1
- package/index.js +20 -590
- package/index.mjs +17 -587
- package/lib/createServerContext/index.js +12 -0
- package/lib/createServerContext/index.mjs +12 -0
- package/package.json +5 -5
- package/providers/AdminBar/index.js +17 -0
- package/providers/AdminBar/index.mjs +17 -0
- package/{index-DV6W6v68.js → providers/DraftMode/index.js} +2 -0
- package/{index-Ber8Ecgv.mjs → providers/DraftMode/index.mjs} +3 -2
- package/providers/DraftMode/server.js +10 -0
- package/providers/DraftMode/server.mjs +11 -0
- package/server.d.ts +1 -0
- package/server.js +8 -30
- package/server.mjs +7 -29
- package/theme/AdminBar/index.js +120 -0
- package/theme/AdminBar/index.mjs +120 -0
- package/theme/Button/index.js +75 -0
- package/theme/Button/index.mjs +76 -0
- package/theme/Filter/index.js +72 -0
- package/theme/Filter/index.mjs +73 -0
- package/theme/Typography/index.js +43 -0
- package/theme/Typography/index.mjs +44 -0
- package/theme/index.js +16 -0
- package/theme/index.mjs +17 -0
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
"use client";
|
|
1
2
|
import { jsx } from "react/jsx-runtime";
|
|
2
3
|
import { createCtx } from "@okam/react-utils";
|
|
3
4
|
import { useMemo } from "react";
|
|
@@ -10,6 +11,6 @@ function DraftModeContextProvider(props) {
|
|
|
10
11
|
return /* @__PURE__ */ jsx(DraftModeProvider, { value, children });
|
|
11
12
|
}
|
|
12
13
|
export {
|
|
13
|
-
DraftModeContextProvider
|
|
14
|
-
useDraftMode
|
|
14
|
+
DraftModeContextProvider,
|
|
15
|
+
useDraftMode
|
|
15
16
|
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const jsxRuntime = require("react/jsx-runtime");
|
|
3
|
+
const headers = require("next/headers");
|
|
4
|
+
const index = require("./index.js");
|
|
5
|
+
async function DraftModeServerContextProvider(props) {
|
|
6
|
+
const { children, ...rest } = props;
|
|
7
|
+
const { isEnabled } = await headers.draftMode();
|
|
8
|
+
return /* @__PURE__ */ jsxRuntime.jsx(index.DraftModeContextProvider, { isEnabled, ...rest, children });
|
|
9
|
+
}
|
|
10
|
+
module.exports = DraftModeServerContextProvider;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { draftMode } from "next/headers";
|
|
3
|
+
import { DraftModeContextProvider } from "./index.mjs";
|
|
4
|
+
async function DraftModeServerContextProvider(props) {
|
|
5
|
+
const { children, ...rest } = props;
|
|
6
|
+
const { isEnabled } = await draftMode();
|
|
7
|
+
return /* @__PURE__ */ jsx(DraftModeContextProvider, { isEnabled, ...rest, children });
|
|
8
|
+
}
|
|
9
|
+
export {
|
|
10
|
+
DraftModeServerContextProvider as default
|
|
11
|
+
};
|
package/server.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
export { default as AdminBar } from './components/AdminBar';
|
|
2
|
+
export { LocalePrefix } from './hooks/useLink/interface';
|
|
2
3
|
export { createServerContext } from './lib/createServerContext';
|
|
3
4
|
export { default as DraftModeServerContextProvider } from './providers/DraftMode/server';
|
package/server.js
CHANGED
|
@@ -1,33 +1,11 @@
|
|
|
1
1
|
require("server-only");
|
|
2
2
|
"use strict";
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
tokens,
|
|
13
|
-
customTheme
|
|
14
|
-
}) {
|
|
15
|
-
const { isEnabled } = await headers.draftMode();
|
|
16
|
-
return isEnabled && /* @__PURE__ */ jsxRuntime.jsx(stackUi.Box, { themeName: `${themeName}.container`, tokens, customTheme, children: /* @__PURE__ */ jsxRuntime.jsx(stackUi.Box, { themeName: `${themeName}.content`, tokens, children }) });
|
|
17
|
-
}
|
|
18
|
-
function createServerContext(defaultValue) {
|
|
19
|
-
const getRef = react.cache(() => ({ current: defaultValue }));
|
|
20
|
-
const getValue = () => getRef().current;
|
|
21
|
-
const setValue = (value) => {
|
|
22
|
-
getRef().current = value;
|
|
23
|
-
};
|
|
24
|
-
return [getValue, setValue];
|
|
25
|
-
}
|
|
26
|
-
async function DraftModeServerContextProvider(props) {
|
|
27
|
-
const { children, ...rest } = props;
|
|
28
|
-
const { isEnabled } = await headers.draftMode();
|
|
29
|
-
return /* @__PURE__ */ jsxRuntime.jsx(index.DraftModeContextProvider, { isEnabled, ...rest, children });
|
|
30
|
-
}
|
|
31
|
-
exports.AdminBar = AdminBar;
|
|
32
|
-
exports.DraftModeServerContextProvider = DraftModeServerContextProvider;
|
|
33
|
-
exports.createServerContext = createServerContext;
|
|
4
|
+
const index = require("./components/AdminBar/index.js");
|
|
5
|
+
const _interface = require("./hooks/useLink/interface.js");
|
|
6
|
+
const index$1 = require("./lib/createServerContext/index.js");
|
|
7
|
+
const server = require("./providers/DraftMode/server.js");
|
|
8
|
+
exports.AdminBar = index;
|
|
9
|
+
exports.LocalePrefix = _interface.LocalePrefix;
|
|
10
|
+
exports.createServerContext = index$1.createServerContext;
|
|
11
|
+
exports.DraftModeServerContextProvider = server;
|
package/server.mjs
CHANGED
|
@@ -1,33 +1,11 @@
|
|
|
1
1
|
import "server-only";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { D as DraftModeContextProvider } from "./index-Ber8Ecgv.mjs";
|
|
7
|
-
async function AdminBar({
|
|
8
|
-
children,
|
|
9
|
-
themeName = "adminBar",
|
|
10
|
-
tokens,
|
|
11
|
-
customTheme
|
|
12
|
-
}) {
|
|
13
|
-
const { isEnabled } = await draftMode();
|
|
14
|
-
return isEnabled && /* @__PURE__ */ jsx(Box, { themeName: `${themeName}.container`, tokens, customTheme, children: /* @__PURE__ */ jsx(Box, { themeName: `${themeName}.content`, tokens, children }) });
|
|
15
|
-
}
|
|
16
|
-
function createServerContext(defaultValue) {
|
|
17
|
-
const getRef = cache(() => ({ current: defaultValue }));
|
|
18
|
-
const getValue = () => getRef().current;
|
|
19
|
-
const setValue = (value) => {
|
|
20
|
-
getRef().current = value;
|
|
21
|
-
};
|
|
22
|
-
return [getValue, setValue];
|
|
23
|
-
}
|
|
24
|
-
async function DraftModeServerContextProvider(props) {
|
|
25
|
-
const { children, ...rest } = props;
|
|
26
|
-
const { isEnabled } = await draftMode();
|
|
27
|
-
return /* @__PURE__ */ jsx(DraftModeContextProvider, { isEnabled, ...rest, children });
|
|
28
|
-
}
|
|
2
|
+
import { default as default2 } from "./components/AdminBar/index.mjs";
|
|
3
|
+
import { LocalePrefix } from "./hooks/useLink/interface.mjs";
|
|
4
|
+
import { createServerContext } from "./lib/createServerContext/index.mjs";
|
|
5
|
+
import { default as default3 } from "./providers/DraftMode/server.mjs";
|
|
29
6
|
export {
|
|
30
|
-
AdminBar,
|
|
31
|
-
DraftModeServerContextProvider,
|
|
7
|
+
default2 as AdminBar,
|
|
8
|
+
default3 as DraftModeServerContextProvider,
|
|
9
|
+
LocalePrefix,
|
|
32
10
|
createServerContext
|
|
33
11
|
};
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const tailwindVariants = require("tailwind-variants");
|
|
4
|
+
const adminBarContainer = tailwindVariants.tv({
|
|
5
|
+
base: "w-full bg-gray-100 py-2 px-4 border-gray-200 fixed left-0 right-0 z-50",
|
|
6
|
+
variants: {
|
|
7
|
+
position: {
|
|
8
|
+
top: "top-0 border-b",
|
|
9
|
+
bottom: "bottom-0 border-t"
|
|
10
|
+
},
|
|
11
|
+
fullWidth: {
|
|
12
|
+
true: "max-w-full"
|
|
13
|
+
},
|
|
14
|
+
background: {
|
|
15
|
+
grey: "bg-gray-100",
|
|
16
|
+
dark: "bg-gray-800 text-white",
|
|
17
|
+
light: "bg-white"
|
|
18
|
+
},
|
|
19
|
+
padding: {
|
|
20
|
+
small: "py-1 px-2",
|
|
21
|
+
medium: "py-2 px-4",
|
|
22
|
+
large: "py-3 px-6"
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
defaultVariants: {
|
|
26
|
+
position: "top",
|
|
27
|
+
background: "grey",
|
|
28
|
+
padding: "medium"
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
const adminBarContent = tailwindVariants.tv({
|
|
32
|
+
base: "flex items-center",
|
|
33
|
+
variants: {
|
|
34
|
+
justify: {
|
|
35
|
+
start: "justify-start",
|
|
36
|
+
center: "justify-center",
|
|
37
|
+
end: "justify-end",
|
|
38
|
+
between: "justify-between",
|
|
39
|
+
around: "justify-around",
|
|
40
|
+
evenly: "justify-evenly"
|
|
41
|
+
},
|
|
42
|
+
gap: {
|
|
43
|
+
small: "gap-2",
|
|
44
|
+
medium: "gap-4",
|
|
45
|
+
large: "gap-6"
|
|
46
|
+
},
|
|
47
|
+
wrap: {
|
|
48
|
+
true: "flex-wrap",
|
|
49
|
+
false: "flex-nowrap"
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
defaultVariants: {
|
|
53
|
+
justify: "between",
|
|
54
|
+
gap: "medium",
|
|
55
|
+
wrap: false
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
const adminBarButton = tailwindVariants.tv({
|
|
59
|
+
base: "px-3 py-1 rounded text-sm font-medium transition-colors",
|
|
60
|
+
variants: {
|
|
61
|
+
variant: {
|
|
62
|
+
primary: "bg-blue-600 text-white hover:bg-blue-700",
|
|
63
|
+
secondary: "bg-gray-200 text-gray-800 hover:bg-gray-300",
|
|
64
|
+
danger: "bg-red-600 text-white hover:bg-red-700"
|
|
65
|
+
},
|
|
66
|
+
size: {
|
|
67
|
+
small: "text-xs px-2 py-0.5",
|
|
68
|
+
medium: "text-sm px-3 py-1",
|
|
69
|
+
large: "text-base px-4 py-2"
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
defaultVariants: {
|
|
73
|
+
variant: "secondary",
|
|
74
|
+
size: "medium"
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
const adminBarError = tailwindVariants.tv({
|
|
78
|
+
base: "flex items-center justify-center bg-red-50 text-red-700 px-3 py-1 rounded-md text-sm",
|
|
79
|
+
variants: {
|
|
80
|
+
severity: {
|
|
81
|
+
low: "bg-yellow-50 text-yellow-700",
|
|
82
|
+
medium: "bg-red-50 text-red-700",
|
|
83
|
+
high: "bg-red-100 text-red-800 font-bold"
|
|
84
|
+
},
|
|
85
|
+
hasBorder: {
|
|
86
|
+
true: "border border-red-300",
|
|
87
|
+
false: ""
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
defaultVariants: {
|
|
91
|
+
severity: "medium",
|
|
92
|
+
hasBorder: true
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
const adminBarErrorTypography = tailwindVariants.tv({
|
|
96
|
+
base: "text-red-700 text-sm font-medium",
|
|
97
|
+
variants: {
|
|
98
|
+
severity: {
|
|
99
|
+
low: "text-yellow-700",
|
|
100
|
+
medium: "text-red-700",
|
|
101
|
+
high: "text-red-800 font-bold"
|
|
102
|
+
}
|
|
103
|
+
},
|
|
104
|
+
defaultVariants: {
|
|
105
|
+
severity: "medium"
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
const adminBarTheme = {
|
|
109
|
+
container: adminBarContainer,
|
|
110
|
+
content: adminBarContent,
|
|
111
|
+
button: adminBarButton,
|
|
112
|
+
error: adminBarError,
|
|
113
|
+
errorTypography: adminBarErrorTypography
|
|
114
|
+
};
|
|
115
|
+
exports.adminBarButton = adminBarButton;
|
|
116
|
+
exports.adminBarContainer = adminBarContainer;
|
|
117
|
+
exports.adminBarContent = adminBarContent;
|
|
118
|
+
exports.adminBarError = adminBarError;
|
|
119
|
+
exports.adminBarErrorTypography = adminBarErrorTypography;
|
|
120
|
+
exports.adminBarTheme = adminBarTheme;
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { tv } from "tailwind-variants";
|
|
2
|
+
const adminBarContainer = tv({
|
|
3
|
+
base: "w-full bg-gray-100 py-2 px-4 border-gray-200 fixed left-0 right-0 z-50",
|
|
4
|
+
variants: {
|
|
5
|
+
position: {
|
|
6
|
+
top: "top-0 border-b",
|
|
7
|
+
bottom: "bottom-0 border-t"
|
|
8
|
+
},
|
|
9
|
+
fullWidth: {
|
|
10
|
+
true: "max-w-full"
|
|
11
|
+
},
|
|
12
|
+
background: {
|
|
13
|
+
grey: "bg-gray-100",
|
|
14
|
+
dark: "bg-gray-800 text-white",
|
|
15
|
+
light: "bg-white"
|
|
16
|
+
},
|
|
17
|
+
padding: {
|
|
18
|
+
small: "py-1 px-2",
|
|
19
|
+
medium: "py-2 px-4",
|
|
20
|
+
large: "py-3 px-6"
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
defaultVariants: {
|
|
24
|
+
position: "top",
|
|
25
|
+
background: "grey",
|
|
26
|
+
padding: "medium"
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
const adminBarContent = tv({
|
|
30
|
+
base: "flex items-center",
|
|
31
|
+
variants: {
|
|
32
|
+
justify: {
|
|
33
|
+
start: "justify-start",
|
|
34
|
+
center: "justify-center",
|
|
35
|
+
end: "justify-end",
|
|
36
|
+
between: "justify-between",
|
|
37
|
+
around: "justify-around",
|
|
38
|
+
evenly: "justify-evenly"
|
|
39
|
+
},
|
|
40
|
+
gap: {
|
|
41
|
+
small: "gap-2",
|
|
42
|
+
medium: "gap-4",
|
|
43
|
+
large: "gap-6"
|
|
44
|
+
},
|
|
45
|
+
wrap: {
|
|
46
|
+
true: "flex-wrap",
|
|
47
|
+
false: "flex-nowrap"
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
defaultVariants: {
|
|
51
|
+
justify: "between",
|
|
52
|
+
gap: "medium",
|
|
53
|
+
wrap: false
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
const adminBarButton = tv({
|
|
57
|
+
base: "px-3 py-1 rounded text-sm font-medium transition-colors",
|
|
58
|
+
variants: {
|
|
59
|
+
variant: {
|
|
60
|
+
primary: "bg-blue-600 text-white hover:bg-blue-700",
|
|
61
|
+
secondary: "bg-gray-200 text-gray-800 hover:bg-gray-300",
|
|
62
|
+
danger: "bg-red-600 text-white hover:bg-red-700"
|
|
63
|
+
},
|
|
64
|
+
size: {
|
|
65
|
+
small: "text-xs px-2 py-0.5",
|
|
66
|
+
medium: "text-sm px-3 py-1",
|
|
67
|
+
large: "text-base px-4 py-2"
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
defaultVariants: {
|
|
71
|
+
variant: "secondary",
|
|
72
|
+
size: "medium"
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
const adminBarError = tv({
|
|
76
|
+
base: "flex items-center justify-center bg-red-50 text-red-700 px-3 py-1 rounded-md text-sm",
|
|
77
|
+
variants: {
|
|
78
|
+
severity: {
|
|
79
|
+
low: "bg-yellow-50 text-yellow-700",
|
|
80
|
+
medium: "bg-red-50 text-red-700",
|
|
81
|
+
high: "bg-red-100 text-red-800 font-bold"
|
|
82
|
+
},
|
|
83
|
+
hasBorder: {
|
|
84
|
+
true: "border border-red-300",
|
|
85
|
+
false: ""
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
defaultVariants: {
|
|
89
|
+
severity: "medium",
|
|
90
|
+
hasBorder: true
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
const adminBarErrorTypography = tv({
|
|
94
|
+
base: "text-red-700 text-sm font-medium",
|
|
95
|
+
variants: {
|
|
96
|
+
severity: {
|
|
97
|
+
low: "text-yellow-700",
|
|
98
|
+
medium: "text-red-700",
|
|
99
|
+
high: "text-red-800 font-bold"
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
defaultVariants: {
|
|
103
|
+
severity: "medium"
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
const adminBarTheme = {
|
|
107
|
+
container: adminBarContainer,
|
|
108
|
+
content: adminBarContent,
|
|
109
|
+
button: adminBarButton,
|
|
110
|
+
error: adminBarError,
|
|
111
|
+
errorTypography: adminBarErrorTypography
|
|
112
|
+
};
|
|
113
|
+
export {
|
|
114
|
+
adminBarButton,
|
|
115
|
+
adminBarContainer,
|
|
116
|
+
adminBarContent,
|
|
117
|
+
adminBarError,
|
|
118
|
+
adminBarErrorTypography,
|
|
119
|
+
adminBarTheme
|
|
120
|
+
};
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const tailwindVariants = require("tailwind-variants");
|
|
3
|
+
const button = tailwindVariants.tv({
|
|
4
|
+
base: `
|
|
5
|
+
flex
|
|
6
|
+
items-center
|
|
7
|
+
justify-center
|
|
8
|
+
gap-4
|
|
9
|
+
transition
|
|
10
|
+
duration-300
|
|
11
|
+
ease-in-out
|
|
12
|
+
disabled:pointer-events-none
|
|
13
|
+
disabled:opacity-30
|
|
14
|
+
focus-ring-black
|
|
15
|
+
`,
|
|
16
|
+
defaultVariants: {
|
|
17
|
+
buttonStyle: "default",
|
|
18
|
+
type: "button",
|
|
19
|
+
size: "default",
|
|
20
|
+
shape: "rounded"
|
|
21
|
+
},
|
|
22
|
+
variants: {
|
|
23
|
+
type: {
|
|
24
|
+
button: "",
|
|
25
|
+
menu: "text-2xl"
|
|
26
|
+
},
|
|
27
|
+
buttonStyle: {
|
|
28
|
+
default: `
|
|
29
|
+
px-4
|
|
30
|
+
py-2
|
|
31
|
+
text-white
|
|
32
|
+
!bg-color-1-500
|
|
33
|
+
hover:!bg-color-1-400
|
|
34
|
+
active:!bg-color-1-400
|
|
35
|
+
`,
|
|
36
|
+
outline: `
|
|
37
|
+
px-4
|
|
38
|
+
py-2
|
|
39
|
+
bg-transparent
|
|
40
|
+
!border-color-1-500
|
|
41
|
+
border-2
|
|
42
|
+
text-color-1-500
|
|
43
|
+
hover:bg-color-1-500
|
|
44
|
+
hover:text-white
|
|
45
|
+
active:bg-color-1-500
|
|
46
|
+
active:text-white
|
|
47
|
+
`,
|
|
48
|
+
hollow: `
|
|
49
|
+
px-2
|
|
50
|
+
bg-transparent
|
|
51
|
+
text-color-1-500
|
|
52
|
+
hover:border-b-color-1-500
|
|
53
|
+
active:border-b-color-1-500
|
|
54
|
+
focus:border-b-color-1-500
|
|
55
|
+
`
|
|
56
|
+
},
|
|
57
|
+
intent: {
|
|
58
|
+
error: `
|
|
59
|
+
!bg-error
|
|
60
|
+
text-white
|
|
61
|
+
pointer-events-none
|
|
62
|
+
!border-error
|
|
63
|
+
`
|
|
64
|
+
},
|
|
65
|
+
size: {
|
|
66
|
+
default: `min-w-12 min-h-6`,
|
|
67
|
+
large: `min-w-36 min-h-18`
|
|
68
|
+
},
|
|
69
|
+
shape: {
|
|
70
|
+
rounded: `rounded-md`,
|
|
71
|
+
circular: `rounded-full`
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
module.exports = button;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { tv } from "tailwind-variants";
|
|
2
|
+
const button = tv({
|
|
3
|
+
base: `
|
|
4
|
+
flex
|
|
5
|
+
items-center
|
|
6
|
+
justify-center
|
|
7
|
+
gap-4
|
|
8
|
+
transition
|
|
9
|
+
duration-300
|
|
10
|
+
ease-in-out
|
|
11
|
+
disabled:pointer-events-none
|
|
12
|
+
disabled:opacity-30
|
|
13
|
+
focus-ring-black
|
|
14
|
+
`,
|
|
15
|
+
defaultVariants: {
|
|
16
|
+
buttonStyle: "default",
|
|
17
|
+
type: "button",
|
|
18
|
+
size: "default",
|
|
19
|
+
shape: "rounded"
|
|
20
|
+
},
|
|
21
|
+
variants: {
|
|
22
|
+
type: {
|
|
23
|
+
button: "",
|
|
24
|
+
menu: "text-2xl"
|
|
25
|
+
},
|
|
26
|
+
buttonStyle: {
|
|
27
|
+
default: `
|
|
28
|
+
px-4
|
|
29
|
+
py-2
|
|
30
|
+
text-white
|
|
31
|
+
!bg-color-1-500
|
|
32
|
+
hover:!bg-color-1-400
|
|
33
|
+
active:!bg-color-1-400
|
|
34
|
+
`,
|
|
35
|
+
outline: `
|
|
36
|
+
px-4
|
|
37
|
+
py-2
|
|
38
|
+
bg-transparent
|
|
39
|
+
!border-color-1-500
|
|
40
|
+
border-2
|
|
41
|
+
text-color-1-500
|
|
42
|
+
hover:bg-color-1-500
|
|
43
|
+
hover:text-white
|
|
44
|
+
active:bg-color-1-500
|
|
45
|
+
active:text-white
|
|
46
|
+
`,
|
|
47
|
+
hollow: `
|
|
48
|
+
px-2
|
|
49
|
+
bg-transparent
|
|
50
|
+
text-color-1-500
|
|
51
|
+
hover:border-b-color-1-500
|
|
52
|
+
active:border-b-color-1-500
|
|
53
|
+
focus:border-b-color-1-500
|
|
54
|
+
`
|
|
55
|
+
},
|
|
56
|
+
intent: {
|
|
57
|
+
error: `
|
|
58
|
+
!bg-error
|
|
59
|
+
text-white
|
|
60
|
+
pointer-events-none
|
|
61
|
+
!border-error
|
|
62
|
+
`
|
|
63
|
+
},
|
|
64
|
+
size: {
|
|
65
|
+
default: `min-w-12 min-h-6`,
|
|
66
|
+
large: `min-w-36 min-h-18`
|
|
67
|
+
},
|
|
68
|
+
shape: {
|
|
69
|
+
rounded: `rounded-md`,
|
|
70
|
+
circular: `rounded-full`
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
export {
|
|
75
|
+
button as default
|
|
76
|
+
};
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const tailwindVariants = require("tailwind-variants");
|
|
3
|
+
const index$1 = require("../Button/index.js");
|
|
4
|
+
const index = require("../Typography/index.js");
|
|
5
|
+
const filterTagGroupWrapper = tailwindVariants.tv({
|
|
6
|
+
base: "w-full flex flex-col gap-2"
|
|
7
|
+
});
|
|
8
|
+
const filterTagGroupTags = tailwindVariants.tv({
|
|
9
|
+
base: "flex flex-col gap-2 max-w-[150px] items-center mx-auto"
|
|
10
|
+
});
|
|
11
|
+
const filterTagGroupLabel = tailwindVariants.tv({
|
|
12
|
+
extend: index,
|
|
13
|
+
defaultVariants: { size: "h4" }
|
|
14
|
+
});
|
|
15
|
+
const filterTagGroupDescription = tailwindVariants.tv({
|
|
16
|
+
extend: index,
|
|
17
|
+
base: "block",
|
|
18
|
+
defaultVariants: { size: "footnotes" }
|
|
19
|
+
});
|
|
20
|
+
const filterTagGroupErrorMessage = tailwindVariants.tv({
|
|
21
|
+
extend: index,
|
|
22
|
+
base: "block",
|
|
23
|
+
defaultVariants: { isError: true }
|
|
24
|
+
});
|
|
25
|
+
const filterTagGroupTagWrapper = tailwindVariants.tv({
|
|
26
|
+
base: [
|
|
27
|
+
index$1({ buttonStyle: "outline" }),
|
|
28
|
+
`
|
|
29
|
+
focus-visible:outline
|
|
30
|
+
focus-visible:outline-offset-2
|
|
31
|
+
focus-visible:outline-2
|
|
32
|
+
focus-visible:outline-black
|
|
33
|
+
`
|
|
34
|
+
],
|
|
35
|
+
variants: {
|
|
36
|
+
isSelected: {
|
|
37
|
+
true: [index$1({ buttonStyle: "default" })]
|
|
38
|
+
},
|
|
39
|
+
isDisabled: {
|
|
40
|
+
true: "pointer-events-none opacity-30"
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
const filterTagGroupTagContainer = tailwindVariants.tv({
|
|
45
|
+
extend: index,
|
|
46
|
+
base: "flex items-center justify-center"
|
|
47
|
+
});
|
|
48
|
+
const filterPopoverButton = tailwindVariants.tv({
|
|
49
|
+
extend: index$1,
|
|
50
|
+
base: "!min-w-[200px]"
|
|
51
|
+
});
|
|
52
|
+
const filterPopoverPopover = tailwindVariants.tv({
|
|
53
|
+
base: "w-[var(--filter-popover-container-width)] bg-gray-300 rounded-md p-4"
|
|
54
|
+
});
|
|
55
|
+
const filterTheme = {
|
|
56
|
+
popover: {
|
|
57
|
+
button: filterPopoverButton,
|
|
58
|
+
popover: filterPopoverPopover
|
|
59
|
+
},
|
|
60
|
+
tagGroup: {
|
|
61
|
+
wrapper: filterTagGroupWrapper,
|
|
62
|
+
tags: filterTagGroupTags,
|
|
63
|
+
label: filterTagGroupLabel,
|
|
64
|
+
description: filterTagGroupDescription,
|
|
65
|
+
errorMessage: filterTagGroupErrorMessage,
|
|
66
|
+
tag: {
|
|
67
|
+
wrapper: filterTagGroupTagWrapper,
|
|
68
|
+
container: filterTagGroupTagContainer
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
module.exports = filterTheme;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { tv } from "tailwind-variants";
|
|
2
|
+
import button from "../Button/index.mjs";
|
|
3
|
+
import typography from "../Typography/index.mjs";
|
|
4
|
+
const filterTagGroupWrapper = tv({
|
|
5
|
+
base: "w-full flex flex-col gap-2"
|
|
6
|
+
});
|
|
7
|
+
const filterTagGroupTags = tv({
|
|
8
|
+
base: "flex flex-col gap-2 max-w-[150px] items-center mx-auto"
|
|
9
|
+
});
|
|
10
|
+
const filterTagGroupLabel = tv({
|
|
11
|
+
extend: typography,
|
|
12
|
+
defaultVariants: { size: "h4" }
|
|
13
|
+
});
|
|
14
|
+
const filterTagGroupDescription = tv({
|
|
15
|
+
extend: typography,
|
|
16
|
+
base: "block",
|
|
17
|
+
defaultVariants: { size: "footnotes" }
|
|
18
|
+
});
|
|
19
|
+
const filterTagGroupErrorMessage = tv({
|
|
20
|
+
extend: typography,
|
|
21
|
+
base: "block",
|
|
22
|
+
defaultVariants: { isError: true }
|
|
23
|
+
});
|
|
24
|
+
const filterTagGroupTagWrapper = tv({
|
|
25
|
+
base: [
|
|
26
|
+
button({ buttonStyle: "outline" }),
|
|
27
|
+
`
|
|
28
|
+
focus-visible:outline
|
|
29
|
+
focus-visible:outline-offset-2
|
|
30
|
+
focus-visible:outline-2
|
|
31
|
+
focus-visible:outline-black
|
|
32
|
+
`
|
|
33
|
+
],
|
|
34
|
+
variants: {
|
|
35
|
+
isSelected: {
|
|
36
|
+
true: [button({ buttonStyle: "default" })]
|
|
37
|
+
},
|
|
38
|
+
isDisabled: {
|
|
39
|
+
true: "pointer-events-none opacity-30"
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
const filterTagGroupTagContainer = tv({
|
|
44
|
+
extend: typography,
|
|
45
|
+
base: "flex items-center justify-center"
|
|
46
|
+
});
|
|
47
|
+
const filterPopoverButton = tv({
|
|
48
|
+
extend: button,
|
|
49
|
+
base: "!min-w-[200px]"
|
|
50
|
+
});
|
|
51
|
+
const filterPopoverPopover = tv({
|
|
52
|
+
base: "w-[var(--filter-popover-container-width)] bg-gray-300 rounded-md p-4"
|
|
53
|
+
});
|
|
54
|
+
const filterTheme = {
|
|
55
|
+
popover: {
|
|
56
|
+
button: filterPopoverButton,
|
|
57
|
+
popover: filterPopoverPopover
|
|
58
|
+
},
|
|
59
|
+
tagGroup: {
|
|
60
|
+
wrapper: filterTagGroupWrapper,
|
|
61
|
+
tags: filterTagGroupTags,
|
|
62
|
+
label: filterTagGroupLabel,
|
|
63
|
+
description: filterTagGroupDescription,
|
|
64
|
+
errorMessage: filterTagGroupErrorMessage,
|
|
65
|
+
tag: {
|
|
66
|
+
wrapper: filterTagGroupTagWrapper,
|
|
67
|
+
container: filterTagGroupTagContainer
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
export {
|
|
72
|
+
filterTheme as default
|
|
73
|
+
};
|