@radui/ui 0.0.5 → 0.0.6

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.
@@ -1,6 +1,5 @@
1
1
  'use client';
2
2
  import React, { useState, useEffect } from 'react';
3
- import { customClassSwitcher } from '@/core';
4
3
 
5
4
  function _extends() {
6
5
  _extends = Object.assign ? Object.assign.bind() : function (target) {
@@ -44,6 +43,19 @@ function _objectWithoutProperties(source, excluded) {
44
43
  return target;
45
44
  }
46
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
+
47
59
  var Root = function (_a) {
48
60
  var children = _a.children, _b = _a.customRootClass, customRootClass = _b === void 0 ? '' : _b;
49
61
  var rootClass = customClassSwitcher(customRootClass, 'Avatar');