@overmap-ai/blocks 0.0.1-alpha.19

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/README.md ADDED
@@ -0,0 +1,3 @@
1
+ # overmap-ai blocks
2
+
3
+ Contains basic components used by overmap-ai libraries.
@@ -0,0 +1,4 @@
1
+ import React from "react";
2
+ import { ButtonProps } from "./typings.ts";
3
+ declare const _default: React.MemoExoticComponent<React.ForwardRefExoticComponent<Omit<ButtonProps, "ref"> & React.RefAttributes<HTMLButtonElement>>>;
4
+ export default _default;
@@ -0,0 +1,4 @@
1
+ import React from "react";
2
+ import { ButtonProps } from "./typings.ts";
3
+ declare const _default: React.MemoExoticComponent<React.ForwardRefExoticComponent<Omit<Omit<ButtonProps, "fluid">, "ref"> & React.RefAttributes<HTMLButtonElement>>>;
4
+ export default _default;
@@ -0,0 +1,4 @@
1
+ import { ButtonHoverEffect, ButtonSeverity, ButtonSize, RadixButtonProps } from "./typings.ts";
2
+ export declare const hoverEffectClassNameMapping: Record<ButtonHoverEffect, string | undefined>;
3
+ export declare const ButtonSeverityColorMapping: Record<ButtonSeverity, RadixButtonProps["color"]>;
4
+ export declare const ButtonSizeMapping: Record<ButtonSize, RadixButtonProps["size"]>;
@@ -0,0 +1,3 @@
1
+ export { default as Button } from "./Button.tsx";
2
+ export { default as IconButton } from "./IconButton.tsx";
3
+ export type { ButtonSeverity, ButtonSize, ButtonHoverEffect } from "./typings.ts";
@@ -0,0 +1,14 @@
1
+ import React from "react";
2
+ import { Button as RadixButton, Responsive } from "@radix-ui/themes";
3
+ export type RadixButtonProps = React.ComponentProps<typeof RadixButton>;
4
+ export type ButtonSeverity = "primary" | "success" | "danger" | "info";
5
+ export type ButtonSize = "small" | "medium" | "large";
6
+ export type ButtonVariant = "solid" | "soft" | "outline" | "ghost";
7
+ export type ButtonHoverEffect = "spin90Clockwise" | "spin180Clockwise" | "spin360Clockwise";
8
+ export interface ButtonProps extends Omit<RadixButtonProps, "size" | "color" | "variant"> {
9
+ fluid?: boolean;
10
+ variant?: ButtonVariant;
11
+ severity?: ButtonSeverity;
12
+ size?: Responsive<ButtonSize>;
13
+ hoverEffects?: ButtonHoverEffect[];
14
+ }
package/dist/blocks.js ADDED
@@ -0,0 +1,105 @@
1
+ import { jsx as u } from "react/jsx-runtime";
2
+ import m, { forwardRef as f } from "react";
3
+ import { Button as h, IconButton as b } from "@radix-ui/themes";
4
+ const k = "_fluid_3aivb_6", y = "_hoverSpin90Clockwise_3aivb_20", B = "_hoverSpin180Clockwise_3aivb_31", j = "_hoverSpin360Clockwise_3aivb_42", a = {
5
+ default: "_default_3aivb_1",
6
+ fluid: k,
7
+ hoverSpin90Clockwise: y,
8
+ hoverSpin180Clockwise: B,
9
+ hoverSpin360Clockwise: j
10
+ };
11
+ function O(t) {
12
+ return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
13
+ }
14
+ var w = { exports: {} };
15
+ /*!
16
+ Copyright (c) 2018 Jed Watson.
17
+ Licensed under the MIT License (MIT), see
18
+ http://jedwatson.github.io/classnames
19
+ */
20
+ (function(t) {
21
+ (function() {
22
+ var s = {}.hasOwnProperty;
23
+ function n() {
24
+ for (var e = [], i = 0; i < arguments.length; i++) {
25
+ var o = arguments[i];
26
+ if (o) {
27
+ var r = typeof o;
28
+ if (r === "string" || r === "number")
29
+ e.push(o);
30
+ else if (Array.isArray(o)) {
31
+ if (o.length) {
32
+ var l = n.apply(null, o);
33
+ l && e.push(l);
34
+ }
35
+ } else if (r === "object") {
36
+ if (o.toString !== Object.prototype.toString && !o.toString.toString().includes("[native code]")) {
37
+ e.push(o.toString());
38
+ continue;
39
+ }
40
+ for (var c in o)
41
+ s.call(o, c) && o[c] && e.push(c);
42
+ }
43
+ }
44
+ }
45
+ return e.join(" ");
46
+ }
47
+ t.exports ? (n.default = n, t.exports = n) : window.classNames = n;
48
+ })();
49
+ })(w);
50
+ var g = w.exports;
51
+ const d = /* @__PURE__ */ O(g), v = {
52
+ spin90Clockwise: a.hoverSpin90Clockwise,
53
+ spin180Clockwise: a.hoverSpin180Clockwise,
54
+ spin360Clockwise: a.hoverSpin360Clockwise
55
+ }, C = {
56
+ primary: "indigo",
57
+ success: "green",
58
+ danger: "red",
59
+ info: "gray"
60
+ }, S = {
61
+ small: "1",
62
+ medium: "2",
63
+ large: "3"
64
+ };
65
+ function _(t, s) {
66
+ if (typeof t == "object") {
67
+ if (!("initial" in t))
68
+ throw new Error("Expected initial property to be set in Responsive object");
69
+ return Object.fromEntries(Object.entries(t).map(([n, e]) => [n, s[e]]));
70
+ } else
71
+ return s[t];
72
+ }
73
+ const N = f(function({ className: s, severity: n = "primary", size: e = "medium", hoverEffects: i, fluid: o, ...r }, l) {
74
+ const c = (i == null ? void 0 : i.map((p) => v[p])) || [];
75
+ return /* @__PURE__ */ u(
76
+ h,
77
+ {
78
+ ref: l,
79
+ className: d(a.default, s, c, {
80
+ [a.fluid]: o
81
+ }),
82
+ color: C[n],
83
+ size: _(e, S),
84
+ ...r
85
+ }
86
+ );
87
+ }), I = m.memo(N), x = f(function({ className: s, children: n, severity: e = "primary", size: i = "medium", hoverEffects: o, ...r }, l) {
88
+ const c = (o == null ? void 0 : o.map((p) => v[p])) || [];
89
+ return /* @__PURE__ */ u(
90
+ b,
91
+ {
92
+ className: d(a.default, s, c),
93
+ ref: l,
94
+ color: C[e],
95
+ size: _(i, S),
96
+ ...r,
97
+ children: n
98
+ }
99
+ );
100
+ }), $ = m.memo(x);
101
+ export {
102
+ I as Button,
103
+ $ as IconButton
104
+ };
105
+ //# sourceMappingURL=blocks.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"blocks.js","sources":["../node_modules/classnames/index.js","../src/Buttons/constants.ts","../src/utils.ts","../src/Buttons/Button.tsx","../src/Buttons/IconButton.tsx"],"sourcesContent":["/*!\n\tCopyright (c) 2018 Jed Watson.\n\tLicensed under the MIT License (MIT), see\n\thttp://jedwatson.github.io/classnames\n*/\n/* global define */\n\n(function () {\n\t'use strict';\n\n\tvar hasOwn = {}.hasOwnProperty;\n\tvar nativeCodeString = '[native code]';\n\n\tfunction classNames() {\n\t\tvar classes = [];\n\n\t\tfor (var i = 0; i < arguments.length; i++) {\n\t\t\tvar arg = arguments[i];\n\t\t\tif (!arg) continue;\n\n\t\t\tvar argType = typeof arg;\n\n\t\t\tif (argType === 'string' || argType === 'number') {\n\t\t\t\tclasses.push(arg);\n\t\t\t} else if (Array.isArray(arg)) {\n\t\t\t\tif (arg.length) {\n\t\t\t\t\tvar inner = classNames.apply(null, arg);\n\t\t\t\t\tif (inner) {\n\t\t\t\t\t\tclasses.push(inner);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else if (argType === 'object') {\n\t\t\t\tif (arg.toString !== Object.prototype.toString && !arg.toString.toString().includes('[native code]')) {\n\t\t\t\t\tclasses.push(arg.toString());\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tfor (var key in arg) {\n\t\t\t\t\tif (hasOwn.call(arg, key) && arg[key]) {\n\t\t\t\t\t\tclasses.push(key);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn classes.join(' ');\n\t}\n\n\tif (typeof module !== 'undefined' && module.exports) {\n\t\tclassNames.default = classNames;\n\t\tmodule.exports = classNames;\n\t} else if (typeof define === 'function' && typeof define.amd === 'object' && define.amd) {\n\t\t// register as 'classnames', consistent with npm package name\n\t\tdefine('classnames', [], function () {\n\t\t\treturn classNames;\n\t\t});\n\t} else {\n\t\twindow.classNames = classNames;\n\t}\n}());\n","import { ButtonHoverEffect, ButtonSeverity, ButtonSize, RadixButtonProps } from \"./typings.ts\"\nimport styles from \"./Button.module.sass\"\n\nexport const hoverEffectClassNameMapping: Record<ButtonHoverEffect, string | undefined> = {\n\tspin90Clockwise: styles.hoverSpin90Clockwise,\n\tspin180Clockwise: styles.hoverSpin180Clockwise,\n\tspin360Clockwise: styles.hoverSpin360Clockwise,\n}\n\nexport const ButtonSeverityColorMapping: Record<ButtonSeverity, RadixButtonProps[\"color\"]> = {\n\tprimary: \"indigo\",\n\tsuccess: \"green\",\n\tdanger: \"red\",\n\tinfo: \"gray\",\n}\n\nexport const ButtonSizeMapping: Record<ButtonSize, RadixButtonProps[\"size\"]> = {\n\tsmall: \"1\",\n\tmedium: \"2\",\n\tlarge: \"3\",\n}\n","import { Responsive } from \"@radix-ui/themes\"\n\n// applyResponsiveMapping is a helper function used to map the keys of a Radix Responsive type that can be understood\n// by a Radix component or primitive. The point of this is to leverage our own custom prop names and values while still\n// using Radix's built in Responsiveness functionality.\n/**\n * Returns an object with mapped key values or a single mapped value\n * @param value an object or string\n * @param mapping a Record mapping the object values of param value\n */\nexport function applyResponsiveMapping<T extends string, K>(value: Responsive<T>, mapping: Record<T, K>) {\n\tif (typeof value === \"object\") {\n\t\tif (!(\"initial\" in value)) {\n\t\t\t// Responsive objects require an 'initial' property to be set that acts as a default\n\t\t\tthrow new Error(\"Expected initial property to be set in Responsive object\")\n\t\t}\n\t\treturn Object.fromEntries(Object.entries(value).map(([key, _value]) => [key, mapping[_value]]))\n\t} else {\n\t\treturn mapping[value]\n\t}\n}\n","import React, { forwardRef } from \"react\"\nimport { ButtonProps } from \"./typings.ts\"\nimport styles from \"./Button.module.sass\"\nimport classNames from \"classnames\"\nimport { Button as RadixButton } from \"@radix-ui/themes\"\nimport { ButtonSeverityColorMapping, ButtonSizeMapping, hoverEffectClassNameMapping } from \"./constants.ts\"\nimport { applyResponsiveMapping } from \"../utils.ts\"\n\nconst _Button = forwardRef(function Button(\n\t{ className, severity = \"primary\", size = \"medium\", hoverEffects, fluid, ...rest }: ButtonProps,\n\tref: React.Ref<HTMLButtonElement>,\n) {\n\tconst hoverEffectClasses =\n\t\thoverEffects?.map((hoverEffect) => {\n\t\t\treturn hoverEffectClassNameMapping[hoverEffect]\n\t\t}) || []\n\n\treturn (\n\t\t<RadixButton\n\t\t\tref={ref}\n\t\t\tclassName={classNames(styles.default, className, hoverEffectClasses, {\n\t\t\t\t[styles.fluid!]: fluid,\n\t\t\t})}\n\t\t\tcolor={ButtonSeverityColorMapping[severity]}\n\t\t\tsize={applyResponsiveMapping(size, ButtonSizeMapping)}\n\t\t\t{...rest}\n\t\t/>\n\t)\n})\n\nexport default React.memo(_Button)\n","import React, { forwardRef } from \"react\"\nimport { ButtonProps } from \"./typings.ts\"\nimport styles from \"./Button.module.sass\"\nimport classNames from \"classnames\"\nimport { IconButton as RadixIconButton } from \"@radix-ui/themes\"\nimport { ButtonSeverityColorMapping, ButtonSizeMapping, hoverEffectClassNameMapping } from \"./constants.ts\"\nimport { applyResponsiveMapping } from \"../utils.ts\"\n\nconst _Button = forwardRef(function Button(\n\t{ className, children, severity = \"primary\", size = \"medium\", hoverEffects, ...rest }: Omit<ButtonProps, \"fluid\">,\n\tref: React.Ref<HTMLButtonElement>,\n) {\n\tconst hoverEffectClasses =\n\t\thoverEffects?.map((hoverEffect) => {\n\t\t\treturn hoverEffectClassNameMapping[hoverEffect]\n\t\t}) || []\n\n\treturn (\n\t\t<RadixIconButton\n\t\t\tclassName={classNames(styles.default, className, hoverEffectClasses)}\n\t\t\tref={ref}\n\t\t\tcolor={ButtonSeverityColorMapping[severity]}\n\t\t\tsize={applyResponsiveMapping(size, ButtonSizeMapping)}\n\t\t\t{...rest}\n\t\t>\n\t\t\t{children}\n\t\t</RadixIconButton>\n\t)\n})\n\nexport default React.memo(_Button)\n"],"names":["hasOwn","classNames","classes","arg","argType","inner","key","module","hoverEffectClassNameMapping","styles","ButtonSeverityColorMapping","ButtonSizeMapping","applyResponsiveMapping","value","mapping","_value","_Button","forwardRef","className","severity","size","hoverEffects","fluid","rest","ref","hoverEffectClasses","hoverEffect","jsx","RadixButton","Button","React","children","RadixIconButton","IconButton"],"mappings":";;;;;;;;;;;;;;;;;;;;AAOA,GAAC,WAAY;AAGZ,QAAIA,IAAS,CAAE,EAAC;AAGhB,aAASC,IAAa;AAGrB,eAFIC,IAAU,CAAA,G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C,GAEDE,IAAeH,EAAM,KAAKd,CAAO;","x_google_ignoreList":[0]}
@@ -0,0 +1,6 @@
1
+ (function(o,l){typeof exports=="object"&&typeof module<"u"?l(exports,require("react/jsx-runtime"),require("react"),require("@radix-ui/themes")):typeof define=="function"&&define.amd?define(["exports","react/jsx-runtime","react","@radix-ui/themes"],l):(o=typeof globalThis<"u"?globalThis:o||self,l(o.blocks={},o.jsxRuntime,o.React,o.themes))})(this,function(o,l,f,m){"use strict";const p={default:"_default_3aivb_1",fluid:"_fluid_3aivb_6",hoverSpin90Clockwise:"_hoverSpin90Clockwise_3aivb_20",hoverSpin180Clockwise:"_hoverSpin180Clockwise_3aivb_31",hoverSpin360Clockwise:"_hoverSpin360Clockwise_3aivb_42"};function k(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var w={exports:{}};/*!
2
+ Copyright (c) 2018 Jed Watson.
3
+ Licensed under the MIT License (MIT), see
4
+ http://jedwatson.github.io/classnames
5
+ */(function(t){(function(){var r={}.hasOwnProperty;function n(){for(var i=[],s=0;s<arguments.length;s++){var e=arguments[s];if(e){var c=typeof e;if(c==="string"||c==="number")i.push(e);else if(Array.isArray(e)){if(e.length){var a=n.apply(null,e);a&&i.push(a)}}else if(c==="object"){if(e.toString!==Object.prototype.toString&&!e.toString.toString().includes("[native code]")){i.push(e.toString());continue}for(var u in e)r.call(e,u)&&e[u]&&i.push(u)}}}return i.join(" ")}t.exports?(n.default=n,t.exports=n):window.classNames=n})()})(w);var y=w.exports;const v=k(y),h={spin90Clockwise:p.hoverSpin90Clockwise,spin180Clockwise:p.hoverSpin180Clockwise,spin360Clockwise:p.hoverSpin360Clockwise},S={primary:"indigo",success:"green",danger:"red",info:"gray"},C={small:"1",medium:"2",large:"3"};function _(t,r){if(typeof t=="object"){if(!("initial"in t))throw new Error("Expected initial property to be set in Responsive object");return Object.fromEntries(Object.entries(t).map(([n,i])=>[n,r[i]]))}else return r[t]}const b=f.forwardRef(function({className:r,severity:n="primary",size:i="medium",hoverEffects:s,fluid:e,...c},a){const u=(s==null?void 0:s.map(d=>h[d]))||[];return l.jsx(m.Button,{ref:a,className:v(p.default,r,u,{[p.fluid]:e}),color:S[n],size:_(i,C),...c})}),j=f.memo(b),B=f.forwardRef(function({className:r,children:n,severity:i="primary",size:s="medium",hoverEffects:e,...c},a){const u=(e==null?void 0:e.map(d=>h[d]))||[];return l.jsx(m.IconButton,{className:v(p.default,r,u),ref:a,color:S[i],size:_(s,C),...c,children:n})}),x=f.memo(B);o.Button=j,o.IconButton=x,Object.defineProperty(o,Symbol.toStringTag,{value:"Module"})});
6
+ //# sourceMappingURL=blocks.umd.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"blocks.umd.cjs","sources":["../node_modules/classnames/index.js","../src/Buttons/constants.ts","../src/utils.ts","../src/Buttons/Button.tsx","../src/Buttons/IconButton.tsx"],"sourcesContent":["/*!\n\tCopyright (c) 2018 Jed Watson.\n\tLicensed under the MIT License (MIT), see\n\thttp://jedwatson.github.io/classnames\n*/\n/* global define */\n\n(function () {\n\t'use strict';\n\n\tvar hasOwn = {}.hasOwnProperty;\n\tvar nativeCodeString = '[native code]';\n\n\tfunction classNames() {\n\t\tvar classes = [];\n\n\t\tfor (var i = 0; i < arguments.length; i++) {\n\t\t\tvar arg = arguments[i];\n\t\t\tif (!arg) continue;\n\n\t\t\tvar argType = typeof arg;\n\n\t\t\tif (argType === 'string' || argType === 'number') {\n\t\t\t\tclasses.push(arg);\n\t\t\t} else if (Array.isArray(arg)) {\n\t\t\t\tif (arg.length) {\n\t\t\t\t\tvar inner = classNames.apply(null, arg);\n\t\t\t\t\tif (inner) {\n\t\t\t\t\t\tclasses.push(inner);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else if (argType === 'object') {\n\t\t\t\tif (arg.toString !== Object.prototype.toString && !arg.toString.toString().includes('[native code]')) {\n\t\t\t\t\tclasses.push(arg.toString());\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tfor (var key in arg) {\n\t\t\t\t\tif (hasOwn.call(arg, key) && arg[key]) {\n\t\t\t\t\t\tclasses.push(key);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn classes.join(' ');\n\t}\n\n\tif (typeof module !== 'undefined' && module.exports) {\n\t\tclassNames.default = classNames;\n\t\tmodule.exports = classNames;\n\t} else if (typeof define === 'function' && typeof define.amd === 'object' && define.amd) {\n\t\t// register as 'classnames', consistent with npm package name\n\t\tdefine('classnames', [], function () {\n\t\t\treturn classNames;\n\t\t});\n\t} else {\n\t\twindow.classNames = classNames;\n\t}\n}());\n","import { ButtonHoverEffect, ButtonSeverity, ButtonSize, RadixButtonProps } from \"./typings.ts\"\nimport styles from \"./Button.module.sass\"\n\nexport const hoverEffectClassNameMapping: Record<ButtonHoverEffect, string | undefined> = {\n\tspin90Clockwise: styles.hoverSpin90Clockwise,\n\tspin180Clockwise: styles.hoverSpin180Clockwise,\n\tspin360Clockwise: styles.hoverSpin360Clockwise,\n}\n\nexport const ButtonSeverityColorMapping: Record<ButtonSeverity, RadixButtonProps[\"color\"]> = {\n\tprimary: \"indigo\",\n\tsuccess: \"green\",\n\tdanger: \"red\",\n\tinfo: \"gray\",\n}\n\nexport const ButtonSizeMapping: Record<ButtonSize, RadixButtonProps[\"size\"]> = {\n\tsmall: \"1\",\n\tmedium: \"2\",\n\tlarge: \"3\",\n}\n","import { Responsive } from \"@radix-ui/themes\"\n\n// applyResponsiveMapping is a helper function used to map the keys of a Radix Responsive type that can be understood\n// by a Radix component or primitive. The point of this is to leverage our own custom prop names and values while still\n// using Radix's built in Responsiveness functionality.\n/**\n * Returns an object with mapped key values or a single mapped value\n * @param value an object or string\n * @param mapping a Record mapping the object values of param value\n */\nexport function applyResponsiveMapping<T extends string, K>(value: Responsive<T>, mapping: Record<T, K>) {\n\tif (typeof value === \"object\") {\n\t\tif (!(\"initial\" in value)) {\n\t\t\t// Responsive objects require an 'initial' property to be set that acts as a default\n\t\t\tthrow new Error(\"Expected initial property to be set in Responsive object\")\n\t\t}\n\t\treturn Object.fromEntries(Object.entries(value).map(([key, _value]) => [key, mapping[_value]]))\n\t} else {\n\t\treturn mapping[value]\n\t}\n}\n","import React, { forwardRef } from \"react\"\nimport { ButtonProps } from \"./typings.ts\"\nimport styles from \"./Button.module.sass\"\nimport classNames from \"classnames\"\nimport { Button as RadixButton } from \"@radix-ui/themes\"\nimport { ButtonSeverityColorMapping, ButtonSizeMapping, hoverEffectClassNameMapping } from \"./constants.ts\"\nimport { applyResponsiveMapping } from \"../utils.ts\"\n\nconst _Button = forwardRef(function Button(\n\t{ className, severity = \"primary\", size = \"medium\", hoverEffects, fluid, ...rest }: ButtonProps,\n\tref: React.Ref<HTMLButtonElement>,\n) {\n\tconst hoverEffectClasses =\n\t\thoverEffects?.map((hoverEffect) => {\n\t\t\treturn hoverEffectClassNameMapping[hoverEffect]\n\t\t}) || []\n\n\treturn (\n\t\t<RadixButton\n\t\t\tref={ref}\n\t\t\tclassName={classNames(styles.default, className, hoverEffectClasses, {\n\t\t\t\t[styles.fluid!]: fluid,\n\t\t\t})}\n\t\t\tcolor={ButtonSeverityColorMapping[severity]}\n\t\t\tsize={applyResponsiveMapping(size, ButtonSizeMapping)}\n\t\t\t{...rest}\n\t\t/>\n\t)\n})\n\nexport default React.memo(_Button)\n","import React, { forwardRef } from \"react\"\nimport { ButtonProps } from \"./typings.ts\"\nimport styles from \"./Button.module.sass\"\nimport classNames from \"classnames\"\nimport { IconButton as RadixIconButton } from \"@radix-ui/themes\"\nimport { ButtonSeverityColorMapping, ButtonSizeMapping, hoverEffectClassNameMapping } from \"./constants.ts\"\nimport { applyResponsiveMapping } from \"../utils.ts\"\n\nconst _Button = forwardRef(function Button(\n\t{ className, children, severity = \"primary\", size = \"medium\", hoverEffects, ...rest }: Omit<ButtonProps, \"fluid\">,\n\tref: React.Ref<HTMLButtonElement>,\n) {\n\tconst hoverEffectClasses =\n\t\thoverEffects?.map((hoverEffect) => {\n\t\t\treturn hoverEffectClassNameMapping[hoverEffect]\n\t\t}) || []\n\n\treturn (\n\t\t<RadixIconButton\n\t\t\tclassName={classNames(styles.default, className, hoverEffectClasses)}\n\t\t\tref={ref}\n\t\t\tcolor={ButtonSeverityColorMapping[severity]}\n\t\t\tsize={applyResponsiveMapping(size, ButtonSizeMapping)}\n\t\t\t{...rest}\n\t\t>\n\t\t\t{children}\n\t\t</RadixIconButton>\n\t)\n})\n\nexport default React.memo(_Button)\n"],"names":["hasOwn","classNames","classes","i","arg","argType","inner","key","module","hoverEffectClassNameMapping","styles","ButtonSeverityColorMapping","ButtonSizeMapping","applyResponsiveMapping","value","mapping","_value","_Button","forwardRef","className","severity","size","hoverEffects","fluid","rest","ref","hoverEffectClasses","hoverEffect","jsx","RadixButton","Button","React","children","RadixIconButton","IconButton"],"mappings":";;;;gBAOC,UAAY,CAGZ,IAAIA,EAAS,CAAE,EAAC,eAGhB,SAASC,GAAa,CAGrB,QAFIC,EAAU,CAAA,EAELC,EAAI,EAAGA,EAAI,UAAU,OAAQA,IAAK,CAC1C,IAAIC,EAAM,UAAUD,CAAC,EACrB,GAAKC,EAEL,KAAIC,EAAU,OAAOD,EAErB,GAAIC,IAAY,UAAYA,IAAY,SACvCH,EAAQ,KAAKE,CAAG,UACN,MAAM,QAAQA,CAAG,GAC3B,GAAIA,EAAI,OAAQ,CACf,IAAIE,EAAQL,EAAW,MAAM,KAAMG,CAAG,EAClCE,GACHJ,EAAQ,KAAKI,CAAK,CAEnB,UACSD,IAAY,SAAU,CAChC,GAAID,EAAI,WAAa,OAAO,UAAU,UAAY,CAACA,EAAI,SAAS,SAAQ,EAAG,SAAS,eAAe,EAAG,CACrGF,EAAQ,KAAKE,EAAI,SAAU,CAAA,EAC3B,QACA,CAED,QAASG,KAAOH,EACXJ,EAAO,KAAKI,EAAKG,CAAG,GAAKH,EAAIG,CAAG,GACnCL,EAAQ,KAAKK,CAAG,CAGlB,EACD,CAED,OAAO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AW,KAAAC,EAAO,SAAU,aAAAC,EAAc,GAAGE,CAAA,EAC/EC,EACC,CACD,MAAMC,GACLJ,GAAA,YAAAA,EAAc,IAAKK,GACXlB,EAA4BkB,CAAW,KACzC,CAAA,EAGN,OAAAC,EAAA,IAACK,EAAA,WAAA,CACA,UAAWhC,EAAWS,EAAO,QAASS,EAAWO,CAAkB,EACnE,IAAAD,EACA,MAAOd,EAA2BS,CAAQ,EAC1C,KAAMP,EAAuBQ,EAAMT,CAAiB,EACnD,GAAGY,EAEH,SAAAQ,CAAA,CAAA,CAGJ,CAAC,EAEDE,EAAeH,EAAM,KAAKd,CAAO","x_google_ignoreList":[0]}
@@ -0,0 +1 @@
1
+ export * from "./Buttons";
package/dist/style.css ADDED
@@ -0,0 +1 @@
1
+ ._default_3aivb_1{width:max-content;cursor:pointer}._fluid_3aivb_6{flex-grow:1;width:auto}._hoverSpin90Clockwise_3aivb_20>svg{transition:unset}._hoverSpin90Clockwise_3aivb_20 svg{transition:transform .25s ease-in-out!important;transform:rotate(0)!important}._hoverSpin90Clockwise_3aivb_20:hover:not(:disabled) svg{transform:rotate(90deg)!important}._hoverSpin180Clockwise_3aivb_31>svg{transition:unset}._hoverSpin180Clockwise_3aivb_31 svg{transition:transform .3s ease-in-out!important;transform:rotate(0)!important}._hoverSpin180Clockwise_3aivb_31:hover:not(:disabled) svg{transform:rotate(180deg)!important}._hoverSpin360Clockwise_3aivb_42>svg{transition:unset}._hoverSpin360Clockwise_3aivb_42 svg{transition:transform .5s ease-in-out!important;transform:rotate(0)!important}._hoverSpin360Clockwise_3aivb_42:hover:not(:disabled) svg{transform:rotate(360deg)!important}
@@ -0,0 +1,9 @@
1
+ import { Responsive } from "@radix-ui/themes";
2
+ /**
3
+ * Returns an object with mapped key values or a single mapped value
4
+ * @param value an object or string
5
+ * @param mapping a Record mapping the object values of param value
6
+ */
7
+ export declare function applyResponsiveMapping<T extends string, K>(value: Responsive<T>, mapping: Record<T, K>): Record<T, K>[T] | {
8
+ [k: string]: Record<T, K>[T];
9
+ };
package/package.json ADDED
@@ -0,0 +1,76 @@
1
+ {
2
+ "name": "@overmap-ai/blocks",
3
+ "private": false,
4
+ "version": "0.0.1-alpha.19",
5
+ "type": "module",
6
+ "main": "dist/blocks.umd.cjs",
7
+ "module": "dist/blocks.js",
8
+ "types": "dist/index.d.ts",
9
+ "scripts": {
10
+ "dev": "vite",
11
+ "build": "tsc --noEmit && vite build",
12
+ "lint": "eslint src, .storybook, stories --ext ts,tsx,js,jsx --report-unused-disable-directives --max-warnings 0",
13
+ "lint:fix": "yarn lint --fix",
14
+ "preview": "vite preview",
15
+ "prepare": "husky install",
16
+ "storybook": "storybook dev -p 6006",
17
+ "build-storybook": "storybook build"
18
+ },
19
+ "peerDependencies": {
20
+ "@radix-ui/themes": "^1.1.2",
21
+ "@radix-ui/colors": "^3.0.0-rc.5",
22
+ "@radix-ui/react-icons": "^1.3.0",
23
+ "react": "^18.2.0",
24
+ "react-dom": "^18.2.0"
25
+ },
26
+ "devDependencies": {
27
+ "@radix-ui/colors": "^3.0.0-rc.5",
28
+ "@radix-ui/react-icons": "^1.3.0",
29
+ "@radix-ui/themes": "^1.1.2",
30
+ "@rollup/plugin-commonjs": "^25.0.4",
31
+ "@storybook/addon-essentials": "^7.4.3",
32
+ "@storybook/addon-interactions": "^7.4.3",
33
+ "@storybook/addon-links": "^7.4.3",
34
+ "@storybook/addon-onboarding": "^1.0.8",
35
+ "@storybook/blocks": "^7.4.3",
36
+ "@storybook/react": "^7.4.3",
37
+ "@storybook/react-vite": "^7.4.3",
38
+ "@storybook/testing-library": "^0.2.1",
39
+ "@types/node": "^20.6.3",
40
+ "@types/react": "^18.2.15",
41
+ "@types/react-dom": "^18.2.7",
42
+ "@typescript-eslint/eslint-plugin": "^6.0.0",
43
+ "@typescript-eslint/parser": "^6.0.0",
44
+ "@vitejs/plugin-react-swc": "^3.3.2",
45
+ "classnames": "^2.3.2",
46
+ "eslint": "^8.45.0",
47
+ "eslint-config-prettier": "^9.0.0",
48
+ "eslint-plugin-prettier": "^5.0.0",
49
+ "eslint-plugin-react-hooks": "^4.6.0",
50
+ "eslint-plugin-react-refresh": "^0.4.3",
51
+ "eslint-plugin-storybook": "^0.6.13",
52
+ "husky": "^8.0.3",
53
+ "lint-staged": "^14.0.1",
54
+ "prettier": "^3.0.3",
55
+ "react": "^18.2.0",
56
+ "react-dom": "^18.2.0",
57
+ "rollup-plugin-polyfill-node": "^0.12.0",
58
+ "sass": "^1.68.0",
59
+ "storybook": "^7.4.3",
60
+ "typescript": "^5.0.2",
61
+ "vite": "^4.4.5",
62
+ "vite-plugin-dts": "^3.5.3",
63
+ "vite-plugin-externalize-deps": "^0.7.0"
64
+ },
65
+ "lint-staged": {
66
+ "*.{js,jsx,ts,tsx}": [
67
+ "yarn eslint --fix"
68
+ ]
69
+ },
70
+ "files": [
71
+ "dist"
72
+ ],
73
+ "resolutions": {
74
+ "jackspeak": "2.1.1"
75
+ }
76
+ }