@momentum-design/components 0.0.28 → 0.0.30
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/browser/index.js +18 -16
- package/dist/browser/index.js.map +4 -4
- package/dist/components/avatar/avatar.component.d.ts +1 -1
- package/dist/components/avatar/avatar.component.js +5 -5
- package/dist/components/avatar/avatar.constants.d.ts +1 -1
- package/dist/components/avatar/avatar.constants.js +1 -1
- package/dist/components/badge/badge.component.d.ts +1 -1
- package/dist/components/badge/badge.component.js +6 -5
- package/dist/components/badge/badge.constants.d.ts +2 -2
- package/dist/components/badge/badge.constants.js +1 -1
- package/dist/components/badge/badge.styles.js +2 -0
- package/dist/components/icon/icon.component.d.ts +8 -6
- package/dist/components/icon/icon.component.js +20 -11
- package/dist/components/icon/icon.constants.d.ts +1 -1
- package/dist/components/icon/icon.constants.js +1 -1
- package/dist/components/iconprovider/iconprovider.component.d.ts +6 -1
- package/dist/components/iconprovider/iconprovider.component.js +15 -2
- package/dist/components/iconprovider/iconprovider.constants.d.ts +3 -1
- package/dist/components/iconprovider/iconprovider.constants.js +8 -1
- package/dist/components/iconprovider/iconprovider.context.d.ts +2 -1
- package/dist/components/text/text.utils.d.ts +1 -1
- package/dist/components/text/text.utils.js +1 -1
- package/dist/components/themeprovider/themeprovider.component.d.ts +29 -17
- package/dist/components/themeprovider/themeprovider.component.js +41 -33
- package/dist/components/themeprovider/themeprovider.constants.d.ts +2 -7
- package/dist/components/themeprovider/themeprovider.constants.js +2 -21
- package/dist/components/themeprovider/themeprovider.context.d.ts +2 -3
- package/dist/components/themeprovider/themeprovider.context.js +3 -3
- package/dist/custom-elements.json +84 -49
- package/dist/react/icon/index.d.ts +2 -2
- package/dist/react/icon/index.js +2 -2
- package/dist/react/themeprovider/index.d.ts +13 -5
- package/dist/react/themeprovider/index.js +13 -5
- package/package.json +9 -3
- package/dist/components/iconprovider/iconprovider.stories.utils.d.ts +0 -12
- package/dist/components/iconprovider/iconprovider.stories.utils.js +0 -24
- package/dist/components/themeprovider/themeprovider.stories.utils.d.ts +0 -12
- package/dist/components/themeprovider/themeprovider.stories.utils.js +0 -20
- package/dist/components/themeprovider/themeprovider.types.d.ts +0 -5
- package/dist/components/themeprovider/themeprovider.types.js +0 -2
- package/dist/components/themeprovider/themeprovider.utils.d.ts +0 -9
- package/dist/components/themeprovider/themeprovider.utils.js +0 -10
@@ -1,31 +1,12 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.TAG_NAME = exports.
|
3
|
+
exports.TAG_NAME = exports.DEFAULTS = void 0;
|
4
4
|
const tslib_1 = require("tslib");
|
5
5
|
/* eslint-disable implicit-arrow-linebreak */
|
6
6
|
const tag_name_1 = tslib_1.__importDefault(require("../../utils/tag-name"));
|
7
|
-
const themeprovider_utils_1 = tslib_1.__importDefault(require("./themeprovider.utils"));
|
8
7
|
const TAG_NAME = tag_name_1.default.constructTagName('themeprovider');
|
9
8
|
exports.TAG_NAME = TAG_NAME;
|
10
|
-
// Some themes are disabled until tokens are available for those themes
|
11
|
-
const THEME_NAMES = {
|
12
|
-
// DARK_BRONZE: 'darkBronze' as const,
|
13
|
-
// DARK_INDIGO: 'darkIndigo' as const,
|
14
|
-
// DARK_JADE: 'darkJade' as const,
|
15
|
-
// DARK_LAVENDER: 'darkLavender' as const,
|
16
|
-
// DARK_ROSE: 'darkRose' as const,
|
17
|
-
DARK_WEBEX: 'darkWebex',
|
18
|
-
// LIGHT_BRONZE: 'lightBronze' as const,
|
19
|
-
// LIGHT_INDIGO: 'lightIndigo' as const,
|
20
|
-
// LIGHT_JADE: 'lightJade' as const,
|
21
|
-
// LIGHT_LAVENDER: 'lightLavender' as const,
|
22
|
-
// LIGHT_ROSE: 'lightRose' as const,
|
23
|
-
LIGHT_WEBEX: 'lightWebex',
|
24
|
-
};
|
25
|
-
exports.THEME_NAMES = THEME_NAMES;
|
26
|
-
const THEMES = Object.values(THEME_NAMES).map((themeName) => themeprovider_utils_1.default.getFullQualifiedTheme(themeName));
|
27
|
-
exports.THEMES = THEMES;
|
28
9
|
const DEFAULTS = {
|
29
|
-
|
10
|
+
THEMECLASS: 'mds-theme-stable-darkWebex',
|
30
11
|
};
|
31
12
|
exports.DEFAULTS = DEFAULTS;
|
@@ -1,9 +1,8 @@
|
|
1
|
-
import type { Theme } from './themeprovider.types';
|
2
1
|
declare class ThemeProviderContext {
|
3
|
-
|
2
|
+
themeclass?: string;
|
4
3
|
static context: {
|
5
4
|
__context__: ThemeProviderContext;
|
6
5
|
};
|
7
|
-
constructor(
|
6
|
+
constructor(defaultThemeClass?: string);
|
8
7
|
}
|
9
8
|
export default ThemeProviderContext;
|
@@ -3,9 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const context_1 = require("@lit/context");
|
4
4
|
const themeprovider_constants_1 = require("./themeprovider.constants");
|
5
5
|
class ThemeProviderContext {
|
6
|
-
// constructor to allow setting the
|
7
|
-
constructor(
|
8
|
-
this.
|
6
|
+
// constructor to allow setting the defaultThemeClass
|
7
|
+
constructor(defaultThemeClass) {
|
8
|
+
this.themeclass = defaultThemeClass;
|
9
9
|
}
|
10
10
|
}
|
11
11
|
// create typed lit context as part of the ThemeProviderContext
|
@@ -44,12 +44,12 @@
|
|
44
44
|
},
|
45
45
|
{
|
46
46
|
"kind": "field",
|
47
|
-
"name": "
|
47
|
+
"name": "size",
|
48
48
|
"type": {
|
49
49
|
"text": "number | undefined"
|
50
50
|
},
|
51
51
|
"description": "Scale of the avatar",
|
52
|
-
"attribute": "
|
52
|
+
"attribute": "size"
|
53
53
|
},
|
54
54
|
{
|
55
55
|
"kind": "method",
|
@@ -85,12 +85,12 @@
|
|
85
85
|
"fieldName": "src"
|
86
86
|
},
|
87
87
|
{
|
88
|
-
"name": "
|
88
|
+
"name": "size",
|
89
89
|
"type": {
|
90
90
|
"text": "number | undefined"
|
91
91
|
},
|
92
92
|
"description": "Scale of the avatar",
|
93
|
-
"fieldName": "
|
93
|
+
"fieldName": "size"
|
94
94
|
}
|
95
95
|
],
|
96
96
|
"superclass": {
|
@@ -141,12 +141,12 @@
|
|
141
141
|
},
|
142
142
|
{
|
143
143
|
"kind": "field",
|
144
|
-
"name": "
|
144
|
+
"name": "size",
|
145
145
|
"type": {
|
146
146
|
"text": "number | undefined"
|
147
147
|
},
|
148
148
|
"description": "Scale of the badge (works in combination with length unit)\n\nDefault: `1`",
|
149
|
-
"attribute": "
|
149
|
+
"attribute": "size"
|
150
150
|
},
|
151
151
|
{
|
152
152
|
"kind": "field",
|
@@ -203,12 +203,12 @@
|
|
203
203
|
"fieldName": "type"
|
204
204
|
},
|
205
205
|
{
|
206
|
-
"name": "
|
206
|
+
"name": "size",
|
207
207
|
"type": {
|
208
208
|
"text": "number | undefined"
|
209
209
|
},
|
210
210
|
"description": "Scale of the badge (works in combination with length unit)\n\nDefault: `1`",
|
211
|
-
"fieldName": "
|
211
|
+
"fieldName": "size"
|
212
212
|
},
|
213
213
|
{
|
214
214
|
"name": "length-unit",
|
@@ -262,7 +262,7 @@
|
|
262
262
|
"declarations": [
|
263
263
|
{
|
264
264
|
"kind": "class",
|
265
|
-
"description": "Icon component, which has to be mounted inside of a `IconProvider`\ncomponent.\n\nThe `IconProvider` component defines where icons should be consumed from (`url`).\nThis `Icon` component accepts the `name` attribute, which will be\nthe file name of the icon to be loaded from the given `url`.\n\nOnce fetched, the icon will be mounted. If fetching wasn't successful,\nnothing will be shown.\n\nThe `
|
265
|
+
"description": "Icon component, which has to be mounted inside of a `IconProvider`\ncomponent.\n\nThe `IconProvider` component defines where icons should be consumed from (`url`).\nThis `Icon` component accepts the `name` attribute, which will be\nthe file name of the icon to be loaded from the given `url`.\n\nOnce fetched, the icon will be mounted. If fetching wasn't successful,\nnothing will be shown.\n\nThe `size` attribute allows sizing the icon based on the provided\n`length-unit` attribute (which will either come from the IconProvider or\ncould be overridden per icon). For example:\nif `size = 1` and `length-unit = 'em'`, the size of the icon will be\n`width: 1em; height: 1em`.\n\nFor accessibility the `role` and `aria-label` of the icon can be set.",
|
266
266
|
"name": "Icon",
|
267
267
|
"members": [
|
268
268
|
{
|
@@ -281,6 +281,14 @@
|
|
281
281
|
},
|
282
282
|
"privacy": "private"
|
283
283
|
},
|
284
|
+
{
|
285
|
+
"kind": "field",
|
286
|
+
"name": "sizeFromContext",
|
287
|
+
"type": {
|
288
|
+
"text": "number | undefined"
|
289
|
+
},
|
290
|
+
"privacy": "private"
|
291
|
+
},
|
284
292
|
{
|
285
293
|
"kind": "field",
|
286
294
|
"name": "name",
|
@@ -293,12 +301,12 @@
|
|
293
301
|
},
|
294
302
|
{
|
295
303
|
"kind": "field",
|
296
|
-
"name": "
|
304
|
+
"name": "size",
|
297
305
|
"type": {
|
298
306
|
"text": "number | undefined"
|
299
307
|
},
|
300
|
-
"description": "
|
301
|
-
"attribute": "
|
308
|
+
"description": "Size of the icon (works in combination with length unit)",
|
309
|
+
"attribute": "size"
|
302
310
|
},
|
303
311
|
{
|
304
312
|
"kind": "field",
|
@@ -306,7 +314,7 @@
|
|
306
314
|
"type": {
|
307
315
|
"text": "string | undefined"
|
308
316
|
},
|
309
|
-
"description": "Length unit attribute for
|
317
|
+
"description": "Length unit attribute for overriding length-unit from `IconProvider`",
|
310
318
|
"attribute": "length-unit"
|
311
319
|
},
|
312
320
|
{
|
@@ -332,7 +340,8 @@
|
|
332
340
|
{
|
333
341
|
"kind": "field",
|
334
342
|
"name": "iconProviderContext",
|
335
|
-
"privacy": "private"
|
343
|
+
"privacy": "private",
|
344
|
+
"readonly": true
|
336
345
|
},
|
337
346
|
{
|
338
347
|
"kind": "method",
|
@@ -355,6 +364,12 @@
|
|
355
364
|
"kind": "method",
|
356
365
|
"name": "setAriaLabelOnIcon",
|
357
366
|
"privacy": "private"
|
367
|
+
},
|
368
|
+
{
|
369
|
+
"kind": "field",
|
370
|
+
"name": "computedIconSize",
|
371
|
+
"privacy": "private",
|
372
|
+
"readonly": true
|
358
373
|
}
|
359
374
|
],
|
360
375
|
"attributes": [
|
@@ -367,19 +382,19 @@
|
|
367
382
|
"fieldName": "name"
|
368
383
|
},
|
369
384
|
{
|
370
|
-
"name": "
|
385
|
+
"name": "size",
|
371
386
|
"type": {
|
372
387
|
"text": "number | undefined"
|
373
388
|
},
|
374
|
-
"description": "
|
375
|
-
"fieldName": "
|
389
|
+
"description": "Size of the icon (works in combination with length unit)",
|
390
|
+
"fieldName": "size"
|
376
391
|
},
|
377
392
|
{
|
378
393
|
"name": "length-unit",
|
379
394
|
"type": {
|
380
395
|
"text": "string | undefined"
|
381
396
|
},
|
382
|
-
"description": "Length unit attribute for
|
397
|
+
"description": "Length unit attribute for overriding length-unit from `IconProvider`",
|
383
398
|
"fieldName": "lengthUnit"
|
384
399
|
},
|
385
400
|
{
|
@@ -406,7 +421,7 @@
|
|
406
421
|
"module": "/src/models"
|
407
422
|
},
|
408
423
|
"tagName": "mdc-icon",
|
409
|
-
"jsDoc": "/**\n * Icon component, which has to be mounted inside of a `IconProvider`\n * component.\n *\n * The `IconProvider` component defines where icons should be consumed from (`url`).\n * This `Icon` component accepts the `name` attribute, which will be\n * the file name of the icon to be loaded from the given `url`.\n *\n * Once fetched, the icon will be mounted. If fetching wasn't successful,\n * nothing will be shown.\n *\n * The `
|
424
|
+
"jsDoc": "/**\n * Icon component, which has to be mounted inside of a `IconProvider`\n * component.\n *\n * The `IconProvider` component defines where icons should be consumed from (`url`).\n * This `Icon` component accepts the `name` attribute, which will be\n * the file name of the icon to be loaded from the given `url`.\n *\n * Once fetched, the icon will be mounted. If fetching wasn't successful,\n * nothing will be shown.\n *\n * The `size` attribute allows sizing the icon based on the provided\n * `length-unit` attribute (which will either come from the IconProvider or\n * could be overridden per icon). For example:\n * if `size = 1` and `length-unit = 'em'`, the size of the icon will be\n * `width: 1em; height: 1em`.\n *\n * For accessibility the `role` and `aria-label` of the icon can be set.\n *\n * @tag mdc-icon\n * @tagname mdc-icon\n */",
|
410
425
|
"customElement": true
|
411
426
|
}
|
412
427
|
],
|
@@ -460,12 +475,23 @@
|
|
460
475
|
"kind": "field",
|
461
476
|
"name": "lengthUnit",
|
462
477
|
"type": {
|
463
|
-
"text": "string
|
478
|
+
"text": "string"
|
464
479
|
},
|
465
480
|
"description": "Length unit used for sizing of icons, default: 'em'",
|
466
481
|
"attribute": "length-unit",
|
467
482
|
"reflects": true
|
468
483
|
},
|
484
|
+
{
|
485
|
+
"kind": "field",
|
486
|
+
"name": "size",
|
487
|
+
"type": {
|
488
|
+
"text": "number | undefined"
|
489
|
+
},
|
490
|
+
"default": "DEFAULTS.LENGTH_UNIT_SIZE[DEFAULTS.LENGTH_UNIT]",
|
491
|
+
"description": "The default size of the icon.\nIf not set, it falls back to the size defined by the length unit.",
|
492
|
+
"attribute": "size",
|
493
|
+
"reflects": true
|
494
|
+
},
|
469
495
|
{
|
470
496
|
"kind": "method",
|
471
497
|
"name": "updateValuesInContext",
|
@@ -502,10 +528,19 @@
|
|
502
528
|
{
|
503
529
|
"name": "length-unit",
|
504
530
|
"type": {
|
505
|
-
"text": "string
|
531
|
+
"text": "string"
|
506
532
|
},
|
507
533
|
"description": "Length unit used for sizing of icons, default: 'em'",
|
508
534
|
"fieldName": "lengthUnit"
|
535
|
+
},
|
536
|
+
{
|
537
|
+
"name": "size",
|
538
|
+
"type": {
|
539
|
+
"text": "number | undefined"
|
540
|
+
},
|
541
|
+
"default": "DEFAULTS.LENGTH_UNIT_SIZE[DEFAULTS.LENGTH_UNIT]",
|
542
|
+
"description": "The default size of the icon.\nIf not set, it falls back to the size defined by the length unit.",
|
543
|
+
"fieldName": "size"
|
509
544
|
}
|
510
545
|
],
|
511
546
|
"superclass": {
|
@@ -595,33 +630,41 @@
|
|
595
630
|
"declarations": [
|
596
631
|
{
|
597
632
|
"kind": "class",
|
598
|
-
"description": "ThemeProvider component, which sets the
|
633
|
+
"description": "ThemeProvider component, which sets the passed in themeclass as class.\nIf the themeclass switches, the existing themeclass will be removed as a class\nand the new themeclass will be added.\n\nCSS variables defined in the themeclass will be used for the styling of child dom nodes.\n\nThemeclass context can be be consumed from Lit child components\n(see providerUtils.consume for how to consume)\n\nThemeProvider also includes basic font defaults for text.",
|
599
634
|
"name": "ThemeProvider",
|
635
|
+
"cssProperties": [
|
636
|
+
{
|
637
|
+
"description": "Option to override the font family",
|
638
|
+
"name": "--mdc-themeprovider-font-family"
|
639
|
+
},
|
640
|
+
{
|
641
|
+
"description": "Option to override the default color",
|
642
|
+
"name": "--mdc-themeprovider-color-default"
|
643
|
+
}
|
644
|
+
],
|
645
|
+
"slots": [
|
646
|
+
{
|
647
|
+
"description": "children",
|
648
|
+
"name": "default"
|
649
|
+
}
|
650
|
+
],
|
600
651
|
"members": [
|
601
652
|
{
|
602
653
|
"kind": "field",
|
603
654
|
"name": "Context",
|
604
655
|
"privacy": "public",
|
605
656
|
"static": true,
|
657
|
+
"description": "Context object of the ThemeProvider, to be consumed by child components",
|
606
658
|
"readonly": true
|
607
659
|
},
|
608
660
|
{
|
609
661
|
"kind": "field",
|
610
|
-
"name": "
|
662
|
+
"name": "themeclass",
|
611
663
|
"type": {
|
612
664
|
"text": "string"
|
613
665
|
},
|
614
|
-
"description": "
|
615
|
-
"attribute": "
|
616
|
-
},
|
617
|
-
{
|
618
|
-
"kind": "field",
|
619
|
-
"name": "theme",
|
620
|
-
"type": {
|
621
|
-
"text": "Theme"
|
622
|
-
},
|
623
|
-
"description": "Current theme attribute\n\nHas to be fully qualified, such that\nthe theme name matches the className of the respective\ntheme stylesheet",
|
624
|
-
"attribute": "theme"
|
666
|
+
"description": "Current theme class\n\nHas to be fully qualified, such that\nthe theme class matches the class of the respective\ntheme stylesheet\n\nDefault: 'mds-theme-stable-darkWebex'",
|
667
|
+
"attribute": "themeclass"
|
625
668
|
},
|
626
669
|
{
|
627
670
|
"kind": "method",
|
@@ -632,31 +675,23 @@
|
|
632
675
|
"text": "void"
|
633
676
|
}
|
634
677
|
},
|
635
|
-
"description": "Update all observing components of this\nprovider to update the
|
678
|
+
"description": "Update all observing components of this\nprovider to update the themeclass\n\nIs called on every re-render, see Provider class"
|
636
679
|
},
|
637
680
|
{
|
638
681
|
"kind": "method",
|
639
|
-
"name": "
|
682
|
+
"name": "setThemeInClassList",
|
640
683
|
"privacy": "private",
|
641
|
-
"description": "Function to update the active theme
|
684
|
+
"description": "Function to update the active theme classnames to update the theme tokens\nas CSS variables on the web component."
|
642
685
|
}
|
643
686
|
],
|
644
687
|
"attributes": [
|
645
688
|
{
|
646
|
-
"name": "
|
689
|
+
"name": "themeclass",
|
647
690
|
"type": {
|
648
691
|
"text": "string"
|
649
692
|
},
|
650
|
-
"description": "
|
651
|
-
"fieldName": "
|
652
|
-
},
|
653
|
-
{
|
654
|
-
"name": "theme",
|
655
|
-
"type": {
|
656
|
-
"text": "Theme"
|
657
|
-
},
|
658
|
-
"description": "Current theme attribute\n\nHas to be fully qualified, such that\nthe theme name matches the className of the respective\ntheme stylesheet",
|
659
|
-
"fieldName": "theme"
|
693
|
+
"description": "Current theme class\n\nHas to be fully qualified, such that\nthe theme class matches the class of the respective\ntheme stylesheet\n\nDefault: 'mds-theme-stable-darkWebex'",
|
694
|
+
"fieldName": "themeclass"
|
660
695
|
}
|
661
696
|
],
|
662
697
|
"superclass": {
|
@@ -664,7 +699,7 @@
|
|
664
699
|
"module": "/src/models"
|
665
700
|
},
|
666
701
|
"tagName": "mdc-themeprovider",
|
667
|
-
"jsDoc": "/**\n * ThemeProvider component, which sets the
|
702
|
+
"jsDoc": "/**\n * ThemeProvider component, which sets the passed in themeclass as class.\n * If the themeclass switches, the existing themeclass will be removed as a class\n * and the new themeclass will be added.\n *\n * CSS variables defined in the themeclass will be used for the styling of child dom nodes.\n *\n * Themeclass context can be be consumed from Lit child components\n * (see providerUtils.consume for how to consume)\n *\n * ThemeProvider also includes basic font defaults for text.\n *\n * @tagname mdc-themeprovider\n *\n * @slot default - children\n *\n * @cssproperty --mdc-themeprovider-font-family - Option to override the font family\n * @cssproperty --mdc-themeprovider-color-default - Option to override the default color\n */",
|
668
703
|
"customElement": true
|
669
704
|
}
|
670
705
|
],
|
@@ -10,10 +10,10 @@ import Component from '../../components/icon';
|
|
10
10
|
* Once fetched, the icon will be mounted. If fetching wasn't successful,
|
11
11
|
* nothing will be shown.
|
12
12
|
*
|
13
|
-
* The `
|
13
|
+
* The `size` attribute allows sizing the icon based on the provided
|
14
14
|
* `length-unit` attribute (which will either come from the IconProvider or
|
15
15
|
* could be overridden per icon). For example:
|
16
|
-
* if `
|
16
|
+
* if `size = 1` and `length-unit = 'em'`, the size of the icon will be
|
17
17
|
* `width: 1em; height: 1em`.
|
18
18
|
*
|
19
19
|
* For accessibility the `role` and `aria-label` of the icon can be set.
|
package/dist/react/icon/index.js
CHANGED
@@ -16,10 +16,10 @@ const icon_constants_1 = require("../../components/icon/icon.constants");
|
|
16
16
|
* Once fetched, the icon will be mounted. If fetching wasn't successful,
|
17
17
|
* nothing will be shown.
|
18
18
|
*
|
19
|
-
* The `
|
19
|
+
* The `size` attribute allows sizing the icon based on the provided
|
20
20
|
* `length-unit` attribute (which will either come from the IconProvider or
|
21
21
|
* could be overridden per icon). For example:
|
22
|
-
* if `
|
22
|
+
* if `size = 1` and `length-unit = 'em'`, the size of the icon will be
|
23
23
|
* `width: 1em; height: 1em`.
|
24
24
|
*
|
25
25
|
* For accessibility the `role` and `aria-label` of the icon can be set.
|
@@ -1,14 +1,22 @@
|
|
1
1
|
import Component from '../../components/themeprovider';
|
2
2
|
/**
|
3
|
-
* ThemeProvider component, which sets the
|
4
|
-
*
|
3
|
+
* ThemeProvider component, which sets the passed in themeclass as class.
|
4
|
+
* If the themeclass switches, the existing themeclass will be removed as a class
|
5
|
+
* and the new themeclass will be added.
|
6
|
+
*
|
7
|
+
* CSS variables defined in the themeclass will be used for the styling of child dom nodes.
|
8
|
+
*
|
9
|
+
* Themeclass context can be be consumed from Lit child components
|
5
10
|
* (see providerUtils.consume for how to consume)
|
6
11
|
*
|
7
|
-
* ThemeProvider also includes
|
8
|
-
* for Text components.
|
12
|
+
* ThemeProvider also includes basic font defaults for text.
|
9
13
|
*
|
10
|
-
* @tag mdc-themeprovider
|
11
14
|
* @tagname mdc-themeprovider
|
15
|
+
*
|
16
|
+
* @slot default - children
|
17
|
+
*
|
18
|
+
* @cssproperty --mdc-themeprovider-font-family - Option to override the font family
|
19
|
+
* @cssproperty --mdc-themeprovider-color-default - Option to override the default color
|
12
20
|
*/
|
13
21
|
declare const reactWrapper: import("@lit/react").ReactWebComponent<Component, {}>;
|
14
22
|
export default reactWrapper;
|
@@ -6,15 +6,23 @@ const react_1 = require("@lit/react");
|
|
6
6
|
const themeprovider_1 = tslib_1.__importDefault(require("../../components/themeprovider"));
|
7
7
|
const themeprovider_constants_1 = require("../../components/themeprovider/themeprovider.constants");
|
8
8
|
/**
|
9
|
-
* ThemeProvider component, which sets the
|
10
|
-
*
|
9
|
+
* ThemeProvider component, which sets the passed in themeclass as class.
|
10
|
+
* If the themeclass switches, the existing themeclass will be removed as a class
|
11
|
+
* and the new themeclass will be added.
|
12
|
+
*
|
13
|
+
* CSS variables defined in the themeclass will be used for the styling of child dom nodes.
|
14
|
+
*
|
15
|
+
* Themeclass context can be be consumed from Lit child components
|
11
16
|
* (see providerUtils.consume for how to consume)
|
12
17
|
*
|
13
|
-
* ThemeProvider also includes
|
14
|
-
* for Text components.
|
18
|
+
* ThemeProvider also includes basic font defaults for text.
|
15
19
|
*
|
16
|
-
* @tag mdc-themeprovider
|
17
20
|
* @tagname mdc-themeprovider
|
21
|
+
*
|
22
|
+
* @slot default - children
|
23
|
+
*
|
24
|
+
* @cssproperty --mdc-themeprovider-font-family - Option to override the font family
|
25
|
+
* @cssproperty --mdc-themeprovider-color-default - Option to override the default color
|
18
26
|
*/
|
19
27
|
const reactWrapper = (0, react_1.createComponent)({
|
20
28
|
tagName: themeprovider_constants_1.TAG_NAME,
|
package/package.json
CHANGED
@@ -14,8 +14,14 @@
|
|
14
14
|
"require": "./dist/index.js"
|
15
15
|
},
|
16
16
|
"./browser": "./dist/browser/index.js",
|
17
|
-
"./
|
18
|
-
"./react": "./dist/react"
|
17
|
+
"./react": "./dist/react/index.js",
|
18
|
+
"./react/*": "./dist/react/*",
|
19
|
+
"./dist/react": "./dist/react/index.js",
|
20
|
+
"./dist/react/*": "./dist/react/*",
|
21
|
+
"./components": "./dist/components/index.js",
|
22
|
+
"./components/*": "./dist/components/*",
|
23
|
+
"./dist/components": "./dist/components/index.js",
|
24
|
+
"./dist/components/*": "./dist/components/*"
|
19
25
|
},
|
20
26
|
"files": [
|
21
27
|
"./dist/",
|
@@ -31,5 +37,5 @@
|
|
31
37
|
"@momentum-design/icons": "*",
|
32
38
|
"@momentum-design/tokens": "*"
|
33
39
|
},
|
34
|
-
"version": "0.0.
|
40
|
+
"version": "0.0.30"
|
35
41
|
}
|
@@ -1,12 +0,0 @@
|
|
1
|
-
import { Component } from '../../models';
|
2
|
-
declare class SubComponentIconProvider extends Component {
|
3
|
-
currentTheme?: string;
|
4
|
-
private iconProviderContext;
|
5
|
-
render(): import("lit-html").TemplateResult<1>;
|
6
|
-
}
|
7
|
-
declare global {
|
8
|
-
interface HTMLElementTagNameMap {
|
9
|
-
['mdc-subcomponent-icon']: SubComponentIconProvider;
|
10
|
-
}
|
11
|
-
}
|
12
|
-
export {};
|
@@ -1,24 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
const tslib_1 = require("tslib");
|
4
|
-
const lit_1 = require("lit");
|
5
|
-
const models_1 = require("../../models");
|
6
|
-
const iconprovider_component_1 = tslib_1.__importDefault(require("./iconprovider.component"));
|
7
|
-
const provider_1 = tslib_1.__importDefault(require("../../utils/provider"));
|
8
|
-
// Subcomponent to be rendered in storybook, to showcase that the
|
9
|
-
// theme can be consumed as a subcomponent
|
10
|
-
class SubComponentIconProvider extends models_1.Component {
|
11
|
-
constructor() {
|
12
|
-
super(...arguments);
|
13
|
-
this.iconProviderContext = provider_1.default.consume({ host: this, context: iconprovider_component_1.default.Context });
|
14
|
-
}
|
15
|
-
render() {
|
16
|
-
var _a, _b, _c;
|
17
|
-
return (0, lit_1.html) `
|
18
|
-
<p>URL: ${(_a = this.iconProviderContext.value) === null || _a === void 0 ? void 0 : _a.url}</p>
|
19
|
-
<p>File Extension: ${(_b = this.iconProviderContext.value) === null || _b === void 0 ? void 0 : _b.fileExtension}</p>
|
20
|
-
<p>Length Unit: ${(_c = this.iconProviderContext.value) === null || _c === void 0 ? void 0 : _c.lengthUnit}</p>
|
21
|
-
`;
|
22
|
-
}
|
23
|
-
}
|
24
|
-
SubComponentIconProvider.register('mdc-subcomponent-icon');
|
@@ -1,12 +0,0 @@
|
|
1
|
-
import { Component } from '../../models';
|
2
|
-
declare class SubComponentThemeProvider extends Component {
|
3
|
-
currentTheme?: string;
|
4
|
-
private themeProviderContext;
|
5
|
-
render(): import("lit-html").TemplateResult<1>;
|
6
|
-
}
|
7
|
-
declare global {
|
8
|
-
interface HTMLElementTagNameMap {
|
9
|
-
['mdc-subcomponent']: SubComponentThemeProvider;
|
10
|
-
}
|
11
|
-
}
|
12
|
-
export {};
|
@@ -1,20 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
const tslib_1 = require("tslib");
|
4
|
-
const lit_1 = require("lit");
|
5
|
-
const models_1 = require("../../models");
|
6
|
-
const themeprovider_component_1 = tslib_1.__importDefault(require("./themeprovider.component"));
|
7
|
-
const provider_1 = tslib_1.__importDefault(require("../../utils/provider"));
|
8
|
-
// Subcomponent to be rendered in storybook, to showcase that the
|
9
|
-
// theme can be consumed as a subcomponent
|
10
|
-
class SubComponentThemeProvider extends models_1.Component {
|
11
|
-
constructor() {
|
12
|
-
super(...arguments);
|
13
|
-
this.themeProviderContext = provider_1.default.consume({ host: this, context: themeprovider_component_1.default.Context });
|
14
|
-
}
|
15
|
-
render() {
|
16
|
-
var _a;
|
17
|
-
return (0, lit_1.html) ` <p>${(_a = this.themeProviderContext.value) === null || _a === void 0 ? void 0 : _a.theme}</p> `;
|
18
|
-
}
|
19
|
-
}
|
20
|
-
SubComponentThemeProvider.register('mdc-subcomponent');
|
@@ -1,5 +0,0 @@
|
|
1
|
-
import type { ValueOf } from '../../utils/types';
|
2
|
-
import { THEME_NAMES } from './themeprovider.constants';
|
3
|
-
import type { ThemeClassPrefix, ThemeClassSeparator } from './themeprovider.utils';
|
4
|
-
export type ThemeName = ValueOf<typeof THEME_NAMES>;
|
5
|
-
export type Theme<T extends ThemeName = ThemeName> = `${ThemeClassPrefix}${ThemeClassSeparator}${T}`;
|
@@ -1,9 +0,0 @@
|
|
1
|
-
import type { Theme, ThemeName } from './themeprovider.types';
|
2
|
-
declare const THEME_CLASS_PREFIX: "mds-theme-stable";
|
3
|
-
export declare const THEME_CLASS_SEPARATOR: "-";
|
4
|
-
declare const utils: {
|
5
|
-
getFullQualifiedTheme: <T extends ThemeName>(themeName: T) => Theme;
|
6
|
-
};
|
7
|
-
export default utils;
|
8
|
-
export type ThemeClassPrefix = typeof THEME_CLASS_PREFIX;
|
9
|
-
export type ThemeClassSeparator = typeof THEME_CLASS_SEPARATOR;
|
@@ -1,10 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.THEME_CLASS_SEPARATOR = void 0;
|
4
|
-
const THEME_CLASS_PREFIX = 'mds-theme-stable';
|
5
|
-
exports.THEME_CLASS_SEPARATOR = '-';
|
6
|
-
const getFullQualifiedTheme = (themeName) => [THEME_CLASS_PREFIX, themeName].join(exports.THEME_CLASS_SEPARATOR);
|
7
|
-
const utils = {
|
8
|
-
getFullQualifiedTheme,
|
9
|
-
};
|
10
|
-
exports.default = utils;
|