bianic-ui 2.11.0 → 2.12.0-alpha.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.
Files changed (41) hide show
  1. package/README.md +49 -49
  2. package/dist/cjs/Empty.svg +12 -12
  3. package/dist/cjs/index.js +235 -28
  4. package/dist/cjs/lib.css +1 -1
  5. package/dist/cjs/types/components/Avatar/Avatar.d.ts +4 -12
  6. package/dist/cjs/types/components/Forms/DatePicker/DateInputDisplay.d.ts +1 -1
  7. package/dist/cjs/types/components/Forms/DatePicker/DatePicker.d.ts +4 -4
  8. package/dist/cjs/types/components/Forms/DatePicker/PickerCalendar/components/PickerHeader.d.ts +8 -8
  9. package/dist/cjs/types/components/Forms/DatePicker/PickerCalendar/components/YearDisplay.d.ts +1 -1
  10. package/dist/cjs/types/components/Forms/DatePicker/PickerCalendar/components/pickerYearContent.d.ts +1 -0
  11. package/dist/cjs/types/components/Forms/DatePicker/PickerCalendar/hooks/useYearLogic.d.ts +16 -0
  12. package/dist/cjs/types/components/Forms/DatePicker/PickerYear.d.ts +9 -0
  13. package/dist/cjs/types/components/Forms/DatePicker/YearPicker.d.ts +10 -0
  14. package/dist/cjs/types/components/Forms/DatePicker/YearPickerDisplay.d.ts +12 -0
  15. package/dist/cjs/types/components/Forms/DatePicker/index.d.ts +1 -0
  16. package/dist/cjs/types/components/Forms/index.d.ts +1 -1
  17. package/dist/cjs/types/components/index.d.ts +1 -1
  18. package/dist/cjs/types/stories/Avatar/Avatar.stories.d.ts +36 -1
  19. package/dist/esm/Empty.svg +12 -12
  20. package/dist/esm/index.js +236 -30
  21. package/dist/esm/lib.css +1 -1
  22. package/dist/esm/types/components/Avatar/Avatar.d.ts +4 -12
  23. package/dist/esm/types/components/Forms/DatePicker/DateInputDisplay.d.ts +1 -1
  24. package/dist/esm/types/components/Forms/DatePicker/DatePicker.d.ts +4 -4
  25. package/dist/esm/types/components/Forms/DatePicker/PickerCalendar/components/PickerHeader.d.ts +8 -8
  26. package/dist/esm/types/components/Forms/DatePicker/PickerCalendar/components/YearDisplay.d.ts +1 -1
  27. package/dist/esm/types/components/Forms/DatePicker/PickerCalendar/components/pickerYearContent.d.ts +1 -0
  28. package/dist/esm/types/components/Forms/DatePicker/PickerCalendar/hooks/useYearLogic.d.ts +16 -0
  29. package/dist/esm/types/components/Forms/DatePicker/PickerYear.d.ts +9 -0
  30. package/dist/esm/types/components/Forms/DatePicker/YearPicker.d.ts +10 -0
  31. package/dist/esm/types/components/Forms/DatePicker/YearPickerDisplay.d.ts +12 -0
  32. package/dist/esm/types/components/Forms/DatePicker/index.d.ts +1 -0
  33. package/dist/esm/types/components/Forms/index.d.ts +1 -1
  34. package/dist/esm/types/components/index.d.ts +1 -1
  35. package/dist/esm/types/stories/Avatar/Avatar.stories.d.ts +36 -1
  36. package/dist/index.d.ts +16 -15
  37. package/package.json +143 -143
  38. package/src/font/SansCode/README.txt +88 -88
  39. package/src/style/color.css +650 -650
  40. package/src/style/scrollbar.css +78 -78
  41. package/tailwind.config.js +592 -592
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**.
@@ -1,12 +1,12 @@
1
- <svg width="92" height="92" viewBox="0 0 92 92" fill="none" xmlns="http://www.w3.org/2000/svg">
2
- <path d="M32.8825 12.968C33.8187 12.0283 35.0905 11.5 36.417 11.5H66.6521C69.4074 11.5 71.641 13.7336 71.641 16.489V75.1388C71.641 77.8941 69.4074 80.1278 66.6521 80.1278H25.8327C23.0774 80.1278 20.8437 77.8875 20.8438 75.1321C20.8438 56.1849 20.8438 44.6779 20.8438 27.1159C20.8438 25.7961 21.3667 24.528 22.2982 23.593L32.8825 12.968Z" fill="#DADEEB"/>
3
- <path d="M32.8825 12.968C33.8187 12.0283 35.0905 11.5 36.417 11.5H66.6521C69.4074 11.5 71.641 13.7336 71.641 16.489V75.1388C71.641 77.8941 69.4074 80.1278 66.6521 80.1278H25.8327C23.0774 80.1278 20.8437 77.8875 20.8438 75.1321C20.8438 56.1849 20.8438 44.6779 20.8438 27.1159C20.8438 25.7961 21.3667 24.528 22.2982 23.593L32.8825 12.968Z" fill="white" fill-opacity="0.5"/>
4
- <path d="M34.3638 11.5V16.1283C34.3638 21.0391 30.3828 25.02 25.472 25.02H20.8438L34.3638 11.5Z" fill="#DADEEB"/>
5
- <rect x="28.1716" y="32.6677" width="18.7253" height="4.07072" rx="1.99559" fill="#DADEEB"/>
6
- <rect x="28.1716" y="39.9949" width="36.6365" height="4.07072" rx="1.99559" fill="#DADEEB"/>
7
- <rect x="28.1716" y="47.3223" width="36.6365" height="4.07072" rx="1.99559" fill="#DADEEB"/>
8
- <rect x="28.1716" y="54.6497" width="36.6365" height="4.07072" rx="1.99559" fill="#DADEEB"/>
9
- <rect x="28.1716" y="61.9768" width="36.6365" height="4.07072" rx="1.99559" fill="#DADEEB"/>
10
- <path d="M58.7737 63.8789C63.267 59.3856 70.5519 59.3856 75.0452 63.8789C79.5382 68.3722 79.5384 75.6572 75.0452 80.1504C70.552 84.6436 63.267 84.6434 58.7737 80.1504C54.2804 75.6571 54.2804 68.3722 58.7737 63.8789Z" stroke="#54A0F9" stroke-width="1.70457"/>
11
- <path d="M75.6475 80.1499L81.9753 86.4778" stroke="#54A0F9" stroke-width="1.70457"/>
12
- </svg>
1
+ <svg width="92" height="92" viewBox="0 0 92 92" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="M32.8825 12.968C33.8187 12.0283 35.0905 11.5 36.417 11.5H66.6521C69.4074 11.5 71.641 13.7336 71.641 16.489V75.1388C71.641 77.8941 69.4074 80.1278 66.6521 80.1278H25.8327C23.0774 80.1278 20.8437 77.8875 20.8438 75.1321C20.8438 56.1849 20.8438 44.6779 20.8438 27.1159C20.8438 25.7961 21.3667 24.528 22.2982 23.593L32.8825 12.968Z" fill="#DADEEB"/>
3
+ <path d="M32.8825 12.968C33.8187 12.0283 35.0905 11.5 36.417 11.5H66.6521C69.4074 11.5 71.641 13.7336 71.641 16.489V75.1388C71.641 77.8941 69.4074 80.1278 66.6521 80.1278H25.8327C23.0774 80.1278 20.8437 77.8875 20.8438 75.1321C20.8438 56.1849 20.8438 44.6779 20.8438 27.1159C20.8438 25.7961 21.3667 24.528 22.2982 23.593L32.8825 12.968Z" fill="white" fill-opacity="0.5"/>
4
+ <path d="M34.3638 11.5V16.1283C34.3638 21.0391 30.3828 25.02 25.472 25.02H20.8438L34.3638 11.5Z" fill="#DADEEB"/>
5
+ <rect x="28.1716" y="32.6677" width="18.7253" height="4.07072" rx="1.99559" fill="#DADEEB"/>
6
+ <rect x="28.1716" y="39.9949" width="36.6365" height="4.07072" rx="1.99559" fill="#DADEEB"/>
7
+ <rect x="28.1716" y="47.3223" width="36.6365" height="4.07072" rx="1.99559" fill="#DADEEB"/>
8
+ <rect x="28.1716" y="54.6497" width="36.6365" height="4.07072" rx="1.99559" fill="#DADEEB"/>
9
+ <rect x="28.1716" y="61.9768" width="36.6365" height="4.07072" rx="1.99559" fill="#DADEEB"/>
10
+ <path d="M58.7737 63.8789C63.267 59.3856 70.5519 59.3856 75.0452 63.8789C79.5382 68.3722 79.5384 75.6572 75.0452 80.1504C70.552 84.6436 63.267 84.6434 58.7737 80.1504C54.2804 75.6571 54.2804 68.3722 58.7737 63.8789Z" stroke="#54A0F9" stroke-width="1.70457"/>
11
+ <path d="M75.6475 80.1499L81.9753 86.4778" stroke="#54A0F9" stroke-width="1.70457"/>
12
+ </svg>
package/dist/cjs/index.js CHANGED
@@ -586,30 +586,30 @@ Button.defaultProps = {
586
586
 
587
587
  var AvatarConfig = {
588
588
  sm: {
589
- picture: 'w-[24px] h-[24px] rounded-[12px] border-[1px] ',
589
+ picture: 'w-[24px] h-[24px] min-w-[24px] min-h-[24px] rounded-[12px] border-[1px] ',
590
590
  'no picture': 'font-semibold text-[12px] leading-[15.96px] text-primary-white flex items-center',
591
591
  },
592
592
  md: {
593
- picture: 'w-[36px] h-[36px] rounded-[18px] border-[1px] ',
593
+ picture: 'w-[36px] h-[36px] min-w-[36px] min-h-[36px] rounded-[18px] border-[1px] ',
594
594
  'no picture': 'font-semibold text-[14px] leading-[18.62px] text-primary-white flex items-center',
595
595
  },
596
596
  lg: {
597
- picture: 'w-[52px] h-[52px] rounded-[26px] border-[2px]',
597
+ picture: 'w-[52px] h-[52px] min-w-[52px] min-h-[52px] rounded-[26px] border-[2px]',
598
598
  'no picture': 'font-semibold text-[24px] leading-[31.92px] text-primary-white flex items-center',
599
599
  },
600
600
  xl: {
601
- picture: 'w-[92px] h-[92px] rounded-[46px] border-[3px]',
601
+ picture: 'w-[92px] h-[92px] min-w-[92px] min-h-[92px] rounded-[46px] border-[3px]',
602
602
  'no picture': 'font-semibold text-[36px] leading-[47.88px] text-primary-white flex items-center',
603
603
  },
604
604
  xxl: {
605
- picture: 'w-[160px] h-[160px] rounded-[80px] border-[5px]',
605
+ picture: 'w-[160px] h-[160px] min-w-[160px] min-h-[160px] rounded-[80px] border-[5px]',
606
606
  'no picture': 'font-semibold text-[64px] leading-[85.13px] text-primary-white flex items-center',
607
607
  },
608
608
  };
609
609
 
610
610
  function Avatar(_a) {
611
- var _b, _c, _d, _e;
612
- 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, _j = _a.bgColor, bgColor = _j === void 0 ? 'bia-sky-dark-40' : _j, _k = _a.outlineColor, outlineColor = _k === void 0 ? 'bia-coolgrey' : _k, className = _a.className;
611
+ var _b, _c, _d, _e, _f, _g;
612
+ var _h = _a.size, size = _h === void 0 ? 'md' : _h, _j = _a.variant, variant = _j === void 0 ? 'initial' : _j, _k = _a.name, name = _k === void 0 ? 'Test' : _k, _l = _a.bgColor, bgColor = _l === void 0 ? 'bia-sky-dark-40' : _l, _m = _a.outlineColor, outlineColor = _m === void 0 ? 'bia-coolgrey' : _m, className = _a.className, imageSrc = _a.imageSrc;
613
613
  var getInitials = function (initial) {
614
614
  if (!initial)
615
615
  return '';
@@ -620,18 +620,31 @@ function Avatar(_a) {
620
620
  return initials.slice(0, 2).toUpperCase();
621
621
  };
622
622
  var usedSize = size in AvatarConfig ? size : 'md';
623
- var usedVariant = variant in ['image', 'picture', 'initial'] ? variant : 'initial';
623
+ var usedVariant = ['default', 'picture', 'initial'].includes(variant)
624
+ ? variant
625
+ : 'initial';
624
626
  var avatarResult = null;
625
627
  switch (usedVariant) {
626
628
  case 'picture':
627
- 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) }));
629
+ if (typeof imageSrc === 'string') {
630
+ avatarResult = (React.createElement("img", { src: imageSrc, alt: name, className: "".concat((_b = AvatarConfig[usedSize]) === null || _b === void 0 ? void 0 : _b.picture, " shrink-0 border-").concat(outlineColor, " bg-").concat(bgColor, " object-cover ").concat(className !== null && className !== void 0 ? className : '') }));
631
+ }
632
+ else if (React.isValidElement(imageSrc)) {
633
+ avatarResult = React.cloneElement(imageSrc, {
634
+ alt: name,
635
+ className: "".concat((_c = AvatarConfig[usedSize]) === null || _c === void 0 ? void 0 : _c.picture, " shrink-0 border-").concat(outlineColor, " bg-").concat(bgColor, " object-cover ").concat(className !== null && className !== void 0 ? className : ''),
636
+ });
637
+ }
638
+ else {
639
+ avatarResult = (React.createElement("img", { src: "https://img.freepik.com/free-psd/girl-avatar-emoji-3d-icon_23-2150579870.jpg", alt: "avatar", className: "".concat((_d = AvatarConfig[usedSize]) === null || _d === void 0 ? void 0 : _d.picture, " shrink-0 border-").concat(outlineColor, " bg-").concat(bgColor, " ").concat(className !== null && className !== void 0 ? className : '') }));
640
+ }
628
641
  break;
