@radui/ui 0.0.1 → 0.0.3

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/dist/Em.js ADDED
@@ -0,0 +1,47 @@
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
+
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
24
+
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 '';
30
+ };
31
+
32
+ const COMPONENT_NAME = 'Em';
33
+ const Em = _ref => {
34
+ let {
35
+ children,
36
+ customRootClass = '',
37
+ className = '',
38
+ ...props
39
+ } = _ref;
40
+ const rootClass = customClassSwitcher(customRootClass, COMPONENT_NAME);
41
+ return /*#__PURE__*/React.createElement("em", _extends({
42
+ className: `${rootClass} ${className}`
43
+ }, props), children);
44
+ };
45
+ Em.displayName = COMPONENT_NAME;
46
+
47
+ export { Em as default };
@@ -0,0 +1,76 @@
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
+
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
24
+
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 '';
30
+ };
31
+
32
+ const RENDER_AS_ENUMS = [{
33
+ label: 'H1',
34
+ tag: 'h1'
35
+ }, {
36
+ label: 'H2',
37
+ tag: 'h2'
38
+ }, {
39
+ label: 'H3',
40
+ tag: 'h3'
41
+ }, {
42
+ label: 'H4',
43
+ tag: 'h4'
44
+ }, {
45
+ label: 'H5',
46
+ tag: 'h5'
47
+ }, {
48
+ label: 'H6',
49
+ tag: 'h6'
50
+ }];
51
+ const Heading = function (_ref) {
52
+ let {
53
+ children,
54
+ as = undefined,
55
+ customRootClass = '',
56
+ className = ''
57
+ } = _ref;
58
+ const rootClass = customClassSwitcher(customRootClass, as || 'h1');
59
+ for (var _len = arguments.length, props = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
60
+ props[_key - 1] = arguments[_key];
61
+ }
62
+ if (as !== undefined && RENDER_AS_ENUMS.find(item => item.tag === as)) {
63
+ const {
64
+ tag: Tag
65
+ } = RENDER_AS_ENUMS.find(item => item.tag === as);
66
+ return /*#__PURE__*/React.createElement(Tag, _extends({
67
+ className: `${rootClass} ${className}`
68
+ }, props), children);
69
+ }
70
+ return /*#__PURE__*/React.createElement("h1", _extends({
71
+ className: `${rootClass} ${className}`
72
+ }, props), children);
73
+ };
74
+ Heading.displayName = 'Heading';
75
+
76
+ export { Heading as default };
package/dist/Kbd.js ADDED
@@ -0,0 +1,46 @@
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
+
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
24
+
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 '';
30
+ };
31
+
32
+ const COMPONENT_NAME = 'Kbd';
33
+ const Kbd = _ref => {
34
+ let {
35
+ children,
36
+ customRootClass = '',
37
+ className = '',
38
+ ...rest
39
+ } = _ref;
40
+ const rootClass = customClassSwitcher(customRootClass, COMPONENT_NAME);
41
+ return /*#__PURE__*/React.createElement("kbd", _extends({
42
+ className: `${rootClass} ${className}`
43
+ }, rest), children);
44
+ };
45
+
46
+ export { Kbd as default };
package/dist/Link.js ADDED
@@ -0,0 +1,51 @@
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
+
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
24
+
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 '';
30
+ };
31
+
32
+ const COMPONENT_NAME = 'Link';
33
+ const Link = _ref => {
34
+ let {
35
+ children,
36
+ href = '#',
37
+ alt = '',
38
+ customRootClass = '',
39
+ className = '',
40
+ ...props
41
+ } = _ref;
42
+ const rootClass = customClassSwitcher(customRootClass, COMPONENT_NAME);
43
+ return /*#__PURE__*/React.createElement("a", _extends({
44
+ href: href,
45
+ alt: alt,
46
+ className: `${rootClass} ${className}`
47
+ }, props), children);
48
+ };
49
+ Link.displayName = COMPONENT_NAME;
50
+
51
+ export { Link as default };
package/dist/Quote.js ADDED
@@ -0,0 +1,47 @@
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
+
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
24
+
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 '';
30
+ };
31
+
32
+ const COMPONENT_NAME = 'Quote';
33
+ const Quote = _ref => {
34
+ let {
35
+ children,
36
+ customRootClass = '',
37
+ className = '',
38
+ ...props
39
+ } = _ref;
40
+ const rootClass = customClassSwitcher(customRootClass, COMPONENT_NAME);
41
+ return /*#__PURE__*/React.createElement("q", _extends({
42
+ className: `${rootClass} ${className}`
43
+ }, props), children);
44
+ };
45
+ Quote.displayName = COMPONENT_NAME;
46
+
47
+ export { Quote as default };
@@ -0,0 +1,32 @@
1
+ 'use client';
2
+ import React from 'react';
3
+
4
+ const RAD_UI_CLASS_PREFIX = 'rad-ui';
5
+ const customClassSwitcher = function (customRootClass) {
6
+ let componentName = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
7
+ // applies a custom root class the user provides, else applies the default rad-ui classes to the component
8
+ // rad ui's classes are based on this logic
9
+
10
+ // add dashes between capitalized words
11
+ const componentClassName = componentName.replace(/([a-z0-9])([A-Z])/g, '$1-$2').toLowerCase();
12
+ if (customRootClass) return customRootClass;
13
+ if (componentName) return `${RAD_UI_CLASS_PREFIX}-${componentClassName}`;
14
+ return '';
15
+ };
16
+
17
+ const COMPONENT_NAME = 'Separator';
18
+ const Separator = _ref => {
19
+ let {
20
+ orientation = 'horizontal',
21
+ className = '',
22
+ customRootClass = ''
23
+ } = _ref;
24
+ const rootClass = customClassSwitcher(customRootClass, COMPONENT_NAME);
25
+ const orientationClass = orientation === 'vertical' ? `${rootClass}-vertical` : `${rootClass}-horizontal`;
26
+ return /*#__PURE__*/React.createElement("div", {
27
+ className: `${rootClass} ${orientationClass} ${className}`
28
+ });
29
+ };
30
+ Separator.displayName = COMPONENT_NAME;
31
+
32
+ export { Separator as default };
package/dist/Strong.js ADDED
@@ -0,0 +1,9 @@
1
+ 'use client';
2
+ const Strong = _ref => {
3
+ let {
4
+ children
5
+ } = _ref;
6
+ return /*#__PURE__*/React.createElement("strong", null, children);
7
+ };
8
+
9
+ export { Strong as default };
package/dist/Tabs.js ADDED
@@ -0,0 +1,146 @@
1
+ 'use client';
2
+ import React, { useState } from 'react';
3
+
4
+ const RAD_UI_CLASS_PREFIX = 'rad-ui';
5
+ const customClassSwitcher = function (customRootClass) {
6
+ let componentName = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
7
+ // applies a custom root class the user provides, else applies the default rad-ui classes to the component
8
+ // rad ui's classes are based on this logic
9
+
10
+ // add dashes between capitalized words
11
+ const componentClassName = componentName.replace(/([a-z0-9])([A-Z])/g, '$1-$2').toLowerCase();
12
+ if (customRootClass) return customRootClass;
13
+ if (componentName) return `${RAD_UI_CLASS_PREFIX}-${componentClassName}`;
14
+ return '';
15
+ };
16
+
17
+ function _extends() {
18
+ _extends = Object.assign ? Object.assign.bind() : function (target) {
19
+ for (var i = 1; i < arguments.length; i++) {
20
+ var source = arguments[i];
21
+ for (var key in source) {
22
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
23
+ target[key] = source[key];
24
+ }
25
+ }
26
+ }
27
+ return target;
28
+ };
29
+ return _extends.apply(this, arguments);
30
+ }
31
+
32
+ const COMPONENT_NAME$3 = 'TabTrigger';
33
+ const TabTrigger = _ref => {
34
+ let {
35
+ tab,
36
+ setActiveTab,
37
+ activeTab,
38
+ className = '',
39
+ customRootClass,
40
+ ...props
41
+ } = _ref;
42
+ const rootClass = customClassSwitcher(customRootClass, COMPONENT_NAME$3);
43
+ const isActive = activeTab === tab.value;
44
+ const handleClick = tab => {
45
+ setActiveTab(tab.value);
46
+ };
47
+ return /*#__PURE__*/React.createElement("button", _extends({
48
+ role: "tab",
49
+ className: `${rootClass} ${isActive ? 'active' : ''} ${className}`
50
+ }, props, {
51
+ onClick: () => handleClick(tab)
52
+ }), /*#__PURE__*/React.createElement("span", {
53
+ className: `${rootClass}-inner`
54
+ }, tab.label));
55
+ };
56
+ TabTrigger.displayName = 'TabTrigger';
57
+
58
+ const COMPONENT_NAME$2 = 'TabList';
59
+ const TabList = _ref => {
60
+ let {
61
+ tabs = [],
62
+ className = '',
63
+ setActiveTab,
64
+ activeTab,
65
+ customRootClass = ''
66
+ } = _ref;
67
+ const rootClass = customClassSwitcher(customRootClass, COMPONENT_NAME$2);
68
+ return /*#__PURE__*/React.createElement("div", {
69
+ role: "tablist",
70
+ "aria-orientation": "horizontal",
71
+ "aria-label": "todo",
72
+ className: `${rootClass} ${className}`
73
+ }, tabs.map((tab, index) => {
74
+ return /*#__PURE__*/React.createElement(TabTrigger, {
75
+ activeTab: activeTab,
76
+ setActiveTab: setActiveTab,
77
+ key: index,
78
+ tab: tab,
79
+ index: index
80
+ });
81
+ }));
82
+ };
83
+ TabList.displayName = COMPONENT_NAME$2;
84
+
85
+ const COMPONENT_NAME$1 = 'TabContent';
86
+ const TabContent = _ref => {
87
+ let {
88
+ tabs = [],
89
+ activeTab,
90
+ className = '',
91
+ customRootClass = ''
92
+ } = _ref;
93
+ const rootClass = customClassSwitcher(customRootClass, COMPONENT_NAME$1);
94
+ return /*#__PURE__*/React.createElement("div", {
95
+ className: `${rootClass} ${className}`
96
+ }, tabs.map((tab, index) => {
97
+ if (tab.value === activeTab) {
98
+ return /*#__PURE__*/React.createElement("div", {
99
+ key: index
100
+ }, tab.content);
101
+ }
102
+ return null;
103
+ }));
104
+ };
105
+ TabContent.displayName = COMPONENT_NAME$1;
106
+
107
+ const COMPONENT_NAME = 'TabRoot';
108
+ const TabRoot = _ref => {
109
+ let {
110
+ children,
111
+ customRootClass = '',
112
+ className = '',
113
+ color = undefined,
114
+ ...props
115
+ } = _ref;
116
+ const rootClass = customClassSwitcher(customRootClass, COMPONENT_NAME);
117
+ if (color) {
118
+ props['data-accent-color'] = color;
119
+ }
120
+ return /*#__PURE__*/React.createElement("div", _extends({
121
+ className: `${rootClass} ${className}`
122
+ }, props), children);
123
+ };
124
+ TabRoot.displayName = COMPONENT_NAME;
125
+
126
+ const Tabs = _ref => {
127
+ let {
128
+ tabs = [],
129
+ ...props
130
+ } = _ref;
131
+ // This should be a value <`tabs.value`> that is passed in from the parent component
132
+ const [activeTab, setActiveTab] = useState(tabs[0].value || '');
133
+ return /*#__PURE__*/React.createElement(TabRoot, props, /*#__PURE__*/React.createElement(TabList, {
134
+ activeTab: activeTab,
135
+ setActiveTab: setActiveTab,
136
+ tabs: tabs
137
+ }), /*#__PURE__*/React.createElement(TabContent, {
138
+ activeTab: activeTab,
139
+ tabs: tabs
140
+ }));
141
+ };
142
+ Tabs.List = TabList;
143
+ Tabs.Content = TabContent;
144
+ Tabs.Root = TabRoot;
145
+
146
+ export { Tabs as default };
package/dist/Text.js ADDED
@@ -0,0 +1,51 @@
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
+
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
24
+
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 '';
30
+ };
31
+
32
+ // Can be rendered as p, label, div, span, etc.
33
+ // TODO: Add as prop support
34
+ // TODO: Add a core reusable function to check and render an as prop
35
+
36
+ const COMPONENT_NAME = 'Text';
37
+ const Text = _ref => {
38
+ let {
39
+ children,
40
+ customRootClass = '',
41
+ className = '',
42
+ ...props
43
+ } = _ref;
44
+ const rootClass = customClassSwitcher(customRootClass, COMPONENT_NAME);
45
+ return /*#__PURE__*/React.createElement("p", _extends({
46
+ className: `${rootClass} ${className}`
47
+ }, props), children);
48
+ };
49
+ Text.displayName = COMPONENT_NAME;
50
+
51
+ export { Text as default };
@@ -0,0 +1,8 @@
1
+ 'use client';
2
+ import React from 'react';
3
+
4
+ const TextArea = _ref => {
5
+ return /*#__PURE__*/React.createElement("textarea", null);
6
+ };
7
+
8
+ export { TextArea as default };