@muraldevkit/ui-toolkit 1.8.1 → 1.9.1
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/divider/MrlDivider.d.ts +44 -0
- package/dist/components/divider/constants.d.ts +18 -0
- package/dist/index.js +1 -1
- package/dist/styles/divider/mixins.scss +73 -0
- package/dist/styles/divider/module.scss +35 -0
- package/dist/styles/divider/variables.scss +30 -0
- package/dist/utils/setAttributes/setAttributes.d.ts +0 -1
- package/package.json +1 -1
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
////
|
|
2
|
+
/// Divider component mixins
|
|
3
|
+
/// @group divider
|
|
4
|
+
////
|
|
5
|
+
|
|
6
|
+
/// Used to apply a separation between two elements without adding an additional element to the DOM. This is
|
|
7
|
+
/// typically used for things like menus where we don't want to add the DOM elements for accessibility considerations
|
|
8
|
+
/// for screen reader users.
|
|
9
|
+
/// @group mixins
|
|
10
|
+
/// @param {String} $orientation - Defines the orientation of the divider. Available options are: "horizontal" (default)
|
|
11
|
+
/// @param {String} $max-width - Use when the divider should not span the full-width of the container, for example
|
|
12
|
+
/// dividers between stacked Icon Buttons in a toolbar. Set to any valid CSS width value.
|
|
13
|
+
///
|
|
14
|
+
/// @example @include mrl-divider; // Generates the default horizontal divider that spans the full width of the container
|
|
15
|
+
/// @example @include mrl-divider($max-width: 2rem); // Generates a separation that is only 2rems wide and centers it between
|
|
16
|
+
/// the overall container's width
|
|
17
|
+
/// @todo - since this is no longer used in the component implementation, we need to use this in another component (e.g. menu)
|
|
18
|
+
/// or set up Storybook so we can test Sass mixins to ensure this is not breaking
|
|
19
|
+
@mixin mrl-divider($orientation: 'horizontal', $max-width: '') {
|
|
20
|
+
// Note: if you change this CSS before the @todo comment is addressed, you'll need to run the changes in the product to
|
|
21
|
+
// verify nothing breaks
|
|
22
|
+
position: relative;
|
|
23
|
+
|
|
24
|
+
// We use pseudo elements so we can apply this to non-divider elements
|
|
25
|
+
// for better accessibility support
|
|
26
|
+
|
|
27
|
+
// The :before element is used to ensure the proper spacing as margin-top
|
|
28
|
+
// will push content down but margin-bottom does not reflow the content
|
|
29
|
+
|
|
30
|
+
// The :after element is the actual visual divider we display to the user
|
|
31
|
+
// The element that these pseudo elements are applied to is position relative
|
|
32
|
+
|
|
33
|
+
@if $orientation == 'horizontal' {
|
|
34
|
+
&::before {
|
|
35
|
+
content: '';
|
|
36
|
+
display: block;
|
|
37
|
+
height: 0;
|
|
38
|
+
margin-top: calc(var(--mrl-divider-spacing) * 2);
|
|
39
|
+
width: 100%;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
&::after {
|
|
43
|
+
background-color: var(--mrl-divider-color);
|
|
44
|
+
content: '';
|
|
45
|
+
display: block;
|
|
46
|
+
height: var(--mrl-divider-size);
|
|
47
|
+
position: absolute;
|
|
48
|
+
top: calc(var(--mrl-divider-spacing) * -1);
|
|
49
|
+
width: 100%;
|
|
50
|
+
|
|
51
|
+
/* stylelint-disable-next-line max-nesting-depth */
|
|
52
|
+
@if $max-width != '' {
|
|
53
|
+
@include mrl-divider-center;
|
|
54
|
+
|
|
55
|
+
max-width: $max-width;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
} @else {
|
|
59
|
+
// @todo - the pseudo elements can't push content to the right
|
|
60
|
+
// in order to get the correct spacing
|
|
61
|
+
@warn 'Vertical dividers are not supported as pseudo elements';
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/// Used to create DRY code for shared styles between the actual divider component and mixin.
|
|
66
|
+
/// This mixin is not intended for external adoption.
|
|
67
|
+
/// @group mixins
|
|
68
|
+
///
|
|
69
|
+
/// @example @include mrl-divider-center; // Adds shared code to your implementation
|
|
70
|
+
@mixin mrl-divider-center() {
|
|
71
|
+
left: 50%;
|
|
72
|
+
transform: translateX(-50%);
|
|
73
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
////
|
|
2
|
+
/// Divider component styles
|
|
3
|
+
/// @group divider
|
|
4
|
+
////
|
|
5
|
+
|
|
6
|
+
@use './styles.variables.scss';
|
|
7
|
+
|
|
8
|
+
// Horizontal divider
|
|
9
|
+
.MrlDivider--horizontal {
|
|
10
|
+
background-color: var(--mrl-divider-color);
|
|
11
|
+
display: block;
|
|
12
|
+
height: var(--mrl-divider-size);
|
|
13
|
+
margin: var(--mrl-divider-spacing) 0;
|
|
14
|
+
width: 100%;
|
|
15
|
+
|
|
16
|
+
.MrlDivider--center {
|
|
17
|
+
margin: var(--mrl-divider-spacing) auto;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
// Vertical divider
|
|
22
|
+
.MrlDivider--vertical {
|
|
23
|
+
// A display: flex parent will give the most consistent and expected results
|
|
24
|
+
// but we add display: inline-block just in case so the user can at least see
|
|
25
|
+
// the divider and then tweak positioning as needed.
|
|
26
|
+
align-self: stretch;
|
|
27
|
+
background-color: var(--mrl-divider-color);
|
|
28
|
+
display: inline-block;
|
|
29
|
+
margin: 0 var(--mrl-divider-spacing);
|
|
30
|
+
width: var(--mrl-divider-size);
|
|
31
|
+
|
|
32
|
+
.MrlDivider--center {
|
|
33
|
+
align-self: center;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
////
|
|
2
|
+
/// Divider component variables
|
|
3
|
+
/// @group divider
|
|
4
|
+
////
|
|
5
|
+
|
|
6
|
+
// Need to define on both the host and root to support traditional DOM and Shadow DOM
|
|
7
|
+
.MrlDivider {
|
|
8
|
+
--mrl-divider-size: var(--mrl-spacing-01);
|
|
9
|
+
--mrl-divider-spacing: var(--mrl-space-stack-section-divider);
|
|
10
|
+
--mrl-divider-color: var(--mrl-color-line-divider);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
// Spacing variants (only applies to horizontal dividers)
|
|
14
|
+
.MrlDivider--small {
|
|
15
|
+
--mrl-divider-spacing: var(--mrl-space-stack-section-divider-small);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.MrlDivider--large {
|
|
19
|
+
--mrl-divider-spacing: var(--mrl-space-stack-section-divider-large);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
// Kind variants
|
|
23
|
+
.MrlDivider--inverse {
|
|
24
|
+
--mrl-divider-color: var(--mrl-color-line-divider-inverse);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// Orientation variants
|
|
28
|
+
.MrlDivider--vertical {
|
|
29
|
+
--mrl-divider-spacing: var(--mrl-spacing-02);
|
|
30
|
+
}
|
|
@@ -21,7 +21,6 @@ export declare const setClasses: (customClasses: AttrsObject | string | undefine
|
|
|
21
21
|
* @param {AttrsObject | string} 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
|
-
* @param {boolean} forReact - Whether or not the attributes are being set for a React component.
|
|
25
24
|
*
|
|
26
25
|
* Use when applying attributes such as a className directly to a react component.
|
|
27
26
|
* @returns {AttrsObject} - An object of component attributes
|