@pismo/marola 0.0.1-alpha.4 → 0.0.1-alpha.6

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 (95) hide show
  1. package/README.md +17 -5
  2. package/dist/{Button-C3Qm852g.js → Button-W6tM-_IT.js} +6 -5
  3. package/dist/Dialog.module-CGVM5V_D.js +15 -0
  4. package/dist/{ListContext-D6-YwtZn.js → ListContext-Dj2Va7Iv.js} +2 -2
  5. package/dist/Portal-P3fPvS3-.js +19695 -0
  6. package/dist/{Tabs.module-_kSbSyth.js → Tabs.module-BA-PC7fA.js} +16 -16
  7. package/dist/_commonjsHelpers-CT_km90n.js +30 -0
  8. package/dist/assets/Advice.css +1 -0
  9. package/dist/assets/Button.css +1 -0
  10. package/dist/assets/Checkbox.css +1 -0
  11. package/dist/assets/Dialog.css +1 -1
  12. package/dist/assets/IconButton.css +1 -0
  13. package/dist/assets/LoadingSpinner.css +1 -1
  14. package/dist/assets/PageHeader.css +1 -0
  15. package/dist/assets/Pagination.css +1 -0
  16. package/dist/assets/Skeleton.css +1 -0
  17. package/dist/assets/SortTooltip.css +1 -0
  18. package/dist/assets/Stepper.css +1 -0
  19. package/dist/assets/Table.css +1 -0
  20. package/dist/assets/Tabs.css +1 -1
  21. package/dist/assets/Tooltip.css +1 -0
  22. package/dist/assets/Typography.css +1 -1
  23. package/dist/assets/global.css +1 -0
  24. package/dist/components/Advice/Advice.d.ts +13 -0
  25. package/dist/components/Advice/Advice.js +25 -0
  26. package/dist/components/Button/Button.d.ts +21 -0
  27. package/dist/components/Button/Button.js +70 -0
  28. package/dist/components/Checkbox/Checkbox.d.ts +17 -0
  29. package/dist/components/Checkbox/Checkbox.js +48 -0
  30. package/dist/components/Dialog/Actions.js +1 -1
  31. package/dist/components/Dialog/Backdrop.d.ts +1 -1
  32. package/dist/components/Dialog/Backdrop.js +2 -9
  33. package/dist/components/Dialog/CloseIconButton.js +12 -124
  34. package/dist/components/Dialog/Dialog.d.ts +2 -2
  35. package/dist/components/Dialog/Dialog.js +418 -20077
  36. package/dist/components/Dialog/Title.js +22 -7
  37. package/dist/components/Icon/Icon.d.ts +7 -0
  38. package/dist/components/Icon/Icon.js +9 -0
  39. package/dist/components/IconButton/IconButton.d.ts +22 -0
  40. package/dist/components/IconButton/IconButton.js +68 -0
  41. package/dist/components/LoadingSpinner/LoadingSpinner.js +12 -13
  42. package/dist/components/PageHeader/PageHeader.d.ts +36 -0
  43. package/dist/components/PageHeader/PageHeader.js +51 -0
  44. package/dist/components/PageHeader/PageHeader.stories.d.ts +43 -0
  45. package/dist/components/PageHeader/PageHeader.stories.js +49 -0
  46. package/dist/components/Pagination/Pagination.d.ts +36 -0
  47. package/dist/components/Pagination/Pagination.js +219 -0
  48. package/dist/components/Skeleton/Skeleton.d.ts +18 -0
  49. package/dist/components/Skeleton/Skeleton.js +26 -0
  50. package/dist/components/SortTooltip/SortTooltip.d.ts +26 -0
  51. package/dist/components/SortTooltip/SortTooltip.js +67 -0
  52. package/dist/components/Stepper/Stepper.d.ts +16 -0
  53. package/dist/components/Stepper/Stepper.js +33 -0
  54. package/dist/components/Table/Table.d.ts +39 -0
  55. package/dist/components/Table/Table.js +122 -0
  56. package/dist/components/Table/TableContext.d.ts +19 -0
  57. package/dist/components/Table/TableContext.js +21 -0
  58. package/dist/components/Tabs/Tab.d.ts +1 -1
  59. package/dist/components/Tabs/Tab.js +42 -37
  60. package/dist/components/Tabs/TabPanel.d.ts +1 -1
  61. package/dist/components/Tabs/TabPanel.js +20 -21
  62. package/dist/components/Tabs/Tabs.d.ts +1 -1
  63. package/dist/components/Tabs/Tabs.js +185 -214
  64. package/dist/components/Tooltip/Tooltip.d.ts +17 -0
  65. package/dist/components/Tooltip/Tooltip.js +1463 -0
  66. package/dist/components/Typography/Typography.d.ts +14 -5
  67. package/dist/components/Typography/Typography.js +76 -68
  68. package/dist/components/Typography/Typography.stories.d.ts +18 -0
  69. package/dist/components/Typography/Typography.stories.js +30 -0
  70. package/dist/components/Typography/typography.test.d.ts +1 -0
  71. package/dist/components/Typography/typography.test.js +11360 -0
  72. package/dist/{index-BZ1lkM_M.js → index-D2P7y2mE.js} +303 -327
  73. package/dist/magic-string.es-O_8lTkE3.js +738 -0
  74. package/dist/main.d.ts +5 -1
  75. package/dist/main.js +30 -21
  76. package/dist/objectWithoutPropertiesLoose-D7Cp0Pg_.js +26 -0
  77. package/dist/react-CGNQ6M5x.js +117 -0
  78. package/dist/test-utils/assertStyles.d.ts +1 -0
  79. package/dist/test-utils/assertStyles.js +11 -0
  80. package/dist/types/helpers.d.ts +14 -7
  81. package/dist/{useButton-CbmjmH5z.js → useButton-JpyBo5M4.js} +17 -16
  82. package/dist/{useCompoundItem-B7wfGDHQ.js → useCompoundItem-CTYi5M_E.js} +1 -1
  83. package/dist/useControlled-CCMYYdCM.js +31 -0
  84. package/dist/utils/styleStrings.d.ts +6 -0
  85. package/dist/utils/styleStrings.js +10 -0
  86. package/dist/utils/styleStrings.test.d.ts +1 -0
  87. package/dist/utils/styleStrings.test.js +41 -0
  88. package/dist/vi.Y_w82WR8-Df0JUamG.js +9860 -0
  89. package/package.json +47 -7
  90. package/dist/Dialog.module-BO0mdB7d.js +0 -15
  91. package/dist/assets/CallToActionButton.css +0 -1
  92. package/dist/assets/main.css +0 -1
  93. package/dist/components/CallToActionButton/CallToActionButton.d.ts +0 -21
  94. package/dist/components/CallToActionButton/CallToActionButton.js +0 -57
  95. package/src/playground/Playground.tsx +0 -20
