@mezzanine-ui/core 1.0.0-beta.1 → 1.0.0-beta.2

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/_styles.scss CHANGED
@@ -57,6 +57,7 @@
57
57
  // Data Display
58
58
  @include _load-styles($options, badge);
59
59
  @include _load-styles($options, card);
60
+ @include _load-styles($options, description);
60
61
  @include _load-styles($options, empty);
61
62
  @include _load-styles($options, tag);
62
63
  @include _load-styles($options, accordion);
@@ -383,7 +383,7 @@ $destructive-ghost: (
383
383
  enable: (
384
384
  text-color: palette.semantic-variable(text, error),
385
385
  icon-color: palette.semantic-variable(icon, error),
386
- background-color: palette.semantic-variable(background, base),
386
+ background-color: none,
387
387
  border-color: none,
388
388
  focus-color: none,
389
389
  ),
@@ -518,6 +518,52 @@ $inverse: (
518
518
  ),
519
519
  );
520
520
 
521
+ $inverse-ghost: (
522
+ enable: (
523
+ text-color: palette.semantic-variable(text, fixed-light),
524
+ icon-color: palette.semantic-variable(icon, fixed-light),
525
+ background-color: none,
526
+ border-color: none,
527
+ focus-color: none,
528
+ ),
529
+ hover: (
530
+ text-color: palette.semantic-variable(text, fixed-light),
531
+ icon-color: palette.semantic-variable(icon, fixed-light),
532
+ background-color: palette.semantic-variable(surface, ghost),
533
+ border-color: none,
534
+ focus-color: none,
535
+ ),
536
+ active: (
537
+ text-color: palette.semantic-variable(text, fixed-light),
538
+ icon-color: palette.semantic-variable(icon, fixed-light),
539
+ background-color: palette.semantic-variable(surface, subtle),
540
+ border-color: none,
541
+ focus-color: none,
542
+ ),
543
+ focus: (
544
+ text-color: palette.semantic-variable(text, neutral-solid),
545
+ icon-color: palette.semantic-variable(icon, neutral-solid),
546
+ background-color: palette.semantic-variable(background, base),
547
+ border-color: palette.semantic-variable(border, fixed-light),
548
+ focus-color: effect.variable(focus, primary),
549
+ ),
550
+ disabled: (
551
+ text-color: palette.semantic-variable(text, neutral-light),
552
+ icon-color: palette.semantic-variable(icon, neutral-light),
553
+ background-color: none,
554
+ border-color: none,
555
+ focus-color: none,
556
+ ),
557
+ // 設計未定義
558
+ loading: (
559
+ text-color: none,
560
+ icon-color: none,
561
+ background-color: none,
562
+ border-color: none,
563
+ focus-color: none,
564
+ ),
565
+ );
566
+
521
567
  // Variant hierarchy map - 將所有 variants 整合
