bianic-ui 2.5.1-beta.1 → 2.6.0-beta.1

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 CHANGED
@@ -1,49 +1,49 @@
1
- # Bianic 2.0
2
-
3
- DLS designed by BIAENERGI
4
-
5
- ## Installation
6
-
7
- ### First Installation
8
-
9
- `npm i bianic-ui`
10
-
11
- ## Usage
12
-
13
- After Bianic-Ui succesfully installed, you can call the component using JSX tag declaration style ex: `<Alert />`. Futher documentation about component can be access [here](https://ristek.link/bianic-dev-docs)
14
-
15
- ## Support
16
-
17
- If you found any bug, please contact at [devbiaenergi@gmail.com](mailto:devbiaenergi@gmail.com)
18
-
19
- ## Contributing
20
-
21
- If you're interested in contributing to Bianic-Ui, please contact our team at [devbiaenergi@gmail.com](mailto:devbiaenergi@gmail.com)
22
-
23
- ## Change Log
24
-
25
- Coming soon
26
-
27
- ## Development Notes
28
-
29
- ### Code Convention
30
-
31
- - Always separate style with tsx
32
- - For style config always try to be object with one level
33
- - Separate config file and component file for more readable code
34
- - The variable name of style config must be describe what you styling not describe the parameters (or key)
35
- - Use .tsx only when defining component, just us .ts if no component defined on the file
36
- - Don't import simulation or any demo to index.ts
37
- - Update storybook for every change or new component
38
-
39
- ### Component attribute naming
40
-
41
- - Check on html documentation. Always try to use the exisiting html atribute name.
42
- - If there the attibute not listed on html documentation. You can make it on your own with rules :
43
- - Use "is" prefix for boolean
44
- - Use "on" prefix for event listener
45
-
46
- ### Another Notes
47
-
48
- - Please assign class `...-primary-black` when need black color. If not assigned system will use #000000 black.
49
- - Just discuss any concept you had. **Discuss first, Implement later**.
1
+ # Bianic 2.0
2
+
3
+ DLS designed by BIAENERGI
4
+
5
+ ## Installation
6
+
7
+ ### First Installation
8
+
9
+ `npm i bianic-ui`
10
+
11
+ ## Usage
12
+
13
+ After Bianic-Ui succesfully installed, you can call the component using JSX tag declaration style ex: `<Alert />`. Futher documentation about component can be access [here](https://ristek.link/bianic-dev-docs)
14
+
15
+ ## Support
16
+
17
+ If you found any bug, please contact at [devbiaenergi@gmail.com](mailto:devbiaenergi@gmail.com)
18
+
19
+ ## Contributing
20
+
21
+ If you're interested in contributing to Bianic-Ui, please contact our team at [devbiaenergi@gmail.com](mailto:devbiaenergi@gmail.com)
22
+
23
+ ## Change Log
24
+
25
+ Coming soon
26
+
27
+ ## Development Notes
28
+
29
+ ### Code Convention
30
+
31
+ - Always separate style with tsx
32
+ - For style config always try to be object with one level
33
+ - Separate config file and component file for more readable code
34
+ - The variable name of style config must be describe what you styling not describe the parameters (or key)
35
+ - Use .tsx only when defining component, just us .ts if no component defined on the file
36
+ - Don't import simulation or any demo to index.ts
37
+ - Update storybook for every change or new component
38
+
39
+ ### Component attribute naming
40
+
41
+ - Check on html documentation. Always try to use the exisiting html atribute name.
42
+ - If there the attibute not listed on html documentation. You can make it on your own with rules :
43
+ - Use "is" prefix for boolean
44
+ - Use "on" prefix for event listener
45
+
46
+ ### Another Notes
47
+
48
+ - Please assign class `...-primary-black` when need black color. If not assigned system will use #000000 black.
49
+ - Just discuss any concept you had. **Discuss first, Implement later**.
package/dist/cjs/index.js CHANGED
@@ -583,7 +583,8 @@ var AvatarConfig = {
583
583
  };
584
584
 
585
585
  function Avatar(_a) {
586
- var _b = _a.size, size = _b === void 0 ? 'md' : _b, variant = _a.variant, _c = _a.name, name = _c === void 0 ? 'Test' : _c;
586
+ var _b, _c, _d, _e;
587
+ var _f = _a.size, size = _f === void 0 ? 'md' : _f, _g = _a.variant, variant = _g === void 0 ? 'initial' : _g, _h = _a.name, name = _h === void 0 ? 'Test' : _h, className = _a.className;
587
588
  var getInitials = function (initial) {
588
589
  if (!initial)
589
590
  return '';
@@ -593,17 +594,19 @@ function Avatar(_a) {
593
594
  .join('');
594
595
  return initials.slice(0, 2).toUpperCase();
595
596
  };
597
+ var usedSize = size in AvatarConfig ? size : 'md';
598
+ var usedVariant = variant in ['image', 'picture', 'initial'] ? variant : 'initial';
596
599
  var avatarResult = null;
597
- switch (variant) {
600
+ switch (usedVariant) {
598
601
  case 'picture':
599
- avatarResult = (React.createElement("img", { src: "https://img.freepik.com/free-psd/girl-avatar-emoji-3d-icon_23-2150579870.jpg", alt: "avatar", className: "".concat(AvatarConfig[size].picture) }));
602
+ avatarResult = (React.createElement("img", { src: "https://img.freepik.com/free-psd/girl-avatar-emoji-3d-icon_23-2150579870.jpg", alt: "avatar", className: "".concat((_b = AvatarConfig[usedSize]) === null || _b === void 0 ? void 0 : _b.picture, " ").concat(className) }));
600
603
  break;
601
604
  case 'initial':
602
- avatarResult = (React.createElement("div", { className: "".concat(AvatarConfig[size].picture, " flex items-center justify-center bg-bia-sky") },
603
- React.createElement("div", { className: "".concat(AvatarConfig[size]['no picture']) }, getInitials(name))));
605
+ avatarResult = (React.createElement("div", { className: "".concat((_c = AvatarConfig[usedSize]) === null || _c === void 0 ? void 0 : _c.picture, " flex items-center justify-center bg-bia-sky ").concat(className) },
606
+ React.createElement("div", { className: "".concat((_d = AvatarConfig[usedSize]) === null || _d === void 0 ? void 0 : _d['no picture']) }, getInitials(name))));
604
607
  break;
605
608
  case 'image':
606
- avatarResult = (React.createElement("svg", { width: "160", height: "160", viewBox: "0 0 160 160", fill: "none", xmlns: "http://www.w3.org/2000/svg", xmlnsXlink: "http://www.w3.org/1999/xlink", className: "".concat(AvatarConfig[size].picture, " flex items-center justify-center") },
609
+ avatarResult = (React.createElement("svg", { width: "160", height: "160", viewBox: "0 0 160 160", fill: "none", xmlns: "http://www.w3.org/2000/svg", xmlnsXlink: "http://www.w3.org/1999/xlink", className: "".concat((_e = AvatarConfig[usedSize]) === null || _e === void 0 ? void 0 : _e.picture, " flex items-center justify-center ").concat(className) },
607
610
  React.createElement("rect", { width: "160", height: "160", fill: "url(#pattern0_9212_4625)" }),
608
611
  React.createElement("defs", null,
609
612
  React.createElement("pattern", { id: "pattern0_9212_4625", patternContentUnits: "objectBoundingBox", width: "1", height: "1" },
@@ -615,6 +618,7 @@ function Avatar(_a) {
615
618
  }
616
619
  Avatar.defaultProps = {
617
620
  name: '',
621
+ variant: 'initial',
618
622
  size: 'md',
619
623
  };
620
624
 
@@ -1532,7 +1536,7 @@ var colorConfig$2 = {
1532
1536
  var ButtonApp = function (_a) {
1533
1537
  _a.icon; _a.isNotified; var _c = _a.isActive, isActive = _c === void 0 ? false : _c, disabled = _a.disabled, _d = _a.color, color = _d === void 0 ? 'green' : _d, label = _a.label, extended = _a.extended, rest = __rest(_a, ["icon", "isNotified", "isActive", "disabled", "color", "label", "extended"]);
1534
1538
  var buttonState = isActive ? 'active' : 'default';
1535
- return (React.createElement("button", __assign({ className: "button-app flex items-center justify-center px-[10px] pb-[8.3px] pt-[8.5px] font-arial text-size-tiny ".concat(colorConfig$2[color][buttonState], " ").concat(extended), type: "button", disabled: disabled }, rest), label));
1539
+ return (React.createElement("button", __assign({ className: "button-app flex max-h-[30px] items-center justify-center px-[10px] pb-[8.3px] pt-[8.5px] font-arial text-size-tiny ".concat(colorConfig$2[color][buttonState], " ").concat(extended), type: "button", disabled: disabled }, rest), label));
1536
1540
  };
1537
1541
 
1538
1542
  var textColorConfig = {
@@ -1953,9 +1957,6 @@ var getDropdownStyle = function (anchorRef, popupRef) {
1953
1957
  return style;
1954
1958
  };
1955
1959
  var usePopupPosition = function (anchorRef, popupRef, position) {
1956
- // In projects where bianic-ui is installed,
1957
- // there is a delay in rendering styles,
1958
- // which causes popups to lose their position and need to be re-rendered.
1959
1960
  if (!anchorRef || !popupRef) {
1960
1961
  return [{}, function () { }];
1961
1962
  }
@@ -1968,18 +1969,23 @@ var usePopupPosition = function (anchorRef, popupRef, position) {
1968
1969
  setPositionStyle(newStyle);
1969
1970
  };
1970
1971
  React.useLayoutEffect(function () {
1971
- if (!(anchorRef === null || anchorRef === void 0 ? void 0 : anchorRef.current))
1972
+ if (!(anchorRef === null || anchorRef === void 0 ? void 0 : anchorRef.current) || !(popupRef === null || popupRef === void 0 ? void 0 : popupRef.current))
1972
1973
  return;
1973
1974
  calcPosition();
1974
- window.addEventListener('scroll', calcPosition);
1975
+ var resizeObserver = new ResizeObserver(calcPosition);
1976
+ resizeObserver.observe(popupRef.current);
1977
+ window.addEventListener('scroll', calcPosition, true);
1975
1978
  window.addEventListener('resize', calcPosition);
1976
- setRepeateRender(0);
1977
1979
  return function () {
1978
- window.removeEventListener('scroll', calcPosition);
1980
+ resizeObserver.disconnect();
1981
+ window.removeEventListener('scroll', calcPosition, true);
1979
1982
  window.removeEventListener('resize', calcPosition);
1980
1983
  };
1981
- }, [anchorRef]);
1984
+ }, [anchorRef, popupRef]);
1982
1985
  React.useEffect(function () {
1986
+ // In projects where bianic-ui is installed,
1987
+ // there is a delay in rendering styles,
1988
+ // which causes popups to lose their position and need to be re-rendered.
1983
1989
  if (repeateRender < 5 && (anchorRef === null || anchorRef === void 0 ? void 0 : anchorRef.current)) {
1984
1990
  calcPosition();
1985
1991
  setRepeateRender(repeateRender + 1);
@@ -3729,8 +3735,8 @@ var Notification = function (props) {
3729
3735
  };
3730
3736
 
3731
3737
  var sizeConfig$2 = {
3732
- md: 'min-w-[38px] h-[40px] text-[14px] font-semibold',
3733
- sm: 'min-w-[29px] h-[30px] text-[12px] font-normal',
3738
+ md: 'min-w-[40px] h-[40px] text-[14px] font-semibold',
3739
+ sm: 'min-w-[30px] h-[30px] text-[12px] font-normal',
3734
3740
  };
3735
3741
  var positionConfig = {
3736
3742
  start: 'justify-start',
@@ -3777,15 +3783,11 @@ function PaginationBar(_a) {
3777
3783
  else
3778
3784
  setStartIndex(0);
3779
3785
  };
3780
- var getStartIndex = function (index) {
3781
- if (index + PAGE_SIZE > totalPages)
3782
- return Math.max(0, totalPages - PAGE_SIZE);
3783
- return index;
3784
- };
3785
3786
  React.useEffect(function () {
3786
- var correctedIndex = getStartIndex(startIndex);
3787
- setShowedPages(totalRange.slice(correctedIndex, correctedIndex + PAGE_SIZE));
3788
- }, [startIndex, totalRange, totalPages]);
3787
+ var start = Math.max(0, Math.min(startIndex, totalPages - PAGE_SIZE));
3788
+ var newPages = Array.from({ length: totalPages }, function (_, i) { return i + 1; }).slice(start, start + PAGE_SIZE);
3789
+ setShowedPages(newPages);
3790
+ }, [startIndex, totalPages]);
3789
3791
  return (React.createElement("div", { className: "flex ".concat(positionConfig[position], " gap-[5px]") },
3790
3792
  totalPages > 5 && (React.createElement(Button, { variant: "subtle", size: size, type: "button", onClick: handlePrevRange, className: showedPages[0] === 1 ? '' : 'cursor-pointer', iconLeft: React.createElement(TbChevronsLeft, { size: iconSize }), disabled: showedPages[0] === 1 })),
3791
3793
  React.createElement(Button, { variant: "subtle", size: size, type: "button", onClick: function () {