bianic-ui 1.2.0-beta → 1.3.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.
@@ -4,6 +4,7 @@ interface ContextualButtonProps extends ComponentPropsWithoutRef<'button'> {
4
4
  variant?: 'dark' | 'light' | undefined;
5
5
  icon?: React.ReactNode;
6
6
  isNotified?: boolean;
7
+ isSelected?: boolean;
7
8
  }
8
- declare const ContextualButton: ({ label, icon, variant, disabled, isNotified, ...props }: ContextualButtonProps) => React.JSX.Element;
9
+ declare const ContextualButton: ({ label, icon, variant, disabled, isNotified, isSelected, ...props }: ContextualButtonProps) => React.JSX.Element;
9
10
  export default ContextualButton;
@@ -2,3 +2,7 @@ export declare const textColorConfig: {
2
2
  dark: string;
3
3
  light: string;
4
4
  };
5
+ export declare const stateColorConfig: {
6
+ selected: string;
7
+ default: string;
8
+ };
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+ interface TextAreaSimulationProps {
3
+ size?: 'md' | 'sm';
4
+ }
5
+ declare function TextAreaSimulation({ size }: TextAreaSimulationProps): React.JSX.Element;
6
+ declare namespace TextAreaSimulation {
7
+ var defaultProps: {
8
+ size: string;
9
+ };
10
+ }
11
+ export default TextAreaSimulation;
@@ -8,8 +8,10 @@ export interface TextAreaProps extends ComponentPropsWithoutRef<'textarea'> {
8
8
  placeholder?: string;
9
9
  required?: boolean;
10
10
  rows?: number;
11
+ maxLength?: number;
12
+ value?: string;
11
13
  }
12
- declare function TextArea({ descText, disabled, id, size, label, placeholder, required, rows, ...props }: TextAreaProps): React.JSX.Element;
14
+ declare function TextArea({ descText, disabled, id, size, label, placeholder, required, rows, maxLength, value, ...props }: TextAreaProps): React.JSX.Element;
13
15
  declare namespace TextArea {
14
16
  var defaultProps: {
15
17
  disabled: boolean;
@@ -20,6 +22,8 @@ declare namespace TextArea {
20
22
  placeholder: string;
21
23
  required: boolean;
22
24
  rows: number;
25
+ maxLength: undefined;
26
+ value: string;
23
27
  };
24
28
  }
25
29
  export default TextArea;
@@ -12,8 +12,9 @@ interface TextInputProps extends Omit<ComponentPropsWithoutRef<'input'>, 'size'>
12
12
  variant?: 'password' | 'text' | 'number' | 'date';
13
13
  value?: string;
14
14
  onChange?: (event: ChangeEvent<HTMLInputElement>) => void;
15
+ maxLength?: number;
15
16
  }
