@pismo/marola 0.0.1-alpha.1

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 (33) hide show
  1. package/README.md +23 -0
  2. package/dist/Button-REznN-RP.js +1139 -0
  3. package/dist/Dialog.module-BO0mdB7d.js +15 -0
  4. package/dist/assets/CallToActionButton.css +1 -0
  5. package/dist/assets/Dialog.css +1 -0
  6. package/dist/assets/LoadingSpinner.css +1 -0
  7. package/dist/assets/Typography.css +1 -0
  8. package/dist/assets/main.css +1 -0
  9. package/dist/clsx-DB4S2d7J.js +22 -0
  10. package/dist/components/CallToActionButton/CallToActionButton.d.ts +23 -0
  11. package/dist/components/CallToActionButton/CallToActionButton.js +57 -0
  12. package/dist/components/Dialog/Actions.d.ts +8 -0
  13. package/dist/components/Dialog/Actions.js +6 -0
  14. package/dist/components/Dialog/Backdrop.d.ts +6 -0
  15. package/dist/components/Dialog/Backdrop.js +17 -0
  16. package/dist/components/Dialog/CloseIconButton.d.ts +6 -0
  17. package/dist/components/Dialog/CloseIconButton.js +19 -0
  18. package/dist/components/Dialog/Content.d.ts +8 -0
  19. package/dist/components/Dialog/Content.js +5 -0
  20. package/dist/components/Dialog/Dialog.d.ts +21 -0
  21. package/dist/components/Dialog/Dialog.js +20304 -0
  22. package/dist/components/Dialog/Title.d.ts +11 -0
  23. package/dist/components/Dialog/Title.js +14 -0
  24. package/dist/components/LoadingSpinner/LoadingSpinner.d.ts +6 -0
  25. package/dist/components/LoadingSpinner/LoadingSpinner.js +24 -0
  26. package/dist/components/Typography/Typography.d.ts +22 -0
  27. package/dist/components/Typography/Typography.js +73 -0
  28. package/dist/main.d.ts +5 -0
  29. package/dist/main.js +17 -0
  30. package/dist/types/helpers.d.ts +20 -0
  31. package/dist/vite-env.d.ts +1 -0
  32. package/package.json +51 -0
  33. package/src/playground/Playground.tsx +58 -0
