@muraldevkit/ui-toolkit 1.13.3 → 1.15.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.
@@ -0,0 +1,24 @@
1
+ ////
2
+ /// Block Notification component styles
3
+ /// @group block-notification
4
+ ////
5
+
6
+ @use '~@muraldevkit/ds-foundation/src/styles/_mixins' as *;
7
+ @use '~@muraldevkit/ds-foundation/src/styles/contextual-variables/z-index' as *;
8
+ @use './styles.mixins.scss' as *;
9
+
10
+ // Transition states were not working as expected when migrated to
11
+ // modules, so we are using global styles for now.
12
+ .mrl-blockNotification.mrl-is--transitioning {
13
+ @include mrl-block-notification-fade-out;
14
+ }
15
+
16
+ @media (prefers-reduced-motion: no-preference) {
17
+ .mrl-blockNotification.mrl-is--transitioning {
18
+ @include mrl-block-notification-slide-out;
19
+ }
20
+ }
21
+
22
+ .mrl-blockNotification .mrl-is--closed {
23
+ display: none;
24
+ }
@@ -0,0 +1,48 @@
1
+ ////
2
+ /// Block notification component mixins
3
+ /// @group block-notification
4
+ ////
5
+
6
+ /// CSS transition setup for block notification animations.
7
+ /// There are no configurations for this mixin
8
+ ///
9
+ /// @example @include mrl-block-notification-animate-in;
10
+ @mixin mrl-block-notification-animate-in() {
11
+ margin-top: 0;
12
+ opacity: 1;
13
+ transition-duration: var(--mrl-duration-03);
14
+ transition-property: margin opacity;
15
+ transition-timing-function: var(--mrl-timing-m1);
16
+ }
17
+
18
+ /// CSS to fade the block notification out.
19
+ /// There are no configurations for this mixin
20
+ ///
21
+ /// @example @include mrl-block-notification-fade-out;
22
+ @mixin mrl-block-notification-fade-in() {
23
+ opacity: 0;
24
+ }
25
+
26
+ /// CSS to slide block notification out
27
+ /// There are no configurations for this mixin
28
+ ///
29
+ /// @example @include mrl-block-notification-slide-out;
30
+ @mixin mrl-block-notification-slide-in() {
31
+ margin-top: calc(var(--mrl-blockNotification-height));
32
+ }
33
+
34
+ /// CSS to fade the block notification out.
35
+ /// There are no configurations for this mixin
36
+ ///
37
+ /// @example @include mrl-block-notification-fade-out;
38
+ @mixin mrl-block-notification-fade-out() {
39
+ opacity: 0;
40
+ }
41
+
42
+ /// CSS to slide block notification out
43
+ /// There are no configurations for this mixin
44
+ ///
45
+ /// @example @include mrl-block-notification-slide-out;
46
+ @mixin mrl-block-notification-slide-out() {
47
+ margin-top: calc(var(--mrl-blockNotification-height) * -1);
48
+ }
@@ -0,0 +1,78 @@
1
+ ////
2
+ /// Block Notification component styles
3
+ /// @group block-notification
4
+ ////
5
+
6
+ @use '~@muraldevkit/ds-foundation/src/styles/_mixins' as *;
7
+ @use '~@muraldevkit/ds-foundation/src/styles/contextual-variables/z-index' as *;
8
+ @use '~@muraldevkit/ds-foundation/src/styles/skeletons/button' as *;
9
+ @use './styles.variables.scss';
10
+ @use './styles.mixins.scss' as *;
11
+
12
+ $mrl-notification-close-inset: var(--mrl-spacing-02);
13
+
14
+ .mrl-blockNotification {
15
+ @include mrl-block-notification-animate-in;
16
+
17
+ align-items: center;
18
+ background: var(--mrl-blockNotification-background);
19
+ border-radius: var(--mrl-blockNotification-radius);
20
+ color: var(--mrl-blockNotification-color);
21
+ display: flex;
22
+ flex-direction: row;
23
+ gap: var(--mrl-blockNotification-inline-spacing);
24
+ justify-content: center;
25
+ min-height: var(--mrl-blockNotification-height);
26
+ padding: var(--mrl-blockNotification-inset-spacing);
27
+ position: relative;
28
+ width: 100%;
29
+
30
+ svg {
31
+ color: var(--mrl-blockNotification-color);
32
+ }
33
+ }
34
+
35
+ .mrl-blockNotification--dismissible {
36
+ padding-right: calc(
37
+ #{$mrl-notification-close-inset} + var(--mrl-blockNotification-inline-spacing) + #{$mrl-button-height--small}
38
+ );
39
+ position: relative;
40
+ }
41
+
42
+ .mrl-blockNotification-close {
43
+ position: absolute;
44
+ right: $mrl-notification-close-inset;
45
+ top: 50%;
46
+ transform: translateY(-50%);
47
+ }
48
+
49
+ .mrl-blockNotification-message {
50
+ align-items: center;
51
+ display: flex;
52
+
53
+ :global(.message) {
54
+ @include mrl-text-static('small');
55
+
56
+ display: inline;
57
+ }
58
+ }
59
+
60
+ .mrl-blockNotification-heading {
61
+ color: var(--mrl-blockNotification-heading-color);
62
+ display: inline;
63
+ margin-right: var(--mrl-blockNotification-inline-spacing-message);
64
+ }
65
+
66
+ /**
67
+ * @todo v2 - we should apply a class to the mrl-svg element instead
68
+ * of targeting the element. However, the class should be `mrl-blockNotification-icon`
69
+ * so we would want to rename the existing class to `mrl-blockNotification-iconWrapper`
70
+ * which is a breaking change. Also we could explore if we need this div at all?
71
+ **/
72
+ .mrl-blockNotification-icon {
73
+ min-width: fit-content;
74
+
75
+ > svg {
76
+ display: flex;
77
+ }
78
+ }
@@ -0,0 +1,37 @@
1
+ ////
2
+ /// Block Notification component styles
3
+ /// @group block-notification
4
+ ////
5
+
6
+ .mrl-blockNotification {
7
+ --mrl-blockNotification-background: var(--mrl-color-background-info);
8
+ --mrl-blockNotification-background-general: rgba(var(--mrl-gray-100), 1);
9
+ --mrl-blockNotification-color: rgba(var(--mrl-gray-10), 1);
10
+ --mrl-blockNotification-heading-color: var(--mrl-color-text-inverse);
11
+ --mrl-blockNotification-height: var(--mrl-spacing-09);
12
+ --mrl-blockNotification-inline-spacing: var(--mrl-spacing-03);
13
+ --mrl-blockNotification-inline-spacing-message: var(--mrl-spacing-02);
14
+ --mrl-blockNotification-inset-spacing: var(--mrl-spacing-03) var(--mrl-spacing-07);
15
+ --mrl-blockNotification-radius: 0;
16
+ --mrl-blockNotification-svg-color: var(--mrl-color-text-inverse);
17
+ }
18
+
19
+ // Kind variants
20
+ .mrl-blockNotification[data-kind='error'] {
21
+ --mrl-blockNotification-background: var(--mrl-color-background-error);
22
+ }
23
+
24
+ .mrl-blockNotification[data-kind='success'] {
25
+ --mrl-blockNotification-background: var(--mrl-color-background-success);
26
+ }
27
+
28
+ .mrl-blockNotification[data-kind='warning'] {
29
+ --mrl-blockNotification-background: var(--mrl-color-background-warning);
30
+ --mrl-blockNotification-color: rgba(var(--mrl-gray-90), 1);
31
+ --mrl-blockNotification-heading-color: rgba(var(--mrl-black), 1);
32
+ }
33
+
34
+ .mrl-blockNotification[data-kind='general'],
35
+ .mrl-blockNotification[data-kind='private'] {
36
+ --mrl-blockNotification-background: var(--mrl-blockNotification-background-general);
37
+ }
@@ -2,3 +2,5 @@ export * from './commonProps';
2
2
  export * from './getCamelCase';