package/dist/main.d.ts CHANGED
@@ -2,7 +2,11 @@
2
2
  export * from './components/Dialog/Dialog';
3
3
  export * from './components/Typography/Typography';
4
4
  export * from './components/LoadingSpinner/LoadingSpinner';
5
- export * from './components/CallToActionButton/CallToActionButton';
6
5
  export * from './components/Tabs/Tabs';
7
6
  export * from './components/Tabs/Tab';
8
7
  export * from './components/Tabs/TabPanel';
8
+ export * from './components/Table/Table';
9
+ export * from './components/Pagination/Pagination';
10
+ export * from './components/PageHeader/PageHeader';
11
+ export * from './components/Button/Button';
12
+ export * from './components/IconButton/IconButton';
package/dist/main.js CHANGED
@@ -1,23 +1,32 @@
1
- import './assets/main.css';
2
- import { Dialog as t } from "./components/Dialog/Dialog.js";
3
- import { Typography as a } from "./components/Typography/Typography.js";
4
- import { LoadingSpinner as p } from "./components/LoadingSpinner/LoadingSpinner.js";
5
- import { CallToActionButton as x } from "./components/CallToActionButton/CallToActionButton.js";
6
- import { Tabs as n } from "./components/Tabs/Tabs.js";
7
- import { Tab as T } from "./components/Tabs/Tab.js";
8
- import { TabPanel as d } from "./components/Tabs/TabPanel.js";
9
- import { default as u } from "./components/Dialog/Title.js";
10
- import { default as c } from "./components/Dialog/Content.js";
11
- import { default as A } from "./components/Dialog/Actions.js";
1
+ import './assets/global.css';
2
+ /* empty css */
3
+ import { Dialog as a } from "./components/Dialog/Dialog.js";
4
+ import { Typography as f } from "./components/Typography/Typography.js";
5
+ import { LoadingSpinner as n } from "./components/LoadingSpinner/LoadingSpinner.js";
6
+ import { Tabs as i } from "./components/Tabs/Tabs.js";
7
+ import { Tab as s } from "./components/Tabs/Tab.js";
8
+ import { TabPanel as g } from "./components/Tabs/TabPanel.js";
9
+ import "./components/Table/Table.js";
10
+ import { Pagination as T, defaultTranslations as b } from "./components/Pagination/Pagination.js";
11
+ import { PageHeader as c } from "./components/PageHeader/PageHeader.js";
12
+ import { Button as B } from "./components/Button/Button.js";
13
+ import { IconButton as h } from "./components/IconButton/IconButton.js";
14
+ import { default as C } from "./components/Dialog/Title.js";
15
+ import { default as I } from "./components/Dialog/Content.js";
16
+ import { default as S } from "./components/Dialog/Actions.js";
12
17
  export {
13
- A as Actions,
14
- x as CallToActionButton,
15
- c as Content,
16
- t as Dialog,
17
- u as DialogTitle,
18
- p as LoadingSpinner,
19
- T as Tab,
20
- d as TabPanel,
21
- n as Tabs,
22
- a as Typography
18
+ S as Actions,
19
+ B as Button,
20
+ I as Content,
21
+ a as Dialog,
22
+ C as DialogTitle,
23
+ h as IconButton,
24
+ n as LoadingSpinner,
25
+ c as PageHeader,
26
+ T as Pagination,
27
+ s as Tab,
28
+ g as TabPanel,
29
+ i as Tabs,
30
+ f as Typography,
31
+ b as defaultTranslations
23
32
  };