@@ -0,0 +1,11 @@
1
+ import { ReactNode } from 'react';
2
+
3
+ export interface TitleProps {
4
+ /** title to be displayed */
5
+ title?: ReactNode;
6
+ /** subtitle to be displayed */
7
+ subTitle?: ReactNode;
8
+ }
9
+ /** internal component only - used by the dialog */
10
+ declare const Title: ({ title, subTitle }: TitleProps) => import("react/jsx-runtime").JSX.Element;
11
+ export default Title;
@@ -0,0 +1,14 @@
1
+ import { jsxs as l, Fragment as s, jsx as e } from "react/jsx-runtime";
2
+ import { s as r } from "../../Dialog.module-BO0mdB7d.js";
3
+ import { Typography as a } from "../Typography/Typography.js";
4
+ const n = ({
5
+ title: i,
6
+ subTitle: t
7
+ }) => /* @__PURE__ */ l(s, { children: [
8
+ /* @__PURE__ */ e(a, { element: "h1", elementProps: { id: "alert-dialog-title" }, variant: "h4", className: r.dialog__title, children: i }),
9
+ /* @__PURE__ */ e("hr", { className: r.dialog__divider, "aria-hidden": !0 }),
10
+ t && /* @__PURE__ */ e(a, { element: "h2", elementProps: { id: "alert-dialog-description" }, variant: "h4", className: r.dialog__subtitle, children: t })
11
+ ] });
12
+ export {
13
+ n as default
14
+ };
@@ -0,0 +1,6 @@
1
+ export interface LoadingSpinnerProps {
2
+ invert?: boolean;
3
+ classNames?: string;
4
+ }
5
+ export declare const LoadingSpinner: ({ invert, classNames }: LoadingSpinnerProps) => import("react/jsx-runtime").JSX.Element;
6
+ export default LoadingSpinner;
@@ -0,0 +1,24 @@
1
+ import '../../assets/LoadingSpinner.css';
2
+ import { jsxs as o, jsx as s } from "react/jsx-runtime";
3
+ import { useMemo as e } from "react";
4
+ import { c as t } from "../../clsx-DB4S2d7J.js";
5
+ const n = {
6
+ "ls-ring": "_ls-ring_19dsy_1",
7
+ "ls-ring--invert": "_ls-ring--invert_19dsy_34"
8
+ }, c = ({ invert: i = !1, classNames: r }) => {
9
+ const l = e(() => t(
10
+ [n["ls-ring"]],
11
+ { [n["ls-ring--invert"]]: i },
12
+ r
13
+ ), [r, i]);
14
+ return /* @__PURE__ */ o("div", { className: l, children: [
15
+ /* @__PURE__ */ s("div", {}),
16
+ /* @__PURE__ */ s("div", {}),
17
+ /* @__PURE__ */ s("div", {}),
18
+ /* @__PURE__ */ s("div", {})
19
+ ] });
20
+ };
21
+ export {
22
+ c as LoadingSpinner,
23
+ c as default
24
+ };
@@ -0,0 +1,22 @@
1
+ import { ComponentType, ElementType, HTMLAttributes, ReactNode } from 'react';
2
+
3
+ export type VariantType = "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "body-large" | "body-medium" | "body" | "body-small" | "body-tiny" | "quote-large" | "quote" | "form-input" | "form-label" | "form-hint" | "form-dropdown" | "table-header" | "table-body" | "table-body-secondary" | "button" | "link";
4
+ export type CommonTypographyHTMLAttributes = HTMLAttributes<HTMLParagraphElement> & HTMLAttributes<HTMLHeadingElement> & HTMLAttributes<HTMLSpanElement> & HTMLAttributes<HTMLTableCellElement>;
5
+ export type TypographyProps = {
6
+ children: ReactNode;
7
+ elementProps?: HTMLAttributes<CommonTypographyHTMLAttributes>;
8
+ dataTestId?: string;
9
+ element?: ElementType;
10
+ className?: string;
11
+ variant?: VariantType;
12
+ underline?: boolean;
13
+ strikethrough?: boolean;
14
+ bold?: boolean;
15
+ };
16
+ /**
17
+ * Typography component provide HTML 'element' field (default span) and override
18
+ * element specific styling with 'variant'. 'className' to provide additional
19
+ * styling. elementProps to provide additional HTML element attributes
20
+ */
21
+ export declare const Typography: import('react').ForwardRefExoticComponent<TypographyProps & import("react").RefAttributes<ElementType | ComponentType>>;
22
+ export default Typography;
@@ -0,0 +1,73 @@
1
+ import '../../assets/Typography.css';
2
+ import { jsx as y } from "react/jsx-runtime";
3
+ import { forwardRef as u, useMemo as c } from "react";
4
+ import { c as f } from "../../clsx-DB4S2d7J.js";
5
+ const p = "_h1_111i6_1", g = "_h2_111i6_11", k = "_h3_111i6_21", q = "_h4_111i6_31", T = "_body_111i6_41", w = "_quote_111i6_75", $ = "_form__input_111i6_86", x = "_form__hint_111i6_91", N = "_form__label_111i6_96", S = "_form__dropdown_111i6_101", v = "_table__header_111i6_107", E = "_table__body_111i6_112", V = "_button_111i6_123", r = {
6
+ h1: p,
7
+ "h1--bold": "_h1--bold_111i6_7",
8
+ h2: g,
9
+ "h2--bold": "_h2--bold_111i6_17",
10
+ h3: k,
11
+ "h3--bold": "_h3--bold_111i6_27",
12
+ h4: q,
13
+ "h4--bold": "_h4--bold_111i6_37",
14
+ body: T,
15
+ "body--large": "_body--large_111i6_46",
16
+ "body--medium": "_body--medium_111i6_50",
17
+ "body--small": "_body--small_111i6_54",
18
+ "body--tiny": "_body--tiny_111i6_58",
19
+ "body--bold": "_body--bold_111i6_62",
20
+ "body--strikethrough": "_body--strikethrough_111i6_65",
21
+ "body--underlined": "_body--underlined_111i6_68",
22
+ "body--strikethrough-underlined": "_body--strikethrough-underlined_111i6_71",
23
+ quote: w,
24
+ "quote--large": "_quote--large_111i6_80",
25
+ form__input: $,
26
+ form__hint: x,
27
+ form__label: N,
28
+ form__dropdown: S,
29
+ table__header: v,
30
+ table__body: E,
31
+ "table__body--secondary": "_table__body--secondary_111i6_117",
32
+ button: V
33
+ }, j = (t) => {
34
+ const _ = t.toString();
35
+ let o = "body";
36
+ return _.match(/^h[1-4]/) ? o = _ : _.match(/^h[5-6]/) && (o = "h4"), _ === "th" && (o = "table-header"), _ === "td" && (o = "table-body"), o;
37
+ }, I = (t) => {
38
+ let _ = t.replace(/form-/g, "form__");
39
+ return _ = _.replace(/table-/g, "table__"), _ = _.replace(new RegExp("(?<!-)-(?!-)", "g"), "--"), _;
40
+ }, U = u((t, _) => {
41
+ const {
42
+ dataTestId: o,
43
+ children: s,
44
+ className: n,
45
+ underline: l = !1,
46
+ element: i = "span",
47
+ bold: a = !1,
48
+ variant: e = j(i),
49
+ strikethrough: d = !1,
50
+ elementProps: b
51
+ } = t, h = i, m = c(() => f(
52
+ r[I(e)],
53
+ n,
54
+ { [r[`${e}--bold`]]: a },
55
+ { [r[`${e}--underlined`]]: l },
56
+ { [r[`${e}--strikethrough`]]: d },
57
+ { [r[`${e}--strikethrough-underlined`]]: d && d && l }
58
+ ), [a, n, d, l, e]);
59
+ return /* @__PURE__ */ y(
60
+ h,
61
+ {
62
+ ref: _,
63
+ "data-testid": o,
64
+ ...b != null && b,
65
+ className: m,
66
+ children: s
67
+ }
68
+ );
69
+ });
70
+ export {
71
+ U as Typography,
72
+ U as default
73
+ };
package/dist/main.d.ts ADDED
@@ -0,0 +1,5 @@
1
+
2
+ export * from './components/Dialog/Dialog';
3
+ export * from './components/Typography/Typography';
4
+ export * from './components/LoadingSpinner/LoadingSpinner';
5
+ export * from './components/CallToActionButton/CallToActionButton';
package/dist/main.js ADDED
@@ -0,0 +1,17 @@
1
+ import './assets/main.css';
2
+ import { Dialog as r } 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 n } from "./components/CallToActionButton/CallToActionButton.js";
6
+ import { default as m } from "./components/Dialog/Title.js";
7
+ import { default as d } from "./components/Dialog/Content.js";
8
+ import { default as s } from "./components/Dialog/Actions.js";
9
+ export {
10
+ s as Actions,
11
+ n as CallToActionButton,
12
+ d as Content,
13
+ r as Dialog,
14
+ m as DialogTitle,
15
+ p as LoadingSpinner,
16
+ a as Typography
17
+ };
@@ -0,0 +1,20 @@
1
+ // Saves having to declare 'never' for every property that exists on the 'other' type
2
+ // Creates a new type that 'only' has properties in the first type and not in the second, if the property does not
3
+ // 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
+ >;
8
+
9
+ // Usage MyNewType = Either<TypeA, TypeB>
10
+ // Creates a new type via union based on two types
11
+ export type Either<T, U> = Only<T, U> | Only<U, T>;
12
+
13
+ // Usage MyNewType = RequireAllOrNone<MyType, 'prop1' | 'prop2' | 'prop3'>;
14
+ // All listed properties in argument 2 which are found in MyType are required if any are provided, otherwise none are required.
15
+ // note these arguments must be declared in MyType as optional '?'
16
+ type RequireAllOrNone<T, U extends keyof T = never> = (
17
+ | 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
@@ -0,0 +1 @@
1
+ /// <reference types="vite/client" />
package/package.json ADDED
@@ -0,0 +1,51 @@
1
+ {
2
+ "name": "@pismo/marola",
3
+ "description": "CDX tribe component library",
4
+ "version": "0.0.1-alpha.1",
5
+ "type": "module",
6
+ "main": "dist/main.js",
7
+ "types": "dist/main.d.ts",
8
+ "files": [
9
+ "dist"
10
+ ],
11
+ "repository": {
12
+ "type": "git",
13
+ "url": "https://github.com/pismo/marola"
14
+ },
15
+ "sideEffects": [
16
+ "**/*.css"
17
+ ],
18
+ "scripts": {
19
+ "dev": "vite",
20
+ "build": "tsc --p ./tsconfig-build.json && vite build",
21
+ "lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
22
+ "preview": "vite preview",
23
+ "prepublishOnly": "npm run build"
24
+ },
25
+ "peerDependencies": {
26
+ "react": "^18.2.0",
27
+ "react-dom": "^18.2.0"
28
+ },
29
+ "devDependencies": {
30
+ "@types/node": "^20.12.2",
31
+ "@types/react": "^18.2.66",
32
+ "@types/react-dom": "^18.2.22",
33
+ "@typescript-eslint/eslint-plugin": "^7.2.0",
34
+ "@typescript-eslint/parser": "^7.2.0",
35
+ "@vitejs/plugin-react": "^4.2.1",
36
+ "clsx": "^2.1.0",
37
+ "eslint": "^8.57.0",
38
+ "eslint-plugin-react-hooks": "^4.6.0",
39
+ "eslint-plugin-react-refresh": "^0.4.6",
40
+ "glob": "^10.3.12",
41
+ "react": "^18.2.0",
42
+ "react-dom": "^18.2.0",
43
+ "typescript": "^5.2.2",
44
+ "vite": "^5.2.0",
45
+ "vite-plugin-dts": "^3.8.1",
46
+ "vite-plugin-lib-inject-css": "^2.0.1"
47
+ },
48
+ "dependencies": {
49
+ "@mui/base": "^5.0.0-beta.40"
50
+ }
51
+ }
@@ -0,0 +1,58 @@
1
+ import {CallToActionButton, LoadingSpinner, Typography} from '../../lib/main';
2
+
3
+ import DialogExample from "./DialogExample.tsx";
4
+
5
+ /**
6
+ * A playground that can be used to test and build components. Run `yarn dev` to launch this page
7
+ */
8
+ const Playground = () => {
9
+ return <>
10
+ <DialogExample/>
11
+ <CallToActionButton variation="primary">Test Button</CallToActionButton>
12
+ <CallToActionButton variation="secondary">Test Button secondary</CallToActionButton>
13
+ <CallToActionButton variation="primary" isLoading>Test Button loading</CallToActionButton>
14
+ <CallToActionButton variation="secondary" isLoading>Test Button loading secondary</CallToActionButton>
15
+ <CallToActionButton variation="primary" disabled>Test Button disabled</CallToActionButton>
16
+ <CallToActionButton variation="secondary" disabled>Test Button disabled secondary</CallToActionButton>
17
+ <Typography element="p">abc</Typography>
18
+ <Typography element="h1" variant="form-hint">abc</Typography>
19
+ <Typography>regular</Typography>
20
+ {/*<Typography className={styles["test-red"]}>regular extra classes</Typography>*/}
21
+ <Typography variant="body" element="p">body explicit (element p) </Typography>
22
+ <Typography variant="body-large">body large </Typography>
23
+ <Typography variant="body-medium">body medium </Typography>
24
+ <Typography variant="body-small">body small </Typography>
25
+ <Typography variant="body-tiny">body tiny </Typography>
26
+ <Typography element="h1">h1</Typography>
27
+ <Typography element="h2">h2</Typography>
28
+ <Typography element="h3">h3</Typography>
29
+ <Typography element="h4">h4</Typography>
30
+ <Typography element="h5">h5 uses h4 style</Typography>
31
+ <Typography element="h6">h6 uses h4 style</Typography>
32
+ <Typography element="h1" variant="h4">h1 with h4 style</Typography>
33
+ <Typography element="h2" variant="h4">h2 with h4 style</Typography>
34
+ <Typography element="h3" variant="h4">h3 with h4 style</Typography>
35
+ <Typography variant="quote"> quote</Typography>
36
+ <Typography variant="quote-large"> large quote</Typography>
37
+ <Typography bold> bold</Typography>
38
+ <Typography strikethrough> strikethrough</Typography>
39
+ <Typography underline> underlined</Typography>
40
+ <Typography element="p" underline strikethrough>strikethrough and underlined paragraph</Typography>
41
+ <Typography variant="form-hint"> form-hint</Typography>
42
+ <Typography variant="form-label"> form-label</Typography>
43
+ <Typography variant="form-dropdown"> form-dropdown</Typography>
44
+ <Typography variant="form-input"> form-input</Typography>
45
+ <Typography variant="table-header"> default element table header explicit variant</Typography>
46
+ <Typography variant="table-body"> default element table body explicit variant</Typography>
47
+ <Typography variant="table-body-secondary"> default element but table body secondary explicit
48
+ variant</Typography>
49
+ <Typography element="th"> th </Typography>
50
+ <Typography element="td"> td</Typography>
51
+ <Typography element="li"> list item</Typography>
52
+ <Typography variant="button"> button</Typography>
53
+ <LoadingSpinner/>
54
+ <LoadingSpinner invert/>
55
+ </>;
56
+ };
57
+
58
+ export default Playground;