522
568
  $variant-hierarchy: (
523
569
  base-primary: $base-primary,
@@ -531,6 +577,7 @@ $variant-hierarchy: (
531
577
  destructive-ghost: $destructive-ghost,
532
578
  destructive-text-link: $destructive-text-link,
533
579
  inverse: $inverse,
580
+ inverse-ghost: $inverse-ghost,
534
581
  );
535
582
 
536
583
  // Size: main
@@ -796,7 +843,7 @@ $size-configs: (
796
843
  @include _apply-variant-states($variant);
797
844
 
798
845
  // Inverse variant 的所有 size 都使用 button typography
799
- @if $variant == 'inverse' {
846
+ @if $variant == 'inverse' or $variant == 'inverse-ghost' {
800
847
  @each $size in $sizes {
801
848
  &.#{$prefix}--#{$size} {
802
849
  @include _apply-size($size, inverse);
@@ -16,5 +16,6 @@ $variants: (
16
16
  destructive-secondary,
17
17
  destructive-ghost,
18
18
  destructive-text-link,
19
- inverse
19
+ inverse,
20
+ inverse-ghost
20
21
  );
@@ -1,6 +1,6 @@
1
1
  import { GeneralSize } from '@mezzanine-ui/system/size';
2
2
  import { IconDefinition } from '@mezzanine-ui/icons';
3
- export type ButtonVariant = 'base-primary' | 'base-secondary' | 'base-tertiary' | 'base-ghost' | 'base-dashed' | 'base-text-link' | 'destructive-primary' | 'destructive-secondary' | 'destructive-ghost' | 'destructive-text-link' | 'inverse';
3
+ export type ButtonVariant = 'base-primary' | 'base-secondary' | 'base-tertiary' | 'base-ghost' | 'base-dashed' | 'base-text-link' | 'destructive-primary' | 'destructive-secondary' | 'destructive-ghost' | 'destructive-text-link' | 'inverse' | 'inverse-ghost';
4
4
  export type ButtonSize = GeneralSize;
5
5
  export type ButtonIconPosition = 'leading' | 'trailing' | 'icon-only';
6
6
  export interface ButtonIcon {
@@ -0,0 +1,113 @@
1
+ @use 'sass:map';
2
+ @use '~@mezzanine-ui/system/palette' as palette;
3
+ @use '~@mezzanine-ui/system/spacing' as spacing;
4
+ @use '~@mezzanine-ui/system/transition' as transition;
5
+ @use '~@mezzanine-ui/system/typography';
6
+ @use './description' as *;
7
+
8
+ .#{$prefix} {
9
+ width: 100%;
10
+ display: flex;
11
+ flex-direction: row;
12
+ align-items: center;
13
+ justify-content: flex-start;
14
+ column-gap: spacing.semantic-variable(gap, base);
15
+
16
+ &--vertical {
17
+ flex-direction: column;
18
+ align-items: flex-start;
19
+ row-gap: spacing.semantic-variable(gap, tight);
20
+ }
21
+ }
22
+
23
+ .#{$title-prefix} {
24
+ display: flex;
25
+ justify-content: flex-start;
26
+ align-items: center;
27
+ column-gap: spacing.semantic-variable(gap, tight);
28
+ color: palette.semantic-variable(text, neutral);
29
+
30
+ @each $width in $widths {
31
+ &--#{$width} {
32
+ @if $width == narrow {
33
+ width: spacing.semantic-variable(size, container, compressed);
34
+ min-width: spacing.semantic-variable(size, container, compressed);
35
+ }
36
+
37
+ @if $width == wide {
38
+ width: spacing.semantic-variable(size, container, snug);
39
+ min-width: spacing.semantic-variable(size, container, snug);
40
+ }
41
+
42
+ @if $width == stretch {
43
+ width: auto;
44
+ flex: 1;
45
+ }
46
+
47
+ @if $width == hug {
48
+ width: fit-content;
49
+ }
50
+ }
51
+ }
52
+
53
+ &__text {
54
+ @include typography.semantic-variable(body);
55
+ color: palette.semantic-variable(text, neutral) !important;
56
+ }
57
+ }
58
+
59
+ .#{$content-prefix} {
60
+ color: palette.semantic-variable(text, neutral-solid);
61
+ display: flex;
62
+ align-items: center;
63
+ justify-content: flex-start;
64
+ column-gap: spacing.semantic-variable(gap, tight);
65
+ width: fit-content;
66
+
67
+ @each $size in $sizes {
68
+ &--#{$size} {
69
+ @if $size == main {
70
+ @include typography.semantic-variable(body);
71
+
72
+ &.#{$content-prefix}--statistic {
73
+ @include typography.semantic-variable(h2);
74
+ }
75
+ }
76
+
77
+ @if $size == sub {
78
+ @include typography.semantic-variable(caption);
79
+
80
+ &.#{$content-prefix}--statistic {
81
+ @include typography.semantic-variable(h3);
82
+ }
83
+ }
84
+ }
85
+ }
86
+
87
+ &__trend-up {
88
+ color: palette.semantic-variable(icon, error);
89
+ }
90
+
91
+ &__trend-down {
92
+ color: palette.semantic-variable(icon, success);
93
+ }
94
+
95
+ &__icon {
96
+ color: palette.semantic-variable(icon, neutral);
97
+ transition: transition.standard(color, fast);
98
+ will-change: color;
99
+
100
+ &:hover {
101
+ color: palette.semantic-variable(icon, neutral-solid);
102
+ }
103
+ }
104
+ }
105
+
106
+ .#{$group-prefix} {
107
+ width: 100%;
108
+ display: flex;
109
+ flex-direction: column;
110
+ align-items: flex-start;
111
+ justify-content: flex-start;
112
+ row-gap: spacing.semantic-variable(gap, base);
113
+ }
@@ -0,0 +1,6 @@
1
+ $prefix: mzn-description;
2
+ $title-prefix: mzn-description-title;
3
+ $content-prefix: mzn-description-content;
4
+ $group-prefix: mzn-description-group;
5
+ $sizes: (main, sub);
6
+ $widths: (narrow, wide, stretch, hug);
@@ -0,0 +1 @@
1
+ @forward './description';
@@ -0,0 +1,24 @@
1
+ import { Orientation } from '@mezzanine-ui/system/orientation';
2
+ import { GeneralSize } from '@mezzanine-ui/system/size';
3
+ export type DescriptionSize = Extract<GeneralSize, 'main' | 'sub'>;
4
+ export type DescriptionWidthType = 'narrow' | 'wide' | 'stretch' | 'hug';
5
+ export type DescriptionContentVariant = 'badge' | 'button' | 'normal' | 'progress' | 'statistic' | 'tags' | 'trend-up' | 'trend-down' | 'with-icon';
6
+ export type DescriptionOrientation = Orientation;
7
+ export declare const descriptionPrefix = "mzn-description";
8
+ export declare const descriptionTitlePrefix = "mzn-description-title";
9
+ export declare const descriptionContentPrefix = "mzn-description-content";
10
+ export declare const descriptionGroupPrefix = "mzn-description-group";
11
+ export declare const descriptionClasses: {
12
+ readonly host: "mzn-description";
13
+ readonly orientation: (orientation: DescriptionOrientation) => string;
14
+ readonly titleHost: "mzn-description-title";
15
+ readonly titleText: "mzn-description-title__text";
16
+ readonly titleWidth: (width: DescriptionWidthType) => string;
17
+ readonly contentHost: "mzn-description-content";
18
+ readonly contentIcon: "mzn-description-content__icon";
19
+ readonly contentTrendUp: "mzn-description-content__trend-up";
20
+ readonly contentTrendDown: "mzn-description-content__trend-down";
21
+ readonly contentVariant: (variant: DescriptionContentVariant) => string;
22
+ readonly contentSize: (size: DescriptionSize) => string;
23
+ readonly groupHost: "mzn-description-group";
24
+ };
@@ -0,0 +1,24 @@
1
+ const descriptionPrefix = 'mzn-description';
2
+ const descriptionTitlePrefix = 'mzn-description-title';
3
+ const descriptionContentPrefix = 'mzn-description-content';
4
+ const descriptionGroupPrefix = 'mzn-description-group';
5
+ const descriptionClasses = {
6
+ // host
7
+ host: descriptionPrefix,
8
+ orientation: (orientation) => `${descriptionPrefix}--${orientation}`,
9
+ // title
10
+ titleHost: descriptionTitlePrefix,
11
+ titleText: `${descriptionTitlePrefix}__text`,
12
+ titleWidth: (width) => `${descriptionTitlePrefix}--${width}`,
13
+ // content
14
+ contentHost: descriptionContentPrefix,
15
+ contentIcon: `${descriptionContentPrefix}__icon`,
16
+ contentTrendUp: `${descriptionContentPrefix}__trend-up`,
17
+ contentTrendDown: `${descriptionContentPrefix}__trend-down`,
18
+ contentVariant: (variant) => `${descriptionContentPrefix}--${variant}`,
19
+ contentSize: (size) => `${descriptionContentPrefix}--${size}`,
20
+ // group
21
+ groupHost: descriptionGroupPrefix,
22
+ };
23
+
24
+ export { descriptionClasses, descriptionContentPrefix, descriptionGroupPrefix, descriptionPrefix, descriptionTitlePrefix };
@@ -0,0 +1 @@
1
+ export * from './description';
@@ -0,0 +1 @@
1
+ export { descriptionClasses, descriptionContentPrefix, descriptionGroupPrefix, descriptionPrefix, descriptionTitlePrefix } from './description.js';
@@ -115,6 +115,7 @@ $section-configs: (
115
115
  &:focus-visible,
116
116
  &:focus-within {
117
117
  @include _apply-card-state(focus);
118
+
118
119
  outline: none;
119
120
  }
120
121
 
@@ -124,6 +125,7 @@ $section-configs: (
124
125
 
125
126
  &.#{$prefix}-item-card--disabled {
126
127
  @include _apply-card-state(disabled);
128
+
127
129
  box-shadow: none;
128
130
  }
129
131
  }
