@muibook/components 19.5.1 → 20.0.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/README.md +1 -1
- package/dist/esm/agent/keywords/index.js +41 -2
- package/dist/esm/agent/prompts/index.js +14 -11
- package/dist/esm/components/mui-addon/index.js +14 -14
- package/dist/esm/components/mui-avatar/index.js +4 -1
- package/dist/esm/components/mui-badge/index.js +35 -18
- package/dist/esm/components/mui-body/index.js +57 -14
- package/dist/esm/components/mui-button/index.js +187 -52
- package/dist/esm/components/mui-card/body/index.js +1 -1
- package/dist/esm/components/mui-chip/index.js +56 -26
- package/dist/esm/components/mui-chip-rail/index.js +239 -0
- package/dist/esm/components/mui-code/index.js +5 -5
- package/dist/esm/components/mui-dropdown/index.js +55 -46
- package/dist/esm/components/mui-file-upload/index.js +1 -0
- package/dist/esm/components/mui-form-message/index.js +21 -13
- package/dist/esm/components/mui-heading/index.js +47 -10
- package/dist/esm/components/mui-hint/index.js +2 -2
- package/dist/esm/components/mui-input/index.js +21 -17
- package/dist/esm/components/mui-link/index.js +199 -55
- package/dist/esm/components/mui-message/index.js +7 -6
- package/dist/esm/components/mui-prompt/index.js +102 -102
- package/dist/esm/components/mui-rule/index.js +8 -1
- package/dist/esm/components/mui-select/index.js +4 -4
- package/dist/esm/components/mui-slat/slat/index.js +9 -1
- package/dist/esm/components/mui-stack/hstack/index.js +10 -5
- package/dist/esm/components/mui-status/index.js +239 -0
- package/dist/esm/components/mui-stepper/step/index.js +46 -32
- package/dist/esm/components/mui-switch/index.js +21 -13
- package/dist/esm/components/mui-tabs/controller/index.js +17 -6
- package/dist/esm/components/mui-tabs/item/index.js +17 -5
- package/dist/esm/components/mui-tabs/tab-bar/index.js +93 -39
- package/dist/esm/components/mui-video-thumbnail/index.js +205 -0
- package/dist/esm/css/mui-brand.css +3 -1
- package/dist/esm/css/mui-tokens.css +270 -78
- package/dist/esm/custom-elements.json +2608 -1900
- package/dist/esm/dynamic-attrs.json +26 -6
- package/dist/esm/index.js +7 -4
- package/dist/esm/tokens/js/index.js +119 -118
- package/dist/types/components/mui-body/api.d.ts +9 -2
- package/dist/types/components/mui-button/api.d.ts +4 -0
- package/dist/types/components/mui-chip/api.d.ts +4 -0
- package/dist/types/components/mui-chip-rail/api.d.ts +21 -0
- package/dist/types/components/mui-chip-rail/doc.d.ts +2 -0
- package/dist/types/components/mui-chip-rail/index.d.ts +3 -0
- package/dist/types/components/mui-link/api.d.ts +4 -0
- package/dist/types/components/mui-status/api.d.ts +24 -0
- package/dist/types/components/mui-status/doc.d.ts +2 -0
- package/dist/types/components/mui-status/index.d.ts +1 -0
- package/dist/types/components/mui-video-thumbnail/api.d.ts +28 -0
- package/dist/types/components/mui-video-thumbnail/doc.d.ts +2 -0
- package/dist/types/components/mui-video-thumbnail/index.d.ts +1 -0
- package/dist/types/index.d.ts +3 -0
- package/dist/types/tokens/js/index.d.ts +1 -0
- package/package.json +13 -1
package/README.md
CHANGED
|
@@ -61,7 +61,7 @@ Learn more at [Muibook.com](https://muibook.com/#/create-mui-app)
|
|
|
61
61
|
|
|
62
62
|
# Muibook Repository
|
|
63
63
|
|
|
64
|
-
Muibook is the home of the
|
|
64
|
+
Muibook is the home of the MichaelUI Design System — native Web Components with clean, composable patterns that help you write less code.
|
|
65
65
|
|
|
66
66
|
- 📖 Comprehensive guides: From basic usage to advanced customization
|
|
67
67
|
- 🎨 Design principles: Learn the MichaelUI design language
|
|
@@ -1,7 +1,15 @@
|
|
|
1
1
|
const e = {
|
|
2
2
|
// FEEDBACK
|
|
3
3
|
alert: ["alert", "success", "info", "warning", "error", "message", "banner", "notification"],
|
|
4
|
-
message: [
|
|
4
|
+
message: [
|
|
5
|
+
"page message",
|
|
6
|
+
"page notice",
|
|
7
|
+
"persistent notice",
|
|
8
|
+
"persistent message",
|
|
9
|
+
"system notice",
|
|
10
|
+
"status notice",
|
|
11
|
+
"message banner"
|
|
12
|
+
],
|
|
5
13
|
loader: ["loader", "loading", "skeleton", "placeholder", "shimmer", "pulse", "fade", "spinner"],
|
|
6
14
|
spinner: ["spinner", "loading", "busy", "indicator", "progress"],
|
|
7
15
|
progress: ["progress", "bar", "loading", "completion", "percent", "syncing", "pending"],
|
|
@@ -49,7 +57,38 @@ const e = {
|
|
|
49
57
|
avatar: ["avatar", "profile", "user", "initials", "image", "icon", "person"],
|
|
50
58
|
image: ["image", "photo", "picture", "figure", "caption", "img"],
|
|
51
59
|
skeleton: ["skeleton", "loading", "placeholder", "shimmer", "pulse", "line", "rect", "circle"],
|
|
52
|
-
badge: [
|
|
60
|
+
badge: [
|
|
61
|
+
"badge",
|
|
62
|
+
"count",
|
|
63
|
+
"label",
|
|
64
|
+
"tag",
|
|
65
|
+
"metadata",
|
|
66
|
+
"notification",
|
|
67
|
+
"overlay",
|
|
68
|
+
"paid",
|
|
69
|
+
"busy",
|
|
70
|
+
"offline",
|
|
71
|
+
"beta",
|
|
72
|
+
"default",
|
|
73
|
+
"shared",
|
|
74
|
+
"positive",
|
|
75
|
+
"warning",
|
|
76
|
+
"error"
|
|
77
|
+
],
|
|
78
|
+
status: [
|
|
79
|
+
"status",
|
|
80
|
+
"state",
|
|
81
|
+
"workflow state",
|
|
82
|
+
"record status",
|
|
83
|
+
"object status",
|
|
84
|
+
"active",
|
|
85
|
+
"draft",
|
|
86
|
+
"pending",
|
|
87
|
+
"review",
|
|
88
|
+
"blocked",
|
|
89
|
+
"synced",
|
|
90
|
+
"queued"
|
|
91
|
+
],
|
|
53
92
|
// ACCORDION
|
|
54
93
|
accordion: [
|
|
55
94
|
"accordion",
|
|
@@ -24,6 +24,7 @@ CRITICAL RULES:
|
|
|
24
24
|
11. Put visual backgrounds on layout style or SmartCard bg props.
|
|
25
25
|
12. SmartCard props use kebab-case: bg-image, bg-color, logo-height.
|
|
26
26
|
13. Normalize scanned Muibook/Figma names to Redactd component types before output.
|
|
27
|
+
14. Do not use Message as a styled paragraph, inline note, or form helper. Message is only for persistent page-level notices with a heading and slotted body content.
|
|
27
28
|
|
|
28
29
|
MUI SCAN NORMALIZATION RULES:
|
|
29
30
|
- Normalize muiscan to Redactd types before output
|
|
@@ -58,9 +59,10 @@ TEXT NODE RULES FOR MUISCAN:
|
|
|
58
59
|
- keep inline children such as Link nested inside the same Span
|
|
59
60
|
- Exceptions:
|
|
60
61
|
- mui-badge: consume TEXT as the badge's direct rendered text; preserve before/after slot children; do not invent Body
|
|
62
|
+
- mui-status: consume TEXT as the status's direct rendered text; preserve before/after icon slot children; do not invent Body, Badge, or Message inside Status
|
|
61
63
|
- mui-chip: consume TEXT as the chip's direct rendered text; preserve before/after slot children; do not invent Body
|
|
62
64
|
- mui-alert: preserve variant/label, convert default content to Span, consume TEXT into Span.props.text, keep inline children such as Link, do not invent Body
|
|
63
|
-
- mui-message: map scanned heading directly to Message.props.heading, preserve variant/icon/size, keep remaining children as default message content
|
|
65
|
+
- mui-message: map scanned heading directly to Message.props.heading, preserve variant/icon/size, keep remaining children as default message content; if there is no supporting body content, prefer Body or FormMessage instead of Message
|
|
64
66
|
- Do not invent wrappers when the target already supports text
|
|
65
67
|
|
|
66
68
|
Available Components:
|
|
@@ -71,7 +73,7 @@ LAYOUT:
|
|
|
71
73
|
- Grid: col, space, padding, alignX, alignY, height, width, fill, viewport, style
|
|
72
74
|
- Container: size (small|medium|large), center, style
|
|
73
75
|
- Responsive: breakpoint, breakpoint-low, breakpoint-high; slots showBelow/showMiddle/showAbove
|
|
74
|
-
- Rule: length, weight, direction (horizontal|vertical)
|
|
76
|
+
- Rule: length, weight (thin|thick|CSS size), direction (horizontal|vertical)
|
|
75
77
|
|
|
76
78
|
SURFACES:
|
|
77
79
|
- Card: use CardBody for card content
|
|
@@ -85,8 +87,8 @@ SURFACES:
|
|
|
85
87
|
- SmartCard: state, number, variant, partner, type, logo, logo-height, bg-color, bg-image, inverted
|
|
86
88
|
|
|
87
89
|
CONTENT:
|
|
88
|
-
- Heading: text, size (1|2|3|4|5|6), level (1|2|3|4|5|6)
|
|
89
|
-
- Body: text, size (x-small|small|medium|large), weight (regular|bold), variant (default|optional|success|warning|error), style
|
|
90
|
+
- Heading: text, size (1|2|3|4|5|6), level (1|2|3|4|5|6), truncate, clamp
|
|
91
|
+
- Body: text, size (x-small|small|medium|large), weight (regular|bold), variant (default|optional|info|success|warning|error), truncate, clamp, style; use _Icon icon=mui-icon-info slot=before for lightweight inline guidance
|
|
90
92
|
- Span: text, style; supports inline children such as Link
|
|
91
93
|
- Code: size, scrollable
|
|
92
94
|
- Quote: default text
|
|
@@ -95,7 +97,8 @@ CONTENT:
|
|
|
95
97
|
- List: slot default
|
|
96
98
|
- ListItem: text, variant, size (x-small|small|medium|large), weight (regular|bold)
|
|
97
99
|
- _Icon: icon, size (xx-small|x-small|small|medium|large), color, slot
|
|
98
|
-
- Badge: text, variant (default|positive|warning|error|overlay)
|
|
100
|
+
- Badge: text, variant (default|positive|warning|error|overlay), color (grey|purple|violet|pink|magenta|red|orange|amber|yellow|lime|green|teal|cyan|blue|indigo|CSS background value). Use for compact non-interactive presentational metadata, counts, and lightweight state-like labels such as Offline, Online, Busy, Do not disturb, Beta, Default, IMG, or Shared when the surrounding UI already explains the object. Good inside cards, messages, chips, buttons, tabs, navigation, and hero or marketing surfaces. Use color to override the badge background only through theme-aware badge background tokens; do not use positive, warning, or attention just to get a different background colour.
|
|
101
|
+
- Status: text, variant (info|positive|warning|attention), color (grey|purple|violet|pink|magenta|red|orange|amber|yellow|lime|green|teal|cyan|blue|indigo), size (small|medium); slots before/after. Use for compact object or workflow state labels such as Active, Draft, Pending, Review, Blocked, or Synced when the value is the primary state of a record, workflow, or system, especially in tables, slats, dashboards, and data-heavy pages. Status is non-interactive by default, but can be interactive when composed as a trigger or compact state action. Omit variant for default low-emphasis grey status; use variant for semantic feedback and color for non-semantic categorical labels. Use action only when the status is a trigger. Do not use for counts, helper text, paragraph guidance, page-level notices, or decorative metadata.
|
|
99
102
|
- Skeleton: loading, shape (line|rect|circle), size, animation (shimmer|pulse|none), lines, width, height, radius, gap, duration, line-widths, max-width, style
|
|
100
103
|
|
|
101
104
|
ACCORDION:
|
|
@@ -108,7 +111,7 @@ FORMS AND INPUTS:
|
|
|
108
111
|
- FormSectionFooter: slot, style
|
|
109
112
|
- FormGroup: heading, variant (vertical|horizontal), hide-label, style
|
|
110
113
|
- Field: label, variant (default|success|warning|error), message, hide-label, size (x-small|small|medium|large), optional, style
|
|
111
|
-
- FormMessage: text, size (x-small|small|medium|large), weight (regular|bold), variant (default|optional|success|warning|error), style
|
|
114
|
+
- FormMessage: text, size (x-small|small|medium|large), weight (regular|bold), variant (default|optional|info|success|warning|error), style
|
|
112
115
|
- Input: label, type (text|email|password|number|tel|url), placeholder, value, id, name, disabled, hide-label, variant (default|error), size (x-small|small|medium|large), optional, max-length; slots before/after
|
|
113
116
|
- Textarea: label, placeholder, value, name, id, variant (default|success|warning|error), size (x-small|small|medium|large), rows, optional, hide-label, max-length, disabled, style
|
|
114
117
|
- Select: label, placeholder, options, value, id, name, disabled, variant (default|error), size (x-small|small|medium|large)
|
|
@@ -122,14 +125,14 @@ FORMS AND INPUTS:
|
|
|
122
125
|
- Addon: text, size (x-small|small|medium|large), slot (before|after), style
|
|
123
126
|
|
|
124
127
|
ACTIONS:
|
|
125
|
-
- Button: text, variant (primary|secondary|tertiary|overlay|attention), size (small|medium|large), disabled, aria-label; slots default/before/after
|
|
128
|
+
- Button: text, variant (primary|secondary|tertiary|overlay|attention), size (xx-small|x-small|small|medium|large), stroke (border|ring), stroke-ring-size (100|200|300|400|500), disabled, aria-label; slots default/before/after
|
|
126
129
|
- ButtonGroup: slot default, right, style
|
|
127
|
-
- Link: text, href, variant (primary|secondary|tertiary|overlay|attention), size (x-small|small|medium|large), target, download, weight (regular|bold), disabled; slots default/before/after
|
|
130
|
+
- Link: text, href, variant (primary|secondary|tertiary|overlay|attention), size (xx-small|x-small|small|medium|large), stroke (border|ring), stroke-ring-size (100|200|300|400|500), target, download, weight (regular|bold), disabled; slots default/before/after
|
|
128
131
|
- Dropdown: zindex, position, persistent; slots action/default
|
|
129
|
-
- Chip: text, active, dismiss, usage; slots default/before/after
|
|
132
|
+
- Chip: text, active, dismiss, usage; slots default/before/after. Chip labels truncate when constrained; keep text short and let icons/dismiss controls remain visible.
|
|
130
133
|
|
|
131
134
|
NAVIGATION:
|
|
132
|
-
- TabBar: speed, controlsPosition; slots default/controls
|
|
135
|
+
- TabBar: speed, controlsPosition, stroke (border|none), active-inset, radius; slots default/controls
|
|
133
136
|
- TabItem: text, icon, active, id
|
|
134
137
|
- TabController: slot default
|
|
135
138
|
- TabPanel: item
|
|
@@ -139,7 +142,7 @@ NAVIGATION:
|
|
|
139
142
|
- CarouselPanel: item, style
|
|
140
143
|
|
|
141
144
|
FEEDBACK:
|
|
142
|
-
- Message: heading, variant (
|
|
145
|
+
- Message: heading, variant (neutral|positive|info|warning|attention), icon, size (small|medium|large); slot default. Use only for persistent page-level or section-level notices. Always provide a concise heading plus default slot body content, usually Body/List/Link. Do not use for inline guidance, styled text blocks, or form helper text.
|
|
143
146
|
- Alert: variant (success|info|warning|error), label; slots default/action
|
|
144
147
|
- Loader: loading, animation (pulsate|fade-in|translate), direction (up|right|down|left), duration; slot default
|
|
145
148
|
- Spinner: size (xx-small|x-small|small|medium|large), color, duration, label, style
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
class
|
|
1
|
+
class a extends HTMLElement {
|
|
2
2
|
static get observedAttributes() {
|
|
3
3
|
return ["slot", "size"];
|
|
4
4
|
}
|
|
@@ -16,8 +16,8 @@ class s extends HTMLElement {
|
|
|
16
16
|
const t = (e = this.shadowRoot) == null ? void 0 : e.querySelector("slot");
|
|
17
17
|
if (!t) return;
|
|
18
18
|
const i = this.getAttribute("size") || "medium";
|
|
19
|
-
t.assignedElements({ flatten: !0 }).forEach((
|
|
20
|
-
|
|
19
|
+
t.assignedElements({ flatten: !0 }).forEach((s) => {
|
|
20
|
+
s.tagName.toLowerCase() === "mui-body" && s.setAttribute("size", i);
|
|
21
21
|
});
|
|
22
22
|
}
|
|
23
23
|
render() {
|
|
@@ -30,32 +30,32 @@ class s extends HTMLElement {
|
|
|
30
30
|
align-items: center;
|
|
31
31
|
justify-content: center;
|
|
32
32
|
box-sizing: border-box;
|
|
33
|
-
min-height:
|
|
33
|
+
min-height: var(--action-size-medium);
|
|
34
34
|
padding: var(--space-200) var(--space-400);
|
|
35
35
|
background: var(--addon-background);
|
|
36
36
|
border: var(--border-thin);
|
|
37
37
|
border-color: var(--form-default-border-color);
|
|
38
|
-
min-width:
|
|
38
|
+
min-width: var(--action-size-medium);
|
|
39
39
|
white-space: nowrap;
|
|
40
40
|
}
|
|
41
41
|
:host([size="x-small"]) {
|
|
42
|
-
min-height: var(--action-
|
|
43
|
-
min-width: var(--action-
|
|
42
|
+
min-height: var(--action-size-x-small);
|
|
43
|
+
min-width: var(--action-size-x-small);
|
|
44
44
|
padding: var(--action-padding-x-small);
|
|
45
45
|
}
|
|
46
46
|
:host([size="small"]) {
|
|
47
|
-
min-height: var(--action-
|
|
48
|
-
min-width: var(--action-
|
|
47
|
+
min-height: var(--action-size-small);
|
|
48
|
+
min-width: var(--action-size-small);
|
|
49
49
|
padding: var(--action-padding-small);
|
|
50
50
|
}
|
|
51
51
|
:host([size="medium"]) {
|
|
52
|
-
min-height:
|
|
53
|
-
min-width:
|
|
52
|
+
min-height: var(--action-size-medium);
|
|
53
|
+
min-width: var(--action-size-medium);
|
|
54
54
|
padding: var(--space-200) var(--space-400);
|
|
55
55
|
}
|
|
56
56
|
:host([size="large"]) {
|
|
57
|
-
min-height: var(--action-
|
|
58
|
-
min-width: var(--action-
|
|
57
|
+
min-height: var(--action-size-large);
|
|
58
|
+
min-width: var(--action-size-large);
|
|
59
59
|
padding: var(--space-300) var(--space-500);
|
|
60
60
|
}
|
|
61
61
|
:host([slot="before"]) {
|
|
@@ -75,4 +75,4 @@ class s extends HTMLElement {
|
|
|
75
75
|
t == null || t.addEventListener("slotchange", () => this.syncSlottedContent());
|
|
76
76
|
}
|
|
77
77
|
}
|
|
78
|
-
customElements.get("mui-addon") || customElements.define("mui-addon",
|
|
78
|
+
customElements.get("mui-addon") || customElements.define("mui-addon", a);
|
|
@@ -87,7 +87,7 @@ class w extends HTMLElement {
|
|
|
87
87
|
font-weight: var(--font-weight-bold);
|
|
88
88
|
letter-spacing: -0.05rem;
|
|
89
89
|
font-size: ${k};
|
|
90
|
-
color: var(--text-color);
|
|
90
|
+
color: var(--avatar-text-color, var(--text-color));
|
|
91
91
|
background: ${p};
|
|
92
92
|
overflow: hidden;
|
|
93
93
|
align-items: center;
|
|
@@ -119,6 +119,9 @@ class w extends HTMLElement {
|
|
|
119
119
|
width: 100%;
|
|
120
120
|
height: 100%;
|
|
121
121
|
}
|
|
122
|
+
::slotted([class*="mui-icon"]) {
|
|
123
|
+
fill: var(--avatar-icon-color, currentColor);
|
|
124
|
+
}
|
|
122
125
|
`
|
|
123
126
|
);
|
|
124
127
|
if (this.shadowRoot.innerHTML = `
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
class
|
|
1
|
+
class m extends HTMLElement {
|
|
2
2
|
constructor() {
|
|
3
3
|
super(), this.attachShadow({ mode: "open" });
|
|
4
4
|
}
|
|
5
5
|
static get observedAttributes() {
|
|
6
|
-
return ["variant", "size"];
|
|
6
|
+
return ["variant", "size", "color"];
|
|
7
7
|
}
|
|
8
8
|
connectedCallback() {
|
|
9
9
|
this.hasAttribute("variant") || this.setAttribute("variant", "neutral"), this.hasAttribute("size") || this.setAttribute("size", "medium"), this.setAttribute("role", "status"), this.render();
|
|
@@ -12,31 +12,48 @@ class b extends HTMLElement {
|
|
|
12
12
|
this.render();
|
|
13
13
|
}
|
|
14
14
|
render() {
|
|
15
|
-
|
|
15
|
+
var o;
|
|
16
|
+
const e = this.getAttribute("variant") || "neutral", s = this.getAttribute("size") || "medium", r = (o = this.getAttribute("color")) == null ? void 0 : o.trim(), g = {
|
|
16
17
|
neutral: "var(--badge-background-neutral)",
|
|
17
18
|
positive: "var(--badge-background-positive)",
|
|
18
19
|
warning: "var(--badge-background-warning)",
|
|
19
20
|
attention: "var(--badge-background-attention)",
|
|
20
21
|
overlay: "var(--badge-background-overlay)"
|
|
21
|
-
},
|
|
22
|
+
}, n = {
|
|
23
|
+
grey: "var(--badge-background-grey)",
|
|
24
|
+
purple: "var(--badge-background-purple)",
|
|
25
|
+
violet: "var(--badge-background-violet)",
|
|
26
|
+
pink: "var(--badge-background-pink)",
|
|
27
|
+
magenta: "var(--badge-background-magenta)",
|
|
28
|
+
red: "var(--badge-background-red)",
|
|
29
|
+
orange: "var(--badge-background-orange)",
|
|
30
|
+
amber: "var(--badge-background-amber)",
|
|
31
|
+
yellow: "var(--badge-background-yellow)",
|
|
32
|
+
lime: "var(--badge-background-lime)",
|
|
33
|
+
green: "var(--badge-background-green)",
|
|
34
|
+
teal: "var(--badge-background-teal)",
|
|
35
|
+
cyan: "var(--badge-background-cyan)",
|
|
36
|
+
blue: "var(--badge-background-blue)",
|
|
37
|
+
indigo: "var(--badge-background-indigo)"
|
|
38
|
+
}, d = {
|
|
22
39
|
neutral: "var(--badge-text-color)",
|
|
23
40
|
positive: "var(--badge-text-color)",
|
|
24
41
|
warning: "var(--badge-text-color)",
|
|
25
42
|
attention: "var(--badge-text-color)",
|
|
26
43
|
overlay: "var(--badge-text-color-overlay)"
|
|
27
|
-
},
|
|
44
|
+
}, b = {
|
|
28
45
|
neutral: "none",
|
|
29
46
|
positive: "none",
|
|
30
47
|
warning: "none",
|
|
31
48
|
attention: "none",
|
|
32
49
|
overlay: "var(--badge-border-overlay)"
|
|
33
|
-
},
|
|
50
|
+
}, l = {
|
|
34
51
|
neutral: "off",
|
|
35
52
|
positive: "polite",
|
|
36
53
|
warning: "assertive",
|
|
37
54
|
attention: "assertive",
|
|
38
55
|
overlay: "off"
|
|
39
|
-
},
|
|
56
|
+
}, t = r, c = t && n[t] ? n[t] : r || "var(--badge-background, " + g[e] + ")", v = d[e], u = b[e], h = l[e], i = {
|
|
40
57
|
"xx-small": {
|
|
41
58
|
fontSize: "var(--font-size-15)",
|
|
42
59
|
lineHeight: "1",
|
|
@@ -65,7 +82,7 @@ class b extends HTMLElement {
|
|
|
65
82
|
lineHeight: "1",
|
|
66
83
|
padding: "var(--space-100) var(--space-300)"
|
|
67
84
|
}
|
|
68
|
-
},
|
|
85
|
+
}, a = i[s] || i.medium, p = (
|
|
69
86
|
/*css*/
|
|
70
87
|
`
|
|
71
88
|
:host {
|
|
@@ -77,14 +94,14 @@ class b extends HTMLElement {
|
|
|
77
94
|
display: inline-flex;
|
|
78
95
|
align-items: center;
|
|
79
96
|
border-radius: var(--badge-radius);
|
|
80
|
-
background: ${
|
|
81
|
-
border: ${
|
|
82
|
-
font-size: ${
|
|
83
|
-
line-height: ${
|
|
97
|
+
background: ${c};
|
|
98
|
+
border: ${u};
|
|
99
|
+
font-size: ${a.fontSize};
|
|
100
|
+
line-height: ${a.lineHeight};
|
|
84
101
|
font-weight: var(--badge-font-weight);
|
|
85
|
-
color: ${
|
|
86
|
-
padding: ${
|
|
87
|
-
min-height: ${
|
|
102
|
+
color: ${v};
|
|
103
|
+
padding: ${a.padding};
|
|
104
|
+
min-height: ${a.minHeight || "auto"};
|
|
88
105
|
}
|
|
89
106
|
|
|
90
107
|
:host([usage="slat-end"]) {
|
|
@@ -92,13 +109,13 @@ class b extends HTMLElement {
|
|
|
92
109
|
}
|
|
93
110
|
`
|
|
94
111
|
);
|
|
95
|
-
this.setAttribute("role", "status"), this.setAttribute("aria-live",
|
|
112
|
+
this.setAttribute("role", "status"), this.setAttribute("aria-live", h), this.shadowRoot && (this.shadowRoot.innerHTML = /*html*/
|
|
96
113
|
`
|
|
97
|
-
<style>${
|
|
114
|
+
<style>${p}</style>
|
|
98
115
|
<span class="badge">
|
|
99
116
|
<slot></slot>
|
|
100
117
|
</span>
|
|
101
118
|
`);
|
|
102
119
|
}
|
|
103
120
|
}
|
|
104
|
-
customElements.get("mui-badge") || customElements.define("mui-badge",
|
|
121
|
+
customElements.get("mui-badge") || customElements.define("mui-badge", m);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { getPartMap as r } from "../../utils/part-map/index.js";
|
|
2
2
|
class l extends HTMLElement {
|
|
3
3
|
static get observedAttributes() {
|
|
4
|
-
return ["size", "weight", "variant"];
|
|
4
|
+
return ["size", "weight", "variant", "truncate", "clamp"];
|
|
5
5
|
}
|
|
6
6
|
constructor() {
|
|
7
7
|
super(), this.attachShadow({ mode: "open" });
|
|
@@ -9,25 +9,36 @@ class l extends HTMLElement {
|
|
|
9
9
|
async connectedCallback() {
|
|
10
10
|
this.hasAttribute("size") || this.setAttribute("size", "medium"), this.hasAttribute("weight") || this.setAttribute("weight", "regular"), this.hasAttribute("variant") || this.setAttribute("variant", "default"), await this.waitForPartMap(), this.render();
|
|
11
11
|
}
|
|
12
|
-
attributeChangedCallback(t, e,
|
|
13
|
-
e !==
|
|
12
|
+
attributeChangedCallback(t, e, i) {
|
|
13
|
+
e !== i && this.shadowRoot && this.render();
|
|
14
14
|
}
|
|
15
15
|
render() {
|
|
16
16
|
if (!this.shadowRoot) return;
|
|
17
|
-
const t = r("text", "spacing", "layout", "visual");
|
|
17
|
+
const t = r("text", "spacing", "layout", "visual"), e = this.getLineClamp();
|
|
18
18
|
this.shadowRoot.innerHTML = /*html*/
|
|
19
19
|
`
|
|
20
20
|
<style>
|
|
21
|
-
:host {
|
|
21
|
+
:host {
|
|
22
|
+
display: block;
|
|
23
|
+
--body-line-clamp: ${e};
|
|
24
|
+
}
|
|
22
25
|
:host([has-before]),
|
|
23
26
|
:host([has-after]) {
|
|
24
27
|
display: inline-flex;
|
|
25
28
|
}
|
|
26
29
|
|
|
30
|
+
:host([truncate]) {
|
|
31
|
+
display: block;
|
|
32
|
+
min-width: 0;
|
|
33
|
+
max-width: 100%;
|
|
34
|
+
width: 100%;
|
|
35
|
+
}
|
|
36
|
+
|
|
27
37
|
:host p {
|
|
28
38
|
color: var(--text-color);
|
|
29
39
|
margin: var(--space-000);
|
|
30
40
|
display: block;
|
|
41
|
+
min-width: 0;
|
|
31
42
|
width: 100%;
|
|
32
43
|
}
|
|
33
44
|
|
|
@@ -41,9 +52,31 @@ class l extends HTMLElement {
|
|
|
41
52
|
}
|
|
42
53
|
|
|
43
54
|
.content {
|
|
55
|
+
max-width: 100%;
|
|
44
56
|
min-width: 0;
|
|
45
57
|
}
|
|
46
58
|
|
|
59
|
+
:host([truncate]) p,
|
|
60
|
+
:host([clamp]) p {
|
|
61
|
+
max-width: 100%;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
:host([truncate]) .content {
|
|
65
|
+
display: block;
|
|
66
|
+
max-width: 100%;
|
|
67
|
+
width: 100%;
|
|
68
|
+
overflow: hidden;
|
|
69
|
+
text-overflow: ellipsis;
|
|
70
|
+
white-space: nowrap;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
:host([clamp]:not([truncate])) .content {
|
|
74
|
+
display: -webkit-box;
|
|
75
|
+
overflow: hidden;
|
|
76
|
+
-webkit-box-orient: vertical;
|
|
77
|
+
-webkit-line-clamp: var(--body-line-clamp);
|
|
78
|
+
}
|
|
79
|
+
|
|
47
80
|
::slotted([slot="before"]),
|
|
48
81
|
::slotted([slot="after"]) {
|
|
49
82
|
flex-shrink: 0;
|
|
@@ -64,7 +97,7 @@ class l extends HTMLElement {
|
|
|
64
97
|
|
|
65
98
|
:host([size="large"]) ::slotted([slot="before"]),
|
|
66
99
|
:host([size="large"]) ::slotted([slot="after"]) {
|
|
67
|
-
margin-top: var(--body-inline-icon-offset-large, var(--body-inline-icon-offset, var(--stroke-size-
|
|
100
|
+
margin-top: var(--body-inline-icon-offset-large, var(--body-inline-icon-offset, var(--stroke-size-300)));
|
|
68
101
|
}
|
|
69
102
|
|
|
70
103
|
:host([size="x-small"]) p {
|
|
@@ -100,6 +133,9 @@ class l extends HTMLElement {
|
|
|
100
133
|
color: var(--text-color-optional);
|
|
101
134
|
}
|
|
102
135
|
|
|
136
|
+
:host([variant="info"]) p {
|
|
137
|
+
color: var(--text-color-info);
|
|
138
|
+
}
|
|
103
139
|
:host([variant="success"]) p {
|
|
104
140
|
color: var(--text-color-success);
|
|
105
141
|
}
|
|
@@ -116,6 +152,9 @@ class l extends HTMLElement {
|
|
|
116
152
|
:host([variant="optional"]) ::slotted(.mui-icon) {
|
|
117
153
|
fill: var(--text-color-optional);
|
|
118
154
|
}
|
|
155
|
+
:host([variant="info"]) ::slotted(.mui-icon) {
|
|
156
|
+
fill: var(--text-color-info);
|
|
157
|
+
}
|
|
119
158
|
:host([variant="success"]) ::slotted(.mui-icon) {
|
|
120
159
|
fill: var(--text-color-success);
|
|
121
160
|
}
|
|
@@ -135,28 +174,32 @@ class l extends HTMLElement {
|
|
|
135
174
|
</p>
|
|
136
175
|
`, this.setupSlotBehavior();
|
|
137
176
|
}
|
|
177
|
+
getLineClamp() {
|
|
178
|
+
const t = Number(this.getAttribute("clamp"));
|
|
179
|
+
return Number.isFinite(t) && t > 0 ? Math.floor(t) : 2;
|
|
180
|
+
}
|
|
138
181
|
setupSlotBehavior() {
|
|
139
182
|
if (!this.shadowRoot) return;
|
|
140
|
-
const t = this.shadowRoot.querySelector('slot[name="before"]'), e = this.shadowRoot.querySelector('slot[name="after"]'),
|
|
141
|
-
const a = (t == null ? void 0 : t.assignedElements({ flatten: !0 })) ?? [],
|
|
142
|
-
a.length > 0 ? this.setAttribute("has-before", "") : this.removeAttribute("has-before"),
|
|
183
|
+
const t = this.shadowRoot.querySelector('slot[name="before"]'), e = this.shadowRoot.querySelector('slot[name="after"]'), i = () => {
|
|
184
|
+
const a = (t == null ? void 0 : t.assignedElements({ flatten: !0 })) ?? [], o = (e == null ? void 0 : e.assignedElements({ flatten: !0 })) ?? [];
|
|
185
|
+
a.length > 0 ? this.setAttribute("has-before", "") : this.removeAttribute("has-before"), o.length > 0 ? this.setAttribute("has-after", "") : this.removeAttribute("has-after"), this.syncInlineSlotSizes([...a, ...o]);
|
|
143
186
|
};
|
|
144
|
-
t == null || t.addEventListener("slotchange",
|
|
187
|
+
t == null || t.addEventListener("slotchange", i), e == null || e.addEventListener("slotchange", i), i();
|
|
145
188
|
}
|
|
146
189
|
syncInlineSlotSizes(t) {
|
|
147
|
-
const
|
|
190
|
+
const i = {
|
|
148
191
|
"x-small": "x-small",
|
|
149
192
|
small: "small",
|
|
150
193
|
medium: "small",
|
|
151
194
|
large: "medium"
|
|
152
|
-
}[this.getAttribute("size") || "medium"] || "small",
|
|
195
|
+
}[this.getAttribute("size") || "medium"] || "small", o = {
|
|
153
196
|
"x-small": "xx-small",
|
|
154
197
|
small: "x-small",
|
|
155
198
|
medium: "small",
|
|
156
199
|
large: "medium"
|
|
157
200
|
}[this.getAttribute("size") || "medium"] || "small";
|
|
158
|
-
t.forEach((
|
|
159
|
-
|
|
201
|
+
t.forEach((s) => {
|
|
202
|
+
s.tagName.startsWith("MUI-ICON-") && s.setAttribute("size", i), s.tagName === "MUI-BADGE" && s.setAttribute("size", o);
|
|
160
203
|
});
|
|
161
204
|
}
|
|
162
205
|
waitForPartMap() {
|