@webiny/ui 5.29.0 → 5.30.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.
Files changed (98) hide show
  1. package/AutoComplete/MultiAutoComplete.js +2 -0
  2. package/AutoComplete/MultiAutoComplete.js.map +1 -1
  3. package/AutoComplete/utils.d.ts +1 -1
  4. package/Button/Button.js +3 -1
  5. package/Button/Button.js.map +1 -1
  6. package/Button/Button.styles.d.ts +6 -0
  7. package/Button/Button.styles.js +15 -0
  8. package/Button/Button.styles.js.map +1 -0
  9. package/Chips/Chips.stories.js +10 -6
  10. package/Chips/Chips.stories.js.map +1 -1
  11. package/Chips/index.d.ts +0 -1
  12. package/Chips/index.js +0 -13
  13. package/Chips/index.js.map +1 -1
  14. package/Chips/styles.js +7 -5
  15. package/Chips/styles.js.map +1 -1
  16. package/Dialog/Dialog.js +4 -2
  17. package/Dialog/Dialog.js.map +1 -1
  18. package/DynamicFieldset/Fieldset.js +4 -1
  19. package/DynamicFieldset/Fieldset.js.map +1 -1
  20. package/Grid/Grid.js +1 -1
  21. package/Grid/Grid.js.map +1 -1
  22. package/ImageEditor/ImageEditor.js +2 -0
  23. package/ImageEditor/ImageEditor.js.map +1 -1
  24. package/Input/Input.d.ts +1 -0
  25. package/Input/Input.js +13 -1
  26. package/Input/Input.js.map +1 -1
  27. package/List/DataList/DataList.js.map +1 -1
  28. package/List/DataList/DataListWithSections.d.ts +45 -0
  29. package/List/DataList/DataListWithSections.js +356 -0
  30. package/List/DataList/DataListWithSections.js.map +1 -0
  31. package/List/DataList/index.d.ts +1 -0
  32. package/List/DataList/index.js +16 -0
  33. package/List/DataList/index.js.map +1 -1
  34. package/List/List.d.ts +1 -1
  35. package/List/List.js.map +1 -1
  36. package/List/index.d.ts +1 -1
  37. package/List/index.js +14 -0
  38. package/List/index.js.map +1 -1
  39. package/Menu/Menu.d.ts +0 -2
  40. package/Menu/Menu.js +1 -4
  41. package/Menu/Menu.js.map +1 -1
  42. package/Select/Select.js +2 -1
  43. package/Select/Select.js.map +1 -1
  44. package/Tabs/Tab.js +23 -10
  45. package/Tabs/Tab.js.map +1 -1
  46. package/Tabs/Tabs.d.ts +37 -21
  47. package/Tabs/Tabs.js +115 -142
  48. package/Tabs/Tabs.js.map +1 -1
  49. package/Tooltip/Tooltip.d.ts +1 -1
  50. package/TopAppBar/TopAppBarActionItem.d.ts +1 -1
  51. package/TopAppBar/TopAppBarActionItem.js.map +1 -1
  52. package/TopAppBar/TopAppBarNavigationIcon.d.ts +1 -1
  53. package/TopAppBar/TopAppBarNavigationIcon.js.map +1 -1
  54. package/package.json +32 -44
  55. package/styles.scss +1 -1
  56. package/Chips/ChipIcon.d.ts +0 -4
  57. package/Chips/ChipIcon.js +0 -22
  58. package/Chips/ChipIcon.js.map +0 -1
  59. package/rmwc/base/LICENSE +0 -21
  60. package/rmwc/base/README.md +0 -3
  61. package/rmwc/base/code/component.d.ts +0 -18
  62. package/rmwc/base/code/component.js +0 -163
  63. package/rmwc/base/code/foundation-component.d.ts +0 -79
  64. package/rmwc/base/code/foundation-component.js +0 -354
  65. package/rmwc/base/code/index.d.ts +0 -16
  66. package/rmwc/base/code/index.js +0 -25
  67. package/rmwc/base/code/test-polyfill.d.ts +0 -3
  68. package/rmwc/base/code/test-polyfill.js +0 -33
  69. package/rmwc/base/code/utils/apply-passive.d.ts +0 -13
  70. package/rmwc/base/code/utils/apply-passive.js +0 -63
  71. package/rmwc/base/code/utils/debounce.d.ts +0 -2
  72. package/rmwc/base/code/utils/debounce.js +0 -17
  73. package/rmwc/base/code/utils/deprecation.d.ts +0 -10
  74. package/rmwc/base/code/utils/deprecation.js +0 -76
  75. package/rmwc/base/code/utils/emitter.d.ts +0 -13
  76. package/rmwc/base/code/utils/emitter.js +0 -120
  77. package/rmwc/base/code/utils/events-map.d.ts +0 -87
  78. package/rmwc/base/code/utils/events-map.js +0 -90
  79. package/rmwc/base/code/utils/index.d.ts +0 -10
  80. package/rmwc/base/code/utils/index.js +0 -19
  81. package/rmwc/base/code/utils/ponyfills.d.ts +0 -3
  82. package/rmwc/base/code/utils/ponyfills.js +0 -29
  83. package/rmwc/base/code/utils/random-id.d.ts +0 -6
  84. package/rmwc/base/code/utils/random-id.js +0 -14
  85. package/rmwc/base/code/utils/strings.d.ts +0 -3
  86. package/rmwc/base/code/utils/strings.js +0 -13
  87. package/rmwc/base/code/utils/use-knob.d.ts +0 -2
  88. package/rmwc/base/code/utils/use-knob.js +0 -64
  89. package/rmwc/base/code/utils/wrap-child.d.ts +0 -3
  90. package/rmwc/base/code/utils/wrap-child.js +0 -55
  91. package/rmwc/base/code/with-theme.d.ts +0 -15
  92. package/rmwc/base/code/with-theme.js +0 -106
  93. package/rmwc/base/package.json +0 -40
  94. package/rmwc/textfield/code/index.d.ts +0 -135
  95. package/rmwc/textfield/code/index.js +0 -571
  96. package/rmwc/textfield/next/index.d.ts +0 -135
  97. package/rmwc/textfield/next/index.js +0 -560
  98. package/rmwc/textfield/package.json +0 -45
