fis-component 0.1.23 → 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.
- package/dist/cjs/index.js +100 -92
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/src/components/Input/InputField/index.d.ts +1 -1
- package/dist/cjs/types/src/components/Text/Text.stories.d.ts +6 -1
- package/dist/cjs/types/src/components/Text/index.d.ts +13 -5
- package/dist/cjs/types/src/components/Text/styles.d.ts +3 -1
- package/dist/esm/index.js +100 -92
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/src/components/Input/InputField/index.d.ts +1 -1
- package/dist/esm/types/src/components/Text/Text.stories.d.ts +6 -1
- package/dist/esm/types/src/components/Text/index.d.ts +13 -5
- package/dist/esm/types/src/components/Text/styles.d.ts +3 -1
- package/dist/index.d.ts +22 -13
- package/package.json +2 -2
|
@@ -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;
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
import type { StoryObj } from "@storybook/react";
|
|
2
2
|
declare const meta: {
|
|
3
3
|
title: string;
|
|
4
|
-
component:
|
|
4
|
+
component: {
|
|
5
|
+
<T extends React.ElementType = "p">(props: import(".").FISTextPropsI<T> & {
|
|
6
|
+
ref?: React.ComponentPropsWithRef<T>["ref"];
|
|
7
|
+
}): React.ReactElement | null;
|
|
8
|
+
displayName?: string;
|
|
9
|
+
};
|
|
5
10
|
tags: string[];
|
|
6
11
|
parameters: {
|
|
7
12
|
controls: {
|
|
@@ -1,10 +1,18 @@
|
|
|
1
1
|
import { ThemeType } from "../../styles/design-system";
|
|
2
2
|
import React from "react";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
import { FISTextVariant } from "./styles";
|
|
4
|
+
export interface FISTextOwnPropsI<T extends React.ElementType = "p"> {
|
|
5
|
+
variant?: FISTextVariant;
|
|
6
|
+
tag?: T;
|
|
6
7
|
color?: keyof ThemeType;
|
|
7
|
-
as?:
|
|
8
|
+
as?: T;
|
|
8
9
|
}
|
|
9
|
-
|
|
10
|
+
export type FISTextPropsI<T extends React.ElementType = "p"> = FISTextOwnPropsI<T> & Omit<React.ComponentPropsWithoutRef<T>, keyof FISTextOwnPropsI<T>>;
|
|
11
|
+
type FISTextComponent = {
|
|
12
|
+
<T extends React.ElementType = "p">(props: FISTextPropsI<T> & {
|
|
13
|
+
ref?: React.ComponentPropsWithRef<T>["ref"];
|
|
14
|
+
}): React.ReactElement | null;
|
|
15
|
+
displayName?: string;
|
|
16
|
+
};
|
|
17
|
+
declare const FISText: FISTextComponent;
|
|
10
18
|
export default FISText;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import { ThemeType } from "../../styles/design-system";
|
|
2
|
+
export type FISTextVariant = Extract<keyof ThemeType, `${"Emphasis" | "Title" | "Label" | "Subheading" | "Paragraph" | "Link"}/${string}` | "_Guide/Flow-Line/Label">;
|
|
1
3
|
export declare const TextSC: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLParagraphElement>, HTMLParagraphElement>, {
|
|
2
|
-
$variant?:
|
|
4
|
+
$variant?: FISTextVariant;
|
|
3
5
|
$color?: string;
|
|
4
6
|
}>> & string;
|
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/
|
|
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/
|
|
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",
|
|
@@ -76527,97 +76622,10 @@ const FISPagination = ({ pageSize = LIMIT_DEFAULT, current = 1, total = 0, minim
|
|
|
76527
76622
|
const TextSC = styled.p `
|
|
76528
76623
|
color: ${(props) => props.$color};
|
|
76529
76624
|
|
|
76530
|
-
${({ $variant }) => {
|
|
76531
|
-
switch ($variant) {
|
|
76532
|
-
case "Emphasis/Emp-6":
|
|
76533
|
-
return css `
|
|
76534
|
-
${getTheme("Emphasis/Emp-6")}
|
|
76535
|
-
`;
|
|
76536
|
-
case "Emphasis/Emp-5":
|
|
76537
|
-
return css `
|
|
76538
|
-
${getTheme("Emphasis/Emp-5")}
|
|
76539
|
-
`;
|
|
76540
|
-
case "Emphasis/Emp-4":
|
|
76541
|
-
return css `
|
|
76542
|
-
${getTheme("Emphasis/Emp-4")}
|
|
76543
|
-
`;
|
|
76544
|
-
case "Emphasis/Emp-3":
|
|
76545
|
-
return css `
|
|
76546
|
-
${getTheme("Emphasis/Emp-3")}
|
|
76547
|
-
`;
|
|
76548
|
-
case "Emphasis/Emp-2":
|
|
76549
|
-
return css `
|
|
76550
|
-
${getTheme("Emphasis/Emp-2")}
|
|
76551
|
-
`;
|
|
76552
|
-
case "Emphasis/Emp-1":
|
|
76553
|
-
return css `
|
|
76554
|
-
${getTheme("Emphasis/Emp-1")}
|
|
76555
|
-
`;
|
|
76556
|
-
case "Label/XL":
|
|
76557
|
-
return css `
|
|
76558
|
-
${getTheme("Label/XL")}
|
|
76559
|
-
`;
|
|
76560
|
-
case "Label/Lg":
|
|
76561
|
-
return css `
|
|
76562
|
-
${getTheme("Label/Lg")}
|
|
76563
|
-
`;
|
|
76564
|
-
case "Label/Md":
|
|
76565
|
-
return css `
|
|
76566
|
-
${getTheme("Label/Md")}
|
|
76567
|
-
`;
|
|
76568
|
-
case "Label/Sm":
|
|
76569
|
-
return css `
|
|
76570
|
-
${getTheme("Label/Sm")}
|
|
76571
|
-
`;
|
|
76572
|
-
case "Label/XS":
|
|
76573
|
-
return css `
|
|
76574
|
-
${getTheme("Label/XS")}
|
|
76575
|
-
`;
|
|
76576
|
-
case "Subheading/Lg":
|
|
76577
|
-
return css `
|
|
76578
|
-
${getTheme("Subheading/Lg")}
|
|
76579
|
-
`;
|
|
76580
|
-
case "Subheading/Md":
|
|
76581
|
-
return css `
|
|
76582
|
-
${getTheme("Subheading/Md")}
|
|
76583
|
-
`;
|
|
76584
|
-
case "Subheading/Sm":
|
|
76585
|
-
return css `
|
|
76586
|
-
${getTheme("Subheading/Sm")}
|
|
76587
|
-
`;
|
|
76588
|
-
case "Subheading/XS":
|
|
76589
|
-
return css `
|
|
76590
|
-
${getTheme("Subheading/XS")}
|
|
76591
|
-
`;
|
|
76592
|
-
case "Paragraph/XL":
|
|
76593
|
-
return css `
|
|
76594
|
-
${getTheme("Paragraph/XL")}
|
|
76595
|
-
`;
|
|
76596
|
-
case "Paragraph/Lg":
|
|
76597
|
-
return css `
|
|
76598
|
-
${getTheme("Paragraph/Lg")}
|
|
76599
|
-
`;
|
|
76600
|
-
case "Paragraph/Md":
|
|
76601
|
-
return css `
|
|
76602
|
-
${getTheme("Paragraph/Md")}
|
|
76603
|
-
`;
|
|
76604
|
-
case "Paragraph/Sm":
|
|
76605
|
-
return css `
|
|
76606
|
-
${getTheme("Paragraph/Sm")}
|
|
76607
|
-
`;
|
|
76608
|
-
case "Paragraph/XS":
|
|
76609
|
-
return css `
|
|
76610
|
-
${getTheme("Paragraph/XS")}
|
|
76611
|
-
`;
|
|
76612
|
-
case "_Guide/Flow-Line/Label":
|
|
76613
|
-
return css `
|
|
76614
|
-
${getTheme("_Guide/Flow-Line/Label")}
|
|
76615
|
-
`;
|
|
76616
|
-
}
|
|
76617
|
-
}}
|
|
76625
|
+
${({ $variant }) => $variant && css `${getTheme($variant)}`}
|
|
76618
76626
|
`;
|
|
76619
76627
|
|
|
76620
|
-
const FISText = forwardRef(({ tag, variant, children, color, ...rest }, ref) => (jsx(TextSC, { as: tag, "$variant": variant, "$color": color ? getTheme(color) : "", ref: ref, ...rest, children: children })));
|
|
76628
|
+
const FISText = forwardRef(({ tag, as, variant, children, color, ...rest }, ref) => (jsx(TextSC, { as: as ?? tag, "$variant": variant, "$color": color ? getTheme(color) : "", ref: ref, ...rest, children: children })));
|
|
76621
76629
|
FISText.displayName = "FISText";
|
|
76622
76630
|
|
|
76623
76631
|
export { FISAlertBanner, FISApiSelect, FISAvatar, FISBadge, FISBreadcrumb, FISButton, FISButtonGroup, FISCheckbox, FISCheckboxGroup, FISChipButton, FISCollapse, FISCombobox, FISDateRange, FISDivider, FISIconButton, FISInputArea, FISInputDate, FISInputField, FISInputLabel, FISInputStepper, FISInputText, FISInputTime, FISLinkButton, FISMenuItem, FISMenuSection, FISMenuSelect, FISMenuSelectDropdown, FISPagination, FISProgressCircular, FISProgressLinear, FISRadio, RadioGroup as FISRadioGroup, FISSegmented, FISSelect, FISSelectItem, FISSorter, FISSplitButton, FISSwitch, FISTab, FISTable, FISTableCell, FISTableHeaderCell, FISText, FISThemeProvider, FISToast, FISTooltip, SegmentedPanelItem, TabPanelItem, useNotification, useToast };
|