@radui/ui 0.0.4 → 0.0.5

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,70 @@
1
+ [![codecov](https://codecov.io/gh/rad-ui/ui/graph/badge.svg?token=Z74MUHF5TN)](https://codecov.io/gh/rad-ui/ui)
2
+
3
+ # RAD UI
4
+
5
+ ![RAD UI](./assets/images/rad-ui-poster.jpg)
6
+
7
+ ## Introduction to Rad UI
8
+
9
+ Rad UI is a React UI library designed to simplify and enhance the process of building user interfaces. With a focus on ease of use and flexibility, Rad UI empowers developers to create engaging and efficient user experiences. Whether you're starting a new project or improving an existing one, Rad UI provides a collection of components and utilities to streamline development.
10
+
11
+ ## Installation
12
+
13
+ To install Rad UI, run the following command from the root of your project's directory:
14
+
15
+ ```bash
16
+ npm install @radui/ui
17
+ ```
18
+
19
+ Description: Rad UI is a React UI library that simplifies UI development, offering a collection of components and utilities to enhance the user experience. It addresses common challenges in building interfaces, making it easier for developers to create intuitive and visually appealing applications.
20
+
21
+ Technology stack: React
22
+ Status: Beta
23
+ Please note that Rad UI is under development and will receive a full official release soon in 2024 once significant production-ready components are readily available.
24
+ What sets this apart: Rad UI stands out with its focus on simplicity, flexibility, and ease of integration into React projects.
25
+ <!--
26
+
27
+ ## Dependencies
28
+
29
+ Describe any dependencies that must be installed for this software to work.
30
+ This includes programming languages, databases or other storage mechanisms, build tools, frameworks, and so forth.
31
+ If specific versions of other software are required, or known not to work, call that out.
32
+
33
+ ## Usage
34
+
35
+ Show users how to use the software.
36
+ Be specific.
37
+ Use appropriate formatting when showing code snippets.
38
+
39
+ ## How to test the software
40
+
41
+ If the software includes automated tests, detail how to run those tests.
42
+
43
+ ## Known issues
44
+
45
+ Document any known significant shortcomings with the software.
46
+
47
+ ## Getting help
48
+
49
+ Instruct users how to get help with this software; this might include links to an issue tracker, wiki, mailing list, etc.
50
+
51
+ **Example**
52
+
53
+ If you have questions, concerns, bug reports, etc, please file an issue in this repository's Issue Tracker. -->
54
+
55
+ ## Getting involved
56
+
57
+ We encourage interested developers in getting involved in building a better future for the web.
58
+ For more details you can read [CONTRIBUTING](CONTRIBUTING.md).
59
+
60
+ ## Open source licensing info
61
+
62
+ For Licensing info you can check out [LICENSE](LICENSE).
63
+
64
+ ## Credits and references
65
+
66
+ 1. Project heavily inspired by RadixUI, Floating UI, shadcn/ui and many other libraries that defined the modern web that we know today
67
+
68
+
69
+ This project is tested with BrowserStack
70
+
@@ -1,26 +1,81 @@
1
1
  'use client';
2
2
  import React, { useState } from 'react';
3
3
 
4
- const Accordion = _ref => {
5
- let {
6
- items
7
- } = _ref;
8
- const [activeIndex, setActiveIndex] = useState(null);
9
- const handleClick = index => {
4
+ function _iterableToArrayLimit(r, l) {
5
+ var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
6
+ if (null != t) {
7
+ var e,
8
+ n,
9
+ i,
10
+ u,
11
+ a = [],
12
+ f = !0,
13
+ o = !1;
14
+ try {
15
+ if (i = (t = t.call(r)).next, 0 === l) {
16
+ if (Object(t) !== t) return;
17
+ f = !1;
18
+ } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
19
+ } catch (r) {
20
+ o = !0, n = r;
21
+ } finally {
22
+ try {
23
+ if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;
24
+ } finally {
25
+ if (o) throw n;
26
+ }
27
+ }
28
+ return a;
29
+ }
30
+ }
31
+ function _slicedToArray(arr, i) {
32
+ return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
33
+ }
34
+ function _arrayWithHoles(arr) {
35
+ if (Array.isArray(arr)) return arr;
36
+ }
37
+ function _unsupportedIterableToArray(o, minLen) {
38
+ if (!o) return;
39
+ if (typeof o === "string") return _arrayLikeToArray(o, minLen);
40
+ var n = Object.prototype.toString.call(o).slice(8, -1);
41
+ if (n === "Object" && o.constructor) n = o.constructor.name;
42
+ if (n === "Map" || n === "Set") return Array.from(o);
43
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
44
+ }
45
+ function _arrayLikeToArray(arr, len) {
46
+ if (len == null || len > arr.length) len = arr.length;
47
+ for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
48
+ return arr2;
49
+ }
50
+ function _nonIterableRest() {
51
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
52
+ }
53
+
54
+ var Accordion = function Accordion(_ref) {
55
+ var items = _ref.items;
56
+ var _useState = useState(null),
57
+ _useState2 = _slicedToArray(_useState, 2),
58
+ activeIndex = _useState2[0],
59
+ setActiveIndex = _useState2[1];
60
+ var handleClick = function handleClick(index) {
10
61
  setActiveIndex(activeIndex === index ? null : index);
11
62
  };
12
- return /*#__PURE__*/React.createElement("div", null, items.map((item, index) => /*#__PURE__*/React.createElement("div", {
13
- key: index
14
- }, /*#__PURE__*/React.createElement("button", {
15
- onClick: () => handleClick(index),
16
- "aria-expanded": activeIndex === index,
17
- "aria-controls": `content-${index}`
18
- }, item.title), /*#__PURE__*/React.createElement("div", {
19
- id: `content-${index}`,
20
- role: "region",
21
- "aria-labelledby": `section-${index}`,
22
- hidden: activeIndex !== index
23
- }, /*#__PURE__*/React.createElement("p", null, item.content)))));
63
+ return /*#__PURE__*/React.createElement("div", null, items.map(function (item, index) {
64
+ return /*#__PURE__*/React.createElement("div", {
65
+ key: index
66
+ }, /*#__PURE__*/React.createElement("button", {
67
+ onClick: function onClick() {
68
+ return handleClick(index);
69
+ },
70
+ "aria-expanded": activeIndex === index,
71
+ "aria-controls": "content-".concat(index)
72
+ }, item.title), /*#__PURE__*/React.createElement("div", {
73
+ id: "content-".concat(index),
74
+ role: "region",
75
+ "aria-labelledby": "section-".concat(index),
76
+ hidden: activeIndex !== index
77
+ }, /*#__PURE__*/React.createElement("p", null, item.content)));
78
+ }));
24
79
  };
25
80
 
26
81
  export { Accordion as default };
@@ -1,5 +1,6 @@
1
1
  'use client';
2
- import React from 'react';
2
+ import React, { useState, useEffect } from 'react';
3
+ import { customClassSwitcher } from '@/core';
3
4
 
4
5
  function _extends() {
5
6
  _extends = Object.assign ? Object.assign.bind() : function (target) {
@@ -15,53 +16,138 @@ function _extends() {
15
16
  };
16
17
  return _extends.apply(this, arguments);
17
18
  }
19
+ function _objectWithoutPropertiesLoose(source, excluded) {
20
+ if (source == null) return {};
21
+ var target = {};
22
+ var sourceKeys = Object.keys(source);
23
+ var key, i;
24
+ for (i = 0; i < sourceKeys.length; i++) {
25
+ key = sourceKeys[i];
26
+ if (excluded.indexOf(key) >= 0) continue;
27
+ target[key] = source[key];
28
+ }
29
+ return target;
30
+ }
31
+ function _objectWithoutProperties(source, excluded) {
32
+ if (source == null) return {};
33
+ var target = _objectWithoutPropertiesLoose(source, excluded);
34
+ var key, i;
35
+ if (Object.getOwnPropertySymbols) {
36
+ var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
37
+ for (i = 0; i < sourceSymbolKeys.length; i++) {
38
+ key = sourceSymbolKeys[i];
39
+ if (excluded.indexOf(key) >= 0) continue;
40
+ if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
41
+ target[key] = source[key];
42
+ }
43
+ }
44
+ return target;
45
+ }
18
46
 
19
- const RAD_UI_CLASS_PREFIX = 'rad-ui';
20
- const customClassSwitcher = function (customRootClass) {
21
- let componentName = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
22
- // applies a custom root class the user provides, else applies the default rad-ui classes to the component
23
- // rad ui's classes are based on this logic
47
+ var Root = function (_a) {
48
+ var children = _a.children, _b = _a.customRootClass, customRootClass = _b === void 0 ? '' : _b;
49
+ var rootClass = customClassSwitcher(customRootClass, 'Avatar');
50
+ return (React.createElement("span", { className: "".concat(rootClass, "-root") }, children));
51
+ };
24
52
 
25
- // add dashes between capitalized words
26
- const componentClassName = componentName.replace(/([a-z0-9])([A-Z])/g, '$1-$2').toLowerCase();
27
- if (customRootClass) return customRootClass;
28
- if (componentName) return `${RAD_UI_CLASS_PREFIX}-${componentClassName}`;
29
- return '';
53
+ /******************************************************************************
54
+ Copyright (c) Microsoft Corporation.
55
+
56
+ Permission to use, copy, modify, and/or distribute this software for any
57
+ purpose with or without fee is hereby granted.
58
+
59
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
60
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
61
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
62
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
63
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
64
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
65
+ PERFORMANCE OF THIS SOFTWARE.
66
+ ***************************************************************************** */
67
+ /* global Reflect, Promise, SuppressedError, Symbol */
68
+
69
+
70
+ var __assign = function() {
71
+ __assign = Object.assign || function __assign(t) {
72
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
73
+ s = arguments[i];
74
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
75
+ }
76
+ return t;
77
+ };
78
+ return __assign.apply(this, arguments);
79
+ };
80
+
81
+ function __rest(s, e) {
82
+ var t = {};
83
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
84
+ t[p] = s[p];
85
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
86
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
87
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
88
+ t[p[i]] = s[p[i]];
89
+ }
90
+ return t;
91
+ }
92
+
93
+ typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
94
+ var e = new Error(message);
95
+ return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
30
96
  };
31
97
 
32
- const COMPONENT_NAME = 'Avatar';
33
- const TextRenderer = _ref => {
34
- let {
35
- rootClass,
36
- fallback
37
- } = _ref;
38
- return /*#__PURE__*/React.createElement("div", {
39
- className: `${rootClass} ${rootClass}-fallback`
40
- }, fallback);
98
+ var AvatarImage = function (_a) {
99
+ var _b = _a.src, src = _b === void 0 ? 'src' : _b, _c = _a.alt, alt = _c === void 0 ? '' : _c, _d = _a.customRootClass, customRootClass = _d === void 0 ? '' : _d, _e = _a.className, className = _e === void 0 ? '' : _e, props = __rest(_a, ["src", "alt", "customRootClass", "className"]);
100
+ var rootClass = customClassSwitcher(customRootClass, 'Avatar');
101
+ var _f = useState(false), isBrokenImage = _f[0], setIsBrokenImage = _f[1];
102
+ var handleImageLoaded = function () {
103
+ setIsBrokenImage(false);
104
+ };
105
+ var handleImageError = function () {
106
+ setIsBrokenImage(true);
107
+ };
108
+ useEffect(function () {
109
+ }, [isBrokenImage]);
110
+ if (isBrokenImage) {
111
+ return null;
112
+ }
113
+ return (React.createElement("img", __assign({ src: src, alt: alt, onError: handleImageError, onLoad: handleImageLoaded, className: "".concat(rootClass, " ").concat(className) }, props)));
41
114
  };
42
- const Avatar = _ref2 => {
43
- let {
44
- children,
45
- customRootClass = '',
46
- fallback = '',
47
- className = '',
48
- src,
49
- alt,
50
- ...rest
51
- } = _ref2;
52
- const rootClass = customClassSwitcher(customRootClass, COMPONENT_NAME);
53
- if (!src) {
54
- return /*#__PURE__*/React.createElement(TextRenderer, {
55
- fallback: fallback,
56
- rootClass: rootClass
57
- });
58
- }
59
- return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("img", _extends({
115
+
116
+ var AvatarFallback = function (_a) {
117
+ var _b = _a.fallback, fallback = _b === void 0 ? '' : _b, _c = _a.customRootClass, customRootClass = _c === void 0 ? '' : _c, props = __rest(_a, ["fallback", "customRootClass"]);
118
+ var rootClass = customClassSwitcher(customRootClass, 'Avatar');
119
+ return (React.createElement("span", __assign({ className: "".concat(rootClass, "-fallback") }, props), fallback));
120
+ };
121
+
122
+ var _excluded = ["children", "customRootClass", "fallback", "className", "src", "alt"];
123
+ var COMPONENT_NAME = 'Avatar';
124
+ var Avatar = function Avatar(_ref) {
125
+ _ref.children;
126
+ var _ref$customRootClass = _ref.customRootClass,
127
+ customRootClass = _ref$customRootClass === void 0 ? '' : _ref$customRootClass,
128
+ _ref$fallback = _ref.fallback,
129
+ fallback = _ref$fallback === void 0 ? '' : _ref$fallback,
130
+ _ref$className = _ref.className,
131
+ className = _ref$className === void 0 ? '' : _ref$className,
132
+ _ref$src = _ref.src,
133
+ src = _ref$src === void 0 ? '' : _ref$src,
134
+ alt = _ref.alt,
135
+ props = _objectWithoutProperties(_ref, _excluded);
136
+ return /*#__PURE__*/React.createElement(Root, {
137
+ customRootClass: customRootClass
138
+ }, /*#__PURE__*/React.createElement(AvatarImage, _extends({
60
139
  src: src,
61
140
  alt: alt,
62
- className: `${rootClass} ${className}`
63
- }, rest)));
141
+ className: className,
142
+ customRootClass: customRootClass
143
+ }, props)), /*#__PURE__*/React.createElement(AvatarFallback, {
144
+ customRootClass: customRootClass,
145
+ fallback: fallback
146
+ }));
64
147
  };
65
148
  Avatar.displayName = COMPONENT_NAME;
149
+ Avatar.Root = Root;
150
+ Avatar.Image = AvatarImage;
151
+ Avatar.Fallback = AvatarFallback;
66
152
 
67
153
  export { Avatar as default };
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ type AvatarFallbackProps = {
3
+ fallback: string;
4
+ customRootClass: string;
5
+ };
6
+ declare const AvatarFallback: React.FC<AvatarFallbackProps>;
7
+ export default AvatarFallback;
8
+ //# sourceMappingURL=AvatarFallback.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AvatarFallback.d.ts","sourceRoot":"","sources":["../src/components/ui/Avatar/shards/AvatarFallback.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,KAAK,mBAAmB,GAAG;IACvB,QAAQ,EAAE,MAAM,CAAC;IACjB,eAAe,EAAE,MAAM,CAAC;CAC3B,CAAC;AAEF,QAAA,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,mBAAmB,CAOjD,CAAC;AAEF,eAAe,cAAc,CAAC"}
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ type AvatarImageProps = {
3
+ src: string;
4
+ alt: string;
5
+ className: string;
6
+ customRootClass: string;
7
+ };
8
+ declare const AvatarImage: React.FC<AvatarImageProps>;
9
+ export default AvatarImage;
10
+ //# sourceMappingURL=AvatarImage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AvatarImage.d.ts","sourceRoot":"","sources":["../src/components/ui/Avatar/shards/AvatarImage.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA4B,MAAM,OAAO,CAAC;AAIjD,KAAK,gBAAgB,GAAG;IACpB,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,EAAE,MAAM,CAAC;IAClB,eAAe,EAAE,MAAM,CAAC;CAC3B,CAAC;AAEF,QAAA,MAAM,WAAW,EAAE,KAAK,CAAC,EAAE,CAAC,gBAAgB,CAuB3C,CAAC;AAEF,eAAe,WAAW,CAAC"}
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ type AvatarRootProps = {
3
+ children: React.ReactNode;
4
+ customRootClass: string;
5
+ };
6
+ declare const Root: React.FC<AvatarRootProps>;
7
+ export default Root;
8
+ //# sourceMappingURL=AvatarRoot.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AvatarRoot.d.ts","sourceRoot":"","sources":["../src/components/ui/Avatar/shards/AvatarRoot.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,KAAK,eAAe,GAAG;IACrB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,eAAe,EAAC,MAAM,CAAA;CACvB,CAAC;AAEF,QAAA,MAAM,IAAI,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CAOnC,CAAC;AAEF,eAAe,IAAI,CAAC"}
@@ -15,35 +15,64 @@ function _extends() {
15
15
  };
16
16
  return _extends.apply(this, arguments);
17
17
  }
18
+ function _objectWithoutPropertiesLoose(source, excluded) {
19
+ if (source == null) return {};
20
+ var target = {};
21
+ var sourceKeys = Object.keys(source);
22
+ var key, i;
23
+ for (i = 0; i < sourceKeys.length; i++) {
24
+ key = sourceKeys[i];
25
+ if (excluded.indexOf(key) >= 0) continue;
26
+ target[key] = source[key];
27
+ }
28
+ return target;
29
+ }
30
+ function _objectWithoutProperties(source, excluded) {
31
+ if (source == null) return {};
32
+ var target = _objectWithoutPropertiesLoose(source, excluded);
33
+ var key, i;
34
+ if (Object.getOwnPropertySymbols) {
35
+ var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
36
+ for (i = 0; i < sourceSymbolKeys.length; i++) {
37
+ key = sourceSymbolKeys[i];
38
+ if (excluded.indexOf(key) >= 0) continue;
39
+ if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
40
+ target[key] = source[key];
41
+ }
42
+ }
43
+ return target;
44
+ }
18
45
 
19
- const RAD_UI_CLASS_PREFIX = 'rad-ui';
20
- const customClassSwitcher = function (customRootClass) {
21
- let componentName = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
46
+ var RAD_UI_CLASS_PREFIX = 'rad-ui';
47
+ var customClassSwitcher = function customClassSwitcher(customRootClass) {
48
+ var componentName = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
22
49
  // applies a custom root class the user provides, else applies the default rad-ui classes to the component
23
50
  // rad ui's classes are based on this logic
24
51
 
25
52
  // add dashes between capitalized words
26
- const componentClassName = componentName.replace(/([a-z0-9])([A-Z])/g, '$1-$2').toLowerCase();
53
+ var componentClassName = componentName.replace(/([a-z0-9])([A-Z])/g, '$1-$2').toLowerCase();
27
54
  if (customRootClass) return customRootClass;
28
- if (componentName) return `${RAD_UI_CLASS_PREFIX}-${componentClassName}`;
55
+ if (componentName) return "".concat(RAD_UI_CLASS_PREFIX, "-").concat(componentClassName);
29
56
  return '';
30
57
  };
31
58
 
32
- const COMPONENT_NAME = 'Badge';
33
- const Badge = _ref => {
34
- let {
35
- children,
36
- customRootClass = '',
37
- className = '',
38
- color = undefined,
39
- ...props
40
- } = _ref;
41
- const rootClass = customClassSwitcher(customRootClass, COMPONENT_NAME);
59
+ var _excluded = ["children", "customRootClass", "className", "color"];
60
+ var COMPONENT_NAME = 'Badge';
61
+ var Badge = function Badge(_ref) {
62
+ var children = _ref.children,
63
+ _ref$customRootClass = _ref.customRootClass,
64
+ customRootClass = _ref$customRootClass === void 0 ? '' : _ref$customRootClass,
65
+ _ref$className = _ref.className,
66
+ className = _ref$className === void 0 ? '' : _ref$className,
67
+ _ref$color = _ref.color,
68
+ color = _ref$color === void 0 ? undefined : _ref$color,
69
+ props = _objectWithoutProperties(_ref, _excluded);
70
+ var rootClass = customClassSwitcher(customRootClass, COMPONENT_NAME);
42
71
  if (color) {
43
72
  props['data-accent-color'] = color;
44
73
  }
45
74
  return /*#__PURE__*/React.createElement("span", _extends({
46
- className: `${rootClass} ${className}`
75
+ className: "".concat(rootClass, " ").concat(className)
47
76
  }, props), children);
48
77
  };
49
78
  Badge.displayName = COMPONENT_NAME;
@@ -15,31 +15,59 @@ function _extends() {
15
15
  };
16
16
  return _extends.apply(this, arguments);
17
17
  }
18
+ function _objectWithoutPropertiesLoose(source, excluded) {
19
+ if (source == null) return {};
20
+ var target = {};
21
+ var sourceKeys = Object.keys(source);
22
+ var key, i;
23
+ for (i = 0; i < sourceKeys.length; i++) {
24
+ key = sourceKeys[i];
25
+ if (excluded.indexOf(key) >= 0) continue;
26
+ target[key] = source[key];
27
+ }
28
+ return target;
29
+ }
30
+ function _objectWithoutProperties(source, excluded) {
31
+ if (source == null) return {};
32
+ var target = _objectWithoutPropertiesLoose(source, excluded);
33
+ var key, i;
34
+ if (Object.getOwnPropertySymbols) {
35
+ var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
36
+ for (i = 0; i < sourceSymbolKeys.length; i++) {
37
+ key = sourceSymbolKeys[i];
38
+ if (excluded.indexOf(key) >= 0) continue;
39
+ if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
40
+ target[key] = source[key];
41
+ }
42
+ }
43
+ return target;
44
+ }
18
45
 
19
- const RAD_UI_CLASS_PREFIX = 'rad-ui';
20
- const customClassSwitcher = function (customRootClass) {
21
- let componentName = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
46
+ var RAD_UI_CLASS_PREFIX = 'rad-ui';
47
+ var customClassSwitcher = function customClassSwitcher(customRootClass) {
48
+ var componentName = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
22
49
  // applies a custom root class the user provides, else applies the default rad-ui classes to the component
23
50
  // rad ui's classes are based on this logic
24
51
 
25
52
  // add dashes between capitalized words
26
- const componentClassName = componentName.replace(/([a-z0-9])([A-Z])/g, '$1-$2').toLowerCase();
53
+ var componentClassName = componentName.replace(/([a-z0-9])([A-Z])/g, '$1-$2').toLowerCase();
27
54
  if (customRootClass) return customRootClass;
28
- if (componentName) return `${RAD_UI_CLASS_PREFIX}-${componentClassName}`;
55
+ if (componentName) return "".concat(RAD_UI_CLASS_PREFIX, "-").concat(componentClassName);
29
56
  return '';
30
57
  };
31
58
 
32
- const COMPONENT_NAME = 'BlockQuote';
33
- const BlockQuote = _ref => {
34
- let {
35
- children,
36
- customRootClass = '',
37
- className = '',
38
- ...props
39
- } = _ref;
40
- const rootClass = customClassSwitcher(customRootClass, COMPONENT_NAME);
59
+ var _excluded = ["children", "customRootClass", "className"];
60
+ var COMPONENT_NAME = 'BlockQuote';
61
+ var BlockQuote = function BlockQuote(_ref) {
62
+ var children = _ref.children,
63
+ _ref$customRootClass = _ref.customRootClass,
64
+ customRootClass = _ref$customRootClass === void 0 ? '' : _ref$customRootClass,
65
+ _ref$className = _ref.className,
66
+ className = _ref$className === void 0 ? '' : _ref$className,
67
+ props = _objectWithoutProperties(_ref, _excluded);
68
+ var rootClass = customClassSwitcher(customRootClass, COMPONENT_NAME);
41
69
  return /*#__PURE__*/React.createElement("blockquote", _extends({
42
- className: `${rootClass} ${className}`
70
+ className: "".concat(rootClass, " ").concat(className)
43
71
  }, props), children);
44
72
  };
45
73
  BlockQuote.displayName = COMPONENT_NAME;
@@ -15,17 +15,46 @@ function _extends() {
15
15
  };
16
16
  return _extends.apply(this, arguments);
17
17
  }
18
+ function _objectWithoutPropertiesLoose(source, excluded) {
19
+ if (source == null) return {};
20
+ var target = {};
21
+ var sourceKeys = Object.keys(source);
22
+ var key, i;
23
+ for (i = 0; i < sourceKeys.length; i++) {
24
+ key = sourceKeys[i];
25
+ if (excluded.indexOf(key) >= 0) continue;
26
+ target[key] = source[key];
27
+ }
28
+ return target;
29
+ }
30
+ function _objectWithoutProperties(source, excluded) {
31
+ if (source == null) return {};
32
+ var target = _objectWithoutPropertiesLoose(source, excluded);
33
+ var key, i;
34
+ if (Object.getOwnPropertySymbols) {
35
+ var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
36
+ for (i = 0; i < sourceSymbolKeys.length; i++) {
37
+ key = sourceSymbolKeys[i];
38
+ if (excluded.indexOf(key) >= 0) continue;
39
+ if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
40
+ target[key] = source[key];
41
+ }
42
+ }
43
+ return target;
44
+ }
18
45
 
46
+ var _excluded = ["children", "type", "color", "className", "variant"];
19
47
  // make the color prop default accent color
20
- const Button = _ref => {
21
- let {
22
- children,
23
- type = 'button',
24
- color = undefined,
25
- className = '',
26
- variant = 'solid',
27
- ...props
28
- } = _ref;
48
+ var Button = function Button(_ref) {
49
+ var children = _ref.children;
50
+ _ref.type;
51
+ var _ref$color = _ref.color,
52
+ color = _ref$color === void 0 ? undefined : _ref$color,
53
+ _ref$className = _ref.className,
54
+ className = _ref$className === void 0 ? '' : _ref$className,
55
+ _ref$variant = _ref.variant,
56
+ variant = _ref$variant === void 0 ? 'solid' : _ref$variant,
57
+ props = _objectWithoutProperties(_ref, _excluded);
29
58
  // apply data attribute for accent color
30
59
  // apply attribute only if color is present
31
60
  if (color) {
@@ -33,7 +62,7 @@ const Button = _ref => {
33
62
  }
34
63
  return /*#__PURE__*/React.createElement("button", _extends({
35
64
  type: "button",
36
- className: `rad-ui-button button-${variant} ${className}`
65
+ className: "rad-ui-button button-".concat(variant, " ").concat(className)
37
66
  }, props), children);
38
67
  };
39
68