@radui/ui 0.0.3 → 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.
Files changed (43) hide show
  1. package/README.md +70 -0
  2. package/dist/components/Accordion.js +81 -0
  3. package/dist/components/Avatar.js +153 -0
  4. package/dist/components/AvatarFallback.d.ts +8 -0
  5. package/dist/components/AvatarFallback.d.ts.map +1 -0
  6. package/dist/components/AvatarImage.d.ts +10 -0
  7. package/dist/components/AvatarImage.d.ts.map +1 -0
  8. package/dist/components/AvatarRoot.d.ts +8 -0
  9. package/dist/components/AvatarRoot.d.ts.map +1 -0
  10. package/dist/components/Badge.js +80 -0
  11. package/dist/components/BlockQuote.js +75 -0
  12. package/dist/components/Button.js +69 -0
  13. package/dist/{Callout.js → components/Callout.js} +46 -17
  14. package/dist/{Code.js → components/Code.js} +2 -4
  15. package/dist/{Dropdown.js → components/Dropdown.js} +66 -8
  16. package/dist/components/Em.js +75 -0
  17. package/dist/{Heading.js → components/Heading.js} +24 -20
  18. package/dist/components/Kbd.js +74 -0
  19. package/dist/components/Link.js +81 -0
  20. package/dist/components/Quote.js +75 -0
  21. package/dist/components/Separator.js +33 -0
  22. package/dist/{Strong.js → components/Strong.js} +2 -4
  23. package/dist/components/Tabs.js +231 -0
  24. package/dist/components/Text.js +80 -0
  25. package/dist/{TextArea.js → components/TextArea.js} +2 -1
  26. package/dist/{Tooltip.js → components/Tooltip.js} +143 -61
  27. package/dist/themes/default.css +2 -0
  28. package/dist/themes/default.css.map +1 -0
  29. package/package.json +24 -9
  30. package/dist/Accordion.js +0 -26
  31. package/dist/Avatar.js +0 -67
  32. package/dist/Badge.js +0 -51
  33. package/dist/BlockQuote.js +0 -47
  34. package/dist/Button.js +0 -40
  35. package/dist/Em.js +0 -47
  36. package/dist/Kbd.js +0 -46
  37. package/dist/Link.js +0 -51
  38. package/dist/Quote.js +0 -47
  39. package/dist/Separator.js +0 -32
  40. package/dist/Tabs.js +0 -146
  41. package/dist/Text.js +0 -51
  42. package/dist/themes/main.css/default.css +0 -2
  43. package/dist/themes/main.css/default.css.map +0 -1
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
+
@@ -0,0 +1,81 @@
1
+ 'use client';
2
+ import React, { useState } from 'react';
3
+
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) {
61
+ setActiveIndex(activeIndex === index ? null : index);
62
+ };
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
+ }));
79
+ };
80
+
81
+ export { Accordion as default };
@@ -0,0 +1,153 @@
1
+ 'use client';
2
+ import React, { useState, useEffect } from 'react';
3
+ import { customClassSwitcher } from '@/core';
4
+
5
+ function _extends() {
6
+ _extends = Object.assign ? Object.assign.bind() : function (target) {
7
+ for (var i = 1; i < arguments.length; i++) {
8
+ var source = arguments[i];
9
+ for (var key in source) {
10
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
11
+ target[key] = source[key];
12
+ }
13
+ }
14
+ }
15
+ return target;
16
+ };
17
+ return _extends.apply(this, arguments);
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
+ }
46
+
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
+ };
52
+
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;
96
+ };
97
+
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)));
114
+ };
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({
139
+ src: src,
140
+ alt: alt,
141
+ className: className,
142
+ customRootClass: customRootClass
143
+ }, props)), /*#__PURE__*/React.createElement(AvatarFallback, {
144
+ customRootClass: customRootClass,
145
+ fallback: fallback
146
+ }));
147
+ };
148
+ Avatar.displayName = COMPONENT_NAME;
149
+ Avatar.Root = Root;
150
+ Avatar.Image = AvatarImage;
151
+ Avatar.Fallback = AvatarFallback;
152
+
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"}
@@ -0,0 +1,80 @@
1
+ 'use client';
2
+ import React from 'react';
3
+
4
+ function _extends() {
5
+ _extends = Object.assign ? Object.assign.bind() : function (target) {
6
+ for (var i = 1; i < arguments.length; i++) {
7
+ var source = arguments[i];
8
+ for (var key in source) {
9
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
10
+ target[key] = source[key];
11
+ }
12
+ }
13
+ }
14
+ return target;
15
+ };
16
+ return _extends.apply(this, arguments);
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
+ }
45
+
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] : '';
49
+ // applies a custom root class the user provides, else applies the default rad-ui classes to the component
50
+ // rad ui's classes are based on this logic
51
+
52
+ // add dashes between capitalized words
53
+ var componentClassName = componentName.replace(/([a-z0-9])([A-Z])/g, '$1-$2').toLowerCase();
54
+ if (customRootClass) return customRootClass;
55
+ if (componentName) return "".concat(RAD_UI_CLASS_PREFIX, "-").concat(componentClassName);
56
+ return '';
57
+ };
58
+
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);
71
+ if (color) {
72
+ props['data-accent-color'] = color;
73
+ }
74
+ return /*#__PURE__*/React.createElement("span", _extends({
75
+ className: "".concat(rootClass, " ").concat(className)
76
+ }, props), children);
77
+ };
78
+ Badge.displayName = COMPONENT_NAME;
79
+
80
+ export { Badge as default };
@@ -0,0 +1,75 @@
1
+ 'use client';
2
+ import React from 'react';
3
+
4
+ function _extends() {
5
+ _extends = Object.assign ? Object.assign.bind() : function (target) {
6
+ for (var i = 1; i < arguments.length; i++) {
7
+ var source = arguments[i];
8
+ for (var key in source) {
9
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
10
+ target[key] = source[key];
11
+ }
12
+ }
13
+ }
14
+ return target;
15
+ };
16
+ return _extends.apply(this, arguments);
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
+ }
45
+
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] : '';
49
+ // applies a custom root class the user provides, else applies the default rad-ui classes to the component
50
+ // rad ui's classes are based on this logic
51
+
52
+ // add dashes between capitalized words
53
+ var componentClassName = componentName.replace(/([a-z0-9])([A-Z])/g, '$1-$2').toLowerCase();
54
+ if (customRootClass) return customRootClass;
55
+ if (componentName) return "".concat(RAD_UI_CLASS_PREFIX, "-").concat(componentClassName);
56
+ return '';
57
+ };
58
+
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);
69
+ return /*#__PURE__*/React.createElement("blockquote", _extends({
70
+ className: "".concat(rootClass, " ").concat(className)
71
+ }, props), children);
72
+ };
73
+ BlockQuote.displayName = COMPONENT_NAME;
74
+
75
+ export { BlockQuote as default };
@@ -0,0 +1,69 @@
1
+ 'use client';
2
+ import React from 'react';
3
+
4
+ function _extends() {
5
+ _extends = Object.assign ? Object.assign.bind() : function (target) {
6
+ for (var i = 1; i < arguments.length; i++) {
7
+ var source = arguments[i];
8
+ for (var key in source) {
9
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
10
+ target[key] = source[key];
11
+ }
12
+ }
13
+ }
14
+ return target;
15
+ };
16
+ return _extends.apply(this, arguments);
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
+ }
45
+
46
+ var _excluded = ["children", "type", "color", "className", "variant"];
47
+ // make the color prop default accent color
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);
58
+ // apply data attribute for accent color
59
+ // apply attribute only if color is present
60
+ if (color) {
61
+ props['data-accent-color'] = color;
62
+ }
63
+ return /*#__PURE__*/React.createElement("button", _extends({
64
+ type: "button",
65
+ className: "rad-ui-button button-".concat(variant, " ").concat(className)
66
+ }, props), children);
67
+ };
68
+
69
+ export { Button as default };
@@ -13,22 +13,50 @@ function _extends() {
13
13
  };
