@humuchen/mac-ui 0.0.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/README.md +940 -0
- package/dist/favicon.svg +1 -0
- package/dist/mac-ui.cjs.js +12367 -0
- package/dist/mac-ui.cjs.js.map +1 -0
- package/dist/mac-ui.es.js +18444 -0
- package/dist/mac-ui.es.js.map +1 -0
- package/dist/mac-ui.umd.js +12367 -0
- package/dist/mac-ui.umd.js.map +1 -0
- package/dist/types/components/alert/index.d.ts +1 -0
- package/dist/types/components/alert/mac-alert.d.ts +38 -0
- package/dist/types/components/alert/mac-alert.stories.d.ts +15 -0
- package/dist/types/components/animation/animations.d.ts +97 -0
- package/dist/types/components/animation/index.d.ts +3 -0
- package/dist/types/components/animation/mac-animation.d.ts +67 -0
- package/dist/types/components/animation/mac-animation.stories.d.ts +9 -0
- package/dist/types/components/button/index.d.ts +1 -0
- package/dist/types/components/button/mac-button.d.ts +37 -0
- package/dist/types/components/button/mac-button.stories.d.ts +14 -0
- package/dist/types/components/card/index.d.ts +1 -0
- package/dist/types/components/card/mac-card.d.ts +38 -0
- package/dist/types/components/card/mac-card.stories.d.ts +14 -0
- package/dist/types/components/carousel/index.d.ts +1 -0
- package/dist/types/components/carousel/mac-carousel.d.ts +105 -0
- package/dist/types/components/carousel/mac-carousel.stories.d.ts +18 -0
- package/dist/types/components/checkbox/index.d.ts +2 -0
- package/dist/types/components/checkbox/mac-checkbox.d.ts +94 -0
- package/dist/types/components/checkbox/mac-checkbox.stories.d.ts +17 -0
- package/dist/types/components/config-provider/index.d.ts +1 -0
- package/dist/types/components/config-provider/mac-config-provider.d.ts +23 -0
- package/dist/types/components/config-provider/mac-config-provider.stories.d.ts +12 -0
- package/dist/types/components/confirm/index.d.ts +2 -0
- package/dist/types/components/confirm/mac-confirm.d.ts +86 -0
- package/dist/types/components/confirm/mac-confirm.stories.d.ts +15 -0
- package/dist/types/components/data-table/index.d.ts +2 -0
- package/dist/types/components/data-table/mac-data-table.d.ts +212 -0
- package/dist/types/components/data-table/mac-data-table.stories.d.ts +18 -0
- package/dist/types/components/date-picker/date-picker-utils.d.ts +13 -0
- package/dist/types/components/date-picker/index.d.ts +3 -0
- package/dist/types/components/date-picker/mac-date-picker.d.ts +72 -0
- package/dist/types/components/date-picker/mac-date-picker.stories.d.ts +28 -0
- package/dist/types/components/date-picker/mac-date-range-picker.d.ts +58 -0
- package/dist/types/components/date-picker/mac-date-range-picker.stories.d.ts +13 -0
- package/dist/types/components/descriptions/mac-descriptions.d.ts +99 -0
- package/dist/types/components/descriptions/mac-descriptions.stories.d.ts +21 -0
- package/dist/types/components/desktop/index.d.ts +2 -0
- package/dist/types/components/desktop/mac-desktop.d.ts +88 -0
- package/dist/types/components/desktop/mac-desktop.stories.d.ts +17 -0
- package/dist/types/components/desktop-icon/index.d.ts +1 -0
- package/dist/types/components/desktop-icon/mac-desktop-icon.d.ts +46 -0
- package/dist/types/components/desktop-icon/mac-desktop-icon.stories.d.ts +8 -0
- package/dist/types/components/dock/index.d.ts +2 -0
- package/dist/types/components/dock/mac-dock-item.d.ts +37 -0
- package/dist/types/components/dock/mac-dock.d.ts +74 -0
- package/dist/types/components/dock/mac-dock.stories.d.ts +13 -0
- package/dist/types/components/drawer/mac-drawer.d.ts +87 -0
- package/dist/types/components/drawer/mac-drawer.stories.d.ts +15 -0
- package/dist/types/components/dropdown/index.d.ts +2 -0
- package/dist/types/components/dropdown/mac-dropdown.d.ts +77 -0
- package/dist/types/components/dropdown/mac-dropdown.stories.d.ts +13 -0
- package/dist/types/components/dynamic-tags/index.d.ts +1 -0
- package/dist/types/components/dynamic-tags/mac-dynamic-tags.d.ts +64 -0
- package/dist/types/components/dynamic-tags/mac-dynamic-tags.stories.d.ts +16 -0
- package/dist/types/components/form/index.d.ts +3 -0
- package/dist/types/components/form/mac-form-item.d.ts +67 -0
- package/dist/types/components/form/mac-form.d.ts +64 -0
- package/dist/types/components/form/mac-form.stories.d.ts +18 -0
- package/dist/types/components/group-button/index.d.ts +2 -0
- package/dist/types/components/group-button/mac-group-button.d.ts +50 -0
- package/dist/types/components/group-button/mac-group-button.stories.d.ts +13 -0
- package/dist/types/components/infinite-scroll/index.d.ts +1 -0
- package/dist/types/components/infinite-scroll/mac-infinite-scroll.d.ts +57 -0
- package/dist/types/components/infinite-scroll/mac-infinite-scroll.stories.d.ts +11 -0
- package/dist/types/components/input/index.d.ts +1 -0
- package/dist/types/components/input/mac-input.d.ts +73 -0
- package/dist/types/components/input/mac-input.stories.d.ts +19 -0
- package/dist/types/components/input-number/index.d.ts +1 -0
- package/dist/types/components/input-number/mac-input-number.d.ts +81 -0
- package/dist/types/components/input-number/mac-input-number.stories.d.ts +18 -0
- package/dist/types/components/lazy-image/index.d.ts +1 -0
- package/dist/types/components/lazy-image/mac-lazy-image.d.ts +86 -0
- package/dist/types/components/lazy-image/mac-lazy-image.stories.d.ts +15 -0
- package/dist/types/components/menu/index.d.ts +2 -0
- package/dist/types/components/menu/mac-menu.d.ts +63 -0
- package/dist/types/components/menu/mac-menu.stories.d.ts +11 -0
- package/dist/types/components/modal/index.d.ts +1 -0
- package/dist/types/components/modal/mac-modal.d.ts +96 -0
- package/dist/types/components/modal/mac-modal.stories.d.ts +12 -0
- package/dist/types/components/number-animation/mac-number-animation.d.ts +64 -0
- package/dist/types/components/number-animation/mac-number-animation.stories.d.ts +15 -0
- package/dist/types/components/popconfirm/mac-popconfirm.d.ts +77 -0
- package/dist/types/components/popconfirm/mac-popconfirm.stories.d.ts +14 -0
- package/dist/types/components/progress/index.d.ts +1 -0
- package/dist/types/components/progress/mac-progress.d.ts +76 -0
- package/dist/types/components/progress/mac-progress.stories.d.ts +25 -0
- package/dist/types/components/radio/index.d.ts +2 -0
- package/dist/types/components/radio/mac-radio.d.ts +90 -0
- package/dist/types/components/radio/mac-radio.stories.d.ts +17 -0
- package/dist/types/components/rating/mac-rating.d.ts +56 -0
- package/dist/types/components/rating/mac-rating.stories.d.ts +15 -0
- package/dist/types/components/select/index.d.ts +1 -0
- package/dist/types/components/select/mac-select.d.ts +97 -0
- package/dist/types/components/select/mac-select.stories.d.ts +18 -0
- package/dist/types/components/split/index.d.ts +1 -0
- package/dist/types/components/split/mac-split.d.ts +69 -0
- package/dist/types/components/split/mac-split.stories.d.ts +13 -0
- package/dist/types/components/tabs/mac-tabs.d.ts +119 -0
- package/dist/types/components/tabs/mac-tabs.stories.d.ts +15 -0
- package/dist/types/components/tag/index.d.ts +1 -0
- package/dist/types/components/tag/mac-tag.d.ts +40 -0
- package/dist/types/components/tag/mac-tag.stories.d.ts +20 -0
- package/dist/types/components/text-ellipsis/mac-text-ellipsis.d.ts +47 -0
- package/dist/types/components/text-ellipsis/mac-text-ellipsis.stories.d.ts +15 -0
- package/dist/types/components/tree/index.d.ts +2 -0
- package/dist/types/components/tree/mac-tree.d.ts +79 -0
- package/dist/types/components/tree/mac-tree.stories.d.ts +12 -0
- package/dist/types/components/tree-select/index.d.ts +2 -0
- package/dist/types/components/tree-select/mac-tree-select.d.ts +59 -0
- package/dist/types/components/tree-select/mac-tree-select.stories.d.ts +19 -0
- package/dist/types/internal/base-element.d.ts +18 -0
- package/dist/types/internal/property-converters.d.ts +7 -0
- package/dist/types/mac-ui.d.ts +60 -0
- package/dist/types/styles/shared-styles.d.ts +2 -0
- package/dist/types/styles/theme.d.ts +11 -0
- package/dist/types/test/setup.d.ts +1 -0
- package/package.json +86 -0
package/README.md
ADDED
|
@@ -0,0 +1,940 @@
|
|
|
1
|
+
## Features
|
|
2
|
+
|
|
3
|
+
- **Framework Agnostic** — Web Components work with React, Vue, Angular, Svelte, or vanilla JS
|
|
4
|
+
- **TypeScript First** — Full type declarations included
|
|
5
|
+
- **Theme System** — CSS custom properties for easy customization
|
|
6
|
+
- **Multiple Formats** — ESM, CommonJS, and UMD outputs
|
|
7
|
+
- **Accessible** — Built with ARIA best practices and keyboard navigation
|
|
8
|
+
- **Lightweight** — Tree-shakeable, only import what you need
|
|
9
|
+
|
|
10
|
+
https://humuchen.github.io/mac-ui/?path=/docs/components-alert--docs
|
|
11
|
+
|
|
12
|
+
## Installation
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
npm install @hy/mac-ui
|
|
16
|
+
# or
|
|
17
|
+
pnpm add @hy/mac-ui
|
|
18
|
+
# or
|
|
19
|
+
yarn add @hy/mac-ui
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
Peer dependency: `lit@^3.0.0`
|
|
23
|
+
|
|
24
|
+
## Quick Start
|
|
25
|
+
|
|
26
|
+
### Import All Components
|
|
27
|
+
|
|
28
|
+
```js
|
|
29
|
+
import '@hy/mac-ui'
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### Import Specific Components
|
|
33
|
+
|
|
34
|
+
```js
|
|
35
|
+
import '@hy/mac-ui'
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### Use in HTML
|
|
39
|
+
|
|
40
|
+
```html
|
|
41
|
+
<mac-button variant="primary" size="md">Click Me</mac-button>
|
|
42
|
+
|
|
43
|
+
<mac-card hoverable>
|
|
44
|
+
<div slot="header">Card Title</div>
|
|
45
|
+
<p>Card content goes here.</p>
|
|
46
|
+
<div slot="footer">Footer</div>
|
|
47
|
+
</mac-card>
|
|
48
|
+
|
|
49
|
+
<mac-input label="Email" required placeholder="you@example.com"></mac-input>
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### Use in TypeScript
|
|
53
|
+
|
|
54
|
+
```ts
|
|
55
|
+
import { MacButton, MacCard, MacInput } from '@hy/mac-ui'
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Components
|
|
59
|
+
|
|
60
|
+
### MacButton
|
|
61
|
+
|
|
62
|
+
A versatile button component with multiple variants and sizes.
|
|
63
|
+
|
|
64
|
+
| Property | Type | Default | Description |
|
|
65
|
+
| ---------- | ------------------------------------ | ----------- | ----------------------- |
|
|
66
|
+
| `variant` | `'primary' \| 'secondary' \| 'text'` | `'primary'` | Button style variant |
|
|
67
|
+
| `size` | `'sm' \| 'md' \| 'lg'` | `'md'` | Button size |
|
|
68
|
+
| `disabled` | `boolean` | `false` | Disables the button |
|
|
69
|
+
| `loading` | `boolean` | `false` | Shows a loading spinner |
|
|
70
|
+
| `type` | `'button' \| 'submit' \| 'reset'` | `'button'` | Native button type |
|
|
71
|
+
|
|
72
|
+
**Slots:** default (label), `prefix`, `suffix`
|
|
73
|
+
|
|
74
|
+
**Events:** `mac-click`
|
|
75
|
+
|
|
76
|
+
**CSS Parts:** `base`, `label`, `prefix`, `suffix`
|
|
77
|
+
|
|
78
|
+
```html
|
|
79
|
+
<mac-button variant="primary">Primary</mac-button>
|
|
80
|
+
<mac-button variant="secondary">Secondary</mac-button>
|
|
81
|
+
<mac-button variant="text">Text</mac-button>
|
|
82
|
+
<mac-button size="sm">Small</mac-button>
|
|
83
|
+
<mac-button size="lg">Large</mac-button>
|
|
84
|
+
<mac-button loading>Loading</mac-button>
|
|
85
|
+
<mac-button disabled>Disabled</mac-button>
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### MacCard
|
|
89
|
+
|
|
90
|
+
A card container with header, body, footer, and media slots.
|
|
91
|
+
|
|
92
|
+
| Property | Type | Default | Description |
|
|
93
|
+
| ----------- | --------- | ------- | -------------------------- |
|
|
94
|
+
| `hoverable` | `boolean` | `false` | Enable hover shadow effect |
|
|
95
|
+
| `bordered` | `boolean` | `true` | Show border |
|
|
96
|
+
|
|
97
|
+
**Slots:** default (body), `header`, `footer`, `media`
|
|
98
|
+
|
|
99
|
+
**CSS Parts:** `base`, `header`, `body`, `footer`, `media`
|
|
100
|
+
|
|
101
|
+
```html
|
|
102
|
+
<mac-card>
|
|
103
|
+
<div slot="header">Title</div>
|
|
104
|
+
Body content
|
|
105
|
+
<div slot="footer">Footer</div>
|
|
106
|
+
</mac-card>
|
|
107
|
+
|
|
108
|
+
<mac-card hoverable> Hoverable card </mac-card>
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
### MacInput
|
|
112
|
+
|
|
113
|
+
A text input with label, validation, and helper text support.
|
|
114
|
+
|
|
115
|
+
| Property | Type | Default | Description |
|
|
116
|
+
| ------------- | --------------------------------------------------------------- | -------- | ----------------------- |
|
|
117
|
+
| `value` | `string` | `''` | Input value |
|
|
118
|
+
| `placeholder` | `string` | `''` | Placeholder text |
|
|
119
|
+
| `type` | `'text' \| 'password' \| 'email' \| 'number' \| 'tel' \| 'url'` | `'text'` | Input type |
|
|
120
|
+
| `size` | `'sm' \| 'md' \| 'lg'` | `'md'` | Input size |
|
|
121
|
+
| `label` | `string` | `''` | Label text |
|
|
122
|
+
| `required` | `boolean` | `false` | Show required indicator |
|
|
123
|
+
| `disabled` | `boolean` | `false` | Disable the input |
|
|
124
|
+
| `readonly` | `boolean` | `false` | Make read-only |
|
|
125
|
+
| `error` | `boolean` | `false` | Error state |
|
|
126
|
+
| `helper-text` | `string` | `''` | Helper text below input |
|
|
127
|
+
| `name` | `string` | `''` | Form field name |
|
|
128
|
+
|
|
129
|
+
**Slots:** `prefix`, `suffix`
|
|
130
|
+
|
|
131
|
+
**Events:** `mac-input`, `mac-focus`, `mac-blur`
|
|
132
|
+
|
|
133
|
+
**CSS Parts:** `base`, `input`, `label`, `helper-text`
|
|
134
|
+
|
|
135
|
+
**Methods:** `focus()`, `blur()`
|
|
136
|
+
|
|
137
|
+
```html
|
|
138
|
+
<mac-input label="Username" placeholder="Enter username"></mac-input>
|
|
139
|
+
<mac-input label="Email" required error helper-text="Invalid email"></mac-input>
|
|
140
|
+
<mac-input label="Password" type="password" helper-text="Min 8 characters"></mac-input>
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
### MacConfigProvider
|
|
144
|
+
|
|
145
|
+
A configuration provider that passes theme and size settings to all child components.
|
|
146
|
+
|
|
147
|
+
| Property | Type | Default | Description |
|
|
148
|
+
| -------- | ---------------------- | --------- | --------------------------------- |
|
|
149
|
+
| `theme` | `'light' \| 'dark'` | `'light'` | Global theme for child components |
|
|
150
|
+
| `size` | `'sm' \| 'md' \| 'lg'` | `'md'` | Global size for child components |
|
|
151
|
+
|
|
152
|
+
**Slots:** default (child components)
|
|
153
|
+
|
|
154
|
+
```html
|
|
155
|
+
<mac-config-provider theme="dark" size="lg">
|
|
156
|
+
<mac-button>Large Dark Button</mac-button>
|
|
157
|
+
<mac-input label="Name"></mac-input>
|
|
158
|
+
</mac-config-provider>
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
### MacLazyImage
|
|
162
|
+
|
|
163
|
+
A lazy-loading image component with placeholder, error states, hover animation, and click-to-preview.
|
|
164
|
+
|
|
165
|
+
| Property | Type | Default | Description |
|
|
166
|
+
| ------------- | ---------------------------------------------------------- | --------- | ------------------------------- |
|
|
167
|
+
| `src` | `string` | `''` | Image source URL |
|
|
168
|
+
| `alt` | `string` | `''` | Image alt text |
|
|
169
|
+
| `width` | `string` | — | Image width |
|
|
170
|
+
| `height` | `string` | — | Image height |
|
|
171
|
+
| `object-fit` | `'cover' \| 'contain' \| 'fill' \| 'none' \| 'scale-down'` | `'cover'` | CSS object-fit value |
|
|
172
|
+
| `placeholder` | `string` | — | Placeholder image URL |
|
|
173
|
+
| `root-margin` | `string` | `'0px'` | IntersectionObserver rootMargin |
|
|
174
|
+
| `threshold` | `number` | `0` | IntersectionObserver threshold |
|
|
175
|
+
| `preview` | `boolean` | `false` | Enable click-to-preview |
|
|
176
|
+
| `preview-src` | `string` | `''` | Custom preview image URL |
|
|
177
|
+
|
|
178
|
+
**Slots:** `placeholder`, `error`
|
|
179
|
+
|
|
180
|
+
**Events:** `mac-load`, `mac-error`, `mac-preview-open`, `mac-preview-close`
|
|
181
|
+
|
|
182
|
+
**CSS Parts:** `image`, `placeholder`, `error`, `preview-overlay`, `preview-image`
|
|
183
|
+
|
|
184
|
+
**CSS Properties:** `--md-lazy-image-hover-scale`, `--md-lazy-image-hover-duration`, `--md-lazy-image-hover-easing`, `--md-lazy-image-hover-filter`, `--md-lazy-image-preview-bg`, `--md-lazy-image-preview-duration`
|
|
185
|
+
|
|
186
|
+
```html
|
|
187
|
+
<mac-lazy-image src="photo.jpg" alt="Photo" width="400px" height="300px"></mac-lazy-image>
|
|
188
|
+
|
|
189
|
+
<mac-lazy-image
|
|
190
|
+
src="thumb.jpg"
|
|
191
|
+
preview
|
|
192
|
+
preview-src="full.jpg"
|
|
193
|
+
width="200px"
|
|
194
|
+
height="150px"
|
|
195
|
+
></mac-lazy-image>
|
|
196
|
+
|
|
197
|
+
<mac-lazy-image
|
|
198
|
+
src="photo.jpg"
|
|
199
|
+
width="300px"
|
|
200
|
+
height="200px"
|
|
201
|
+
style="--md-lazy-image-hover-scale: 1.1;"
|
|
202
|
+
></mac-lazy-image>
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
### MacAlert
|
|
206
|
+
|
|
207
|
+
A contextual alert message component with multiple status types.
|
|
208
|
+
|
|
209
|
+
| Property | Type | Default | Description |
|
|
210
|
+
| ----------- | ----------------------------------------------------------------------- | ----------- | ----------------- |
|
|
211
|
+
| `type` | `'default' \| 'primary' \| 'success' \| 'warning' \| 'error' \| 'info'` | `'default'` | Alert status type |
|
|
212
|
+
| `title` | `string` | `''` | Alert title |
|
|
213
|
+
| `closable` | `boolean` | `false` | Show close button |
|
|
214
|
+
| `show-icon` | `boolean` | `true` | Show status icon |
|
|
215
|
+
|
|
216
|
+
**Slots:** default (content)
|
|
217
|
+
|
|
218
|
+
**Events:** `mac-close`
|
|
219
|
+
|
|
220
|
+
```html
|
|
221
|
+
<mac-alert type="success" title="Success">Your changes have been saved.</mac-alert>
|
|
222
|
+
<mac-alert type="warning" closable>This action cannot be undone.</mac-alert>
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
### MacConfirm
|
|
226
|
+
|
|
227
|
+
A confirm dialog component for user confirmation actions.
|
|
228
|
+
|
|
229
|
+
| Property | Type | Default | Description |
|
|
230
|
+
| -------------- | --------- | -------- | -------------------- |
|
|
231
|
+
| `title` | `string` | `''` | Confirm title |
|
|
232
|
+
| `content` | `string` | `''` | Confirm content |
|
|
233
|
+
| `confirm-text` | `string` | `'确认'` | Confirm button text |
|
|
234
|
+
| `cancel-text` | `string` | `'取消'` | Cancel button text |
|
|
235
|
+
| `danger` | `boolean` | `false` | Danger style confirm |
|
|
236
|
+
| `icon` | `boolean` | `true` | Show warning icon |
|
|
237
|
+
|
|
238
|
+
**Events:** `mac-confirm`, `mac-cancel`
|
|
239
|
+
|
|
240
|
+
```html
|
|
241
|
+
<mac-confirm title="Delete?" content="This cannot be undone." danger>
|
|
242
|
+
<mac-button variant="text" danger>Delete</mac-button>
|
|
243
|
+
</mac-confirm>
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
### MacModal
|
|
247
|
+
|
|
248
|
+
A macOS-style modal/dialog with title bar and customizable footer.
|
|
249
|
+
|
|
250
|
+
| Property | Type | Default | Description |
|
|
251
|
+
| --------------- | --------- | --------- | ------------------------- |
|
|
252
|
+
| `title` | `string` | `''` | Modal title |
|
|
253
|
+
| `open` | `boolean` | `false` | Whether the modal is open |
|
|
254
|
+
| `closable` | `boolean` | `true` | Show close button |
|
|
255
|
+
| `mask-closable` | `boolean` | `true` | Click mask to close |
|
|
256
|
+
| `show-mask` | `boolean` | `true` | Show overlay mask |
|
|
257
|
+
| `width` | `string` | `'520px'` | Modal width |
|
|
258
|
+
| `footer` | `boolean` | `true` | Show footer with buttons |
|
|
259
|
+
| `centered` | `boolean` | `false` | Center modal vertically |
|
|
260
|
+
|
|
261
|
+
**Slots:** default (body), `header`, `footer`
|
|
262
|
+
|
|
263
|
+
**Events:** `mac-modal-open`, `mac-modal-close`, `mac-modal-confirm`, `mac-modal-cancel`
|
|
264
|
+
|
|
265
|
+
**CSS Parts:** `base`, `mask`, `container`, `header`, `body`, `footer`
|
|
266
|
+
|
|
267
|
+
```html
|
|
268
|
+
<mac-modal title="Settings" open>
|
|
269
|
+
<p>Modal content here.</p>
|
|
270
|
+
<div slot="footer">
|
|
271
|
+
<mac-button variant="text">Cancel</mac-button>
|
|
272
|
+
<mac-button variant="primary">Save</mac-button>
|
|
273
|
+
</div>
|
|
274
|
+
</mac-modal>
|
|
275
|
+
```
|
|
276
|
+
|
|
277
|
+
### MacDrawer
|
|
278
|
+
|
|
279
|
+
A macOS-style drawer that slides in from the edge of the viewport.
|
|
280
|
+
|
|
281
|
+
| Property | Type | Default | Description |
|
|
282
|
+
| --------------- | ---------------------------------------- | --------- | -------------------------- |
|
|
283
|
+
| `open` | `boolean` | `false` | Whether the drawer is open |
|
|
284
|
+
| `placement` | `'top' \| 'right' \| 'bottom' \| 'left'` | `'right'` | Slide-in direction |
|
|
285
|
+
| `title` | `string` | `''` | Drawer title |
|
|
286
|
+
| `width` | `string` | `'360px'` | Drawer width |
|
|
287
|
+
| `height` | `string` | `'360px'` | Drawer height |
|
|
288
|
+
| `closable` | `boolean` | `true` | Show close button |
|
|
289
|
+
| `mask-closable` | `boolean` | `true` | Click mask to close |
|
|
290
|
+
| `show-mask` | `boolean \| 'transparent'` | `true` | Show overlay mask |
|
|
291
|
+
| `close-on-esc` | `boolean` | `true` | Close on Escape key |
|
|
292
|
+
| `resizable` | `boolean` | `false` | Enable resizing |
|
|
293
|
+
| `min-width` | `string` | `'200px'` | Minimum width |
|
|
294
|
+
| `max-width` | `string` | `'80vw'` | Maximum width |
|
|
295
|
+
| `min-height` | `string` | `'200px'` | Minimum height |
|
|
296
|
+
| `max-height` | `string` | `'80vh'` | Maximum height |
|
|
297
|
+
|
|
298
|
+
**Slots:** default (content), `header`, `footer`
|
|
299
|
+
|
|
300
|
+
**Events:** `mac-drawer-open`, `mac-drawer-close`, `mac-drawer-after-open`, `mac-drawer-after-close`
|
|
301
|
+
|
|
302
|
+
```html
|
|
303
|
+
<mac-drawer title="Notifications" placement="right" .open="${true}">
|
|
304
|
+
<p>Notification list here.</p>
|
|
305
|
+
<div slot="footer">
|
|
306
|
+
<mac-button>Mark all read</mac-button>
|
|
307
|
+
</div>
|
|
308
|
+
</mac-drawer>
|
|
309
|
+
```
|
|
310
|
+
|
|
311
|
+
### MacDock
|
|
312
|
+
|
|
313
|
+
A macOS-style dock with Liquid Glass background, magnification effect, and drag-to-remove.
|
|
314
|
+
|
|
315
|
+
| Property | Type | Default | Description |
|
|
316
|
+
| --------------- | ------------------------------- | ---------- | ---------------------------- |
|
|
317
|
+
| `magnification` | `number` | `1.6` | Magnification scale on hover |
|
|
318
|
+
| `iconSize` | `number` | `48` | Base icon size (px) |
|
|
319
|
+
| `magnifyRange` | `number` | `120` | Magnification range (px) |
|
|
320
|
+
| `position` | `'bottom' \| 'left' \| 'right'` | `'bottom'` | Dock position |
|
|
321
|
+
|
|
322
|
+
**Slots:** default (mac-dock-item elements), `separator`
|
|
323
|
+
|
|
324
|
+
**Events:** `mac-dock-item-click`, `mac-dock-item-remove`
|
|
325
|
+
|
|
326
|
+
**CSS Parts:** `base`, `glass`, `items`
|
|
327
|
+
|
|
328
|
+
### MacDockItem
|
|
329
|
+
|
|
330
|
+
A dock item with icon, label, and bounce animation.
|
|
331
|
+
|
|
332
|
+
| Property | Type | Default | Description |
|
|
333
|
+
| ---------- | --------- | ----------- | ----------------------------- |
|
|
334
|
+
| `itemId` | `string` | `''` | Unique item identifier |
|
|
335
|
+
| `label` | `string` | `''` | Tooltip label |
|
|
336
|
+
| `color` | `string` | `'#007AFF'` | Default icon background color |
|
|
337
|
+
| `running` | `boolean` | `false` | Show running indicator dot |
|
|
338
|
+
| `bouncing` | `boolean` | `false` | Trigger bounce animation |
|
|
339
|
+
|
|
340
|
+
**Slots:** default (icon content)
|
|
341
|
+
|
|
342
|
+
**Events:** `mac-dock-item-click`
|
|
343
|
+
|
|
344
|
+
**CSS Parts:** `base`, `icon`, `label`, `indicator`
|
|
345
|
+
|
|
346
|
+
```html
|
|
347
|
+
<mac-dock>
|
|
348
|
+
<mac-dock-item item-id="finder" label="Finder" color="#007AFF">
|
|
349
|
+
<img src="finder-icon.svg" />
|
|
350
|
+
</mac-dock-item>
|
|
351
|
+
<mac-dock-item item-id="safari" label="Safari" color="#34C759" running>
|
|
352
|
+
<img src="safari-icon.svg" />
|
|
353
|
+
</mac-dock-item>
|
|
354
|
+
</mac-dock>
|
|
355
|
+
```
|
|
356
|
+
|
|
357
|
+
### MacDesktop
|
|
358
|
+
|
|
359
|
+
A macOS-style desktop container with icon layout, drag management, and integrated dock.
|
|
360
|
+
|
|
361
|
+
| Property | Type | Default | Description |
|
|
362
|
+
| ----------- | ---------------------------- | ------------ | ----------------------------- |
|
|
363
|
+
| `layout` | `'vertical' \| 'horizontal'` | `'vertical'` | Icon layout direction |
|
|
364
|
+
| `cellSize` | `number` | `90` | Grid cell size (px) |
|
|
365
|
+
| `spacing` | `number` | `8` | Spacing between icons (px) |
|
|
366
|
+
| `padding` | `number` | `16` | Padding around icon area (px) |
|
|
367
|
+
| `wallpaper` | `string` | `''` | Wallpaper image URL |
|
|
368
|
+
| `showDock` | `boolean` | `true` | Show dock area |
|
|
369
|
+
|
|
370
|
+
**Slots:** default (mac-desktop-icon elements), `wallpaper`, `dock`
|
|
371
|
+
|
|
372
|
+
**Events:** `mac-layout-change`, `mac-icons-reorder`
|
|
373
|
+
|
|
374
|
+
**CSS Parts:** `base`, `wallpaper`, `dock`
|
|
375
|
+
|
|
376
|
+
### MacDesktopIcon
|
|
377
|
+
|
|
378
|
+
A desktop icon with selection state.
|
|
379
|
+
|
|
380
|
+
| Property | Type | Default | Description |
|
|
381
|
+
| ---------- | --------- | ------- | ---------------------- |
|
|
382
|
+
| `iconId` | `string` | auto | Unique icon identifier |
|
|
383
|
+
| `label` | `string` | `''` | Icon label text |
|
|
384
|
+
| `selected` | `boolean` | `false` | Selection state |
|
|
385
|
+
| `dragging` | `boolean` | `false` | Dragging state |
|
|
386
|
+
|
|
387
|
+
**Slots:** default (icon content)
|
|
388
|
+
|
|
389
|
+
**Events:** `mac-icon-dblclick`
|
|
390
|
+
|
|
391
|
+
**CSS Parts:** `base`, `icon`, `label`
|
|
392
|
+
|
|
393
|
+
```html
|
|
394
|
+
<mac-desktop wallpaper="bg.jpg">
|
|
395
|
+
<mac-desktop-icon icon-id="app1" label="My App">
|
|
396
|
+
<img src="app-icon.svg" />
|
|
397
|
+
</mac-desktop-icon>
|
|
398
|
+
</mac-desktop>
|
|
399
|
+
```
|
|
400
|
+
|
|
401
|
+
### MacDropdown
|
|
402
|
+
|
|
403
|
+
A dropdown menu component with macOS-style design.
|
|
404
|
+
|
|
405
|
+
| Property | Type | Default | Description |
|
|
406
|
+
| --------------- | ------------------------------------------------------------ | ---------------- | ------------------------ |
|
|
407
|
+
| `items` | `DropdownItem[]` | `[]` | Menu items |
|
|
408
|
+
| `placement` | `'bottom-start' \| 'bottom-end' \| 'top-start' \| 'top-end'` | `'bottom-start'` | Menu placement |
|
|
409
|
+
| `value` | `string` | `''` | Currently selected value |
|
|
410
|
+
| `disabled` | `boolean` | `false` | Disable the dropdown |
|
|
411
|
+
| `open-on-hover` | `boolean` | `false` | Open on hover |
|
|
412
|
+
| `hover-delay` | `number` | `150` | Hover delay (ms) |
|
|
413
|
+
| `trigger` | `'click' \| 'contextmenu' \| 'both'` | `'click'` | Trigger mode |
|
|
414
|
+
|
|
415
|
+
**Slots:** `trigger`
|
|
416
|
+
|
|
417
|
+
**CSS Parts:** `base`, `menu`, `item`
|
|
418
|
+
|
|
419
|
+
```html
|
|
420
|
+
<mac-dropdown .items=${[
|
|
421
|
+
{ value: 'copy', label: 'Copy' },
|
|
422
|
+
{ value: 'paste', label: 'Paste' },
|
|
423
|
+
{ value: 'delete', label: 'Delete', danger: true }
|
|
424
|
+
]}>
|
|
425
|
+
<mac-button slot="trigger">Menu</mac-button>
|
|
426
|
+
</mac-dropdown>
|
|
427
|
+
```
|
|
428
|
+
|
|
429
|
+
### MacSelect
|
|
430
|
+
|
|
431
|
+
A select dropdown component with macOS-style design.
|
|
432
|
+
|
|
433
|
+
| Property | Type | Default | Description |
|
|
434
|
+
| ------------- | ---------------------------------- | -------------------- | ------------------------ |
|
|
435
|
+
| `value` | `string \| string[]` | `''` | Selected value(s) |
|
|
436
|
+
| `placeholder` | `string` | `'Select an option'` | Placeholder text |
|
|
437
|
+
| `options` | `SelectOption[]` | `[]` | Options list |
|
|
438
|
+
| `groups` | `OptionGroup[]` | `[]` | Grouped options |
|
|
439
|
+
| `size` | `'sm' \| 'md' \| 'lg'` | — | Component size |
|
|
440
|
+
| `variant` | `'default' \| 'filled' \| 'glass'` | `'default'` | Visual variant |
|
|
441
|
+
| `label` | `string` | `''` | Label text |
|
|
442
|
+
| `required` | `boolean` | `false` | Required indicator |
|
|
443
|
+
| `disabled` | `boolean` | `false` | Disable the select |
|
|
444
|
+
| `error` | `boolean` | `false` | Error state |
|
|
445
|
+
| `success` | `boolean` | `false` | Success state |
|
|
446
|
+
| `helper-text` | `string` | `''` | Helper text below input |
|
|
447
|
+
| `multiple` | `boolean` | `false` | Allow multiple selection |
|
|
448
|
+
| `clearable` | `boolean` | `false` | Show clear button |
|
|
449
|
+
| `searchable` | `boolean` | `false` | Enable search/filter |
|
|
450
|
+
|
|
451
|
+
**Events:** `mac-change`, `mac-focus`, `mac-blur`
|
|
452
|
+
|
|
453
|
+
**CSS Parts:** `base`, `trigger`, `dropdown`, `option`
|
|
454
|
+
|
|
455
|
+
```html
|
|
456
|
+
<mac-select label="Country" placeholder="Select a country" .options=${[
|
|
457
|
+
{ value: 'us', label: 'United States' },
|
|
458
|
+
{ value: 'cn', label: 'China' },
|
|
459
|
+
{ value: 'jp', label: 'Japan' }
|
|
460
|
+
]}></mac-select>
|
|
461
|
+
```
|
|
462
|
+
|
|
463
|
+
### MacGroupButton
|
|
464
|
+
|
|
465
|
+
A macOS-style segmented control component.
|
|
466
|
+
|
|
467
|
+
| Property | Type | Default | Description |
|
|
468
|
+
| ---------- | ---------------------- | ------- | ------------------- |
|
|
469
|
+
| `items` | `GroupButtonItem[]` | `[]` | Button items |
|
|
470
|
+
| `value` | `string` | `''` | Selected value |
|
|
471
|
+
| `size` | `'sm' \| 'md' \| 'lg'` | — | Component size |
|
|
472
|
+
| `disabled` | `boolean` | `false` | Disable the control |
|
|
473
|
+
|
|
474
|
+
**Events:** `mac-change`
|
|
475
|
+
|
|
476
|
+
**CSS Parts:** `container`, `slider`, `button`
|
|
477
|
+
|
|
478
|
+
```html
|
|
479
|
+
<mac-group-button .items=${[
|
|
480
|
+
{ value: 'day', label: 'Day' },
|
|
481
|
+
{ value: 'week', label: 'Week' },
|
|
482
|
+
{ value: 'month', label: 'Month' }
|
|
483
|
+
]} value="day"></mac-group-button>
|
|
484
|
+
```
|
|
485
|
+
|
|
486
|
+
### MacTabs
|
|
487
|
+
|
|
488
|
+
A macOS-style tabs component with animated indicator.
|
|
489
|
+
|
|
490
|
+
| Property | Type | Default | Description |
|
|
491
|
+
| --------------- | ------------------------------- | --------- | ------------------------------------------ |
|
|
492
|
+
| `type` | `'line' \| 'card' \| 'segment'` | `'line'` | Tabs style |
|
|
493
|
+
| `size` | `'sm' \| 'md' \| 'lg'` | — | Component size |
|
|
494
|
+
| `value` | `string` | `''` | Active tab key |
|
|
495
|
+
| `default-value` | `string` | `''` | Default active tab key |
|
|
496
|
+
| `closable` | `boolean` | `false` | Show close button on tabs |
|
|
497
|
+
| `addable` | `boolean` | `false` | Show add button |
|
|
498
|
+
| `animated` | `boolean` | `true` | Enable indicator animation |
|
|
499
|
+
| `trigger` | `'click' \| 'hover'` | `'click'` | Tab switching trigger |
|
|
500
|
+
| `items` | `TabItem[]` | `[]` | Tab items (key, label, disabled, closable) |
|
|
501
|
+
|
|
502
|
+
**Slots:** default (mac-tab-pane elements), `prefix`, `suffix`
|
|
503
|
+
|
|
504
|
+
**Events:** `mac-tabs-change`, `mac-tabs-close`, `mac-tabs-add`
|
|
505
|
+
|
|
506
|
+
```html
|
|
507
|
+
<mac-tabs .items=${[
|
|
508
|
+
{ key: 'general', label: 'General' },
|
|
509
|
+
{ key: 'security', label: 'Security' },
|
|
510
|
+
{ key: 'about', label: 'About' }
|
|
511
|
+
]} value="general">
|
|
512
|
+
<mac-tab-pane tab-key="general">General settings</mac-tab-pane>
|
|
513
|
+
<mac-tab-pane tab-key="security">Security settings</mac-tab-pane>
|
|
514
|
+
</mac-tabs>
|
|
515
|
+
```
|
|
516
|
+
|
|
517
|
+
### MacTree / MacTreeSelect
|
|
518
|
+
|
|
519
|
+
**MacTree** — A tree component for displaying hierarchical data with expand/collapse, selection, and checkbox support.
|
|
520
|
+
|
|
521
|
+
| Property | Type | Default | Description |
|
|
522
|
+
| -------------------- | ---------------- | ------- | ------------------------ |
|
|
523
|
+
| `data` | `TreeNodeData[]` | `[]` | Tree data array |
|
|
524
|
+
| `checkable` | `boolean` | `false` | Show checkboxes |
|
|
525
|
+
| `multiple` | `boolean` | `false` | Allow multiple selection |
|
|
526
|
+
| `selectable` | `boolean` | `true` | Nodes are selectable |
|
|
527
|
+
| `show-line` | `boolean` | `false` | Show connecting lines |
|
|
528
|
+
| `block-node` | `boolean` | `true` | Whole row clickable |
|
|
529
|
+
| `default-expand-all` | `boolean` | `false` | Expand all by default |
|
|
530
|
+
| `expandedKeys` | `string[]` | `[]` | Controlled expanded keys |
|
|
531
|
+
| `selectedKeys` | `string[]` | `[]` | Controlled selected keys |
|
|
532
|
+
| `checkedKeys` | `string[]` | `[]` | Controlled checked keys |
|
|
533
|
+
|
|
534
|
+
**Events:** `mac-expand`, `mac-select`, `mac-check`
|
|
535
|
+
|
|
536
|
+
```html
|
|
537
|
+
<mac-tree
|
|
538
|
+
.data=${[
|
|
539
|
+
{
|
|
540
|
+
key: '1',
|
|
541
|
+
label: 'Documents',
|
|
542
|
+
children: [
|
|
543
|
+
{ key: '1-1', label: 'Work' },
|
|
544
|
+
{ key: '1-2', label: 'Personal' },
|
|
545
|
+
],
|
|
546
|
+
},
|
|
547
|
+
{ key: '2', label: 'Downloads' },
|
|
548
|
+
]}
|
|
549
|
+
checkable
|
|
550
|
+
default-expand-all
|
|
551
|
+
></mac-tree>
|
|
552
|
+
```
|
|
553
|
+
|
|
554
|
+
**MacTreeSelect** — A select component with tree dropdown for single or multiple selection.
|
|
555
|
+
|
|
556
|
+
| Property | Type | Default | Description |
|
|
557
|
+
| -------------------- | -------------------- | ------- | --------------------- |
|
|
558
|
+
| `options` | `TreeOption[]` | `[]` | Tree options |
|
|
559
|
+
| `value` | `string \| string[]` | `''` | Selected value(s) |
|
|
560
|
+
| `multiple` | `boolean` | `false` | Multiple selection |
|
|
561
|
+
| `checkable` | `boolean` | `false` | Show checkboxes |
|
|
562
|
+
| `searchable` | `boolean` | `false` | Enable search |
|
|
563
|
+
| `clearable` | `boolean` | `false` | Show clear button |
|
|
564
|
+
| `default-expand-all` | `boolean` | `false` | Expand all by default |
|
|
565
|
+
|
|
566
|
+
**Events:** `mac-change`
|
|
567
|
+
|
|
568
|
+
```html
|
|
569
|
+
<mac-tree-select
|
|
570
|
+
placeholder="Select folder"
|
|
571
|
+
.options=${[
|
|
572
|
+
{ value: '1', label: 'Documents', children: [{ value: '1-1', label: 'Work' }] },
|
|
573
|
+
]}
|
|
574
|
+
></mac-tree-select>
|
|
575
|
+
```
|
|
576
|
+
|
|
577
|
+
### MacCarousel / MacCarouselItem
|
|
578
|
+
|
|
579
|
+
A carousel/slider component with dot/line indicators and arrow navigation.
|
|
580
|
+
|
|
581
|
+
| Property | Type | Default | Description |
|
|
582
|
+
| ----------- | ------------------------------- | --------- | ----------------------- |
|
|
583
|
+
| `autoplay` | `boolean` | `false` | Auto-play slides |
|
|
584
|
+
| `interval` | `number` | `3000` | Auto-play interval (ms) |
|
|
585
|
+
| `indicator` | `'dot' \| 'line' \| 'none'` | `'dot'` | Indicator type |
|
|
586
|
+
| `arrow` | `'always' \| 'hover' \| 'none'` | `'hover'` | Arrow display mode |
|
|
587
|
+
| `loop` | `boolean` | `true` | Infinite loop |
|
|
588
|
+
|
|
589
|
+
**Events:** `mac-change`
|
|
590
|
+
|
|
591
|
+
```html
|
|
592
|
+
<mac-carousel autoplay indicator="line">
|
|
593
|
+
<mac-carousel-item>
|
|
594
|
+
<img src="slide1.jpg" />
|
|
595
|
+
</mac-carousel-item>
|
|
596
|
+
<mac-carousel-item>
|
|
597
|
+
<img src="slide2.jpg" />
|
|
598
|
+
</mac-carousel-item>
|
|
599
|
+
</mac-carousel>
|
|
600
|
+
```
|
|
601
|
+
|
|
602
|
+
### MacRating
|
|
603
|
+
|
|
604
|
+
A rating component with customizable icons.
|
|
605
|
+
|
|
606
|
+
| Property | Type | Default | Description |
|
|
607
|
+
| ------------ | ----------------------------------------------------- | -------- | ----------------------- |
|
|
608
|
+
| `value` | `number` | `0` | Current rating value |
|
|
609
|
+
| `max` | `number` | `5` | Maximum rating |
|
|
610
|
+
| `allow-half` | `boolean` | `false` | Allow half-star ratings |
|
|
611
|
+
| `readonly` | `boolean` | `false` | Read-only mode |
|
|
612
|
+
| `disabled` | `boolean` | `false` | Disable interaction |
|
|
613
|
+
| `show-value` | `boolean` | `false` | Show numeric value |
|
|
614
|
+
| `icon` | `'star' \| 'heart' \| 'circle' \| 'flame' \| 'thumb'` | `'star'` | Icon shape |
|
|
615
|
+
|
|
616
|
+
**Slots:** `icon-empty`, `icon-half`, `icon-full`
|
|
617
|
+
|
|
618
|
+
**Events:** `mac-rating-change`
|
|
619
|
+
|
|
620
|
+
**CSS Properties:** `--md-rating-icon-size`, `--md-rating-gap`, `--md-rating-color-active`, `--md-rating-color-inactive`
|
|
621
|
+
|
|
622
|
+
```html
|
|
623
|
+
<mac-rating value="4" max="5"></mac-rating>
|
|
624
|
+
<mac-rating value="3.5" allow-half readonly></mac-rating>
|
|
625
|
+
```
|
|
626
|
+
|
|
627
|
+
### MacTextEllipsis
|
|
628
|
+
|
|
629
|
+
A text ellipsis component with line clamping, click-to-expand, and tooltip.
|
|
630
|
+
|
|
631
|
+
| Property | Type | Default | Description |
|
|
632
|
+
| ---------------- | ------------------- | -------- | --------------------------- |
|
|
633
|
+
| `line-clamp` | `number` | `3` | Number of lines to show |
|
|
634
|
+
| `expand-trigger` | `'click' \| 'none'` | `'none'` | Trigger for expand/collapse |
|
|
635
|
+
| `expanded` | `boolean` | `false` | Whether text is expanded |
|
|
636
|
+
| `tooltip` | `boolean` | `false` | Show tooltip on hover |
|
|
637
|
+
|
|
638
|
+
**Slots:** default (text content), `tooltip`
|
|
639
|
+
|
|
640
|
+
**Events:** `mac-ellipsis-expand`
|
|
641
|
+
|
|
642
|
+
**CSS Properties:** `--md-ellipsis-color`, `--md-ellipsis-expand-color`, `--md-ellipsis-tooltip-bg`
|
|
643
|
+
|
|
644
|
+
```html
|
|
645
|
+
<mac-text-ellipsis line-clamp="2" expand-trigger="click" tooltip>
|
|
646
|
+
This is a very long text that will be truncated after two lines...
|
|
647
|
+
</mac-text-ellipsis>
|
|
648
|
+
```
|
|
649
|
+
|
|
650
|
+
### MacNumberAnimation
|
|
651
|
+
|
|
652
|
+
A number animation component that smoothly transitions between numeric values.
|
|
653
|
+
|
|
654
|
+
| Property | Type | Default | Description |
|
|
655
|
+
| ----------- | -------------------------------------------------- | ----------- | ----------------------- |
|
|
656
|
+
| `to` | `number` | `0` | Target value |
|
|
657
|
+
| `from` | `number` | `0` | Starting value |
|
|
658
|
+
| `duration` | `number` | `2000` | Animation duration (ms) |
|
|
659
|
+
| `precision` | `number` | `0` | Decimal places |
|
|
660
|
+
| `separator` | `string` | `''` | Thousands separator |
|
|
661
|
+
| `easing` | `'linear' \| 'easeIn' \| 'easeOut' \| 'easeInOut'` | `'easeOut'` | Easing function |
|
|
662
|
+
| `autoplay` | `boolean` | `true` | Auto-start animation |
|
|
663
|
+
| `prefix` | `string` | `''` | Text before number |
|
|
664
|
+
| `suffix` | `string` | `''` | Text after number |
|
|
665
|
+
| `size` | `'sm' \| 'md' \| 'lg'` | — | Component size |
|
|
666
|
+
|
|
667
|
+
**Slots:** `prefix`, `suffix`
|
|
668
|
+
|
|
669
|
+
**Events:** `mac-number-animation-start`, `mac-number-animation-finish`
|
|
670
|
+
|
|
671
|
+
**CSS Properties:** `--md-number-animation-font-size`, `--md-number-animation-color`, `--md-number-animation-font-weight`
|
|
672
|
+
|
|
673
|
+
```html
|
|
674
|
+
<mac-number-animation
|
|
675
|
+
from="0"
|
|
676
|
+
to="10000"
|
|
677
|
+
duration="2000"
|
|
678
|
+
separator=","
|
|
679
|
+
prefix="$"
|
|
680
|
+
></mac-number-animation>
|
|
681
|
+
```
|
|
682
|
+
|
|
683
|
+
### MacProgress
|
|
684
|
+
|
|
685
|
+
A progress component supporting line, circle, multi-circle, and gradient fill.
|
|
686
|
+
|
|
687
|
+
| Property | Type | Default | Description |
|
|
688
|
+
| ------------- | ------------------------------------------ | ----------- | --------------------------- |
|
|
689
|
+
| `percentage` | `number` | `0` | Progress percentage (0-100) |
|
|
690
|
+
| `type` | `'line' \| 'circle'` | `'line'` | Progress type |
|
|
691
|
+
| `status` | `'default'\|'success'\|'warning'\|'error'` | `'default'` | Progress status |
|
|
692
|
+
| `size` | `'sm' \| 'md' \| 'lg'` | `'md'` | Line progress size |
|
|
693
|
+
| `showText` | `boolean` | `true` | Show percentage text |
|
|
694
|
+
| `processing` | `boolean` | `false` | Show processing animation |
|
|
695
|
+
| `color` | `string` | — | Custom fill color |
|
|
696
|
+
| `strokeWidth` | `number` | `6` | Circle stroke width (px) |
|
|
697
|
+
| `width` | `number` | `120` | Circle width/height (px) |
|
|
698
|
+
| `circles` | `CircleConfig[]` | — | Multi-circle configuration |
|
|
699
|
+
| `gradient` | `GradientConfig` | — | Gradient fill configuration |
|
|
700
|
+
|
|
701
|
+
**GradientConfig:**
|
|
702
|
+
|
|
703
|
+
- Two-color mode: `{ from: '#3b82f6', to: '#22c55e', angle?: 90 }`
|
|
704
|
+
- Custom stops mode: `{ angle?: 45, stops: [{ color, offset? }, ...] }`
|
|
705
|
+
|
|
706
|
+
**CSS Parts:** `track`, `fill`, `text`
|
|
707
|
+
|
|
708
|
+
```html
|
|
709
|
+
<mac-progress percentage="60" status="success"></mac-progress>
|
|
710
|
+
|
|
711
|
+
<mac-progress type="circle" percentage="75" .gradient=${{ from: '#ec4899', to: '#f59e0b' }}></mac-progress>
|
|
712
|
+
|
|
713
|
+
<!-- Custom multi-stop gradient -->
|
|
714
|
+
<mac-progress
|
|
715
|
+
percentage="60"
|
|
716
|
+
.gradient=${{
|
|
717
|
+
angle: 90,
|
|
718
|
+
stops: [
|
|
719
|
+
{ color: '#3b82f6', offset: 0 },
|
|
720
|
+
{ color: '#22c55e', offset: 50 },
|
|
721
|
+
{ color: '#f59e0b', offset: 100 },
|
|
722
|
+
],
|
|
723
|
+
}}
|
|
724
|
+
></mac-progress>
|
|
725
|
+
|
|
726
|
+
<mac-progress
|
|
727
|
+
type="circle"
|
|
728
|
+
.circles=${[
|
|
729
|
+
{ percentage: 80, color: '#3b82f6', strokeWidth: 8 },
|
|
730
|
+
{ percentage: 60, color: '#22c55e', strokeWidth: 6 },
|
|
731
|
+
]}
|
|
732
|
+
></mac-progress>
|
|
733
|
+
```
|
|
734
|
+
|
|
735
|
+
### MacTag / MacDynamicTags
|
|
736
|
+
|
|
737
|
+
A tag component for marking and categorization.
|
|
738
|
+
|
|
739
|
+
| Property | Type | Default | Description |
|
|
740
|
+
| ---------- | ----------------------------------------------------------------------- | ----------- | ------------------ |
|
|
741
|
+
| `type` | `'default' \| 'primary' \| 'success' \| 'warning' \| 'error' \| 'info'` | `'default'` | Tag type |
|
|
742
|
+
| `size` | `'sm' \| 'md' \| 'lg'` | `'md'` | Tag size |
|
|
743
|
+
| `round` | `boolean` | `false` | Rounded pill style |
|
|
744
|
+
| `closable` | `boolean` | `false` | Show close button |
|
|
745
|
+
| `bordered` | `boolean` | `true` | Show border |
|
|
746
|
+
|
|
747
|
+
**Events:** `mac-close`
|
|
748
|
+
|
|
749
|
+
```html
|
|
750
|
+
<mac-tag type="primary">Primary</mac-tag> <mac-tag type="success" round closable>Success</mac-tag>
|
|
751
|
+
```
|
|
752
|
+
|
|
753
|
+
**MacDynamicTags** — editable tag list with input to add new tags.
|
|
754
|
+
|
|
755
|
+
| Property | Type | Default | Description |
|
|
756
|
+
| ---------- | ---------- | ------- | ----------------- |
|
|
757
|
+
| `value` | `string[]` | `[]` | Tag list |
|
|
758
|
+
| `max` | `number` | — | Maximum tag count |
|
|
759
|
+
| `readonly` | `boolean` | `false` | Disable editing |
|
|
760
|
+
|
|
761
|
+
**Events:** `mac-change`
|
|
762
|
+
|
|
763
|
+
```html
|
|
764
|
+
<mac-dynamic-tags .value=${['Tag1', 'Tag2']}></mac-dynamic-tags>
|
|
765
|
+
```
|
|
766
|
+
|
|
767
|
+
### MacPopconfirm
|
|
768
|
+
|
|
769
|
+
A popover confirmation component.
|
|
770
|
+
|
|
771
|
+
| Property | Type | Default | Description |
|
|
772
|
+
| -------------- | -------------------------------------------- | --------- | ------------------------------- |
|
|
773
|
+
| `title` | `string` | `''` | Confirmation title |
|
|
774
|
+
| `description` | `string` | `''` | Confirmation description |
|
|
775
|
+
| `confirm-text` | `string` | `'确认'` | Confirm button text |
|
|
776
|
+
| `cancel-text` | `string` | `'取消'` | Cancel button text |
|
|
777
|
+
| `danger` | `boolean` | `false` | Danger style for confirm button |
|
|
778
|
+
| `show-icon` | `boolean` | `true` | Show warning icon |
|
|
779
|
+
| `placement` | `'top' \| 'top-start' \| ... \| 'right-end'` | `'top'` | Popover placement |
|
|
780
|
+
| `trigger` | `'click' \| 'hover'` | `'click'` | Trigger mode |
|
|
781
|
+
| `disabled` | `boolean` | `false` | Disable the popconfirm |
|
|
782
|
+
| `width` | `string` | `'240px'` | Popover width |
|
|
783
|
+
|
|
784
|
+
**Slots:** default (trigger element), `action`
|
|
785
|
+
|
|
786
|
+
**Events:** `mac-popconfirm-confirm`, `mac-popconfirm-cancel`, `mac-popconfirm-open`, `mac-popconfirm-close`
|
|
787
|
+
|
|
788
|
+
```html
|
|
789
|
+
<mac-popconfirm title="Are you sure?" description="This action cannot be undone." danger>
|
|
790
|
+
<mac-button variant="text" danger>Delete</mac-button>
|
|
791
|
+
</mac-popconfirm>
|
|
792
|
+
```
|
|
793
|
+
|
|
794
|
+
### MacDescriptions
|
|
795
|
+
|
|
796
|
+
A descriptions list component for displaying key-value pairs.
|
|
797
|
+
|
|
798
|
+
| Property | Type | Default | Description |
|
|
799
|
+
| ----------------- | ------------------------------- | -------- | --------------------- |
|
|
800
|
+
| `label-placement` | `'left' \| 'top'` | `'left'` | Label position |
|
|
801
|
+
| `label-align` | `'left' \| 'center' \| 'right'` | `'left'` | Label text alignment |
|
|
802
|
+
| `column` | `number` | `3` | Number of columns |
|
|
803
|
+
| `size` | `'sm' \| 'md' \| 'lg'` | — | Component size |
|
|
804
|
+
| `bordered` | `boolean` | `false` | Show borders |
|
|
805
|
+
| `title` | `string` | `''` | List title |
|
|
806
|
+
| `separator` | `string` | `':'` | Label-value separator |
|
|
807
|
+
| `items` | `DescriptionItem[]` | `[]` | Description items |
|
|
808
|
+
|
|
809
|
+
**Slots:** default (mac-description-item elements), `title`, `extra`
|
|
810
|
+
|
|
811
|
+
```html
|
|
812
|
+
<mac-descriptions title="User Info" :items=${[
|
|
813
|
+
{ label: 'Name', value: 'John' },
|
|
814
|
+
{ label: 'Email', value: 'john@example.com' },
|
|
815
|
+
{ label: 'Phone', value: '123-456-7890' }
|
|
816
|
+
]}></mac-descriptions>
|
|
817
|
+
```
|
|
818
|
+
|
|
819
|
+
### MacInfiniteScroll
|
|
820
|
+
|
|
821
|
+
An infinite scroll component that triggers loading more data when scrolling to the bottom.
|
|
822
|
+
|
|
823
|
+
| Property | Type | Default | Description |
|
|
824
|
+
| ----------------- | --------- | ------- | --------------------------------- |
|
|
825
|
+
| `has-more` | `boolean` | `true` | Whether more data is available |
|
|
826
|
+
| `loading` | `boolean` | `false` | Whether data is loading |
|
|
827
|
+
| `error` | `boolean` | `false` | Whether last load failed |
|
|
828
|
+
| `threshold` | `number` | `100` | Trigger distance from bottom (px) |
|
|
829
|
+
| `immediate-check` | `boolean` | `true` | Check immediately after mount |
|
|
830
|
+
| `disabled` | `boolean` | `false` | Disable auto-loading |
|
|
831
|
+
|
|
832
|
+
**Slots:** default (list content), `loading`, `finished`, `error`
|
|
833
|
+
|
|
834
|
+
**Events:** `mac-load-more`, `mac-retry`
|
|
835
|
+
|
|
836
|
+
**CSS Parts:** `loading`, `finished`, `error`
|
|
837
|
+
|
|
838
|
+
```html
|
|
839
|
+
<mac-infinite-scroll @mac-load-more="${loadMore}" :has-more="${hasMore}" :loading="${loading}">
|
|
840
|
+
<div>Item 1</div>
|
|
841
|
+
<div>Item 2</div>
|
|
842
|
+
</mac-infinite-scroll>
|
|
843
|
+
```
|
|
844
|
+
|
|
845
|
+
### MacSplit / MacSplitPane
|
|
846
|
+
|
|
847
|
+
A resizable split panel component.
|
|
848
|
+
|
|
849
|
+
**MacSplit Properties:**
|
|
850
|
+
|
|
851
|
+
| Property | Type | Default | Description |
|
|
852
|
+
| ----------- | ---------------------------- | -------------- | ---------------------------------- |
|
|
853
|
+
| `direction` | `'horizontal' \| 'vertical'` | `'horizontal'` | Split direction |
|
|
854
|
+
| `split` | `number` | `0.5` | Split position (0-1 or px) |
|
|
855
|
+
| `unit` | `'ratio' \| 'pixel'` | `'ratio'` | Unit type for split value |
|
|
856
|
+
| `min` | `number` | `0` | Minimum panel size |
|
|
857
|
+
| `max` | `number` | `0` | Maximum panel size (0 = unlimited) |
|
|
858
|
+
| `disabled` | `boolean` | `false` | Disable resizing |
|
|
859
|
+
|
|
860
|
+
**Slots:** `first`, `second`
|
|
861
|
+
|
|
862
|
+
**Events:** `mac-split-change`, `mac-split-drag-start`, `mac-split-drag-end`
|
|
863
|
+
|
|
864
|
+
**CSS Parts:** `base`, `first`, `second`, `resizer`, `resizer-line`
|
|
865
|
+
|
|
866
|
+
```html
|
|
867
|
+
<mac-split direction="horizontal" split="0.3">
|
|
868
|
+
<div slot="first">Left panel</div>
|
|
869
|
+
<div slot="second">Right panel</div>
|
|
870
|
+
</mac-split>
|
|
871
|
+
```
|
|
872
|
+
|
|
873
|
+
## Theming
|
|
874
|
+
|
|
875
|
+
All components use CSS custom properties for theming. Override these on the host element or globally:
|
|
876
|
+
|
|
877
|
+
```css
|
|
878
|
+
:root {
|
|
879
|
+
--md-color-primary: #3b82f6;
|
|
880
|
+
--md-color-primary-hover: #2563eb;
|
|
881
|
+
--md-color-primary-active: #1d4ed8;
|
|
882
|
+
--md-color-success: #22c55e;
|
|
883
|
+
--md-color-warning: #f59e0b;
|
|
884
|
+
--md-color-danger: #ef4444;
|
|
885
|
+
--md-color-text: #1f2937;
|
|
886
|
+
--md-color-text-secondary: #6b7280;
|
|
887
|
+
--md-color-border: #d1d5db;
|
|
888
|
+
--md-color-bg: #ffffff;
|
|
889
|
+
--md-color-bg-secondary: #f9fafb;
|
|
890
|
+
--md-radius-sm: 4px;
|
|
891
|
+
--md-radius-md: 6px;
|
|
892
|
+
--md-radius-lg: 8px;
|
|
893
|
+
--md-font-size-sm: 12px;
|
|
894
|
+
--md-font-size-base: 14px;
|
|
895
|
+
--md-font-size-lg: 16px;
|
|
896
|
+
--md-spacing-xs: 4px;
|
|
897
|
+
--md-spacing-sm: 8px;
|
|
898
|
+
--md-spacing-md: 12px;
|
|
899
|
+
--md-spacing-lg: 16px;
|
|
900
|
+
--md-spacing-xl: 24px;
|
|
901
|
+
--md-transition-fast: 150ms ease;
|
|
902
|
+
--md-transition-normal: 250ms ease;
|
|
903
|
+
}
|
|
904
|
+
```
|
|
905
|
+
|
|
906
|
+
## Development
|
|
907
|
+
|
|
908
|
+
### Prerequisites
|
|
909
|
+
|
|
910
|
+
- Node.js >= 20+
|
|
911
|
+
- pnpm
|
|
912
|
+
|
|
913
|
+
### Setup
|
|
914
|
+
|
|
915
|
+
```bash
|
|
916
|
+
pnpm install
|
|
917
|
+
```
|
|
918
|
+
|
|
919
|
+
### Available Scripts
|
|
920
|
+
|
|
921
|
+
| Command | Description |
|
|
922
|
+
| ---------------------- | ------------------------------------- |
|
|
923
|
+
| `pnpm dev` | Start dev server with demo page |
|
|
924
|
+
| `pnpm build` | Build library (types + ESM/CJS/UMD) |
|
|
925
|
+
| `pnpm build:types` | Generate TypeScript declarations only |
|
|
926
|
+
| `pnpm build:lib` | Build JS bundles only |
|
|
927
|
+
| `pnpm test` | Run tests |
|
|
928
|
+
| `pnpm test:watch` | Run tests in watch mode |
|
|
929
|
+
| `pnpm test:coverage` | Run tests with coverage report |
|
|
930
|
+
| `pnpm storybook` | Start Storybook dev server |
|
|
931
|
+
| `pnpm build-storybook` | Build static Storybook site |
|
|
932
|
+
| `pnpm lint` | Run ESLint |
|
|
933
|
+
| `pnpm lint:fix` | Run ESLint with auto-fix |
|
|
934
|
+
| `pnpm format` | Format code with Prettier |
|
|
935
|
+
| `pnpm format:check` | Check code formatting |
|
|
936
|
+
| `pnpm type-check` | Run TypeScript type checking |
|
|
937
|
+
|
|
938
|
+
## License
|
|
939
|
+
|
|
940
|
+
MIT
|