reshaped 2.7.4 → 2.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +17 -0
- package/bin/cli.js +2 -4
- package/bundle.css +1 -1
- package/bundle.js +15 -15
- package/cli/theming/index.d.ts +3 -3
- package/cli/theming/index.js +4 -8
- package/components/Actionable/Actionable.module.css +1 -1
- package/components/Alert/Alert.types.d.ts +1 -1
- package/components/Alert/tests/Alert.stories.js +10 -0
- package/components/Avatar/Avatar.module.css +1 -1
- package/components/Avatar/Avatar.types.d.ts +1 -1
- package/components/Avatar/tests/Avatar.stories.js +6 -0
- package/components/Badge/Badge.module.css +1 -1
- package/components/Badge/Badge.types.d.ts +1 -1
- package/components/Badge/tests/Badge.stories.js +12 -0
- package/components/Button/Button.module.css +1 -1
- package/components/Button/tests/Button.stories.d.ts +1 -0
- package/components/Button/tests/Button.stories.js +11 -0
- package/components/Calendar/useCalendarKeyboardNavigation.js +0 -1
- package/components/Card/Card.d.ts +1 -1
- package/components/Carousel/Carousel.module.css +1 -1
- package/components/Checkbox/Checkbox.module.css +1 -1
- package/components/Divider/Divider.module.css +1 -1
- package/components/FormControl/FormControl.context.d.ts +0 -1
- package/components/Hidden/Hidden.module.css +1 -1
- package/components/HiddenVisually/HiddenVisually.module.css +1 -1
- package/components/Icon/Icon.module.css +1 -1
- package/components/Icon/Icon.types.d.ts +1 -1
- package/components/Image/Image.module.css +1 -1
- package/components/Loader/Loader.module.css +1 -1
- package/components/MenuItem/MenuItem.module.css +1 -1
- package/components/Modal/Modal.module.css +1 -1
- package/components/Overlay/Overlay.module.css +1 -1
- package/components/Popover/Popover.module.css +1 -1
- package/components/Progress/Progress.module.css +1 -1
- package/components/Progress/Progress.types.d.ts +1 -1
- package/components/Progress/tests/Progress.stories.js +3 -0
- package/components/Radio/Radio.module.css +1 -1
- package/components/Reshaped/Reshaped.css +1 -1
- package/components/Select/Select.module.css +1 -1
- package/components/Slider/Slider.module.css +1 -1
- package/components/Slider/SliderThumb.js +2 -2
- package/components/Switch/Switch.module.css +1 -1
- package/components/Table/Table.module.css +1 -1
- package/components/Tabs/Tabs.module.css +1 -1
- package/components/Text/Text.module.css +1 -1
- package/components/Text/Text.types.d.ts +1 -1
- package/components/Text/tests/Text.stories.js +3 -0
- package/components/TextArea/TextArea.module.css +1 -1
- package/components/TextField/TextField.module.css +1 -1
- package/components/Theme/Theme.module.css +1 -1
- package/components/Toast/Toast.module.css +1 -1
- package/components/View/View.js +7 -3
- package/components/View/View.module.css +1 -1
- package/components/View/View.types.d.ts +5 -3
- package/components/View/tests/View.stories.d.ts +1 -0
- package/components/View/tests/View.stories.js +37 -0
- package/config/postcss.d.ts +18 -3
- package/config/postcss.js +18 -4
- package/config/tailwind.d.ts +2 -2
- package/config/tailwind.js +1 -2
- package/package.json +36 -40
- package/styles/aspectRatio/aspectRatio.module.css +1 -1
- package/styles/bleed/bleed.module.css +1 -1
- package/styles/height/height.module.css +1 -1
- package/styles/inset/inset.module.css +1 -1
- package/styles/maxHeight/maxHeight.module.css +1 -1
- package/styles/maxWidth/maxWidth.module.css +1 -1
- package/styles/minHeight/index.d.ts +3 -0
- package/styles/minHeight/index.js +10 -0
- package/styles/minHeight/minHeight.module.css +1 -0
- package/styles/minWidth/minWidth.module.css +1 -1
- package/styles/padding/padding.module.css +1 -1
- package/styles/position/position.module.css +1 -1
- package/styles/radius/radius.module.css +1 -1
- package/styles/width/width.module.css +1 -1
- package/themes/_generator/constants.js +2 -0
- package/themes/_generator/definitions/figma.d.ts +2 -2
- package/themes/_generator/definitions/figma.js +6 -0
- package/themes/_generator/definitions/reshaped.d.ts +2 -2
- package/themes/_generator/definitions/reshaped.js +5 -0
- package/themes/_generator/definitions/slate.d.ts +2 -2
- package/themes/_generator/tests/themes.stories.js +48 -1
- package/themes/_generator/tokens/color/color.types.d.ts +3 -3
- package/themes/_generator/tokens/transforms.d.ts +1 -1
- package/themes/_generator/tokens/types.d.ts +13 -14
- package/themes/_generator/tokens/viewport/viewport.transforms.d.ts +1 -1
- package/themes/_generator/tokens/viewport/viewport.types.d.ts +6 -2
- package/themes/_generator/transform.js +7 -2
- package/themes/_generator/types.d.ts +0 -1
- package/themes/_generator/utilities/color.d.ts +5 -1
- package/themes/_generator/utilities/color.js +18 -13
- package/themes/_generator/utilities/generateColors.d.ts +2 -0
- package/themes/_generator/utilities/generateColors.js +15 -10
- package/themes/figma/media.css +1 -0
- package/themes/figma/theme.css +1 -1
- package/themes/index.d.ts +1 -1
- package/themes/index.js +2 -4
- package/themes/reshaped/media.css +1 -0
- package/themes/reshaped/theme.css +1 -1
- package/themes/slate/media.css +1 -0
- package/themes/slate/theme.css +1 -1
- package/types/config.d.ts +3 -3
- package/utilities/storybook/Example.js +1 -2
- package/themes/_generator/definitions/base.d.ts +0 -3
- package/themes/_generator/definitions/base.js +0 -11
- package/themes/media.css +0 -5
package/config/tailwind.d.ts
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
import {
|
2
|
-
export declare const getTheme: (theme?:
|
1
|
+
import { ThemeDefinition } from "../themes/_generator/tokens/types";
|
2
|
+
export declare const getTheme: (theme?: ThemeDefinition) => Record<"backgroundColor" | "textColor" | "borderColor" | "colors" | "borderRadius" | "spacing" | "boxShadow" | "screens", Record<string, string>>;
|
package/config/tailwind.js
CHANGED
@@ -5,7 +5,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
6
6
|
exports.getTheme = void 0;
|
7
7
|
const reshaped_1 = __importDefault(require("../themes/_generator/definitions/reshaped"));
|
8
|
-
const base_1 = __importDefault(require("../themes/_generator/definitions/base"));
|
9
8
|
const string_1 = require("../utilities/string");
|
10
9
|
const mergeDefinitions_1 = __importDefault(require("../themes/_generator/utilities/mergeDefinitions"));
|
11
10
|
const constants_1 = require("../themes/_generator/constants");
|
@@ -81,7 +80,7 @@ const getTheme = (theme) => {
|
|
81
80
|
config.boxShadow[name] = configValue;
|
82
81
|
return;
|
83
82
|
});
|
84
|
-
Object.entries(
|
83
|
+
Object.entries(definition.viewport).forEach(([tokenName, tokenValue]) => {
|
85
84
|
if (!tokenValue.minPx)
|
86
85
|
return;
|
87
86
|
config.screens[tokenName] = `${tokenValue.minPx}px`;
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "reshaped",
|
3
3
|
"description": "Professionally crafted design system in React & Figma for building products of any scale and complexity",
|
4
|
-
"version": "2.
|
4
|
+
"version": "2.8.0",
|
5
5
|
"license": "SEE LICENSE IN LICENSE.md",
|
6
6
|
"email": "hello@reshaped.so",
|
7
7
|
"homepage": "https://reshaped.so",
|
@@ -53,10 +53,10 @@
|
|
53
53
|
"dev": "storybook dev -c tools/storybook -p 3001 --disable-telemetry",
|
54
54
|
"clean": "sh ./bin/clean.sh",
|
55
55
|
"build": "yarn clean && yarn build:stories && yarn build:esm && yarn build:cjs && yarn build:css && yarn build:bundle && resolve-tspaths && cp -r dist/* ./",
|
56
|
-
"build:themes": "node bin/cli.js theming --config cli/theming/reshaped.config.js --output src/themes
|
56
|
+
"build:themes": "node bin/cli.js theming --config cli/theming/reshaped.config.js --output src/themes",
|
57
57
|
"build:esm": "tsc -p tsconfig.esm.json",
|
58
58
|
"build:cjs": "tsc -p tsconfig.cjs.json",
|
59
|
-
"build:css": "postcss \"src/**/*.css\" --dir dist --base src --config tools/build
|
59
|
+
"build:css": "postcss \"src/**/*.css\" --dir dist --base src --config tools/build",
|
60
60
|
"build:stories": "tsc -p tsconfig.stories.json",
|
61
61
|
"build:bundle": "vite build && mv dist/bundle.umd.js dist/bundle.js && cp dist/index.d.ts dist/bundle.d.ts",
|
62
62
|
"build:storybook": "storybook build -c tools/storybook -o dist/app --disable-telemetry",
|
@@ -80,60 +80,56 @@
|
|
80
80
|
"defaults and not IE 11"
|
81
81
|
],
|
82
82
|
"devDependencies": {
|
83
|
-
"@commitlint/cli": "18.4.
|
84
|
-
"@commitlint/config-conventional": "18.4.
|
85
|
-
"@commitlint/types": "18.4.
|
86
|
-
"@
|
87
|
-
"@
|
88
|
-
"@
|
89
|
-
"@storybook/
|
90
|
-
"@
|
91
|
-
"@storybook/react-vite": "7.6.3",
|
92
|
-
"@testing-library/jest-dom": "6.1.4",
|
83
|
+
"@commitlint/cli": "18.4.3",
|
84
|
+
"@commitlint/config-conventional": "18.4.3",
|
85
|
+
"@commitlint/types": "18.4.3",
|
86
|
+
"@size-limit/preset-big-lib": "11.0.1",
|
87
|
+
"@storybook/addon-a11y": "7.6.6",
|
88
|
+
"@storybook/react": "7.6.6",
|
89
|
+
"@storybook/react-vite": "7.6.6",
|
90
|
+
"@testing-library/jest-dom": "6.1.6",
|
93
91
|
"@testing-library/react": "14.1.2",
|
94
|
-
"@testing-library/user-event": "14.5.
|
92
|
+
"@testing-library/user-event": "14.5.2",
|
95
93
|
"@types/events": "3.0.3",
|
96
|
-
"@types/jest": "29.5.
|
97
|
-
"@types/node": "20.
|
98
|
-
"@types/react": "18.2.
|
99
|
-
"@types/react-dom": "18.2.
|
100
|
-
"@typescript-eslint/eslint-plugin": "6.
|
101
|
-
"@typescript-eslint/parser": "6.
|
102
|
-
"@vitejs/plugin-react": "4.2.
|
103
|
-
"chromatic": "
|
94
|
+
"@types/jest": "29.5.11",
|
95
|
+
"@types/node": "20.10.6",
|
96
|
+
"@types/react": "18.2.46",
|
97
|
+
"@types/react-dom": "18.2.18",
|
98
|
+
"@typescript-eslint/eslint-plugin": "6.16.0",
|
99
|
+
"@typescript-eslint/parser": "6.16.0",
|
100
|
+
"@vitejs/plugin-react": "4.2.1",
|
101
|
+
"chromatic": "10.2.0",
|
104
102
|
"cz-conventional-changelog": "3.3.0",
|
105
|
-
"eslint": "8.
|
103
|
+
"eslint": "8.56.0",
|
106
104
|
"eslint-config-airbnb-typescript": "17.1.0",
|
107
|
-
"eslint-config-prettier": "9.
|
108
|
-
"eslint-plugin-import": "2.29.
|
105
|
+
"eslint-config-prettier": "9.1.0",
|
106
|
+
"eslint-plugin-import": "2.29.1",
|
109
107
|
"eslint-plugin-jsx-a11y": "6.8.0",
|
110
|
-
"eslint-plugin-prettier": "5.
|
108
|
+
"eslint-plugin-prettier": "5.1.2",
|
111
109
|
"eslint-plugin-react": "7.33.2",
|
112
110
|
"eslint-plugin-react-hooks": "4.6.0",
|
113
111
|
"identity-obj-proxy": "3.0.0",
|
114
112
|
"jest": "29.7.0",
|
115
113
|
"jest-environment-jsdom": "29.7.0",
|
116
114
|
"jest-matchmedia-mock": "1.1.0",
|
117
|
-
"lefthook": "1.5.
|
118
|
-
"postcss": "8.4.
|
119
|
-
"postcss-cli": "
|
115
|
+
"lefthook": "1.5.5",
|
116
|
+
"postcss": "8.4.32",
|
117
|
+
"postcss-cli": "11.0.0",
|
120
118
|
"postcss-each": "1.1.0",
|
121
|
-
"postcss-import": "15.1.0",
|
122
119
|
"postcss-nested": "6.0.1",
|
123
|
-
"prettier": "3.1.
|
120
|
+
"prettier": "3.1.1",
|
124
121
|
"react": "18.2.0",
|
125
122
|
"react-dom": "18.2.0",
|
126
123
|
"resolve-tspaths": "0.8.17",
|
127
|
-
"
|
128
|
-
"
|
129
|
-
"storybook": "7.6.3",
|
124
|
+
"size-limit": "11.0.1",
|
125
|
+
"storybook": "7.6.6",
|
130
126
|
"stylelint": "15.11.0",
|
131
127
|
"stylelint-config-prettier": "9.0.5",
|
132
128
|
"stylelint-config-standard": "34.0.0",
|
133
129
|
"ts-jest": "29.1.1",
|
134
|
-
"typescript": "5.
|
135
|
-
"vite": "
|
136
|
-
"vite-tsconfig-paths": "4.2.
|
130
|
+
"typescript": "5.3.3",
|
131
|
+
"vite": "5.0.10",
|
132
|
+
"vite-tsconfig-paths": "4.2.3"
|
137
133
|
},
|
138
134
|
"peerDependencies": {
|
139
135
|
"postcss": "^8.0.0",
|
@@ -141,11 +137,11 @@
|
|
141
137
|
"react-dom": "^18.0.0"
|
142
138
|
},
|
143
139
|
"dependencies": {
|
144
|
-
"
|
140
|
+
"@csstools/postcss-global-data": "2.1.1",
|
145
141
|
"chalk": "4.1.2",
|
146
142
|
"commander": "11.1.0",
|
147
|
-
"cssnano": "6.0.
|
148
|
-
"postcss-custom-media": "
|
143
|
+
"cssnano": "6.0.2",
|
144
|
+
"postcss-custom-media": "10.0.2"
|
149
145
|
},
|
150
146
|
"resolutions": {
|
151
147
|
"jackspeak": "2.1.1"
|
@@ -1 +1 @@
|
|
1
|
-
.root:empty,.root:not(:empty)>*{aspect-ratio:var(--rs-ratio)}.root>img{
|
1
|
+
.root:empty,.root:not(:empty)>*{aspect-ratio:var(--rs-ratio)}.root>img{object-fit:cover}.root{--rs-ratio-s:0;--rs-ratio-m:var(--rs-ratio-s);--rs-ratio-l:var(--rs-ratio-m);--rs-ratio-xl:var(--rs-ratio-l);--rs-ratio:var(--rs-ratio-s)}@media (--rs-viewport-m ){.root{--rs-ratio:var(--rs-ratio-m)}}@media (--rs-viewport-l ){.root{--rs-ratio:var(--rs-ratio-l)}}@media (--rs-viewport-xl ){.root{--rs-ratio:var(--rs-ratio-xl)}}
|
@@ -1 +1 @@
|
|
1
|
-
.root{
|
1
|
+
.root{margin-left:calc(var(--rs-unit-x1) * var(--rs-bleed) * -1);margin-right:calc(var(--rs-unit-x1) * var(--rs-bleed) * -1);--rs-bleed-s:0;--rs-bleed-m:var(--rs-bleed-s);--rs-bleed-l:var(--rs-bleed-m);--rs-bleed-xl:var(--rs-bleed-l);--rs-bleed:var(--rs-bleed-s)}.--bleed{border-left-style:none!important;border-radius:0;border-right-style:none!important}@media (--rs-viewport-m ){.root{--rs-bleed:var(--rs-bleed-m)}.--bleed-true--m{border-left-style:none!important;border-radius:0;border-right-style:none!important}.--bleed-false--m{border-left-style:solid!important;border-radius:var(--rs-radius);border-right-style:solid!important}}@media (--rs-viewport-l ){.root{--rs-bleed:var(--rs-bleed-l)}.--bleed-true--l{border-left-style:none!important;border-radius:0;border-right-style:none!important}.--bleed-false--l{border-left-style:solid!important;border-radius:var(--rs-radius);border-right-style:solid!important}}@media (--rs-viewport-xl ){.root{--rs-bleed:var(--rs-bleed-xl)}.--bleed-true--xl{border-left-style:none!important;border-radius:0;border-right-style:none!important}.--bleed-false--xl{border-left-style:solid!important;border-radius:var(--rs-radius);border-right-style:solid!important}}
|
@@ -1 +1 @@
|
|
1
|
-
.literal,.unit{--rs-h-s:auto;--rs-h-m:var(--rs-h-s);--rs-h-l:var(--rs-h-m);--rs-h-xl:var(--rs-h-l);height:var(--rs-h)}.literal{--rs-h:var(--rs-h-s)}.unit{--rs-h:calc(var(--rs-h-s) * var(--rs-unit-x1))}@media (
|
1
|
+
.literal,.unit{--rs-h-s:auto;--rs-h-m:var(--rs-h-s);--rs-h-l:var(--rs-h-m);--rs-h-xl:var(--rs-h-l);height:var(--rs-h)}.literal{--rs-h:var(--rs-h-s)}.unit{--rs-h:calc(var(--rs-h-s) * var(--rs-unit-x1))}@media (--rs-viewport-m ){.literal--m{--rs-h:var(--rs-h-m)}.unit--m{--rs-h:calc(var(--rs-h-m) * var(--rs-unit-x1))}}@media (--rs-viewport-l ){.literal--l{--rs-h:var(--rs-h-l)}.unit--l{--rs-h:calc(var(--rs-h-l) * var(--rs-unit-x1))}}@media (--rs-viewport-xl ){.literal--xl{--rs-h:var(--rs-h-xl)}.unit--xl{--rs-h:calc(var(--rs-h-xl) * var(--rs-unit-x1))}}
|
@@ -1 +1 @@
|
|
1
|
-
.--inset{inset:calc(var(--rs-inset) * var(--rs-unit-x1))}.--inset-end{inset-inline-end:calc(var(--rs-inset-end) * var(--rs-unit-x1))}.--inset-start{inset-inline-start:calc(var(--rs-inset-start) * var(--rs-unit-x1))}.--inset-top{inset-block-start:calc(var(--rs-inset-top) * var(--rs-unit-x1))}.--inset-bottom{inset-block-end:calc(var(--rs-inset-bottom) * var(--rs-unit-x1))}.--inset{--rs-inset-s:0;--rs-inset-m:var(--rs-inset-s);--rs-inset-l:var(--rs-inset-m);--rs-inset-xl:var(--rs-inset-l);--rs-inset:var(--rs-inset-s)}.--inset-end{--rs-inset-end-s:0;--rs-inset-end-m:var(--rs-inset-end-s);--rs-inset-end-l:var(--rs-inset-end-m);--rs-inset-end-xl:var(--rs-inset-end-l);--rs-inset-end:var(--rs-inset-end-s)}.--inset-start{--rs-inset-start-s:0;--rs-inset-start-m:var(--rs-inset-start-s);--rs-inset-start-l:var(--rs-inset-start-m);--rs-inset-start-xl:var(--rs-inset-start-l);--rs-inset-start:var(--rs-inset-start-s)}.--inset-top{--rs-inset-top-s:0;--rs-inset-top-m:var(--rs-inset-top-s);--rs-inset-top-l:var(--rs-inset-top-m);--rs-inset-top-xl:var(--rs-inset-top-l);--rs-inset-top:var(--rs-inset-top-s)}.--inset-bottom{--rs-inset-bottom-s:0;--rs-inset-bottom-m:var(--rs-inset-bottom-s);--rs-inset-bottom-l:var(--rs-inset-bottom-m);--rs-inset-bottom-xl:var(--rs-inset-bottom-l);--rs-inset-bottom:var(--rs-inset-bottom-s)}@media (
|
1
|
+
.--inset{inset:calc(var(--rs-inset) * var(--rs-unit-x1))}.--inset-end{inset-inline-end:calc(var(--rs-inset-end) * var(--rs-unit-x1))}.--inset-start{inset-inline-start:calc(var(--rs-inset-start) * var(--rs-unit-x1))}.--inset-top{inset-block-start:calc(var(--rs-inset-top) * var(--rs-unit-x1))}.--inset-bottom{inset-block-end:calc(var(--rs-inset-bottom) * var(--rs-unit-x1))}.--inset{--rs-inset-s:0;--rs-inset-m:var(--rs-inset-s);--rs-inset-l:var(--rs-inset-m);--rs-inset-xl:var(--rs-inset-l);--rs-inset:var(--rs-inset-s)}.--inset-end{--rs-inset-end-s:0;--rs-inset-end-m:var(--rs-inset-end-s);--rs-inset-end-l:var(--rs-inset-end-m);--rs-inset-end-xl:var(--rs-inset-end-l);--rs-inset-end:var(--rs-inset-end-s)}.--inset-start{--rs-inset-start-s:0;--rs-inset-start-m:var(--rs-inset-start-s);--rs-inset-start-l:var(--rs-inset-start-m);--rs-inset-start-xl:var(--rs-inset-start-l);--rs-inset-start:var(--rs-inset-start-s)}.--inset-top{--rs-inset-top-s:0;--rs-inset-top-m:var(--rs-inset-top-s);--rs-inset-top-l:var(--rs-inset-top-m);--rs-inset-top-xl:var(--rs-inset-top-l);--rs-inset-top:var(--rs-inset-top-s)}.--inset-bottom{--rs-inset-bottom-s:0;--rs-inset-bottom-m:var(--rs-inset-bottom-s);--rs-inset-bottom-l:var(--rs-inset-bottom-m);--rs-inset-bottom-xl:var(--rs-inset-bottom-l);--rs-inset-bottom:var(--rs-inset-bottom-s)}@media (--rs-viewport-m ){.--inset-end--m{inset-inline-end:calc(var(--rs-inset-end) * var(--rs-unit-x1))}.--inset-start--m{inset-inline-start:calc(var(--rs-inset-start) * var(--rs-unit-x1))}.--inset-top--m{inset-block-start:calc(var(--rs-inset-top) * var(--rs-unit-x1))}.--inset-bottom--m{inset-block-end:calc(var(--rs-inset-bottom) * var(--rs-unit-x1))}.--inset{--rs-inset:var(--rs-inset-m)}.--inset-end{--rs-inset-end:var(--rs-inset-end-m)}.--inset-start{--rs-inset-start:var(--rs-inset-start-m)}.--inset-top{--rs-inset-top:var(--rs-inset-top-m)}.--inset-bottom{--rs-inset-bottom:var(--rs-inset-bottom-m)}}@media (--rs-viewport-l ){.--inset-end--l{inset-inline-end:calc(var(--rs-inset-end) * var(--rs-unit-x1))}.--inset-start--l{inset-inline-start:calc(var(--rs-inset-start) * var(--rs-unit-x1))}.--inset-top--l{inset-block-start:calc(var(--rs-inset-top) * var(--rs-unit-x1))}.--inset-bottom--l{inset-block-end:calc(var(--rs-inset-bottom) * var(--rs-unit-x1))}.--inset{--rs-inset:var(--rs-inset-l)}.--inset-end{--rs-inset-end:var(--rs-inset-end-l)}.--inset-start{--rs-inset-start:var(--rs-inset-start-l)}.--inset-top{--rs-inset-top:var(--rs-inset-top-l)}.--inset-bottom{--rs-inset-bottom:var(--rs-inset-bottom-l)}}@media (--rs-viewport-xl ){.--inset-end--xl{inset-inline-end:calc(var(--rs-inset-end) * var(--rs-unit-x1))}.--inset-start--xl{inset-inline-start:calc(var(--rs-inset-start) * var(--rs-unit-x1))}.--inset-top--xl{inset-block-start:calc(var(--rs-inset-top) * var(--rs-unit-x1))}.--inset-bottom--xl{inset-block-end:calc(var(--rs-inset-bottom) * var(--rs-unit-x1))}.--inset{--rs-inset:var(--rs-inset-xl)}.--inset-end{--rs-inset-end:var(--rs-inset-end-xl)}.--inset-start{--rs-inset-start:var(--rs-inset-start-xl)}.--inset-top{--rs-inset-top:var(--rs-inset-top-xl)}.--inset-bottom{--rs-inset-bottom:var(--rs-inset-bottom-xl)}}
|
@@ -1 +1 @@
|
|
1
|
-
.literal{max-height:var(--rs-max-h-s,auto)}.unit{max-height:calc(var(--rs-max-h-s) * var(--rs-unit-x1))}@media (
|
1
|
+
.literal{max-height:var(--rs-max-h-s,auto)}.unit{max-height:calc(var(--rs-max-h-s) * var(--rs-unit-x1))}@media (--rs-viewport-m ){.literal--m{max-height:var(--rs-max-h-m)}.unit--m{max-height:calc(var(--rs-max-h-m) * var(--rs-unit-x1))}}@media (--rs-viewport-l ){.literal--l{max-height:var(--rs-max-h-l)}.unit--l{max-height:calc(var(--rs-max-h-l) * var(--rs-unit-x1))}}@media (--rs-viewport-xl ){.literal--xl{max-height:var(--rs-max-h-xl)}.unit--xl{max-height:calc(var(--rs-max-h-xl) * var(--rs-unit-x1))}}
|
@@ -1 +1 @@
|
|
1
|
-
.literal{max-width:var(--rs-max-w-s,auto)}.unit{max-width:calc(var(--rs-max-w-s) * var(--rs-unit-x1))}@media (
|
1
|
+
.literal{max-width:var(--rs-max-w-s,auto)}.unit{max-width:calc(var(--rs-max-w-s) * var(--rs-unit-x1))}@media (--rs-viewport-m ){.literal--m{max-width:var(--rs-max-w-m)}.unit--m{max-width:calc(var(--rs-max-w-m) * var(--rs-unit-x1))}}@media (--rs-viewport-l ){.literal--l{max-width:var(--rs-max-w-l)}.unit--l{max-width:calc(var(--rs-max-w-l) * var(--rs-unit-x1))}}@media (--rs-viewport-xl ){.literal--xl{max-width:var(--rs-max-w-xl)}.unit--xl{max-width:calc(var(--rs-max-w-xl) * var(--rs-unit-x1))}}
|
@@ -0,0 +1,10 @@
|
|
1
|
+
import { responsiveClassNames, responsiveVariables } from "../../utilities/helpers.js";
|
2
|
+
import s from "./minHeight.module.css";
|
3
|
+
const getMinWidthStyles = (value) => {
|
4
|
+
if (!value)
|
5
|
+
return null;
|
6
|
+
const variables = responsiveVariables("--rs-min-h", value);
|
7
|
+
const classNames = responsiveClassNames(s, (value) => (typeof value === "number" ? "unit" : "literal"), value, { excludeValueFromClassName: true });
|
8
|
+
return { classNames, variables };
|
9
|
+
};
|
10
|
+
export default getMinWidthStyles;
|
@@ -0,0 +1 @@
|
|
1
|
+
.literal{min-height:var(--rs-min-h-s,auto)}.unit{min-height:calc(var(--rs-min-h-s) * var(--rs-unit-x1))}@media (--rs-viewport-m ){.literal--m{min-height:var(--rs-min-h-m)}.unit--m{min-height:calc(var(--rs-min-h-m) * var(--rs-unit-x1))}}@media (--rs-viewport-l ){.literal--l{min-height:var(--rs-min-h-l)}.unit--l{min-height:calc(var(--rs-min-h-l) * var(--rs-unit-x1))}}@media (--rs-viewport-xl ){.literal--xl{min-height:var(--rs-min-h-xl)}.unit--xl{min-height:calc(var(--rs-min-h-xl) * var(--rs-unit-x1))}}
|
@@ -1 +1 @@
|
|
1
|
-
.literal{min-width:var(--rs-min-w-s,auto)}.unit{min-width:calc(var(--rs-min-w-s) * var(--rs-unit-x1))}@media (
|
1
|
+
.literal{min-width:var(--rs-min-w-s,auto)}.unit{min-width:calc(var(--rs-min-w-s) * var(--rs-unit-x1))}@media (--rs-viewport-m ){.literal--m{min-width:var(--rs-min-w-m)}.unit--m{min-width:calc(var(--rs-min-w-m) * var(--rs-unit-x1))}}@media (--rs-viewport-l ){.literal--l{min-width:var(--rs-min-w-l)}.unit--l{min-width:calc(var(--rs-min-w-l) * var(--rs-unit-x1))}}@media (--rs-viewport-xl ){.literal--xl{min-width:var(--rs-min-w-xl)}.unit--xl{min-width:calc(var(--rs-min-w-xl) * var(--rs-unit-x1))}}
|
@@ -1 +1 @@
|
|
1
|
-
.root{--rs-p-s:0;--rs-p-m:var(--rs-p-s);--rs-p-l:var(--rs-p-m);--rs-p-xl:var(--rs-p-l);--rs-p:var(--rs-p-s)
|
1
|
+
.root{padding:calc(var(--rs-p) * var(--rs-unit-x1));--rs-p-s:0;--rs-p-m:var(--rs-p-s);--rs-p-l:var(--rs-p-m);--rs-p-xl:var(--rs-p-l);--rs-p:var(--rs-p-s)}@media (--rs-viewport-m ){.root{--rs-p:var(--rs-p-m)}}@media (--rs-viewport-l ){.root{--rs-p:var(--rs-p-l)}}@media (--rs-viewport-xl ){.root{--rs-p:var(--rs-p-xl)}}
|
@@ -1 +1 @@
|
|
1
|
-
.--position-static{position:static}.--position-relative{position:relative}.--position-absolute{position:absolute}.--position-fixed{position:fixed}.--position-sticky{position:sticky}@media (
|
1
|
+
.--position-static{position:static}.--position-relative{position:relative}.--position-absolute{position:absolute}.--position-fixed{position:fixed}.--position-sticky{position:sticky}@media (--rs-viewport-m ){.--position-static--m{position:static}.--position-relative--m{position:relative}.--position-absolute--m{position:absolute}.--position-fixed--m{position:fixed}.--position-sticky--m{position:sticky}}@media (--rs-viewport-l ){.--position-static--l{position:static}.--position-relative--l{position:relative}.--position-absolute--l{position:absolute}.--position-fixed--l{position:fixed}.--position-sticky--l{position:sticky}}@media (--rs-viewport-xl ){.--position-static--xl{position:static}.--position-relative--xl{position:relative}.--position-absolute--xl{position:absolute}.--position-fixed--xl{position:fixed}.--position-sticky--xl{position:sticky}}
|
@@ -1 +1 @@
|
|
1
|
-
.root{border-radius:var(--rs-radius)}.--radius-none{--rs-radius:0}.--radius-small{--rs-radius:var(--rs-unit-radius-small)}.--radius-medium{--rs-radius:var(--rs-unit-radius-medium)}.--radius-large{--rs-radius:var(--rs-unit-radius-large)}.--radius-circular{--rs-radius:9999px}@media (
|
1
|
+
.root{border-radius:var(--rs-radius)}.--radius-none{--rs-radius:0}.--radius-small{--rs-radius:var(--rs-unit-radius-small)}.--radius-medium{--rs-radius:var(--rs-unit-radius-medium)}.--radius-large{--rs-radius:var(--rs-unit-radius-large)}.--radius-circular{--rs-radius:9999px}@media (--rs-viewport-m ){.--radius-none--m{--rs-radius:0}.--radius-small--m{--rs-radius:var(--rs-unit-radius-small)}.--radius-medium--m{--rs-radius:var(--rs-unit-radius-medium)}.--radius-large--m{--rs-radius:var(--rs-unit-radius-large)}.--radius-circular--m{--rs-radius:9999px}}@media (--rs-viewport-l ){.--radius-none--l{--rs-radius:0}.--radius-small--l{--rs-radius:var(--rs-unit-radius-small)}.--radius-medium--l{--rs-radius:var(--rs-unit-radius-medium)}.--radius-large--l{--rs-radius:var(--rs-unit-radius-large)}.--radius-circular--l{--rs-radius:9999px}}@media (--rs-viewport-xl ){.--radius-none--xl{--rs-radius:0}.--radius-small--xl{--rs-radius:var(--rs-unit-radius-small)}.--radius-medium--xl{--rs-radius:var(--rs-unit-radius-medium)}.--radius-large--xl{--rs-radius:var(--rs-unit-radius-large)}.--radius-circular--xl{--rs-radius:9999px}}
|
@@ -1 +1 @@
|
|
1
|
-
.literal{width:var(--rs-w-s,auto)}.unit{width:calc(var(--rs-w-s) * var(--rs-unit-x1))}@media (
|
1
|
+
.literal{width:var(--rs-w-s,auto)}.unit{width:calc(var(--rs-w-s) * var(--rs-unit-x1))}@media (--rs-viewport-m ){.literal--m{width:var(--rs-w-m)}.unit--m{width:calc(var(--rs-w-m) * var(--rs-unit-x1))}}@media (--rs-viewport-l ){.literal--l{width:var(--rs-w-l)}.unit--l{width:calc(var(--rs-w-l) * var(--rs-unit-x1))}}@media (--rs-viewport-xl ){.literal--xl{width:var(--rs-w-xl)}.unit--xl{width:calc(var(--rs-w-xl) * var(--rs-unit-x1))}}
|
@@ -1,3 +1,3 @@
|
|
1
|
-
import {
|
2
|
-
declare const theme:
|
1
|
+
import { ThemeDefinition } from "../tokens/types";
|
2
|
+
declare const theme: ThemeDefinition;
|
3
3
|
export default theme;
|
@@ -101,6 +101,7 @@ const theme = {
|
|
101
101
|
radiusMedium: { px: 4 },
|
102
102
|
radiusLarge: { px: 4 },
|
103
103
|
},
|
104
|
+
// @ts-ignore
|
104
105
|
color: {
|
105
106
|
foregroundNeutral: { hex: "#191919", hexDark: "#FFFFFF" },
|
106
107
|
foregroundNeutralFaded: { hex: "#474747", hexDark: "#B2B2B2" },
|
@@ -176,5 +177,10 @@ const theme = {
|
|
176
177
|
},
|
177
178
|
],
|
178
179
|
},
|
180
|
+
viewport: {
|
181
|
+
m: { minPx: 660 },
|
182
|
+
l: { minPx: 900 },
|
183
|
+
xl: { minPx: 1280 },
|
184
|
+
},
|
179
185
|
};
|
180
186
|
exports.default = theme;
|
@@ -1,3 +1,3 @@
|
|
1
|
-
import {
|
2
|
-
declare const theme:
|
1
|
+
import { ThemeDefinition } from "../tokens/types";
|
2
|
+
declare const theme: ThemeDefinition;
|
3
3
|
export default theme;
|
@@ -1,3 +1,3 @@
|
|
1
|
-
import {
|
2
|
-
declare const theme:
|
1
|
+
import { ThemeDefinition } from "../tokens/types";
|
2
|
+
declare const theme: ThemeDefinition;
|
3
3
|
export default theme;
|
@@ -5,6 +5,7 @@ import Button from "../../../components/Button/index.js";
|
|
5
5
|
import Badge from "../../../components/Badge/index.js";
|
6
6
|
import Alert from "../../../components/Alert/index.js";
|
7
7
|
import Card from "../../../components/Card/index.js";
|
8
|
+
import Avatar from "../../../components/Avatar/index.js";
|
8
9
|
import DropdownMenu from "../../../components/DropdownMenu/index.js";
|
9
10
|
import Theme from "../../../components/Theme/index.js";
|
10
11
|
import { getThemeCSS, generateThemeColors, baseThemeDefinition } from "../../index.js";
|
@@ -50,12 +51,58 @@ const componentExamples = (<View gap={4}>
|
|
50
51
|
<View.Item columns={6}>
|
51
52
|
<Alert color="critical">Critical</Alert>
|
52
53
|
</View.Item>
|
54
|
+
<View.Item columns={6}>
|
55
|
+
<Alert color="warning">Warning</Alert>
|
56
|
+
</View.Item>
|
53
57
|
<View.Item columns={6}>
|
54
58
|
<Alert color="positive">Positive</Alert>
|
55
59
|
</View.Item>
|
56
60
|
<View.Item columns={6}>
|
57
61
|
<Alert color="neutral">Neutral</Alert>
|
58
62
|
</View.Item>
|
63
|
+
<View.Item columns={12}>
|
64
|
+
<View direction="row" gap={2}>
|
65
|
+
<View backgroundColor="neutral" width={10} height={10}/>
|
66
|
+
<View backgroundColor="neutral-faded" width={10} height={10}/>
|
67
|
+
<View backgroundColor="primary" width={10} height={10}/>
|
68
|
+
<View backgroundColor="primary-faded" width={10} height={10}/>
|
69
|
+
<View backgroundColor="critical" width={10} height={10}/>
|
70
|
+
<View backgroundColor="critical-faded" width={10} height={10}/>
|
71
|
+
<View backgroundColor="warning" width={10} height={10}/>
|
72
|
+
<View backgroundColor="warning-faded" width={10} height={10}/>
|
73
|
+
<View backgroundColor="positive" width={10} height={10}/>
|
74
|
+
<View backgroundColor="positive-faded" width={10} height={10}/>
|
75
|
+
</View>
|
76
|
+
</View.Item>
|
77
|
+
<View.Item columns={12}>
|
78
|
+
<View direction="row" gap={2}>
|
79
|
+
<Avatar initials="RS" color="warning" variant="faded"/>
|
80
|
+
<Badge color="warning">Warning</Badge>
|
81
|
+
</View>
|
82
|
+
</View.Item>
|
83
|
+
<View.Item columns={12}>
|
84
|
+
<View direction="row">
|
85
|
+
<View padding={4} gap={4} backgroundColor="page">
|
86
|
+
Page
|
87
|
+
<View backgroundColor="neutral" padding={4}>
|
88
|
+
Neutral
|
89
|
+
</View>
|
90
|
+
<View backgroundColor="neutral-faded" padding={4}>
|
91
|
+
Neutral faded
|
92
|
+
</View>
|
93
|
+
</View>
|
94
|
+
|
95
|
+
<View padding={4} gap={4} backgroundColor="page-faded">
|
96
|
+
Page faded
|
97
|
+
<View backgroundColor="neutral" padding={4}>
|
98
|
+
Neutral
|
99
|
+
</View>
|
100
|
+
<View backgroundColor="neutral-faded" padding={4}>
|
101
|
+
Neutral faded
|
102
|
+
</View>
|
103
|
+
</View>
|
104
|
+
</View>
|
105
|
+
</View.Item>
|
59
106
|
<View.Item columns={6}>
|
60
107
|
<Card>
|
61
108
|
<View gap={2} align="start">
|
@@ -93,7 +140,7 @@ export const base = () => (<Example>
|
|
93
140
|
</Example.Item>
|
94
141
|
</Example>);
|
95
142
|
export const generation = () => (<Example>
|
96
|
-
<Example.Item
|
143
|
+
<Example.Item>
|
97
144
|
<style>{cssGenerated}</style>
|
98
145
|
<View gap={4}>
|
99
146
|
<View.Item>Generated theme</View.Item>
|
@@ -1,6 +1,6 @@
|
|
1
|
-
export type Name = "foregroundNeutral" | "foregroundNeutralFaded" | "foregroundDisabled" | "foregroundPrimary" | "foregroundCritical" | "foregroundPositive" | "borderNeutral" | "borderNeutralFaded" | "borderDisabled" | "borderPrimary" | "borderPrimaryFaded" | "borderCritical" | "borderCriticalFaded" | "borderPositive" | "borderPositiveFaded" | "backgroundNeutral" | "backgroundNeutralFaded" | "backgroundNeutralHighlighted" | "backgroundDisabled" | "backgroundDisabledFaded" | "backgroundPrimary" | "backgroundPrimaryFaded" | "backgroundPrimaryHighlighted" | "backgroundCritical" | "backgroundCriticalFaded" | "backgroundCriticalHighlighted" | "backgroundPositive" | "backgroundPositiveFaded" | "backgroundPositiveHighlighted" | "backgroundPage" | "backgroundPageFaded" | "backgroundElevationBase" | "backgroundElevationRaised" | "backgroundElevationOverlay" | "white" | "black";
|
2
|
-
export type GeneratedOnName = "onBackgroundNeutral" | "onBackgroundPrimary" | "onBackgroundPositive" | "onBackgroundCritical";
|
3
|
-
export type GeneratedRGBName = "rgbBackgroundNeutral" | "rgbBackgroundNeutralFaded" | "rgbBackgroundNeutralHighlighted" | "rgbBackgroundDisabled" | "rgbBackgroundDisabledFaded" | "rgbBackgroundPrimary" | "rgbBackgroundPrimaryFaded" | "rgbBackgroundPrimaryHighlighted" | "rgbBackgroundCritical" | "rgbBackgroundCriticalFaded" | "rgbBackgroundCriticalHighlighted" | "rgbBackgroundPositive" | "rgbBackgroundPositiveFaded" | "rgbBackgroundPositiveHighlighted" | "rgbBackgroundPage" | "rgbBackgroundPageFaded" | "rgbBackgroundElevationBase" | "rgbBackgroundElevationRaised" | "rgbBackgroundElevationOverlay";
|
1
|
+
export type Name = "foregroundNeutral" | "foregroundNeutralFaded" | "foregroundDisabled" | "foregroundPrimary" | "foregroundCritical" | "foregrounwarning" | "foregroundPositive" | "borderNeutral" | "borderNeutralFaded" | "borderDisabled" | "borderPrimary" | "borderPrimaryFaded" | "borderCritical" | "borderCriticalFaded" | "borderwarning" | "borderwarningFaded" | "borderPositive" | "borderPositiveFaded" | "backgroundNeutral" | "backgroundNeutralFaded" | "backgroundNeutralHighlighted" | "backgroundDisabled" | "backgroundDisabledFaded" | "backgroundPrimary" | "backgroundPrimaryFaded" | "backgroundPrimaryHighlighted" | "backgroundCritical" | "backgroundCriticalFaded" | "backgroundCriticalHighlighted" | "backgroundWarning" | "backgroundWarningFaded" | "backgroundWarningHighlighted" | "backgroundPositive" | "backgroundPositiveFaded" | "backgroundPositiveHighlighted" | "backgroundPage" | "backgroundPageFaded" | "backgroundElevationBase" | "backgroundElevationRaised" | "backgroundElevationOverlay" | "brand" | "white" | "black";
|
2
|
+
export type GeneratedOnName = "onBackgroundNeutral" | "onBackgroundPrimary" | "onBackgroundPositive" | "onBackgroundWarning" | "onBackgroundCritical";
|
3
|
+
export type GeneratedRGBName = "rgbBackgroundNeutral" | "rgbBackgroundNeutralFaded" | "rgbBackgroundNeutralHighlighted" | "rgbBackgroundDisabled" | "rgbBackgroundDisabledFaded" | "rgbBackgroundPrimary" | "rgbBackgroundPrimaryFaded" | "rgbBackgroundPrimaryHighlighted" | "rgbBackgroundCritical" | "rgbBackgroundCriticalFaded" | "rgbBackgroundCriticalHighlighted" | "rgbBackgroundWarning" | "rgbBackgroundWarningFaded" | "rgbBackgroundWarningHighlighted" | "rgbBackgroundPositive" | "rgbBackgroundPositiveFaded" | "rgbBackgroundPositiveHighlighted" | "rgbBackgroundPage" | "rgbBackgroundPageFaded" | "rgbBackgroundElevationBase" | "rgbBackgroundElevationRaised" | "rgbBackgroundElevationOverlay";
|
4
4
|
export type Token = {
|
5
5
|
hex: string;
|
6
6
|
hexDark?: string;
|
@@ -7,5 +7,5 @@ export declare const css: {
|
|
7
7
|
fontWeight: import("./types").Transformer<import("./fontWeight/fontWeight.types").Token>;
|
8
8
|
shadow: import("./types").Transformer<import("./shadow/shadow.types").Token>;
|
9
9
|
unit: import("./types").Transformer<import("./unit/unit.types").Token>;
|
10
|
-
viewport: import("./types").Transformer<import("./viewport/viewport.types").Token>;
|
10
|
+
viewport: import("./types").Transformer<import("./viewport/viewport.types").Token | import("./viewport/viewport.types").SToken>;
|
11
11
|
};
|
@@ -9,13 +9,10 @@ import type * as TUnit from "./unit/unit.types";
|
|
9
9
|
import type * as TViewport from "./viewport/viewport.types";
|
10
10
|
export type TokenType = "fontFamily" | "fontWeight" | "unit" | "viewport" | "font" | "color" | "duration" | "easing" | "shadow";
|
11
11
|
export type ColorHue = "primary" | "positive" | "critical" | "neutral";
|
12
|
-
export type BaseThemeDefinition = {
|
13
|
-
viewport: Record<TViewport.Name, TViewport.Token>;
|
14
|
-
};
|
15
12
|
type TokenSet<Name extends string, Token> = Record<Name, Token> & {
|
16
13
|
[tokenName: string]: Token;
|
17
14
|
};
|
18
|
-
export type
|
15
|
+
export type ThemeDefinition = {
|
19
16
|
unit: TokenSet<TUnit.Name, TUnit.Token>;
|
20
17
|
fontFamily: TokenSet<TFontFamily.Name, TFontFamily.Token>;
|
21
18
|
fontWeight: TokenSet<TFontWeight.Name, TFontWeight.Token>;
|
@@ -24,21 +21,23 @@ export type UserThemeDefinition = {
|
|
24
21
|
duration: TokenSet<TDuration.Name, TDuration.Token>;
|
25
22
|
easing: TokenSet<TEasing.Name, TEasing.Token>;
|
26
23
|
shadow: TokenSet<TShadow.Name, TShadow.Token>;
|
24
|
+
viewport: Record<Exclude<TViewport.Name, "s">, TViewport.Token>;
|
27
25
|
};
|
28
|
-
export type
|
29
|
-
unit?: Partial<
|
30
|
-
fontFamily?: Partial<
|
31
|
-
fontWeight?: Partial<
|
32
|
-
font?: Partial<
|
33
|
-
color?: Partial<
|
34
|
-
duration?: Partial<
|
35
|
-
easing?: Partial<
|
36
|
-
shadow?: Partial<
|
26
|
+
export type PartialThemeDefinition = {
|
27
|
+
unit?: Partial<ThemeDefinition["unit"]>;
|
28
|
+
fontFamily?: Partial<ThemeDefinition["fontFamily"]>;
|
29
|
+
fontWeight?: Partial<ThemeDefinition["fontWeight"]>;
|
30
|
+
font?: Partial<ThemeDefinition["font"]>;
|
31
|
+
color?: Partial<ThemeDefinition["color"]>;
|
32
|
+
duration?: Partial<ThemeDefinition["duration"]>;
|
33
|
+
easing?: Partial<ThemeDefinition["easing"]>;
|
34
|
+
shadow?: Partial<ThemeDefinition["shadow"]>;
|
35
|
+
viewport?: Partial<ThemeDefinition["viewport"]>;
|
37
36
|
};
|
38
|
-
export type ThemeDefinition = BaseThemeDefinition & UserThemeDefinition;
|
39
37
|
export type FullThemeDefinition = ThemeDefinition & {
|
40
38
|
color: Record<TColor.GeneratedOnName | TColor.GeneratedRGBName | TColor.Name, TColor.Token>;
|
41
39
|
unit: Record<TUnit.GeneratedName | TUnit.Name, TUnit.Token>;
|
40
|
+
viewport: Record<TViewport.Name, TViewport.Token | TViewport.SToken>;
|
42
41
|
};
|
43
42
|
export type TransformedToken = {
|
44
43
|
name: string;
|
@@ -31,9 +31,14 @@ const css_1 = require("./utilities/css");
|
|
31
31
|
const generateBackgroundColors_1 = __importDefault(require("./utilities/generateBackgroundColors"));
|
32
32
|
const generateUnits_1 = __importDefault(require("./utilities/generateUnits"));
|
33
33
|
const transform = (name, definition, options) => {
|
34
|
-
|
34
|
+
var _a, _b;
|
35
|
+
const { isFragment, themeOptions } = options;
|
35
36
|
(0, generateBackgroundColors_1.default)(definition, themeOptions);
|
36
37
|
(0, generateUnits_1.default)(definition);
|
38
|
+
// Generate s viewport
|
39
|
+
if ((_b = (_a = definition.viewport) === null || _a === void 0 ? void 0 : _a.m) === null || _b === void 0 ? void 0 : _b.minPx) {
|
40
|
+
definition.viewport.s = { maxPx: definition.viewport.m.minPx - 1 };
|
41
|
+
}
|
37
42
|
const transformedStorage = {
|
38
43
|
variable: [],
|
39
44
|
media: [],
|
@@ -51,7 +56,7 @@ const transform = (name, definition, options) => {
|
|
51
56
|
});
|
52
57
|
return {
|
53
58
|
variables: (0, css_1.variablesTemplate)(name, transformedStorage.variable),
|
54
|
-
media:
|
59
|
+
media: !isFragment ? (0, css_1.mediaTemplate)(transformedStorage.media) : undefined,
|
55
60
|
};
|
56
61
|
};
|
57
62
|
exports.default = transform;
|
@@ -4,7 +4,6 @@ export type PartialDeep<T> = T extends Primitive ? Partial<T> : {
|
|
4
4
|
[Key in keyof T]?: PartialDeep<T[Key]>;
|
5
5
|
};
|
6
6
|
export type PublicOptions = {
|
7
|
-
isPrivate?: boolean;
|
8
7
|
themeOptions?: ReshapedConfig["themeOptions"];
|
9
8
|
};
|
10
9
|
export type PrivateOptions = PublicOptions & {
|
@@ -74,7 +74,11 @@ export declare const hslToHex: (hsl: HslColor) => string;
|
|
74
74
|
/**
|
75
75
|
* Normalizing utilities
|
76
76
|
*/
|
77
|
-
export declare const
|
77
|
+
export declare const getDarkModeColor: (hsl: HslColor) => {
|
78
|
+
s: number;
|
79
|
+
l: number;
|
80
|
+
h: number;
|
81
|
+
};
|
78
82
|
export declare const getLuminanceDelta: (luminance: number) => number;
|
79
83
|
export declare function getRgbLuminance({ r, g, b }: RgbColor): number;
|
80
84
|
export declare const getOnColor: (args: {
|
@@ -4,7 +4,7 @@
|
|
4
4
|
* They have been rewritten for easier color transformations in the theme generation case
|
5
5
|
*/
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
7
|
-
exports.getOnColor = exports.getRgbLuminance = exports.getLuminanceDelta = exports.
|
7
|
+
exports.getOnColor = exports.getRgbLuminance = exports.getLuminanceDelta = exports.getDarkModeColor = exports.hslToHex = exports.hexToHsluv = exports.hexToHsl = exports.hsluvToHex = exports.hsluvToLch = exports.lchToHsluv = exports.lchToLuv = exports.luvToLch = exports.luvToXyz = exports.xyzToLuv = exports.lToY = exports.yToL = exports.xyzToRgb = exports.rgbToXyz = exports.fromLinear = exports.toLinear = exports.rgbToHex = exports.hslToRgb = exports.rgbToHsl = exports.hexToRgb = exports.calcMaxChromaHsluv = exports.distanceFromOriginAngle = exports.calculateBoundingLines = void 0;
|
8
8
|
/**
|
9
9
|
* Constants
|
10
10
|
*/
|
@@ -293,19 +293,24 @@ exports.hslToHex = hslToHex;
|
|
293
293
|
/**
|
294
294
|
* Normalizing utilities
|
295
295
|
*/
|
296
|
-
const
|
297
|
-
const
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
296
|
+
const getDarkModeColor = (hsl) => {
|
297
|
+
const { s, l } = hsl;
|
298
|
+
/**
|
299
|
+
* Colors with lower saturation should have bigger lightness delta, for example it can be
|
300
|
+
* Neutral: l: 97 -> l dark: 13
|
301
|
+
* Warning: l: 53 -> l dark: 47
|
302
|
+
*
|
303
|
+
* Therefor we calculate the dark mode lightness based on a saturation modifier, which should be between 0 and 1
|
304
|
+
* We take base saturation:
|
305
|
+
* Neutral: 20 -> 0.2 modifier, Warning: 96 -> 0.96 modifier
|
306
|
+
*
|
307
|
+
* And we also adjust that value with a modifier of 0.9-2 based on the saturation
|
308
|
+
* That way satured colors won't change much from its original value
|
309
|
+
*/
|
310
|
+
const sModifier = (s / 100) * (0.96 + (100 - s) / 100);
|
311
|
+
return Object.assign(Object.assign({}, hsl), { s: s - 7, l: l * sModifier });
|
307
312
|
};
|
308
|
-
exports.
|
313
|
+
exports.getDarkModeColor = getDarkModeColor;
|
309
314
|
const getLuminanceDelta = (luminance) => {
|
310
315
|
return Math.max(0, luminance - 50) / 5;
|
311
316
|
};
|
@@ -1,8 +1,10 @@
|
|
1
1
|
declare const generate: (args?: {
|
2
2
|
primary?: string;
|
3
3
|
critical?: string;
|
4
|
+
warning?: string;
|
4
5
|
positive?: string;
|
5
6
|
neutral?: string;
|
7
|
+
brand?: string;
|
6
8
|
}) => Record<import("../tokens/color/color.types").Name, import("../tokens/color/color.types").Token> & {
|
7
9
|
[tokenName: string]: import("../tokens/color/color.types").Token;
|
8
10
|
};
|