fis-component 0.1.22 → 0.1.24

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,12 @@
1
1
  import type { StoryObj } from "@storybook/react";
2
2
  declare const meta: {
3
3
  title: string;
4
- component: import("react").ForwardRefExoticComponent<import(".").FISTextPropsI & import("react").RefAttributes<any>>;
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
- export interface FISTextPropsI extends React.HTMLAttributes<HTMLElement> {
4
- variant?: keyof ThemeType;
5
- tag?: keyof JSX.IntrinsicElements;
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?: keyof JSX.IntrinsicElements;
8
+ as?: T;
8
9
  }
9
- declare const FISText: React.ForwardRefExoticComponent<FISTextPropsI & React.RefAttributes<any>>;
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?: string;
4
+ $variant?: FISTextVariant;
3
5
  $color?: string;
4
6
  }>> & string;
package/dist/esm/index.js CHANGED
@@ -76527,97 +76527,10 @@ const FISPagination = ({ pageSize = LIMIT_DEFAULT, current = 1, total = 0, minim
76527
76527
  const TextSC = styled.p `
76528
76528
  color: ${(props) => props.$color};
76529
76529
 
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
- }}
76530
+ ${({ $variant }) => $variant && css `${getTheme($variant)}`}
76618
76531
  `;
76619
76532
 
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 })));
76533
+ 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
76534
  FISText.displayName = "FISText";
76622
76535
 
76623
76536
  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 };