@nuralyui/divider 0.0.7 → 0.0.8
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/bundle.js +128 -1
- package/package.json +1 -1
package/bundle.js
CHANGED
|
@@ -1 +1,128 @@
|
|
|
1
|
-
import{css as i,LitElement as r,html as t}from"lit";import{property as e,customElement as d}from"lit/decorators.js";import{classMap as a}from"lit/directives/class-map.js";import{styleMap as o}from"lit/directives/style-map.js";import{NuralyUIBaseMixin as n}from"@nuralyui/common/mixins";var l=i
|
|
1
|
+
import{css as i,LitElement as r,html as t}from"lit";import{property as e,customElement as d}from"lit/decorators.js";import{classMap as a}from"lit/directives/class-map.js";import{styleMap as o}from"lit/directives/style-map.js";import{NuralyUIBaseMixin as n}from"@nuralyui/common/mixins";var l=i`
|
|
2
|
+
:host {
|
|
3
|
+
display: block;
|
|
4
|
+
box-sizing: border-box;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
:host([type="vertical"]) {
|
|
8
|
+
display: inline-block;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.divider {
|
|
12
|
+
box-sizing: border-box;
|
|
13
|
+
margin: 0;
|
|
14
|
+
padding: 0;
|
|
15
|
+
color: var(--nuraly-divider-text-color);
|
|
16
|
+
font-size: var(--nuraly-divider-font-size);
|
|
17
|
+
line-height: 1.5715;
|
|
18
|
+
list-style: none;
|
|
19
|
+
font-family: inherit;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/* Horizontal Divider */
|
|
23
|
+
.divider--horizontal {
|
|
24
|
+
display: flex;
|
|
25
|
+
clear: both;
|
|
26
|
+
width: 100%;
|
|
27
|
+
min-width: 100%;
|
|
28
|
+
margin: var(--nuraly-divider-margin-vertical, 24px) 0;
|
|
29
|
+
border-block-start: 1px var(--nuraly-divider-variant-style, solid) var(--nuraly-divider-color, rgba(5, 5, 5, 0.12));
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/* Horizontal with text */
|
|
33
|
+
.divider--horizontal.divider--with-text {
|
|
34
|
+
display: flex;
|
|
35
|
+
align-items: center;
|
|
36
|
+
margin: var(--nuraly-divider-margin-vertical) 0;
|
|
37
|
+
color: var(--nuraly-divider-text-color);
|
|
38
|
+
font-weight: 500;
|
|
39
|
+
font-size: var(--nuraly-divider-font-size);
|
|
40
|
+
white-space: nowrap;
|
|
41
|
+
text-align: center;
|
|
42
|
+
border-block-start: 0;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.divider--horizontal.divider--with-text::before,
|
|
46
|
+
.divider--horizontal.divider--with-text::after {
|
|
47
|
+
position: relative;
|
|
48
|
+
width: 50%;
|
|
49
|
+
border-block-start: 1px var(--nuraly-divider-variant-style, solid) var(--nuraly-divider-color, rgba(5, 5, 5, 0.12));
|
|
50
|
+
border-block-end: 0;
|
|
51
|
+
transform: translateY(50%);
|
|
52
|
+
content: '';
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/* Text positioning */
|
|
56
|
+
.divider--start::before {
|
|
57
|
+
width: var(--nuraly-divider-orientation-margin-left, 5%);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.divider--start::after {
|
|
61
|
+
width: 95%;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.divider--end::before {
|
|
65
|
+
width: 95%;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.divider--end::after {
|
|
69
|
+
width: var(--nuraly-divider-orientation-margin-right, 5%);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/* Text wrapper */
|
|
73
|
+
.divider__text {
|
|
74
|
+
display: inline-block;
|
|
75
|
+
padding: 0 var(--nuraly-divider-text-padding, 1em);
|
|
76
|
+
color: var(--nuraly-divider-text-color, rgba(0, 0, 0, 0.88));
|
|
77
|
+
font-size: var(--nuraly-divider-font-size, 1rem);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/* Plain text style */
|
|
81
|
+
.divider--plain .divider__text {
|
|
82
|
+
font-weight: normal;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/* Vertical Divider */
|
|
86
|
+
.divider--vertical {
|
|
87
|
+
position: relative;
|
|
88
|
+
top: -0.06em;
|
|
89
|
+
display: inline-block;
|
|
90
|
+
height: 0.9em;
|
|
91
|
+
margin: 0 var(--nuraly-divider-margin-horizontal, 8px);
|
|
92
|
+
vertical-align: middle;
|
|
93
|
+
border-top: 0;
|
|
94
|
+
border-inline-start: 1px var(--nuraly-divider-variant-style, solid) var(--nuraly-divider-color, rgba(5, 5, 5, 0.12));
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/* Variant styles */
|
|
98
|
+
.divider--solid {
|
|
99
|
+
--nuraly-divider-variant-style: solid;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
.divider--dashed {
|
|
103
|
+
--nuraly-divider-variant-style: dashed;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
.divider--dotted {
|
|
107
|
+
--nuraly-divider-variant-style: dotted;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/* Size variations (horizontal only) */
|
|
111
|
+
.divider--horizontal.divider--small {
|
|
112
|
+
margin: var(--nuraly-divider-margin-vertical-small) 0;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
.divider--horizontal.divider--middle {
|
|
116
|
+
margin: var(--nuraly-divider-margin-vertical-middle) 0;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
.divider--horizontal.divider--large {
|
|
120
|
+
margin: var(--nuraly-divider-margin-vertical-large) 0;
|
|
121
|
+
}
|
|
122
|
+
`,v=function(i,r,t,e){for(var d,a=arguments.length,o=a<3?r:null===e?e=Object.getOwnPropertyDescriptor(r,t):e,n=i.length-1;n>=0;n--)(d=i[n])&&(o=(a<3?d(o):a>3?d(r,t,o):d(r,t))||o);return a>3&&o&&Object.defineProperty(r,t,o),o};let s=class extends(n(r)){constructor(){super(...arguments),this.type="horizontal",this.dashed=!1,this.variant="solid",this.orientation="center",this.plain=!0}get hasText(){var i;const r=null===(i=this.shadowRoot)||void 0===i?void 0:i.querySelector("slot");return((null==r?void 0:r.assignedNodes({flatten:!0}))||[]).some((i=>{var r;return i.nodeType===Node.TEXT_NODE&&(null===(r=i.textContent)||void 0===r?void 0:r.trim())||i.nodeType===Node.ELEMENT_NODE}))}render(){const i=this.dashed?"dashed":this.variant,r="horizontal"===this.type,e="vertical"===this.type,d={divider:!0,"divider--horizontal":r,"divider--vertical":e,"divider--with-text":r&&this.hasText,"divider--plain":this.plain,[`divider--${i}`]:!0,[`divider--${this.orientation}`]:r&&this.hasText,[`divider--${this.size}`]:r&&!!this.size},n={};if(void 0!==this.orientationMargin&&r&&this.hasText){const i="number"==typeof this.orientationMargin?`${this.orientationMargin}px`:this.orientationMargin;"start"===this.orientation?n["--nuraly-divider-orientation-margin-left"]=i:"end"===this.orientation&&(n["--nuraly-divider-orientation-margin-right"]=i)}return e?t`<div class=${a(d)}></div>`:this.hasText?t`
|
|
123
|
+
<div class=${a(d)} style=${o(n)}>
|
|
124
|
+
<span class="divider__text">
|
|
125
|
+
<slot></slot>
|
|
126
|
+
</span>
|
|
127
|
+
</div>
|
|
128
|
+
`:t`<div class=${a(d)}></div>`}};s.styles=l,v([e({type:String})],s.prototype,"type",void 0),v([e({type:Boolean})],s.prototype,"dashed",void 0),v([e({type:String})],s.prototype,"variant",void 0),v([e({type:String})],s.prototype,"orientation",void 0),v([e({type:String,attribute:"orientation-margin"})],s.prototype,"orientationMargin",void 0),v([e({type:Boolean})],s.prototype,"plain",void 0),v([e({type:String})],s.prototype,"size",void 0),s=v([d("nr-divider")],s);export{s as NrDividerElement};
|