@@ -1,120 +0,0 @@
1
- /* eslint-disable */
2
- "use strict";
3
- var __extends =
4
- (this && this.__extends) ||
5
- (function () {
6
- var extendStatics = function (d, b) {
7
- extendStatics =
8
- Object.setPrototypeOf ||
9
- ({ __proto__: [] } instanceof Array &&
10
- function (d, b) {
11
- d.__proto__ = b;
12
- }) ||
13
- function (d, b) {
14
- for (var p in b) {
15
- if (b.hasOwnProperty(p)) {
16
- d[p] = b[p];
17
- }
18
- }
19
- };
20
- return extendStatics(d, b);
21
- };
22
- return function (d, b) {
23
- extendStatics(d, b);
24
- function __() {
25
- this.constructor = d;
26
- }
27
- d.prototype = b === null ? Object.create(b) : ((__.prototype = b.prototype), new __());
28
- };
29
- })();
30
- var __read =
31
- (this && this.__read) ||
32
- function (o, n) {
33
- var m = typeof Symbol === "function" && o[Symbol.iterator];
34
- if (!m) {
35
- return o;
36
- }
37
- var i = m.call(o),
38
- r,
39
- ar = [],
40
- e;
41
- try {
42
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done) {
43
- ar.push(r.value);
44
- }
45
- } catch (error) {
46
- e = { error: error };
47
- } finally {
48
- try {
49
- if (r && !r.done && (m = i["return"])) {
50
- m.call(i);
51
- }
52
- } finally {
53
- if (e) {
54
- throw e.error;
55
- }
56
- }
57
- }
58
- return ar;
59
- };
60
- var __spread =
61
- (this && this.__spread) ||
62
- function () {
63
- for (var ar = [], i = 0; i < arguments.length; i++) {
64
- ar = ar.concat(__read(arguments[i]));
65
- }
66
- return ar;
67
- };
68
- Object.defineProperty(exports, "__esModule", { value: true });
69
- var EventEmitter = /** @class */ (function () {
70
- function EventEmitter() {
71
- this.events_ = {};
72
- }
73
- EventEmitter.prototype.on = function (event, cb) {
74
- this.events_ = this.events_ || {};
75
- this.events_[event] = this.events_[event] || [];
76
- this.events_[event].push(cb);
77
- };
78
- EventEmitter.prototype.off = function (event, cb) {
79
- this.events_ = this.events_ || {};
80
- if (event in this.events_ === false) {
81
- return;
82
- }
83
- this.events_[event].splice(this.events_[event].indexOf(cb), 1);
84
- };
85
- EventEmitter.prototype.trigger = function (event) {
86
- var args = [];
87
- for (var _i = 1; _i < arguments.length; _i++) {
88
- args[_i - 1] = arguments[_i];
89
- }
90
- this.events_ = this.events_ || {};
91
- if (event in this.events_ === false) {
92
- return;
93
- }
94
- for (var i = 0; i < this.events_[event].length; i++) {
95
- this.events_[event][i].apply(this, Array.prototype.slice.call(arguments, 1));
96
- }
97
- };
98
- return EventEmitter;
99
- })();
100
- exports.EventEmitter = EventEmitter;
101
- var ArrayEmitter = /** @class */ (function (_super) {
102
- __extends(ArrayEmitter, _super);
103
- function ArrayEmitter() {
104
- var _this = (_super !== null && _super.apply(this, arguments)) || this;
105
- _this.array = [];
106
- return _this;
107
- }
108
- ArrayEmitter.prototype.push = function () {
109
- var _a;
110
- var items = [];
111
- for (var _i = 0; _i < arguments.length; _i++) {
112
- items[_i] = arguments[_i];
113
- }
114
- var rVal = (_a = this.array).push.apply(_a, __spread(items));
115
- this.trigger("change");
116
- return rVal;
117
- };
118
- return ArrayEmitter;
119
- })(EventEmitter);
120
- exports.ArrayEmitter = ArrayEmitter;
@@ -1,87 +0,0 @@
1
- /* eslint-disable */
2
- export declare const eventsMap: {
3
- blur: string;
4
- cancel: string;
5
- click: string;
6
- close: string;
7
- contextmenu: string;
8
- copy: string;
9
- cut: string;
10
- auxclick: string;
11
- doubleclick: string;
12
- dragend: string;
13
- dragstart: string;
14
- drop: string;
15
- focus: string;
16
- input: string;
17
- invalid: string;
18
- keydown: string;
19
- keypress: string;
20
- keyup: string;
21
- mousedown: string;
22
- mouseup: string;
23
- paste: string;
24
- pause: string;
25
- play: string;
26
- pointercancel: string;
27
- pointerdown: string;
28
- pointerup: string;
29
- ratechange: string;
30
- reset: string;
31
- seeked: string;
32
- submit: string;
33
- touchcancel: string;
34
- touchend: string;
35
- touchstart: string;
36
- volumechange: string;
37
- abort: string;
38
- animationend: string;
39
- animationiteration: string;
40
- animationstart: string;
41
- canplay: string;
42
- canplaythrough: string;
43
- drag: string;
44
- dragenter: string;
45
- dragexit: string;
46
- dragleave: string;
47
- dragover: string;
48
- durationchange: string;
49
- emptied: string;
50
- encrypted: string;
51
- ended: string;
52
- error: string;
53
- gotpointercapture: string;
54
- load: string;
55
- loadeddata: string;
56
- loadedmetadata: string;
57
- loadstart: string;
58
- lostpointercapture: string;
59
- mousemove: string;
60
- mouseout: string;
61
- mouseover: string;
62
- playing: string;
63
- pointermove: string;
64
- pointerout: string;
65
- pointerover: string;
66
- progress: string;
67
- scroll: string;
68
- seeking: string;
69
- stalled: string;
70
- suspend: string;
71
- timeupdate: string;
72
- toggle: string;
73
- touchmove: string;
74
- transitionend: string;
75
- waiting: string;
76
- wheel: string;
77
- mouseenter: string;
78
- mouseleave: string;
79
- pointerenter: string;
80
- pointerleave: string;
81
- change: string;
82
- select: string;
83
- beforeinput: string;
84
- compositionend: string;
85
- compositionstart: string;
86
- compositionupdate: string;
87
- };
@@ -1,90 +0,0 @@
1
- /* eslint-disable */
2
- "use strict";
3
- /* istanbul ignore file */
4
- Object.defineProperty(exports, "__esModule", { value: true });
5
- exports.eventsMap = {
6
- blur: "onBlur",
7
- cancel: "onCancel",
8
- click: "onClick",
9
- close: "onClose",
10
- contextmenu: "onContextMenu",
11
- copy: "onCopy",
12
- cut: "onCut",
13
- auxclick: "onAuxClick",
14
- doubleclick: "onDoubleClick",
15
- dragend: "onDragEnd",
16
- dragstart: "onDragStart",
17
- drop: "onDrop",
18
- focus: "onFocus",
19
- input: "onInput",
20
- invalid: "onInvalid",
21
- keydown: "onKeyDown",
22
- keypress: "onKeyPress",
23
- keyup: "onKeyUp",
24
- mousedown: "onMouseDown",
25
- mouseup: "onMouseUp",
26
- paste: "onPaste",
27
- pause: "onPause",
28
- play: "onPlay",
29
- pointercancel: "onPointerCancel",
30
- pointerdown: "onPointerDown",
31
- pointerup: "onPointerUp",
32
- ratechange: "onRateChange",
33
- reset: "onReset",
34
- seeked: "onSeeked",
35
- submit: "onSubmit",
36
- touchcancel: "onTouchCancel",
37
- touchend: "onTouchEnd",
38
- touchstart: "onTouchStart",
39
- volumechange: "onVolumeChange",
40
- abort: "onAbort",
41
- animationend: "onAnimationEnd",
42
- animationiteration: "onAnimationIteration",
43
- animationstart: "onAnimationStart",
44
- canplay: "onCanPlay",
45
- canplaythrough: "onCanPlayThrough",
46
- drag: "onDrag",
47
- dragenter: "onDragEnter",
48
- dragexit: "onDragExit",
49
- dragleave: "onDragLeave",
50
- dragover: "onDragOver",
51
- durationchange: "onDurationChange",
52
- emptied: "onEmptied",
53
- encrypted: "onEncrypted",
54
- ended: "onEnded",
55
- error: "onError",
56
- gotpointercapture: "onGotPointerCapture",
57
- load: "onLoad",
58
- loadeddata: "onLoadedData",
59
- loadedmetadata: "onLoadedMetadata",
60
- loadstart: "onLoadStart",
61
- lostpointercapture: "onLostPointerCapture",
62
- mousemove: "onMouseMove",
63
- mouseout: "onMouseOut",
64
- mouseover: "onMouseOver",
65
- playing: "onPlaying",
66
- pointermove: "onPointerMove",
67
- pointerout: "onPointerOut",
68
- pointerover: "onPointerOver",
69
- progress: "onProgress",
70
- scroll: "onScroll",
71
- seeking: "onSeeking",
72
- stalled: "onStalled",
73
- suspend: "onSuspend",
74
- timeupdate: "onTimeUpdate",
75
- toggle: "onToggle",
76
- touchmove: "onTouchMove",
77
- transitionend: "onTransitionEnd",
78
- waiting: "onWaiting",
79
- wheel: "onWheel",
80
- mouseenter: "onMouseEnter",
81
- mouseleave: "onMouseLeave",
82
- pointerenter: "onPointerEnter",
83
- pointerleave: "onPointerLeave",
84
- change: "onChange",
85
- select: "onSelect",
86
- beforeinput: "onBeforeInput",
87
- compositionend: "onCompositionEnd",
88
- compositionstart: "onCompositionStart",
89
- compositionupdate: "onCompositionUpdate"
90
- };
@@ -1,10 +0,0 @@
1
- /* eslint-disable */
2
- export * from './debounce';
3
- export * from './deprecation';
4
- export * from './events-map';
5
- export * from './ponyfills';
6
- export * from './random-id';
7
- export * from './strings';
8
- export * from './wrap-child';
9
- export * from './emitter';
10
- export * from './apply-passive';
@@ -1,19 +0,0 @@
1
- /* eslint-disable */
2
- "use strict";
3
- function __export(m) {
4
- for (var p in m) {
5
- if (!exports.hasOwnProperty(p)) {
6
- exports[p] = m[p];
7
- }
8
- }
9
- }
10
- Object.defineProperty(exports, "__esModule", { value: true });
11
- __export(require("./debounce"));
12
- __export(require("./deprecation"));
13
- __export(require("./events-map"));
14
- __export(require("./ponyfills"));
15
- __export(require("./random-id"));
16
- __export(require("./strings"));
17
- __export(require("./wrap-child"));
18
- __export(require("./emitter"));
19
- __export(require("./apply-passive"));
@@ -1,3 +0,0 @@
1
- /* eslint-disable */
2
- export declare const closest: (element: EventTarget | HTMLElement | null, selector: string) => HTMLElement | null;
3
- export declare const matches: (element: HTMLElement, selector: string) => boolean;
@@ -1,29 +0,0 @@
1
- /* eslint-disable */
2
- "use strict";
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.closest = function (element, selector) {
5
- if (element instanceof Element) {
6
- /* istanbul ignore else */
7
- if (element && element.closest) {
8
- return element.closest(selector);
9
- } else {
10
- var el = element;
11
- while (el) {
12
- if (exports.matches(el, selector)) {
13
- return el;
14
- }
15
- el = el.parentElement;
16
- }
17
- }
18
- }
19
- return null;
20
- };
21
- exports.matches = function (element, selector) {
22
- /* istanbul ignore next */
23
- var nativeMatches =
24
- element.matches ||
25
- element.webkitMatchesSelector ||
26
- // @ts-ignore
27
- element.msMatchesSelector;
28
- return nativeMatches.call(element, selector);
29
- };
@@ -1,6 +0,0 @@
1
- /* eslint-disable */
2
- /**
3
- * Generates a pseudo random string for DOM ids
4
- * Will return 'test' in the NODE test-env so things like storyshots doesnt break.
5
- */
6
- export declare const randomId: (prefix?: string | undefined) => string;
@@ -1,14 +0,0 @@
1
- /* eslint-disable */
2
- "use strict";
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- /**
5
- * Generates a pseudo random string for DOM ids
6
- * Will return 'test' in the NODE test-env so things like storyshots doesnt break.
7
- */
8
- exports.randomId = function (prefix) {
9
- var id =
10
- process.env.NODE_ENV === "test"
11
- ? "test"
12
- : (Math.random() + Math.random() + 1).toString(36).substring(2);
13
- return prefix + "-" + id;
14
- };
@@ -1,3 +0,0 @@
1
- /* eslint-disable */
2
- export declare const toCamel: (str: string) => string;
3
- export declare const toDashCase: (str: string) => string;
@@ -1,13 +0,0 @@
1
- /* eslint-disable */
2
- "use strict";
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.toCamel = function (str) {
5
- return str.replace(/(-[a-z])/g, function ($1) {
6
- return $1.toUpperCase().replace("-", "");
7
- });
8
- };
9
- exports.toDashCase = function (str) {
10
- return str.replace(/([A-Z])/g, function ($1) {
11
- return "-" + $1.toLowerCase();
12
- });
13
- };
@@ -1,2 +0,0 @@
1
- /* eslint-disable */
2
- export declare const useKnob: (knobType: "number" | "boolean" | "object" | "button" | "select" | "text" | "color" | "date" | "files" | "knob" | "radios" | "array" | "optionsKnob" | "withKnobs" | "withKnobsOptions", name: string, defaultValue: any) => any[];
@@ -1,64 +0,0 @@
1
- /* eslint-disable */
2
- "use strict";
3
- var __read =
4
- (this && this.__read) ||
5
- function (o, n) {
6
- var m = typeof Symbol === "function" && o[Symbol.iterator];
7
- if (!m) {
8
- return o;
9
- }
10
- var i = m.call(o),
11
- r,
12
- ar = [],
13
- e;
14
- try {
15
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done) {
16
- ar.push(r.value);
17
- }
18
- } catch (error) {
19
- e = { error: error };
20
- } finally {
21
- try {
22
- if (r && !r.done && (m = i["return"])) {
23
- m.call(i);
24
- }
25
- } finally {
26
- if (e) {
27
- throw e.error;
28
- }
29
- }
30
- }
31
- return ar;
32
- };
33
- var __importStar =
34
- (this && this.__importStar) ||
35
- function (mod) {
36
- if (mod && mod.__esModule) {
37
- return mod;
38
- }
39
- var result = {};
40
- if (mod != null) {
41
- for (var k in mod) {
42
- if (Object.hasOwnProperty.call(mod, k)) {
43
- result[k] = mod[k];
44
- }
45
- }
46
- }
47
- result["default"] = mod;
48
- return result;
49
- };
50
- Object.defineProperty(exports, "__esModule", { value: true });
51
- /* istanbul ignore file */
52
- var react_1 = require("react");
53
- var knobTypes = __importStar(require("@storybook/addon-knobs"));
54
- exports.useKnob = function (knobType, name, defaultValue) {
55
- var knobFunc = knobTypes[knobType];
56
- var _a = __read(react_1.useState(defaultValue), 2),
57
- stateValue = _a[0],
58
- stateSetter = _a[1];
59
- var knobValue = knobFunc(name, stateValue);
60
- if (knobValue !== stateValue) {
61
- stateSetter(knobValue);
62
- }
63
- return [stateValue, stateSetter];
64
- };
@@ -1,3 +0,0 @@
1
- /* eslint-disable */
2
- import * as React from 'react';
3
- export declare const wrapChild: (props: any) => React.DetailedReactHTMLElement<any, HTMLElement>;
@@ -1,55 +0,0 @@
1
- /* eslint-disable */
2
- "use strict";
3
- var __assign =
4
- (this && this.__assign) ||
5
- function () {
6
- __assign =
7
- Object.assign ||
8
- function (t) {
9
- for (var s, i = 1, n = arguments.length; i < n; i++) {
10
- s = arguments[i];
11
- for (var p in s) {
12
- if (Object.prototype.hasOwnProperty.call(s, p)) {
13
- t[p] = s[p];
14
- }
15
- }
16
- }
17
- return t;
18
- };
19
- return __assign.apply(this, arguments);
20
- };
21
- var __importStar =
22
- (this && this.__importStar) ||
23
- function (mod) {
24
- if (mod && mod.__esModule) {
25
- return mod;
26
- }
27
- var result = {};
28
- if (mod != null) {
29
- for (var k in mod) {
30
- if (Object.hasOwnProperty.call(mod, k)) {
31
- result[k] = mod[k];
32
- }
33
- }
34
- }
35
- result["default"] = mod;
36
- return result;
37
- };
38
- var __importDefault =
39
- (this && this.__importDefault) ||
40
- function (mod) {
41
- return mod && mod.__esModule ? mod : { default: mod };
42
- };
43
- Object.defineProperty(exports, "__esModule", { value: true });
44
- var React = __importStar(require("react"));
45
- var classnames_1 = __importDefault(require("classnames"));
46
- exports.wrapChild = function (props) {
47
- var child = React.Children.only(props.children);
48
- return React.cloneElement(
49
- child,
50
- __assign({}, props, child.props, {
51
- // @ts-ignore
52
- className: classnames_1.default(props.className, child.props.className)
53
- })
54
- );
55
- };
@@ -1,15 +0,0 @@
1
- /* eslint-disable */
2
- import * as RMWC from '@rmwc/types';
3
- import * as React from 'react';
4
- export interface WithThemeProps {
5
- theme?: RMWC.ThemePropT;
6
- className?: string;
7
- }
8
- /**
9
- * Actually parses the theme options
10
- */
11
- export declare const parseThemeOptions: (theme: string | string[]) => string[];
12
- /**
13
- * HOC that adds themeability to any component
14
- */
15
- export declare const withTheme: <P extends any>(Component: React.ComponentType<any>) => React.ComponentType<any>;
@@ -1,106 +0,0 @@
1
- /* eslint-disable */
2
- "use strict";
3
- var __assign =
4
- (this && this.__assign) ||
5
- function () {
6
- __assign =
7
- Object.assign ||
8
- function (t) {
9
- for (var s, i = 1, n = arguments.length; i < n; i++) {
10
- s = arguments[i];
11
- for (var p in s) {
12
- if (Object.prototype.hasOwnProperty.call(s, p)) {
13
- t[p] = s[p];
14
- }
15
- }
16
- }
17
- return t;
18
- };
19
- return __assign.apply(this, arguments);
20
- };
21
- var __rest =
22
- (this && this.__rest) ||
23
- function (s, e) {
24
- var t = {};
25
- for (var p in s) {
26
- if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) {
27
- t[p] = s[p];
28
- }
29
- }
30
- if (s != null && typeof Object.getOwnPropertySymbols === "function") {
31
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
32
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) {
33
- t[p[i]] = s[p[i]];
34
- }
35
- }
36
- }
37
- return t;
38
- };
39
- var __importStar =
40
- (this && this.__importStar) ||
41
- function (mod) {
42
- if (mod && mod.__esModule) {
43
- return mod;
44
- }
45
- var result = {};
46
- if (mod != null) {
47
- for (var k in mod) {
48
- if (Object.hasOwnProperty.call(mod, k)) {
49
- result[k] = mod[k];
50
- }
51
- }
52
- }
53
- result["default"] = mod;
54
- return result;
55
- };
56
- var __importDefault =
57
- (this && this.__importDefault) ||
58
- function (mod) {
59
- return mod && mod.__esModule ? mod : { default: mod };
60
- };
61
- Object.defineProperty(exports, "__esModule", { value: true });
62
- var React = __importStar(require("react"));
63
- var classnames_1 = __importDefault(require("classnames"));
64
- var strings_1 = require("./utils/strings");
65
- var deprecation_1 = require("./utils/deprecation");
66
- /**
67
- * Actually parses the theme options
68
- */
69
- exports.parseThemeOptions = function (theme) {
70
- if (typeof theme === "string" && theme.includes(" ")) {
71
- deprecation_1.deprecationWarning(
72
- "Theme no longer accepts a string of theme names with spaces. Please pass them as an array instead."
73
- );
74
- }
75
- var themeItems = Array.isArray(theme) ? theme : theme.split(" ");
76
- return themeItems.map(function (v) {
77
- if (v.includes("-")) {
78
- deprecation_1.deprecationWarning(
79
- "Theme properties need to be passed as camelCase. Please convert " +
80
- v +
81
- " to " +
82
- v.replace(/-([a-z])/g, function (m, w) {
83
- return w.toUpperCase();
84
- })
85
- );
86
- }
87
- return "mdc-theme--" + strings_1.toDashCase(v);
88
- });
89
- };
90
- /**
91
- * HOC that adds themeability to any component
92
- */
93
- exports.withTheme = function (Component) {
94
- var HOC = function (_a) {
95
- var theme = _a.theme,
96
- className = _a.className,
97
- rest = __rest(_a, ["theme", "className"]);
98
- if (theme) {
99
- var classes = classnames_1.default(className, exports.parseThemeOptions(theme));
100
- return React.createElement(Component, __assign({ className: classes }, rest));
101
- }
102
- return React.createElement(Component, __assign({ className: className }, rest));
103
- };
104
- HOC.displayName = "withTheme";
105
- return HOC;
106
- };