@momentum-design/components 0.12.6 → 0.13.0
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/components/divider/divider.component.d.ts +128 -0
- package/dist/components/divider/divider.component.js +222 -0
- package/dist/components/divider/divider.constants.d.ts +32 -0
- package/dist/components/divider/divider.constants.js +33 -0
- package/dist/components/divider/divider.styles.d.ts +5 -0
- package/dist/components/divider/divider.styles.js +155 -0
- package/dist/components/divider/divider.types.d.ts +6 -0
- package/dist/components/divider/divider.types.js +1 -0
- package/dist/components/divider/index.d.ts +7 -0
- package/dist/components/divider/index.js +4 -0
- package/dist/custom-elements.json +230 -0
- package/dist/react/divider/index.d.ts +43 -0
- package/dist/react/divider/index.js +52 -0
- package/dist/react/index.d.ts +1 -0
- package/dist/react/index.js +1 -0
- package/package.json +1 -1
@@ -0,0 +1,128 @@
|
|
1
|
+
import { CSSResult, PropertyValueMap } from 'lit';
|
2
|
+
import { Component } from '../../models';
|
3
|
+
import { DividerOrientation, DividerVariant } from './divider.types';
|
4
|
+
/**
|
5
|
+
* `mdc-divider` is a component that provides a line to separate and organize content.
|
6
|
+
* It can also include a button or text positioned centrally, allowing users to interact with the layout.
|
7
|
+
*
|
8
|
+
* **Divider Orientation:**
|
9
|
+
* - **Horizontal**: A thin, horizontal line.
|
10
|
+
* - **Vertical**: A thin, vertical line.
|
11
|
+
*
|
12
|
+
* **Divider Variants:**
|
13
|
+
* - **solid**: Solid line.
|
14
|
+
* - **gradient**: Gradient Line.
|
15
|
+
*
|
16
|
+
* **Divider Types:**
|
17
|
+
* - The type of divider is inferred based on the kind of slot present.
|
18
|
+
* - **Primary**: A simple horizontal or vertical divider.
|
19
|
+
* - **Text**: A horizontal divider with a text label in the center.
|
20
|
+
* - **Grabber Button**: A horizontal or vertical divider with a styled button in the center.
|
21
|
+
*
|
22
|
+
* **Accessibility:**
|
23
|
+
* - When the slot is replaced by an `mdc-button`:
|
24
|
+
* - `aria-label` should be passed to the `mdc-button`.
|
25
|
+
* - `aria-expanded` should be passed to the `mdc-button`.
|
26
|
+
*
|
27
|
+
* **Notes:**
|
28
|
+
* - If the slot is replaced by an invalid tag name or contains multiple elements,
|
29
|
+
* the divider defaults to the **Primary** type.
|
30
|
+
* - To override the styles of the divider, use the provided CSS custom properties.
|
31
|
+
*
|
32
|
+
* @tagname mdc-divider
|
33
|
+
*
|
34
|
+
* @cssproperty --mdc-divider-background-color - background color of the divider
|
35
|
+
* @cssproperty --mdc-divider-width - width of the divider
|
36
|
+
* @cssproperty --mdc-divider-horizontal-gradient - gradient of the horizontal divider
|
37
|
+
* @cssproperty --mdc-divider-vertical-gradient - gradient of the vertical divider
|
38
|
+
* @cssproperty --mdc-divider-text-size - font size of label in the text divider
|
39
|
+
* @cssproperty --mdc-divider-text-color - font color of label in the text divider
|
40
|
+
* @cssproperty --mdc-divider-text-margin - left and right margin of label in the text divider
|
41
|
+
* @cssproperty --mdc-divider-text-line-height - line height of label in the text divider
|
42
|
+
* @cssproperty --mdc-divider-grabber-button-border-radius - border radius of the grabber button
|
43
|
+
*/
|
44
|
+
declare class Divider extends Component {
|
45
|
+
/**
|
46
|
+
* Two orientations of divider
|
47
|
+
* - **horizontal**: A thin, horizontal line with 0.0625rem width.
|
48
|
+
* - **vertical**: A thin, vertical line with 0.0625rem width.
|
49
|
+
*
|
50
|
+
* Note: We do not support "Vertical Text Divider" as of now.
|
51
|
+
* @default horizontal
|
52
|
+
*/
|
53
|
+
orientation: DividerOrientation;
|
54
|
+
/**
|
55
|
+
* Two variants of divider
|
56
|
+
* - **solid**: Solid line.
|
57
|
+
* - **gradient**: Gradient Line that fades on either sides of the divider.
|
58
|
+
* @default solid
|
59
|
+
*/
|
60
|
+
variant: DividerVariant;
|
61
|
+
/**
|
62
|
+
* Direction of the arrow icon, if applicable.
|
63
|
+
* - **positive**
|
64
|
+
* - **negative**
|
65
|
+
*
|
66
|
+
* Note: Positive and Negative directions are defined based on Cartesian plane.
|
67
|
+
* @default 'negative'
|
68
|
+
*/
|
69
|
+
arrowDirection: string;
|
70
|
+
/**
|
71
|
+
* Position of the button, if applicable.
|
72
|
+
* - **positive**
|
73
|
+
* - **negative**
|
74
|
+
*
|
75
|
+
* Note: Positive and Negative directions are defined based on Cartesian plane.
|
76
|
+
* @default 'negative'
|
77
|
+
*/
|
78
|
+
buttonPosition: string;
|
79
|
+
/**
|
80
|
+
* Sets the variant attribute for the divider component.
|
81
|
+
* If the provided variant is not included in the DIVIDER_VARIANT,
|
82
|
+
* it defaults to the value specified in DEFAULTS.VARIANT.
|
83
|
+
*
|
84
|
+
* @param variant - The variant to set.
|
85
|
+
*/
|
86
|
+
private setVariant;
|
87
|
+
/**
|
88
|
+
* Sets the orientation attribute for the divider component.
|
89
|
+
* If the provided orientation is not included in the DIVIDER_ORIENTATION,
|
90
|
+
* it defaults to the value specified in DEFAULTS.ORIENTATION.
|
91
|
+
*
|
92
|
+
* @param orientation - The orientation to set.
|
93
|
+
*/
|
94
|
+
private setOrientation;
|
95
|
+
/**
|
96
|
+
* Sets the buttonPosition and arrowDirection attribute for the divider component.
|
97
|
+
* If the provided buttonPosition and arrowDirection are not included in the DIRECTIONS,
|
98
|
+
* it defaults to the value specified in DIRECTIONS based on the ORIENTATION.
|
99
|
+
*
|
100
|
+
* @param buttonPosition - The buttonPosition to set.
|
101
|
+
* @param arrowDirection - The arrowDirection to set.
|
102
|
+
*/
|
103
|
+
private ensureValidDirections;
|
104
|
+
/**
|
105
|
+
* Configures the grabber button within the divider.
|
106
|
+
*
|
107
|
+
* - Sets the `prefix-icon` attribute for the grabber button based
|
108
|
+
* on the `arrow-direction` and `orientation` properties.
|
109
|
+
*
|
110
|
+
* This method updates the DOM element dynamically if a grabber button is present.
|
111
|
+
*/
|
112
|
+
private setGrabberButton;
|
113
|
+
/**
|
114
|
+
* Determines the arrow icon based on the consumer-defined `arrowDirection`.
|
115
|
+
*
|
116
|
+
* @returns The icon that represents the arrow direction.
|
117
|
+
*/
|
118
|
+
private getArrowIcon;
|
119
|
+
update(changedProperties: PropertyValueMap<any> | Map<PropertyKey, unknown>): void;
|
120
|
+
/**
|
121
|
+
* Infers the type of divider based on the kind of slot present.
|
122
|
+
* @param slot - default slot of divider
|
123
|
+
*/
|
124
|
+
private inferDividerType;
|
125
|
+
protected render(): import("lit-html").TemplateResult<1>;
|
126
|
+
static styles: Array<CSSResult>;
|
127
|
+
}
|
128
|
+
export default Divider;
|
@@ -0,0 +1,222 @@
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
6
|
+
};
|
7
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
9
|
+
};
|
10
|
+
import { html } from 'lit';
|
11
|
+
import { property } from 'lit/decorators.js';
|
12
|
+
import styles from './divider.styles';
|
13
|
+
import { Component } from '../../models';
|
14
|
+
import { ARROW_ICONS, BUTTON_TAG, DEFAULTS, DIRECTIONS, DIVIDER_ORIENTATION, DIVIDER_VARIANT, TEXT_TAG, } from './divider.constants';
|
15
|
+
/**
|
16
|
+
* `mdc-divider` is a component that provides a line to separate and organize content.
|
17
|
+
* It can also include a button or text positioned centrally, allowing users to interact with the layout.
|
18
|
+
*
|
19
|
+
* **Divider Orientation:**
|
20
|
+
* - **Horizontal**: A thin, horizontal line.
|
21
|
+
* - **Vertical**: A thin, vertical line.
|
22
|
+
*
|
23
|
+
* **Divider Variants:**
|
24
|
+
* - **solid**: Solid line.
|
25
|
+
* - **gradient**: Gradient Line.
|
26
|
+
*
|
27
|
+
* **Divider Types:**
|
28
|
+
* - The type of divider is inferred based on the kind of slot present.
|
29
|
+
* - **Primary**: A simple horizontal or vertical divider.
|
30
|
+
* - **Text**: A horizontal divider with a text label in the center.
|
31
|
+
* - **Grabber Button**: A horizontal or vertical divider with a styled button in the center.
|
32
|
+
*
|
33
|
+
* **Accessibility:**
|
34
|
+
* - When the slot is replaced by an `mdc-button`:
|
35
|
+
* - `aria-label` should be passed to the `mdc-button`.
|
36
|
+
* - `aria-expanded` should be passed to the `mdc-button`.
|
37
|
+
*
|
38
|
+
* **Notes:**
|
39
|
+
* - If the slot is replaced by an invalid tag name or contains multiple elements,
|
40
|
+
* the divider defaults to the **Primary** type.
|
41
|
+
* - To override the styles of the divider, use the provided CSS custom properties.
|
42
|
+
*
|
43
|
+
* @tagname mdc-divider
|
44
|
+
*
|
45
|
+
* @cssproperty --mdc-divider-background-color - background color of the divider
|
46
|
+
* @cssproperty --mdc-divider-width - width of the divider
|
47
|
+
* @cssproperty --mdc-divider-horizontal-gradient - gradient of the horizontal divider
|
48
|
+
* @cssproperty --mdc-divider-vertical-gradient - gradient of the vertical divider
|
49
|
+
* @cssproperty --mdc-divider-text-size - font size of label in the text divider
|
50
|
+
* @cssproperty --mdc-divider-text-color - font color of label in the text divider
|
51
|
+
* @cssproperty --mdc-divider-text-margin - left and right margin of label in the text divider
|
52
|
+
* @cssproperty --mdc-divider-text-line-height - line height of label in the text divider
|
53
|
+
* @cssproperty --mdc-divider-grabber-button-border-radius - border radius of the grabber button
|
54
|
+
*/
|
55
|
+
class Divider extends Component {
|
56
|
+
constructor() {
|
57
|
+
super(...arguments);
|
58
|
+
/**
|
59
|
+
* Two orientations of divider
|
60
|
+
* - **horizontal**: A thin, horizontal line with 0.0625rem width.
|
61
|
+
* - **vertical**: A thin, vertical line with 0.0625rem width.
|
62
|
+
*
|
63
|
+
* Note: We do not support "Vertical Text Divider" as of now.
|
64
|
+
* @default horizontal
|
65
|
+
*/
|
66
|
+
this.orientation = DEFAULTS.ORIENTATION;
|
67
|
+
/**
|
68
|
+
* Two variants of divider
|
69
|
+
* - **solid**: Solid line.
|
70
|
+
* - **gradient**: Gradient Line that fades on either sides of the divider.
|
71
|
+
* @default solid
|
72
|
+
*/
|
73
|
+
this.variant = DEFAULTS.VARIANT;
|
74
|
+
/**
|
75
|
+
* Direction of the arrow icon, if applicable.
|
76
|
+
* - **positive**
|
77
|
+
* - **negative**
|
78
|
+
*
|
79
|
+
* Note: Positive and Negative directions are defined based on Cartesian plane.
|
80
|
+
* @default 'negative'
|
81
|
+
*/
|
82
|
+
this.arrowDirection = DEFAULTS.ARROW_DIRECTION;
|
83
|
+
/**
|
84
|
+
* Position of the button, if applicable.
|
85
|
+
* - **positive**
|
86
|
+
* - **negative**
|
87
|
+
*
|
88
|
+
* Note: Positive and Negative directions are defined based on Cartesian plane.
|
89
|
+
* @default 'negative'
|
90
|
+
*/
|
91
|
+
this.buttonPosition = DEFAULTS.BUTTON_DIRECTION;
|
92
|
+
}
|
93
|
+
/**
|
94
|
+
* Sets the variant attribute for the divider component.
|
95
|
+
* If the provided variant is not included in the DIVIDER_VARIANT,
|
96
|
+
* it defaults to the value specified in DEFAULTS.VARIANT.
|
97
|
+
*
|
98
|
+
* @param variant - The variant to set.
|
99
|
+
*/
|
100
|
+
setVariant(variant) {
|
101
|
+
this.setAttribute('variant', Object.values(DIVIDER_VARIANT).includes(variant) ? variant : DEFAULTS.VARIANT);
|
102
|
+
}
|
103
|
+
/**
|
104
|
+
* Sets the orientation attribute for the divider component.
|
105
|
+
* If the provided orientation is not included in the DIVIDER_ORIENTATION,
|
106
|
+
* it defaults to the value specified in DEFAULTS.ORIENTATION.
|
107
|
+
*
|
108
|
+
* @param orientation - The orientation to set.
|
109
|
+
*/
|
110
|
+
setOrientation(orientation) {
|
111
|
+
this.setAttribute('orientation', Object.values(DIVIDER_ORIENTATION).includes(orientation) ? orientation : DEFAULTS.ORIENTATION);
|
112
|
+
}
|
113
|
+
/**
|
114
|
+
* Sets the buttonPosition and arrowDirection attribute for the divider component.
|
115
|
+
* If the provided buttonPosition and arrowDirection are not included in the DIRECTIONS,
|
116
|
+
* it defaults to the value specified in DIRECTIONS based on the ORIENTATION.
|
117
|
+
*
|
118
|
+
* @param buttonPosition - The buttonPosition to set.
|
119
|
+
* @param arrowDirection - The arrowDirection to set.
|
120
|
+
*/
|
121
|
+
ensureValidDirections() {
|
122
|
+
const defaultDirection = this.orientation === DIVIDER_ORIENTATION.HORIZONTAL
|
123
|
+
? DIRECTIONS.NEGATIVE
|
124
|
+
: DIRECTIONS.POSITIVE;
|
125
|
+
if (!Object.values(DIRECTIONS).includes(this.buttonPosition)) {
|
126
|
+
this.buttonPosition = defaultDirection;
|
127
|
+
}
|
128
|
+
if (!Object.values(DIRECTIONS).includes(this.arrowDirection)) {
|
129
|
+
this.arrowDirection = defaultDirection;
|
130
|
+
}
|
131
|
+
}
|
132
|
+
/**
|
133
|
+
* Configures the grabber button within the divider.
|
134
|
+
*
|
135
|
+
* - Sets the `prefix-icon` attribute for the grabber button based
|
136
|
+
* on the `arrow-direction` and `orientation` properties.
|
137
|
+
*
|
138
|
+
* This method updates the DOM element dynamically if a grabber button is present.
|
139
|
+
*/
|
140
|
+
setGrabberButton() {
|
141
|
+
const buttonElement = this.querySelector('mdc-button');
|
142
|
+
if (!buttonElement)
|
143
|
+
return;
|
144
|
+
this.ensureValidDirections();
|
145
|
+
const iconType = this.getArrowIcon();
|
146
|
+
buttonElement.setAttribute('variant', 'secondary');
|
147
|
+
buttonElement.setAttribute('prefix-icon', iconType);
|
148
|
+
}
|
149
|
+
/**
|
150
|
+
* Determines the arrow icon based on the consumer-defined `arrowDirection`.
|
151
|
+
*
|
152
|
+
* @returns The icon that represents the arrow direction.
|
153
|
+
*/
|
154
|
+
getArrowIcon() {
|
155
|
+
const isHorizontal = this.orientation === DIVIDER_ORIENTATION.HORIZONTAL;
|
156
|
+
const isPositive = this.arrowDirection === DIRECTIONS.POSITIVE;
|
157
|
+
if (isHorizontal) {
|
158
|
+
return isPositive ? ARROW_ICONS.UP : ARROW_ICONS.DOWN;
|
159
|
+
}
|
160
|
+
return isPositive ? ARROW_ICONS.RIGHT : ARROW_ICONS.LEFT;
|
161
|
+
}
|
162
|
+
update(changedProperties) {
|
163
|
+
super.update(changedProperties);
|
164
|
+
if (changedProperties.has('orientation')) {
|
165
|
+
this.setOrientation(this.orientation);
|
166
|
+
}
|
167
|
+
if (changedProperties.has('variant')) {
|
168
|
+
this.setVariant(this.variant);
|
169
|
+
}
|
170
|
+
if (changedProperties.has('orientation')
|
171
|
+
|| changedProperties.has('arrowDirection')
|
172
|
+
|| changedProperties.has('buttonPosition')) {
|
173
|
+
this.setGrabberButton();
|
174
|
+
}
|
175
|
+
}
|
176
|
+
/**
|
177
|
+
* Infers the type of divider based on the kind of slot present.
|
178
|
+
* @param slot - default slot of divider
|
179
|
+
*/
|
180
|
+
inferDividerType() {
|
181
|
+
var _a;
|
182
|
+
this.setAttribute('data-type', 'mdc-primary-divider');
|
183
|
+
const slot = (_a = this.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('slot');
|
184
|
+
const assignedElements = (slot === null || slot === void 0 ? void 0 : slot.assignedElements({ flatten: true })) || [];
|
185
|
+
if (assignedElements.length > 1)
|
186
|
+
return;
|
187
|
+
const hasTextChild = assignedElements.some((el) => el.tagName === TEXT_TAG.toUpperCase());
|
188
|
+
const hasButtonChild = assignedElements.some((el) => el.tagName === BUTTON_TAG.toUpperCase());
|
189
|
+
if (hasTextChild && !hasButtonChild) {
|
190
|
+
this.setAttribute('data-type', 'mdc-text-divider');
|
191
|
+
}
|
192
|
+
else if (!hasTextChild && hasButtonChild) {
|
193
|
+
this.setAttribute('data-type', 'mdc-grabber-divider');
|
194
|
+
this.setGrabberButton();
|
195
|
+
}
|
196
|
+
}
|
197
|
+
render() {
|
198
|
+
return html `
|
199
|
+
<div></div>
|
200
|
+
<slot @slotchange=${this.inferDividerType}></slot>
|
201
|
+
<div></div>
|
202
|
+
`;
|
203
|
+
}
|
204
|
+
}
|
205
|
+
Divider.styles = [...Component.styles, ...styles];
|
206
|
+
__decorate([
|
207
|
+
property({ type: String, reflect: true }),
|
208
|
+
__metadata("design:type", String)
|
209
|
+
], Divider.prototype, "orientation", void 0);
|
210
|
+
__decorate([
|
211
|
+
property({ type: String, reflect: true }),
|
212
|
+
__metadata("design:type", String)
|
213
|
+
], Divider.prototype, "variant", void 0);
|
214
|
+
__decorate([
|
215
|
+
property({ type: String, attribute: 'arrow-direction', reflect: true }),
|
216
|
+
__metadata("design:type", String)
|
217
|
+
], Divider.prototype, "arrowDirection", void 0);
|
218
|
+
__decorate([
|
219
|
+
property({ type: String, attribute: 'button-position', reflect: true }),
|
220
|
+
__metadata("design:type", String)
|
221
|
+
], Divider.prototype, "buttonPosition", void 0);
|
222
|
+
export default Divider;
|
@@ -0,0 +1,32 @@
|
|
1
|
+
import { TAG_NAME as BUTTON_TAG } from '../button/button.constants';
|
2
|
+
import { TAG_NAME as TEXT_TAG } from '../text/text.constants';
|
3
|
+
declare const TAG_NAME: "mdc-divider";
|
4
|
+
declare const DIVIDER_ORIENTATION: {
|
5
|
+
readonly HORIZONTAL: "horizontal";
|
6
|
+
readonly VERTICAL: "vertical";
|
7
|
+
};
|
8
|
+
declare const DIVIDER_VARIANT: {
|
9
|
+
readonly SOLID: "solid";
|
10
|
+
readonly GRADIENT: "gradient";
|
11
|
+
};
|
12
|
+
/**
|
13
|
+
* Direction types for both the arrow and button component.
|
14
|
+
* These directions are dependent on the divider's orientation.
|
15
|
+
*/
|
16
|
+
declare const DIRECTIONS: {
|
17
|
+
readonly POSITIVE: "positive";
|
18
|
+
readonly NEGATIVE: "negative";
|
19
|
+
};
|
20
|
+
declare const ARROW_ICONS: {
|
21
|
+
readonly UP: "arrow-up-regular";
|
22
|
+
readonly DOWN: "arrow-down-regular";
|
23
|
+
readonly LEFT: "arrow-left-regular";
|
24
|
+
readonly RIGHT: "arrow-right-regular";
|
25
|
+
};
|
26
|
+
declare const DEFAULTS: {
|
27
|
+
readonly ORIENTATION: "horizontal";
|
28
|
+
readonly VARIANT: "solid";
|
29
|
+
readonly ARROW_DIRECTION: "negative";
|
30
|
+
readonly BUTTON_DIRECTION: "negative";
|
31
|
+
};
|
32
|
+
export { TAG_NAME, DEFAULTS, DIVIDER_VARIANT, DIVIDER_ORIENTATION, DIRECTIONS, BUTTON_TAG, TEXT_TAG, ARROW_ICONS, };
|
@@ -0,0 +1,33 @@
|
|
1
|
+
import utils from '../../utils/tag-name';
|
2
|
+
import { TAG_NAME as BUTTON_TAG } from '../button/button.constants';
|
3
|
+
import { TAG_NAME as TEXT_TAG } from '../text/text.constants';
|
4
|
+
const TAG_NAME = utils.constructTagName('divider');
|
5
|
+
const DIVIDER_ORIENTATION = {
|
6
|
+
HORIZONTAL: 'horizontal',
|
7
|
+
VERTICAL: 'vertical',
|
8
|
+
};
|
9
|
+
const DIVIDER_VARIANT = {
|
10
|
+
SOLID: 'solid',
|
11
|
+
GRADIENT: 'gradient',
|
12
|
+
};
|
13
|
+
/**
|
14
|
+
* Direction types for both the arrow and button component.
|
15
|
+
* These directions are dependent on the divider's orientation.
|
16
|
+
*/
|
17
|
+
const DIRECTIONS = {
|
18
|
+
POSITIVE: 'positive',
|
19
|
+
NEGATIVE: 'negative',
|
20
|
+
};
|
21
|
+
const ARROW_ICONS = {
|
22
|
+
UP: 'arrow-up-regular',
|
23
|
+
DOWN: 'arrow-down-regular',
|
24
|
+
LEFT: 'arrow-left-regular',
|
25
|
+
RIGHT: 'arrow-right-regular',
|
26
|
+
};
|
27
|
+
const DEFAULTS = {
|
28
|
+
ORIENTATION: DIVIDER_ORIENTATION.HORIZONTAL,
|
29
|
+
VARIANT: DIVIDER_VARIANT.SOLID,
|
30
|
+
ARROW_DIRECTION: DIRECTIONS.NEGATIVE,
|
31
|
+
BUTTON_DIRECTION: DIRECTIONS.NEGATIVE,
|
32
|
+
};
|
33
|
+
export { TAG_NAME, DEFAULTS, DIVIDER_VARIANT, DIVIDER_ORIENTATION, DIRECTIONS, BUTTON_TAG, TEXT_TAG, ARROW_ICONS, };
|
@@ -0,0 +1,155 @@
|
|
1
|
+
import { css } from 'lit';
|
2
|
+
import { hostFitContentStyles } from '../../utils/styles';
|
3
|
+
/**
|
4
|
+
* Divider component styles
|
5
|
+
*/
|
6
|
+
const styles = [
|
7
|
+
hostFitContentStyles,
|
8
|
+
/* Host styles */
|
9
|
+
css `
|
10
|
+
:host {
|
11
|
+
--mdc-divider-background-color: var(--mds-color-theme-outline-secondary-normal);
|
12
|
+
--mdc-divider-width: 0.0625rem;
|
13
|
+
--mdc-divider-horizontal-gradient: var(--mds-color-theme-gradientdivider-default-normal);
|
14
|
+
--mdc-divider-vertical-gradient: var(--mds-color-theme-gradientdivider-vertical-normal);
|
15
|
+
--mdc-divider-text-size: var(--mds-font-size-body-midsize);
|
16
|
+
--mdc-divider-text-color: var(--mds-color-theme-text-secondary-normal);
|
17
|
+
--mdc-divider-text-line-height: var(--mds-font-lineheight-body-midsize);
|
18
|
+
--mdc-divider-text-margin: 1.5rem;
|
19
|
+
--mdc-divider-grabber-button-border-radius: 0.5rem;
|
20
|
+
|
21
|
+
display: flex;
|
22
|
+
justify-content: center;
|
23
|
+
}
|
24
|
+
|
25
|
+
/* Primary and grabber divider styles */
|
26
|
+
:host([data-type='mdc-primary-divider']),
|
27
|
+
:host([data-type='mdc-grabber-divider']) {
|
28
|
+
background-color: var(--mdc-divider-background-color);
|
29
|
+
}
|
30
|
+
|
31
|
+
/* Orientation-specific styles */
|
32
|
+
:host([orientation='horizontal']) {
|
33
|
+
flex-direction: row;
|
34
|
+
height: var(--mdc-divider-width);
|
35
|
+
width: 100%;
|
36
|
+
}
|
37
|
+
|
38
|
+
:host([orientation='vertical']:not([data-type='mdc-text-divider'])) {
|
39
|
+
flex-direction: column;
|
40
|
+
height: 100%;
|
41
|
+
width: var(--mdc-divider-width);
|
42
|
+
}
|
43
|
+
|
44
|
+
/* Gradient styles for primary and grabber dividers */
|
45
|
+
:host([orientation='horizontal'][variant='gradient'][data-type='mdc-primary-divider']),
|
46
|
+
:host([orientation='horizontal'][variant='gradient'][data-type='mdc-grabber-divider']) {
|
47
|
+
background: var(--mdc-divider-horizontal-gradient);
|
48
|
+
}
|
49
|
+
|
50
|
+
:host([orientation='vertical'][variant='gradient'][data-type='mdc-primary-divider']),
|
51
|
+
:host([orientation='vertical'][variant='gradient'][data-type='mdc-grabber-divider']) {
|
52
|
+
background: var(--mdc-divider-vertical-gradient);
|
53
|
+
}
|
54
|
+
|
55
|
+
/* Hiding slotted content for primary dividers */
|
56
|
+
:host([data-type='mdc-primary-divider']) ::slotted(*) {
|
57
|
+
display: none;
|
58
|
+
}
|
59
|
+
|
60
|
+
/** Button divider styles */
|
61
|
+
:host([orientation='vertical']) ::slotted(mdc-button) {
|
62
|
+
width: 1.25rem;
|
63
|
+
height: 2.5rem;
|
64
|
+
border-radius: 0
|
65
|
+
var(--mdc-divider-grabber-button-border-radius)
|
66
|
+
var(--mdc-divider-grabber-button-border-radius)
|
67
|
+
0;
|
68
|
+
}
|
69
|
+
|
70
|
+
:host([orientation='horizontal']) ::slotted(mdc-button) {
|
71
|
+
height: 1.25rem;
|
72
|
+
width: 2.5rem;
|
73
|
+
border-radius: 0
|
74
|
+
0
|
75
|
+
var(--mdc-divider-grabber-button-border-radius)
|
76
|
+
var(--mdc-divider-grabber-button-border-radius);
|
77
|
+
}
|
78
|
+
|
79
|
+
:host([orientation='horizontal'][button-position='positive']),
|
80
|
+
:host([orientation='vertical'][button-position='negative']) {
|
81
|
+
align-items: end;
|
82
|
+
}
|
83
|
+
|
84
|
+
:host([orientation='horizontal'][button-position='negative']),
|
85
|
+
:host([orientation='vertical'][button-position='positive']) {
|
86
|
+
align-items: start;
|
87
|
+
}
|
88
|
+
|
89
|
+
:host([orientation='horizontal'][button-position='positive']) ::slotted(mdc-button) {
|
90
|
+
border-radius: var(--mdc-divider-grabber-button-border-radius)
|
91
|
+
var(--mdc-divider-grabber-button-border-radius)
|
92
|
+
0
|
93
|
+
0;
|
94
|
+
border-bottom-color: transparent;
|
95
|
+
}
|
96
|
+
|
97
|
+
:host([orientation='horizontal'][button-position='negative']) ::slotted(mdc-button) {
|
98
|
+
border-top-color: transparent;
|
99
|
+
}
|
100
|
+
|
101
|
+
:host([orientation='vertical'][button-position='negative']:dir(ltr)) ::slotted(mdc-button),
|
102
|
+
:host([orientation='vertical'][button-position='negative']:dir(rtl)) ::slotted(mdc-button) {
|
103
|
+
border-radius: var(--mdc-divider-grabber-button-border-radius)
|
104
|
+
0
|
105
|
+
0
|
106
|
+
var(--mdc-divider-grabber-button-border-radius);
|
107
|
+
border-right-color: transparent;
|
108
|
+
}
|
109
|
+
|
110
|
+
:host([orientation='vertical'][button-position='positive']:dir(ltr)) ::slotted(mdc-button),
|
111
|
+
:host([orientation='vertical'][button-position='positive']:dir(rtl)) ::slotted(mdc-button) {
|
112
|
+
border-left-color: transparent;
|
113
|
+
}
|
114
|
+
|
115
|
+
:host([orientation='vertical'][button-position='positive']:dir(rtl)) ::slotted(mdc-button) {
|
116
|
+
border-radius: 0
|
117
|
+
var(--mdc-divider-grabber-button-border-radius)
|
118
|
+
var(--mdc-divider-grabber-button-border-radius)
|
119
|
+
0;
|
120
|
+
transform: rotate(180deg);
|
121
|
+
}
|
122
|
+
|
123
|
+
:host([orientation='vertical'][button-position='negative']:dir(rtl)) ::slotted(mdc-button) {
|
124
|
+
transform: rotate(180deg);
|
125
|
+
}
|
126
|
+
|
127
|
+
/** Text divider styles */
|
128
|
+
:host([orientation='horizontal'][variant='gradient'][data-type='mdc-text-divider']),
|
129
|
+
:host([orientation='horizontal'][variant='solid'][data-type='mdc-text-divider']) {
|
130
|
+
align-items: center;
|
131
|
+
}
|
132
|
+
|
133
|
+
:host([data-type='mdc-text-divider']) > div {
|
134
|
+
width: 100%;
|
135
|
+
height: 100%;
|
136
|
+
background-color: var(--mdc-divider-background-color);
|
137
|
+
}
|
138
|
+
|
139
|
+
:host([orientation='horizontal'][variant='gradient'][data-type='mdc-text-divider']) > div:first-of-type {
|
140
|
+
background: linear-gradient(to right, transparent, 30%, var(--mdc-divider-background-color));
|
141
|
+
}
|
142
|
+
|
143
|
+
:host([orientation='horizontal'][variant='gradient'][data-type='mdc-text-divider']) > div:last-of-type {
|
144
|
+
background: linear-gradient(to left, transparent, 30%, var(--mdc-divider-background-color));
|
145
|
+
}
|
146
|
+
|
147
|
+
:host([data-type='mdc-text-divider']) ::slotted(mdc-text) {
|
148
|
+
margin: 0 var(--mdc-divider-text-margin);
|
149
|
+
color: var(--mdc-divider-text-color);
|
150
|
+
font-size: var(--mdc-divider-text-size);
|
151
|
+
line-height: var(--mdc-divider-text-line-height);
|
152
|
+
}
|
153
|
+
`,
|
154
|
+
];
|
155
|
+
export default styles;
|
@@ -0,0 +1,6 @@
|
|
1
|
+
import type { ValueOf } from '../../utils/types';
|
2
|
+
import { DIVIDER_ORIENTATION, DIVIDER_VARIANT, DIRECTIONS } from './divider.constants';
|
3
|
+
type DividerOrientation = ValueOf<typeof DIVIDER_ORIENTATION>;
|
4
|
+
type DividerVariant = ValueOf<typeof DIVIDER_VARIANT>;
|
5
|
+
type Directions = ValueOf<typeof DIRECTIONS>;
|
6
|
+
export { DividerOrientation, DividerVariant, Directions };
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
@@ -938,6 +938,236 @@
|
|
938
938
|
}
|
939
939
|
]
|
940
940
|
},
|
941
|
+
{
|
942
|
+
"kind": "javascript-module",
|
943
|
+
"path": "components/divider/divider.component.js",
|
944
|
+
"declarations": [
|
945
|
+
{
|
946
|
+
"kind": "class",
|
947
|
+
"description": "`mdc-divider` is a component that provides a line to separate and organize content.\nIt can also include a button or text positioned centrally, allowing users to interact with the layout.\n\n**Divider Orientation:**\n- **Horizontal**: A thin, horizontal line.\n- **Vertical**: A thin, vertical line.\n\n**Divider Variants:**\n- **solid**: Solid line.\n- **gradient**: Gradient Line.\n\n**Divider Types:**\n- The type of divider is inferred based on the kind of slot present.\n - **Primary**: A simple horizontal or vertical divider.\n - **Text**: A horizontal divider with a text label in the center.\n - **Grabber Button**: A horizontal or vertical divider with a styled button in the center.\n\n**Accessibility:**\n- When the slot is replaced by an `mdc-button`:\n - `aria-label` should be passed to the `mdc-button`.\n - `aria-expanded` should be passed to the `mdc-button`.\n\n**Notes:**\n- If the slot is replaced by an invalid tag name or contains multiple elements,\n the divider defaults to the **Primary** type.\n- To override the styles of the divider, use the provided CSS custom properties.",
|
948
|
+
"name": "Divider",
|
949
|
+
"cssProperties": [
|
950
|
+
{
|
951
|
+
"description": "background color of the divider",
|
952
|
+
"name": "--mdc-divider-background-color"
|
953
|
+
},
|
954
|
+
{
|
955
|
+
"description": "width of the divider",
|
956
|
+
"name": "--mdc-divider-width"
|
957
|
+
},
|
958
|
+
{
|
959
|
+
"description": "gradient of the horizontal divider",
|
960
|
+
"name": "--mdc-divider-horizontal-gradient"
|
961
|
+
},
|
962
|
+
{
|
963
|
+
"description": "gradient of the vertical divider",
|
964
|
+
"name": "--mdc-divider-vertical-gradient"
|
965
|
+
},
|
966
|
+
{
|
967
|
+
"description": "font size of label in the text divider",
|
968
|
+
"name": "--mdc-divider-text-size"
|
969
|
+
},
|
970
|
+
{
|
971
|
+
"description": "font color of label in the text divider",
|
972
|
+
"name": "--mdc-divider-text-color"
|
973
|
+
},
|
974
|
+
{
|
975
|
+
"description": "left and right margin of label in the text divider",
|
976
|
+
"name": "--mdc-divider-text-margin"
|
977
|
+
},
|
978
|
+
{
|
979
|
+
"description": "line height of label in the text divider",
|
980
|
+
"name": "--mdc-divider-text-line-height"
|
981
|
+
},
|
982
|
+
{
|
983
|
+
"description": "border radius of the grabber button",
|
984
|
+
"name": "--mdc-divider-grabber-button-border-radius"
|
985
|
+
}
|
986
|
+
],
|
987
|
+
"members": [
|
988
|
+
{
|
989
|
+
"kind": "field",
|
990
|
+
"name": "orientation",
|
991
|
+
"type": {
|
992
|
+
"text": "DividerOrientation"
|
993
|
+
},
|
994
|
+
"description": "Two orientations of divider\n- **horizontal**: A thin, horizontal line with 0.0625rem width.\n- **vertical**: A thin, vertical line with 0.0625rem width.\n\nNote: We do not support \"Vertical Text Divider\" as of now.",
|
995
|
+
"default": "horizontal",
|
996
|
+
"attribute": "orientation",
|
997
|
+
"reflects": true
|
998
|
+
},
|
999
|
+
{
|
1000
|
+
"kind": "field",
|
1001
|
+
"name": "variant",
|
1002
|
+
"type": {
|
1003
|
+
"text": "DividerVariant"
|
1004
|
+
},
|
1005
|
+
"description": "Two variants of divider\n- **solid**: Solid line.\n- **gradient**: Gradient Line that fades on either sides of the divider.",
|
1006
|
+
"default": "solid",
|
1007
|
+
"attribute": "variant",
|
1008
|
+
"reflects": true
|
1009
|
+
},
|
1010
|
+
{
|
1011
|
+
"kind": "field",
|
1012
|
+
"name": "arrowDirection",
|
1013
|
+
"type": {
|
1014
|
+
"text": "string"
|
1015
|
+
},
|
1016
|
+
"description": "Direction of the arrow icon, if applicable.\n- **positive**\n- **negative**\n\nNote: Positive and Negative directions are defined based on Cartesian plane.",
|
1017
|
+
"default": "'negative'",
|
1018
|
+
"attribute": "arrow-direction",
|
1019
|
+
"reflects": true
|
1020
|
+
},
|
1021
|
+
{
|
1022
|
+
"kind": "field",
|
1023
|
+
"name": "buttonPosition",
|
1024
|
+
"type": {
|
1025
|
+
"text": "string"
|
1026
|
+
},
|
1027
|
+
"description": "Position of the button, if applicable.\n- **positive**\n- **negative**\n\nNote: Positive and Negative directions are defined based on Cartesian plane.",
|
1028
|
+
"default": "'negative'",
|
1029
|
+
"attribute": "button-position",
|
1030
|
+
"reflects": true
|
1031
|
+
},
|
1032
|
+
{
|
1033
|
+
"kind": "method",
|
1034
|
+
"name": "setVariant",
|
1035
|
+
"privacy": "private",
|
1036
|
+
"parameters": [
|
1037
|
+
{
|
1038
|
+
"name": "variant",
|
1039
|
+
"type": {
|
1040
|
+
"text": "DividerVariant"
|
1041
|
+
},
|
1042
|
+
"description": "The variant to set."
|
1043
|
+
}
|
1044
|
+
],
|
1045
|
+
"description": "Sets the variant attribute for the divider component.\nIf the provided variant is not included in the DIVIDER_VARIANT,\nit defaults to the value specified in DEFAULTS.VARIANT."
|
1046
|
+
},
|
1047
|
+
{
|
1048
|
+
"kind": "method",
|
1049
|
+
"name": "setOrientation",
|
1050
|
+
"privacy": "private",
|
1051
|
+
"parameters": [
|
1052
|
+
{
|
1053
|
+
"name": "orientation",
|
1054
|
+
"type": {
|
1055
|
+
"text": "DividerOrientation"
|
1056
|
+
},
|
1057
|
+
"description": "The orientation to set."
|
1058
|
+
}
|
1059
|
+
],
|
1060
|
+
"description": "Sets the orientation attribute for the divider component.\nIf the provided orientation is not included in the DIVIDER_ORIENTATION,\nit defaults to the value specified in DEFAULTS.ORIENTATION."
|
1061
|
+
},
|
1062
|
+
{
|
1063
|
+
"kind": "method",
|
1064
|
+
"name": "ensureValidDirections",
|
1065
|
+
"privacy": "private",
|
1066
|
+
"description": "Sets the buttonPosition and arrowDirection attribute for the divider component.\nIf the provided buttonPosition and arrowDirection are not included in the DIRECTIONS,\nit defaults to the value specified in DIRECTIONS based on the ORIENTATION.",
|
1067
|
+
"parameters": [
|
1068
|
+
{
|
1069
|
+
"description": "The buttonPosition to set.",
|
1070
|
+
"name": "buttonPosition"
|
1071
|
+
},
|
1072
|
+
{
|
1073
|
+
"description": "The arrowDirection to set.",
|
1074
|
+
"name": "arrowDirection"
|
1075
|
+
}
|
1076
|
+
]
|
1077
|
+
},
|
1078
|
+
{
|
1079
|
+
"kind": "method",
|
1080
|
+
"name": "setGrabberButton",
|
1081
|
+
"privacy": "private",
|
1082
|
+
"return": {
|
1083
|
+
"type": {
|
1084
|
+
"text": "void"
|
1085
|
+
}
|
1086
|
+
},
|
1087
|
+
"description": "Configures the grabber button within the divider.\n\n- Sets the `prefix-icon` attribute for the grabber button based\non the `arrow-direction` and `orientation` properties.\n\nThis method updates the DOM element dynamically if a grabber button is present."
|
1088
|
+
},
|
1089
|
+
{
|
1090
|
+
"kind": "method",
|
1091
|
+
"name": "getArrowIcon",
|
1092
|
+
"privacy": "private",
|
1093
|
+
"return": {
|
1094
|
+
"type": {
|
1095
|
+
"text": ""
|
1096
|
+
}
|
1097
|
+
},
|
1098
|
+
"description": "Determines the arrow icon based on the consumer-defined `arrowDirection`."
|
1099
|
+
},
|
1100
|
+
{
|
1101
|
+
"kind": "method",
|
1102
|
+
"name": "inferDividerType",
|
1103
|
+
"privacy": "private",
|
1104
|
+
"description": "Infers the type of divider based on the kind of slot present.",
|
1105
|
+
"parameters": [
|
1106
|
+
{
|
1107
|
+
"description": "default slot of divider",
|
1108
|
+
"name": "slot"
|
1109
|
+
}
|
1110
|
+
]
|
1111
|
+
}
|
1112
|
+
],
|
1113
|
+
"attributes": [
|
1114
|
+
{
|
1115
|
+
"name": "orientation",
|
1116
|
+
"type": {
|
1117
|
+
"text": "DividerOrientation"
|
1118
|
+
},
|
1119
|
+
"description": "Two orientations of divider\n- **horizontal**: A thin, horizontal line with 0.0625rem width.\n- **vertical**: A thin, vertical line with 0.0625rem width.\n\nNote: We do not support \"Vertical Text Divider\" as of now.",
|
1120
|
+
"default": "horizontal",
|
1121
|
+
"fieldName": "orientation"
|
1122
|
+
},
|
1123
|
+
{
|
1124
|
+
"name": "variant",
|
1125
|
+
"type": {
|
1126
|
+
"text": "DividerVariant"
|
1127
|
+
},
|
1128
|
+
"description": "Two variants of divider\n- **solid**: Solid line.\n- **gradient**: Gradient Line that fades on either sides of the divider.",
|
1129
|
+
"default": "solid",
|
1130
|
+
"fieldName": "variant"
|
1131
|
+
},
|
1132
|
+
{
|
1133
|
+
"name": "arrow-direction",
|
1134
|
+
"type": {
|
1135
|
+
"text": "string"
|
1136
|
+
},
|
1137
|
+
"description": "Direction of the arrow icon, if applicable.\n- **positive**\n- **negative**\n\nNote: Positive and Negative directions are defined based on Cartesian plane.",
|
1138
|
+
"default": "'negative'",
|
1139
|
+
"fieldName": "arrowDirection"
|
1140
|
+
},
|
1141
|
+
{
|
1142
|
+
"name": "button-position",
|
1143
|
+
"type": {
|
1144
|
+
"text": "string"
|
1145
|
+
},
|
1146
|
+
"description": "Position of the button, if applicable.\n- **positive**\n- **negative**\n\nNote: Positive and Negative directions are defined based on Cartesian plane.",
|
1147
|
+
"default": "'negative'",
|
1148
|
+
"fieldName": "buttonPosition"
|
1149
|
+
}
|
1150
|
+
],
|
1151
|
+
"superclass": {
|
1152
|
+
"name": "Component",
|
1153
|
+
"module": "/src/models"
|
1154
|
+
},
|
1155
|
+
"tagName": "mdc-divider",
|
1156
|
+
"jsDoc": "/**\n * `mdc-divider` is a component that provides a line to separate and organize content.\n * It can also include a button or text positioned centrally, allowing users to interact with the layout.\n *\n * **Divider Orientation:**\n * - **Horizontal**: A thin, horizontal line.\n * - **Vertical**: A thin, vertical line.\n *\n * **Divider Variants:**\n * - **solid**: Solid line.\n * - **gradient**: Gradient Line.\n *\n * **Divider Types:**\n * - The type of divider is inferred based on the kind of slot present.\n * - **Primary**: A simple horizontal or vertical divider.\n * - **Text**: A horizontal divider with a text label in the center.\n * - **Grabber Button**: A horizontal or vertical divider with a styled button in the center.\n *\n * **Accessibility:**\n * - When the slot is replaced by an `mdc-button`:\n * - `aria-label` should be passed to the `mdc-button`.\n * - `aria-expanded` should be passed to the `mdc-button`.\n *\n * **Notes:**\n * - If the slot is replaced by an invalid tag name or contains multiple elements,\n * the divider defaults to the **Primary** type.\n * - To override the styles of the divider, use the provided CSS custom properties.\n *\n * @tagname mdc-divider\n *\n * @cssproperty --mdc-divider-background-color - background color of the divider\n * @cssproperty --mdc-divider-width - width of the divider\n * @cssproperty --mdc-divider-horizontal-gradient - gradient of the horizontal divider\n * @cssproperty --mdc-divider-vertical-gradient - gradient of the vertical divider\n * @cssproperty --mdc-divider-text-size - font size of label in the text divider\n * @cssproperty --mdc-divider-text-color - font color of label in the text divider\n * @cssproperty --mdc-divider-text-margin - left and right margin of label in the text divider\n * @cssproperty --mdc-divider-text-line-height - line height of label in the text divider\n * @cssproperty --mdc-divider-grabber-button-border-radius - border radius of the grabber button\n */",
|
1157
|
+
"customElement": true
|
1158
|
+
}
|
1159
|
+
],
|
1160
|
+
"exports": [
|
1161
|
+
{
|
1162
|
+
"kind": "js",
|
1163
|
+
"name": "default",
|
1164
|
+
"declaration": {
|
1165
|
+
"name": "Divider",
|
1166
|
+
"module": "components/divider/divider.component.js"
|
1167
|
+
}
|
1168
|
+
}
|
1169
|
+
]
|
1170
|
+
},
|
941
1171
|
{
|
942
1172
|
"kind": "javascript-module",
|
943
1173
|
"path": "components/icon/icon.component.js",
|
@@ -0,0 +1,43 @@
|
|
1
|
+
import Component from '../../components/divider';
|
2
|
+
/**
|
3
|
+
* `mdc-divider` is a component that provides a line to separate and organize content.
|
4
|
+
* It can also include a button or text positioned centrally, allowing users to interact with the layout.
|
5
|
+
*
|
6
|
+
* **Divider Orientation:**
|
7
|
+
* - **Horizontal**: A thin, horizontal line.
|
8
|
+
* - **Vertical**: A thin, vertical line.
|
9
|
+
*
|
10
|
+
* **Divider Variants:**
|
11
|
+
* - **solid**: Solid line.
|
12
|
+
* - **gradient**: Gradient Line.
|
13
|
+
*
|
14
|
+
* **Divider Types:**
|
15
|
+
* - The type of divider is inferred based on the kind of slot present.
|
16
|
+
* - **Primary**: A simple horizontal or vertical divider.
|
17
|
+
* - **Text**: A horizontal divider with a text label in the center.
|
18
|
+
* - **Grabber Button**: A horizontal or vertical divider with a styled button in the center.
|
19
|
+
*
|
20
|
+
* **Accessibility:**
|
21
|
+
* - When the slot is replaced by an `mdc-button`:
|
22
|
+
* - `aria-label` should be passed to the `mdc-button`.
|
23
|
+
* - `aria-expanded` should be passed to the `mdc-button`.
|
24
|
+
*
|
25
|
+
* **Notes:**
|
26
|
+
* - If the slot is replaced by an invalid tag name or contains multiple elements,
|
27
|
+
* the divider defaults to the **Primary** type.
|
28
|
+
* - To override the styles of the divider, use the provided CSS custom properties.
|
29
|
+
*
|
30
|
+
* @tagname mdc-divider
|
31
|
+
*
|
32
|
+
* @cssproperty --mdc-divider-background-color - background color of the divider
|
33
|
+
* @cssproperty --mdc-divider-width - width of the divider
|
34
|
+
* @cssproperty --mdc-divider-horizontal-gradient - gradient of the horizontal divider
|
35
|
+
* @cssproperty --mdc-divider-vertical-gradient - gradient of the vertical divider
|
36
|
+
* @cssproperty --mdc-divider-text-size - font size of label in the text divider
|
37
|
+
* @cssproperty --mdc-divider-text-color - font color of label in the text divider
|
38
|
+
* @cssproperty --mdc-divider-text-margin - left and right margin of label in the text divider
|
39
|
+
* @cssproperty --mdc-divider-text-line-height - line height of label in the text divider
|
40
|
+
* @cssproperty --mdc-divider-grabber-button-border-radius - border radius of the grabber button
|
41
|
+
*/
|
42
|
+
declare const reactWrapper: import("@lit/react").ReactWebComponent<Component, {}>;
|
43
|
+
export default reactWrapper;
|
@@ -0,0 +1,52 @@
|
|
1
|
+
import * as React from 'react';
|
2
|
+
import { createComponent } from '@lit/react';
|
3
|
+
import Component from '../../components/divider';
|
4
|
+
import { TAG_NAME } from '../../components/divider/divider.constants';
|
5
|
+
/**
|
6
|
+
* `mdc-divider` is a component that provides a line to separate and organize content.
|
7
|
+
* It can also include a button or text positioned centrally, allowing users to interact with the layout.
|
8
|
+
*
|
9
|
+
* **Divider Orientation:**
|
10
|
+
* - **Horizontal**: A thin, horizontal line.
|
11
|
+
* - **Vertical**: A thin, vertical line.
|
12
|
+
*
|
13
|
+
* **Divider Variants:**
|
14
|
+
* - **solid**: Solid line.
|
15
|
+
* - **gradient**: Gradient Line.
|
16
|
+
*
|
17
|
+
* **Divider Types:**
|
18
|
+
* - The type of divider is inferred based on the kind of slot present.
|
19
|
+
* - **Primary**: A simple horizontal or vertical divider.
|
20
|
+
* - **Text**: A horizontal divider with a text label in the center.
|
21
|
+
* - **Grabber Button**: A horizontal or vertical divider with a styled button in the center.
|
22
|
+
*
|
23
|
+
* **Accessibility:**
|
24
|
+
* - When the slot is replaced by an `mdc-button`:
|
25
|
+
* - `aria-label` should be passed to the `mdc-button`.
|
26
|
+
* - `aria-expanded` should be passed to the `mdc-button`.
|
27
|
+
*
|
28
|
+
* **Notes:**
|
29
|
+
* - If the slot is replaced by an invalid tag name or contains multiple elements,
|
30
|
+
* the divider defaults to the **Primary** type.
|
31
|
+
* - To override the styles of the divider, use the provided CSS custom properties.
|
32
|
+
*
|
33
|
+
* @tagname mdc-divider
|
34
|
+
*
|
35
|
+
* @cssproperty --mdc-divider-background-color - background color of the divider
|
36
|
+
* @cssproperty --mdc-divider-width - width of the divider
|
37
|
+
* @cssproperty --mdc-divider-horizontal-gradient - gradient of the horizontal divider
|
38
|
+
* @cssproperty --mdc-divider-vertical-gradient - gradient of the vertical divider
|
39
|
+
* @cssproperty --mdc-divider-text-size - font size of label in the text divider
|
40
|
+
* @cssproperty --mdc-divider-text-color - font color of label in the text divider
|
41
|
+
* @cssproperty --mdc-divider-text-margin - left and right margin of label in the text divider
|
42
|
+
* @cssproperty --mdc-divider-text-line-height - line height of label in the text divider
|
43
|
+
* @cssproperty --mdc-divider-grabber-button-border-radius - border radius of the grabber button
|
44
|
+
*/
|
45
|
+
const reactWrapper = createComponent({
|
46
|
+
tagName: TAG_NAME,
|
47
|
+
elementClass: Component,
|
48
|
+
react: React,
|
49
|
+
events: {},
|
50
|
+
displayName: 'Divider',
|
51
|
+
});
|
52
|
+
export default reactWrapper;
|
package/dist/react/index.d.ts
CHANGED
@@ -2,6 +2,7 @@ export { default as Avatar } from './avatar';
|
|
2
2
|
export { default as Badge } from './badge';
|
3
3
|
export { default as Bullet } from './bullet';
|
4
4
|
export { default as Button } from './button';
|
5
|
+
export { default as Divider } from './divider';
|
5
6
|
export { default as Icon } from './icon';
|
6
7
|
export { default as IconProvider } from './iconprovider';
|
7
8
|
export { default as Presence } from './presence';
|
package/dist/react/index.js
CHANGED
@@ -2,6 +2,7 @@ export { default as Avatar } from './avatar';
|
|
2
2
|
export { default as Badge } from './badge';
|
3
3
|
export { default as Bullet } from './bullet';
|
4
4
|
export { default as Button } from './button';
|
5
|
+
export { default as Divider } from './divider';
|
5
6
|
export { default as Icon } from './icon';
|
6
7
|
export { default as IconProvider } from './iconprovider';
|
7
8
|
export { default as Presence } from './presence';
|
package/package.json
CHANGED