@@ -0,0 +1,26 @@
1
+ function e() {
2
+ return e = Object.assign ? Object.assign.bind() : function(n) {
3
+ for (var a = 1; a < arguments.length; a++) {
4
+ var r = arguments[a];
5
+ for (var t in r)
6
+ Object.prototype.hasOwnProperty.call(r, t) && (n[t] = r[t]);
7
+ }
8
+ return n;
9
+ }, e.apply(this, arguments);
10
+ }
11
+ function i(n, a) {
12
+ if (n == null)
13
+ return {};
14
+ var r = {};
15
+ for (var t in n)
16
+ if (Object.prototype.hasOwnProperty.call(n, t)) {
17
+ if (a.indexOf(t) >= 0)
18
+ continue;
19
+ r[t] = n[t];
20
+ }
21
+ return r;
22
+ }
23
+ export {
24
+ i as _,
25
+ e as a
26
+ };
@@ -0,0 +1,117 @@
1
+ import { c as N, g as W } from "./_commonjsHelpers-CT_km90n.js";
2
+ import T from "react";
3
+ var E = { exports: {} };
4
+ (function(A, I) {
5
+ (function(y, w) {
6
+ A.exports = w(T);
7
+ })(N, (y) => (() => {
8
+ var w = { 639: (e) => {
9
+ e.exports = y;
10
+ } }, S = {};
11
+ function c(e) {
12
+ var o = S[e];
13
+ if (o !== void 0)
14
+ return o.exports;
15
+ var s = S[e] = { exports: {} };
16
+ return w[e](s, s.exports, c), s.exports;
17
+ }
18
+ c.n = (e) => {
19
+ var o = e && e.__esModule ? () => e.default : () => e;
20
+ return c.d(o, { a: o }), o;
21
+ }, c.d = (e, o) => {
22
+ for (var s in o)
23
+ c.o(o, s) && !c.o(e, s) && Object.defineProperty(e, s, { enumerable: !0, get: o[s] });
24
+ }, c.o = (e, o) => Object.prototype.hasOwnProperty.call(e, o), c.r = (e) => {
25
+ typeof Symbol < "u" && Symbol.toStringTag && Object.defineProperty(e, Symbol.toStringTag, { value: "Module" }), Object.defineProperty(e, "__esModule", { value: !0 });
26
+ };
27
+ var x = {};
28
+ return (() => {
29
+ c.r(x), c.d(x, { default: () => O });
30
+ var e = c(639), o = c.n(e), s = function(a, i, u, r) {
31
+ return new (u || (u = Promise))(function(m, l) {
32
+ function p(n) {
33
+ try {
34
+ d(r.next(n));
35
+ } catch (t) {
36
+ l(t);
37
+ }
38
+ }
39
+ function f(n) {
40
+ try {
41
+ d(r.throw(n));
42
+ } catch (t) {
43
+ l(t);
44
+ }
45
+ }
46
+ function d(n) {
47
+ var t;
48
+ n.done ? m(n.value) : (t = n.value, t instanceof u ? t : new u(function(h) {
49
+ h(t);
50
+ })).then(p, f);
51
+ }
52
+ d((r = r.apply(a, [])).next());
53
+ });
54
+ };
55
+ function j() {
56
+ return typeof globalThis < "u" && globalThis.WAVES_ICONS_BASE_URL ? globalThis.WAVES_ICONS_BASE_URL : typeof window < "u" && window.WAVES_ICONS_BASE_URL ? window.WAVES_ICONS_BASE_URL : "https://waves-icons.pismolabs.io/bin";
57
+ }
58
+ function _(a, i, u) {
59
+ const r = i && Number.isNaN(Number(i)) ? i : i ? `${i}px` : "1em", m = u || "currentColor", l = { fill: m, color: m, width: r, height: r };
60
+ return a && Object.keys(l).forEach((p) => {
61
+ a.setAttribute(p, l[p]);
62
+ }), a && Object.assign(a.style, l), a;
63
+ }
64
+ const O = ({ icon: a, color: i, size: u }) => {
65
+ const r = (0, e.useRef)(null), [m, l] = (0, e.useState)(null), p = (f) => {
66
+ const d = _(f, `${u || ""}`, i);
67
+ r != null && r.current && (r.current.innerHTML = "", r.current.append(d)), l(d);
68
+ };
69
+ return (0, e.useEffect)(() => {
70
+ (function(f, d = !1) {
71
+ return s(this, void 0, void 0, function* () {
72
+ return function(n) {
73
+ return s(this, void 0, void 0, function* () {
74
+ return fetch(n, { cache: "force-cache" }).then((t) => t.status >= 200 && t.status <= 299 ? t.text() : Promise.resolve(`
75
+ <?xml version="1.0" encoding="UTF-8" standalone="no"?>
76
+ <svg role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1000 1000">
77
+ <!-- Waves Icon Not Found -->
78
+ </svg>
79
+ `)).catch(console.error);
80
+ });
81
+ }(f.startsWith("http") ? f : function(n, t = "svg", h) {
82
+ return h || (h = j()), `${h}/${n}.${t}`;
83
+ }(f)).then((n) => {
84
+ try {
85
+ const t = d ? n : function(h, b) {
86
+ b || (b = `
87
+ <?xml version="1.0" encoding="UTF-8" standalone="no"?>
88
+ <svg role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1000 1000">
89
+ <!-- Waves Icon Not Found -->
90
+ </svg>
91
+ `);
92
+ const g = Object.assign(document.createElement("template"), { innerHTML: b }).content.querySelector("svg");
93
+ return Array.from(g.attributes).map(({ name: v }) => v).find((v) => {
94
+ v.startsWith("on") && g.removeAttribute(v);
95
+ }), g.querySelectorAll(["a", "animate", "color-profile", "cursor", "discard", "fedropshadow", "font-face", "font-face-format", "font-face-name", "font-face-src", "font-face-uri", "foreignobject", "hatch", "hatchpath", "mesh", "meshgradient", "meshpatch", "meshrow", "missing-glyph", "script", "set", "solidcolor", "unknown", "use"].join(",")).forEach((v) => {
96
+ v.remove();
97
+ }), g.setAttribute("data-waves-icon", h), g;
98
+ }(f, n);
99
+ return Promise.resolve(t);
100
+ } catch (t) {
101
+ return Promise.reject(t);
102
+ }
103
+ }).catch(console.error);
104
+ });
105
+ })(a).then(p).catch(console.error);
106
+ }, [a]), (0, e.useEffect)(() => {
107
+ _(m, `${u || ""}`, i);
108
+ }, [u, i]), o().createElement("span", { ref: r });
109
+ };
110
+ })(), x;
111
+ })());
112
+ })(E);
113
+ var P = E.exports;
114
+ const L = /* @__PURE__ */ W(P);
115
+ export {
116
+ L as W
117
+ };
@@ -0,0 +1 @@
1
+ export declare const assertClassesApplied: (expectedClasses: string[] | null, component: HTMLElement) => void;
@@ -0,0 +1,11 @@
1
+ const i = (h, r) => {
2
+ h == null || h.forEach((a) => {
3
+ if (!r.className.split(" ").some((t) => t.startsWith(`_${a}_`)))
4
+ throw new Error(`
5
+ Received: ${r.className}
6
+ Expected: _${a}_{x}, (where {x} = random hash)`);
7
+ });
8
+ };
9
+ export {
10
+ i as assertClassesApplied
11
+ };
@@ -1,10 +1,9 @@
1
+ /// <reference types="vite-plugin-svgr/client" />
2
+
1
3
  // Saves having to declare 'never' for every property that exists on the 'other' type