16
- declare function TextInput({ descText, disabled, icon, id, size, isValid, label, placeholder, readOnly, required, variant, value, onChange, ...props }: TextInputProps): React.JSX.Element;
17
+ declare function TextInput({ descText, disabled, icon, id, size, isValid, label, placeholder, readOnly, required, variant, value, onChange, maxLength, ...props }: TextInputProps): React.JSX.Element;
17
18
  declare namespace TextInput {
18
19
  var defaultProps: {
19
20
  descText: string;
@@ -1,5 +1,5 @@
1
1
  import type { StoryObj } from '@storybook/react';
2
- import { TextArea } from '../../components';
2
+ import { TextArea } from '../../../components';
3
3
  declare const meta: {
4
4
  title: string;
5
5
  component: typeof TextArea;
@@ -0,0 +1,14 @@
1
+ import type { StoryObj } from '@storybook/react';
2
+ import TextAreaSimulation from '../../../components/Forms/TextArea/Simulation';
3
+ declare const meta: {
4
+ title: string;
5
+ component: typeof TextAreaSimulation;
6
+ parameters: {
7
+ layout: string;
8
+ };
9
+ tags: string[];
10
+ args: {};
11
+ };
12
+ export default meta;
13
+ type Story = StoryObj<typeof meta>;
14
+ export declare const Simulation: Story;
package/dist/esm/index.js CHANGED
@@ -1548,13 +1548,14 @@ function PasswordIcon(_a) {
1548
1548
  }
1549
1549
 
1550
1550
  function TextInput(_a) {
1551
- var descText = _a.descText, _b = _a.disabled, disabled = _b === void 0 ? false : _b, icon = _a.icon, _c = _a.id, id = _c === void 0 ? '' : _c, _d = _a.size, size = _d === void 0 ? 'md' : _d, _e = _a.isValid, isValid = _e === void 0 ? false : _e, label = _a.label, _f = _a.placeholder, placeholder = _f === void 0 ? '' : _f, _g = _a.readOnly, readOnly = _g === void 0 ? false : _g, _h = _a.required, required = _h === void 0 ? false : _h, _j = _a.variant, variant = _j === void 0 ? 'text' : _j, _k = _a.value, value = _k === void 0 ? '' : _k, _l = _a.onChange, onChange = _l === void 0 ? function () { } : _l, props = __rest(_a, ["descText", "disabled", "icon", "id", "size", "isValid", "label", "placeholder", "readOnly", "required", "variant", "value", "onChange"]);
1552
- var _m = useState(false), isShow = _m[0], setIsShow = _m[1];
1553
- var _o = styleConfig[variant], fieldStyle = _o.fieldStyle, iconStyle = _o.iconStyle;
1554
- var _p = sizeConfig$a[size], iconSize = _p.iconSize, fieldSize = _p.fieldSize, iconPosition = _p.iconPosition;
1551
+ var descText = _a.descText, _b = _a.disabled, disabled = _b === void 0 ? false : _b, icon = _a.icon, _c = _a.id, id = _c === void 0 ? '' : _c, _d = _a.size, size = _d === void 0 ? 'md' : _d, _e = _a.isValid, isValid = _e === void 0 ? false : _e, label = _a.label, _f = _a.placeholder, placeholder = _f === void 0 ? '' : _f, _g = _a.readOnly, readOnly = _g === void 0 ? false : _g, _h = _a.required, required = _h === void 0 ? false : _h, _j = _a.variant, variant = _j === void 0 ? 'text' : _j, _k = _a.value, value = _k === void 0 ? '' : _k, _l = _a.onChange, onChange = _l === void 0 ? function () { } : _l, _m = _a.maxLength, maxLength = _m === void 0 ? undefined : _m, props = __rest(_a, ["descText", "disabled", "icon", "id", "size", "isValid", "label", "placeholder", "readOnly", "required", "variant", "value", "onChange", "maxLength"]);
1552
+ var _o = useState(false), isShow = _o[0], setIsShow = _o[1];
1553
+ var _p = styleConfig[variant], fieldStyle = _p.fieldStyle, iconStyle = _p.iconStyle;
1554
+ var _q = sizeConfig$a[size], iconSize = _q.iconSize, fieldSize = _q.fieldSize, iconPosition = _q.iconPosition;
1555
1555
  var typeVariant = variant;
1556
1556
  if (variant === 'password')
1557
1557
  typeVariant = isShow ? 'text' : 'password';
1558
+ var remainWords = maxLength ? maxLength - (value ? value.length : 0) : 0;
1558
1559
  var isExistValidation = isValid !== null;
1559
1560
  var descColor = 'text-primary-cool';
1560
1561
  if (!disabled && isExistValidation && isValid)
@@ -1579,9 +1580,15 @@ function TextInput(_a) {
1579
1580
  label,
1580
1581
  required && React.createElement("span", { className: "p-1 text-bia-red" }, "*")),
1581
1582
  React.createElement("div", { className: "relative w-full" },
1582
- React.createElement("input", __assign({ className: "field w-full rounded border border-bia-grey-dark-10 bg-primary-white read-only:pointer-events-none read-only:border-bia-grey-light-50 hover:rounded-b-none 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(fieldStyle, " ").concat(fieldSize, " ").concat(bottomBorderColor), disabled: disabled, id: id, placeholder: placeholder || label, readOnly: readOnly, required: required, type: typeVariant, value: value, onChange: function (e) { return onChange(e); } }, props)),
1583
+ React.createElement("input", __assign({ className: "field w-full rounded border border-bia-grey-dark-10 bg-primary-white read-only:pointer-events-none read-only:border-bia-grey-light-50 hover:rounded-b-none 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(fieldStyle, " ").concat(fieldSize, " ").concat(bottomBorderColor), disabled: disabled, id: id, placeholder: placeholder || label, readOnly: readOnly, required: required, type: typeVariant, value: value, onChange: function (e) { return onChange(e); }, maxLength: maxLength }, props)),
1583
1584
  React.createElement("div", { className: "absolute inset-y-0 flex items-center pl-3 ".concat(iconStyle, " ").concat(iconPosition) }, iconElement)),
1584
- descText && (React.createElement("span", { className: "desc text-xs ".concat(descColor) }, descText))));
1585
+ React.createElement("div", { className: "desc flex justify-between gap-1 text-xs ".concat(descColor) },
1586
+ descText && React.createElement("span", null, descText),
1587
+ maxLength && (React.createElement("span", null,
1588
+ remainWords,
1589
+ "/",
1590
+ maxLength,
1591
+ ' ')))));
1585
1592
  }
1586
1593
  TextInput.defaultProps = {
1587
1594
  descText: '',
@@ -1640,16 +1647,23 @@ var sizeConfig$8 = {
1640
1647
  };
1641
1648
 
1642
1649
  function TextArea(_a) {
1643
- var descText = _a.descText, _b = _a.disabled, disabled = _b === void 0 ? false : _b, id = _a.id, _c = _a.size, size = _c === void 0 ? 'md' : _c, label = _a.label, _d = _a.placeholder, placeholder = _d === void 0 ? '' : _d, required = _a.required, rows = _a.rows, props = __rest(_a, ["descText", "disabled", "id", "size", "label", "placeholder", "required", "rows"]);
1650
+ var descText = _a.descText, _b = _a.disabled, disabled = _b === void 0 ? false : _b, id = _a.id, _c = _a.size, size = _c === void 0 ? 'md' : _c, label = _a.label, _d = _a.placeholder, placeholder = _d === void 0 ? '' : _d, required = _a.required, rows = _a.rows, _e = _a.maxLength, maxLength = _e === void 0 ? undefined : _e, value = _a.value, props = __rest(_a, ["descText", "disabled", "id", "size", "label", "placeholder", "required", "rows", "maxLength", "value"]);
1644
1651
  var inputRow = rows !== null && rows !== void 0 ? rows : 4;
1645
1652
  var inputClass = sizeConfig$8[size].inputClass;
1646
- return (React.createElement("div", { className: "field-group w-full flex flex-col" },
1647
- React.createElement("label", { htmlFor: id, className: "label text-xs pb-2 font-semibold" },
1653
+ var remainWords = maxLength ? maxLength - (value ? value.length : 0) : 0;
1654
+ return (React.createElement("div", { className: "field-group flex w-full flex-col" },
1655
+ React.createElement("label", { htmlFor: id, className: "label pb-2 text-xs font-semibold" },
1648
1656
  label,
1649
1657
  required && React.createElement("span", { className: "p-1 text-bia-red" }, "*")),
1650
- React.createElement("div", { className: "min-w-[250px] w-full h-full" },
1651
- React.createElement("textarea", __assign({ className: "field bg-primary-white disabled:bg-bia-grey-light-80 disabled:text-bia-grey-active read-only:pointe r-events-none p-2.5 w-full border border-bia-grey-dark-10 enabled:hover:border-b-bia-blue enabled:hover:rounded-b-none enabled:focus:border-b-bia-blue enabled:focus:rounded-b-none focus-visible:outline-none rounded ".concat(inputClass), rows: inputRow, id: id, placeholder: placeholder, disabled: disabled }, props))),
1652
- React.createElement("span", { className: "desc text-primary-cool text-xs" }, descText)));
1658
+ React.createElement("div", { className: "h-full w-full min-w-[250px]" },
1659
+ React.createElement("textarea", __assign({ className: "field read-only:pointe r-events-none w-full rounded border border-bia-grey-dark-10 bg-primary-white p-2.5 focus-visible:outline-none enabled:hover:rounded-b-none enabled:hover:border-b-bia-blue enabled:focus:rounded-b-none enabled:focus:border-b-bia-blue disabled:bg-bia-grey-light-80 disabled:text-bia-grey-active ".concat(inputClass), rows: inputRow, id: id, placeholder: placeholder, disabled: disabled, maxLength: maxLength, value: value }, props))),
1660
+ React.createElement("div", { className: "desc flex justify-between gap-1 text-xs text-primary-cool" },
1661
+ descText && React.createElement("span", null, descText),
1662
+ maxLength && (React.createElement("span", null,
1663
+ remainWords,
1664
+ "/",
1665
+ maxLength,
1666
+ ' ')))));
1653
1667
  }
1654
1668
  TextArea.defaultProps = {
1655
1669
  disabled: false,
@@ -1660,6 +1674,8 @@ TextArea.defaultProps = {
1660
1674
  placeholder: 'Write here ...',
1661
1675
  required: false,
1662
1676
  rows: 4,
1677
+ maxLength: undefined,
1678
+ value: '',
1663
1679
  };
1664
1680
 
1665
1681
  var sizeConfig$7 = {
@@ -1917,16 +1933,16 @@ var roundedConfig = {
1917
1933
  tn: 'first:rounded-l-radius-tn last:rounded-r-radius-tn',
1918
1934
  };
1919
1935
  var sizeConfig$2 = {
1920
- lg: 'text-size-md leading-[23.94px] px-[13px] py-[10.5px]',
1921
- md: 'text-size-base leading-[21px] px-[11px] py-[9px]',
1922
- sm: 'text-size-sm leading-[15.96px] px-[7px] py-[5px]',
1923
- tn: 'text-size-sm leading-[15.96px] px-[4px] py-[2px]',
1936
+ lg: 'text-size-md leading-[23.94px] px-[13px] py-[10.5px] min-w-[112px]',
1937
+ md: 'text-size-base leading-[21px] px-[11px] py-[9px] min-w-[96px]',
1938
+ sm: 'text-size-sm leading-[15.96px] px-[7px] py-[5px] min-w-[72px]',
1939
+ tn: 'text-size-sm leading-[15.96px] px-[4px] py-[2px] min-w-[64px]',
1924
1940
  };
1925
1941
 
1926
1942
  function SegmentButtonItem(_a) {
1927
1943
  var _b = _a.selected, selected = _b === void 0 ? false : _b, size = _a.size, children = _a.children, disabled = _a.disabled, onClick = _a.onClick;
1928
1944
  var isSelected = selected ? 'selected' : 'notSelected';
1929
- return (React.createElement("button", { type: "button", onClick: onClick, disabled: disabled, className: "focus-visible:z-50 focus-visible:outline focus-visible:-outline-offset-1 focus-visible:outline-[3px] focus-visible:outline-bia-blue-light-50 border-[1px] border-l-0 first:border-l-[1px] border-bia-grey-dark-10 group:last:border-l-0 disabled:bg-bia-grey-light-80 disabled:text-bia-grey-dark-10 disabled:cursor-not-allowed ".concat(isSelectedConfig[isSelected], " ").concat(roundedConfig[size], " ").concat(sizeConfig$2[size]) }, children));
1945
+ return (React.createElement("button", { type: "button", onClick: onClick, disabled: disabled, className: "group:last:border-l-0 border-[1px] border-l-0 border-bia-grey-dark-10 first:border-l-[1px] focus-visible:z-50 focus-visible:outline focus-visible:outline-[3px] focus-visible:-outline-offset-1 focus-visible:outline-bia-blue-light-50 disabled:cursor-not-allowed disabled:bg-bia-grey-light-80 disabled:text-bia-grey-dark-10 ".concat(isSelectedConfig[isSelected], " ").concat(roundedConfig[size], " ").concat(sizeConfig$2[size]) }, children));
1930
1946
  }
1931
1947
 
1932
1948
  function SegmentButtonGroup(_a) {
@@ -2271,7 +2287,7 @@ function Tab(_a) {
2271
2287
  React.createElement("button", __assign({ type: "button", disabled: disabled }, rest, { className: "-mb-[1px] flex items-stretch justify-between ".concat(card && cardColor, " ").concat(mode === 'horizontal' ? 'flex-col' : 'w-full flex-row', " group relative outline-none ").concat(disabledKeyTab, " ").concat(fit) }),
2272
2288
  React.createElement("div", { className: "flex items-center justify-center ".concat(size === 'sm' ? " pt-[10px] ".concat(mode === 'vertical' ? 'pb-[10px] pe-[30px]' : 'px-[30px] pb-[8px]') : "px-[30px] pt-[13px] ".concat(mode === 'vertical' ? 'pb-[13px]' : 'pb-[10px]', " ")) },
2273
2289
  React.createElement("div", { className: "flex items-center justify-center " },
2274
- React.createElement("div", { className: "flex space-x-1 text-nowrap ".concat(activeKeyTab, " ").concat(configTab[size].text) },
2290
+ React.createElement("div", { className: "flex items-center space-x-1 text-nowrap ".concat(activeKeyTab, " ").concat(configTab[size].text) },
2275
2291
  icon && React.createElement("div", { className: "mr-[5px]" }, icon),
2276
2292
  children))),
2277
2293
  React.createElement("div", { className: "flex flex-row ".concat(mode === 'vertical' ? 'w-[3px] justify-end' : 'h-[3px] w-full', " items-end") }, !card && (React.createElement("div", { className: "shadow-lg shadow-bia-blue ".concat(configTab[active ? 'true' : 'false'][mode]) }))))));