629
642
  case 'initial':
630
- avatarResult = (React.createElement("div", { className: "".concat((_c = AvatarConfig[usedSize]) === null || _c === void 0 ? void 0 : _c.picture, " flex items-center justify-center border-").concat(outlineColor, " bg-").concat(bgColor, " ").concat(className) },
631
- React.createElement("div", { className: "".concat((_d = AvatarConfig[usedSize]) === null || _d === void 0 ? void 0 : _d['no picture']) }, getInitials(name))));
643
+ avatarResult = (React.createElement("div", { className: "".concat((_e = AvatarConfig[usedSize]) === null || _e === void 0 ? void 0 : _e.picture, " flex h-[24px] w-[24px] items-center justify-center border-").concat(outlineColor, " bg-").concat(bgColor, " ").concat(className) },
644
+ React.createElement("div", { className: "".concat((_f = AvatarConfig[usedSize]) === null || _f === void 0 ? void 0 : _f['no picture']) }, getInitials(name))));
632
645
  break;
633
- case 'image':
634
- 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) },
646
+ case 'default':
647
+ 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((_g = AvatarConfig[usedSize]) === null || _g === void 0 ? void 0 : _g.picture, " flex items-center justify-center ").concat(className) },
635
648
  React.createElement("rect", { width: "160", height: "160", fill: "url(#pattern0_9212_4625)" }),