@@ -189,9 +191,14 @@ $section-configs: (
189
191
  .#{$prefix} {
190
192
  position: relative;
191
193
 
194
+ &--outside {
195
+ line-height: 0;
196
+ }
197
+
192
198
  // dropdown items
193
199
  &-list {
194
200
  @include _apply-section(list);
201
+
195
202
  width: 100%;
196
203
  min-width: max-content;
197
204
  max-width: 100%;
@@ -205,6 +212,7 @@ $section-configs: (
205
212
 
206
213
  &-list-header {
207
214
  @include _apply-section(list-header);
215
+
208
216
  position: sticky;
209
217
  inset-block-start: 0;
210
218
  z-index: 1;
@@ -217,6 +225,7 @@ $section-configs: (
217
225
 
218
226
  &-group-label {
219
227
  @include typography.semantic-variable(body);
228
+
220
229
  color: palette.semantic-variable(text, neutral-light);
221
230
  font-feature-settings: 'liga' off, 'clig' off;
222
231
  padding-block: spacing.semantic-variable(padding, vertical, tiny);
@@ -230,6 +239,10 @@ $section-configs: (
230
239
 
231
240
  &-item-card {
232
241
  @include _apply-card-states();
242
+
243
+ --#{$prefix}-item-card-title-color: palette.semantic-variable(text, neutral-strong);
244
+ --#{$prefix}-item-card-description-color: palette.semantic-variable(text, neutral);
245
+
233
246
  border-radius: radius.variable(base);
234
247
  padding-inline: spacing.semantic-variable(padding, horizontal, base);
235
248
  padding-block: spacing.semantic-variable(padding, vertical, base);
@@ -244,9 +257,7 @@ $section-configs: (
244
257
  transition.standard(color, fast),
245
258
  transition.standard(border, fast),
246
259
  transition.standard(box-shadow, fast);
247
- --#{$prefix}-item-card-title-color: palette.semantic-variable(text, neutral-strong);
248
- --#{$prefix}-item-card-description-color: palette.semantic-variable(text, neutral);
249
-
260
+
250
261
  &--disabled {
251
262
  cursor: not-allowed;
252
263
  }
@@ -275,36 +286,43 @@ $section-configs: (
275
286
 
276
287
  &-item-card-title {
277
288
  @include typography.semantic-variable(label-primary);
289
+
278
290
  overflow: hidden;
279
291
  font-feature-settings: 'liga' off, 'clig' off;
280
292
  text-overflow: ellipsis;
281
293
  transition: transition.standard(color, fast);
282
294
  color: var(--#{$prefix}-item-card-title-color, currentColor);
283
295
  }
296
+
284
297
  &-item-card-description {
285
298
  @include typography.semantic-variable(caption);
299
+
286
300
  overflow: hidden;
287
301
  font-feature-settings: 'liga' off, 'clig' off;
288
302
  text-overflow: ellipsis;
289
303
  transition: transition.standard(color, fast);
290
304
  color: var(--#{$prefix}-item-card-description-color, currentColor);
291
305
  }
306
+
292
307
  &-item-card-prepend-content {
293
308
  display: flex;
294
309
  align-items: center;
295
310
  justify-content: center;
296
311
  gap: spacing.semantic-variable(gap, base);
297
312
  }
313
+
298
314
  &-item-card-highlighted-text {
299
315
  color: palette.semantic-variable(text, brand);
300
316
  transition: transition.standard(color, fast);
301
317
  }
318
+
302
319
  &-item-card-body {
303
320
  display: flex;
304
321
  flex-direction: column;
305
322
  flex: 1 0 0;
306
323
  gap: spacing.semantic-variable(gap, tight);
307
324
  }
325
+
308
326
  &-item-card-append-content {
309
327
  display: flex;
310
328
  align-items: center;
@@ -316,6 +334,7 @@ $section-configs: (
316
334
  &-action {
317
335
  display: flex;
318
336
  @include _apply-section(action);
337
+
319
338
  position: sticky;
320
339
  inset-block-end: 0;
321
340
  flex-direction: column;
@@ -325,6 +344,7 @@ $section-configs: (
325
344
 
326
345
  &-action--top-bar {
327
346
  @include _apply-section(action-top-bar);
347
+
328
348
  display: block;
329
349
  width: 100%;
330
350
  inset-block-start: 0;
@@ -341,6 +361,7 @@ $section-configs: (
341
361
  &-status {
342
362
  display: flex;
343
363
  @include _apply-section(status);
364
+
344
365
  position: relative;
345
366
  align-items: center;
346
367
  width: 100%;
@@ -348,6 +369,7 @@ $section-configs: (
348
369
 
349
370
  &-status-text {
350
371
  @include typography.semantic-variable(input);
372
+
351
373
  color: palette.semantic-variable(text, neutral);
352
374
  text-align: center;
353
375
  font-feature-settings: 'liga' off, 'clig' off;
@@ -1,13 +1,12 @@
1
1
  import type { IconDefinition } from '@mezzanine-ui/icons';
2
2
  export declare const dropdownPrefix = "mzn-dropdown";
3
- export type dropdownPlacement = 'top' | 'bottom' | 'left' | 'right';
4
- export type dropdownStatus = 'loading' | 'empty';
5
- export type dropdownMode = 'single' | 'multiple';
6
- export type dropdownType = 'default' | 'tree' | 'grouped';
7
- export type dropdownItemLevel = 0 | 1 | 2;
8
- export type dropdownItemValidate = 'default' | 'danger';
9
- export type dropdownCheckPosition = 'prepend' | 'append' | 'none';
10
- export type dropdownInputPosition = 'inside' | 'outside';
3
+ export type DropdownStatus = 'loading' | 'empty';
4
+ export type DropdownMode = 'single' | 'multiple';
5
+ export type DropdownType = 'default' | 'tree' | 'grouped';
6
+ export type DropdownItemLevel = 0 | 1 | 2;
7
+ export type DropdownItemValidate = 'default' | 'danger';
8
+ export type DropdownCheckPosition = 'prepend' | 'append' | 'none';
9
+ export type DropdownInputPosition = 'inside' | 'outside';
11
10
  /**
12
11
  * Base dropdown option interface
13
12
  */
@@ -37,11 +36,11 @@ export interface DropdownOption {
37
36
  /**
38
37
  * The validation type of the dropdown option.
39
38
  */
40
- validate?: dropdownItemValidate;
39
+ validate?: DropdownItemValidate;
41
40
  /**
42
41
  * The position of the checkbox.
43
42
  */
44
- checkSite?: dropdownCheckPosition;
43
+ checkSite?: DropdownCheckPosition;
45
44
  /**
46
45
  * The children options for tree/grouped structure.
47
46
  * If provided, this option will be rendered as a group with expand/collapse functionality.
@@ -104,17 +103,17 @@ export type DropdownOptionTree = DropdownOptionTreeLevel3;
104
103
  * - 'grouped': array with one level of children (children cannot have children)
105
104
  * - 'tree': array with nested children up to 3 levels
106
105
  */
107
- export type DropdownOptionsByType<T extends dropdownType | undefined> = T extends 'default' ? DropdownOptionFlat[] : T extends 'grouped' ? DropdownOptionGrouped[] : T extends 'tree' ? DropdownOptionTree[] : DropdownOption[];
106
+ export type DropdownOptionsByType<T extends DropdownType | undefined> = T extends 'default' ? DropdownOptionFlat[] : T extends 'grouped' ? DropdownOptionGrouped[] : T extends 'tree' ? DropdownOptionTree[] : DropdownOption[];
108
107
  export interface DropdownItemSharedProps {
109
108
  disabled?: boolean;
110
- mode?: dropdownMode;
109
+ mode?: DropdownMode;
111
110
  onSelect?: (option: DropdownOption) => void;
112
- type?: dropdownType;
111
+ type?: DropdownType;
113
112
  value?: string | string[];
114
113
  }
115
114
  export declare const dropdownClasses: {
116
115
  root: string;
117
- inputPosition: (inputPosition: dropdownInputPosition) => string;
116
+ inputPosition: (inputPosition: DropdownInputPosition) => string;
118
117
  list: string;
119
118
  listWrapper: string;
120
119
  listHeader: string;
@@ -132,7 +131,7 @@ export declare const dropdownClasses: {
132
131
  cardActive: string;
133
132
  cardDisabled: string;
134
133
  cardUnderline: string;
135
- cardLevel: (level: dropdownItemLevel) => string;
134
+ cardLevel: (level: DropdownItemLevel) => string;
136
135
  cardBody: string;
137
136
  cardTitle: string;
138
137
  cardDescription: string;