mithril-materialized 3.8.0 → 3.10.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/dist/badge.d.ts +129 -0
- package/dist/circular-progress.d.ts +43 -0
- package/dist/components.css +227 -0
- package/dist/index.css +702 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.esm.js +277 -1
- package/dist/index.js +279 -0
- package/dist/index.min.css +1 -1
- package/dist/index.umd.js +279 -0
- package/dist/linear-progress.d.ts +40 -0
- package/package.json +1 -1
- package/sass/components/_badge-component.scss +203 -0
- package/sass/components/_circular-progress.scss +220 -0
- package/sass/components/_linear-progress.scss +183 -0
- package/sass/materialize.scss +4 -0
package/dist/badge.d.ts
ADDED
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import { FactoryComponent, Attributes } from 'mithril';
|
|
2
|
+
import { MaterialColor, ColorIntensity } from './types';
|
|
3
|
+
/** Badge positioning anchor origin */
|
|
4
|
+
export interface BadgeAnchorOrigin {
|
|
5
|
+
/** Vertical positioning: 'top' | 'bottom' */
|
|
6
|
+
vertical: 'top' | 'bottom';
|
|
7
|
+
/** Horizontal positioning: 'left' | 'right' */
|
|
8
|
+
horizontal: 'left' | 'right';
|
|
9
|
+
}
|
|
10
|
+
/** Badge display variant */
|
|
11
|
+
export type BadgeVariant = 'standard' | 'dot';
|
|
12
|
+
/** Badge overlap mode affecting positioning offset */
|
|
13
|
+
export type BadgeOverlap = 'rectangular' | 'circular';
|
|
14
|
+
/**
|
|
15
|
+
* Badge component attributes
|
|
16
|
+
*
|
|
17
|
+
* Displays a badge anchored to a child element, commonly used for notifications,
|
|
18
|
+
* counts, or status indicators.
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```typescript
|
|
22
|
+
* // Standard notification badge
|
|
23
|
+
* m(Badge, { badgeContent: 4 },
|
|
24
|
+
* m('button.btn', 'Notifications')
|
|
25
|
+
* )
|
|
26
|
+
*
|
|
27
|
+
* // Dot variant with custom color
|
|
28
|
+
* m(Badge, {
|
|
29
|
+
* variant: 'dot',
|
|
30
|
+
* color: 'green',
|
|
31
|
+
* anchorOrigin: { vertical: 'bottom', horizontal: 'right' }
|
|
32
|
+
* },
|
|
33
|
+
* m(Icon, { iconName: 'notifications' })
|
|
34
|
+
* )
|
|
35
|
+
*
|
|
36
|
+
* // Badge with max value capping
|
|
37
|
+
* m(Badge, { badgeContent: 150, max: 99 },
|
|
38
|
+
* m('span', 'Inbox')
|
|
39
|
+
* )
|
|
40
|
+
* ```
|
|
41
|
+
*/
|
|
42
|
+
export interface BadgeAttrs extends Attributes {
|
|
43
|
+
/**
|
|
44
|
+
* Content to display in badge (number or string)
|
|
45
|
+
* For 'dot' variant, this is ignored
|
|
46
|
+
*/
|
|
47
|
+
badgeContent?: string | number;
|
|
48
|
+
/**
|
|
49
|
+
* Maximum value to display - if badgeContent exceeds this, shows "max+"
|
|
50
|
+
* @default undefined (no capping)
|
|
51
|
+
*/
|
|
52
|
+
max?: number;
|
|
53
|
+
/**
|
|
54
|
+
* Badge positioning relative to child element
|
|
55
|
+
* @default { vertical: 'top', horizontal: 'right' }
|
|
56
|
+
*/
|
|
57
|
+
anchorOrigin?: BadgeAnchorOrigin;
|
|
58
|
+
/**
|
|
59
|
+
* Overlap mode affecting positioning offset
|
|
60
|
+
* - 'rectangular': Badge positioned at corner edge
|
|
61
|
+
* - 'circular': Badge overlaps slightly for circular child elements
|
|
62
|
+
* @default 'rectangular'
|
|
63
|
+
*/
|
|
64
|
+
overlap?: BadgeOverlap;
|
|
65
|
+
/**
|
|
66
|
+
* Badge display variant
|
|
67
|
+
* - 'standard': Shows badgeContent
|
|
68
|
+
* - 'dot': Displays minimal dot indicator
|
|
69
|
+
* @default 'standard'
|
|
70
|
+
*/
|
|
71
|
+
variant?: BadgeVariant;
|
|
72
|
+
/**
|
|
73
|
+
* Badge background color from MaterialColor palette
|
|
74
|
+
* @default 'red'
|
|
75
|
+
*/
|
|
76
|
+
color?: MaterialColor;
|
|
77
|
+
/**
|
|
78
|
+
* Color intensity modifier
|
|
79
|
+
* @example 'lighten-2', 'darken-3'
|
|
80
|
+
*/
|
|
81
|
+
colorIntensity?: ColorIntensity;
|
|
82
|
+
/**
|
|
83
|
+
* Force hide badge regardless of badgeContent
|
|
84
|
+
* @default false
|
|
85
|
+
*/
|
|
86
|
+
invisible?: boolean;
|
|
87
|
+
/**
|
|
88
|
+
* Show badge even when badgeContent is 0
|
|
89
|
+
* @default false
|
|
90
|
+
*/
|
|
91
|
+
showZero?: boolean;
|
|
92
|
+
/**
|
|
93
|
+
* ARIA label for accessibility
|
|
94
|
+
* Automatically generated from badgeContent if not provided
|
|
95
|
+
*/
|
|
96
|
+
'aria-label'?: string;
|
|
97
|
+
/**
|
|
98
|
+
* Additional CSS class for badge element (not wrapper)
|
|
99
|
+
*/
|
|
100
|
+
badgeClassName?: string;
|
|
101
|
+
/**
|
|
102
|
+
* Additional CSS class for wrapper element
|
|
103
|
+
*/
|
|
104
|
+
className?: string;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Badge component
|
|
108
|
+
*
|
|
109
|
+
* Displays a badge anchored to a child element. Commonly used for notifications,
|
|
110
|
+
* counts, or status indicators. Supports flexible positioning, colors, and variants.
|
|
111
|
+
*
|
|
112
|
+
* @example
|
|
113
|
+
* ```typescript
|
|
114
|
+
* // Basic notification badge
|
|
115
|
+
* m(Badge, { badgeContent: 5 },
|
|
116
|
+
* m('button.btn', 'Messages')
|
|
117
|
+
* )
|
|
118
|
+
*
|
|
119
|
+
* // Dot badge on avatar
|
|
120
|
+
* m(Badge, {
|
|
121
|
+
* variant: 'dot',
|
|
122
|
+
* color: 'green',
|
|
123
|
+
* overlap: 'circular'
|
|
124
|
+
* },
|
|
125
|
+
* m('img.circle', { src: 'avatar.jpg' })
|
|
126
|
+
* )
|
|
127
|
+
* ```
|
|
128
|
+
*/
|
|
129
|
+
export declare const Badge: FactoryComponent<BadgeAttrs>;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { FactoryComponent, Attributes } from 'mithril';
|
|
2
|
+
import { MaterialColor, ColorIntensity } from './types';
|
|
3
|
+
/** Progress mode - determinate shows specific progress, indeterminate shows loading animation */
|
|
4
|
+
export type ProgressMode = 'determinate' | 'indeterminate';
|
|
5
|
+
/** Progress size options */
|
|
6
|
+
export type ProgressSize = 'small' | 'medium' | 'large';
|
|
7
|
+
/** CircularProgress component attributes */
|
|
8
|
+
export interface CircularProgressAttrs extends Attributes {
|
|
9
|
+
/** Progress mode (default: 'indeterminate') */
|
|
10
|
+
mode?: ProgressMode;
|
|
11
|
+
/** Current progress value (0-100) for determinate mode */
|
|
12
|
+
value?: number;
|
|
13
|
+
/** Maximum progress value (default: 100) */
|
|
14
|
+
max?: number;
|
|
15
|
+
/** Size variant (default: 'medium') */
|
|
16
|
+
size?: ProgressSize;
|
|
17
|
+
/** Materialize color (default: 'teal') */
|
|
18
|
+
color?: MaterialColor;
|
|
19
|
+
/** Color intensity modifier */
|
|
20
|
+
colorIntensity?: ColorIntensity;
|
|
21
|
+
/** Label to display inside the circle */
|
|
22
|
+
label?: string | number;
|
|
23
|
+
/** Auto-show percentage inside circle for determinate mode (default: false) */
|
|
24
|
+
showPercentage?: boolean;
|
|
25
|
+
/** Additional CSS class names */
|
|
26
|
+
className?: string;
|
|
27
|
+
/** Additional CSS styles */
|
|
28
|
+
style?: any;
|
|
29
|
+
/** HTML ID for the component */
|
|
30
|
+
id?: string;
|
|
31
|
+
/** ARIA label for accessibility */
|
|
32
|
+
'aria-label'?: string;
|
|
33
|
+
/** ARIA valuemin (default: 0) */
|
|
34
|
+
'aria-valuemin'?: number;
|
|
35
|
+
/** ARIA valuemax (default: 100) */
|
|
36
|
+
'aria-valuemax'?: number;
|
|
37
|
+
/** ARIA valuenow (current value) */
|
|
38
|
+
'aria-valuenow'?: number;
|
|
39
|
+
/** ARIA valuetext (custom text description) */
|
|
40
|
+
'aria-valuetext'?: string;
|
|
41
|
+
}
|
|
42
|
+
/** Create a CircularProgress component */
|
|
43
|
+
export declare const CircularProgress: FactoryComponent<CircularProgressAttrs>;
|
package/dist/components.css
CHANGED
|
@@ -4529,3 +4529,230 @@ nav .theme-toggle:focus {
|
|
|
4529
4529
|
display: none;
|
|
4530
4530
|
}
|
|
4531
4531
|
}
|
|
4532
|
+
/* Badge Component
|
|
4533
|
+
========================================================================== */
|
|
4534
|
+
.badge-wrapper {
|
|
4535
|
+
position: relative;
|
|
4536
|
+
display: inline-flex;
|
|
4537
|
+
vertical-align: middle;
|
|
4538
|
+
flex-shrink: 0;
|
|
4539
|
+
}
|
|
4540
|
+
|
|
4541
|
+
.m-badge {
|
|
4542
|
+
position: absolute;
|
|
4543
|
+
display: flex;
|
|
4544
|
+
align-items: center;
|
|
4545
|
+
justify-content: center;
|
|
4546
|
+
box-sizing: border-box;
|
|
4547
|
+
font-family: Roboto, sans-serif;
|
|
4548
|
+
font-weight: 500;
|
|
4549
|
+
line-height: 1;
|
|
4550
|
+
white-space: nowrap;
|
|
4551
|
+
text-align: center;
|
|
4552
|
+
border-radius: 10px;
|
|
4553
|
+
background-color: #F44336;
|
|
4554
|
+
color: #fff;
|
|
4555
|
+
z-index: 1;
|
|
4556
|
+
transition: transform 225ms cubic-bezier(0.4, 0, 0.2, 1);
|
|
4557
|
+
}
|
|
4558
|
+
.m-badge.m-badge--standard {
|
|
4559
|
+
min-width: 20px;
|
|
4560
|
+
height: 20px;
|
|
4561
|
+
padding: 0 6px;
|
|
4562
|
+
font-size: 12px;
|
|
4563
|
+
}
|
|
4564
|
+
.m-badge.m-badge--dot {
|
|
4565
|
+
width: 8px;
|
|
4566
|
+
height: 8px;
|
|
4567
|
+
min-width: 8px;
|
|
4568
|
+
padding: 0;
|
|
4569
|
+
border-radius: 50%;
|
|
4570
|
+
}
|
|
4571
|
+
.m-badge.m-badge--invisible {
|
|
4572
|
+
transform: scale(0);
|
|
4573
|
+
opacity: 0;
|
|
4574
|
+
}
|
|
4575
|
+
.m-badge.m-badge--top-right {
|
|
4576
|
+
top: 0;
|
|
4577
|
+
right: 0;
|
|
4578
|
+
transform: scale(1) translate(50%, -50%);
|
|
4579
|
+
transform-origin: 100% 0%;
|
|
4580
|
+
}
|
|
4581
|
+
.m-badge.m-badge--top-right.m-badge--rectangular {
|
|
4582
|
+
transform: scale(1) translate(50%, -50%);
|
|
4583
|
+
}
|
|
4584
|
+
.m-badge.m-badge--top-right.m-badge--circular {
|
|
4585
|
+
transform: scale(1) translate(30%, -30%);
|
|
4586
|
+
}
|
|
4587
|
+
.m-badge.m-badge--top-right.m-badge--invisible {
|
|
4588
|
+
transform: scale(0) translate(50%, -50%);
|
|
4589
|
+
}
|
|
4590
|
+
.m-badge.m-badge--top-left {
|
|
4591
|
+
top: 0;
|
|
4592
|
+
left: 0;
|
|
4593
|
+
transform: scale(1) translate(-50%, -50%);
|
|
4594
|
+
transform-origin: 0% 0%;
|
|
4595
|
+
}
|
|
4596
|
+
.m-badge.m-badge--top-left.m-badge--rectangular {
|
|
4597
|
+
transform: scale(1) translate(-50%, -50%);
|
|
4598
|
+
}
|
|
4599
|
+
.m-badge.m-badge--top-left.m-badge--circular {
|
|
4600
|
+
transform: scale(1) translate(-30%, -30%);
|
|
4601
|
+
}
|
|
4602
|
+
.m-badge.m-badge--top-left.m-badge--invisible {
|
|
4603
|
+
transform: scale(0) translate(-50%, -50%);
|
|
4604
|
+
}
|
|
4605
|
+
.m-badge.m-badge--bottom-right {
|
|
4606
|
+
bottom: 0;
|
|
4607
|
+
right: 0;
|
|
4608
|
+
transform: scale(1) translate(50%, 50%);
|
|
4609
|
+
transform-origin: 100% 100%;
|
|
4610
|
+
}
|
|
4611
|
+
.m-badge.m-badge--bottom-right.m-badge--rectangular {
|
|
4612
|
+
transform: scale(1) translate(50%, 50%);
|
|
4613
|
+
}
|
|
4614
|
+
.m-badge.m-badge--bottom-right.m-badge--circular {
|
|
4615
|
+
transform: scale(1) translate(30%, 30%);
|
|
4616
|
+
}
|
|
4617
|
+
.m-badge.m-badge--bottom-right.m-badge--invisible {
|
|
4618
|
+
transform: scale(0) translate(50%, 50%);
|
|
4619
|
+
}
|
|
4620
|
+
.m-badge.m-badge--bottom-left {
|
|
4621
|
+
bottom: 0;
|
|
4622
|
+
left: 0;
|
|
4623
|
+
transform: scale(1) translate(-50%, 50%);
|
|
4624
|
+
transform-origin: 0% 100%;
|
|
4625
|
+
}
|
|
4626
|
+
.m-badge.m-badge--bottom-left.m-badge--rectangular {
|
|
4627
|
+
transform: scale(1) translate(-50%, 50%);
|
|
4628
|
+
}
|
|
4629
|
+
.m-badge.m-badge--bottom-left.m-badge--circular {
|
|
4630
|
+
transform: scale(1) translate(-30%, 30%);
|
|
4631
|
+
}
|
|
4632
|
+
.m-badge.m-badge--bottom-left.m-badge--invisible {
|
|
4633
|
+
transform: scale(0) translate(-50%, 50%);
|
|
4634
|
+
}
|
|
4635
|
+
|
|
4636
|
+
.m-badge--red {
|
|
4637
|
+
background-color: #F44336;
|
|
4638
|
+
}
|
|
4639
|
+
|
|
4640
|
+
.m-badge--pink {
|
|
4641
|
+
background-color: #e91e63;
|
|
4642
|
+
}
|
|
4643
|
+
|
|
4644
|
+
.m-badge--purple {
|
|
4645
|
+
background-color: #9c27b0;
|
|
4646
|
+
}
|
|
4647
|
+
|
|
4648
|
+
.m-badge--deep-purple {
|
|
4649
|
+
background-color: #673ab7;
|
|
4650
|
+
}
|
|
4651
|
+
|
|
4652
|
+
.m-badge--indigo {
|
|
4653
|
+
background-color: #3f51b5;
|
|
4654
|
+
}
|
|
4655
|
+
|
|
4656
|
+
.m-badge--blue {
|
|
4657
|
+
background-color: #2196F3;
|
|
4658
|
+
}
|
|
4659
|
+
|
|
4660
|
+
.m-badge--light-blue {
|
|
4661
|
+
background-color: #03a9f4;
|
|
4662
|
+
}
|
|
4663
|
+
|
|
4664
|
+
.m-badge--cyan {
|
|
4665
|
+
background-color: #00bcd4;
|
|
4666
|
+
}
|
|
4667
|
+
|
|
4668
|
+
.m-badge--teal {
|
|
4669
|
+
background-color: #009688;
|
|
4670
|
+
}
|
|
4671
|
+
|
|
4672
|
+
.m-badge--green {
|
|
4673
|
+
background-color: #4CAF50;
|
|
4674
|
+
}
|
|
4675
|
+
|
|
4676
|
+
.m-badge--light-green {
|
|
4677
|
+
background-color: #8bc34a;
|
|
4678
|
+
}
|
|
4679
|
+
|
|
4680
|
+
.m-badge--lime {
|
|
4681
|
+
background-color: #cddc39;
|
|
4682
|
+
}
|
|
4683
|
+
|
|
4684
|
+
.m-badge--yellow {
|
|
4685
|
+
background-color: #ffeb3b;
|
|
4686
|
+
color: #000;
|
|
4687
|
+
}
|
|
4688
|
+
|
|
4689
|
+
.m-badge--amber {
|
|
4690
|
+
background-color: #ffc107;
|
|
4691
|
+
}
|
|
4692
|
+
|
|
4693
|
+
.m-badge--orange {
|
|
4694
|
+
background-color: #ff9800;
|
|
4695
|
+
}
|
|
4696
|
+
|
|
4697
|
+
.m-badge--deep-orange {
|
|
4698
|
+
background-color: #ff5722;
|
|
4699
|
+
}
|
|
4700
|
+
|
|
4701
|
+
.m-badge--brown {
|
|
4702
|
+
background-color: #795548;
|
|
4703
|
+
}
|
|
4704
|
+
|
|
4705
|
+
.m-badge--grey {
|
|
4706
|
+
background-color: #9e9e9e;
|
|
4707
|
+
}
|
|
4708
|
+
|
|
4709
|
+
.m-badge--blue-grey {
|
|
4710
|
+
background-color: #607d8b;
|
|
4711
|
+
}
|
|
4712
|
+
|
|
4713
|
+
.m-badge--lighten-5 {
|
|
4714
|
+
filter: brightness(1.4);
|
|
4715
|
+
}
|
|
4716
|
+
|
|
4717
|
+
.m-badge--lighten-4 {
|
|
4718
|
+
filter: brightness(1.3);
|
|
4719
|
+
}
|
|
4720
|
+
|
|
4721
|
+
.m-badge--lighten-3 {
|
|
4722
|
+
filter: brightness(1.2);
|
|
4723
|
+
}
|
|
4724
|
+
|
|
4725
|
+
.m-badge--lighten-2 {
|
|
4726
|
+
filter: brightness(1.1);
|
|
4727
|
+
}
|
|
4728
|
+
|
|
4729
|
+
.m-badge--lighten-1 {
|
|
4730
|
+
filter: brightness(1.05);
|
|
4731
|
+
}
|
|
4732
|
+
|
|
4733
|
+
.m-badge--darken-1 {
|
|
4734
|
+
filter: brightness(0.95);
|
|
4735
|
+
}
|
|
4736
|
+
|
|
4737
|
+
.m-badge--darken-2 {
|
|
4738
|
+
filter: brightness(0.9);
|
|
4739
|
+
}
|
|
4740
|
+
|
|
4741
|
+
.m-badge--darken-3 {
|
|
4742
|
+
filter: brightness(0.8);
|
|
4743
|
+
}
|
|
4744
|
+
|
|
4745
|
+
.m-badge--darken-4 {
|
|
4746
|
+
filter: brightness(0.7);
|
|
4747
|
+
}
|
|
4748
|
+
|
|
4749
|
+
@media (prefers-reduced-motion: reduce) {
|
|
4750
|
+
.m-badge {
|
|
4751
|
+
transition: none;
|
|
4752
|
+
}
|
|
4753
|
+
}
|
|
4754
|
+
@media (prefers-contrast: high) {
|
|
4755
|
+
.m-badge {
|
|
4756
|
+
border: 2px solid currentColor;
|
|
4757
|
+
}
|
|
4758
|
+
}
|