@okam/next-component 2.0.3 → 2.1.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.
Files changed (39) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/hooks/useLink/interface.d.ts +4 -1
  3. package/{providers/DraftMode/index.mjs → index-Ber8Ecgv.mjs} +2 -3
  4. package/{providers/DraftMode/index.js → index-DV6W6v68.js} +0 -2
  5. package/index.js +590 -18
  6. package/index.mjs +587 -15
  7. package/package.json +2 -3
  8. package/server.js +31 -7
  9. package/server.mjs +30 -6
  10. package/components/AdminBar/index.js +0 -14
  11. package/components/AdminBar/index.mjs +0 -15
  12. package/components/Filter/index.js +0 -54
  13. package/components/Filter/index.mjs +0 -55
  14. package/components/Img/index.js +0 -29
  15. package/components/Img/index.mjs +0 -30
  16. package/components/Link/index.js +0 -39
  17. package/components/Link/index.mjs +0 -40
  18. package/hooks/useFilterState/index.js +0 -50
  19. package/hooks/useFilterState/index.mjs +0 -50
  20. package/hooks/useHash/index.js +0 -25
  21. package/hooks/useHash/index.mjs +0 -25
  22. package/hooks/useLink/index.js +0 -99
  23. package/hooks/useLink/index.mjs +0 -99
  24. package/lib/createServerContext/index.js +0 -12
  25. package/lib/createServerContext/index.mjs +0 -12
  26. package/providers/AdminBar/index.js +0 -17
  27. package/providers/AdminBar/index.mjs +0 -17
  28. package/providers/DraftMode/server.js +0 -10
  29. package/providers/DraftMode/server.mjs +0 -11
  30. package/theme/AdminBar/index.js +0 -120
  31. package/theme/AdminBar/index.mjs +0 -120
  32. package/theme/Button/index.js +0 -75
  33. package/theme/Button/index.mjs +0 -76
  34. package/theme/Filter/index.js +0 -72
  35. package/theme/Filter/index.mjs +0 -73
  36. package/theme/Typography/index.js +0 -43
  37. package/theme/Typography/index.mjs +0 -44
  38. package/theme/index.js +0 -16
  39. package/theme/index.mjs +0 -17
@@ -1,17 +0,0 @@
1
- "use client";
2
- import { jsx } from "react/jsx-runtime";
3
- import { createCtx } from "@okam/react-utils";
4
- import { useState, useMemo } from "react";
5
- const adminBarCtx = createCtx();
6
- const useAdminBar = adminBarCtx[0];
7
- const AdminBarProvider = adminBarCtx[1];
8
- function AdminBarContextProvider(props) {
9
- const { children } = props;
10
- const [error, setError] = useState();
11
- const value = useMemo(() => ({ error, setError }), [error]);
12
- return /* @__PURE__ */ jsx(AdminBarProvider, { value, children });
13
- }
14
- export {
15
- AdminBarContextProvider,
16
- useAdminBar
17
- };
@@ -1,10 +0,0 @@
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;
@@ -1,11 +0,0 @@
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
- };
@@ -1,120 +0,0 @@
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;
@@ -1,120 +0,0 @@
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
- };
@@ -1,75 +0,0 @@
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;
@@ -1,76 +0,0 @@
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
- };
@@ -1,72 +0,0 @@
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;
@@ -1,73 +0,0 @@
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
- };
@@ -1,43 +0,0 @@
1
- "use strict";
2
- const tailwindVariants = require("tailwind-variants");
3
- const typography = tailwindVariants.tv({
4
- variants: {
5
- size: {
6
- h1: `text-5xl`,
7
- h2: `text-4xl`,
8
- h3: `text-3xl`,
9
- h4: `text-2xl`,
10
- h5: `text-xl`,
11
- h6: `text-lg`,
12
- leading: `text-md font-bold leading-normal`,
13
- paragraph: `text-md inline`,
14
- footnotes: `text-sm`,
15
- xs: `text-xs`
16
- },
17
- font: {
18
- body: `font-body`
19
- },
20
- weight: {
21
- normal: `font-normal`,
22
- light: `font-light`,
23
- bold: "font-bold"
24
- },
25
- color: {
26
- gray: `text-gray-500`,
27
- white: `text-white`
28
- },
29
- isError: {
30
- true: "text-sm text-error py-3"
31
- },
32
- align: {
33
- center: "text-center",
34
- left: "text-left",
35
- right: "text-right"
36
- }
37
- },
38
- defaultVariants: {
39
- size: "paragraph",
40
- font: "body"
41
- }
42
- });
43
- module.exports = typography;
@@ -1,44 +0,0 @@
1
- import { tv } from "tailwind-variants";
2
- const typography = tv({
3
- variants: {
4
- size: {
5
- h1: `text-5xl`,
6
- h2: `text-4xl`,
7
- h3: `text-3xl`,
8
- h4: `text-2xl`,
9
- h5: `text-xl`,
10
- h6: `text-lg`,
11
- leading: `text-md font-bold leading-normal`,
12
- paragraph: `text-md inline`,
13
- footnotes: `text-sm`,
14
- xs: `text-xs`
15
- },
16
- font: {
17
- body: `font-body`
18
- },
19
- weight: {
20
- normal: `font-normal`,
21
- light: `font-light`,
22
- bold: "font-bold"
23
- },
24
- color: {
25
- gray: `text-gray-500`,
26
- white: `text-white`
27
- },
28
- isError: {
29
- true: "text-sm text-error py-3"
30
- },
31
- align: {
32
- center: "text-center",
33
- left: "text-left",
34
- right: "text-right"
35
- }
36
- },
37
- defaultVariants: {
38
- size: "paragraph",
39
- font: "body"
40
- }
41
- });
42
- export {
43
- typography as default
44
- };
package/theme/index.js DELETED
@@ -1,16 +0,0 @@
1
- "use client";
2
- "use strict";
3
- const stackUi = require("@okam/stack-ui");
4
- const react = require("react");
5
- const index$1 = require("./AdminBar/index.js");
6
- const index$3 = require("./Button/index.js");
7
- const index$4 = require("./Filter/index.js");
8
- const index$2 = require("./Typography/index.js");
9
- const BaseTheme = stackUi.makeTheme({
10
- filter: index$4,
11
- button: index$3,
12
- typography: index$2,
13
- adminBar: index$1.adminBarTheme
14
- });
15
- const index = react.memo(stackUi.createThemeProvider(BaseTheme));
16
- module.exports = index;
package/theme/index.mjs DELETED
@@ -1,17 +0,0 @@
1
- "use client";
2
- import { createThemeProvider, makeTheme } from "@okam/stack-ui";
3
- import { memo } from "react";
4
- import { adminBarTheme } from "./AdminBar/index.mjs";
5
- import button from "./Button/index.mjs";
6
- import filterTheme from "./Filter/index.mjs";
7
- import typography from "./Typography/index.mjs";
8
- const BaseTheme = makeTheme({
9
- filter: filterTheme,
10
- button,
11
- typography,
12
- adminBar: adminBarTheme
13
- });
14
- const index = memo(createThemeProvider(BaseTheme));
15
- export {
16
- index as default
17
- };