@soroush.tech/design-system 2.0.0-alpha.0 → 2.0.0-alpha.2
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/README.md +37 -34
- package/dist/AppBar.cjs +0 -4
- package/dist/AppBar.d.cts +3 -3
- package/dist/AppBar.d.mts +3 -3
- package/dist/AppBar.mjs +0 -4
- package/dist/Avatar.cjs +1 -1
- package/dist/Avatar.d.cts +3 -3
- package/dist/Avatar.d.mts +3 -3
- package/dist/Avatar.mjs +1 -1
- package/dist/Backdrop.d.cts +1 -1
- package/dist/Backdrop.d.mts +1 -1
- package/dist/Button.cjs +1 -1
- package/dist/Button.d.cts +1 -1
- package/dist/Button.d.mts +1 -1
- package/dist/Button.mjs +1 -1
- package/dist/ButtonGroup.d.cts +1 -1
- package/dist/ButtonGroup.d.mts +1 -1
- package/dist/Card.cjs +2 -2
- package/dist/Card.d.cts +3 -3
- package/dist/Card.d.mts +3 -3
- package/dist/Card.mjs +2 -2
- package/dist/Checkbox.d.cts +2 -2
- package/dist/Checkbox.d.mts +2 -2
- package/dist/CircularProgress.d.cts +3 -3
- package/dist/CircularProgress.d.mts +3 -3
- package/dist/Drawer.cjs +109 -17
- package/dist/Drawer.d.cts +43 -7
- package/dist/Drawer.d.mts +43 -7
- package/dist/Drawer.mjs +109 -18
- package/dist/Flex.cjs +6 -2
- package/dist/Flex.d.cts +1 -1
- package/dist/Flex.d.mts +1 -1
- package/dist/Flex.mjs +6 -2
- package/dist/Form.d.cts +1 -1
- package/dist/Form.d.mts +1 -1
- package/dist/FormControl.cjs +1 -1
- package/dist/FormControl.d.cts +2 -2
- package/dist/FormControl.d.mts +2 -2
- package/dist/FormControl.mjs +1 -1
- package/dist/FormHelperText.d.cts +1 -1
- package/dist/FormHelperText.d.mts +1 -1
- package/dist/FormLabel.d.cts +1 -1
- package/dist/FormLabel.d.mts +1 -1
- package/dist/Grid.cjs +7 -2
- package/dist/Grid.d.cts +20 -1
- package/dist/Grid.d.mts +20 -1
- package/dist/Grid.mjs +7 -2
- package/dist/{Icon-CkQGOBmm.mjs → Icon-BGcd6yy0.mjs} +1 -1
- package/dist/{Icon-CKLBJ7CC.cjs → Icon-Cn6Zx8wb.cjs} +1 -1
- package/dist/Icon.cjs +1 -1
- package/dist/Icon.d.cts +1 -1
- package/dist/Icon.d.mts +1 -1
- package/dist/Icon.mjs +1 -1
- package/dist/Image.d.cts +2 -2
- package/dist/Image.d.mts +2 -2
- package/dist/LinearProgress.d.cts +3 -3
- package/dist/LinearProgress.d.mts +3 -3
- package/dist/Link.cjs +1 -1
- package/dist/Link.d.cts +1 -1
- package/dist/Link.d.mts +1 -1
- package/dist/Link.mjs +1 -1
- package/dist/MenuItem.cjs +2 -2
- package/dist/MenuItem.d.cts +2 -2
- package/dist/MenuItem.d.mts +2 -2
- package/dist/MenuItem.mjs +2 -2
- package/dist/Modal.cjs +1 -1
- package/dist/Modal.d.cts +1 -1
- package/dist/Modal.d.mts +1 -1
- package/dist/Modal.mjs +1 -1
- package/dist/NativeSelect.cjs +2 -2
- package/dist/NativeSelect.d.cts +3 -3
- package/dist/NativeSelect.d.mts +3 -3
- package/dist/NativeSelect.mjs +2 -2
- package/dist/Pagination/PaginationItem.cjs +1 -1
- package/dist/Pagination/PaginationItem.d.cts +1 -1
- package/dist/Pagination/PaginationItem.d.mts +1 -1
- package/dist/Pagination/PaginationItem.mjs +1 -1
- package/dist/Pagination.d.cts +2 -2
- package/dist/Pagination.d.mts +2 -2
- package/dist/Paper.cjs +1 -1
- package/dist/Paper.d.cts +1 -1
- package/dist/Paper.d.mts +1 -1
- package/dist/Paper.mjs +1 -1
- package/dist/{Popover-Dz6h3A_9.cjs → Popover-CrSABgRk.cjs} +2 -2
- package/dist/{Popover-DWOrf7sy.mjs → Popover-DlpXdcwt.mjs} +2 -2
- package/dist/Popover.cjs +1 -1
- package/dist/Popover.d.cts +4 -4
- package/dist/Popover.d.mts +4 -4
- package/dist/Popover.mjs +1 -1
- package/dist/Pressable.cjs +1 -1
- package/dist/Pressable.d.cts +1 -1
- package/dist/Pressable.d.mts +1 -1
- package/dist/Pressable.mjs +1 -1
- package/dist/Quote.d.cts +4 -4
- package/dist/Quote.d.mts +4 -4
- package/dist/Radio.d.cts +2 -2
- package/dist/Radio.d.mts +2 -2
- package/dist/Select.cjs +3 -3
- package/dist/Select.d.cts +3 -3
- package/dist/Select.d.mts +3 -3
- package/dist/Select.mjs +3 -3
- package/dist/Sidebar/Sidebar.cjs +6 -25
- package/dist/Sidebar/Sidebar.d.cts +2 -5
- package/dist/Sidebar/Sidebar.d.mts +2 -5
- package/dist/Sidebar/Sidebar.mjs +7 -26
- package/dist/Sidebar/SidebarItem.cjs +1 -2
- package/dist/Sidebar/SidebarItem.d.cts +4 -4
- package/dist/Sidebar/SidebarItem.d.mts +4 -4
- package/dist/Sidebar/SidebarItem.mjs +1 -2
- package/dist/Skeleton.d.cts +2 -2
- package/dist/Skeleton.d.mts +2 -2
- package/dist/Switch.cjs +1 -1
- package/dist/Switch.d.cts +2 -2
- package/dist/Switch.d.mts +2 -2
- package/dist/Switch.mjs +1 -1
- package/dist/Table/Table.d.cts +3 -3
- package/dist/Table/Table.d.mts +3 -3
- package/dist/Table/TableBody.d.cts +2 -2
- package/dist/Table/TableBody.d.mts +2 -2
- package/dist/Table/TableCell.d.cts +1 -1
- package/dist/Table/TableCell.d.mts +1 -1
- package/dist/Table/TableContainer.d.cts +4 -4
- package/dist/Table/TableContainer.d.mts +4 -4
- package/dist/Table/TableControl.d.cts +1 -1
- package/dist/Table/TableControl.d.mts +1 -1
- package/dist/Table/TableFooter.d.cts +2 -2
- package/dist/Table/TableFooter.d.mts +2 -2
- package/dist/Table/TableHead.d.cts +2 -2
- package/dist/Table/TableHead.d.mts +2 -2
- package/dist/Table/TablePagination.d.cts +2 -2
- package/dist/Table/TablePagination.d.mts +2 -2
- package/dist/Table/TablePaginationActions.cjs +1 -1
- package/dist/Table/TablePaginationActions.d.cts +1 -1
- package/dist/Table/TablePaginationActions.d.mts +1 -1
- package/dist/Table/TablePaginationActions.mjs +1 -1
- package/dist/Table/TableRow.d.cts +2 -2
- package/dist/Table/TableRow.d.mts +2 -2
- package/dist/Table/TableSortLabel.cjs +1 -1
- package/dist/Table/TableSortLabel.d.cts +1 -1
- package/dist/Table/TableSortLabel.d.mts +1 -1
- package/dist/Table/TableSortLabel.mjs +1 -1
- package/dist/Table/hooks.d.cts +1 -1
- package/dist/Table/hooks.d.mts +1 -1
- package/dist/Table.d.cts +5 -5
- package/dist/Table.d.mts +5 -5
- package/dist/{TableContext-DRAhXvq3.d.cts → TableContext-BowhBZkZ.d.cts} +1 -1
- package/dist/{TableContext-DBOk01Xl.d.mts → TableContext-GmYLRYpc.d.mts} +1 -1
- package/dist/TextInput.cjs +1 -1
- package/dist/TextInput.d.cts +2 -2
- package/dist/TextInput.d.mts +2 -2
- package/dist/TextInput.mjs +1 -1
- package/dist/ToggleButton/ToggleButton.cjs +1 -1
- package/dist/ToggleButton/ToggleButton.d.cts +1 -1
- package/dist/ToggleButton/ToggleButton.d.mts +1 -1
- package/dist/ToggleButton/ToggleButton.mjs +1 -1
- package/dist/ToggleButton/ToggleButtonGroup.cjs +1 -1
- package/dist/ToggleButton/ToggleButtonGroup.d.cts +1 -1
- package/dist/ToggleButton/ToggleButtonGroup.d.mts +1 -1
- package/dist/ToggleButton/ToggleButtonGroup.mjs +1 -1
- package/dist/Typography.cjs +1 -1
- package/dist/Typography.d.cts +2 -2
- package/dist/Typography.d.mts +2 -2
- package/dist/Typography.mjs +1 -1
- package/dist/View.cjs +2 -1
- package/dist/View.d.cts +1 -1
- package/dist/View.d.mts +1 -1
- package/dist/View.mjs +2 -1
- package/dist/engine.d.cts +1 -1
- package/dist/engine.d.mts +1 -1
- package/dist/{index-D4i9vrQM.d.mts → index-B2eLreA5.d.cts} +3 -3
- package/dist/{index-DPHwCZYf.d.cts → index-BBV7_p-W.d.mts} +2 -2
- package/dist/{index-CoHrw2p7.d.mts → index-BHyJ6P_D.d.mts} +1 -1
- package/dist/{index-BDD-L8uL.d.cts → index-BO-vkjtm.d.cts} +1 -1
- package/dist/{index-BNpkmtaM.d.mts → index-BT-mcuE6.d.mts} +3 -3
- package/dist/{index-qtKJ56yu.d.mts → index-BW4rc8cK.d.cts} +2 -2
- package/dist/{index-B8KscJic.d.cts → index-BbngAEDY.d.mts} +2 -2
- package/dist/{index-BSR9zrAA.d.mts → index-Bqk30r0W.d.mts} +3 -3
- package/dist/{index-DkJzi96w.d.cts → index-BsUsSWXP.d.cts} +1 -1
- package/dist/{index-EYR0z1Qv.d.cts → index-C-kvrbCi.d.cts} +2 -2
- package/dist/{index-CvWslVk6.d.cts → index-C0-SB0dL.d.mts} +4 -4
- package/dist/{index-DsKd9VW5.d.mts → index-C58AZZQ2.d.cts} +4 -4
- package/dist/{index-IEvuh6Cd.d.mts → index-C7bEBYuv.d.mts} +3 -3
- package/dist/{index-CohgpyUj.d.cts → index-CGCO5eo7.d.mts} +4 -4
- package/dist/{index-CzmA09Yf.d.mts → index-CMKzrxOO.d.mts} +2 -2
- package/dist/{index-DNNg9RoR.d.cts → index-CNzkJGNq.d.cts} +3 -3
- package/dist/{index-CtrxW81j.d.cts → index-CPNzQhUu.d.cts} +2 -2
- package/dist/{index-8mHoIUt5.d.mts → index-CmscFo1L.d.mts} +2 -2
- package/dist/{index-r2avCy1z.d.mts → index-CxDY_w-H.d.cts} +2 -2
- package/dist/{index-CCrocxBL.d.cts → index-D0XX9v0b.d.cts} +3 -3
- package/dist/{index-CVb5zbas.d.mts → index-D2yMhmE_.d.mts} +3 -3
- package/dist/{index-bN91IhZi.d.cts → index-D5Rj4uWe.d.cts} +2 -2
- package/dist/{index-DuefjNlC.d.mts → index-DJ8NTYR8.d.mts} +2 -2
- package/dist/{index-B6vxRNLt.d.cts → index-DTeurv8z.d.cts} +3 -3
- package/dist/{index-S3NZS-Qp.d.cts → index-DYtIEMr9.d.mts} +3 -3
- package/dist/{index-CEqa8xx8.d.mts → index-Dkqk_6g2.d.mts} +1 -1
- package/dist/index-EuWfYhf8.d.mts +21 -0
- package/dist/{index-BGD4OzzG.d.cts → index-H30eNjJf.d.cts} +3 -3
- package/dist/{index-tv-TGYSG.d.mts → index-JSOR69Iy.d.cts} +4 -4
- package/dist/{index-CLttbRhG.d.cts → index-VwsWkazt.d.cts} +2 -2
- package/dist/{index-Cjlax0-f.d.mts → index-di-L2lJ9.d.mts} +2 -2
- package/dist/index-ue1Ccvln.d.cts +21 -0
- package/dist/index.d.cts +2 -2
- package/dist/index.d.mts +2 -2
- package/dist/style.cjs +1 -1
- package/dist/style.d.cts +2 -2
- package/dist/style.d.mts +2 -2
- package/dist/style.mjs +1 -1
- package/dist/{theme-BQGlZoma.mjs → theme-C1o9qa2E.mjs} +75 -27
- package/dist/{theme-BmEAXmwh.cjs → theme-DfAqr7qo.cjs} +116 -26
- package/dist/theme.cjs +8 -1
- package/dist/theme.d.cts +3 -3
- package/dist/theme.d.mts +3 -3
- package/dist/theme.mjs +2 -2
- package/dist/{themes-9YNnlVyY.d.mts → themes-C3RTORGO.d.mts} +63 -21
- package/dist/{themes-9YNnlVyY.d.cts → themes-Dswy4M6B.d.cts} +63 -21
- package/dist/{useTablePagination-RelVsdMR.d.mts → useTablePagination-BueH0_dG.d.cts} +1 -1
- package/dist/{useTablePagination-CLoac5oX.d.cts → useTablePagination-CxBh-gU8.d.mts} +1 -1
- package/package.json +2 -12
- package/dist/PageLayout/LayoutGrid.cjs +0 -21
- package/dist/PageLayout/LayoutGrid.d.cts +0 -22
- package/dist/PageLayout/LayoutGrid.d.mts +0 -22
- package/dist/PageLayout/LayoutGrid.mjs +0 -20
- package/dist/PageLayout/PageLayout.cjs +0 -148
- package/dist/PageLayout/PageLayout.d.cts +0 -31
- package/dist/PageLayout/PageLayout.d.mts +0 -31
- package/dist/PageLayout/PageLayout.mjs +0 -147
- package/dist/PageLayout.cjs +0 -7
- package/dist/PageLayout.d.cts +0 -19
- package/dist/PageLayout.d.mts +0 -19
- package/dist/PageLayout.mjs +0 -4
- package/dist/PageLayoutContext-DjJ1_7Xc.mjs +0 -5
- package/dist/PageLayoutContext-agXGhegE.cjs +0 -9
- package/dist/index-B41OXLX8.d.mts +0 -16
- package/dist/index-BJ5Tsf7u.d.cts +0 -16
- package/dist/index-BMJ3tyIw.d.cts +0 -16
- package/dist/index-BnFxdnEL.d.mts +0 -16
- package/dist/layoutStyles-B4Z1K6HZ.cjs +0 -67
- package/dist/layoutStyles-f0ISNjsC.mjs +0 -56
- package/dist/{Modal-CYNcPk-2.mjs → Modal-BcsyrrpH.mjs} +1 -1
- package/dist/{Modal-CApyh_V5.cjs → Modal-CM3osOqj.cjs} +1 -1
|
@@ -1,10 +1,31 @@
|
|
|
1
1
|
import { alpha, generateBoxShadow } from "./utils.mjs";
|
|
2
2
|
import { a as useEmotionTheme, n as EmotionThemeContext, r as EmotionThemeProvider } from "./emotion-BAyqVw0c.mjs";
|
|
3
|
+
import { createContainerQueries, createMediaHelpers } from "@soroush.tech/styled-system";
|
|
3
4
|
import { useMemo } from "react";
|
|
4
5
|
import { jsx } from "react/jsx-runtime";
|
|
5
6
|
//#region src/theme/utils/spacing.ts
|
|
6
7
|
const spacing = (units) => `${8 * units}px`;
|
|
7
8
|
//#endregion
|
|
9
|
+
//#region src/theme/breakpoints.ts
|
|
10
|
+
/**
|
|
11
|
+
* The scale with its helpers attached as non-enumerable methods: the engine, the theme's JSON
|
|
12
|
+
* and a spread see only the sizes, while `theme.breakpoints.up('md')` works. `createTheme`
|
|
13
|
+
* and `ThemeProvider` re-attach them after a merge, so they always follow the theme's own
|
|
14
|
+
* breakpoints.
|
|
15
|
+
*/
|
|
16
|
+
const withBreakpointHelpers = (scale) => {
|
|
17
|
+
const sizes = { ...scale };
|
|
18
|
+
const helpers = {
|
|
19
|
+
...createMediaHelpers(sizes),
|
|
20
|
+
containerQueries: createContainerQueries(sizes)
|
|
21
|
+
};
|
|
22
|
+
for (const [name, helper] of Object.entries(helpers)) Object.defineProperty(sizes, name, {
|
|
23
|
+
value: helper,
|
|
24
|
+
enumerable: false
|
|
25
|
+
});
|
|
26
|
+
return sizes;
|
|
27
|
+
};
|
|
28
|
+
//#endregion
|
|
8
29
|
//#region src/theme/utils/createTheme.ts
|
|
9
30
|
const isPlainObject = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
10
31
|
const deepMerge = (base, overrides) => {
|
|
@@ -24,8 +45,17 @@ const deepMerge = (base, overrides) => {
|
|
|
24
45
|
* - `undefined` override values are ignored - a key can be added or replaced,
|
|
25
46
|
* never removed.
|
|
26
47
|
* - Neither argument is mutated; untouched branches keep referential identity.
|
|
48
|
+
* - `breakpoints` gets its query helpers back, built from the merged sizes.
|
|
27
49
|
*/
|
|
28
|
-
const createTheme = (base, overrides) =>
|
|
50
|
+
const createTheme = (base, overrides) => {
|
|
51
|
+
const theme = deepMerge(base, overrides);
|
|
52
|
+
return withHelpers(theme);
|
|
53
|
+
};
|
|
54
|
+
/** A theme whose `breakpoints` carry the query helpers - added when a hand-built theme lacks them. */
|
|
55
|
+
const withHelpers = (theme) => theme.breakpoints && !("up" in theme.breakpoints) ? {
|
|
56
|
+
...theme,
|
|
57
|
+
breakpoints: withBreakpointHelpers(theme.breakpoints)
|
|
58
|
+
} : theme;
|
|
29
59
|
//#endregion
|
|
30
60
|
//#region src/theme/themes.ts
|
|
31
61
|
const shadow = {
|
|
@@ -141,19 +171,28 @@ const space = {
|
|
|
141
171
|
10: spacing(10),
|
|
142
172
|
auto: "auto"
|
|
143
173
|
};
|
|
144
|
-
const breakpoints = {
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
174
|
+
const breakpoints = withBreakpointHelpers({
|
|
175
|
+
xs: "0px",
|
|
176
|
+
sm: "600px",
|
|
177
|
+
md: "840px",
|
|
178
|
+
lg: "1200px",
|
|
179
|
+
xl: "1600px"
|
|
180
|
+
});
|
|
149
181
|
const layout = {
|
|
150
|
-
|
|
151
|
-
bars: {
|
|
152
|
-
panels: {
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
182
|
+
xs: {
|
|
183
|
+
bars: { top: 8 },
|
|
184
|
+
panels: {
|
|
185
|
+
start: {
|
|
186
|
+
mode: "hidden",
|
|
187
|
+
width: "280px",
|
|
188
|
+
railWidth: 9
|
|
189
|
+
},
|
|
190
|
+
end: {
|
|
191
|
+
mode: "hidden",
|
|
192
|
+
width: "360px",
|
|
193
|
+
railWidth: 9
|
|
194
|
+
}
|
|
195
|
+
},
|
|
157
196
|
content: {
|
|
158
197
|
columns: 4,
|
|
159
198
|
margin: 2,
|
|
@@ -161,31 +200,35 @@ const layout = {
|
|
|
161
200
|
mode: "fluid"
|
|
162
201
|
}
|
|
163
202
|
},
|
|
164
|
-
|
|
203
|
+
sm: {
|
|
165
204
|
panels: { start: { mode: "collapsed" } },
|
|
166
205
|
content: {
|
|
167
206
|
columns: 8,
|
|
168
207
|
margin: 4
|
|
169
208
|
}
|
|
170
209
|
},
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
top: 8,
|
|
174
|
-
bottom: 0
|
|
175
|
-
},
|
|
176
|
-
panels: { start: { mode: "inline" } },
|
|
210
|
+
md: {
|
|
211
|
+
panels: { end: { mode: "overlay" } },
|
|
177
212
|
content: {
|
|
178
213
|
columns: 12,
|
|
179
214
|
margin: 3,
|
|
180
|
-
gutter: 3
|
|
215
|
+
gutter: 3
|
|
216
|
+
}
|
|
217
|
+
},
|
|
218
|
+
lg: {
|
|
219
|
+
panels: { end: { width: "412px" } },
|
|
220
|
+
content: {
|
|
181
221
|
mode: "fixed",
|
|
182
222
|
maxWidth: "1200px"
|
|
183
223
|
}
|
|
184
224
|
},
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
225
|
+
xl: {
|
|
226
|
+
panels: {
|
|
227
|
+
start: { mode: "inline" },
|
|
228
|
+
end: { mode: "inline" }
|
|
229
|
+
},
|
|
230
|
+
content: { maxWidth: "1600px" }
|
|
231
|
+
}
|
|
189
232
|
};
|
|
190
233
|
const typography = {
|
|
191
234
|
h1: {
|
|
@@ -364,10 +407,15 @@ const baseTheme = {
|
|
|
364
407
|
shadow,
|
|
365
408
|
shadows
|
|
366
409
|
};
|
|
410
|
+
/**
|
|
411
|
+
* The query helpers for `baseTheme`'s breakpoints, as plain functions. A theme with its own
|
|
412
|
+
* breakpoints has the same helpers on `theme.breakpoints`.
|
|
413
|
+
*/
|
|
414
|
+
const { up, down, only, between, not, containerQueries } = breakpoints;
|
|
367
415
|
//#endregion
|
|
368
416
|
//#region src/theme/ThemeProvider.tsx
|
|
369
417
|
function ThemeProvider({ children, theme = baseTheme, defaults }) {
|
|
370
|
-
const value = useMemo(() => defaults ? createTheme(theme, { defaults }) : theme, [theme, defaults]);
|
|
418
|
+
const value = useMemo(() => defaults ? createTheme(theme, { defaults }) : withHelpers(theme), [theme, defaults]);
|
|
371
419
|
return /* @__PURE__ */ jsx(EmotionThemeProvider, {
|
|
372
420
|
theme: value,
|
|
373
421
|
children
|
|
@@ -403,4 +451,4 @@ function withTheme(WrappedComponent) {
|
|
|
403
451
|
};
|
|
404
452
|
}
|
|
405
453
|
//#endregion
|
|
406
|
-
export { sizes as _, avatar as a,
|
|
454
|
+
export { space as C, createTheme as D, zOrder as E, withBreakpointHelpers as O, sizes as S, up as T, letterSpacings as _, avatar as a, only as b, borderWidths as c, down as d, fontSizes as f, layout as g, icon as h, ThemeProvider as i, breakpoints as l, fonts as m, useDefaultProps as n, baseTheme as o, fontWeights as p, useTheme as r, between as s, withTheme as t, containerQueries as u, lineHeights as v, typography as w, radii as x, not as y };
|
|
@@ -1,10 +1,31 @@
|
|
|
1
1
|
const require_utils = require("./utils.cjs");
|
|
2
|
+
let _soroush_tech_styled_system = require("@soroush.tech/styled-system");
|
|
2
3
|
let react = require("react");
|
|
3
4
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
4
5
|
let _emotion_react = require("@emotion/react");
|
|
5
6
|
//#region src/theme/utils/spacing.ts
|
|
6
7
|
const spacing = (units) => `${8 * units}px`;
|
|
7
8
|
//#endregion
|
|
9
|
+
//#region src/theme/breakpoints.ts
|
|
10
|
+
/**
|
|
11
|
+
* The scale with its helpers attached as non-enumerable methods: the engine, the theme's JSON
|
|
12
|
+
* and a spread see only the sizes, while `theme.breakpoints.up('md')` works. `createTheme`
|
|
13
|
+
* and `ThemeProvider` re-attach them after a merge, so they always follow the theme's own
|
|
14
|
+
* breakpoints.
|
|
15
|
+
*/
|
|
16
|
+
const withBreakpointHelpers = (scale) => {
|
|
17
|
+
const sizes = { ...scale };
|
|
18
|
+
const helpers = {
|
|
19
|
+
...(0, _soroush_tech_styled_system.createMediaHelpers)(sizes),
|
|
20
|
+
containerQueries: (0, _soroush_tech_styled_system.createContainerQueries)(sizes)
|
|
21
|
+
};
|
|
22
|
+
for (const [name, helper] of Object.entries(helpers)) Object.defineProperty(sizes, name, {
|
|
23
|
+
value: helper,
|
|
24
|
+
enumerable: false
|
|
25
|
+
});
|
|
26
|
+
return sizes;
|
|
27
|
+
};
|
|
28
|
+
//#endregion
|
|
8
29
|
//#region src/theme/utils/createTheme.ts
|
|
9
30
|
const isPlainObject = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
10
31
|
const deepMerge = (base, overrides) => {
|
|
@@ -24,8 +45,17 @@ const deepMerge = (base, overrides) => {
|
|
|
24
45
|
* - `undefined` override values are ignored - a key can be added or replaced,
|
|
25
46
|
* never removed.
|
|
26
47
|
* - Neither argument is mutated; untouched branches keep referential identity.
|
|
48
|
+
* - `breakpoints` gets its query helpers back, built from the merged sizes.
|
|
27
49
|
*/
|
|
28
|
-
const createTheme = (base, overrides) =>
|
|
50
|
+
const createTheme = (base, overrides) => {
|
|
51
|
+
const theme = deepMerge(base, overrides);
|
|
52
|
+
return withHelpers(theme);
|
|
53
|
+
};
|
|
54
|
+
/** A theme whose `breakpoints` carry the query helpers - added when a hand-built theme lacks them. */
|
|
55
|
+
const withHelpers = (theme) => theme.breakpoints && !("up" in theme.breakpoints) ? {
|
|
56
|
+
...theme,
|
|
57
|
+
breakpoints: withBreakpointHelpers(theme.breakpoints)
|
|
58
|
+
} : theme;
|
|
29
59
|
//#endregion
|
|
30
60
|
//#region src/theme/themes.ts
|
|
31
61
|
const shadow = {
|
|
@@ -141,19 +171,28 @@ const space = {
|
|
|
141
171
|
10: spacing(10),
|
|
142
172
|
auto: "auto"
|
|
143
173
|
};
|
|
144
|
-
const breakpoints = {
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
174
|
+
const breakpoints = withBreakpointHelpers({
|
|
175
|
+
xs: "0px",
|
|
176
|
+
sm: "600px",
|
|
177
|
+
md: "840px",
|
|
178
|
+
lg: "1200px",
|
|
179
|
+
xl: "1600px"
|
|
180
|
+
});
|
|
149
181
|
const layout = {
|
|
150
|
-
|
|
151
|
-
bars: {
|
|
152
|
-
panels: {
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
182
|
+
xs: {
|
|
183
|
+
bars: { top: 8 },
|
|
184
|
+
panels: {
|
|
185
|
+
start: {
|
|
186
|
+
mode: "hidden",
|
|
187
|
+
width: "280px",
|
|
188
|
+
railWidth: 9
|
|
189
|
+
},
|
|
190
|
+
end: {
|
|
191
|
+
mode: "hidden",
|
|
192
|
+
width: "360px",
|
|
193
|
+
railWidth: 9
|
|
194
|
+
}
|
|
195
|
+
},
|
|
157
196
|
content: {
|
|
158
197
|
columns: 4,
|
|
159
198
|
margin: 2,
|
|
@@ -161,31 +200,35 @@ const layout = {
|
|
|
161
200
|
mode: "fluid"
|
|
162
201
|
}
|
|
163
202
|
},
|
|
164
|
-
|
|
203
|
+
sm: {
|
|
165
204
|
panels: { start: { mode: "collapsed" } },
|
|
166
205
|
content: {
|
|
167
206
|
columns: 8,
|
|
168
207
|
margin: 4
|
|
169
208
|
}
|
|
170
209
|
},
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
top: 8,
|
|
174
|
-
bottom: 0
|
|
175
|
-
},
|
|
176
|
-
panels: { start: { mode: "inline" } },
|
|
210
|
+
md: {
|
|
211
|
+
panels: { end: { mode: "overlay" } },
|
|
177
212
|
content: {
|
|
178
213
|
columns: 12,
|
|
179
214
|
margin: 3,
|
|
180
|
-
gutter: 3
|
|
215
|
+
gutter: 3
|
|
216
|
+
}
|
|
217
|
+
},
|
|
218
|
+
lg: {
|
|
219
|
+
panels: { end: { width: "412px" } },
|
|
220
|
+
content: {
|
|
181
221
|
mode: "fixed",
|
|
182
222
|
maxWidth: "1200px"
|
|
183
223
|
}
|
|
184
224
|
},
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
225
|
+
xl: {
|
|
226
|
+
panels: {
|
|
227
|
+
start: { mode: "inline" },
|
|
228
|
+
end: { mode: "inline" }
|
|
229
|
+
},
|
|
230
|
+
content: { maxWidth: "1600px" }
|
|
231
|
+
}
|
|
189
232
|
};
|
|
190
233
|
const typography = {
|
|
191
234
|
h1: {
|
|
@@ -364,10 +407,15 @@ const baseTheme = {
|
|
|
364
407
|
shadow,
|
|
365
408
|
shadows
|
|
366
409
|
};
|
|
410
|
+
/**
|
|
411
|
+
* The query helpers for `baseTheme`'s breakpoints, as plain functions. A theme with its own
|
|
412
|
+
* breakpoints has the same helpers on `theme.breakpoints`.
|
|
413
|
+
*/
|
|
414
|
+
const { up, down, only, between, not, containerQueries } = breakpoints;
|
|
367
415
|
//#endregion
|
|
368
416
|
//#region src/theme/ThemeProvider.tsx
|
|
369
417
|
function ThemeProvider({ children, theme = baseTheme, defaults }) {
|
|
370
|
-
const value = (0, react.useMemo)(() => defaults ? createTheme(theme, { defaults }) : theme, [theme, defaults]);
|
|
418
|
+
const value = (0, react.useMemo)(() => defaults ? createTheme(theme, { defaults }) : withHelpers(theme), [theme, defaults]);
|
|
371
419
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_emotion_react.ThemeProvider, {
|
|
372
420
|
theme: value,
|
|
373
421
|
children
|
|
@@ -421,6 +469,12 @@ Object.defineProperty(exports, "baseTheme", {
|
|
|
421
469
|
return baseTheme;
|
|
422
470
|
}
|
|
423
471
|
});
|
|
472
|
+
Object.defineProperty(exports, "between", {
|
|
473
|
+
enumerable: true,
|
|
474
|
+
get: function() {
|
|
475
|
+
return between;
|
|
476
|
+
}
|
|
477
|
+
});
|
|
424
478
|
Object.defineProperty(exports, "borderWidths", {
|
|
425
479
|
enumerable: true,
|
|
426
480
|
get: function() {
|
|
@@ -433,12 +487,24 @@ Object.defineProperty(exports, "breakpoints", {
|
|
|
433
487
|
return breakpoints;
|
|
434
488
|
}
|
|
435
489
|
});
|
|
490
|
+
Object.defineProperty(exports, "containerQueries", {
|
|
491
|
+
enumerable: true,
|
|
492
|
+
get: function() {
|
|
493
|
+
return containerQueries;
|
|
494
|
+
}
|
|
495
|
+
});
|
|
436
496
|
Object.defineProperty(exports, "createTheme", {
|
|
437
497
|
enumerable: true,
|
|
438
498
|
get: function() {
|
|
439
499
|
return createTheme;
|
|
440
500
|
}
|
|
441
501
|
});
|
|
502
|
+
Object.defineProperty(exports, "down", {
|
|
503
|
+
enumerable: true,
|
|
504
|
+
get: function() {
|
|
505
|
+
return down;
|
|
506
|
+
}
|
|
507
|
+
});
|
|
442
508
|
Object.defineProperty(exports, "fontSizes", {
|
|
443
509
|
enumerable: true,
|
|
444
510
|
get: function() {
|
|
@@ -481,6 +547,18 @@ Object.defineProperty(exports, "lineHeights", {
|
|
|
481
547
|
return lineHeights;
|
|
482
548
|
}
|
|
483
549
|
});
|
|
550
|
+
Object.defineProperty(exports, "not", {
|
|
551
|
+
enumerable: true,
|
|
552
|
+
get: function() {
|
|
553
|
+
return not;
|
|
554
|
+
}
|
|
555
|
+
});
|
|
556
|
+
Object.defineProperty(exports, "only", {
|
|
557
|
+
enumerable: true,
|
|
558
|
+
get: function() {
|
|
559
|
+
return only;
|
|
560
|
+
}
|
|
561
|
+
});
|
|
484
562
|
Object.defineProperty(exports, "radii", {
|
|
485
563
|
enumerable: true,
|
|
486
564
|
get: function() {
|
|
@@ -505,6 +583,12 @@ Object.defineProperty(exports, "typography", {
|
|
|
505
583
|
return typography;
|
|
506
584
|
}
|
|
507
585
|
});
|
|
586
|
+
Object.defineProperty(exports, "up", {
|
|
587
|
+
enumerable: true,
|
|
588
|
+
get: function() {
|
|
589
|
+
return up;
|
|
590
|
+
}
|
|
591
|
+
});
|
|
508
592
|
Object.defineProperty(exports, "useDefaultProps", {
|
|
509
593
|
enumerable: true,
|
|
510
594
|
get: function() {
|
|
@@ -517,6 +601,12 @@ Object.defineProperty(exports, "useTheme", {
|
|
|
517
601
|
return useTheme;
|
|
518
602
|
}
|
|
519
603
|
});
|
|
604
|
+
Object.defineProperty(exports, "withBreakpointHelpers", {
|
|
605
|
+
enumerable: true,
|
|
606
|
+
get: function() {
|
|
607
|
+
return withBreakpointHelpers;
|
|
608
|
+
}
|
|
609
|
+
});
|
|
520
610
|
Object.defineProperty(exports, "withTheme", {
|
|
521
611
|
enumerable: true,
|
|
522
612
|
get: function() {
|
package/dist/theme.cjs
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_themeDefault = require("./themeDefault-Cebi08Cv.cjs");
|
|
3
|
-
const require_theme = require("./theme-
|
|
3
|
+
const require_theme = require("./theme-DfAqr7qo.cjs");
|
|
4
4
|
exports.ThemeProvider = require_theme.ThemeProvider;
|
|
5
5
|
exports.avatar = require_theme.avatar;
|
|
6
6
|
exports.baseTheme = require_theme.baseTheme;
|
|
7
|
+
exports.between = require_theme.between;
|
|
7
8
|
exports.borderWidths = require_theme.borderWidths;
|
|
8
9
|
exports.breakpoints = require_theme.breakpoints;
|
|
10
|
+
exports.containerQueries = require_theme.containerQueries;
|
|
9
11
|
exports.createTheme = require_theme.createTheme;
|
|
12
|
+
exports.down = require_theme.down;
|
|
10
13
|
exports.fontSizes = require_theme.fontSizes;
|
|
11
14
|
exports.fontWeights = require_theme.fontWeights;
|
|
12
15
|
exports.fonts = require_theme.fonts;
|
|
@@ -14,12 +17,16 @@ exports.icon = require_theme.icon;
|
|
|
14
17
|
exports.layout = require_theme.layout;
|
|
15
18
|
exports.letterSpacings = require_theme.letterSpacings;
|
|
16
19
|
exports.lineHeights = require_theme.lineHeights;
|
|
20
|
+
exports.not = require_theme.not;
|
|
21
|
+
exports.only = require_theme.only;
|
|
17
22
|
exports.radii = require_theme.radii;
|
|
18
23
|
exports.sizes = require_theme.sizes;
|
|
19
24
|
exports.space = require_theme.space;
|
|
20
25
|
exports.themeDefault = require_themeDefault.themeDefault;
|
|
21
26
|
exports.typography = require_theme.typography;
|
|
27
|
+
exports.up = require_theme.up;
|
|
22
28
|
exports.useDefaultProps = require_theme.useDefaultProps;
|
|
23
29
|
exports.useTheme = require_theme.useTheme;
|
|
30
|
+
exports.withBreakpointHelpers = require_theme.withBreakpointHelpers;
|
|
24
31
|
exports.withTheme = require_theme.withTheme;
|
|
25
32
|
exports.zOrder = require_theme.zOrder;
|
package/dist/theme.d.cts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { $ as
|
|
2
|
-
import { a as ThemeProvider, i as themeDefault, n as useDefaultProps, r as useTheme, t as withTheme } from "./index-
|
|
3
|
-
export { ButtonOwnerState, ButtonVariants, CSSObject, CardOwnerState, CardSlotIconProps, CardSlotTypographyProps, ComponentConfig, ComponentStyle, ComponentVariant, type DeepPartial, LayoutBars, LayoutContent, LayoutEntry, LayoutLength, LayoutPanel, LayoutPanels, LayoutSpace, OpenScale, PaletteColor, PaletteEntry, PressableOwnerState, SizeEntry, Theme, ThemeAvatarSizes, ThemeBackground, ThemeBorder, ThemeBorderWidths, ThemeBreakpoints, ThemeComponents, ThemeDefaults, ThemeFontWeights, ThemeFonts, ThemeIconSizes, ThemeLayout, ThemeLetterSpacings, ThemeLineHeights, type ThemeOverride, ThemePalette, ThemeProvider, ThemeRadii, ThemeShadow, ThemeSizes, ThemeSkeleton, ThemeSpace, ThemeSwitch, ThemeText, ThemeTypographyVariants, ThemeZOrder, TypographyVariant, TypographyVariantStyle, avatar, baseTheme, borderWidths, breakpoints, createTheme, fontSizes, fontWeights, fonts, icon, layout, letterSpacings, lineHeights, radii, sizes, space, themeDefault, typography, useDefaultProps, useTheme, withTheme, zOrder };
|
|
1
|
+
import { $ as between, A as ThemeBreakpoints, B as ThemeRadii, C as PressableOwnerState, Ct as withBreakpointHelpers, D as ThemeBackground, E as ThemeAvatarSizes, F as ThemeIconSizes, G as ThemeSwitch, H as ThemeSizes, I as ThemeLayout, J as ThemeZOrder, K as ThemeText, L as ThemeLetterSpacings, M as ThemeDefaults, N as ThemeFontWeights, O as ThemeBorder, P as ThemeFonts, Q as baseTheme, R as ThemeLineHeights, S as PaletteEntry, St as BreakpointHelpers, T as Theme, U as ThemeSkeleton, V as ThemeShadow, W as ThemeSpace, X as TypographyVariantStyle, Y as TypographyVariant, Z as avatar, _ as LayoutPanel, _t as up, a as CSSObject, at as fontWeights, b as OpenScale, bt as ThemeOverride, c as CardSlotTypographyProps, ct as layout, d as ComponentVariant, dt as not, et as borderWidths, f as DefaultBreakpoints, ft as only, g as LayoutLength, gt as typography, h as LayoutEntry, ht as space, i as ButtonVariants, it as fontSizes, j as ThemeComponents, k as ThemeBorderWidths, l as ComponentConfig, lt as letterSpacings, m as LayoutContent, mt as sizes, n as BreakpointOverrides, nt as containerQueries, o as CardOwnerState, ot as fonts, p as LayoutBars, pt as radii, q as ThemeTypographyVariants, r as ButtonOwnerState, rt as down, s as CardSlotIconProps, st as icon, t as BreakpointKey, tt as breakpoints, u as ComponentStyle, ut as lineHeights, v as LayoutPanels, vt as zOrder, w as SizeEntry, x as PaletteColor, xt as createTheme, y as LayoutSpace, yt as DeepPartial, z as ThemePalette } from "./themes-Dswy4M6B.cjs";
|
|
2
|
+
import { a as ThemeProvider, i as themeDefault, n as useDefaultProps, r as useTheme, t as withTheme } from "./index-BO-vkjtm.cjs";
|
|
3
|
+
export { BreakpointHelpers, BreakpointKey, BreakpointOverrides, ButtonOwnerState, ButtonVariants, CSSObject, CardOwnerState, CardSlotIconProps, CardSlotTypographyProps, ComponentConfig, ComponentStyle, ComponentVariant, type DeepPartial, DefaultBreakpoints, LayoutBars, LayoutContent, LayoutEntry, LayoutLength, LayoutPanel, LayoutPanels, LayoutSpace, OpenScale, PaletteColor, PaletteEntry, PressableOwnerState, SizeEntry, Theme, ThemeAvatarSizes, ThemeBackground, ThemeBorder, ThemeBorderWidths, ThemeBreakpoints, ThemeComponents, ThemeDefaults, ThemeFontWeights, ThemeFonts, ThemeIconSizes, ThemeLayout, ThemeLetterSpacings, ThemeLineHeights, type ThemeOverride, ThemePalette, ThemeProvider, ThemeRadii, ThemeShadow, ThemeSizes, ThemeSkeleton, ThemeSpace, ThemeSwitch, ThemeText, ThemeTypographyVariants, ThemeZOrder, TypographyVariant, TypographyVariantStyle, avatar, baseTheme, between, borderWidths, breakpoints, containerQueries, createTheme, down, fontSizes, fontWeights, fonts, icon, layout, letterSpacings, lineHeights, not, only, radii, sizes, space, themeDefault, typography, up, useDefaultProps, useTheme, withBreakpointHelpers, withTheme, zOrder };
|
package/dist/theme.d.mts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { $ as
|
|
2
|
-
import { a as ThemeProvider, i as themeDefault, n as useDefaultProps, r as useTheme, t as withTheme } from "./index-
|
|
3
|
-
export { ButtonOwnerState, ButtonVariants, CSSObject, CardOwnerState, CardSlotIconProps, CardSlotTypographyProps, ComponentConfig, ComponentStyle, ComponentVariant, type DeepPartial, LayoutBars, LayoutContent, LayoutEntry, LayoutLength, LayoutPanel, LayoutPanels, LayoutSpace, OpenScale, PaletteColor, PaletteEntry, PressableOwnerState, SizeEntry, Theme, ThemeAvatarSizes, ThemeBackground, ThemeBorder, ThemeBorderWidths, ThemeBreakpoints, ThemeComponents, ThemeDefaults, ThemeFontWeights, ThemeFonts, ThemeIconSizes, ThemeLayout, ThemeLetterSpacings, ThemeLineHeights, type ThemeOverride, ThemePalette, ThemeProvider, ThemeRadii, ThemeShadow, ThemeSizes, ThemeSkeleton, ThemeSpace, ThemeSwitch, ThemeText, ThemeTypographyVariants, ThemeZOrder, TypographyVariant, TypographyVariantStyle, avatar, baseTheme, borderWidths, breakpoints, createTheme, fontSizes, fontWeights, fonts, icon, layout, letterSpacings, lineHeights, radii, sizes, space, themeDefault, typography, useDefaultProps, useTheme, withTheme, zOrder };
|
|
1
|
+
import { $ as between, A as ThemeBreakpoints, B as ThemeRadii, C as PressableOwnerState, Ct as withBreakpointHelpers, D as ThemeBackground, E as ThemeAvatarSizes, F as ThemeIconSizes, G as ThemeSwitch, H as ThemeSizes, I as ThemeLayout, J as ThemeZOrder, K as ThemeText, L as ThemeLetterSpacings, M as ThemeDefaults, N as ThemeFontWeights, O as ThemeBorder, P as ThemeFonts, Q as baseTheme, R as ThemeLineHeights, S as PaletteEntry, St as BreakpointHelpers, T as Theme, U as ThemeSkeleton, V as ThemeShadow, W as ThemeSpace, X as TypographyVariantStyle, Y as TypographyVariant, Z as avatar, _ as LayoutPanel, _t as up, a as CSSObject, at as fontWeights, b as OpenScale, bt as ThemeOverride, c as CardSlotTypographyProps, ct as layout, d as ComponentVariant, dt as not, et as borderWidths, f as DefaultBreakpoints, ft as only, g as LayoutLength, gt as typography, h as LayoutEntry, ht as space, i as ButtonVariants, it as fontSizes, j as ThemeComponents, k as ThemeBorderWidths, l as ComponentConfig, lt as letterSpacings, m as LayoutContent, mt as sizes, n as BreakpointOverrides, nt as containerQueries, o as CardOwnerState, ot as fonts, p as LayoutBars, pt as radii, q as ThemeTypographyVariants, r as ButtonOwnerState, rt as down, s as CardSlotIconProps, st as icon, t as BreakpointKey, tt as breakpoints, u as ComponentStyle, ut as lineHeights, v as LayoutPanels, vt as zOrder, w as SizeEntry, x as PaletteColor, xt as createTheme, y as LayoutSpace, yt as DeepPartial, z as ThemePalette } from "./themes-C3RTORGO.mjs";
|
|
2
|
+
import { a as ThemeProvider, i as themeDefault, n as useDefaultProps, r as useTheme, t as withTheme } from "./index-BHyJ6P_D.mjs";
|
|
3
|
+
export { BreakpointHelpers, BreakpointKey, BreakpointOverrides, ButtonOwnerState, ButtonVariants, CSSObject, CardOwnerState, CardSlotIconProps, CardSlotTypographyProps, ComponentConfig, ComponentStyle, ComponentVariant, type DeepPartial, DefaultBreakpoints, LayoutBars, LayoutContent, LayoutEntry, LayoutLength, LayoutPanel, LayoutPanels, LayoutSpace, OpenScale, PaletteColor, PaletteEntry, PressableOwnerState, SizeEntry, Theme, ThemeAvatarSizes, ThemeBackground, ThemeBorder, ThemeBorderWidths, ThemeBreakpoints, ThemeComponents, ThemeDefaults, ThemeFontWeights, ThemeFonts, ThemeIconSizes, ThemeLayout, ThemeLetterSpacings, ThemeLineHeights, type ThemeOverride, ThemePalette, ThemeProvider, ThemeRadii, ThemeShadow, ThemeSizes, ThemeSkeleton, ThemeSpace, ThemeSwitch, ThemeText, ThemeTypographyVariants, ThemeZOrder, TypographyVariant, TypographyVariantStyle, avatar, baseTheme, between, borderWidths, breakpoints, containerQueries, createTheme, down, fontSizes, fontWeights, fonts, icon, layout, letterSpacings, lineHeights, not, only, radii, sizes, space, themeDefault, typography, up, useDefaultProps, useTheme, withBreakpointHelpers, withTheme, zOrder };
|
package/dist/theme.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { t as themeDefault } from "./themeDefault-Z3KmyIbm.mjs";
|
|
2
|
-
import {
|
|
3
|
-
export { ThemeProvider, avatar, baseTheme, borderWidths, breakpoints, createTheme, fontSizes, fontWeights, fonts, icon, layout, letterSpacings, lineHeights, radii, sizes, space, themeDefault, typography, useDefaultProps, useTheme, withTheme, zOrder };
|
|
2
|
+
import { C as space, D as createTheme, E as zOrder, O as withBreakpointHelpers, S as sizes, T as up, _ as letterSpacings, a as avatar, b as only, c as borderWidths, d as down, f as fontSizes, g as layout, h as icon, i as ThemeProvider, l as breakpoints, m as fonts, n as useDefaultProps, o as baseTheme, p as fontWeights, r as useTheme, s as between, t as withTheme, u as containerQueries, v as lineHeights, w as typography, x as radii, y as not } from "./theme-C1o9qa2E.mjs";
|
|
3
|
+
export { ThemeProvider, avatar, baseTheme, between, borderWidths, breakpoints, containerQueries, createTheme, down, fontSizes, fontWeights, fonts, icon, layout, letterSpacings, lineHeights, not, only, radii, sizes, space, themeDefault, typography, up, useDefaultProps, useTheme, withBreakpointHelpers, withTheme, zOrder };
|
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
import { CSSObject } from "@emotion/react";
|
|
2
|
+
import { ContainerQueries, QueryHelpers } from "@soroush.tech/styled-system";
|
|
2
3
|
import { ElementType } from "react";
|
|
4
|
+
//#region src/theme/breakpoints.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* The query helpers a theme's breakpoint scale carries: `up` / `down` / `only` / `between` /
|
|
7
|
+
* `not` as `@media` rules, and `containerQueries` for the same sizes as `@container` rules.
|
|
8
|
+
*/
|
|
9
|
+
interface BreakpointHelpers extends QueryHelpers {
|
|
10
|
+
containerQueries: ContainerQueries;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* The scale with its helpers attached as non-enumerable methods: the engine, the theme's JSON
|
|
14
|
+
* and a spread see only the sizes, while `theme.breakpoints.up('md')` works. `createTheme`
|
|
15
|
+
* and `ThemeProvider` re-attach them after a merge, so they always follow the theme's own
|
|
16
|
+
* breakpoints.
|
|
17
|
+
*/
|
|
18
|
+
declare const withBreakpointHelpers: <Scale extends Record<string, string | number>>(scale: Scale) => Scale & BreakpointHelpers;
|
|
19
|
+
//#endregion
|
|
3
20
|
//#region src/theme/utils/createTheme.d.ts
|
|
4
21
|
/**
|
|
5
22
|
* Recursive partial of a theme shape. Plain objects recurse; arrays and
|
|
@@ -16,6 +33,7 @@ type ThemeOverride = DeepPartial<Theme>;
|
|
|
16
33
|
* - `undefined` override values are ignored - a key can be added or replaced,
|
|
17
34
|
* never removed.
|
|
18
35
|
* - Neither argument is mutated; untouched branches keep referential identity.
|
|
36
|
+
* - `breakpoints` gets its query helpers back, built from the merged sizes.
|
|
19
37
|
*/
|
|
20
38
|
declare const createTheme: (base: Theme, overrides: ThemeOverride) => Theme;
|
|
21
39
|
//#endregion
|
|
@@ -187,17 +205,40 @@ interface ThemeSizes {
|
|
|
187
205
|
* forces the matching icon size to be supplied.
|
|
188
206
|
*/
|
|
189
207
|
type ThemeIconSizes = { [K in keyof ThemeSizes]: string; };
|
|
208
|
+
/** The default breakpoint names - Material 3's window classes. */
|
|
209
|
+
interface DefaultBreakpoints {
|
|
210
|
+
/** compact: 0-599px - the base, applies everywhere until `sm` overrides it. */
|
|
211
|
+
xs: true;
|
|
212
|
+
/** medium: 600-839px. */
|
|
213
|
+
sm: true;
|
|
214
|
+
/** expanded: 840-1199px. */
|
|
215
|
+
md: true;
|
|
216
|
+
/** large: 1200-1599px. */
|
|
217
|
+
lg: true;
|
|
218
|
+
/** extra-large: 1600px and up. */
|
|
219
|
+
xl: true;
|
|
220
|
+
}
|
|
190
221
|
/**
|
|
191
|
-
*
|
|
192
|
-
*
|
|
193
|
-
*
|
|
194
|
-
*
|
|
222
|
+
* Add, rename or remove breakpoints by augmenting this interface: `true` adds a name, `false`
|
|
223
|
+
* removes a default one.
|
|
224
|
+
*
|
|
225
|
+
* declare module '@soroush.tech/design-system/theme' {
|
|
226
|
+
* interface BreakpointOverrides { mobile: true; tablet: true; xs: false; sm: false }
|
|
227
|
+
* }
|
|
195
228
|
*/
|
|
196
|
-
interface
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
229
|
+
interface BreakpointOverrides {}
|
|
230
|
+
type RemovedBreakpoints = keyof { [K in keyof BreakpointOverrides as BreakpointOverrides[K] extends false ? K : never]: true; };
|
|
231
|
+
/** The theme's breakpoint names: the defaults, plus every override set to `true`, minus every one set to `false`. */
|
|
232
|
+
type BreakpointKey = Exclude<keyof DefaultBreakpoints | keyof BreakpointOverrides, RemovedBreakpoints>;
|
|
233
|
+
/**
|
|
234
|
+
* `theme.breakpoints`: where each window class starts, ascending, in declared order. A key holds
|
|
235
|
+
* from its value until the next key, so `xs: '0px'` applies everywhere until `sm` overrides it;
|
|
236
|
+
* media queries are min-width, which is why the theme writes the start of each range. Responsive
|
|
237
|
+
* props map onto the keys by name, or by position for an array. A value is a CSS length; a
|
|
238
|
+
* media condition or a full `@media` rule is passed through, without the range helpers.
|
|
239
|
+
* `createTheme` appends a breakpoint you add after the existing ones, so it must be larger.
|
|
240
|
+
*/
|
|
241
|
+
type ThemeBreakpoints = { [K in BreakpointKey]: string; };
|
|
201
242
|
/** A `theme.space` key - layout margins and gutters step on the spacing scale. */
|
|
202
243
|
type LayoutSpace = Exclude<keyof ThemeSpace, 'auto'>;
|
|
203
244
|
/** A `theme.space` key or a CSS length (a 280px panel is a size, not a spacing step). */
|
|
@@ -238,14 +279,12 @@ interface LayoutEntry {
|
|
|
238
279
|
content: LayoutContent;
|
|
239
280
|
}
|
|
240
281
|
/**
|
|
241
|
-
* `theme.layout`:
|
|
242
|
-
*
|
|
243
|
-
*
|
|
244
|
-
*
|
|
282
|
+
* `theme.layout`: layout tokens per breakpoint, merged mobile-first in breakpoint order. The
|
|
283
|
+
* first breakpoint's entry (`xs`) is complete; every later one lists only what changes. A panel
|
|
284
|
+
* first declared at a later breakpoint needs its `mode`, `width` and `railWidth` there. These
|
|
285
|
+
* are tokens: apps (and the studio) read them; nothing in the design system lays a page out.
|
|
245
286
|
*/
|
|
246
|
-
type ThemeLayout = {
|
|
247
|
-
base: LayoutEntry;
|
|
248
|
-
} & { [K in keyof ThemeBreakpoints]?: {
|
|
287
|
+
type ThemeLayout = { [K in BreakpointKey]?: {
|
|
249
288
|
bars?: LayoutBars;
|
|
250
289
|
panels?: { [P in keyof LayoutPanels]?: Partial<LayoutPanel>; };
|
|
251
290
|
content?: Partial<LayoutContent>;
|
|
@@ -426,14 +465,12 @@ interface ThemeComponents {
|
|
|
426
465
|
Icon?: ComponentConfig;
|
|
427
466
|
Image?: ComponentConfig;
|
|
428
467
|
LinearProgress?: ComponentConfig<Record<string, unknown>, 'root' | 'track' | 'dash' | 'bar' | 'traveler' | 'segment' | 'secondaryBar'>;
|
|
429
|
-
LayoutGrid?: ComponentConfig;
|
|
430
468
|
Link?: ComponentConfig;
|
|
431
469
|
MenuItem?: ComponentConfig<Record<string, unknown>, 'root' | 'check'>;
|
|
432
470
|
Modal?: ComponentConfig;
|
|
433
471
|
NativeSelect?: ComponentConfig<Record<string, unknown>, 'root' | 'select' | 'icon'>;
|
|
434
472
|
Pagination?: ComponentConfig<Record<string, unknown>, 'root' | 'list'>;
|
|
435
473
|
PaginationItem?: ComponentConfig<Record<string, unknown>, 'root' | 'ellipsis'>;
|
|
436
|
-
PageLayout?: ComponentConfig<Record<string, unknown>, 'root' | 'bar' | 'panel' | 'content'>;
|
|
437
474
|
Paper?: ComponentConfig;
|
|
438
475
|
Popover?: ComponentConfig<Record<string, unknown>, 'root' | 'positioner'>;
|
|
439
476
|
Pressable?: ComponentConfig<PressableOwnerState>;
|
|
@@ -467,7 +504,7 @@ interface Theme {
|
|
|
467
504
|
/** Optional per-component customization - see `ThemeComponents`. */
|
|
468
505
|
components?: OpenScale<ThemeComponents>;
|
|
469
506
|
space: OpenScale<ThemeSpace>;
|
|
470
|
-
breakpoints: OpenScale<ThemeBreakpoints>;
|
|
507
|
+
breakpoints: OpenScale<ThemeBreakpoints & BreakpointHelpers>;
|
|
471
508
|
layout: ThemeLayout;
|
|
472
509
|
border: OpenScale<ThemeBorder>;
|
|
473
510
|
text: OpenScale<ThemeText>;
|
|
@@ -560,7 +597,7 @@ declare const avatar: {
|
|
|
560
597
|
declare const icon: ThemeIconSizes;
|
|
561
598
|
declare const sizes: ThemeSizes;
|
|
562
599
|
declare const space: ThemeSpace;
|
|
563
|
-
declare const breakpoints: ThemeBreakpoints;
|
|
600
|
+
declare const breakpoints: ThemeBreakpoints & BreakpointHelpers;
|
|
564
601
|
declare const layout: ThemeLayout;
|
|
565
602
|
declare const typography: ThemeTypographyVariants;
|
|
566
603
|
/**
|
|
@@ -568,5 +605,10 @@ declare const typography: ThemeTypographyVariants;
|
|
|
568
605
|
* belong to the consumer, who builds brand themes with `createTheme(baseTheme, ...)`.
|
|
569
606
|
*/
|
|
570
607
|
declare const baseTheme: Theme;
|
|
608
|
+
/**
|
|
609
|
+
* The query helpers for `baseTheme`'s breakpoints, as plain functions. A theme with its own
|
|
610
|
+
* breakpoints has the same helpers on `theme.breakpoints`.
|
|
611
|
+
*/
|
|
612
|
+
declare const up: (from: import("@soroush.tech/styled-system").BreakpointInput) => string, down: (to: import("@soroush.tech/styled-system").BreakpointInput) => string, only: (key: string) => string, between: (from: import("@soroush.tech/styled-system").BreakpointInput, to: import("@soroush.tech/styled-system").BreakpointInput) => string, not: (key: string) => string, containerQueries: import("@soroush.tech/styled-system").ContainerQueries;
|
|
571
613
|
//#endregion
|
|
572
|
-
export {
|
|
614
|
+
export { between as $, ThemeBreakpoints as A, ThemeRadii as B, PressableOwnerState as C, withBreakpointHelpers as Ct, ThemeBackground as D, ThemeAvatarSizes as E, ThemeIconSizes as F, ThemeSwitch as G, ThemeSizes as H, ThemeLayout as I, ThemeZOrder as J, ThemeText as K, ThemeLetterSpacings as L, ThemeDefaults as M, ThemeFontWeights as N, ThemeBorder as O, ThemeFonts as P, baseTheme as Q, ThemeLineHeights as R, PaletteEntry as S, BreakpointHelpers as St, Theme as T, ThemeSkeleton as U, ThemeShadow as V, ThemeSpace as W, TypographyVariantStyle as X, TypographyVariant as Y, avatar as Z, LayoutPanel as _, up as _t, CSSObject$1 as a, fontWeights as at, OpenScale as b, ThemeOverride as bt, CardSlotTypographyProps as c, layout as ct, ComponentVariant as d, not as dt, borderWidths as et, DefaultBreakpoints as f, only as ft, LayoutLength as g, typography as gt, LayoutEntry as h, space as ht, ButtonVariants as i, fontSizes as it, ThemeComponents as j, ThemeBorderWidths as k, ComponentConfig as l, letterSpacings as lt, LayoutContent as m, sizes as mt, BreakpointOverrides as n, containerQueries as nt, CardOwnerState as o, fonts as ot, LayoutBars as p, radii as pt, ThemeTypographyVariants as q, ButtonOwnerState as r, down as rt, CardSlotIconProps as s, icon as st, BreakpointKey as t, breakpoints as tt, ComponentStyle as u, lineHeights as ut, LayoutPanels as v, zOrder as vt, SizeEntry as w, PaletteColor as x, createTheme as xt, LayoutSpace as y, DeepPartial as yt, ThemePalette as z };
|