@ssa-ui-kit/core 3.8.0 → 3.9.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/components/Icon/icons/AttentionCircle.d.ts +3 -0
- package/dist/components/Icon/icons/all.d.ts +1 -0
- package/dist/components/Icon/icons/iconsList.d.ts +1 -1
- package/dist/components/NotificationComponents/Alert/Alert.d.ts +58 -0
- package/dist/components/NotificationComponents/Alert/AlertItem.d.ts +48 -0
- package/dist/components/NotificationComponents/Alert/alertObserver.d.ts +18 -0
- package/dist/components/NotificationComponents/Alert/index.d.ts +4 -0
- package/dist/components/NotificationComponents/Alert/styles.d.ts +18 -0
- package/dist/components/NotificationComponents/Alert/types.d.ts +80 -0
- package/dist/components/NotificationComponents/Notification/Notification.d.ts +4 -0
- package/dist/components/NotificationComponents/Notification/NotificationItem.d.ts +60 -0
- package/dist/components/NotificationComponents/Notification/index.d.ts +4 -0
- package/dist/components/NotificationComponents/Notification/notificationObserver.d.ts +23 -0
- package/dist/components/NotificationComponents/Notification/styles.d.ts +18 -0
- package/dist/components/NotificationComponents/Notification/types.d.ts +119 -0
- package/dist/components/NotificationComponents/Toast/Toast.d.ts +4 -0
- package/dist/components/NotificationComponents/Toast/ToastItem.d.ts +53 -0
- package/dist/components/NotificationComponents/Toast/index.d.ts +4 -0
- package/dist/components/NotificationComponents/Toast/styles.d.ts +26 -0
- package/dist/components/NotificationComponents/Toast/toastObserver.d.ts +30 -0
- package/dist/components/NotificationComponents/Toast/types.d.ts +102 -0
- package/dist/components/NotificationComponents/hooks/useAutoDismiss.d.ts +32 -0
- package/dist/components/NotificationComponents/index.d.ts +8 -0
- package/dist/components/NotificationComponents/styles.d.ts +22 -0
- package/dist/components/NotificationComponents/types.d.ts +38 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/index.js +1772 -0
- package/dist/index.js.map +1 -1
- package/dist/types/emotion.d.ts +4 -0
- package/dist/utils/colorUtils.d.ts +45 -0
- package/dist/utils/createObserver.d.ts +21 -0
- package/package.json +3 -3
package/dist/types/emotion.d.ts
CHANGED
|
@@ -12,6 +12,7 @@ type Colors = MakeColors<[
|
|
|
12
12
|
'white30',
|
|
13
13
|
'dark',
|
|
14
14
|
'greyLighter',
|
|
15
|
+
'greenLighterRGB',
|
|
15
16
|
'greyLighter20',
|
|
16
17
|
'greyLighter40',
|
|
17
18
|
'greyLighter60',
|
|
@@ -52,6 +53,7 @@ type Colors = MakeColors<[
|
|
|
52
53
|
'redLighter40',
|
|
53
54
|
'red',
|
|
54
55
|
'red6',
|
|
56
|
+
'red6RGB',
|
|
55
57
|
'redDark',
|
|
56
58
|
'red40',
|
|
57
59
|
'greenLighter',
|
|
@@ -78,6 +80,7 @@ type Colors = MakeColors<[
|
|
|
78
80
|
'yellow20',
|
|
79
81
|
'yellowLighter',
|
|
80
82
|
'yellowLighter20',
|
|
83
|
+
'yellowLighter20RGB',
|
|
81
84
|
'yellowLighter40',
|
|
82
85
|
'yellowWarm',
|
|
83
86
|
'yellowWarm20',
|
|
@@ -97,6 +100,7 @@ type Colors = MakeColors<[
|
|
|
97
100
|
'purpleDark40',
|
|
98
101
|
'blue',
|
|
99
102
|
'blue6',
|
|
103
|
+
'blue6RGB',
|
|
100
104
|
'blue20',
|
|
101
105
|
'blueCool',
|
|
102
106
|
'blueDark',
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Color utilities shared by notification components (`Alert`, `Toast`, …).
|
|
3
|
+
*
|
|
4
|
+
* Used by any component that accepts a `color` prop and needs to auto-derive
|
|
5
|
+
* readable text/icon colors, darkened border/accent shades, or luminance checks.
|
|
6
|
+
*
|
|
7
|
+
* Theme colors are `rgba(r, g, b, a)` strings. Arbitrary CSS colors passed by
|
|
8
|
+
* consumers may be hex (`#rrggbb`) or any valid CSS color. Functions here handle
|
|
9
|
+
* both formats and fall back gracefully (returning the original string) for
|
|
10
|
+
* formats they cannot parse.
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* Returns `true` when the color is perceptually dark enough to need light
|
|
14
|
+
* text/icons on top of it.
|
|
15
|
+
*
|
|
16
|
+
* Uses the WCAG luminance threshold (L < 0.179 ≈ midpoint between black and
|
|
17
|
+
* "mid-grey" at contrast ratio ~3:1 against white).
|
|
18
|
+
*/
|
|
19
|
+
export declare function isColorDark(color: string): boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Returns a darkened version of the color by **reducing HSL lightness** by
|
|
22
|
+
* `amount` (default 0.35 → 35 percentage points darker).
|
|
23
|
+
*
|
|
24
|
+
* Converting through HSL preserves the hue and saturation so light pastel
|
|
25
|
+
* colors (e.g. `greenLighter`) darken to a recognizable mid-shade of the same
|
|
26
|
+
* hue rather than washing out to grey (which a naïve per-channel multiply does).
|
|
27
|
+
*
|
|
28
|
+
* Falls back to the original string when the color format is not parsable
|
|
29
|
+
* (e.g. CSS named colors, `hsl()`, `color-mix()`).
|
|
30
|
+
*/
|
|
31
|
+
export declare function darkenColor(color: string, amount?: number): string;
|
|
32
|
+
/**
|
|
33
|
+
* Returns either `'rgba(255, 255, 255, 1)'` (white) or `'rgba(43, 45, 49, 1)'`
|
|
34
|
+
* (greyDarker) depending on whether the background color is perceived as dark
|
|
35
|
+
* or light.
|
|
36
|
+
*
|
|
37
|
+
* Intended for computing readable text/icon colors on a custom background.
|
|
38
|
+
*
|
|
39
|
+
* @param bgColor - The background color to contrast against.
|
|
40
|
+
* @param darkText - The dark text color to use on light backgrounds.
|
|
41
|
+
* Defaults to `rgba(43, 45, 49, 1)` (theme `greyDarker`).
|
|
42
|
+
* @param lightText - The light text color to use on dark backgrounds.
|
|
43
|
+
* Defaults to `rgba(255, 255, 255, 1)` (white).
|
|
44
|
+
*/
|
|
45
|
+
export declare function getContrastColor(bgColor: string, darkText?: string, lightText?: string): string;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Creates a lightweight pub/sub observer.
|
|
3
|
+
*
|
|
4
|
+
* Subscribers are stored in a Map keyed by a caller-provided string identifier,
|
|
5
|
+
* so a single mount point can subscribe once and cleanly unsubscribe by key
|
|
6
|
+
* without affecting other subscribers.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```ts
|
|
10
|
+
* const myObserver = createObserver<{ message: string }>();
|
|
11
|
+
*
|
|
12
|
+
* myObserver.subscribe('my-component', (data) => console.log(data.message));
|
|
13
|
+
* myObserver.dispatch({ message: 'Hello' });
|
|
14
|
+
* myObserver.unsubscribe('my-component');
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
export declare function createObserver<T>(): {
|
|
18
|
+
subscribe: (key: string, fn: (data: T) => void) => void;
|
|
19
|
+
unsubscribe: (key: string) => void;
|
|
20
|
+
dispatch: (data: T) => void;
|
|
21
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ssa-ui-kit/core",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.9.0",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"exports": {
|
|
@@ -39,8 +39,8 @@
|
|
|
39
39
|
"luxon": "3.5.0",
|
|
40
40
|
"plotly.js": "3.0.0",
|
|
41
41
|
"react-plotly.js": "2.6.0",
|
|
42
|
-
"@ssa-ui-kit/hooks": "^3.
|
|
43
|
-
"@ssa-ui-kit/utils": "^3.
|
|
42
|
+
"@ssa-ui-kit/hooks": "^3.9.0",
|
|
43
|
+
"@ssa-ui-kit/utils": "^3.9.0"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"@emotion/css": "11.13.5",
|