636
649
  React.createElement("defs", null,
637
650
  React.createElement("pattern", { id: "pattern0_9212_4625", patternContentUnits: "objectBoundingBox", width: "1", height: "1" },
@@ -641,11 +654,6 @@ function Avatar(_a) {
641
654
  }
642
655
  return avatarResult;
643
656
  }
644
- Avatar.defaultProps = {
645
- name: '',
646
- variant: 'initial',
647
- size: 'md',
648
- };
649
657
 
650
658
  var typeConfig = {
651
659
  standart: 'text-[75%] px-[7px] py-[1.5px] min-w-[26px] rounded-full',
@@ -3384,7 +3392,7 @@ var PickerHeader = function (_a) {
3384
3392
  } },
3385
3393
  React.createElement(Text, { variant: "normal-text-semibold" },
3386
3394
  MONTH_MAP[viewMonthValue],
3387
- " ")),
3395
+ ' ')),
3388
3396
  React.createElement("button", { className: pickerMode === 'date' || pickerMode === 'month' ? '' : 'hidden', onClick: function (e) {
3389
3397
  e.stopPropagation();
3390
3398
  handlePickerMode('year');
@@ -3512,7 +3520,7 @@ var useCalendarLogic = function (selectedDate, minDate, maxDate) {
3512
3520
  }
3513
3521
  else {
3514
3522
  return (yearDisplayRange.includes(maxDateValue.getFullYear()) &&
3515
- yearDisplayRange[12] >= maxDateValue.getFullYear());
3523
+ yearDisplayRange[11] >= maxDateValue.getFullYear());
3516
3524
  }
3517
3525
  };
3518
3526
  return {
@@ -3846,7 +3854,7 @@ var monthMap = [
3846
3854
  'December',
3847
3855
  ];
3848
3856
  var DateInputDisplay = React.forwardRef(function (_a, ref) {
3849
- var value = _a.value, setValue = _a.setValue, _b = _a.placeholder, placeholder = _b === void 0 ? 'YYYY-MM-DD' : _b, label = _a.label, required = _a.required, id = _a.id, _c = _a.size, size = _c === void 0 ? 'sm' : _c, className = _a.className, _d = _a.disabled, disabled = _d === void 0 ? false : _d, buttonAction = _a.buttonAction, nullDisplay = _a.nullDisplay, props = __rest(_a, ["value", "setValue", "placeholder", "label", "required", "id", "size", "className", "disabled", "buttonAction", "nullDisplay"]);
3857
+ var value = _a.value, setValue = _a.setValue, _b = _a.placeholder, placeholder = _b === void 0 ? 'YYYY-MM-DD' : _b, label = _a.label, required = _a.required, readOnly = _a.readOnly, id = _a.id, _c = _a.size, size = _c === void 0 ? 'sm' : _c, className = _a.className, _d = _a.disabled, disabled = _d === void 0 ? false : _d, buttonAction = _a.buttonAction, nullDisplay = _a.nullDisplay, props = __rest(_a, ["value", "setValue", "placeholder", "label", "required", "readOnly", "id", "size", "className", "disabled", "buttonAction", "nullDisplay"]);
3850
3858
  var inputValue = value || (value === null || value === void 0 ? void 0 : value.length) > 0
3851
3859
  ? Array.isArray(value)
3852
3860
  ? "".concat(value[0], " ").concat(value[1] ? "- ".concat(value[1]) : '')
@@ -3863,7 +3871,7 @@ var DateInputDisplay = React.forwardRef(function (_a, ref) {
3863
3871
  var _h = sizeConfig$c[size], iconSize = _h.iconSize, fieldSize = _h.fieldSize, iconPosition = _h.iconPosition;
3864
3872
  var borderStyle = 'border border-bia-grey-dark-10 bg-primary-white';
3865
3873
  var extendedInputClassName = "w-full ".concat(fieldStyle, " ").concat(fieldSize, " ").concat(borderStyle, " ").concat(className);
3866
- var labelStatus = props.readOnly ? 'read-only:pointer-events-none' : '';
3874
+ props.readOnly ? 'read-only:pointer-events-none' : '';
3867
3875
  var handleTextChange = function (event) {
3868
3876
  var rawValue = event.target.value;
3869
3877
  setDateString(rawValue); // Update the displayed text input immediately
@@ -3899,9 +3907,7 @@ var DateInputDisplay = React.forwardRef(function (_a, ref) {
3899
3907
  setDateString(inputValue !== null && inputValue !== void 0 ? inputValue : '');
3900
3908
  }, [inputValue, isEditing]);
3901
3909
  return (React.createElement("div", { className: "bianic-date-input-container bianic-fgc-container flex w-full flex-col gap-y-2 text-bia-black" },
3902
- label && (React.createElement("label", { htmlFor: id, className: "bianic-text-input-label text-xs font-semibold ".concat(labelStatus) },
3903
- label,
3904
- required && React.createElement("span", { className: "p-1 text-bia-red" }, "*"))),
3910
+ label && (React.createElement(FormLabel, { htmlFor: id, required: required, readOnly: readOnly }, label)),
3905
3911
  React.createElement("div", { className: "relative w-full", ref: ref }, input)));
3906
3912
  });
3907
3913
  var displayDateFormatter = function (date) {
@@ -3914,16 +3920,216 @@ function isDate(val) {
3914
3920
  }
3915
3921
 
3916
3922
  function DatePicker(_a) {
3917
- var _b = _a.zIndexCalendar, zIndexCalendar = _b === void 0 ? 100 : _b, value = _a.value, onChange = _a.onChange, _c = _a.variant, variant = _c === void 0 ? 'single' : _c, size = _a.size, disabled = _a.disabled, _d = _a.placeholder, placeholder = _d === void 0 ? '"YYYY-MM-DD"' : _d, label = _a.label, minDate = _a.minDate, maxDate = _a.maxDate, required = _a.required, nullDisplay = _a.nullDisplay, inputClassName = _a.inputClassName, containerClassName = _a.containerClassName;
3923
+ var _b = _a.zIndexCalendar, zIndexCalendar = _b === void 0 ? 100 : _b, value = _a.value, onChange = _a.onChange, _c = _a.variant, variant = _c === void 0 ? 'single' : _c, _d = _a.size, size = _d === void 0 ? 'sm' : _d, _e = _a.disabled, disabled = _e === void 0 ? false : _e, _f = _a.placeholder, placeholder = _f === void 0 ? '"YYYY-MM-DD"' : _f, label = _a.label, minDate = _a.minDate, maxDate = _a.maxDate, required = _a.required, nullDisplay = _a.nullDisplay, inputClassName = _a.inputClassName, containerClassName = _a.containerClassName;
3918
3924
  // State and Ref
3919
3925
  var inputRef = React.useRef(null);
3920
- var _e = React.useState(false), isPickerOpen = _e[0], setIsPickerOpen = _e[1];
3926
+ var _g = React.useState(false), isPickerOpen = _g[0], setIsPickerOpen = _g[1];
3921
3927
  return (React.createElement("div", { className: "bianic-datepicker-container relative ".concat(containerClassName) },
3922
3928
  React.createElement("div", { className: "bianic-datepicker-field-container" },
3923
- React.createElement(DateInputDisplay, { className: inputClassName, value: value, setValue: onChange, placeholder: placeholder, nullDisplay: nullDisplay, size: size, label: label, required: required, buttonAction: function () { return setIsPickerOpen(!isPickerOpen); }, ref: inputRef, disabled: disabled })),
3929
+ React.createElement(DateInputDisplay, { className: inputClassName || '', value: value, setValue: onChange, placeholder: placeholder, nullDisplay: nullDisplay, size: size, label: label, required: required, buttonAction: function () { return setIsPickerOpen(!isPickerOpen); }, ref: inputRef, disabled: disabled })),
3924
3930
  React.createElement(PickerCalendar, { zIndex: zIndexCalendar, anchorRef: inputRef, selectedDate: value, pickerVariant: variant, onDateChange: onChange, minDate: minDate, maxDate: maxDate, isOpen: isPickerOpen, onClose: function () { return setIsPickerOpen(false); } })));
3925
3931
  }
3926
3932
 
3933
+ var YearPickerDisplay = React.forwardRef(function (_a, ref) {
3934
+ var value = _a.value, setValue = _a.setValue, _b = _a.placeholder, placeholder = _b === void 0 ? 'YYYY' : _b, label = _a.label, required = _a.required, readOnly = _a.readOnly, id = _a.id, _c = _a.size, size = _c === void 0 ? 'sm' : _c, className = _a.className, _d = _a.disabled, disabled = _d === void 0 ? false : _d, buttonAction = _a.buttonAction, nullDisplay = _a.nullDisplay, minYear = _a.minYear, maxYear = _a.maxYear, customErrorMessage = _a.errorMessage, onErrorChange = _a.onErrorChange, props = __rest(_a, ["value", "setValue", "placeholder", "label", "required", "readOnly", "id", "size", "className", "disabled", "buttonAction", "nullDisplay", "minYear", "maxYear", "errorMessage", "onErrorChange"]);
3935
+ var inputRef = React.useRef(null);
3936
+ React.useImperativeHandle(ref, function () { return inputRef.current; });
3937
+ var _e = React.useState(false), isEditing = _e[0], setIsEditing = _e[1];
3938
+ var _f = React.useState(value ? value.toString() : ''), inputValue = _f[0], setInputValue = _f[1];
3939
+ var _g = React.useState(null), internalError = _g[0], setInternalError = _g[1];
3940
+ // Sync input string when value changes externally
3941
+ React.useEffect(function () {
3942
+ setInputValue(value ? value.toString() : '');
3943
+ if (value) {
3944
+ validateValue(value);
3945
+ }
3946
+ else {
3947
+ setError(null);
3948
+ }
3949
+ }, [value, minYear, maxYear]);
3950
+ var setError = function (msg) {
3951
+ setInternalError(msg);
3952
+ onErrorChange === null || onErrorChange === void 0 ? void 0 : onErrorChange(msg);
3953
+ };
3954
+ var validateValue = function (year) {
3955
+ if (minYear != null && year < minYear) {
3956
+ return "Year cannot be earlier than ".concat(minYear);
3957
+ }
3958
+ if (maxYear != null && year > maxYear) {
3959
+ return "Year cannot be later than ".concat(maxYear);
3960
+ }
3961
+ return null;
3962
+ };
3963
+ var handleChange = function (e) {
3964
+ var rawValue = e.target.value;
3965
+ var cleanValue = rawValue.replace(/\D/g, '').slice(0, 4);
3966
+ setInputValue(cleanValue);
3967
+ // 1. Cleared input state
3968
+ if (cleanValue === '') {
3969
+ setValue(null);
3970
+ setError(null);
3971
+ return;
3972
+ }
3973
+ // 2. Typing progress validation (before 4 digits)
3974
+ if (cleanValue.length < 4) {
3975
+ setError(null);
3976
+ return;
3977
+ }
3978
+ // 3. Full 4-digit processing
3979
+ if (cleanValue.length === 4) {
3980
+ var yearNum = Number(cleanValue);
3981
+ var error = validateValue(yearNum);
3982
+ if (error) {
3983
+ setError(error);
3984
+ }
3985
+ else {
3986
+ setError(null);
3987
+ setValue(yearNum);
3988
+ }
3989
+ }
3990
+ };
3991
+ var handleBlur = function () {
3992
+ setIsEditing(false);
3993
+ // Case A: User left field incomplete (< 4 digits)
3994
+ if (inputValue.length > 0 && inputValue.length < 4) {
3995
+ if (value) {
3996
+ setInputValue(value.toString());
3997
+ setError(null);
3998
+ }
3999
+ else {
4000
+ setInputValue('');
4001
+ setValue(null);
4002
+ setError(null);
4003
+ }
4004
+ return;
4005
+ }
4006
+ // Case B: User typed 4 digits but out of bounds
4007
+ if (inputValue.length === 4) {
4008
+ var yearNum = Number(inputValue);
4009
+ var error = validateValue(yearNum);
4010
+ if (error) {
4011
+ // Revert back to the last valid parent value on blur
4012
+ setInputValue(value ? value.toString() : '');
4013
+ setError(null);
4014
+ }
4015
+ }
4016
+ };
4017
+ var _h = sizeConfig$c[size], iconSize = _h.iconSize, fieldSize = _h.fieldSize, iconPosition = _h.iconPosition;
4018
+ var fieldStyle = styleConfig['text'].fieldStyle;
4019
+ var displayError = customErrorMessage || internalError;
4020
+ var borderStyle = displayError
4021
+ ? 'border border-bia-red bg-primary-white'
4022
+ : 'border border-bia-grey-dark-10 bg-primary-white';
4023
+ var extendedInputClassName = "w-full ".concat(fieldStyle, " ").concat(fieldSize, " ").concat(borderStyle, " ").concat(className);
4024
+ props.readOnly ? 'read-only:pointer-events-none' : '';
4025
+ var input = isEditing || disabled ? (React.createElement(TextInput, __assign({ type: "text", id: id, value: inputValue, placeholder: placeholder, size: size, inputClassName: extendedInputClassName, onChange: handleChange, onBlur: handleBlur, autoFocus: true, required: required, disabled: disabled, actionElement: React.createElement("button", { type: "button", className: "bianic-datepicker-toggle-button text-bia-coolgrey disabled:cursor-not-allowed", disabled: disabled, onClick: function () {
4026
+ buttonAction && buttonAction();
4027
+ } },
4028
+ React.createElement(TbCalendar, { size: iconSize })) }, props))) : (React.createElement(React.Fragment, null,
4029
+ React.createElement("div", { role: "button", tabIndex: disabled ? -1 : 0, onClick: function () { return !disabled && setIsEditing(true); }, onKeyDown: function (e) {
4030
+ if (e.key === 'Enter' || e.key === ' ') {
4031
+ e.preventDefault();
4032
+ !disabled && setIsEditing(true);
4033
+ }
4034
+ }, className: "bianic-text-input bianic-fgc-target flex w-full items-center rounded hover:rounded-b-none hover:border-b-bia-blue focus:rounded-b-none focus-visible:outline-none disabled:border-bia-grey-dark-10 disabled:bg-bia-grey-light-80 disabled:text-bia-grey-active ".concat(extendedInputClassName, " ").concat(value || nullDisplay ? 'text-bia-black' : 'text-bia-coolgrey', " ").concat(disabled ? 'cursor-not-allowed opacity-60' : 'cursor-text') }, value || nullDisplay || placeholder),
4035
+ React.createElement("div", { className: "absolute inset-y-0 right-0 flex items-center pl-3 text-bia-coolgrey ".concat(iconPosition) },
4036
+ React.createElement("button", { type: "button", className: "bianic-datepicker-toggle-button", disabled: disabled, onClick: function () { return buttonAction && buttonAction(); } },
4037
+ React.createElement(TbCalendar, { size: iconSize })))));
4038
+ return (React.createElement("div", { className: "bianic-year-input-container bianic-fgc-container flex w-full flex-col gap-y-1 text-bia-black" },
4039
+ label && (React.createElement(FormLabel, { htmlFor: id, required: required, readOnly: readOnly }, label)),
4040
+ React.createElement("div", { className: "relative w-full", ref: inputRef }, input),
4041
+ displayError && (React.createElement("span", { className: "text-xs text-bia-red" }, displayError))));
4042
+ });
4043
+ YearPickerDisplay.displayName = 'YearPickerDisplay';
4044
+
4045
+ var useYearLogic = function (selectYear, minYear, maxYear) {
4046
+ var _a = React.useState(selectYear !== null && selectYear !== void 0 ? selectYear : new Date(TODAY_VALUE).getFullYear()), viewYearValue = _a[0], setViewYearValue = _a[1];
4047
+ var _b = React.useState(selectYear !== null && selectYear !== void 0 ? selectYear : new Date(TODAY_VALUE).getFullYear()), viewDecadeValue = _b[0], setViewDecadeValue = _b[1];
4048
+ var minYearValue = minYear ? Number(minYear) : null;
4049
+ var maxYearValue = maxYear ? Number(maxYear) : null;
4050
+ var handlePrevYear = function () {
4051
+ setViewYearValue(function (prev) { return prev - 1; });
4052
+ };
4053
+ var handleNextYear = function () {
4054
+ setViewYearValue(function (prev) { return prev + 1; });
4055
+ };
4056
+ var handlePrevDecade = function () {
4057
+ setViewDecadeValue(function (prev) { return prev - 10; });
4058
+ };
4059
+ var handleNextDecade = function () {
4060
+ setViewDecadeValue(function (prev) { return prev + 10; });
4061
+ };
4062
+ var getDecadeRange = function (year) {
4063
+ var startOfDecade = Math.floor(year / 10) * 10;
4064
+ var endOfDecade = startOfDecade + 9;
4065
+ var decadeRange = [];
4066
+ for (var i = startOfDecade - 1; i < endOfDecade + 2; i++) {
4067
+ decadeRange.push(i);
4068
+ }
4069
+ return decadeRange;
4070
+ };
4071
+ var yearDisplayRange = getDecadeRange(viewDecadeValue);
4072
+ var isPrevDisabled = function () {
4073
+ if (!minYearValue)
4074
+ return false;
4075
+ return (yearDisplayRange.includes(minYearValue) &&
4076
+ yearDisplayRange[0] <= minYearValue);
4077
+ };
4078
+ var isNextDisabled = function () {
4079
+ if (!maxYearValue)
4080
+ return false;
4081
+ return (yearDisplayRange.includes(maxYearValue) &&
4082
+ yearDisplayRange[11] >= maxYearValue);
4083
+ };
4084
+ return {
4085
+ viewYearValue: viewYearValue,
4086
+ setViewYearValue: setViewYearValue,
4087
+ viewDecadeValue: viewDecadeValue,
4088
+ setViewDecadeValue: setViewDecadeValue,
4089
+ minYearValue: minYearValue,
4090
+ maxYearValue: maxYearValue,
4091
+ handlePrevYear: handlePrevYear,
4092
+ handleNextYear: handleNextYear,
4093
+ handlePrevDecade: handlePrevDecade,
4094
+ handleNextDecade: handleNextDecade,
4095
+ getDecadeRange: getDecadeRange,
4096
+ yearDisplayRange: yearDisplayRange,
4097
+ isPrevDisabled: isPrevDisabled,
4098
+ isNextDisabled: isNextDisabled,
4099
+ };
4100
+ };
4101
+
4102
+ var PickerYear = function (_a) {
4103
+ var selectedYear = _a.selectedYear, setSelectedYear = _a.setSelectedYear, minYear = _a.minYear, maxYear = _a.maxYear, anchorRef = _a.anchorRef, zIndex = _a.zIndex, _b = _a.isOpen, isOpen = _b === void 0 ? false : _b, _c = _a.onClose, onClose = _c === void 0 ? function () { } : _c, props = __rest(_a, ["selectedYear", "setSelectedYear", "minYear", "maxYear", "anchorRef", "zIndex", "isOpen", "onClose"]);
4104
+ var _d = useYearLogic(selectedYear, minYear, maxYear), viewYearValue = _d.viewYearValue, yearDisplayRange = _d.yearDisplayRange, isNextDisabled = _d.isNextDisabled, isPrevDisabled = _d.isPrevDisabled, handleNextDecade = _d.handleNextDecade, handleNextYear = _d.handleNextYear, handlePrevDecade = _d.handlePrevDecade, handlePrevYear = _d.handlePrevYear;
4105
+ var pickerCalendarRef = React.useRef(null);
4106
+ var _e = useDetectOutsideClick(anchorRef, false, pickerCalendarRef), isPickerOpen = _e[0], setIsPickerOpen = _e[1];
4107
+ var style = props.style, className = props.className, restProps = __rest(props, ["style", "className"]);
4108
+ var positionStyle = usePopupPosition(anchorRef, pickerCalendarRef)[0];
4109
+ var substituteMaxDate = maxYear ? new Date(maxYear, 0, 1) : null;
4110
+ var substituteMinDate = minYear ? new Date(minYear, 0, 1) : null;
4111
+ React.useEffect(function () {
4112
+ setIsPickerOpen(isOpen);
4113
+ }, [isOpen]);
4114
+ return reactDom.createPortal(React.createElement("div", __assign({ className: "bianic-datepicker-calendar absolute rounded-b-radius-sm bg-bia-white px-1.5 pb-[17px] pt-[15px] text-bia-black shadow-md ".concat(className), ref: pickerCalendarRef, style: __assign(__assign({ zIndex: zIndex, display: isPickerOpen ? 'flex' : 'none' }, positionStyle), style) }, restProps),
4115
+ React.createElement("div", { className: "picker-body flex w-[250px] flex-col gap-[15px]" },
4116
+ React.createElement(PickerHeader, { pickerMode: 'year', handlePickerMode: function () { }, viewYearValue: viewYearValue, yearDisplayRange: yearDisplayRange, isPrevDisabled: isPrevDisabled, isNextDisabled: isNextDisabled, handlePrevYear: handlePrevYear, handlePrevDecade: handlePrevDecade, handleNextYear: handleNextYear, handleNextDecade: handleNextDecade, viewMonthValue: 0 }),
4117
+ React.createElement(YearDisplay, { maxDateValue: substituteMaxDate, minDateValue: substituteMinDate, onYearSelect: function (y) {
4118
+ setSelectedYear(y);
4119
+ onClose();
4120
+ }, viewYearValue: selectedYear, yearDisplayRange: yearDisplayRange }))), document.body);
4121
+ };
4122
+
4123
+ var YearPicker = function (_a) {
4124
+ var value = _a.value, onChange = _a.onChange, _b = _a.zIndexCalendar, zIndexCalendar = _b === void 0 ? 100 : _b, minYear = _a.minYear, maxYear = _a.maxYear, _c = _a.size, size = _c === void 0 ? 'md' : _c, disabled = _a.disabled, _d = _a.placeholder, placeholder = _d === void 0 ? '"YYYY-MM-DD"' : _d, label = _a.label, required = _a.required, nullDisplay = _a.nullDisplay, inputClassName = _a.inputClassName, containerClassName = _a.containerClassName;
4125
+ var inputRef = React.useRef(null);
4126
+ var _e = React.useState(false), isPickerOpen = _e[0], setIsPickerOpen = _e[1];
4127
+ return (React.createElement("div", { className: "bianic-yearpicker-container relative ".concat(containerClassName) },
4128
+ React.createElement("div", { className: "bianic-yearpicker-field-container" },
4129
+ React.createElement(YearPickerDisplay, { className: inputClassName || '', value: value, setValue: onChange, placeholder: placeholder, nullDisplay: nullDisplay, size: size, label: label, required: required, buttonAction: function () { return setIsPickerOpen(!isPickerOpen); }, ref: inputRef, disabled: disabled, minYear: minYear, maxYear: maxYear })),
4130
+ React.createElement(PickerYear, { maxYear: maxYear, minYear: minYear, zIndex: zIndexCalendar, anchorRef: inputRef, selectedYear: value, setSelectedYear: onChange, isOpen: isPickerOpen, onClose: function () { return setIsPickerOpen(false); } })));
4131
+ };
4132
+
3927
4133
  var AlertRoundedSquare = function (_a) {
3928
4134
  var className = _a.className, _b = _a.fill, fill = _b === void 0 ? 'currentColor' : _b, _c = _a.size, size = _c === void 0 ? 20 : _c;
3929
4135
  return (React.createElement("svg", { className: className, width: size, height: size, viewBox: "0 0 24 24", fill: fill, xmlns: "http://www.w3.org/2000/svg" },
@@ -5630,6 +5836,7 @@ exports.Tooltip = Tooltip;
5630
5836
  exports.TreeItem = TreeItem;
5631
5837
  exports.VerticalStepper = StepperItem;
5632
5838
  exports.Window = Window;
5839
+ exports.YearPicker = YearPicker;
5633
5840
  exports.getRelativeTime = getRelativeTime;
5634
5841
  exports.useFileTree = useFileTree;
5635
5842
  exports.useTableDataHandler = useTableDataHandler;