3
3
  export * from './isObject';
4
4
  export * from './setAttributes';
5
+ export * from './noop';
6
+ export * from './trapFocus';
@@ -0,0 +1,7 @@
1
+ /**
2
+ * No operation function to be used as a default callback.
3
+ *
4
+ * Example usage: in tests where there is a required handler, but we do not want to do anything.
5
+ * Better than passing a console log which clutters up our test output.
6
+ */
7
+ export declare const noop: () => void;
@@ -14,18 +14,18 @@ export type ClassObject = Record<string, boolean>;
14
14
  * @param {ClassObject} defaultClasses - design system component classes to apply
15
15
  * @returns {ClassObject} - with all classes
16
16
  */
17
- export declare const setClasses: (customClasses: AttrsObject | string | undefined, defaultClasses: ClassObject) => ClassObject;
17
+ export declare const setClasses: (customClasses: AttrsObject | undefined, defaultClasses: ClassObject) => ClassObject;
18
18
  /**
19
19
  * Set an object of attributes to be used in a given component.
20
20
  *
21
- * @param {AttrsObject | string} attributes - The custom attributes passed to the component
21
+ * @param {AttrsObject} attributes - The custom attributes passed to the component
22
22
  * @param {AttrsObject} [defaults={}] - An optional object of the default attributes of a component
23
23
  * @param {string} className - Default classes to apply to the component
24
24
  *
25
25
  * Use when applying attributes such as a className directly to a react component.
26
26
  * @returns {AttrsObject} - An object of component attributes
27
27
  */
28
- export declare const setAttributes: (attributes: AttrsObject | string | undefined, defaults?: AttrsObject, className?: string) => AttrsObject;
28
+ export declare const setAttributes: (attributes: AttrsObject | undefined, defaults?: AttrsObject, className?: string) => AttrsObject;
29
29
  /**
30
30
  * Generates unique identifier
31
31
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@muraldevkit/ui-toolkit",
3
- "version": "1.13.3",
3
+ "version": "1.15.0",
4
4
  "description": "Mural's UI Toolkit",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",