fis-component 0.1.24 → 0.1.25

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,7 +1,7 @@
1
1
  import { ComponentPropsWithoutRef, JSX } from "react";
2
2
  export type InputTypeSuffix = "icon" | "suffix" | "dropdown";
3
3
  export type InputTypePrefix = "prefix" | "dropdown";
4
- export type InputSize = "md" | "lg";
4
+ export type InputSize = "xs" | "sm" | "md" | "lg";
5
5
  export interface InputFieldProps extends Omit<ComponentPropsWithoutRef<"input">, "onClick"> {
6
6
  /**Control the size of the component*/
7
7
  sizeInput?: InputSize;
package/dist/esm/index.js CHANGED
@@ -65269,6 +65269,52 @@ const InputSC$2 = styled.input `
65269
65269
  border-radius: 0;
65270
65270
  }
65271
65271
 
65272
+ /* xs/sm dùng chung corner-radius với md nên chỉ cần override height,
65273
+ typography và sub-spacing. */
65274
+ &.input-text-xs {
65275
+ height: calc(
65276
+ ${getTheme("com/input/field/size-xs/height")} - 2 *
65277
+ ${getTheme("com/input/field/stroke-width")}
65278
+ );
65279
+ ${getTheme("Paragraph/XS")}
65280
+ padding-right: calc(
65281
+ ${getTheme("com/input/field/size-xs/label/sub-spacing")} +
65282
+ ${getTheme("com/input/field/right-padding")}
65283
+ );
65284
+ padding-left: calc(
65285
+ ${getTheme("com/input/field/size-xs/label/sub-spacing")} +
65286
+ ${getTheme("com/input/field/left-padding")}
65287
+ );
65288
+
65289
+ &.prefix,
65290
+ &.suffix {
65291
+ padding-right: ${getTheme("com/input/field/size-xs/label/sub-spacing")};
65292
+ padding-left: ${getTheme("com/input/field/size-xs/label/sub-spacing")};
65293
+ }
65294
+ }
65295
+
65296
+ &.input-text-sm {
65297
+ height: calc(
65298
+ ${getTheme("com/input/field/size-sm/height")} - 2 *
65299
+ ${getTheme("com/input/field/stroke-width")}
65300
+ );
65301
+ ${getTheme("Paragraph/XS")}
65302
+ padding-right: calc(
65303
+ ${getTheme("com/input/field/size-sm/label/sub-spacing")} +
65304
+ ${getTheme("com/input/field/right-padding")}
65305
+ );
65306
+ padding-left: calc(
65307
+ ${getTheme("com/input/field/size-sm/label/sub-spacing")} +
65308
+ ${getTheme("com/input/field/left-padding")}
65309
+ );
65310
+
65311
+ &.prefix,
65312
+ &.suffix {
65313
+ padding-right: ${getTheme("com/input/field/size-sm/label/sub-spacing")};
65314
+ padding-left: ${getTheme("com/input/field/size-sm/label/sub-spacing")};
65315
+ }
65316
+ }
65317
+
65272
65318
  &.input-text-lg {
65273
65319
  height: calc(
65274
65320
  ${getTheme("com/input/field/size-lg/height")} - 2 *
@@ -65330,8 +65376,38 @@ const DivIconSC$2 = styled.div `
65330
65376
  margin-left: ${getTheme("com/input/field/size-md/icon/left-padding")};
65331
65377
  color: ${getTheme("com/input/field/default/icon/color-icon/default")};
65332
65378
 
65379
+ svg {
65380
+ width: ${getTheme("com/input/field/size-md/icon/size-icon")};
65381
+ height: ${getTheme("com/input/field/size-md/icon/size-icon")};
65382
+ }
65383
+
65384
+ /* xs/sm không có token icon/left-padding, dùng label/sub-spacing (cùng 4px
65385
+ như token icon/left-padding của select ở hai size này). */
65386
+ &.input-text-xs {
65387
+ margin-left: ${getTheme("com/input/field/size-xs/label/sub-spacing")};
65388
+
65389
+ svg {
65390
+ width: ${getTheme("com/input/field/size-xs/icon/size-icon")};
65391
+ height: ${getTheme("com/input/field/size-xs/icon/size-icon")};
65392
+ }
65393
+ }
65394
+
65395
+ &.input-text-sm {
65396
+ margin-left: ${getTheme("com/input/field/size-sm/label/sub-spacing")};
65397
+
65398
+ svg {
65399
+ width: ${getTheme("com/input/field/size-sm/icon/size-icon")};
65400
+ height: ${getTheme("com/input/field/size-sm/icon/size-icon")};
65401
+ }
65402
+ }
65403
+
65333
65404
  &.input-text-lg {
65334
65405
  margin-left: ${getTheme("com/input/field/size-lg/icon/left-padding")};
65406
+
65407
+ svg {
65408
+ width: ${getTheme("com/input/field/size-lg/icon/size-icon")};
65409
+ height: ${getTheme("com/input/field/size-lg/icon/size-icon")};
65410
+ }
65335
65411
  }
65336
65412
  `;
65337
65413
  const DivIconSuffixSC$1 = styled.div `
@@ -65374,7 +65450,7 @@ const DivDropdownSuffixSC = styled.div `
65374
65450
  );
65375
65451
  padding-right: ${getTheme("com/input/dropdown/horizontal-padding")};
65376
65452
  border-left: ${getTheme("com/input/dropdown/divider/stroke-width")} solid
65377
- ${getTheme("com/input/suffix/divider/color-stroke")};
65453
+ ${getTheme("com/input/dropdown/divider/color-stroke")};
65378
65454
  border-top-right-radius: ${getTheme("com/input/field/size-md/corner-radius")};
65379
65455
  border-bottom-right-radius: ${getTheme("com/input/field/size-md/corner-radius")};
65380
65456
  background-color: ${getTheme("com/input/dropdown/background/default")};
@@ -65442,7 +65518,7 @@ const DivDropdownPreFixSC = styled.div `
65442
65518
  );