2
4
  // Creates a new type that 'only' has properties in the first type and not in the second, if the property does not
3
5
  // exist in the second type, it is given the value of 'never' so it can never be set
4
- type Only<T, U> = { [P in keyof T]: T[P] } & Omit<
5
- { [P in keyof U]?: never },
6
- keyof T
7
- >;
6
+ type Only<T, U> = { [P in keyof T]: T[P] } & Omit<{ [P in keyof U]?: never }, keyof T>;
8
7
 
9
8
  // Usage MyNewType = Either<TypeA, TypeB>
10
9
  // Creates a new type via union based on two types
@@ -15,6 +14,14 @@ export type Either<T, U> = Only<T, U> | Only<U, T>;
15
14
  // note these arguments must be declared in MyType as optional '?'
16
15
  type RequireAllOrNone<T, U extends keyof T = never> = (
17
16
  | Required<Pick<T, U>> // Require all properties
18
- | Partial<Record<U, never>>
19
- ) & // Require none
20
- Omit<T, U>; // remaining keys not listed in U
17
+ | Partial<Record<U, never>> // Require none
18
+ ) &
19
+ Omit<T, U>; // remaining keys not listed in U
20
+
21
+ // S = string, D = delimiter to split by. Then split S by D and return array of strings. "foo-bar-baz" = ["foo","bar","baz"]
22
+ // Fallback if no '-' return [s] which is an array of the input string e.g. foo = [foo]
23
+ type Split<S extends string, D extends string> = string extends S
24
+ ? string[]
25
+ : S extends `${infer T}${D}${infer Rest}`
26
+ ? [T, ...Split<Rest, D>]
27
+ : [S];
@@ -1,18 +1,19 @@
1
- import { u as _, _ as k, e as I } from "./index-BZ1lkM_M.js";
1
+ import { a as k } from "./objectWithoutPropertiesLoose-D7Cp0Pg_.js";
2
2
  import * as l from "react";