14
14
  return _extends.apply(this, arguments);
15
15
  }
16
+ function _objectWithoutPropertiesLoose(source, excluded) {
17
+ if (source == null) return {};
18
+ var target = {};
19
+ var sourceKeys = Object.keys(source);
20
+ var key, i;
21
+ for (i = 0; i < sourceKeys.length; i++) {
22
+ key = sourceKeys[i];
23
+ if (excluded.indexOf(key) >= 0) continue;
24
+ target[key] = source[key];
25
+ }
26
+ return target;
27
+ }
28
+ function _objectWithoutProperties(source, excluded) {
29
+ if (source == null) return {};
30
+ var target = _objectWithoutPropertiesLoose(source, excluded);
31
+ var key, i;
32
+ if (Object.getOwnPropertySymbols) {
33
+ var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
34
+ for (i = 0; i < sourceSymbolKeys.length; i++) {
35
+ key = sourceSymbolKeys[i];
36
+ if (excluded.indexOf(key) >= 0) continue;
37
+ if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
38
+ target[key] = source[key];
39
+ }
40
+ }
41
+ return target;
42
+ }
16
43
 
17
- const RAD_UI_CLASS_PREFIX = 'rad-ui';
18
- const customClassSwitcher = function (customRootClass) {
19
- let componentName = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
44
+ var RAD_UI_CLASS_PREFIX = 'rad-ui';
45
+ var customClassSwitcher = function customClassSwitcher(customRootClass) {
46
+ var componentName = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
20
47
  // applies a custom root class the user provides, else applies the default rad-ui classes to the component
21
48
  // rad ui's classes are based on this logic
22
49
 
23
50
  // add dashes between capitalized words
24
- const componentClassName = componentName.replace(/([a-z0-9])([A-Z])/g, '$1-$2').toLowerCase();
51
+ var componentClassName = componentName.replace(/([a-z0-9])([A-Z])/g, '$1-$2').toLowerCase();
25
52
  if (customRootClass) return customRootClass;
26
- if (componentName) return `${RAD_UI_CLASS_PREFIX}-${componentClassName}`;
53
+ if (componentName) return "".concat(RAD_UI_CLASS_PREFIX, "-").concat(componentClassName);
27
54
  return '';
28
55
  };
29
56
 
30
- const COMPONENT_NAME = 'Callout';
31
- const InfoIcon = () => {
57
+ var _excluded = ["children", "className", "color", "customRootClass"];
58
+ var COMPONENT_NAME = 'Callout';
59
+ var InfoIcon = function InfoIcon() {
32
60
  return /*#__PURE__*/React.createElement("svg", {
33
61
  width: "18",
34
62
  height: "18",
@@ -42,15 +70,16 @@ const InfoIcon = () => {
42
70
  "clip-rule": "evenodd"
43
71
  }));
44
72
  };
45
- const Callout = _ref => {
46
- let {
47
- children,
48
- className = '',
49
- color = undefined,
50
- customRootClass = '',
51
- ...restOfTheProps
52
- } = _ref;
53
- const rootClass = customClassSwitcher(customRootClass, COMPONENT_NAME);
73
+ var Callout = function Callout(_ref) {
74
+ var children = _ref.children,
75
+ _ref$className = _ref.className,
76
+ className = _ref$className === void 0 ? '' : _ref$className,
77
+ _ref$color = _ref.color,
78
+ color = _ref$color === void 0 ? undefined : _ref$color,
79
+ _ref$customRootClass = _ref.customRootClass,
80
+ customRootClass = _ref$customRootClass === void 0 ? '' : _ref$customRootClass,
81
+ restOfTheProps = _objectWithoutProperties(_ref, _excluded);
82
+ var rootClass = customClassSwitcher(customRootClass, COMPONENT_NAME);
54
83
  if (color) {
55
84
  restOfTheProps['data-accent-color'] = color;
56
85
  }
@@ -58,7 +87,7 @@ const Callout = _ref => {
58
87
  // TODO: if children is a string then wrap it in a Text component, else return the children as is - need to add this to core logic helpers
59
88
 
60
89
  return /*#__PURE__*/React.createElement("div", _extends({
61
- className: `${rootClass} ${className}`
90
+ className: "".concat(rootClass, " ").concat(className)
62
91
  }, restOfTheProps), /*#__PURE__*/React.createElement(InfoIcon, null), " ", children);
63
92
  };
64
93
  Callout.displayName = COMPONENT_NAME;
@@ -1,10 +1,8 @@
1
1
  'use client';
2
2
  import React from 'react';
3
3
 
4
- const Code = _ref => {
5
- let {
6
- children
7
- } = _ref;
4
+ var Code = function Code(_ref) {
5
+ var children = _ref.children;
8
6
  return /*#__PURE__*/React.createElement("code", {
9
7
  className: "rui-code-root"
10
8
  }, children);