@vitality-ds/components 5.5.0 → 5.6.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/dist/Button/constants.js +14 -7
- package/dist/Button/index.js +7 -3
- package/dist/Button/logic.spec.js +12 -6
- package/dist/Button/primitives/index.js +12 -3
- package/dist/Button/primitives/styles/BaseButton.styles.js +6 -2
- package/dist/Button/primitives/styles/BaseContentContainer.styles.js +3 -0
- package/dist/DropdownMenu/components/DropdownMenuItem/styles/BaseItem.styles.js +6 -3
- package/dist/Form/CheckboxList/index.js +5 -4
- package/dist/Form/CheckboxList/index.spec.js +70 -0
- package/dist/Input/Checkbox/styles/BaseCheckboxText.styles.js +2 -1
- package/dist/Input/RadioButtons/components/RadioButton/styles/BaseRadioButton.styles.js +2 -1
- package/dist/Input/RadioButtons/components/RadioButton/styles/BaseRadioLabel.styles.js +2 -1
- package/dist/Input/RadioButtons/index.js +8 -4
- package/dist/Input/RadioButtons/index.spec.js +51 -0
- package/dist/Input/TextInput/components/ShortcutAdornment/index.js +8 -3
- package/dist/Shortcuts/constants.js +36 -0
- package/dist/Shortcuts/hooks/useOS.js +31 -0
- package/dist/Shortcuts/index.js +29 -4
- package/dist/Shortcuts/logic.js +47 -0
- package/dist/Shortcuts/logic.spec.js +149 -0
- package/dist/Shortcuts/styled.js +2 -2
- package/dist/Shortcuts/styles/BaseShortcut.styles.js +306 -21
- package/dist/Shortcuts/styles/BaseShortcutGroup.styles.js +4 -2
- package/dist/Shortcuts/styles/helpers.js +54 -0
- package/dist/components/src/Button/logic.d.ts +14 -6
- package/dist/components/src/Button/primitives/styled.d.ts +8 -0
- package/dist/components/src/Button/primitives/styles/BaseButton.styles.d.ts +5 -0
- package/dist/components/src/Button/primitives/styles/BaseContentContainer.styles.d.ts +3 -0
- package/dist/components/src/Button/primitives/types.d.ts +6 -0
- package/dist/components/src/Button/types.d.ts +3 -0
- package/dist/components/src/DropdownMenu/components/CheckableDropdownMenuItem/styled.d.ts +10 -1
- package/dist/components/src/DropdownMenu/components/DropdownMenuItem/styled.d.ts +10 -1
- package/dist/components/src/DropdownMenu/components/DropdownMenuItem/styles/BaseItem.styles.d.ts +10 -1
- package/dist/components/src/DropdownMenu/components/Submenu/styled.d.ts +10 -1
- package/dist/components/src/Form/CheckboxList/index.d.ts +1 -1
- package/dist/components/src/Form/CheckboxList/types.d.ts +4 -0
- package/dist/components/src/Input/Checkbox/styled.d.ts +1 -0
- package/dist/components/src/Input/Checkbox/styles/BaseCheckboxText.styles.d.ts +1 -0
- package/dist/components/src/Input/RadioButtons/components/RadioButton/styled.d.ts +1 -0
- package/dist/components/src/Input/RadioButtons/components/RadioButton/styles/BaseRadioLabel.styles.d.ts +1 -0
- package/dist/components/src/Input/TextInput/components/ShortcutAdornment/index.d.ts +1 -1
- package/dist/components/src/Input/TextInput/components/ShortcutAdornment/types.d.ts +1 -1
- package/dist/components/src/Link/styled.d.ts +5 -0
- package/dist/components/src/Shortcuts/constants.d.ts +6 -0
- package/dist/components/src/Shortcuts/hooks/useOS.d.ts +13 -0
- package/dist/components/src/Shortcuts/index.d.ts +1 -1
- package/dist/components/src/Shortcuts/logic.d.ts +31 -0
- package/dist/components/src/Shortcuts/logic.spec.d.ts +1 -0
- package/dist/components/src/Shortcuts/styled.d.ts +43 -18
- package/dist/components/src/Shortcuts/styles/BaseShortcut.styles.d.ts +54 -16
- package/dist/components/src/Shortcuts/styles/helpers.d.ts +9 -0
- package/dist/components/src/Shortcuts/types.d.ts +4 -2
- package/dist/esm/Button/constants.js +14 -7
- package/dist/esm/Button/index.js +7 -3
- package/dist/esm/Button/logic.spec.js +12 -6
- package/dist/esm/Button/primitives/index.js +12 -3
- package/dist/esm/Button/primitives/styles/BaseButton.styles.js +6 -2
- package/dist/esm/Button/primitives/styles/BaseContentContainer.styles.js +3 -0
- package/dist/esm/DropdownMenu/components/DropdownMenuItem/styles/BaseItem.styles.js +6 -3
- package/dist/esm/Form/CheckboxList/index.js +5 -4
- package/dist/esm/Form/CheckboxList/index.spec.js +70 -0
- package/dist/esm/Input/Checkbox/styles/BaseCheckboxText.styles.js +2 -1
- package/dist/esm/Input/RadioButtons/components/RadioButton/styles/BaseRadioButton.styles.js +2 -1
- package/dist/esm/Input/RadioButtons/components/RadioButton/styles/BaseRadioLabel.styles.js +2 -1
- package/dist/esm/Input/RadioButtons/index.js +8 -4
- package/dist/esm/Input/RadioButtons/index.spec.js +51 -0
- package/dist/esm/Input/TextInput/components/ShortcutAdornment/index.js +8 -3
- package/dist/esm/Shortcuts/constants.js +30 -0
- package/dist/esm/Shortcuts/hooks/useOS.js +24 -0
- package/dist/esm/Shortcuts/index.js +29 -4
- package/dist/esm/Shortcuts/logic.js +41 -0
- package/dist/esm/Shortcuts/logic.spec.js +147 -0
- package/dist/esm/Shortcuts/styled.js +2 -2
- package/dist/esm/Shortcuts/styles/BaseShortcut.styles.js +307 -22
- package/dist/esm/Shortcuts/styles/BaseShortcutGroup.styles.js +4 -2
- package/dist/esm/Shortcuts/styles/helpers.js +48 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +4 -4
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _constants = require("./constants");
|
|
4
|
+
var _logic = require("./logic");
|
|
5
|
+
describe("Shortcuts logic", function () {
|
|
6
|
+
describe("getOS", function () {
|
|
7
|
+
var originalNavigator = global.navigator;
|
|
8
|
+
afterEach(function () {
|
|
9
|
+
Object.defineProperty(global, "navigator", {
|
|
10
|
+
value: originalNavigator,
|
|
11
|
+
writable: true
|
|
12
|
+
});
|
|
13
|
+
});
|
|
14
|
+
it("should return null when navigator is undefined", function () {
|
|
15
|
+
Object.defineProperty(global, "navigator", {
|
|
16
|
+
value: undefined,
|
|
17
|
+
writable: true
|
|
18
|
+
});
|
|
19
|
+
expect((0, _logic.getOS)()).toBeNull();
|
|
20
|
+
});
|
|
21
|
+
it("should return 'mac' when platform includes 'mac'", function () {
|
|
22
|
+
Object.defineProperty(global, "navigator", {
|
|
23
|
+
value: {
|
|
24
|
+
userAgentData: {
|
|
25
|
+
platform: "macOS"
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
writable: true
|
|
29
|
+
});
|
|
30
|
+
expect((0, _logic.getOS)()).toBe("mac");
|
|
31
|
+
});
|
|
32
|
+
it("should return 'windows' when platform includes 'win'", function () {
|
|
33
|
+
Object.defineProperty(global, "navigator", {
|
|
34
|
+
value: {
|
|
35
|
+
userAgentData: {
|
|
36
|
+
platform: "Windows"
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
writable: true
|
|
40
|
+
});
|
|
41
|
+
expect((0, _logic.getOS)()).toBe("windows");
|
|
42
|
+
});
|
|
43
|
+
it("should return 'linux' when platform includes 'linux'", function () {
|
|
44
|
+
Object.defineProperty(global, "navigator", {
|
|
45
|
+
value: {
|
|
46
|
+
userAgentData: {
|
|
47
|
+
platform: "Linux"
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
writable: true
|
|
51
|
+
});
|
|
52
|
+
expect((0, _logic.getOS)()).toBe("linux");
|
|
53
|
+
});
|
|
54
|
+
it("should return the platform string when platform is not recognized", function () {
|
|
55
|
+
Object.defineProperty(global, "navigator", {
|
|
56
|
+
value: {
|
|
57
|
+
userAgentData: {
|
|
58
|
+
platform: "ChromeOS"
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
writable: true
|
|
62
|
+
});
|
|
63
|
+
expect((0, _logic.getOS)()).toBe("chromeos");
|
|
64
|
+
});
|
|
65
|
+
it("should return null when userAgentData is undefined", function () {
|
|
66
|
+
Object.defineProperty(global, "navigator", {
|
|
67
|
+
value: {
|
|
68
|
+
userAgentData: undefined
|
|
69
|
+
},
|
|
70
|
+
writable: true
|
|
71
|
+
});
|
|
72
|
+
expect((0, _logic.getOS)()).toBeNull();
|
|
73
|
+
});
|
|
74
|
+
});
|
|
75
|
+
describe("transformKey", function () {
|
|
76
|
+
describe("on Mac", function () {
|
|
77
|
+
var os = "mac";
|
|
78
|
+
it.each(Object.entries(_constants.MAC_KEY_MAP))("should transform '%s' to '%s'", function (input, expected) {
|
|
79
|
+
expect((0, _logic.transformKey)(input, os)).toBe(expected);
|
|
80
|
+
});
|
|
81
|
+
it("should handle uppercase input", function () {
|
|
82
|
+
expect((0, _logic.transformKey)("CMD", os)).toBe("⌘");
|
|
83
|
+
expect((0, _logic.transformKey)("SHIFT", os)).toBe("⇧");
|
|
84
|
+
expect((0, _logic.transformKey)("CTRL", os)).toBe("⌃");
|
|
85
|
+
});
|
|
86
|
+
it("should handle input with whitespace", function () {
|
|
87
|
+
expect((0, _logic.transformKey)(" cmd ", os)).toBe("⌘");
|
|
88
|
+
expect((0, _logic.transformKey)(" shift ", os)).toBe("⇧");
|
|
89
|
+
});
|
|
90
|
+
it("should return the original key if not in the map", function () {
|
|
91
|
+
expect((0, _logic.transformKey)("P", os)).toBe("P");
|
|
92
|
+
expect((0, _logic.transformKey)("Escape", os)).toBe("Escape");
|
|
93
|
+
expect((0, _logic.transformKey)("F5", os)).toBe("F5");
|
|
94
|
+
});
|
|
95
|
+
});
|
|
96
|
+
describe("on Windows", function () {
|
|
97
|
+
var os = "windows";
|
|
98
|
+
it.each(Object.entries(_constants.WINDOWS_KEY_MAP))("should transform '%s' to '%s'", function (input, expected) {
|
|
99
|
+
expect((0, _logic.transformKey)(input, os)).toBe(expected);
|
|
100
|
+
});
|
|
101
|
+
it("should handle uppercase input", function () {
|
|
102
|
+
expect((0, _logic.transformKey)("CMD", os)).toBe("Ctrl");
|
|
103
|
+
expect((0, _logic.transformKey)("SHIFT", os)).toBe("Shift");
|
|
104
|
+
expect((0, _logic.transformKey)("CTRL", os)).toBe("Ctrl");
|
|
105
|
+
});
|
|
106
|
+
it("should return the original key if not in the map", function () {
|
|
107
|
+
expect((0, _logic.transformKey)("P", os)).toBe("P");
|
|
108
|
+
expect((0, _logic.transformKey)("Escape", os)).toBe("Escape");
|
|
109
|
+
});
|
|
110
|
+
});
|
|
111
|
+
describe("on Linux", function () {
|
|
112
|
+
var os = "linux";
|
|
113
|
+
it("should use Windows key map for Linux", function () {
|
|
114
|
+
expect((0, _logic.transformKey)("cmd", os)).toBe("Ctrl");
|
|
115
|
+
expect((0, _logic.transformKey)("shift", os)).toBe("Shift");
|
|
116
|
+
expect((0, _logic.transformKey)("alt", os)).toBe("Alt");
|
|
117
|
+
});
|
|
118
|
+
});
|
|
119
|
+
describe("on null OS", function () {
|
|
120
|
+
var os = null;
|
|
121
|
+
it("should use Windows key map for null OS", function () {
|
|
122
|
+
expect((0, _logic.transformKey)("cmd", os)).toBe("Ctrl");
|
|
123
|
+
expect((0, _logic.transformKey)("shift", os)).toBe("Shift");
|
|
124
|
+
});
|
|
125
|
+
});
|
|
126
|
+
});
|
|
127
|
+
describe("transformKeys", function () {
|
|
128
|
+
it("should transform an array of keys for Mac", function () {
|
|
129
|
+
var result = (0, _logic.transformKeys)(["cmd", "shift", "P"], "mac");
|
|
130
|
+
expect(result).toEqual(["⌘", "⇧", "P"]);
|
|
131
|
+
});
|
|
132
|
+
it("should transform an array of keys for Windows", function () {
|
|
133
|
+
var result = (0, _logic.transformKeys)(["cmd", "shift", "P"], "windows");
|
|
134
|
+
expect(result).toEqual(["Ctrl", "Shift", "P"]);
|
|
135
|
+
});
|
|
136
|
+
it("should handle an empty array", function () {
|
|
137
|
+
var result = (0, _logic.transformKeys)([], "mac");
|
|
138
|
+
expect(result).toEqual([]);
|
|
139
|
+
});
|
|
140
|
+
it("should handle mixed mapped and unmapped keys", function () {
|
|
141
|
+
var result = (0, _logic.transformKeys)(["ctrl", "alt", "Delete", "F5"], "mac");
|
|
142
|
+
expect(result).toEqual(["⌃", "⌥", "Delete", "F5"]);
|
|
143
|
+
});
|
|
144
|
+
it("should preserve order of keys", function () {
|
|
145
|
+
var result = (0, _logic.transformKeys)(["shift", "cmd", "alt", "K"], "mac");
|
|
146
|
+
expect(result).toEqual(["⇧", "⌘", "⌥", "K"]);
|
|
147
|
+
});
|
|
148
|
+
});
|
|
149
|
+
});
|
package/dist/Shortcuts/styled.js
CHANGED
|
@@ -8,5 +8,5 @@ exports.BaseShortcutGroup = exports.BaseShortcut = void 0;
|
|
|
8
8
|
var _system = require("@vitality-ds/system");
|
|
9
9
|
var _BaseShortcut = _interopRequireDefault(require("./styles/BaseShortcut.styles"));
|
|
10
10
|
var _BaseShortcutGroup = _interopRequireDefault(require("./styles/BaseShortcutGroup.styles"));
|
|
11
|
-
var BaseShortcut = exports.BaseShortcut = (0, _system.styled)("
|
|
12
|
-
var BaseShortcutGroup = exports.BaseShortcutGroup = (0, _system.styled)("
|
|
11
|
+
var BaseShortcut = exports.BaseShortcut = (0, _system.styled)("kbd", _BaseShortcut["default"]);
|
|
12
|
+
var BaseShortcutGroup = exports.BaseShortcutGroup = (0, _system.styled)("kbd", _BaseShortcutGroup["default"]);
|
|
@@ -5,29 +5,314 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports["default"] = void 0;
|
|
7
7
|
var _system = require("@vitality-ds/system");
|
|
8
|
-
var
|
|
9
|
-
borders = _system.colorUseCases.borders;
|
|
8
|
+
var _helpers = require("./helpers");
|
|
10
9
|
var _default = exports["default"] = (0, _system.css)({
|
|
11
|
-
fontSize: "$caption",
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
10
|
+
$$fontSize: "$fontSizes$caption",
|
|
11
|
+
$$paddingHorizontal: "$space$sm",
|
|
12
|
+
fontSize: "$$fontSize",
|
|
13
|
+
fontWeight: "$caption",
|
|
14
|
+
"&, kbd": {
|
|
15
|
+
fontFamily: "$body",
|
|
16
|
+
lineHeight: "$caption",
|
|
17
|
+
boxSizing: "border-box"
|
|
18
|
+
},
|
|
19
|
+
borderRadius: "$default",
|
|
20
|
+
display: "inline-flex",
|
|
21
|
+
padding: "$xs $$paddingHorizontal",
|
|
22
|
+
justifyContent: "center",
|
|
23
|
+
alignItems: "center",
|
|
24
|
+
alignSelf: "center",
|
|
25
|
+
minWidth: "calc($$fontSize + $$paddingHorizontal * 2)",
|
|
15
26
|
variants: {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
alignItems: "center",
|
|
23
|
-
borderWidth: "1px 1px 3px",
|
|
24
|
-
borderColor: (0, _system.getColorScaleValueByUseCase)("neutralA", borders.uiElement)
|
|
25
|
-
},
|
|
26
|
-
color: {
|
|
27
|
-
inherit: {
|
|
28
|
-
color: "inherit"
|
|
29
|
-
}
|
|
27
|
+
/**
|
|
28
|
+
* When combinedKeys = true, adds spacing between characters
|
|
29
|
+
*/
|
|
30
|
+
separateCombinedKeys: {
|
|
31
|
+
"true": {
|
|
32
|
+
gap: "$xs"
|
|
30
33
|
}
|
|
34
|
+
},
|
|
35
|
+
/**
|
|
36
|
+
* The stylistic changes in the element (Internal Prop - Not Exposed)
|
|
37
|
+
* Note that these variants are empty on purpose
|
|
38
|
+
* to allow for the compound variants
|
|
39
|
+
*/
|
|
40
|
+
variant: {
|
|
41
|
+
uiElement: {},
|
|
42
|
+
uiElementSolid: {},
|
|
43
|
+
onSolidBackground: {},
|
|
44
|
+
onUiElementBackground: {},
|
|
45
|
+
onSurfaceBackground: {},
|
|
46
|
+
ghost: {},
|
|
47
|
+
link: {}
|
|
48
|
+
},
|
|
49
|
+
/**
|
|
50
|
+
* The tint of the element (Internal Prop - Not Exposed)
|
|
51
|
+
* Note that these variants are empty on purpose
|
|
52
|
+
* to allow for the compound variants
|
|
53
|
+
*/
|
|
54
|
+
color: {
|
|
55
|
+
neutral: {},
|
|
56
|
+
primary: {},
|
|
57
|
+
critical: {},
|
|
58
|
+
success: {},
|
|
59
|
+
warning: {},
|
|
60
|
+
info: {},
|
|
61
|
+
brand: {},
|
|
62
|
+
accent: {}
|
|
31
63
|
}
|
|
32
|
-
}
|
|
64
|
+
},
|
|
65
|
+
compoundVariants: [
|
|
66
|
+
/**
|
|
67
|
+
* Standard Variants
|
|
68
|
+
*/
|
|
69
|
+
{
|
|
70
|
+
color: "neutral",
|
|
71
|
+
variant: "uiElement",
|
|
72
|
+
css: (0, _helpers.getUiElementVariant)("neutral")
|
|
73
|
+
}, {
|
|
74
|
+
color: "primary",
|
|
75
|
+
variant: "uiElement",
|
|
76
|
+
css: (0, _helpers.getUiElementVariant)("primary")
|
|
77
|
+
}, {
|
|
78
|
+
color: "success",
|
|
79
|
+
variant: "uiElement",
|
|
80
|
+
css: (0, _helpers.getUiElementVariant)("success")
|
|
81
|
+
}, {
|
|
82
|
+
color: "warning",
|
|
83
|
+
variant: "uiElement",
|
|
84
|
+
css: (0, _helpers.getUiElementVariant)("warning")
|
|
85
|
+
}, {
|
|
86
|
+
color: "critical",
|
|
87
|
+
variant: "uiElement",
|
|
88
|
+
css: (0, _helpers.getUiElementVariant)("critical")
|
|
89
|
+
}, {
|
|
90
|
+
color: "info",
|
|
91
|
+
variant: "uiElement",
|
|
92
|
+
css: (0, _helpers.getUiElementVariant)("info")
|
|
93
|
+
}, {
|
|
94
|
+
color: "brand",
|
|
95
|
+
variant: "uiElement",
|
|
96
|
+
css: (0, _helpers.getUiElementVariant)("brand")
|
|
97
|
+
}, {
|
|
98
|
+
color: "accent",
|
|
99
|
+
variant: "uiElement",
|
|
100
|
+
css: (0, _helpers.getUiElementVariant)("accent")
|
|
101
|
+
},
|
|
102
|
+
/**
|
|
103
|
+
* Solid Variants
|
|
104
|
+
*/
|
|
105
|
+
{
|
|
106
|
+
color: "neutral",
|
|
107
|
+
variant: "uiElementSolid",
|
|
108
|
+
css: (0, _helpers.getSolidVariant)("neutral")
|
|
109
|
+
}, {
|
|
110
|
+
color: "primary",
|
|
111
|
+
variant: "uiElementSolid",
|
|
112
|
+
css: (0, _helpers.getSolidVariant)("primary")
|
|
113
|
+
}, {
|
|
114
|
+
color: "success",
|
|
115
|
+
variant: "uiElementSolid",
|
|
116
|
+
css: (0, _helpers.getSolidVariant)("success")
|
|
117
|
+
}, {
|
|
118
|
+
color: "warning",
|
|
119
|
+
variant: "uiElementSolid",
|
|
120
|
+
css: (0, _helpers.getSolidVariant)("warning")
|
|
121
|
+
}, {
|
|
122
|
+
color: "critical",
|
|
123
|
+
variant: "uiElementSolid",
|
|
124
|
+
css: (0, _helpers.getSolidVariant)("critical")
|
|
125
|
+
}, {
|
|
126
|
+
color: "info",
|
|
127
|
+
variant: "uiElementSolid",
|
|
128
|
+
css: (0, _helpers.getSolidVariant)("info")
|
|
129
|
+
}, {
|
|
130
|
+
color: "brand",
|
|
131
|
+
variant: "uiElementSolid",
|
|
132
|
+
css: (0, _helpers.getSolidVariant)("brand")
|
|
133
|
+
}, {
|
|
134
|
+
color: "accent",
|
|
135
|
+
variant: "uiElementSolid",
|
|
136
|
+
css: (0, _helpers.getSolidVariant)("accent")
|
|
137
|
+
},
|
|
138
|
+
/**
|
|
139
|
+
* onUiElementBackground Variants
|
|
140
|
+
*/
|
|
141
|
+
{
|
|
142
|
+
color: "neutral",
|
|
143
|
+
variant: "onUiElementBackground",
|
|
144
|
+
css: (0, _helpers.getOnUiElementBackgroundVariant)("neutral")
|
|
145
|
+
}, {
|
|
146
|
+
color: "primary",
|
|
147
|
+
variant: "onUiElementBackground",
|
|
148
|
+
css: (0, _helpers.getOnUiElementBackgroundVariant)("primary")
|
|
149
|
+
}, {
|
|
150
|
+
color: "success",
|
|
151
|
+
variant: "onUiElementBackground",
|
|
152
|
+
css: (0, _helpers.getOnUiElementBackgroundVariant)("success")
|
|
153
|
+
}, {
|
|
154
|
+
color: "warning",
|
|
155
|
+
variant: "onUiElementBackground",
|
|
156
|
+
css: (0, _helpers.getOnUiElementBackgroundVariant)("warning")
|
|
157
|
+
}, {
|
|
158
|
+
color: "critical",
|
|
159
|
+
variant: "onUiElementBackground",
|
|
160
|
+
css: (0, _helpers.getOnUiElementBackgroundVariant)("critical")
|
|
161
|
+
}, {
|
|
162
|
+
color: "info",
|
|
163
|
+
variant: "onUiElementBackground",
|
|
164
|
+
css: (0, _helpers.getOnUiElementBackgroundVariant)("info")
|
|
165
|
+
}, {
|
|
166
|
+
color: "brand",
|
|
167
|
+
variant: "onUiElementBackground",
|
|
168
|
+
css: (0, _helpers.getOnUiElementBackgroundVariant)("brand")
|
|
169
|
+
}, {
|
|
170
|
+
color: "accent",
|
|
171
|
+
variant: "onUiElementBackground",
|
|
172
|
+
css: (0, _helpers.getOnUiElementBackgroundVariant)("accent")
|
|
173
|
+
},
|
|
174
|
+
/**
|
|
175
|
+
* OnSurface Variants
|
|
176
|
+
*/
|
|
177
|
+
{
|
|
178
|
+
color: "neutral",
|
|
179
|
+
variant: "onSurfaceBackground",
|
|
180
|
+
css: (0, _helpers.getOnSurfaceVariant)("neutral")
|
|
181
|
+
}, {
|
|
182
|
+
color: "primary",
|
|
183
|
+
variant: "onSurfaceBackground",
|
|
184
|
+
css: (0, _helpers.getOnSurfaceVariant)("primary")
|
|
185
|
+
}, {
|
|
186
|
+
color: "success",
|
|
187
|
+
variant: "onSurfaceBackground",
|
|
188
|
+
css: (0, _helpers.getOnSurfaceVariant)("success")
|
|
189
|
+
}, {
|
|
190
|
+
color: "warning",
|
|
191
|
+
variant: "onSurfaceBackground",
|
|
192
|
+
css: (0, _helpers.getOnSurfaceVariant)("warning")
|
|
193
|
+
}, {
|
|
194
|
+
color: "critical",
|
|
195
|
+
variant: "onSurfaceBackground",
|
|
196
|
+
css: (0, _helpers.getOnSurfaceVariant)("critical")
|
|
197
|
+
}, {
|
|
198
|
+
color: "info",
|
|
199
|
+
variant: "onSurfaceBackground",
|
|
200
|
+
css: (0, _helpers.getOnSurfaceVariant)("info")
|
|
201
|
+
}, {
|
|
202
|
+
color: "brand",
|
|
203
|
+
variant: "onSurfaceBackground",
|
|
204
|
+
css: (0, _helpers.getOnSurfaceVariant)("brand")
|
|
205
|
+
}, {
|
|
206
|
+
color: "accent",
|
|
207
|
+
variant: "onSurfaceBackground",
|
|
208
|
+
css: (0, _helpers.getOnSurfaceVariant)("accent")
|
|
209
|
+
},
|
|
210
|
+
/**
|
|
211
|
+
* Ghost Variants
|
|
212
|
+
*/
|
|
213
|
+
{
|
|
214
|
+
color: "neutral",
|
|
215
|
+
variant: "ghost",
|
|
216
|
+
css: (0, _helpers.getGhostVariant)("neutralA")
|
|
217
|
+
}, {
|
|
218
|
+
color: "primary",
|
|
219
|
+
variant: "ghost",
|
|
220
|
+
css: (0, _helpers.getGhostVariant)("primary")
|
|
221
|
+
}, {
|
|
222
|
+
color: "success",
|
|
223
|
+
variant: "ghost",
|
|
224
|
+
css: (0, _helpers.getGhostVariant)("success")
|
|
225
|
+
}, {
|
|
226
|
+
color: "warning",
|
|
227
|
+
variant: "ghost",
|
|
228
|
+
css: (0, _helpers.getGhostVariant)("warning")
|
|
229
|
+
}, {
|
|
230
|
+
color: "critical",
|
|
231
|
+
variant: "ghost",
|
|
232
|
+
css: (0, _helpers.getGhostVariant)("critical")
|
|
233
|
+
}, {
|
|
234
|
+
color: "info",
|
|
235
|
+
variant: "ghost",
|
|
236
|
+
css: (0, _helpers.getGhostVariant)("info")
|
|
237
|
+
}, {
|
|
238
|
+
color: "brand",
|
|
239
|
+
variant: "ghost",
|
|
240
|
+
css: (0, _helpers.getGhostVariant)("brand")
|
|
241
|
+
}, {
|
|
242
|
+
color: "accent",
|
|
243
|
+
variant: "ghost",
|
|
244
|
+
css: (0, _helpers.getGhostVariant)("accent")
|
|
245
|
+
},
|
|
246
|
+
/**
|
|
247
|
+
* Link Variants
|
|
248
|
+
*/
|
|
249
|
+
{
|
|
250
|
+
color: "neutral",
|
|
251
|
+
variant: "link",
|
|
252
|
+
css: (0, _helpers.getLinkVariant)("neutralA")
|
|
253
|
+
}, {
|
|
254
|
+
color: "primary",
|
|
255
|
+
variant: "link",
|
|
256
|
+
css: (0, _helpers.getLinkVariant)("primary")
|
|
257
|
+
}, {
|
|
258
|
+
color: "success",
|
|
259
|
+
variant: "link",
|
|
260
|
+
css: (0, _helpers.getLinkVariant)("success")
|
|
261
|
+
}, {
|
|
262
|
+
color: "warning",
|
|
263
|
+
variant: "link",
|
|
264
|
+
css: (0, _helpers.getLinkVariant)("warning")
|
|
265
|
+
}, {
|
|
266
|
+
color: "critical",
|
|
267
|
+
variant: "link",
|
|
268
|
+
css: (0, _helpers.getLinkVariant)("critical")
|
|
269
|
+
}, {
|
|
270
|
+
color: "info",
|
|
271
|
+
variant: "link",
|
|
272
|
+
css: (0, _helpers.getLinkVariant)("info")
|
|
273
|
+
}, {
|
|
274
|
+
color: "brand",
|
|
275
|
+
variant: "link",
|
|
276
|
+
css: (0, _helpers.getLinkVariant)("brand")
|
|
277
|
+
}, {
|
|
278
|
+
color: "accent",
|
|
279
|
+
variant: "link",
|
|
280
|
+
css: (0, _helpers.getLinkVariant)("accent")
|
|
281
|
+
},
|
|
282
|
+
/**
|
|
283
|
+
* Solid Variants
|
|
284
|
+
*/
|
|
285
|
+
{
|
|
286
|
+
color: "neutral",
|
|
287
|
+
variant: "onSolidBackground",
|
|
288
|
+
css: (0, _helpers.getOnSolidBackgroundVariant)("neutral")
|
|
289
|
+
}, {
|
|
290
|
+
color: "primary",
|
|
291
|
+
variant: "onSolidBackground",
|
|
292
|
+
css: (0, _helpers.getOnSolidBackgroundVariant)("primary")
|
|
293
|
+
}, {
|
|
294
|
+
color: "success",
|
|
295
|
+
variant: "onSolidBackground",
|
|
296
|
+
css: (0, _helpers.getOnSolidBackgroundVariant)("success")
|
|
297
|
+
}, {
|
|
298
|
+
color: "warning",
|
|
299
|
+
variant: "onSolidBackground",
|
|
300
|
+
css: (0, _helpers.getOnSolidBackgroundVariant)("warning")
|
|
301
|
+
}, {
|
|
302
|
+
color: "critical",
|
|
303
|
+
variant: "onSolidBackground",
|
|
304
|
+
css: (0, _helpers.getOnSolidBackgroundVariant)("critical")
|
|
305
|
+
}, {
|
|
306
|
+
color: "info",
|
|
307
|
+
variant: "onSolidBackground",
|
|
308
|
+
css: (0, _helpers.getOnSolidBackgroundVariant)("info")
|
|
309
|
+
}, {
|
|
310
|
+
color: "brand",
|
|
311
|
+
variant: "onSolidBackground",
|
|
312
|
+
css: (0, _helpers.getOnSolidBackgroundVariant)("brand")
|
|
313
|
+
}, {
|
|
314
|
+
color: "accent",
|
|
315
|
+
variant: "onSolidBackground",
|
|
316
|
+
css: (0, _helpers.getOnSolidBackgroundVariant)("accent")
|
|
317
|
+
}]
|
|
33
318
|
});
|
|
@@ -6,6 +6,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports["default"] = void 0;
|
|
7
7
|
var _system = require("@vitality-ds/system");
|
|
8
8
|
var _default = exports["default"] = (0, _system.css)({
|
|
9
|
-
display: "flex",
|
|
10
|
-
userSelect: "none"
|
|
9
|
+
display: "inline-flex",
|
|
10
|
+
userSelect: "none",
|
|
11
|
+
gap: "$xs",
|
|
12
|
+
justifyContent: "center"
|
|
11
13
|
});
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.getUiElementVariant = exports.getSolidVariant = exports.getOnUiElementBackgroundVariant = exports.getOnSurfaceVariant = exports.getOnSolidBackgroundVariant = exports.getLinkVariant = exports.getGhostVariant = void 0;
|
|
7
|
+
var _system = require("@vitality-ds/system");
|
|
8
|
+
var _tokens = require("@vitality-ds/tokens");
|
|
9
|
+
var text = _tokens.colorUseCases.text,
|
|
10
|
+
backgrounds = _tokens.colorUseCases.backgrounds;
|
|
11
|
+
var getUiElementVariant = exports.getUiElementVariant = function getUiElementVariant(colorScale) {
|
|
12
|
+
return {
|
|
13
|
+
color: (0, _system.getColorScaleValueByUseCase)(colorScale, text.lowContrast),
|
|
14
|
+
backgroundColor: (0, _system.getColorScaleValueByUseCase)(colorScale, backgrounds.uiElement)
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
var getSolidVariant = exports.getSolidVariant = function getSolidVariant(colorScale) {
|
|
18
|
+
return {
|
|
19
|
+
color: (0, _system.getColorScaleValueByUseCase)(colorScale, text.hiContrastOnSolidBackgrounds),
|
|
20
|
+
backgroundColor: (0, _system.getColorScaleValueByUseCase)(colorScale, backgrounds.uiElementSolid)
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
var getOnSolidBackgroundVariant = exports.getOnSolidBackgroundVariant = function getOnSolidBackgroundVariant(colorScale) {
|
|
24
|
+
return {
|
|
25
|
+
color: (0, _system.getColorScaleValueByUseCase)(colorScale, text.hiContrastOnSolidBackgrounds),
|
|
26
|
+
backgroundColor: (0, _system.getColorScaleValueByUseCase)(colorScale, backgrounds.blanket),
|
|
27
|
+
// Black alpha uses to maintain consistent indentation style
|
|
28
|
+
boxShadow: "0 0 2px 1px hsla(0, 100%, 0%, 0.4) inset"
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
var getOnUiElementBackgroundVariant = exports.getOnUiElementBackgroundVariant = function getOnUiElementBackgroundVariant(colorScale) {
|
|
32
|
+
return {
|
|
33
|
+
color: (0, _system.getColorScaleValueByUseCase)(colorScale, text.lowContrast),
|
|
34
|
+
backgroundColor: (0, _system.getColorScaleValueByUseCase)(colorScale, backgrounds.uiElement_active)
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
var getOnSurfaceVariant = exports.getOnSurfaceVariant = function getOnSurfaceVariant(colorScale) {
|
|
38
|
+
return {
|
|
39
|
+
color: (0, _system.getColorScaleValueByUseCase)(colorScale, text.hiSaturation),
|
|
40
|
+
backgroundColor: (0, _system.getColorScaleValueByUseCase)(colorScale, backgrounds.uiElementOnSurface)
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
var getGhostVariant = exports.getGhostVariant = function getGhostVariant(colorScale) {
|
|
44
|
+
return {
|
|
45
|
+
backgroundColor: "transparent",
|
|
46
|
+
color: (0, _system.getColorScaleValueByUseCase)(colorScale, text.lowContrast)
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
var getLinkVariant = exports.getLinkVariant = function getLinkVariant(colorScale) {
|
|
50
|
+
return {
|
|
51
|
+
backgroundColor: "transparent",
|
|
52
|
+
color: (0, _system.getColorScaleValueByUseCase)(colorScale, text.hiSaturation)
|
|
53
|
+
};
|
|
54
|
+
};
|
|
@@ -8,13 +8,13 @@ export declare const getAppearance: (appearance: keyof Appearances) => {
|
|
|
8
8
|
} & {
|
|
9
9
|
[x: string]: "neutral" | "primary" | "accent" | "success" | "info" | "warning" | "critical" | "brand";
|
|
10
10
|
});
|
|
11
|
-
variant: "link" | "subtle" | "solid" | "
|
|
12
|
-
"@bp1"?: "link" | "subtle" | "solid" | "
|
|
13
|
-
"@bp2"?: "link" | "subtle" | "solid" | "
|
|
14
|
-
"@bp3"?: "link" | "subtle" | "solid" | "
|
|
15
|
-
"@initial"?: "link" | "subtle" | "solid" | "
|
|
11
|
+
variant: "link" | "subtle" | "solid" | "ghost" | "onSurface" | ({
|
|
12
|
+
"@bp1"?: "link" | "subtle" | "solid" | "ghost" | "onSurface";
|
|
13
|
+
"@bp2"?: "link" | "subtle" | "solid" | "ghost" | "onSurface";
|
|
14
|
+
"@bp3"?: "link" | "subtle" | "solid" | "ghost" | "onSurface";
|
|
15
|
+
"@initial"?: "link" | "subtle" | "solid" | "ghost" | "onSurface";
|
|
16
16
|
} & {
|
|
17
|
-
[x: string]: "link" | "subtle" | "solid" | "
|
|
17
|
+
[x: string]: "link" | "subtle" | "solid" | "ghost" | "onSurface";
|
|
18
18
|
});
|
|
19
19
|
spinnerColor: "neutral" | "primary" | "accent" | "success" | "info" | "warning" | "critical" | "brand" | ({
|
|
20
20
|
"@bp1"?: "neutral" | "primary" | "accent" | "success" | "info" | "warning" | "critical" | "brand";
|
|
@@ -24,4 +24,12 @@ export declare const getAppearance: (appearance: keyof Appearances) => {
|
|
|
24
24
|
} & {
|
|
25
25
|
[x: string]: "neutral" | "primary" | "accent" | "success" | "info" | "warning" | "critical" | "brand";
|
|
26
26
|
});
|
|
27
|
+
shortcutsVariant: "link" | "uiElement" | "uiElementSolid" | "onSolidBackground" | "onUiElementBackground" | "onSurfaceBackground" | "ghost" | ({
|
|
28
|
+
"@bp1"?: "link" | "uiElement" | "uiElementSolid" | "onSolidBackground" | "onUiElementBackground" | "onSurfaceBackground" | "ghost";
|
|
29
|
+
"@bp2"?: "link" | "uiElement" | "uiElementSolid" | "onSolidBackground" | "onUiElementBackground" | "onSurfaceBackground" | "ghost";
|
|
30
|
+
"@bp3"?: "link" | "uiElement" | "uiElementSolid" | "onSolidBackground" | "onUiElementBackground" | "onSurfaceBackground" | "ghost";
|
|
31
|
+
"@initial"?: "link" | "uiElement" | "uiElementSolid" | "onSolidBackground" | "onUiElementBackground" | "onSurfaceBackground" | "ghost";
|
|
32
|
+
} & {
|
|
33
|
+
[x: string]: "link" | "uiElement" | "uiElementSolid" | "onSolidBackground" | "onUiElementBackground" | "onSurfaceBackground" | "ghost";
|
|
34
|
+
});
|
|
27
35
|
};
|
|
@@ -55,6 +55,11 @@ export declare const BaseButton: import("@stitches/react/types/styled-component"
|
|
|
55
55
|
pointerEvents: string;
|
|
56
56
|
};
|
|
57
57
|
};
|
|
58
|
+
hasShortcut: {
|
|
59
|
+
true: {
|
|
60
|
+
paddingInlineEnd: string;
|
|
61
|
+
};
|
|
62
|
+
};
|
|
58
63
|
};
|
|
59
64
|
compoundVariants: {
|
|
60
65
|
color: string;
|
|
@@ -853,6 +858,9 @@ export declare const BaseButton: import("@stitches/react/types/styled-component"
|
|
|
853
858
|
export declare const BaseContentContainer: import("@stitches/react/types/styled-component").StyledComponent<"span", import("@stitches/react/types/styled-component").StyledComponentProps<[import("@stitches/react/types/styled-component").CssComponent<never, import("@stitches/react/types/styled-component").StyledComponentProps<[{
|
|
854
859
|
transition: string;
|
|
855
860
|
opacity: number;
|
|
861
|
+
display: string;
|
|
862
|
+
gap: string;
|
|
863
|
+
alignItems: string;
|
|
856
864
|
variants: {
|
|
857
865
|
isLoading: {
|
|
858
866
|
true: {
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
declare const _default: import("@stitches/react/types/styled-component").CssComponent<never, import("@stitches/react/types/styled-component").StyledComponentProps<[{
|
|
2
2
|
transition: string;
|
|
3
3
|
opacity: number;
|
|
4
|
+
display: string;
|
|
5
|
+
gap: string;
|
|
6
|
+
alignItems: string;
|
|
4
7
|
variants: {
|
|
5
8
|
isLoading: {
|
|
6
9
|
true: {
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { ComponentProps, ExcludedProps, VariantProps } from "@vitality-ds/system";
|
|
3
|
+
import { BaseShortcut } from "../../Shortcuts/styled";
|
|
4
|
+
import { ShortcutsProps } from "../../Shortcuts/types";
|
|
3
5
|
import { BaseSpinnerCircle } from "../../Spinner/styled";
|
|
4
6
|
import { BaseButton } from "./styled";
|
|
7
|
+
declare type ShortcutVariantOptions = VariantProps<typeof BaseShortcut>["variant"];
|
|
5
8
|
export declare type ButtonPrimitiveProps = ExcludedProps & ComponentProps<typeof BaseButton> & {
|
|
6
9
|
/**
|
|
7
10
|
* Text contents of the component.
|
|
@@ -26,4 +29,7 @@ export declare type ButtonPrimitiveProps = ExcludedProps & ComponentProps<typeof
|
|
|
26
29
|
* different visual styles.
|
|
27
30
|
*/
|
|
28
31
|
spinnerColor?: VariantProps<typeof BaseSpinnerCircle>["color"];
|
|
32
|
+
shortcut?: ShortcutsProps["keys"];
|
|
33
|
+
shortcutsVariant?: ShortcutVariantOptions;
|
|
29
34
|
};
|
|
35
|
+
export {};
|