3
- function A(r) {
3
+ import { d as A, e as I } from "./index-D2P7y2mE.js";
4
+ function _(r) {
4
5
  const {
5
6
  rootElementName: n = "",
6
7
  componentName: o
7
- } = r, [a, i] = l.useState(n.toUpperCase());
8
+ } = r, [s, i] = l.useState(n.toUpperCase());
8
9
  process.env.NODE_ENV !== "production" && l.useEffect(() => {
9
- n && a !== n.toUpperCase() && console.error(`useRootElementName: the \`rootElementName\` prop of ${o ? `the ${o} component` : "a component"} expected the '${n}' element, but a '${a.toLowerCase()}' was rendered instead`, "This may cause hydration issues in an SSR context, for example in a Next.js app");
10
- }, [n, a, o]);
10
+ n && s !== n.toUpperCase() && console.error(`useRootElementName: the \`rootElementName\` prop of ${o ? `the ${o} component` : "a component"} expected the '${n}' element, but a '${s.toLowerCase()}' was rendered instead`, "This may cause hydration issues in an SSR context, for example in a Next.js app");
11
+ }, [n, s, o]);
11
12
  const c = l.useCallback((b) => {
12
13
  var f;
13
14
  i((f = b == null ? void 0 : b.tagName) != null ? f : "");
14
15
  }, []);
15
- return [a, c];
16
+ return [s, c];
16
17
  }
