@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/package.json CHANGED
@@ -1,21 +1,27 @@
1
1
  {
2
2
  "name": "@radui/ui",
3
- "version": "0.0.3",
3
+ "version": "0.0.5",
4
4
  "description": "",
5
5
  "main": "dist",
6
6
  "type": "module",
7
+ "exports": {
8
+ "./Avatar": "./dist/components/Avatar.js"
9
+ },
7
10
  "scripts": {
8
- "test": "echo \"Error: no test specified\" && exit 1",
11
+ "test": "jest",
12
+ "coverage": "jest --coverage",
9
13
  "clean": "rimraf dist",
14
+ "chromatic": "chromatic --exit-zero-on-changes",
10
15
  "sb": "storybook dev -p 6006",
11
16
  "patch": "npm version patch",
12
17
  "storybook": "storybook dev -p 6006",
13
18
  "build-storybook": "storybook build",
14
- "build-css": "parcel build styles/themes/default.scss --out-dir dist/themes/main.css",
15
- "build": "npm run clean && npm run build-css && rollup -c",
19
+ "build-css": "parcel build styles/themes/default.scss --out-dir dist/themes/",
20
+ "build": "npm run test && npm run clean && npm run build-css && rollup -c",
16
21
  "generate-tokens": "node ./scripts/tokenGen",
17
- "publish": "npm publish --access public",
18
- "lint": "eslint --ext .js,.jsx,.ts,.tsx . --fix"
22
+ "publish": "npm run build && npm publish --access public",
23
+ "lint": "eslint --ext .js,.jsx,.ts,.tsx . --fix",
24
+ "update-rad": "npm update @radui/ui"
19
25
  },
20
26
  "repository": {
21
27
  "type": "git",
@@ -27,11 +33,15 @@
27
33
  "author": "Pranay Kothapalli",
28
34
  "license": "ISC",
29
35
  "devDependencies": {
36
+ "@babel/eslint-parser": "^7.23.3",
30
37
  "@babel/preset-env": "^7.22.15",
31
38
  "@babel/preset-react": "^7.22.15",
39
+ "@babel/preset-typescript": "^7.23.3",
40
+ "@radui/ui": "^0.0.4",
32
41
  "@rollup/plugin-babel": "^6.0.3",
33
42
  "@rollup/plugin-node-resolve": "^15.2.3",
34
43
  "@rollup/plugin-terser": "^0.4.4",
44
+ "@rollup/plugin-typescript": "^11.1.5",
35
45
  "@storybook/addon-essentials": "^7.4.0",
36
46
  "@storybook/addon-interactions": "^7.4.0",
37
47
  "@storybook/addon-links": "^7.4.0",
@@ -41,20 +51,26 @@
41
51
  "@storybook/react": "^7.4.0",
42
52
  "@storybook/react-webpack5": "^7.4.0",
43
53
  "@storybook/testing-library": "^0.2.0",
54
+ "@testing-library/jest-dom": "^6.1.5",
55
+ "@testing-library/react": "^14.1.2",
44
56
  "@typescript-eslint/eslint-plugin": "^6.9.0",
45
57
  "autoprefixer": "^10.4.15",
46
58
  "babel-plugin-module-resolver": "^5.0.0",
47
59
  "eslint": "^8.52.0",
48
60
  "eslint-config-google": "^0.14.0",
49
61
  "eslint-config-standard": "^17.1.0",
50
- "eslint-config-standard-with-typescript": "^39.1.1",
62
+ "eslint-config-standard-with-typescript": "^43.0.0",
51
63
  "eslint-plugin-import": "^2.29.0",
52
64
  "eslint-plugin-n": "^16.2.0",
53
65
  "eslint-plugin-promise": "^6.1.1",
54
66
  "eslint-plugin-react": "^7.33.2",
55
67
  "eslint-plugin-react-hooks": "^4.6.0",
56
68
  "husky": "^8.0.3",
69
+ "install": "^0.13.0",
70
+ "jest": "^29.7.0",
71
+ "jest-environment-jsdom": "^29.7.0",
57
72
  "node-sass": "^9.0.0",
73
+ "npm": "^10.2.5",
58
74
  "parcel-bundler": "^1.12.5",
59
75
  "postcss": "^8.4.29",
60
76
  "prop-types": "^15.8.1",
@@ -67,11 +83,10 @@
67
83
  "sass-loader": "^13.3.2",
68
84
  "storybook": "^7.4.0",
69
85
  "tailwindcss": "^3.3.3",
70
- "typescript": "^5.2.2"
86
+ "typescript": "^5.3.3"
71
87
  },
72
88
  "dependencies": {
73
89
  "@floating-ui/react": "^0.26.2",
74
- "@radui/ui": "^0.0.2",
75
90
  "react": "^18.2.0",
76
91
  "react-dom": "^18.2.0"
77
92
  },
package/dist/Accordion.js DELETED
@@ -1,26 +0,0 @@
1
- 'use client';
2
- import React, { useState } from 'react';
3
-
4
- const Accordion = _ref => {
5
- let {
6
- items
7
- } = _ref;
8
- const [activeIndex, setActiveIndex] = useState(null);
9
- const handleClick = index => {
10
- setActiveIndex(activeIndex === index ? null : index);
11
- };
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)))));
24
- };
25
-
26
- export { Accordion as default };
package/dist/Avatar.js DELETED
@@ -1,67 +0,0 @@
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 = '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);
41
- };
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({
60
- src: src,
61
- alt: alt,
62
- className: `${rootClass} ${className}`
63
- }, rest)));
64
- };
65
- Avatar.displayName = COMPONENT_NAME;
66
-
67
- export { Avatar as default };
package/dist/Badge.js DELETED
@@ -1,51 +0,0 @@
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 = '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);
42
- if (color) {
43
- props['data-accent-color'] = color;
44
- }
45
- return /*#__PURE__*/React.createElement("span", _extends({
46
- className: `${rootClass} ${className}`
47
- }, props), children);
48
- };
49
- Badge.displayName = COMPONENT_NAME;
50
-
51
- export { Badge as default };
@@ -1,47 +0,0 @@
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 = 'BlockQuote';
33
- const BlockQuote = _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("blockquote", _extends({
42
- className: `${rootClass} ${className}`
43
- }, props), children);
44
- };
45
- BlockQuote.displayName = COMPONENT_NAME;
46
-
47
- export { BlockQuote as default };
package/dist/Button.js DELETED
@@ -1,40 +0,0 @@
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
- // 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;
29
- // apply data attribute for accent color
30
- // apply attribute only if color is present
31
- if (color) {
32
- props['data-accent-color'] = color;
33
- }
34
- return /*#__PURE__*/React.createElement("button", _extends({
35
- type: "button",
36
- className: `rad-ui-button button-${variant} ${className}`
37
- }, props), children);
38
- };
39
-
40
- export { Button as default };
package/dist/Em.js DELETED
@@ -1,47 +0,0 @@
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 };
package/dist/Kbd.js DELETED
@@ -1,46 +0,0 @@
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 DELETED
@@ -1,51 +0,0 @@
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 DELETED
@@ -1,47 +0,0 @@
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 };
package/dist/Separator.js DELETED
@@ -1,32 +0,0 @@
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 };