@doneisbetter/gds-theme 2.6.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/dist/chunk-AS4RLGFF.mjs +218 -0
- package/dist/chunk-TAI4BSAN.mjs +42 -0
- package/dist/client.d.mts +29 -0
- package/dist/client.d.ts +29 -0
- package/dist/client.js +290 -0
- package/dist/client.mjs +24 -0
- package/dist/index.d.mts +5 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +290 -0
- package/dist/index.mjs +24 -0
- package/dist/server.d.mts +16 -0
- package/dist/server.d.ts +16 -0
- package/dist/server.js +250 -0
- package/dist/server.mjs +18 -0
- package/package.json +56 -0
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
// src/theme.ts
|
|
2
|
+
import { DEFAULT_THEME, createTheme, mergeMantineTheme, mergeThemeOverrides } from "@mantine/core";
|
|
3
|
+
var baseTheme = mergeMantineTheme(DEFAULT_THEME, createTheme({
|
|
4
|
+
primaryColor: "violet",
|
|
5
|
+
fontFamily: "Inter, system-ui, Avenir, Helvetica, Arial, sans-serif",
|
|
6
|
+
fontSmoothing: true,
|
|
7
|
+
defaultRadius: "md",
|
|
8
|
+
black: "#111827",
|
|
9
|
+
white: "#ffffff",
|
|
10
|
+
headings: {
|
|
11
|
+
fontFamily: "Inter, system-ui, Avenir, Helvetica, Arial, sans-serif",
|
|
12
|
+
sizes: {
|
|
13
|
+
h1: { fontSize: "2.5rem", fontWeight: "800" },
|
|
14
|
+
h2: { fontSize: "1.75rem", fontWeight: "700" },
|
|
15
|
+
h3: { fontSize: "1.25rem", fontWeight: "600" }
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
shadows: {
|
|
19
|
+
md: "0 8px 24px rgba(15, 23, 42, 0.08)",
|
|
20
|
+
lg: "0 16px 40px rgba(15, 23, 42, 0.12)"
|
|
21
|
+
},
|
|
22
|
+
components: {
|
|
23
|
+
Button: {
|
|
24
|
+
defaultProps: {
|
|
25
|
+
radius: "md",
|
|
26
|
+
size: "sm",
|
|
27
|
+
fw: 600
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
Card: {
|
|
31
|
+
defaultProps: {
|
|
32
|
+
radius: "lg",
|
|
33
|
+
shadow: "sm",
|
|
34
|
+
withBorder: true
|
|
35
|
+
},
|
|
36
|
+
styles: {
|
|
37
|
+
root: {
|
|
38
|
+
backgroundColor: "var(--mantine-color-body)"
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
Paper: {
|
|
43
|
+
defaultProps: {
|
|
44
|
+
radius: "lg",
|
|
45
|
+
withBorder: true
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
TextInput: {
|
|
49
|
+
defaultProps: {
|
|
50
|
+
radius: "md"
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
Table: {
|
|
54
|
+
defaultProps: {
|
|
55
|
+
highlightOnHover: true,
|
|
56
|
+
verticalSpacing: "md"
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
Badge: {
|
|
60
|
+
defaultProps: {
|
|
61
|
+
radius: "xl"
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}));
|
|
66
|
+
var gdsTheme = baseTheme;
|
|
67
|
+
var gdsDarkPublicTheme = extendGdsTheme({
|
|
68
|
+
primaryColor: "violet",
|
|
69
|
+
components: {
|
|
70
|
+
AppShell: {
|
|
71
|
+
styles: {
|
|
72
|
+
main: {
|
|
73
|
+
backgroundColor: "var(--mantine-color-dark-8)"
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
Card: {
|
|
78
|
+
styles: {
|
|
79
|
+
root: {
|
|
80
|
+
backgroundColor: "var(--mantine-color-dark-7)",
|
|
81
|
+
borderColor: "var(--mantine-color-dark-4)"
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
Paper: {
|
|
86
|
+
styles: {
|
|
87
|
+
root: {
|
|
88
|
+
backgroundColor: "var(--mantine-color-dark-7)",
|
|
89
|
+
borderColor: "var(--mantine-color-dark-4)"
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
Table: {
|
|
94
|
+
styles: {
|
|
95
|
+
table: {
|
|
96
|
+
color: "var(--mantine-color-gray-0)"
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
var gdsFlatSurfaceTheme = extendGdsTheme({
|
|
103
|
+
shadows: {
|
|
104
|
+
xs: "none",
|
|
105
|
+
sm: "none",
|
|
106
|
+
md: "none",
|
|
107
|
+
lg: "none",
|
|
108
|
+
xl: "none"
|
|
109
|
+
},
|
|
110
|
+
components: {
|
|
111
|
+
Card: {
|
|
112
|
+
defaultProps: {
|
|
113
|
+
shadow: void 0,
|
|
114
|
+
withBorder: true
|
|
115
|
+
}
|
|
116
|
+
},
|
|
117
|
+
Paper: {
|
|
118
|
+
defaultProps: {
|
|
119
|
+
withBorder: true
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
});
|
|
124
|
+
var gdsEditorialPublicTheme = extendGdsTheme({
|
|
125
|
+
headings: {
|
|
126
|
+
fontFamily: '"Instrument Serif", Georgia, "Times New Roman", serif',
|
|
127
|
+
sizes: {
|
|
128
|
+
h1: { fontSize: "2.75rem", fontWeight: "700" },
|
|
129
|
+
h2: { fontSize: "2rem", fontWeight: "700" },
|
|
130
|
+
h3: { fontSize: "1.375rem", fontWeight: "600" }
|
|
131
|
+
}
|
|
132
|
+
},
|
|
133
|
+
shadows: {
|
|
134
|
+
xs: "none",
|
|
135
|
+
sm: "none",
|
|
136
|
+
md: "none",
|
|
137
|
+
lg: "none",
|
|
138
|
+
xl: "none"
|
|
139
|
+
},
|
|
140
|
+
components: {
|
|
141
|
+
Card: {
|
|
142
|
+
defaultProps: {
|
|
143
|
+
shadow: void 0,
|
|
144
|
+
withBorder: true
|
|
145
|
+
}
|
|
146
|
+
},
|
|
147
|
+
Paper: {
|
|
148
|
+
defaultProps: {
|
|
149
|
+
withBorder: true
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
});
|
|
154
|
+
function createPublicBrandTheme({
|
|
155
|
+
editorialSerif = false,
|
|
156
|
+
flatSurfaces = false,
|
|
157
|
+
overrides = {}
|
|
158
|
+
} = {}) {
|
|
159
|
+
const layeredOverrides = [];
|
|
160
|
+
if (flatSurfaces) {
|
|
161
|
+
layeredOverrides.push(gdsFlatSurfaceTheme);
|
|
162
|
+
}
|
|
163
|
+
if (editorialSerif) {
|
|
164
|
+
layeredOverrides.push(gdsEditorialPublicTheme);
|
|
165
|
+
}
|
|
166
|
+
layeredOverrides.push(overrides);
|
|
167
|
+
const mergedOverrides = layeredOverrides.reduce(
|
|
168
|
+
(theme, layer) => mergeThemeOverrides(theme, layer),
|
|
169
|
+
{}
|
|
170
|
+
);
|
|
171
|
+
return extendGdsTheme(mergedOverrides);
|
|
172
|
+
}
|
|
173
|
+
function extendGdsTheme(overrides = {}) {
|
|
174
|
+
return mergeMantineTheme(baseTheme, overrides);
|
|
175
|
+
}
|
|
176
|
+
function withGdsMotion(overrides = {}) {
|
|
177
|
+
return extendGdsTheme(
|
|
178
|
+
mergeThemeOverrides(
|
|
179
|
+
{
|
|
180
|
+
components: {
|
|
181
|
+
Button: {
|
|
182
|
+
styles: {
|
|
183
|
+
root: {
|
|
184
|
+
transition: "transform 150ms ease, filter 120ms ease",
|
|
185
|
+
"&:hover": {
|
|
186
|
+
transform: "translateY(-1px)",
|
|
187
|
+
filter: "brightness(1.05)"
|
|
188
|
+
},
|
|
189
|
+
"&:active": {
|
|
190
|
+
transform: "translateY(0)",
|
|
191
|
+
filter: "brightness(0.95)"
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
},
|
|
196
|
+
Card: {
|
|
197
|
+
styles: {
|
|
198
|
+
root: {
|
|
199
|
+
transition: "transform 150ms ease, box-shadow 150ms ease"
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
},
|
|
205
|
+
overrides
|
|
206
|
+
)
|
|
207
|
+
);
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
export {
|
|
211
|
+
gdsTheme,
|
|
212
|
+
gdsDarkPublicTheme,
|
|
213
|
+
gdsFlatSurfaceTheme,
|
|
214
|
+
gdsEditorialPublicTheme,
|
|
215
|
+
createPublicBrandTheme,
|
|
216
|
+
extendGdsTheme,
|
|
217
|
+
withGdsMotion
|
|
218
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import {
|
|
2
|
+
gdsTheme
|
|
3
|
+
} from "./chunk-AS4RLGFF.mjs";
|
|
4
|
+
|
|
5
|
+
// src/i18n.ts
|
|
6
|
+
import { createContext, useContext } from "react";
|
|
7
|
+
var GdsI18nContext = createContext({
|
|
8
|
+
locale: "en",
|
|
9
|
+
messages: {}
|
|
10
|
+
});
|
|
11
|
+
function useGdsTranslation() {
|
|
12
|
+
const { messages, locale } = useContext(GdsI18nContext);
|
|
13
|
+
return {
|
|
14
|
+
t: (id, defaultMessage) => messages[id] || defaultMessage,
|
|
15
|
+
locale
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
// src/GdsProvider.tsx
|
|
20
|
+
import { MantineProvider, DirectionProvider, Box } from "@mantine/core";
|
|
21
|
+
import { ModalsProvider } from "@mantine/modals";
|
|
22
|
+
import { Notifications } from "@mantine/notifications";
|
|
23
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
24
|
+
function GdsProvider({
|
|
25
|
+
children,
|
|
26
|
+
locale = "en",
|
|
27
|
+
messages = {},
|
|
28
|
+
theme = gdsTheme,
|
|
29
|
+
defaultColorScheme = "light"
|
|
30
|
+
}) {
|
|
31
|
+
const isRtl = ["ar", "he"].includes(locale);
|
|
32
|
+
const dir = isRtl ? "rtl" : "ltr";
|
|
33
|
+
return /* @__PURE__ */ jsx(DirectionProvider, { initialDirection: dir, children: /* @__PURE__ */ jsx(GdsI18nContext.Provider, { value: { locale, messages }, children: /* @__PURE__ */ jsx(MantineProvider, { theme, withCssVariables: true, withGlobalClasses: true, defaultColorScheme, children: /* @__PURE__ */ jsx(ModalsProvider, { children: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
34
|
+
/* @__PURE__ */ jsx(Notifications, {}),
|
|
35
|
+
/* @__PURE__ */ jsx(Box, { dir, h: "100%", children })
|
|
36
|
+
] }) }) }) }) });
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export {
|
|
40
|
+
useGdsTranslation,
|
|
41
|
+
GdsProvider
|
|
42
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export { createPublicBrandTheme, extendGdsTheme, gdsDarkPublicTheme, gdsEditorialPublicTheme, gdsFlatSurfaceTheme, gdsTheme, withGdsMotion } from './server.mjs';
|
|
2
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { MantineThemeOverride } from '@mantine/core';
|
|
5
|
+
|
|
6
|
+
interface GdsProviderProps {
|
|
7
|
+
children: React.ReactNode;
|
|
8
|
+
locale?: string;
|
|
9
|
+
messages?: Record<string, string>;
|
|
10
|
+
theme?: MantineThemeOverride;
|
|
11
|
+
defaultColorScheme?: 'light' | 'dark' | 'auto';
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* GdsProvider is the single required root provider for any application
|
|
15
|
+
* adopting the General Design System. It injects the strict Mantine theme.
|
|
16
|
+
*/
|
|
17
|
+
declare function GdsProvider({ children, locale, messages, theme, defaultColorScheme, }: GdsProviderProps): react_jsx_runtime.JSX.Element;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* useGdsTranslation provides a lightweight translation hook.
|
|
21
|
+
* It looks up the translation key in the provider's message dictionary,
|
|
22
|
+
* and falls back to the default semantic English string if not found.
|
|
23
|
+
*/
|
|
24
|
+
declare function useGdsTranslation(): {
|
|
25
|
+
t: (id: string, defaultMessage: string) => string;
|
|
26
|
+
locale: string;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export { GdsProvider, type GdsProviderProps, useGdsTranslation };
|
package/dist/client.d.ts
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export { createPublicBrandTheme, extendGdsTheme, gdsDarkPublicTheme, gdsEditorialPublicTheme, gdsFlatSurfaceTheme, gdsTheme, withGdsMotion } from './server.js';
|
|
2
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { MantineThemeOverride } from '@mantine/core';
|
|
5
|
+
|
|
6
|
+
interface GdsProviderProps {
|
|
7
|
+
children: React.ReactNode;
|
|
8
|
+
locale?: string;
|
|
9
|
+
messages?: Record<string, string>;
|
|
10
|
+
theme?: MantineThemeOverride;
|
|
11
|
+
defaultColorScheme?: 'light' | 'dark' | 'auto';
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* GdsProvider is the single required root provider for any application
|
|
15
|
+
* adopting the General Design System. It injects the strict Mantine theme.
|
|
16
|
+
*/
|
|
17
|
+
declare function GdsProvider({ children, locale, messages, theme, defaultColorScheme, }: GdsProviderProps): react_jsx_runtime.JSX.Element;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* useGdsTranslation provides a lightweight translation hook.
|
|
21
|
+
* It looks up the translation key in the provider's message dictionary,
|
|
22
|
+
* and falls back to the default semantic English string if not found.
|
|
23
|
+
*/
|
|
24
|
+
declare function useGdsTranslation(): {
|
|
25
|
+
t: (id: string, defaultMessage: string) => string;
|
|
26
|
+
locale: string;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export { GdsProvider, type GdsProviderProps, useGdsTranslation };
|
package/dist/client.js
ADDED
|
@@ -0,0 +1,290 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/client.ts
|
|
21
|
+
var client_exports = {};
|
|
22
|
+
__export(client_exports, {
|
|
23
|
+
GdsProvider: () => GdsProvider,
|
|
24
|
+
createPublicBrandTheme: () => createPublicBrandTheme,
|
|
25
|
+
extendGdsTheme: () => extendGdsTheme,
|
|
26
|
+
gdsDarkPublicTheme: () => gdsDarkPublicTheme,
|
|
27
|
+
gdsEditorialPublicTheme: () => gdsEditorialPublicTheme,
|
|
28
|
+
gdsFlatSurfaceTheme: () => gdsFlatSurfaceTheme,
|
|
29
|
+
gdsTheme: () => gdsTheme,
|
|
30
|
+
useGdsTranslation: () => useGdsTranslation,
|
|
31
|
+
withGdsMotion: () => withGdsMotion
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(client_exports);
|
|
34
|
+
|
|
35
|
+
// src/theme.ts
|
|
36
|
+
var import_core = require("@mantine/core");
|
|
37
|
+
var baseTheme = (0, import_core.mergeMantineTheme)(import_core.DEFAULT_THEME, (0, import_core.createTheme)({
|
|
38
|
+
primaryColor: "violet",
|
|
39
|
+
fontFamily: "Inter, system-ui, Avenir, Helvetica, Arial, sans-serif",
|
|
40
|
+
fontSmoothing: true,
|
|
41
|
+
defaultRadius: "md",
|
|
42
|
+
black: "#111827",
|
|
43
|
+
white: "#ffffff",
|
|
44
|
+
headings: {
|
|
45
|
+
fontFamily: "Inter, system-ui, Avenir, Helvetica, Arial, sans-serif",
|
|
46
|
+
sizes: {
|
|
47
|
+
h1: { fontSize: "2.5rem", fontWeight: "800" },
|
|
48
|
+
h2: { fontSize: "1.75rem", fontWeight: "700" },
|
|
49
|
+
h3: { fontSize: "1.25rem", fontWeight: "600" }
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
shadows: {
|
|
53
|
+
md: "0 8px 24px rgba(15, 23, 42, 0.08)",
|
|
54
|
+
lg: "0 16px 40px rgba(15, 23, 42, 0.12)"
|
|
55
|
+
},
|
|
56
|
+
components: {
|
|
57
|
+
Button: {
|
|
58
|
+
defaultProps: {
|
|
59
|
+
radius: "md",
|
|
60
|
+
size: "sm",
|
|
61
|
+
fw: 600
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
Card: {
|
|
65
|
+
defaultProps: {
|
|
66
|
+
radius: "lg",
|
|
67
|
+
shadow: "sm",
|
|
68
|
+
withBorder: true
|
|
69
|
+
},
|
|
70
|
+
styles: {
|
|
71
|
+
root: {
|
|
72
|
+
backgroundColor: "var(--mantine-color-body)"
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
Paper: {
|
|
77
|
+
defaultProps: {
|
|
78
|
+
radius: "lg",
|
|
79
|
+
withBorder: true
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
TextInput: {
|
|
83
|
+
defaultProps: {
|
|
84
|
+
radius: "md"
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
Table: {
|
|
88
|
+
defaultProps: {
|
|
89
|
+
highlightOnHover: true,
|
|
90
|
+
verticalSpacing: "md"
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
Badge: {
|
|
94
|
+
defaultProps: {
|
|
95
|
+
radius: "xl"
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}));
|
|
100
|
+
var gdsTheme = baseTheme;
|
|
101
|
+
var gdsDarkPublicTheme = extendGdsTheme({
|
|
102
|
+
primaryColor: "violet",
|
|
103
|
+
components: {
|
|
104
|
+
AppShell: {
|
|
105
|
+
styles: {
|
|
106
|
+
main: {
|
|
107
|
+
backgroundColor: "var(--mantine-color-dark-8)"
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
Card: {
|
|
112
|
+
styles: {
|
|
113
|
+
root: {
|
|
114
|
+
backgroundColor: "var(--mantine-color-dark-7)",
|
|
115
|
+
borderColor: "var(--mantine-color-dark-4)"
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
},
|
|
119
|
+
Paper: {
|
|
120
|
+
styles: {
|
|
121
|
+
root: {
|
|
122
|
+
backgroundColor: "var(--mantine-color-dark-7)",
|
|
123
|
+
borderColor: "var(--mantine-color-dark-4)"
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
},
|
|
127
|
+
Table: {
|
|
128
|
+
styles: {
|
|
129
|
+
table: {
|
|
130
|
+
color: "var(--mantine-color-gray-0)"
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
});
|
|
136
|
+
var gdsFlatSurfaceTheme = extendGdsTheme({
|
|
137
|
+
shadows: {
|
|
138
|
+
xs: "none",
|
|
139
|
+
sm: "none",
|
|
140
|
+
md: "none",
|
|
141
|
+
lg: "none",
|
|
142
|
+
xl: "none"
|
|
143
|
+
},
|
|
144
|
+
components: {
|
|
145
|
+
Card: {
|
|
146
|
+
defaultProps: {
|
|
147
|
+
shadow: void 0,
|
|
148
|
+
withBorder: true
|
|
149
|
+
}
|
|
150
|
+
},
|
|
151
|
+
Paper: {
|
|
152
|
+
defaultProps: {
|
|
153
|
+
withBorder: true
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
});
|
|
158
|
+
var gdsEditorialPublicTheme = extendGdsTheme({
|
|
159
|
+
headings: {
|
|
160
|
+
fontFamily: '"Instrument Serif", Georgia, "Times New Roman", serif',
|
|
161
|
+
sizes: {
|
|
162
|
+
h1: { fontSize: "2.75rem", fontWeight: "700" },
|
|
163
|
+
h2: { fontSize: "2rem", fontWeight: "700" },
|
|
164
|
+
h3: { fontSize: "1.375rem", fontWeight: "600" }
|
|
165
|
+
}
|
|
166
|
+
},
|
|
167
|
+
shadows: {
|
|
168
|
+
xs: "none",
|
|
169
|
+
sm: "none",
|
|
170
|
+
md: "none",
|
|
171
|
+
lg: "none",
|
|
172
|
+
xl: "none"
|
|
173
|
+
},
|
|
174
|
+
components: {
|
|
175
|
+
Card: {
|
|
176
|
+
defaultProps: {
|
|
177
|
+
shadow: void 0,
|
|
178
|
+
withBorder: true
|
|
179
|
+
}
|
|
180
|
+
},
|
|
181
|
+
Paper: {
|
|
182
|
+
defaultProps: {
|
|
183
|
+
withBorder: true
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
});
|
|
188
|
+
function createPublicBrandTheme({
|
|
189
|
+
editorialSerif = false,
|
|
190
|
+
flatSurfaces = false,
|
|
191
|
+
overrides = {}
|
|
192
|
+
} = {}) {
|
|
193
|
+
const layeredOverrides = [];
|
|
194
|
+
if (flatSurfaces) {
|
|
195
|
+
layeredOverrides.push(gdsFlatSurfaceTheme);
|
|
196
|
+
}
|
|
197
|
+
if (editorialSerif) {
|
|
198
|
+
layeredOverrides.push(gdsEditorialPublicTheme);
|
|
199
|
+
}
|
|
200
|
+
layeredOverrides.push(overrides);
|
|
201
|
+
const mergedOverrides = layeredOverrides.reduce(
|
|
202
|
+
(theme, layer) => (0, import_core.mergeThemeOverrides)(theme, layer),
|
|
203
|
+
{}
|
|
204
|
+
);
|
|
205
|
+
return extendGdsTheme(mergedOverrides);
|
|
206
|
+
}
|
|
207
|
+
function extendGdsTheme(overrides = {}) {
|
|
208
|
+
return (0, import_core.mergeMantineTheme)(baseTheme, overrides);
|
|
209
|
+
}
|
|
210
|
+
function withGdsMotion(overrides = {}) {
|
|
211
|
+
return extendGdsTheme(
|
|
212
|
+
(0, import_core.mergeThemeOverrides)(
|
|
213
|
+
{
|
|
214
|
+
components: {
|
|
215
|
+
Button: {
|
|
216
|
+
styles: {
|
|
217
|
+
root: {
|
|
218
|
+
transition: "transform 150ms ease, filter 120ms ease",
|
|
219
|
+
"&:hover": {
|
|
220
|
+
transform: "translateY(-1px)",
|
|
221
|
+
filter: "brightness(1.05)"
|
|
222
|
+
},
|
|
223
|
+
"&:active": {
|
|
224
|
+
transform: "translateY(0)",
|
|
225
|
+
filter: "brightness(0.95)"
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
},
|
|
230
|
+
Card: {
|
|
231
|
+
styles: {
|
|
232
|
+
root: {
|
|
233
|
+
transition: "transform 150ms ease, box-shadow 150ms ease"
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
},
|
|
239
|
+
overrides
|
|
240
|
+
)
|
|
241
|
+
);
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
// src/GdsProvider.tsx
|
|
245
|
+
var import_core2 = require("@mantine/core");
|
|
246
|
+
var import_modals = require("@mantine/modals");
|
|
247
|
+
var import_notifications = require("@mantine/notifications");
|
|
248
|
+
|
|
249
|
+
// src/i18n.ts
|
|
250
|
+
var import_react = require("react");
|
|
251
|
+
var GdsI18nContext = (0, import_react.createContext)({
|
|
252
|
+
locale: "en",
|
|
253
|
+
messages: {}
|
|
254
|
+
});
|
|
255
|
+
function useGdsTranslation() {
|
|
256
|
+
const { messages, locale } = (0, import_react.useContext)(GdsI18nContext);
|
|
257
|
+
return {
|
|
258
|
+
t: (id, defaultMessage) => messages[id] || defaultMessage,
|
|
259
|
+
locale
|
|
260
|
+
};
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
// src/GdsProvider.tsx
|
|
264
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
265
|
+
function GdsProvider({
|
|
266
|
+
children,
|
|
267
|
+
locale = "en",
|
|
268
|
+
messages = {},
|
|
269
|
+
theme = gdsTheme,
|
|
270
|
+
defaultColorScheme = "light"
|
|
271
|
+
}) {
|
|
272
|
+
const isRtl = ["ar", "he"].includes(locale);
|
|
273
|
+
const dir = isRtl ? "rtl" : "ltr";
|
|
274
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_core2.DirectionProvider, { initialDirection: dir, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(GdsI18nContext.Provider, { value: { locale, messages }, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_core2.MantineProvider, { theme, withCssVariables: true, withGlobalClasses: true, defaultColorScheme, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_modals.ModalsProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
275
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_notifications.Notifications, {}),
|
|
276
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_core2.Box, { dir, h: "100%", children })
|
|
277
|
+
] }) }) }) }) });
|
|
278
|
+
}
|
|
279
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
280
|
+
0 && (module.exports = {
|
|
281
|
+
GdsProvider,
|
|
282
|
+
createPublicBrandTheme,
|
|
283
|
+
extendGdsTheme,
|
|
284
|
+
gdsDarkPublicTheme,
|
|
285
|
+
gdsEditorialPublicTheme,
|
|
286
|
+
gdsFlatSurfaceTheme,
|
|
287
|
+
gdsTheme,
|
|
288
|
+
useGdsTranslation,
|
|
289
|
+
withGdsMotion
|
|
290
|
+
});
|
package/dist/client.mjs
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import {
|
|
2
|
+
GdsProvider,
|
|
3
|
+
useGdsTranslation
|
|
4
|
+
} from "./chunk-TAI4BSAN.mjs";
|
|
5
|
+
import {
|
|
6
|
+
createPublicBrandTheme,
|
|
7
|
+
extendGdsTheme,
|
|
8
|
+
gdsDarkPublicTheme,
|
|
9
|
+
gdsEditorialPublicTheme,
|
|
10
|
+
gdsFlatSurfaceTheme,
|
|
11
|
+
gdsTheme,
|
|
12
|
+
withGdsMotion
|
|
13
|
+
} from "./chunk-AS4RLGFF.mjs";
|
|
14
|
+
export {
|
|
15
|
+
GdsProvider,
|
|
16
|
+
createPublicBrandTheme,
|
|
17
|
+
extendGdsTheme,
|
|
18
|
+
gdsDarkPublicTheme,
|
|
19
|
+
gdsEditorialPublicTheme,
|
|
20
|
+
gdsFlatSurfaceTheme,
|
|
21
|
+
gdsTheme,
|
|
22
|
+
useGdsTranslation,
|
|
23
|
+
withGdsMotion
|
|
24
|
+
};
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { createPublicBrandTheme, extendGdsTheme, gdsDarkPublicTheme, gdsEditorialPublicTheme, gdsFlatSurfaceTheme, gdsTheme, withGdsMotion } from './server.mjs';
|
|
2
|
+
export { GdsProvider, GdsProviderProps, useGdsTranslation } from './client.mjs';
|
|
3
|
+
import '@mantine/core';
|
|
4
|
+
import 'react/jsx-runtime';
|
|
5
|
+
import 'react';
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { createPublicBrandTheme, extendGdsTheme, gdsDarkPublicTheme, gdsEditorialPublicTheme, gdsFlatSurfaceTheme, gdsTheme, withGdsMotion } from './server.js';
|
|
2
|
+
export { GdsProvider, GdsProviderProps, useGdsTranslation } from './client.js';
|
|
3
|
+
import '@mantine/core';
|
|
4
|
+
import 'react/jsx-runtime';
|
|
5
|
+
import 'react';
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,290 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/index.ts
|
|
21
|
+
var index_exports = {};
|
|
22
|
+
__export(index_exports, {
|
|
23
|
+
GdsProvider: () => GdsProvider,
|
|
24
|
+
createPublicBrandTheme: () => createPublicBrandTheme,
|
|
25
|
+
extendGdsTheme: () => extendGdsTheme,
|
|
26
|
+
gdsDarkPublicTheme: () => gdsDarkPublicTheme,
|
|
27
|
+
gdsEditorialPublicTheme: () => gdsEditorialPublicTheme,
|
|
28
|
+
gdsFlatSurfaceTheme: () => gdsFlatSurfaceTheme,
|
|
29
|
+
gdsTheme: () => gdsTheme,
|
|
30
|
+
useGdsTranslation: () => useGdsTranslation,
|
|
31
|
+
withGdsMotion: () => withGdsMotion
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(index_exports);
|
|
34
|
+
|
|
35
|
+
// src/theme.ts
|
|
36
|
+
var import_core = require("@mantine/core");
|
|
37
|
+
var baseTheme = (0, import_core.mergeMantineTheme)(import_core.DEFAULT_THEME, (0, import_core.createTheme)({
|
|
38
|
+
primaryColor: "violet",
|
|
39
|
+
fontFamily: "Inter, system-ui, Avenir, Helvetica, Arial, sans-serif",
|
|
40
|
+
fontSmoothing: true,
|
|
41
|
+
defaultRadius: "md",
|
|
42
|
+
black: "#111827",
|
|
43
|
+
white: "#ffffff",
|
|
44
|
+
headings: {
|
|
45
|
+
fontFamily: "Inter, system-ui, Avenir, Helvetica, Arial, sans-serif",
|
|
46
|
+
sizes: {
|
|
47
|
+
h1: { fontSize: "2.5rem", fontWeight: "800" },
|
|
48
|
+
h2: { fontSize: "1.75rem", fontWeight: "700" },
|
|
49
|
+
h3: { fontSize: "1.25rem", fontWeight: "600" }
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
shadows: {
|
|
53
|
+
md: "0 8px 24px rgba(15, 23, 42, 0.08)",
|
|
54
|
+
lg: "0 16px 40px rgba(15, 23, 42, 0.12)"
|
|
55
|
+
},
|
|
56
|
+
components: {
|
|
57
|
+
Button: {
|
|
58
|
+
defaultProps: {
|
|
59
|
+
radius: "md",
|
|
60
|
+
size: "sm",
|
|
61
|
+
fw: 600
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
Card: {
|
|
65
|
+
defaultProps: {
|
|
66
|
+
radius: "lg",
|
|
67
|
+
shadow: "sm",
|
|
68
|
+
withBorder: true
|
|
69
|
+
},
|
|
70
|
+
styles: {
|
|
71
|
+
root: {
|
|
72
|
+
backgroundColor: "var(--mantine-color-body)"
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
Paper: {
|
|
77
|
+
defaultProps: {
|
|
78
|
+
radius: "lg",
|
|
79
|
+
withBorder: true
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
TextInput: {
|
|
83
|
+
defaultProps: {
|
|
84
|
+
radius: "md"
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
Table: {
|
|
88
|
+
defaultProps: {
|
|
89
|
+
highlightOnHover: true,
|
|
90
|
+
verticalSpacing: "md"
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
Badge: {
|
|
94
|
+
defaultProps: {
|
|
95
|
+
radius: "xl"
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}));
|
|
100
|
+
var gdsTheme = baseTheme;
|
|
101
|
+
var gdsDarkPublicTheme = extendGdsTheme({
|
|
102
|
+
primaryColor: "violet",
|
|
103
|
+
components: {
|
|
104
|
+
AppShell: {
|
|
105
|
+
styles: {
|
|
106
|
+
main: {
|
|
107
|
+
backgroundColor: "var(--mantine-color-dark-8)"
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
Card: {
|
|
112
|
+
styles: {
|
|
113
|
+
root: {
|
|
114
|
+
backgroundColor: "var(--mantine-color-dark-7)",
|
|
115
|
+
borderColor: "var(--mantine-color-dark-4)"
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
},
|
|
119
|
+
Paper: {
|
|
120
|
+
styles: {
|
|
121
|
+
root: {
|
|
122
|
+
backgroundColor: "var(--mantine-color-dark-7)",
|
|
123
|
+
borderColor: "var(--mantine-color-dark-4)"
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
},
|
|
127
|
+
Table: {
|
|
128
|
+
styles: {
|
|
129
|
+
table: {
|
|
130
|
+
color: "var(--mantine-color-gray-0)"
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
});
|
|
136
|
+
var gdsFlatSurfaceTheme = extendGdsTheme({
|
|
137
|
+
shadows: {
|
|
138
|
+
xs: "none",
|
|
139
|
+
sm: "none",
|
|
140
|
+
md: "none",
|
|
141
|
+
lg: "none",
|
|
142
|
+
xl: "none"
|
|
143
|
+
},
|
|
144
|
+
components: {
|
|
145
|
+
Card: {
|
|
146
|
+
defaultProps: {
|
|
147
|
+
shadow: void 0,
|
|
148
|
+
withBorder: true
|
|
149
|
+
}
|
|
150
|
+
},
|
|
151
|
+
Paper: {
|
|
152
|
+
defaultProps: {
|
|
153
|
+
withBorder: true
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
});
|
|
158
|
+
var gdsEditorialPublicTheme = extendGdsTheme({
|
|
159
|
+
headings: {
|
|
160
|
+
fontFamily: '"Instrument Serif", Georgia, "Times New Roman", serif',
|
|
161
|
+
sizes: {
|
|
162
|
+
h1: { fontSize: "2.75rem", fontWeight: "700" },
|
|
163
|
+
h2: { fontSize: "2rem", fontWeight: "700" },
|
|
164
|
+
h3: { fontSize: "1.375rem", fontWeight: "600" }
|
|
165
|
+
}
|
|
166
|
+
},
|
|
167
|
+
shadows: {
|
|
168
|
+
xs: "none",
|
|
169
|
+
sm: "none",
|
|
170
|
+
md: "none",
|
|
171
|
+
lg: "none",
|
|
172
|
+
xl: "none"
|
|
173
|
+
},
|
|
174
|
+
components: {
|
|
175
|
+
Card: {
|
|
176
|
+
defaultProps: {
|
|
177
|
+
shadow: void 0,
|
|
178
|
+
withBorder: true
|
|
179
|
+
}
|
|
180
|
+
},
|
|
181
|
+
Paper: {
|
|
182
|
+
defaultProps: {
|
|
183
|
+
withBorder: true
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
});
|
|
188
|
+
function createPublicBrandTheme({
|
|
189
|
+
editorialSerif = false,
|
|
190
|
+
flatSurfaces = false,
|
|
191
|
+
overrides = {}
|
|
192
|
+
} = {}) {
|
|
193
|
+
const layeredOverrides = [];
|
|
194
|
+
if (flatSurfaces) {
|
|
195
|
+
layeredOverrides.push(gdsFlatSurfaceTheme);
|
|
196
|
+
}
|
|
197
|
+
if (editorialSerif) {
|
|
198
|
+
layeredOverrides.push(gdsEditorialPublicTheme);
|
|
199
|
+
}
|
|
200
|
+
layeredOverrides.push(overrides);
|
|
201
|
+
const mergedOverrides = layeredOverrides.reduce(
|
|
202
|
+
(theme, layer) => (0, import_core.mergeThemeOverrides)(theme, layer),
|
|
203
|
+
{}
|
|
204
|
+
);
|
|
205
|
+
return extendGdsTheme(mergedOverrides);
|
|
206
|
+
}
|
|
207
|
+
function extendGdsTheme(overrides = {}) {
|
|
208
|
+
return (0, import_core.mergeMantineTheme)(baseTheme, overrides);
|
|
209
|
+
}
|
|
210
|
+
function withGdsMotion(overrides = {}) {
|
|
211
|
+
return extendGdsTheme(
|
|
212
|
+
(0, import_core.mergeThemeOverrides)(
|
|
213
|
+
{
|
|
214
|
+
components: {
|
|
215
|
+
Button: {
|
|
216
|
+
styles: {
|
|
217
|
+
root: {
|
|
218
|
+
transition: "transform 150ms ease, filter 120ms ease",
|
|
219
|
+
"&:hover": {
|
|
220
|
+
transform: "translateY(-1px)",
|
|
221
|
+
filter: "brightness(1.05)"
|
|
222
|
+
},
|
|
223
|
+
"&:active": {
|
|
224
|
+
transform: "translateY(0)",
|
|
225
|
+
filter: "brightness(0.95)"
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
},
|
|
230
|
+
Card: {
|
|
231
|
+
styles: {
|
|
232
|
+
root: {
|
|
233
|
+
transition: "transform 150ms ease, box-shadow 150ms ease"
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
},
|
|
239
|
+
overrides
|
|
240
|
+
)
|
|
241
|
+
);
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
// src/GdsProvider.tsx
|
|
245
|
+
var import_core2 = require("@mantine/core");
|
|
246
|
+
var import_modals = require("@mantine/modals");
|
|
247
|
+
var import_notifications = require("@mantine/notifications");
|
|
248
|
+
|
|
249
|
+
// src/i18n.ts
|
|
250
|
+
var import_react = require("react");
|
|
251
|
+
var GdsI18nContext = (0, import_react.createContext)({
|
|
252
|
+
locale: "en",
|
|
253
|
+
messages: {}
|
|
254
|
+
});
|
|
255
|
+
function useGdsTranslation() {
|
|
256
|
+
const { messages, locale } = (0, import_react.useContext)(GdsI18nContext);
|
|
257
|
+
return {
|
|
258
|
+
t: (id, defaultMessage) => messages[id] || defaultMessage,
|
|
259
|
+
locale
|
|
260
|
+
};
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
// src/GdsProvider.tsx
|
|
264
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
265
|
+
function GdsProvider({
|
|
266
|
+
children,
|
|
267
|
+
locale = "en",
|
|
268
|
+
messages = {},
|
|
269
|
+
theme = gdsTheme,
|
|
270
|
+
defaultColorScheme = "light"
|
|
271
|
+
}) {
|
|
272
|
+
const isRtl = ["ar", "he"].includes(locale);
|
|
273
|
+
const dir = isRtl ? "rtl" : "ltr";
|
|
274
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_core2.DirectionProvider, { initialDirection: dir, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(GdsI18nContext.Provider, { value: { locale, messages }, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_core2.MantineProvider, { theme, withCssVariables: true, withGlobalClasses: true, defaultColorScheme, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_modals.ModalsProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
275
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_notifications.Notifications, {}),
|
|
276
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_core2.Box, { dir, h: "100%", children })
|
|
277
|
+
] }) }) }) }) });
|
|
278
|
+
}
|
|
279
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
280
|
+
0 && (module.exports = {
|
|
281
|
+
GdsProvider,
|
|
282
|
+
createPublicBrandTheme,
|
|
283
|
+
extendGdsTheme,
|
|
284
|
+
gdsDarkPublicTheme,
|
|
285
|
+
gdsEditorialPublicTheme,
|
|
286
|
+
gdsFlatSurfaceTheme,
|
|
287
|
+
gdsTheme,
|
|
288
|
+
useGdsTranslation,
|
|
289
|
+
withGdsMotion
|
|
290
|
+
});
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import {
|
|
2
|
+
GdsProvider,
|
|
3
|
+
useGdsTranslation
|
|
4
|
+
} from "./chunk-TAI4BSAN.mjs";
|
|
5
|
+
import {
|
|
6
|
+
createPublicBrandTheme,
|
|
7
|
+
extendGdsTheme,
|
|
8
|
+
gdsDarkPublicTheme,
|
|
9
|
+
gdsEditorialPublicTheme,
|
|
10
|
+
gdsFlatSurfaceTheme,
|
|
11
|
+
gdsTheme,
|
|
12
|
+
withGdsMotion
|
|
13
|
+
} from "./chunk-AS4RLGFF.mjs";
|
|
14
|
+
export {
|
|
15
|
+
GdsProvider,
|
|
16
|
+
createPublicBrandTheme,
|
|
17
|
+
extendGdsTheme,
|
|
18
|
+
gdsDarkPublicTheme,
|
|
19
|
+
gdsEditorialPublicTheme,
|
|
20
|
+
gdsFlatSurfaceTheme,
|
|
21
|
+
gdsTheme,
|
|
22
|
+
useGdsTranslation,
|
|
23
|
+
withGdsMotion
|
|
24
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { MantineThemeOverride, MantineTheme } from '@mantine/core';
|
|
2
|
+
|
|
3
|
+
declare const gdsTheme: MantineTheme;
|
|
4
|
+
declare const gdsDarkPublicTheme: MantineTheme;
|
|
5
|
+
declare const gdsFlatSurfaceTheme: MantineTheme;
|
|
6
|
+
declare const gdsEditorialPublicTheme: MantineTheme;
|
|
7
|
+
interface PublicBrandThemeOptions {
|
|
8
|
+
editorialSerif?: boolean;
|
|
9
|
+
flatSurfaces?: boolean;
|
|
10
|
+
overrides?: MantineThemeOverride;
|
|
11
|
+
}
|
|
12
|
+
declare function createPublicBrandTheme({ editorialSerif, flatSurfaces, overrides, }?: PublicBrandThemeOptions): MantineTheme;
|
|
13
|
+
declare function extendGdsTheme(overrides?: MantineThemeOverride): MantineTheme;
|
|
14
|
+
declare function withGdsMotion(overrides?: MantineThemeOverride): MantineTheme;
|
|
15
|
+
|
|
16
|
+
export { createPublicBrandTheme, extendGdsTheme, gdsDarkPublicTheme, gdsEditorialPublicTheme, gdsFlatSurfaceTheme, gdsTheme, withGdsMotion };
|
package/dist/server.d.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { MantineThemeOverride, MantineTheme } from '@mantine/core';
|
|
2
|
+
|
|
3
|
+
declare const gdsTheme: MantineTheme;
|
|
4
|
+
declare const gdsDarkPublicTheme: MantineTheme;
|
|
5
|
+
declare const gdsFlatSurfaceTheme: MantineTheme;
|
|
6
|
+
declare const gdsEditorialPublicTheme: MantineTheme;
|
|
7
|
+
interface PublicBrandThemeOptions {
|
|
8
|
+
editorialSerif?: boolean;
|
|
9
|
+
flatSurfaces?: boolean;
|
|
10
|
+
overrides?: MantineThemeOverride;
|
|
11
|
+
}
|
|
12
|
+
declare function createPublicBrandTheme({ editorialSerif, flatSurfaces, overrides, }?: PublicBrandThemeOptions): MantineTheme;
|
|
13
|
+
declare function extendGdsTheme(overrides?: MantineThemeOverride): MantineTheme;
|
|
14
|
+
declare function withGdsMotion(overrides?: MantineThemeOverride): MantineTheme;
|
|
15
|
+
|
|
16
|
+
export { createPublicBrandTheme, extendGdsTheme, gdsDarkPublicTheme, gdsEditorialPublicTheme, gdsFlatSurfaceTheme, gdsTheme, withGdsMotion };
|
package/dist/server.js
ADDED
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/server.ts
|
|
21
|
+
var server_exports = {};
|
|
22
|
+
__export(server_exports, {
|
|
23
|
+
createPublicBrandTheme: () => createPublicBrandTheme,
|
|
24
|
+
extendGdsTheme: () => extendGdsTheme,
|
|
25
|
+
gdsDarkPublicTheme: () => gdsDarkPublicTheme,
|
|
26
|
+
gdsEditorialPublicTheme: () => gdsEditorialPublicTheme,
|
|
27
|
+
gdsFlatSurfaceTheme: () => gdsFlatSurfaceTheme,
|
|
28
|
+
gdsTheme: () => gdsTheme,
|
|
29
|
+
withGdsMotion: () => withGdsMotion
|
|
30
|
+
});
|
|
31
|
+
module.exports = __toCommonJS(server_exports);
|
|
32
|
+
|
|
33
|
+
// src/theme.ts
|
|
34
|
+
var import_core = require("@mantine/core");
|
|
35
|
+
var baseTheme = (0, import_core.mergeMantineTheme)(import_core.DEFAULT_THEME, (0, import_core.createTheme)({
|
|
36
|
+
primaryColor: "violet",
|
|
37
|
+
fontFamily: "Inter, system-ui, Avenir, Helvetica, Arial, sans-serif",
|
|
38
|
+
fontSmoothing: true,
|
|
39
|
+
defaultRadius: "md",
|
|
40
|
+
black: "#111827",
|
|
41
|
+
white: "#ffffff",
|
|
42
|
+
headings: {
|
|
43
|
+
fontFamily: "Inter, system-ui, Avenir, Helvetica, Arial, sans-serif",
|
|
44
|
+
sizes: {
|
|
45
|
+
h1: { fontSize: "2.5rem", fontWeight: "800" },
|
|
46
|
+
h2: { fontSize: "1.75rem", fontWeight: "700" },
|
|
47
|
+
h3: { fontSize: "1.25rem", fontWeight: "600" }
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
shadows: {
|
|
51
|
+
md: "0 8px 24px rgba(15, 23, 42, 0.08)",
|
|
52
|
+
lg: "0 16px 40px rgba(15, 23, 42, 0.12)"
|
|
53
|
+
},
|
|
54
|
+
components: {
|
|
55
|
+
Button: {
|
|
56
|
+
defaultProps: {
|
|
57
|
+
radius: "md",
|
|
58
|
+
size: "sm",
|
|
59
|
+
fw: 600
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
Card: {
|
|
63
|
+
defaultProps: {
|
|
64
|
+
radius: "lg",
|
|
65
|
+
shadow: "sm",
|
|
66
|
+
withBorder: true
|
|
67
|
+
},
|
|
68
|
+
styles: {
|
|
69
|
+
root: {
|
|
70
|
+
backgroundColor: "var(--mantine-color-body)"
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
Paper: {
|
|
75
|
+
defaultProps: {
|
|
76
|
+
radius: "lg",
|
|
77
|
+
withBorder: true
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
TextInput: {
|
|
81
|
+
defaultProps: {
|
|
82
|
+
radius: "md"
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
Table: {
|
|
86
|
+
defaultProps: {
|
|
87
|
+
highlightOnHover: true,
|
|
88
|
+
verticalSpacing: "md"
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
Badge: {
|
|
92
|
+
defaultProps: {
|
|
93
|
+
radius: "xl"
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}));
|
|
98
|
+
var gdsTheme = baseTheme;
|
|
99
|
+
var gdsDarkPublicTheme = extendGdsTheme({
|
|
100
|
+
primaryColor: "violet",
|
|
101
|
+
components: {
|
|
102
|
+
AppShell: {
|
|
103
|
+
styles: {
|
|
104
|
+
main: {
|
|
105
|
+
backgroundColor: "var(--mantine-color-dark-8)"
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
},
|
|
109
|
+
Card: {
|
|
110
|
+
styles: {
|
|
111
|
+
root: {
|
|
112
|
+
backgroundColor: "var(--mantine-color-dark-7)",
|
|
113
|
+
borderColor: "var(--mantine-color-dark-4)"
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
},
|
|
117
|
+
Paper: {
|
|
118
|
+
styles: {
|
|
119
|
+
root: {
|
|
120
|
+
backgroundColor: "var(--mantine-color-dark-7)",
|
|
121
|
+
borderColor: "var(--mantine-color-dark-4)"
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
},
|
|
125
|
+
Table: {
|
|
126
|
+
styles: {
|
|
127
|
+
table: {
|
|
128
|
+
color: "var(--mantine-color-gray-0)"
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
});
|
|
134
|
+
var gdsFlatSurfaceTheme = extendGdsTheme({
|
|
135
|
+
shadows: {
|
|
136
|
+
xs: "none",
|
|
137
|
+
sm: "none",
|
|
138
|
+
md: "none",
|
|
139
|
+
lg: "none",
|
|
140
|
+
xl: "none"
|
|
141
|
+
},
|
|
142
|
+
components: {
|
|
143
|
+
Card: {
|
|
144
|
+
defaultProps: {
|
|
145
|
+
shadow: void 0,
|
|
146
|
+
withBorder: true
|
|
147
|
+
}
|
|
148
|
+
},
|
|
149
|
+
Paper: {
|
|
150
|
+
defaultProps: {
|
|
151
|
+
withBorder: true
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
});
|
|
156
|
+
var gdsEditorialPublicTheme = extendGdsTheme({
|
|
157
|
+
headings: {
|
|
158
|
+
fontFamily: '"Instrument Serif", Georgia, "Times New Roman", serif',
|
|
159
|
+
sizes: {
|
|
160
|
+
h1: { fontSize: "2.75rem", fontWeight: "700" },
|
|
161
|
+
h2: { fontSize: "2rem", fontWeight: "700" },
|
|
162
|
+
h3: { fontSize: "1.375rem", fontWeight: "600" }
|
|
163
|
+
}
|
|
164
|
+
},
|
|
165
|
+
shadows: {
|
|
166
|
+
xs: "none",
|
|
167
|
+
sm: "none",
|
|
168
|
+
md: "none",
|
|
169
|
+
lg: "none",
|
|
170
|
+
xl: "none"
|
|
171
|
+
},
|
|
172
|
+
components: {
|
|
173
|
+
Card: {
|
|
174
|
+
defaultProps: {
|
|
175
|
+
shadow: void 0,
|
|
176
|
+
withBorder: true
|
|
177
|
+
}
|
|
178
|
+
},
|
|
179
|
+
Paper: {
|
|
180
|
+
defaultProps: {
|
|
181
|
+
withBorder: true
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
});
|
|
186
|
+
function createPublicBrandTheme({
|
|
187
|
+
editorialSerif = false,
|
|
188
|
+
flatSurfaces = false,
|
|
189
|
+
overrides = {}
|
|
190
|
+
} = {}) {
|
|
191
|
+
const layeredOverrides = [];
|
|
192
|
+
if (flatSurfaces) {
|
|
193
|
+
layeredOverrides.push(gdsFlatSurfaceTheme);
|
|
194
|
+
}
|
|
195
|
+
if (editorialSerif) {
|
|
196
|
+
layeredOverrides.push(gdsEditorialPublicTheme);
|
|
197
|
+
}
|
|
198
|
+
layeredOverrides.push(overrides);
|
|
199
|
+
const mergedOverrides = layeredOverrides.reduce(
|
|
200
|
+
(theme, layer) => (0, import_core.mergeThemeOverrides)(theme, layer),
|
|
201
|
+
{}
|
|
202
|
+
);
|
|
203
|
+
return extendGdsTheme(mergedOverrides);
|
|
204
|
+
}
|
|
205
|
+
function extendGdsTheme(overrides = {}) {
|
|
206
|
+
return (0, import_core.mergeMantineTheme)(baseTheme, overrides);
|
|
207
|
+
}
|
|
208
|
+
function withGdsMotion(overrides = {}) {
|
|
209
|
+
return extendGdsTheme(
|
|
210
|
+
(0, import_core.mergeThemeOverrides)(
|
|
211
|
+
{
|
|
212
|
+
components: {
|
|
213
|
+
Button: {
|
|
214
|
+
styles: {
|
|
215
|
+
root: {
|
|
216
|
+
transition: "transform 150ms ease, filter 120ms ease",
|
|
217
|
+
"&:hover": {
|
|
218
|
+
transform: "translateY(-1px)",
|
|
219
|
+
filter: "brightness(1.05)"
|
|
220
|
+
},
|
|
221
|
+
"&:active": {
|
|
222
|
+
transform: "translateY(0)",
|
|
223
|
+
filter: "brightness(0.95)"
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
},
|
|
228
|
+
Card: {
|
|
229
|
+
styles: {
|
|
230
|
+
root: {
|
|
231
|
+
transition: "transform 150ms ease, box-shadow 150ms ease"
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
},
|
|
237
|
+
overrides
|
|
238
|
+
)
|
|
239
|
+
);
|
|
240
|
+
}
|
|
241
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
242
|
+
0 && (module.exports = {
|
|
243
|
+
createPublicBrandTheme,
|
|
244
|
+
extendGdsTheme,
|
|
245
|
+
gdsDarkPublicTheme,
|
|
246
|
+
gdsEditorialPublicTheme,
|
|
247
|
+
gdsFlatSurfaceTheme,
|
|
248
|
+
gdsTheme,
|
|
249
|
+
withGdsMotion
|
|
250
|
+
});
|
package/dist/server.mjs
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createPublicBrandTheme,
|
|
3
|
+
extendGdsTheme,
|
|
4
|
+
gdsDarkPublicTheme,
|
|
5
|
+
gdsEditorialPublicTheme,
|
|
6
|
+
gdsFlatSurfaceTheme,
|
|
7
|
+
gdsTheme,
|
|
8
|
+
withGdsMotion
|
|
9
|
+
} from "./chunk-AS4RLGFF.mjs";
|
|
10
|
+
export {
|
|
11
|
+
createPublicBrandTheme,
|
|
12
|
+
extendGdsTheme,
|
|
13
|
+
gdsDarkPublicTheme,
|
|
14
|
+
gdsEditorialPublicTheme,
|
|
15
|
+
gdsFlatSurfaceTheme,
|
|
16
|
+
gdsTheme,
|
|
17
|
+
withGdsMotion
|
|
18
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@doneisbetter/gds-theme",
|
|
3
|
+
"version": "2.6.1",
|
|
4
|
+
"main": "./dist/index.js",
|
|
5
|
+
"module": "./dist/index.mjs",
|
|
6
|
+
"types": "./dist/index.d.ts",
|
|
7
|
+
"sideEffects": false,
|
|
8
|
+
"publishConfig": {
|
|
9
|
+
"access": "public"
|
|
10
|
+
},
|
|
11
|
+
"repository": {
|
|
12
|
+
"type": "git",
|
|
13
|
+
"url": "git+https://github.com/sovereignsquad/general-design-system.git",
|
|
14
|
+
"directory": "packages/gds-theme"
|
|
15
|
+
},
|
|
16
|
+
"exports": {
|
|
17
|
+
".": {
|
|
18
|
+
"types": "./dist/index.d.ts",
|
|
19
|
+
"import": "./dist/index.mjs",
|
|
20
|
+
"require": "./dist/index.js"
|
|
21
|
+
},
|
|
22
|
+
"./client": {
|
|
23
|
+
"types": "./dist/client.d.ts",
|
|
24
|
+
"import": "./dist/client.mjs",
|
|
25
|
+
"require": "./dist/client.js"
|
|
26
|
+
},
|
|
27
|
+
"./server": {
|
|
28
|
+
"types": "./dist/server.d.ts",
|
|
29
|
+
"import": "./dist/server.mjs",
|
|
30
|
+
"require": "./dist/server.js"
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
"files": [
|
|
34
|
+
"dist"
|
|
35
|
+
],
|
|
36
|
+
"scripts": {
|
|
37
|
+
"build": "tsup",
|
|
38
|
+
"dev": "tsup --watch"
|
|
39
|
+
},
|
|
40
|
+
"peerDependencies": {
|
|
41
|
+
"@mantine/core": "^7.9.0 || ^8.3.0",
|
|
42
|
+
"@mantine/hooks": "^7.9.0 || ^8.3.0",
|
|
43
|
+
"@mantine/modals": "^7.9.0 || ^8.3.0",
|
|
44
|
+
"@mantine/notifications": "^7.9.0 || ^8.3.0",
|
|
45
|
+
"react": "^18.2.0 || ^19.0.0",
|
|
46
|
+
"react-dom": "^18.2.0 || ^19.0.0"
|
|
47
|
+
},
|
|
48
|
+
"devDependencies": {
|
|
49
|
+
"@mantine/core": "^7.9.0",
|
|
50
|
+
"@mantine/hooks": "^7.9.0",
|
|
51
|
+
"@mantine/modals": "^7.9.0",
|
|
52
|
+
"@mantine/notifications": "^7.9.0",
|
|
53
|
+
"react": "^18.2.0",
|
|
54
|
+
"react-dom": "^18.2.0"
|
|
55
|
+
}
|
|
56
|
+
}
|