@trackunit/react-components 0.1.113 → 0.1.116
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/index.cjs +757 -503
- package/index.js +748 -502
- package/package.json +4 -5
- package/src/components/Alert/Alert.d.ts +1 -1
- package/src/components/Badge/Badge.d.ts +1 -6
- package/src/components/Badge/Badge.variants.d.ts +3 -0
- package/src/components/Drawer/Drawer.variants.d.ts +4 -0
- package/src/components/Heading/Heading.variants.d.ts +5 -0
- package/src/components/Icon/Icon.d.ts +4 -3
- package/src/components/Icon/Icon.variants.d.ts +8 -0
- package/src/components/Indicator/Indicator.d.ts +1 -1
- package/src/components/Indicator/Indicator.variants.d.ts +10 -0
- package/src/components/PageHeader/PageHeader.variants.d.ts +5 -0
- package/src/components/Pagination/Pagination.variants.d.ts +2 -0
- package/src/components/Popover/Popover.variants.d.ts +5 -0
- package/src/components/Sidebar/Sidebar.variants.d.ts +4 -0
- package/src/components/SkeletonLines/SkeletonLines.variants.d.ts +1 -0
- package/src/components/Spacer/Spacer.d.ts +3 -3
- package/src/components/Spacer/Spacer.variants.d.ts +4 -0
- package/src/components/Spinner/Spinner.variants.d.ts +7 -0
- package/src/components/Tag/Tag.d.ts +3 -2
- package/src/components/Tag/Tag.variants.d.ts +7 -0
- package/src/components/Timeline/Timeline.variants.d.ts +3 -0
- package/src/components/Tip/Tip.d.ts +3 -7
- package/src/components/Tip/Tip.variants.d.ts +4 -0
- package/src/components/Tooltip/Tooltip.variants.d.ts +6 -0
- package/src/components/ValueBar/ValueBar.variants.d.ts +9 -0
- package/src/components/buttons/BackToTopButton/BackToTopButton.d.ts +1 -1
- package/src/components/buttons/BackToTopButton/BackToTopButton.variants.d.ts +3 -0
- package/src/components/buttons/Button/Button.d.ts +1 -10
- package/src/components/buttons/IconButton/IconButton.d.ts +0 -5
- package/src/components/buttons/shared/Button.variants.d.ts +13 -0
- package/src/components/buttons/shared/ButtonProps.d.ts +5 -1
- package/src/index.d.ts +2 -0
- package/index.css +0 -194
- package/src/components/buttons/shared/helpers.d.ts +0 -20
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trackunit/react-components",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.116",
|
|
4
4
|
"repository": "https://github.com/Trackunit/manager",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"engines": {
|
|
@@ -9,15 +9,14 @@
|
|
|
9
9
|
"dependencies": {
|
|
10
10
|
"@floating-ui/react": "0.22.2",
|
|
11
11
|
"@trackunit/css-class-variance-utilities": "0.0.5",
|
|
12
|
-
"@trackunit/css-core": "0.0.
|
|
12
|
+
"@trackunit/css-core": "0.0.86",
|
|
13
13
|
"@trackunit/tailwind-styled-components": "0.0.57",
|
|
14
|
-
"@trackunit/ui-design-tokens": "0.0.
|
|
15
|
-
"@trackunit/ui-icons": "0.0.
|
|
14
|
+
"@trackunit/ui-design-tokens": "0.0.70",
|
|
15
|
+
"@trackunit/ui-icons": "0.0.67",
|
|
16
16
|
"date-fns": "2.29.3",
|
|
17
17
|
"lodash": "4.17.21",
|
|
18
18
|
"react": "18.2.0",
|
|
19
19
|
"react-day-picker": "8.7.1",
|
|
20
|
-
"react-dom": "18.2.0",
|
|
21
20
|
"react-helmet-async": "1.3.0",
|
|
22
21
|
"react-router-dom": "6.4.5",
|
|
23
22
|
"react-use": "17.4.0",
|
|
@@ -7,11 +7,6 @@ interface BaseBadgeProps extends CommonProps {
|
|
|
7
7
|
* The color of the badge.
|
|
8
8
|
*/
|
|
9
9
|
color?: BadgeColors;
|
|
10
|
-
/**
|
|
11
|
-
* Specifies whether the badge is subtle or not.
|
|
12
|
-
* Subtle badges have a light background color wither a darker text color.
|
|
13
|
-
*/
|
|
14
|
-
subtle?: boolean;
|
|
15
10
|
/**
|
|
16
11
|
* Custom classNames can be added to make adjustments where needed.
|
|
17
12
|
* Example: Set a maximum width of the badge by adding the className "max-w-[your-max-width]" or similar tailwind max-w class.
|
|
@@ -39,5 +34,5 @@ export type BadgeProps = BaseBadgeProps;
|
|
|
39
34
|
* @param {BadgeProps} props - The props for the Badge component
|
|
40
35
|
* @returns {JSX.Element} Badge component
|
|
41
36
|
*/
|
|
42
|
-
export declare const Badge: ({ color,
|
|
37
|
+
export declare const Badge: ({ color, className, count, max, hideZero, dataTestId, ...rest }: BadgeProps) => JSX.Element | null;
|
|
43
38
|
export {};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare const cvaDrawerOverlay: (props?: import("class-variance-authority/dist/types").ClassProp | undefined) => string;
|
|
2
|
+
export declare const cvaDrawerCard: (props?: ({
|
|
3
|
+
position?: "left" | "right" | "bottom" | "top" | null | undefined;
|
|
4
|
+
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const cvaHeading: (props?: ({
|
|
2
|
+
subtle?: boolean | null | undefined;
|
|
3
|
+
inverted?: boolean | null | undefined;
|
|
4
|
+
size?: "primary" | "secondary" | "tertiary" | "subtitle" | null | undefined;
|
|
5
|
+
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ActivityColors, CriticalityColors, GeneralColors, IntentColors } from "@trackunit/ui-design-tokens";
|
|
2
2
|
import { HeroIconName, TrackunitIconName } from "@trackunit/ui-icons";
|
|
3
3
|
import * as React from "react";
|
|
4
4
|
import { CommonProps, Size } from "../../common/CommonProps";
|
|
5
|
+
export type IconColors = IntentColors | GeneralColors | CriticalityColors | ActivityColors;
|
|
5
6
|
export interface IconProps extends CommonProps {
|
|
6
7
|
/**
|
|
7
8
|
* The name of the icon to be rendered.
|
|
@@ -13,14 +14,14 @@ export interface IconProps extends CommonProps {
|
|
|
13
14
|
* Supports any colors from the theme.
|
|
14
15
|
* Custom colors can be used by setting a text color in the className.
|
|
15
16
|
*/
|
|
16
|
-
color?:
|
|
17
|
+
color?: IconColors;
|
|
17
18
|
/**
|
|
18
19
|
* The size of the icon.
|
|
19
20
|
* Small = 16x16px, medium = 20x20px, Large = 24x24px.
|
|
20
21
|
* Default value is Large.
|
|
21
22
|
* If a custom size is needed, set it in the className.
|
|
22
23
|
*/
|
|
23
|
-
size?: Size;
|
|
24
|
+
size?: Size | "font";
|
|
24
25
|
/**
|
|
25
26
|
* Select if the icon should be rendered as solid or outline.
|
|
26
27
|
* Default value depends on the Size prop, small == solid, medium == solid, large == outline.
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare const cvaIcon: (props?: ({
|
|
2
|
+
color?: "primary" | "secondary" | "accent" | "neutral" | "info" | "success" | "warning" | "danger" | "good" | "low" | "critical" | "working" | "idle" | "moving" | "active" | "stopped" | "unknown" | "default" | "black" | "white" | null | undefined;
|
|
3
|
+
size?: "small" | "medium" | "large" | "font" | null | undefined;
|
|
4
|
+
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
|
|
5
|
+
export declare const cvaIconComponent: (props?: ({
|
|
6
|
+
iconType?: "solid" | "outline" | null | undefined;
|
|
7
|
+
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
|
|
8
|
+
export declare const cvaLoadingDot: (props?: import("class-variance-authority/dist/types").ClassProp | undefined) => string;
|
|
@@ -39,4 +39,4 @@ export interface IndicatorProps extends CommonProps {
|
|
|
39
39
|
* @param {IndicatorProps} props - The props for the Indicator component
|
|
40
40
|
* @returns {JSX.Element} Indicator component
|
|
41
41
|
*/
|
|
42
|
-
export declare const Indicator: ({ dataTestId, icon, label, color, withBackground, withLabel, ping, ...rest }: IndicatorProps) => JSX.Element;
|
|
42
|
+
export declare const Indicator: ({ dataTestId, icon, label, color, withBackground, withLabel, ping, className, ...rest }: IndicatorProps) => JSX.Element;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare const cvaIndicator: (props?: import("class-variance-authority/dist/types").ClassProp | undefined) => string;
|
|
2
|
+
export declare const cvaIndicatorIcon: (props?: import("class-variance-authority/dist/types").ClassProp | undefined) => string;
|
|
3
|
+
export declare const cvaIndicatorLabel: (props?: import("class-variance-authority/dist/types").ClassProp | undefined) => string;
|
|
4
|
+
export declare const cvaIndicatorPing: (props?: ({
|
|
5
|
+
color?: "primary" | "secondary" | "accent" | "neutral" | "info" | "success" | "warning" | "danger" | "good" | "low" | "critical" | "working" | "idle" | "stopped" | "moving" | "active" | "unknown" | "unused" | "utilized" | "heavily_utilized" | "available" | "on_rent" | "pickup_ready" | "transfer" | "in_repair" | "returned" | "other_rental_status" | "site" | "white" | "black" | null | undefined;
|
|
6
|
+
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
|
|
7
|
+
export declare const cvaIndicatorIconBackground: (props?: ({
|
|
8
|
+
color?: "primary" | "secondary" | "accent" | "neutral" | "info" | "success" | "warning" | "danger" | "good" | "low" | "critical" | "working" | "idle" | "stopped" | "moving" | "active" | "unknown" | "unused" | "utilized" | "heavily_utilized" | "available" | "on_rent" | "pickup_ready" | "transfer" | "in_repair" | "returned" | "other_rental_status" | "site" | "white" | "black" | null | undefined;
|
|
9
|
+
background?: "visible" | "hidden" | null | undefined;
|
|
10
|
+
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const cvaPageHeader: (props?: import("class-variance-authority/dist/types").ClassProp | undefined) => string;
|
|
2
|
+
export declare const cvaPageHeaderHeading: (props?: import("class-variance-authority/dist/types").ClassProp | undefined) => string;
|
|
3
|
+
export declare const cvaPageHeaderHeadingContainer: (props?: import("class-variance-authority/dist/types").ClassProp | undefined) => string;
|
|
4
|
+
export declare const cvaPageHeaderHeadingAccessoriesContainer: (props?: import("class-variance-authority/dist/types").ClassProp | undefined) => string;
|
|
5
|
+
export declare const cvaPageHeaderChildContainer: (props?: import("class-variance-authority/dist/types").ClassProp | undefined) => string;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const cvaPopoverContainer: (props?: import("class-variance-authority/dist/types").ClassProp | undefined) => string;
|
|
2
|
+
export declare const cvaPopoverTitleContainer: (props?: ({
|
|
3
|
+
divider?: boolean | null | undefined;
|
|
4
|
+
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
|
|
5
|
+
export declare const cvaPopoverTitleText: (props?: import("class-variance-authority/dist/types").ClassProp | undefined) => string;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare const cvaSidebar: (props?: import("class-variance-authority/dist/types").ClassProp | undefined) => string;
|
|
2
|
+
export declare const cvaSidebarChildContainer: (props?: ({
|
|
3
|
+
breakpoint?: "xs" | "sm" | "md" | "lg" | "xl" | "2xl" | "3xl" | null | undefined;
|
|
4
|
+
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const cvaSkeletonLine: (props?: import("class-variance-authority/dist/types").ClassProp | undefined) => string;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { CommonProps } from "../../common";
|
|
2
|
+
import { CommonProps, Size } from "../../common";
|
|
3
3
|
export interface SpacerProps extends CommonProps {
|
|
4
4
|
/**
|
|
5
5
|
* The minimum height of the spacer. Defaults to 1px.
|
|
6
6
|
* Possible values are "normal"(8px), and "large" (32px).
|
|
7
7
|
*/
|
|
8
|
-
|
|
8
|
+
size?: Size;
|
|
9
9
|
/**
|
|
10
10
|
* The border of the spacer.
|
|
11
11
|
*/
|
|
@@ -17,4 +17,4 @@ export interface SpacerProps extends CommonProps {
|
|
|
17
17
|
* @param {SpacerProps} props - The props for the Spacer component
|
|
18
18
|
* @returns {JSX.Element} Spacer component
|
|
19
19
|
*/
|
|
20
|
-
export declare const Spacer: ({
|
|
20
|
+
export declare const Spacer: ({ size, border, dataTestId, className }: SpacerProps) => JSX.Element;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const cvaSpinner: (props?: ({
|
|
2
|
+
size?: "small" | "medium" | "large" | null | undefined;
|
|
3
|
+
mode?: "dark" | "light" | null | undefined;
|
|
4
|
+
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
|
|
5
|
+
export declare const cvaSpinnerContainer: (props?: ({
|
|
6
|
+
centering?: "centered" | "vertically" | "horizontally" | null | undefined;
|
|
7
|
+
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
|
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ActivityColors, CriticalityColors, GeneralColors, IntentColors } from "@trackunit/ui-design-tokens";
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
import { CommonProps } from "../../common/CommonProps";
|
|
4
4
|
export type TagSize = "small" | "medium";
|
|
5
|
+
export type TagColors = IntentColors | GeneralColors | CriticalityColors | ActivityColors;
|
|
5
6
|
export interface TagProps extends CommonProps {
|
|
6
7
|
/**
|
|
7
8
|
* The color of the tag.
|
|
8
9
|
*
|
|
9
10
|
*/
|
|
10
|
-
color?:
|
|
11
|
+
color?: TagColors;
|
|
11
12
|
/**
|
|
12
13
|
* A handler for a click event triggered on X icon.
|
|
13
14
|
* If not passed then x icon won't be visible.
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const cvaTag: (props?: ({
|
|
2
|
+
size?: "small" | "medium" | null | undefined;
|
|
3
|
+
layout?: "withIcon" | "default" | null | undefined;
|
|
4
|
+
color?: "primary" | "secondary" | "accent" | "neutral" | "black" | "white" | "info" | "success" | "warning" | "danger" | "good" | "low" | "critical" | "working" | "stopped" | "idle" | "unknown" | "moving" | "active" | null | undefined;
|
|
5
|
+
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
|
|
6
|
+
export declare const cvaTagIconContainer: (props?: import("class-variance-authority/dist/types").ClassProp | undefined) => string;
|
|
7
|
+
export declare const cvaTagIcon: (props?: import("class-variance-authority/dist/types").ClassProp | undefined) => string;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export declare const cvaTimeline: (props?: import("class-variance-authority/dist/types").ClassProp | undefined) => string;
|
|
2
|
+
export declare const cvaTimelineElement: (props?: import("class-variance-authority/dist/types").ClassProp | undefined) => string;
|
|
3
|
+
export declare const cvaTimelineDot: (props?: import("class-variance-authority/dist/types").ClassProp | undefined) => string;
|
|
@@ -6,17 +6,13 @@ export interface TipProps extends CommonProps, Pick<TooltipProps, "placement" |
|
|
|
6
6
|
/**
|
|
7
7
|
* Child nodes to render inside the tip.
|
|
8
8
|
*/
|
|
9
|
-
children: React.ReactNode;
|
|
9
|
+
children: React.ReactNode | string;
|
|
10
10
|
/**
|
|
11
11
|
* The props for setting the icon on this tip.
|
|
12
12
|
*/
|
|
13
13
|
iconProps?: Partial<IconProps>;
|
|
14
14
|
/**
|
|
15
|
-
*
|
|
16
|
-
*/
|
|
17
|
-
renderAs?: keyof JSX.IntrinsicElements;
|
|
18
|
-
/**
|
|
19
|
-
* The href attribute if the tip is rendered as an anchor tag.
|
|
15
|
+
* Shows an icon with link as the href attribute inside the tip.
|
|
20
16
|
*/
|
|
21
17
|
link?: string;
|
|
22
18
|
}
|
|
@@ -27,4 +23,4 @@ export interface TipProps extends CommonProps, Pick<TooltipProps, "placement" |
|
|
|
27
23
|
* @param {TipProps} props - The props for the Tip component
|
|
28
24
|
* @returns {JSX.Element} Tip component
|
|
29
25
|
*/
|
|
30
|
-
export declare const Tip: ({ children, iconProps, dataTestId,
|
|
26
|
+
export declare const Tip: ({ children, iconProps, dataTestId, className, placement, mode, link, }: TipProps) => JSX.Element;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare const cvaTip: (props?: import("class-variance-authority/dist/types").ClassProp | undefined) => string;
|
|
2
|
+
export declare const cvaTipContent: (props?: ({
|
|
3
|
+
color?: "light" | "dark" | null | undefined;
|
|
4
|
+
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const cvaTooltipFlexContainer: (props?: import("class-variance-authority/dist/types").ClassProp | undefined) => string;
|
|
2
|
+
export declare const cvaTooltipPopover: (props?: import("class-variance-authority/dist/types").ClassProp | undefined) => string;
|
|
3
|
+
export declare const cvaTooltipContainer: (props?: import("class-variance-authority/dist/types").ClassProp | undefined) => string;
|
|
4
|
+
export declare const cvaTooltipContent: (props?: ({
|
|
5
|
+
color?: "light" | "dark" | null | undefined;
|
|
6
|
+
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare const cvaValueBar: (props?: ({
|
|
2
|
+
size?: "small" | "large" | null | undefined;
|
|
3
|
+
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
|
|
4
|
+
export declare const cvaValueBarProgress: (props?: ({
|
|
5
|
+
fill?: "default" | "background" | null | undefined;
|
|
6
|
+
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
|
|
7
|
+
export declare const cvaValueBarText: (props?: ({
|
|
8
|
+
size?: "small" | "large" | null | undefined;
|
|
9
|
+
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
|
|
@@ -11,4 +11,4 @@ export interface BackToTopProps extends CommonProps {
|
|
|
11
11
|
* BackToTopButton appears at the bottom-right corner of the screen when the user scrolls down the page. When clicked, the page scrolls smoothly to the top.
|
|
12
12
|
*
|
|
13
13
|
*/
|
|
14
|
-
export declare const BackToTopButton: ({ color, size, dataTestId }: BackToTopProps) => JSX.Element;
|
|
14
|
+
export declare const BackToTopButton: ({ color, size, dataTestId, className }: BackToTopProps) => JSX.Element;
|
|
@@ -1,14 +1,5 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import {
|
|
3
|
-
import { ButtonColor, ButtonCommonProps, ButtonType, ButtonVariant } from "../shared/ButtonProps";
|
|
4
|
-
export interface StyledButtonProps {
|
|
5
|
-
$variant: ButtonVariant;
|
|
6
|
-
$size: Size;
|
|
7
|
-
$square: boolean;
|
|
8
|
-
$color: ButtonColor;
|
|
9
|
-
$fullWidth: boolean;
|
|
10
|
-
$as: keyof JSX.IntrinsicElements | React.ComponentType<unknown>;
|
|
11
|
-
}
|
|
2
|
+
import { ButtonCommonProps, ButtonType } from "../shared/ButtonProps";
|
|
12
3
|
export interface ButtonProps extends ButtonCommonProps {
|
|
13
4
|
onClick?: (event: React.MouseEvent<HTMLElement>) => void;
|
|
14
5
|
/**
|
|
@@ -1,16 +1,11 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { Size } from "../../../common";
|
|
3
|
-
import "../shared/Button.css";
|
|
4
3
|
import { ButtonCommonProps } from "../shared/ButtonProps";
|
|
5
4
|
export interface IconButtonProps extends ButtonCommonProps {
|
|
6
5
|
/**
|
|
7
6
|
* The icon to display.
|
|
8
7
|
*/
|
|
9
8
|
icon: React.ReactNode;
|
|
10
|
-
/**
|
|
11
|
-
* Whether the button is circular or not.
|
|
12
|
-
*/
|
|
13
|
-
circular?: boolean;
|
|
14
9
|
/**
|
|
15
10
|
* The element type the button will be rendered as.
|
|
16
11
|
*
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare const cvaButton: (props?: ({
|
|
2
|
+
color?: "primary" | "secondary" | "danger" | "warning" | "tertiary" | null | undefined;
|
|
3
|
+
size?: "small" | "medium" | "large" | null | undefined;
|
|
4
|
+
rounded?: boolean | null | undefined;
|
|
5
|
+
fullWidth?: boolean | null | undefined;
|
|
6
|
+
square?: boolean | null | undefined;
|
|
7
|
+
disabled?: boolean | null | undefined;
|
|
8
|
+
variant?: "transparent" | "filled" | null | undefined;
|
|
9
|
+
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
|
|
10
|
+
export declare const cvaButtonSpinner: (props?: import("class-variance-authority/dist/types").ClassProp | undefined) => string;
|
|
11
|
+
export declare const cvaIconButtonContainer: (props?: ({
|
|
12
|
+
size?: "small" | "medium" | "large" | null | undefined;
|
|
13
|
+
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { GeneralColors, IntentColors } from "@trackunit/ui-design-tokens";
|
|
3
3
|
import { CommonProps, Size } from "../../../common/CommonProps";
|
|
4
4
|
export type ButtonVariant = "filled" | "transparent";
|
|
5
|
-
export type ButtonColor = Extract<GeneralColors, "primary" | "secondary"> | Extract<IntentColors, "
|
|
5
|
+
export type ButtonColor = Extract<GeneralColors, "primary" | "secondary"> | Extract<IntentColors, "warning" | "danger"> | "tertiary";
|
|
6
6
|
export type ButtonType = "button" | "submit";
|
|
7
7
|
export interface ButtonCommonProps extends CommonProps {
|
|
8
8
|
onClick?: (event: React.MouseEvent<HTMLElement>) => void;
|
|
@@ -38,6 +38,10 @@ export interface ButtonCommonProps extends CommonProps {
|
|
|
38
38
|
* The id of the button.
|
|
39
39
|
*/
|
|
40
40
|
id?: string;
|
|
41
|
+
/**
|
|
42
|
+
* Whether the button is circular or not.
|
|
43
|
+
*/
|
|
44
|
+
circular?: boolean;
|
|
41
45
|
title?: string;
|
|
42
46
|
tabIndex?: number;
|
|
43
47
|
role?: string;
|
package/src/index.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
export * from "./common";
|
|
2
2
|
export * from "./components";
|
|
3
|
+
export * from "./components/buttons/shared/Button.variants";
|
|
3
4
|
export * from "./components/Clickable/Clickable.variants";
|
|
5
|
+
export * from "./components/Indicator/Indicator.variants";
|
|
4
6
|
export * from "./hooks";
|
|
5
7
|
export * from "./layout";
|
package/index.css
DELETED
|
@@ -1,194 +0,0 @@
|
|
|
1
|
-
/* CSS related to the Button component */
|
|
2
|
-
|
|
3
|
-
.tu-button {
|
|
4
|
-
@apply flex-row
|
|
5
|
-
inline-flex
|
|
6
|
-
gap-2
|
|
7
|
-
box-border
|
|
8
|
-
justify-center
|
|
9
|
-
items-center
|
|
10
|
-
whitespace-nowrap
|
|
11
|
-
max-w-full
|
|
12
|
-
outline-0
|
|
13
|
-
outline-current
|
|
14
|
-
transition-all
|
|
15
|
-
ease-in-out
|
|
16
|
-
component-button-border
|
|
17
|
-
cursor-pointer
|
|
18
|
-
flex-none
|
|
19
|
-
py-1.5
|
|
20
|
-
component-button-padding
|
|
21
|
-
component-button-height
|
|
22
|
-
focus:ring
|
|
23
|
-
focus:ring-offset-1
|
|
24
|
-
focus:outline-none
|
|
25
|
-
disabled:cursor-not-allowed
|
|
26
|
-
text-sm
|
|
27
|
-
font-medium
|
|
28
|
-
align-middle;
|
|
29
|
-
|
|
30
|
-
&__spinner {
|
|
31
|
-
@apply !w-[1em]
|
|
32
|
-
!h-[1em];
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
&--rounded {
|
|
36
|
-
@apply !rounded-full;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
&--square {
|
|
40
|
-
@apply aspect-square;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
&--full-width {
|
|
44
|
-
@apply w-full
|
|
45
|
-
flex-auto;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
&--small {
|
|
49
|
-
@apply py-1
|
|
50
|
-
px-2;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
&--large {
|
|
54
|
-
@apply py-2
|
|
55
|
-
px-4;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
&--primary {
|
|
59
|
-
@apply bg-primary-600
|
|
60
|
-
text-white
|
|
61
|
-
hover:bg-primary-800
|
|
62
|
-
active:bg-primary-700
|
|
63
|
-
focus:ring-primary-300
|
|
64
|
-
disabled:hover:bg-slate-400
|
|
65
|
-
disabled:bg-slate-400
|
|
66
|
-
disabled:text-slate-200;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
&--secondary {
|
|
70
|
-
@apply component-button-secondary-color
|
|
71
|
-
hover:bg-secondary-400
|
|
72
|
-
hover:text-secondary-800
|
|
73
|
-
active:text-secondary-700
|
|
74
|
-
active:bg-secondary-300
|
|
75
|
-
focus:ring-secondary-300
|
|
76
|
-
disabled:bg-secondary-200
|
|
77
|
-
disabled:hover:bg-secondary-200
|
|
78
|
-
disabled:text-secondary-400;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
&--danger {
|
|
82
|
-
@apply bg-danger-600
|
|
83
|
-
text-white
|
|
84
|
-
hover:bg-danger-800
|
|
85
|
-
active:bg-danger-700
|
|
86
|
-
focus:ring-danger-300
|
|
87
|
-
disabled:bg-slate-200
|
|
88
|
-
disabled:hover:bg-slate-200
|
|
89
|
-
disabled:text-slate-400;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
&--warning {
|
|
93
|
-
@apply bg-warning-50
|
|
94
|
-
text-warning-600
|
|
95
|
-
hover:bg-warning-200
|
|
96
|
-
hover:text-warning-800
|
|
97
|
-
active:text-warning-700
|
|
98
|
-
active:bg-warning-100
|
|
99
|
-
focus:ring-warning-300
|
|
100
|
-
disabled:bg-warning-50
|
|
101
|
-
disabled:hover:bg-warning-50
|
|
102
|
-
disabled:text-slate-400;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
&--tertiary {
|
|
106
|
-
@apply bg-white
|
|
107
|
-
border
|
|
108
|
-
text-slate-600
|
|
109
|
-
active:bg-slate-100
|
|
110
|
-
active:text-slate-700
|
|
111
|
-
focus:ring-slate-300
|
|
112
|
-
hover:bg-slate-200
|
|
113
|
-
hover:text-slate-800
|
|
114
|
-
border-slate-300
|
|
115
|
-
disabled:bg-slate-200
|
|
116
|
-
disabled:hover:bg-slate-200
|
|
117
|
-
disabled:text-slate-400;
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
&--transparent-primary {
|
|
121
|
-
@apply text-primary-600
|
|
122
|
-
hover:text-primary-700
|
|
123
|
-
active:bg-primary-700
|
|
124
|
-
focus:ring-primary-300
|
|
125
|
-
hover:bg-primary-500/10
|
|
126
|
-
disabled:hover:bg-transparent;
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
&--transparent-secondary {
|
|
130
|
-
@apply text-neutral-600
|
|
131
|
-
hover:text-neutral-800
|
|
132
|
-
active:text-neutral-700
|
|
133
|
-
active:bg-black/10
|
|
134
|
-
focus:ring-neutral-300
|
|
135
|
-
hover:bg-black/5
|
|
136
|
-
disabled:hover:bg-transparent;
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
&--transparent-danger {
|
|
140
|
-
@apply text-danger-600
|
|
141
|
-
active:bg-danger-600/10
|
|
142
|
-
focus:ring-danger-300
|
|
143
|
-
hover:bg-danger-600/10
|
|
144
|
-
disabled:hover:bg-transparent;
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
&--transparent-warning {
|
|
148
|
-
@apply text-warning-600
|
|
149
|
-
active:bg-warning-500/20
|
|
150
|
-
focus:ring-warning-300
|
|
151
|
-
hover:bg-warning-500/10
|
|
152
|
-
disabled:hover:bg-transparent;
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
&--transparent-tertiary {
|
|
156
|
-
@apply text-slate-600
|
|
157
|
-
active:bg-slate-200/20
|
|
158
|
-
focus:ring-slate-300
|
|
159
|
-
hover:bg-slate-600/10
|
|
160
|
-
disabled:hover:bg-transparent;
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
&__container {
|
|
164
|
-
@apply w-5
|
|
165
|
-
h-5
|
|
166
|
-
flex
|
|
167
|
-
justify-center
|
|
168
|
-
items-center
|
|
169
|
-
box-border;
|
|
170
|
-
|
|
171
|
-
&--small {
|
|
172
|
-
@apply w-4
|
|
173
|
-
h-4
|
|
174
|
-
flex
|
|
175
|
-
justify-center
|
|
176
|
-
items-center
|
|
177
|
-
box-border;
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
&__disabled {
|
|
182
|
-
@apply cursor-not-allowed
|
|
183
|
-
pointer-events-none
|
|
184
|
-
bg-slate-200
|
|
185
|
-
hover:bg-slate-200
|
|
186
|
-
text-slate-400;
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
&__disabled--transparent {
|
|
190
|
-
@apply cursor-not-allowed
|
|
191
|
-
pointer-events-none
|
|
192
|
-
hover:bg-transparent;
|
|
193
|
-
}
|
|
194
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { Size } from "../../../common";
|
|
2
|
-
import { ButtonColor, ButtonVariant } from "./ButtonProps";
|
|
3
|
-
interface ButtonProps {
|
|
4
|
-
$color: ButtonColor;
|
|
5
|
-
$variant: ButtonVariant;
|
|
6
|
-
$size: Size;
|
|
7
|
-
}
|
|
8
|
-
/**
|
|
9
|
-
* Helper to get the needed classname from buttonProps.
|
|
10
|
-
*
|
|
11
|
-
* @returns {string} - Classnames for the button
|
|
12
|
-
*/
|
|
13
|
-
export declare const getStyles: () => ({ $color, $variant }: ButtonProps) => any;
|
|
14
|
-
/**
|
|
15
|
-
* Helper to get the needed classname for padding.
|
|
16
|
-
*
|
|
17
|
-
* @returns {string} - The correct class for setting padding.
|
|
18
|
-
*/
|
|
19
|
-
export declare const getPadding: () => ({ $size }: ButtonProps) => string;
|
|
20
|
-
export {};
|