65443
65519
  padding-right: ${getTheme("com/input/dropdown/horizontal-padding")};
65444
65520
  border-right: ${getTheme("com/input/dropdown/divider/stroke-width")} solid
65445
- ${getTheme("com/input/suffix/divider/color-stroke")};
65521
+ ${getTheme("com/input/dropdown/divider/color-stroke")};
65446
65522
  border-top-left-radius: ${getTheme("com/input/field/size-md/corner-radius")};
65447
65523
  border-bottom-left-radius: ${getTheme("com/input/field/size-md/corner-radius")};
65448
65524
  background-color: ${getTheme("com/input/dropdown/background/default")};
@@ -65591,6 +65667,19 @@ const DivContainerSC$6 = styled.div `
65591
65667
  color: ${getTheme("com/input/character-limit/label/over-limit/color-text")};
65592
65668
  }
65593
65669
 
65670
+ /* xs/sm dùng chung corner-radius với md nên chỉ cần override height. */
65671
+ &.input-text-xs {
65672
+ height: ${getTheme("com/input/field/size-xs/height")};
65673
+ min-height: ${getTheme("com/input/field/size-xs/height")};
65674
+ max-height: ${getTheme("com/input/field/size-xs/height")};
65675
+ }
65676
+
65677
+ &.input-text-sm {
65678
+ height: ${getTheme("com/input/field/size-sm/height")};
65679
+ min-height: ${getTheme("com/input/field/size-sm/height")};
65680
+ max-height: ${getTheme("com/input/field/size-sm/height")};
65681
+ }
65682
+
65594
65683
  &.input-text-lg {
65595
65684
  height: ${getTheme("com/input/field/size-lg/height")};
65596
65685
  min-height: ${getTheme("com/input/field/size-lg/height")};
@@ -65741,6 +65830,8 @@ const DivContainerSC$6 = styled.div `
65741
65830
  const FISInputField = forwardRef(({ onClickSuffix, onClickPrefix, ...props }, ref) => {
65742
65831
  const { sizeInput = "md", iconPrefix, iconSuffix, labelSuffix, labelPrefix, typeSuffix, typePrefix, disabled, negative, activeDropdown, ...rest } = props;
65743
65832
  return (jsxs(DivContainerSC$6, { className: classNames({
65833
+ "input-text-xs": sizeInput === "xs",
65834
+ "input-text-sm": sizeInput === "sm",
65744
65835
  "input-text-lg": sizeInput === "lg",
65745
65836
  negative: negative,
65746
65837
  dropdownSuffix: typeSuffix === "dropdown",
@@ -65751,6 +65842,8 @@ const FISInputField = forwardRef(({ onClickSuffix, onClickPrefix, ...props }, re
65751
65842
  iconSuffix: typeSuffix === "icon",
65752
65843
  disabled: disabled,
65753
65844
  }), children: [iconPrefix && typePrefix !== "prefix" && typePrefix !== "dropdown" && (jsx(DivIconSC$2, { className: classNames({
65845
+ "input-text-xs": sizeInput === "xs",
65846
+ "input-text-sm": sizeInput === "sm",
65754
65847
  "input-text-lg": sizeInput === "lg",
65755
65848
  }), children: iconPrefix })), typePrefix === "prefix" && (jsxs(DivPrefixSC, { onClick: onClickPrefix, className: classNames({ disabled: disabled }), children: [iconPrefix && jsx(DivIconPrefixSC$1, { children: iconPrefix }), labelPrefix && jsx(SpanTextPrefixSC, { children: labelPrefix })] })), typePrefix === "dropdown" && (jsxs(DivDropdownPreFixSC, { className: classNames({
65756
65849
  "active-dropdown": activeDropdown,
@@ -65758,12 +65851,14 @@ const FISInputField = forwardRef(({ onClickSuffix, onClickPrefix, ...props }, re
65758
65851
  "input-text-lg": sizeInput === "lg",
65759
65852
  }), onClick: onClickPrefix, children: [iconPrefix && jsx(DivIconDropSC, { children: iconPrefix }), labelPrefix && jsx(SpanTextDropSC, { children: labelPrefix }), jsx(DivIconPrefixSC$1, { children: jsx(DropdownIcon, {}) })] })), jsx(InputSC$2, { ...rest, ref: ref, disabled: disabled, "$isPointer": props.$isPointer, className: classNames({
65760
65853
  negative: negative,
65854
+ "input-text-xs": sizeInput === "xs",
65855
+ "input-text-sm": sizeInput === "sm",
65761
65856
  "input-text-lg": sizeInput === "lg",
65762
65857
  prefix: iconPrefix,
65763
65858
  suffix: typeSuffix === "icon" ||
65764
65859
  typeSuffix === "suffix" ||
65765
65860
  typeSuffix === "dropdown",
65766
- }) }), typeSuffix === "icon" && iconSuffix && (jsx(FISIconButton, { size: "md", icon: iconSuffix, variant: "tertiary-invisible", className: "icon-suffix", onClick: onClickSuffix, disabled: disabled })), typeSuffix === "suffix" && (jsxs(DivSuffixSC, { onClick: onClickSuffix, className: classNames({ disabled: disabled }), children: [iconSuffix && jsx(DivIconSuffixSC$1, { children: iconSuffix }), labelSuffix && jsx(SpanTextSuffixSC, { children: labelSuffix })] })), typeSuffix === "dropdown" && (jsxs(DivDropdownSuffixSC, { className: classNames({
65861
+ }) }), typeSuffix === "icon" && iconSuffix && (jsx(FISIconButton, { size: sizeInput === "xs" || sizeInput === "sm" ? sizeInput : "md", icon: iconSuffix, variant: "tertiary-invisible", className: "icon-suffix", onClick: onClickSuffix, disabled: disabled })), typeSuffix === "suffix" && (jsxs(DivSuffixSC, { onClick: onClickSuffix, className: classNames({ disabled: disabled }), children: [iconSuffix && jsx(DivIconSuffixSC$1, { children: iconSuffix }), labelSuffix && jsx(SpanTextSuffixSC, { children: labelSuffix })] })), typeSuffix === "dropdown" && (jsxs(DivDropdownSuffixSC, { className: classNames({
65767
65862
  "active-dropdown": activeDropdown,
65768
65863
  disabled: disabled,
65769
65864
  "input-text-lg": sizeInput === "lg",