17
18
  class F {
18
19
  constructor() {
@@ -86,21 +87,21 @@ function Q() {
86
87
  w = !1;
87
88
  }), n.current = !1, !0) : !1;
88
89
  }
89
- function a(i) {
90
+ function s(i) {
90
91
  return J(i) ? (n.current = !0, !0) : !1;
91
92
  }
92
93
  return {
93
94
  isFocusVisibleRef: n,
94
- onFocus: a,
95
+ onFocus: s,
95
96
  onBlur: o,
96
97
  ref: r
97
98
  };
98
99
  }
99
- function H(r = {}) {
100
+ function ee(r = {}) {
100
101
  const {
101
102
  disabled: n = !1,
102
103
  focusableWhenDisabled: o,
103
- href: a,
104
+ href: s,
104
105
  rootRef: i,
105
106
  tabIndex: c,
106
107
  to: b,
@@ -115,8 +116,8 @@ function H(r = {}) {
115
116
  n && !o && p && N(!1), l.useEffect(() => {
116
117
  h.current = p;
117
118
  }, [p, h]);
118
- const [m, M] = A({
119
- rootElementName: V ?? (a || b ? "a" : void 0),
119
+ const [m, M] = _({
120
+ rootElementName: V ?? (s || b ? "a" : void 0),
120
121
  componentName: "Button"
121
122
  }), U = (t) => (e) => {
122
123
  var u;
@@ -158,12 +159,12 @@ function H(r = {}) {
158
159
  var d;
159
160
  (d = t.onClick) == null || d.call(t, e);
160
161
  }
161
- }, D = _(M, i, v, y), s = {};
162
- return c !== void 0 && (s.tabIndex = c), m === "BUTTON" ? (s.type = f ?? "button", o ? s["aria-disabled"] = n : s.disabled = n) : m === "INPUT" ? f && ["button", "submit", "reset"].includes(f) && (o ? s["aria-disabled"] = n : s.disabled = n) : m !== "" && (!a && !b && (s.role = "button", s.tabIndex = c ?? 0), n && (s["aria-disabled"] = n, s.tabIndex = o ? c ?? 0 : -1)), {
162
+ }, D = A(M, i, v, y), a = {};
163
+ return c !== void 0 && (a.tabIndex = c), m === "BUTTON" ? (a.type = f ?? "button", o ? a["aria-disabled"] = n : a.disabled = n) : m === "INPUT" ? f && ["button", "submit", "reset"].includes(f) && (o ? a["aria-disabled"] = n : a.disabled = n) : m !== "" && (!s && !b && (a.role = "button", a.tabIndex = c ?? 0), n && (a["aria-disabled"] = n, a.tabIndex = o ? c ?? 0 : -1)), {
163
164
  getRootProps: (t = {}) => {
164
165
  const e = k({}, I(r), I(t)), u = k({
165
166
  type: f
166
- }, e, s, t, {
167
+ }, e, a, t, {
167
168
  onBlur: L(e),
168
169
  onClick: C(e),
169
170
  onFocus: P(e),
@@ -182,5 +183,5 @@ function H(r = {}) {
182
183
  };
183
184
  }
184
185
  export {
185
- H as u
186
+ ee as u
186
187
  };
@@ -1,5 +1,5 @@
1
1
  import * as o from "react";
2
- import { C as a } from "./Tabs.module-_kSbSyth.js";
2
+ import { C as a } from "./Tabs.module-BA-PC7fA.js";
3
3
  import { u as I } from "./useEnhancedEffect-CJGo-L3B.js";
4
4
  let r = 0;
5
5
  function i(t) {
@@ -0,0 +1,31 @@
1
+ import * as n from "react";
2
+ function d({
3
+ controlled: o,
4
+ default: r,
5
+ name: t,
6
+ state: s = "value"
7
+ }) {
8
+ const {
9
+ current: e
10
+ } = n.useRef(o !== void 0), [l, c] = n.useState(r), u = e ? o : l;
11
+ if (process.env.NODE_ENV !== "production") {
12
+ n.useEffect(() => {
13
+ e !== (o !== void 0) && console.error([`MUI: A component is changing the ${e ? "" : "un"}controlled ${s} state of ${t} to be ${e ? "un" : ""}controlled.`, "Elements should not switch from uncontrolled to controlled (or vice versa).", `Decide between using a controlled or uncontrolled ${t} element for the lifetime of the component.`, "The nature of the state is determined during the first render. It's considered controlled if the value is not `undefined`.", "More info: https://fb.me/react-controlled-components"].join(`
14
+ `));
15
+ }, [s, t, o]);
16
+ const {
17
+ current: i
18
+ } = n.useRef(r);
19
+ n.useEffect(() => {
20
+ !e && i !== r && console.error([`MUI: A component is changing the default ${s} state of an uncontrolled ${t} after being initialized. To suppress this warning opt to use a controlled ${t}.`].join(`
21
+ `));
22
+ }, [JSON.stringify(r)]);
23
+ }
24
+ const f = n.useCallback((i) => {
25
+ e || c(i);
26
+ }, []);
27
+ return [u, f];
28
+ }
29
+ export {
30
+ d as u
31
+ };
@@ -0,0 +1,6 @@
1
+ import { Split } from '../types/helpers';
2
+
3
+ export type BlockType<T extends string> = Split<T, '-'>[0];
4
+ export declare const bemify: <T extends string>(variant: T, blocksWithElements: BlockType<T>[]) => string;
5
+ export declare const getBEMBase: (variant: string) => string;
6
+ export declare const getBEMBlock: (variant: string) => string;
@@ -0,0 +1,10 @@
1
+ const s = (e, n) => {
2
+ const r = new RegExp(`^([${n.join("|")}]*)-`);
3
+ let t = e.replace(r, "$1__");
4
+ return t = t.replace(new RegExp("(?<!-)-(?!-)", "g"), "--"), t;
5
+ }, c = (e) => e.split("--")[0], l = (e) => e.split(/--|__/)[0];
6
+ export {
7
+ s as bemify,
8
+ c as getBEMBase,
9
+ l as getBEMBlock
10
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,41 @@
1
+ import { bemify as a, getBEMBase as e, getBEMBlock as r } from "./styleStrings.js";
2
+ import { d as s, i as o, g as t } from "../vi.Y_w82WR8-Df0JUamG.js";
3
+ s("styleStrings", () => {
4
+ s("bemify", () => {
5
+ o("returns just a block if a block was only given", () => {
6
+ t(a("foo", ["bar"])).toEqual("foo");
7
+ }), o("returns just a block and modifier if no elements for that block", () => {
8
+ t(a("foo-baz", ["bar"])).toEqual("foo--baz");
9
+ }), o("returns just block and element if it is a block with elements", () => {
10
+ t(a("bar-baz", ["bar"])).toEqual("bar__baz");
11
+ }), o("returns block, element and modifier if it has all three parts", () => {
12
+ t(a("bar-baz-qux", ["bar"])).toEqual("bar__baz--qux");
13
+ }), o("accepts alternative types for the generic variants type", () => {
14
+ t(a("abc-def", ["abc"])).toEqual("abc__def");
15
+ });
16
+ }), s("getBEMBase", () => {
17
+ o("returns the base BEM of a Block with no elements or modifiers", () => {
18
+ t(e("foo")).toEqual("foo");
19
+ }), o("returns the base BEM of a Block with an element but no modifiers", () => {
20
+ t(e("foo__bar")).toEqual("foo__bar");
21
+ }), o("returns the base BEM of a Block with no elements but a modifier", () => {
22
+ t(e("foo--baz")).toEqual("foo");
23
+ }), o("returns the base BEM of a Block with an element and a modifier", () => {
24
+ t(e("foo__bar--baz")).toEqual("foo__bar");
25
+ }), o("returns empty if given nothing", () => {
26
+ t(e("")).toEqual("");
27
+ });
28
+ }), s("getBEMBlock", () => {
29
+ o("returns the block part of a full BEM style string", () => {
30
+ t(r("foo__bar--baz")).toEqual("foo");
31
+ }), o("returns the block part of a BEM style string that has just block and element", () => {
32
+ t(r("foo__bar")).toEqual("foo");
33
+ }), o("returns the block part of a BEM style string that has just block and modifier", () => {
34
+ t(r("foo--baz")).toEqual("foo");
35
+ }), o("returns the block part of a BEM style string that has just a block", () => {
36
+ t(r("foo")).toEqual("foo");
37
+ }), o("returns nothing if nothing passed in", () => {
38
+ t(r("")).toEqual("");
39
+ });
40
+ });
41
+ });