mithril-materialized 3.12.0 → 3.14.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/advanced.css CHANGED
@@ -577,6 +577,11 @@ td, th {
577
577
  .collection .collection-item.active .secondary-content {
578
578
  color: var(--mm-text-on-primary, #fff);
579
579
  }
580
+ .collection .collection-item .secondary-text {
581
+ color: var(--mm-text-secondary, rgba(0, 0, 0, 0.54));
582
+ font-size: 0.9rem;
583
+ margin-top: 4px;
584
+ }
580
585
  .collection a.collection-item {
581
586
  display: block;
582
587
  transition: 0.25s;
package/dist/button.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import m, { FactoryComponent, Attributes } from 'mithril';
2
+ import { IconName } from './material-icon';
2
3
  import { MaterialPosition, IconClass, ButtonVariant } from './types';
3
4
  /**
4
5
  * HTML attributes that can be passed to button elements
@@ -86,3 +87,11 @@ export declare const FlatButton: m.FactoryComponent<ButtonAttrs>;
86
87
  export declare const IconButton: m.FactoryComponent<ButtonAttrs>;
87
88
  export declare const RoundIconButton: m.FactoryComponent<ButtonAttrs>;
88
89
  export declare const SubmitButton: m.FactoryComponent<ButtonAttrs>;
90
+ export interface ConfirmButtonAttrs extends ButtonAttrs {
91
+ confirmIconName?: IconName;
92
+ confirmColor?: string;
93
+ timeout?: number;
94
+ clickDelay?: number;
95
+ onFirstClick?: () => void;
96
+ }
97
+ export declare const ConfirmButton: FactoryComponent<ConfirmButtonAttrs>;
@@ -15,8 +15,8 @@ export interface CollectionItem {
15
15
  avatar?: string;
16
16
  /** Add a class to the avatar image or icon, e.g. a color 'red'. */
17
17
  className?: string;
18
- /** For Avatar mode, may contain a two-line trusted HTML content */
19
- content?: string;
18
+ /** For Avatar mode, may contain a two-line trusted HTML content, or a Vnode for rich content */
19
+ content?: string | Vnode<any, any>;
20
20
  /** If active, preselect the collection item. */
21
21
  active?: boolean;
22
22
  /** Add a material icon as secondary content. */
@@ -500,6 +500,11 @@ td, th {
500
500
  .collection .collection-item.active .secondary-content {
501
501
  color: var(--mm-text-on-primary, #fff);
502
502
  }
503
+ .collection .collection-item .secondary-text {
504
+ color: var(--mm-text-secondary, rgba(0, 0, 0, 0.54));
505
+ font-size: 0.9rem;
506
+ margin-top: 4px;
507
+ }
503
508
  .collection a.collection-item {
504
509
  display: block;
505
510
  transition: 0.25s;
package/dist/core.css CHANGED
@@ -897,6 +897,11 @@ td, th {
897
897
  .collection .collection-item.active .secondary-content {
898
898
  color: var(--mm-text-on-primary, #fff);
899
899
  }
900
+ .collection .collection-item .secondary-text {
901
+ color: var(--mm-text-secondary, rgba(0, 0, 0, 0.54));
902
+ font-size: 0.9rem;
903
+ margin-top: 4px;
904
+ }
900
905
  .collection a.collection-item {
901
906
  display: block;
902
907
  transition: 0.25s;
package/dist/forms.css CHANGED
@@ -500,6 +500,11 @@ td, th {
500
500
  .collection .collection-item.active .secondary-content {
501
501
  color: var(--mm-text-on-primary, #fff);
502
502
  }
503
+ .collection .collection-item .secondary-text {
504
+ color: var(--mm-text-secondary, rgba(0, 0, 0, 0.54));
505
+ font-size: 0.9rem;
506
+ margin-top: 4px;
507
+ }
503
508
  .collection a.collection-item {
504
509
  display: block;
505
510
  transition: 0.25s;
package/dist/index.css CHANGED
@@ -3180,6 +3180,11 @@ td, th {
3180
3180
  .collection .collection-item.active .secondary-content {
3181
3181
  color: var(--mm-text-on-primary, #fff);
3182
3182
  }
3183
+ .collection .collection-item .secondary-text {
3184
+ color: var(--mm-text-secondary, rgba(0, 0, 0, 0.54));
3185
+ font-size: 0.9rem;
3186
+ margin-top: 4px;
3187
+ }
3183
3188
  .collection a.collection-item {
3184
3189
  display: block;
3185
3190
  transition: 0.25s;
@@ -12016,6 +12021,461 @@ body.dark {
12016
12021
  transform: none;
12017
12022
  }
12018
12023
  }
12024
+ /* Likert Scale Component
12025
+ ========================================================================== */
12026
+ .likert-scale {
12027
+ position: relative;
12028
+ display: flex;
12029
+ align-items: center;
12030
+ outline: none;
12031
+ gap: 16px;
12032
+ transition: all 0.2s ease;
12033
+ margin-bottom: 20px;
12034
+ }
12035
+ .likert-scale:focus-visible {
12036
+ outline: 2px solid var(--mm-primary-color, #ee6e73);
12037
+ outline-offset: 2px;
12038
+ border-radius: 4px;
12039
+ }
12040
+ .likert-scale--readonly .likert-scale__item {
12041
+ cursor: default;
12042
+ }
12043
+ .likert-scale--disabled {
12044
+ opacity: 0.6;
12045
+ }
12046
+ .likert-scale--disabled .likert-scale__item {
12047
+ cursor: not-allowed;
12048
+ }
12049
+ .likert-scale--aligned .likert-scale__question-label {
12050
+ min-width: 250px;
12051
+ max-width: 50%;
12052
+ }
12053
+ .likert-scale--aligned .likert-scale__scale-container {
12054
+ flex: 0 0 auto;
12055
+ min-width: 300px;
12056
+ }
12057
+
12058
+ .likert-scale__question-label {
12059
+ flex: 1 1 auto;
12060
+ display: flex;
12061
+ flex-direction: column;
12062
+ min-width: 0;
12063
+ }
12064
+ .likert-scale__question-label span {
12065
+ font-size: 1rem;
12066
+ font-weight: 400;
12067
+ color: var(--mm-text-primary, rgba(0, 0, 0, 0.87));
12068
+ line-height: 1.4;
12069
+ word-wrap: break-word;
12070
+ }
12071
+
12072
+ .likert-scale__description {
12073
+ font-size: 0.875rem;
12074
+ color: var(--mm-text-secondary, rgba(0, 0, 0, 0.54));
12075
+ margin-top: 4px;
12076
+ line-height: 1.3;
12077
+ }
12078
+
12079
+ .likert-scale__scale-container {
12080
+ flex: 0 0 auto;
12081
+ display: flex;
12082
+ flex-direction: column;
12083
+ align-items: stretch;
12084
+ }
12085
+
12086
+ .likert-scale__scale {
12087
+ display: flex;
12088
+ align-items: flex-start;
12089
+ justify-content: space-between;
12090
+ position: relative;
12091
+ }
12092
+
12093
+ .likert-scale__item {
12094
+ display: flex;
12095
+ flex-direction: column;
12096
+ align-items: center;
12097
+ justify-content: flex-start;
12098
+ position: relative;
12099
+ cursor: pointer;
12100
+ transition: transform 0.15s ease;
12101
+ flex: 1 1 0;
12102
+ }
12103
+ .likert-scale__item:hover:not(.likert-scale__item--disabled):not(.likert-scale__item--readonly) {
12104
+ transform: scale(1.05);
12105
+ }
12106
+ .likert-scale__item--checked .likert-scale__label::before {
12107
+ border-color: var(--mm-primary-color, #ee6e73);
12108
+ }
12109
+ .likert-scale__item--checked .likert-scale__label::after {
12110
+ background-color: var(--mm-primary-color, #ee6e73);
12111
+ transform: scale(1);
12112
+ }
12113
+ .likert-scale__item--disabled {
12114
+ cursor: not-allowed;
12115
+ opacity: 0.6;
12116
+ }
12117
+ .likert-scale__item--disabled .likert-scale__label::before {
12118
+ border-color: var(--mm-text-disabled, rgba(0, 0, 0, 0.38));
12119
+ }
12120
+ .likert-scale__item--readonly {
12121
+ cursor: default;
12122
+ }
12123
+
12124
+ .likert-scale__number {
12125
+ font-size: 16px;
12126
+ font-weight: 500;
12127
+ color: var(--mm-text-primary, rgba(0, 0, 0, 0.87));
12128
+ margin-bottom: 4px;
12129
+ -webkit-user-select: none;
12130
+ -moz-user-select: none;
12131
+ user-select: none;
12132
+ text-align: center;
12133
+ }
12134
+
12135
+ .likert-scale__input {
12136
+ position: absolute;
12137
+ opacity: 0;
12138
+ pointer-events: none;
12139
+ }
12140
+
12141
+ .likert-scale__label {
12142
+ position: relative;
12143
+ display: flex;
12144
+ align-items: center;
12145
+ justify-content: center;
12146
+ min-width: 48px;
12147
+ min-height: 48px;
12148
+ cursor: pointer;
12149
+ -webkit-user-select: none;
12150
+ -moz-user-select: none;
12151
+ user-select: none;
12152
+ }
12153
+ .likert-scale__label::before, .likert-scale__label::after {
12154
+ content: "";
12155
+ position: absolute;
12156
+ left: 50%;
12157
+ top: 50%;
12158
+ margin-left: -8px;
12159
+ margin-top: -8px;
12160
+ width: 16px;
12161
+ height: 16px;
12162
+ z-index: 0;
12163
+ transition: 0.28s ease;
12164
+ border-radius: 50%;
12165
+ }
12166
+ .likert-scale__label::before, .likert-scale__label::after {
12167
+ border: 2px solid var(--mm-text-secondary, var(--mm-text-hint, #9e9e9e));
12168
+ }
12169
+ .likert-scale__label::after {
12170
+ transform: scale(0);
12171
+ }
12172
+
12173
+ .likert-scale__input:checked + .likert-scale__label::before {
12174
+ border: 2px solid transparent;
12175
+ }
12176
+ .likert-scale__input:checked + .likert-scale__label::after {
12177
+ border: 2px solid var(--mm-primary-color, var(--mm-primary-color, #ee6e73));
12178
+ background-color: var(--mm-primary-color, var(--mm-primary-color, #ee6e73));
12179
+ transform: scale(1.02);
12180
+ }
12181
+
12182
+ .likert-scale__item:hover:not(.likert-scale__item--disabled):not(.likert-scale__item--readonly) .likert-scale__label::before {
12183
+ border-color: var(--mm-primary-color, var(--mm-primary-color, #ee6e73));
12184
+ }
12185
+
12186
+ .likert-scale__input:focus + .likert-scale__label::before {
12187
+ box-shadow: 0 0 0 10px rgba(0, 0, 0, 0.1);
12188
+ }
12189
+
12190
+ .likert-scale__input:disabled + .likert-scale__label::before {
12191
+ background-color: transparent;
12192
+ border-color: var(--mm-text-disabled, var(--mm-text-disabled, rgba(0, 0, 0, 0.38)));
12193
+ }
12194
+
12195
+ .likert-scale__input:disabled:checked + .likert-scale__label::after {
12196
+ background-color: var(--mm-text-disabled, var(--mm-text-disabled, rgba(0, 0, 0, 0.38)));
12197
+ border-color: var(--mm-text-disabled, var(--mm-text-disabled, rgba(0, 0, 0, 0.38)));
12198
+ }
12199
+
12200
+ .likert-scale__tooltip {
12201
+ position: absolute;
12202
+ bottom: calc(100% + 8px);
12203
+ left: 50%;
12204
+ transform: translateX(-50%);
12205
+ padding: 4px 8px;
12206
+ background: rgba(0, 0, 0, 0.8);
12207
+ color: white;
12208
+ font-size: 12px;
12209
+ border-radius: 4px;
12210
+ white-space: nowrap;
12211
+ opacity: 0;
12212
+ pointer-events: none;
12213
+ transition: opacity 0.2s ease;
12214
+ z-index: 1000;
12215
+ }
12216
+ .likert-scale__tooltip::after {
12217
+ content: "";
12218
+ position: absolute;
12219
+ top: 100%;
12220
+ left: 50%;
12221
+ transform: translateX(-50%);
12222
+ border: 4px solid transparent;
12223
+ border-top-color: rgba(0, 0, 0, 0.8);
12224
+ }
12225
+
12226
+ .likert-scale__item:hover .likert-scale__tooltip {
12227
+ opacity: 1;
12228
+ }
12229
+
12230
+ .likert-scale__anchors {
12231
+ display: flex;
12232
+ justify-content: space-between;
12233
+ align-items: flex-start;
12234
+ font-size: 0.875rem;
12235
+ color: var(--mm-text-secondary, rgba(0, 0, 0, 0.54));
12236
+ position: relative;
12237
+ }
12238
+
12239
+ .likert-scale__anchor {
12240
+ flex: 1 1 0;
12241
+ text-align: center;
12242
+ line-height: 1.2;
12243
+ padding: 0 4px;
12244
+ }
12245
+ .likert-scale__anchor--start {
12246
+ text-align: left;
12247
+ }
12248
+ .likert-scale__anchor--middle {
12249
+ text-align: center;
12250
+ }
12251
+ .likert-scale__anchor--end {
12252
+ text-align: right;
12253
+ }
12254
+
12255
+ .likert-scale--horizontal {
12256
+ flex-direction: row;
12257
+ align-items: center;
12258
+ }
12259
+ .likert-scale--horizontal .likert-scale__scale {
12260
+ flex-direction: row;
12261
+ }
12262
+
12263
+ .likert-scale--vertical {
12264
+ flex-direction: column;
12265
+ align-items: stretch;
12266
+ }
12267
+ .likert-scale--vertical .likert-scale__question-label {
12268
+ margin-bottom: 12px;
12269
+ }
12270
+ .likert-scale--vertical .likert-scale__scale-container {
12271
+ width: 100%;
12272
+ }
12273
+ .likert-scale--vertical .likert-scale__scale {
12274
+ flex-direction: column;
12275
+ align-items: stretch;
12276
+ }
12277
+ .likert-scale--vertical .likert-scale__item {
12278
+ flex-direction: row;
12279
+ justify-content: flex-start;
12280
+ padding: 4px 0;
12281
+ width: 100%;
12282
+ }
12283
+ .likert-scale--vertical .likert-scale__number {
12284
+ margin-bottom: 0;
12285
+ margin-right: 12px;
12286
+ min-width: 24px;
12287
+ text-align: left;
12288
+ }
12289
+ .likert-scale--vertical .likert-scale__anchors {
12290
+ flex-direction: column;
12291
+ margin-top: 0;
12292
+ margin-left: 60px;
12293
+ }
12294
+ .likert-scale--vertical .likert-scale__anchor {
12295
+ margin: 4px 0;
12296
+ text-align: left;
12297
+ flex: 0 0 auto;
12298
+ }
12299
+ .likert-scale--vertical .likert-scale__anchor--start, .likert-scale--vertical .likert-scale__anchor--middle, .likert-scale--vertical .likert-scale__anchor--end {
12300
+ text-align: left;
12301
+ }
12302
+
12303
+ .likert-scale--responsive {
12304
+ flex-direction: row;
12305
+ align-items: center;
12306
+ }
12307
+ .likert-scale--responsive .likert-scale__scale {
12308
+ flex-direction: row;
12309
+ }
12310
+ @media only screen and (max-width : 600px) {
12311
+ .likert-scale--responsive {
12312
+ flex-direction: column;
12313
+ align-items: stretch;
12314
+ }
12315
+ .likert-scale--responsive .likert-scale__question-label {
12316
+ margin-bottom: 12px;
12317
+ }
12318
+ .likert-scale--responsive .likert-scale__scale-container {
12319
+ width: 100%;
12320
+ }
12321
+ .likert-scale--responsive .likert-scale__scale {
12322
+ flex-direction: column;
12323
+ align-items: stretch;
12324
+ }
12325
+ .likert-scale--responsive .likert-scale__item {
12326
+ flex-direction: row;
12327
+ justify-content: flex-start;
12328
+ padding: 4px 0;
12329
+ width: 100%;
12330
+ }
12331
+ .likert-scale--responsive .likert-scale__number {
12332
+ margin-bottom: 0;
12333
+ margin-right: 12px;
12334
+ min-width: 24px;
12335
+ text-align: left;
12336
+ }
12337
+ .likert-scale--responsive .likert-scale__anchors {
12338
+ flex-direction: column;
12339
+ margin-top: 0;
12340
+ margin-left: 60px;
12341
+ }
12342
+ .likert-scale--responsive .likert-scale__anchor {
12343
+ margin: 4px 0;
12344
+ text-align: left;
12345
+ flex: 0 0 auto;
12346
+ }
12347
+ .likert-scale--responsive .likert-scale__anchor--start, .likert-scale--responsive .likert-scale__anchor--middle, .likert-scale--responsive .likert-scale__anchor--end {
12348
+ text-align: left;
12349
+ }
12350
+ }
12351
+
12352
+ .likert-scale--compact {
12353
+ margin-bottom: 12px;
12354
+ gap: 12px;
12355
+ }
12356
+ .likert-scale--compact .likert-scale__scale {
12357
+ gap: 4px;
12358
+ }
12359
+ .likert-scale--compact .likert-scale__anchors {
12360
+ margin-top: 4px;
12361
+ }
12362
+
12363
+ .likert-scale--standard {
12364
+ margin-bottom: 20px;
12365
+ gap: 16px;
12366
+ }
12367
+ .likert-scale--standard .likert-scale__scale {
12368
+ gap: 10px;
12369
+ }
12370
+
12371
+ .likert-scale--comfortable {
12372
+ margin-bottom: 28px;
12373
+ gap: 20px;
12374
+ }
12375
+ .likert-scale--comfortable .likert-scale__scale {
12376
+ gap: 16px;
12377
+ }
12378
+ .likert-scale--comfortable .likert-scale__anchors {
12379
+ margin-top: 12px;
12380
+ }
12381
+
12382
+ .likert-scale--small .likert-scale__number {
12383
+ font-size: 14px;
12384
+ margin-bottom: 2px;
12385
+ }
12386
+ .likert-scale--small .likert-scale__label {
12387
+ min-width: 36px;
12388
+ min-height: 36px;
12389
+ }
12390
+ .likert-scale--small .likert-scale__anchor {
12391
+ font-size: 0.75rem;
12392
+ }
12393
+
12394
+ .likert-scale--medium .likert-scale__number {
12395
+ font-size: 16px;
12396
+ margin-bottom: 4px;
12397
+ }
12398
+ .likert-scale--medium .likert-scale__label {
12399
+ min-width: 48px;
12400
+ min-height: 48px;
12401
+ }
12402
+ .likert-scale--medium .likert-scale__anchor {
12403
+ font-size: 0.875rem;
12404
+ }
12405
+
12406
+ .likert-scale--large .likert-scale__number {
12407
+ font-size: 18px;
12408
+ margin-bottom: 6px;
12409
+ }
12410
+ .likert-scale--large .likert-scale__label {
12411
+ min-width: 56px;
12412
+ min-height: 56px;
12413
+ }
12414
+ .likert-scale--large .likert-scale__anchor {
12415
+ font-size: 1rem;
12416
+ }
12417
+
12418
+ .likert-scale__sr-only {
12419
+ position: absolute;
12420
+ width: 1px;
12421
+ height: 1px;
12422
+ padding: 0;
12423
+ margin: -1px;
12424
+ overflow: hidden;
12425
+ clip: rect(0, 0, 0, 0);
12426
+ white-space: nowrap;
12427
+ border: 0;
12428
+ }
12429
+
12430
+ @media (pointer: coarse) {
12431
+ .likert-scale__label {
12432
+ min-width: 48px;
12433
+ min-height: 48px;
12434
+ }
12435
+ }
12436
+ [dir=rtl] .likert-scale__tooltip::after {
12437
+ transform: translateX(50%);
12438
+ }
12439
+ [dir=rtl] .likert-scale--vertical .likert-scale__number {
12440
+ margin-right: 0;
12441
+ margin-left: 12px;
12442
+ }
12443
+ [dir=rtl] .likert-scale--vertical .likert-scale__anchors {
12444
+ margin-left: 0;
12445
+ margin-right: 60px;
12446
+ }
12447
+ [dir=rtl] .likert-scale--vertical .likert-scale__item {
12448
+ justify-content: flex-end;
12449
+ }
12450
+ [dir=rtl] .likert-scale--aligned .likert-scale__question-label {
12451
+ text-align: right;
12452
+ }
12453
+
12454
+ @media (prefers-contrast: high) {
12455
+ .likert-scale__label::before {
12456
+ border-width: 3px;
12457
+ }
12458
+ }
12459
+ [data-theme=dark] .likert-scale__tooltip {
12460
+ background: rgba(255, 255, 255, 0.9);
12461
+ color: rgba(0, 0, 0, 0.87);
12462
+ }
12463
+ [data-theme=dark] .likert-scale__tooltip::after {
12464
+ border-top-color: rgba(255, 255, 255, 0.9);
12465
+ }
12466
+
12467
+ @media (prefers-reduced-motion: reduce) {
12468
+ .likert-scale,
12469
+ .likert-scale__item,
12470
+ .likert-scale__label,
12471
+ .likert-scale__tooltip {
12472
+ transition: none !important;
12473
+ animation: none !important;
12474
+ }
12475
+ .likert-scale__item:hover:not(.likert-scale__item--disabled):not(.likert-scale__item--readonly) {
12476
+ transform: none;
12477
+ }
12478
+ }
12019
12479
  .toggle-group {
12020
12480
  display: inline-flex;
12021
12481
  border-radius: 4px;
package/dist/index.d.ts CHANGED
@@ -49,6 +49,7 @@ export * from './timeline';
49
49
  export * from './masonry';
50
50
  export * from './image-list';
51
51
  export * from './rating';
52
+ export * from './likert-scale';
52
53
  export * from './toggle-group';
53
54
  export * from './circular-progress';
54
55
  export * from './linear-progress';