@kroo-web/design-system 1.0.39 → 1.0.41
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/README.MD +5 -0
- package/dist/cjs/icons/Icon.stories.d.ts +2 -2
- package/dist/cjs/index.js +40 -4
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/product/components/Button/button.stories.d.ts +5 -1
- package/dist/cjs/product/components/Button/index.d.ts +24 -3
- package/dist/cjs/product/components/Callout/Callout.stories.d.ts +1 -1
- package/dist/cjs/product/components/Columns/Columns.stories.d.ts +6 -0
- package/dist/cjs/product/components/DatePicker/DatePicker.stories.d.ts +1 -1
- package/dist/cjs/product/components/Disclosure/Disclosure.stories.d.ts +1 -1
- package/dist/cjs/product/components/Form/Form.stories.d.ts +12 -0
- package/dist/cjs/product/components/Loading/Loading.stories.d.ts +7 -0
- package/dist/cjs/product/components/Loading/Loading.test.d.ts +1 -0
- package/dist/cjs/product/components/Loading/index.d.ts +12 -0
- package/dist/cjs/product/components/Modal/Modal.stories.d.ts +7 -0
- package/dist/cjs/product/components/Modal/Modal.test.d.ts +1 -0
- package/dist/cjs/product/components/Modal/index.d.ts +25 -0
- package/dist/cjs/product/components/NumberField/numberField.stories.d.ts +1 -1
- package/dist/cjs/product/components/ProgressIndicator/ProgressIndicator.stories.d.ts +1 -1
- package/dist/cjs/product/components/ProgressIndicator/index.d.ts +2 -2
- package/dist/cjs/product/components/RadioGroup/radioGroup.stories.d.ts +1 -1
- package/dist/cjs/product/components/Range/range.stories.d.ts +2 -2
- package/dist/cjs/product/components/Select/select.stories.d.ts +2 -2
- package/dist/cjs/product/components/TextField/textField.stories.d.ts +1 -1
- package/dist/cjs/product/components/Toast/Toast.stories.d.ts +7 -0
- package/dist/cjs/product/components/Toast/index.d.ts +16 -0
- package/dist/cjs/product/components/Tooltip/Tooltip.stories.d.ts +7 -0
- package/dist/cjs/product/components/Tooltip/Tooltip.test.d.ts +1 -0
- package/dist/cjs/product/components/Tooltip/index.d.ts +10 -0
- package/dist/cjs/product/components/Typography/typography.stories.d.ts +1 -1
- package/dist/cjs/product/components/index.d.ts +6 -1
- package/dist/esm/icons/Icon.stories.d.ts +2 -2
- package/dist/esm/index.js +40 -4
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/product/components/Button/button.stories.d.ts +5 -1
- package/dist/esm/product/components/Button/index.d.ts +24 -3
- package/dist/esm/product/components/Callout/Callout.stories.d.ts +1 -1
- package/dist/esm/product/components/Columns/Columns.stories.d.ts +6 -0
- package/dist/esm/product/components/DatePicker/DatePicker.stories.d.ts +1 -1
- package/dist/esm/product/components/Disclosure/Disclosure.stories.d.ts +1 -1
- package/dist/esm/product/components/Form/Form.stories.d.ts +12 -0
- package/dist/esm/product/components/Loading/Loading.stories.d.ts +7 -0
- package/dist/esm/product/components/Loading/Loading.test.d.ts +1 -0
- package/dist/esm/product/components/Loading/index.d.ts +12 -0
- package/dist/esm/product/components/Modal/Modal.stories.d.ts +7 -0
- package/dist/esm/product/components/Modal/Modal.test.d.ts +1 -0
- package/dist/esm/product/components/Modal/index.d.ts +25 -0
- package/dist/esm/product/components/NumberField/numberField.stories.d.ts +1 -1
- package/dist/esm/product/components/ProgressIndicator/ProgressIndicator.stories.d.ts +1 -1
- package/dist/esm/product/components/ProgressIndicator/index.d.ts +2 -2
- package/dist/esm/product/components/RadioGroup/radioGroup.stories.d.ts +1 -1
- package/dist/esm/product/components/Range/range.stories.d.ts +2 -2
- package/dist/esm/product/components/Select/select.stories.d.ts +2 -2
- package/dist/esm/product/components/TextField/textField.stories.d.ts +1 -1
- package/dist/esm/product/components/Toast/Toast.stories.d.ts +7 -0
- package/dist/esm/product/components/Toast/index.d.ts +16 -0
- package/dist/esm/product/components/Tooltip/Tooltip.stories.d.ts +7 -0
- package/dist/esm/product/components/Tooltip/Tooltip.test.d.ts +1 -0
- package/dist/esm/product/components/Tooltip/index.d.ts +10 -0
- package/dist/esm/product/components/Typography/typography.stories.d.ts +1 -1
- package/dist/esm/product/components/index.d.ts +6 -1
- package/dist/styles/dev.global.css +2 -0
- package/dist/styles/global.css +4 -0
- package/dist/styles/tokens/product.css +1 -0
- package/dist/types.d.ts +117 -26
- package/package.json +8 -5
- /package/dist/cjs/product/components/{FormField → shared/FormField}/FormField.stories.d.ts +0 -0
- /package/dist/cjs/product/components/{FormField → shared/FormField}/index.d.ts +0 -0
- /package/dist/esm/product/components/{FormField → shared/FormField}/FormField.stories.d.ts +0 -0
- /package/dist/esm/product/components/{FormField → shared/FormField}/index.d.ts +0 -0
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { StoryObj } from '@storybook/react';
|
|
3
3
|
import { Button } from '.';
|
|
4
|
-
declare const _default: import("@storybook/types").ComponentAnnotations<import("@storybook/react").ReactRenderer, import(".").
|
|
4
|
+
declare const _default: import("@storybook/types").ComponentAnnotations<import("@storybook/react").ReactRenderer, import(".").TButtonProps<React.ElementType<any, keyof React.JSX.IntrinsicElements>>>;
|
|
5
5
|
export default _default;
|
|
6
6
|
type Story = StoryObj<typeof Button>;
|
|
7
|
+
export declare const GeneralUsage: Story;
|
|
8
|
+
export declare const PolymorphicButton: Story;
|
|
9
|
+
export declare const OnlyIcon: Story;
|
|
7
10
|
export declare const DefaultVariants: Story;
|
|
8
11
|
export declare const ActionVariants: Story;
|
|
12
|
+
export declare const TextVariants: Story;
|
|
9
13
|
export declare const DefaultOnlyIcons: Story;
|
|
10
14
|
export declare const ActionOnlyIcons: Story;
|
|
11
15
|
export declare const IconsAndText: Story;
|
|
@@ -6,15 +6,36 @@ export type TButtonDefaultProps = {
|
|
|
6
6
|
variant?: "primary" | "secondary" | "tertiary" | "ghost" | "danger";
|
|
7
7
|
};
|
|
8
8
|
export type TActionButtonProps = {
|
|
9
|
+
/**
|
|
10
|
+
* The size changing variant of the button.
|
|
11
|
+
*/
|
|
9
12
|
visualType?: "action";
|
|
13
|
+
/**
|
|
14
|
+
* The colour changing variant of the button.
|
|
15
|
+
*/
|
|
10
16
|
variant?: "standard" | "secondary" | "tertiary" | "ghost" | "danger";
|
|
11
17
|
};
|
|
12
|
-
type
|
|
18
|
+
export type TTextButtonProps = {
|
|
19
|
+
visualType?: "text";
|
|
20
|
+
variant?: "primary" | "secondary";
|
|
21
|
+
};
|
|
22
|
+
type ConditionalProps = TButtonDefaultProps | TActionButtonProps | TTextButtonProps;
|
|
13
23
|
export interface IButtonOwnProps extends React.ButtonHTMLAttributes<HTMLButtonElement>, PropsWithChildren {
|
|
24
|
+
/**
|
|
25
|
+
* Polymorphic prop to define the element type of the button, currently
|
|
26
|
+
* we only support 2 types: button and span.
|
|
27
|
+
*/
|
|
14
28
|
as?: "button" | "span";
|
|
29
|
+
/**
|
|
30
|
+
* Appends the className to the button element.
|
|
31
|
+
*/
|
|
15
32
|
className?: string;
|
|
33
|
+
/**
|
|
34
|
+
* To be used when the contents of the button is only an icon this props
|
|
35
|
+
* will correct the padding as the padding is different to a button that includes text.
|
|
36
|
+
*/
|
|
16
37
|
onlyIcon?: boolean;
|
|
17
38
|
}
|
|
18
|
-
export type
|
|
19
|
-
export declare function Button<T extends React.ElementType = typeof defaultElement>({ as, children, variant, className, visualType, onlyIcon, ...rest }:
|
|
39
|
+
export type TButtonProps<T extends React.ElementType = typeof defaultElement> = PolymorphicPropsWithoutRef<IButtonOwnProps, T> & ConditionalProps;
|
|
40
|
+
export declare function Button<T extends React.ElementType = typeof defaultElement>({ as, children, variant, className, visualType, onlyIcon, ...rest }: TButtonProps<T>): React.JSX.Element;
|
|
20
41
|
export {};
|
|
@@ -6,5 +6,5 @@ declare const _default: import("@storybook/types").ComponentAnnotations<import("
|
|
|
6
6
|
}>;
|
|
7
7
|
export default _default;
|
|
8
8
|
type Story = StoryObj<typeof Callout.Root>;
|
|
9
|
-
export declare const
|
|
9
|
+
export declare const GeneralUsage: Story;
|
|
10
10
|
export declare const Types: Story;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { StoryObj } from "@storybook/react";
|
|
2
|
+
import { Columns } from ".";
|
|
3
|
+
declare const _default: import("@storybook/types").ComponentAnnotations<import("@storybook/react").ReactRenderer, import(".").TColumnsProps>;
|
|
4
|
+
export default _default;
|
|
5
|
+
type Story = StoryObj<typeof Columns>;
|
|
6
|
+
export declare const GeneralUsage: Story;
|
|
@@ -3,6 +3,6 @@ import { DatePicker } from ".";
|
|
|
3
3
|
declare const _default: import("@storybook/types").ComponentAnnotations<import("@storybook/react").ReactRenderer, import(".").TDatePicker<import("react-hook-form").FieldValues>>;
|
|
4
4
|
export default _default;
|
|
5
5
|
type Story = StoryObj<typeof DatePicker>;
|
|
6
|
-
export declare const
|
|
6
|
+
export declare const GeneralUsage: Story;
|
|
7
7
|
export declare const Helper: Story;
|
|
8
8
|
export declare const Error: Story;
|
|
@@ -3,4 +3,4 @@ import { Disclosure } from ".";
|
|
|
3
3
|
declare const _default: import("@storybook/types").ComponentAnnotations<import("@storybook/react").ReactRenderer, import(".").TDisclosureProps>;
|
|
4
4
|
export default _default;
|
|
5
5
|
type Story = StoryObj<typeof Disclosure>;
|
|
6
|
-
export declare const
|
|
6
|
+
export declare const GeneralUsage: Story;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { StoryObj } from "@storybook/react";
|
|
3
|
+
import { Form } from ".";
|
|
4
|
+
declare const _default: import("@storybook/types").ComponentAnnotations<import("@storybook/react").ReactRenderer, React.HTMLProps<HTMLFormElement> & {
|
|
5
|
+
children?: React.ReactNode;
|
|
6
|
+
} & {
|
|
7
|
+
methods: import("react-hook-form").UseFormReturn<import("react-hook-form").FieldValues>;
|
|
8
|
+
onSubmit: (values: import("react-hook-form").FieldValues) => void;
|
|
9
|
+
}>;
|
|
10
|
+
export default _default;
|
|
11
|
+
type Story = StoryObj<typeof Form>;
|
|
12
|
+
export declare const GeneralUsage: Story;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { StoryObj } from "@storybook/react";
|
|
2
|
+
import { Loading } from ".";
|
|
3
|
+
declare const _default: import("@storybook/types").ComponentAnnotations<import("@storybook/react").ReactRenderer, import(".").TLoadingProps>;
|
|
4
|
+
export default _default;
|
|
5
|
+
type Story = StoryObj<typeof Loading>;
|
|
6
|
+
export declare const GeneralUsage: Story;
|
|
7
|
+
export declare const Sizes: Story;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
declare const sizes: {
|
|
3
|
+
small: string;
|
|
4
|
+
medium: string;
|
|
5
|
+
large: string;
|
|
6
|
+
full: string;
|
|
7
|
+
};
|
|
8
|
+
export type TLoadingProps = {
|
|
9
|
+
size?: keyof typeof sizes;
|
|
10
|
+
};
|
|
11
|
+
export declare const Loading: ({ size }: TLoadingProps) => React.JSX.Element;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { StoryObj } from "@storybook/react";
|
|
2
|
+
import { Modal } from ".";
|
|
3
|
+
declare const _default: import("@storybook/types").ComponentAnnotations<import("@storybook/react").ReactRenderer, import(".").TModalControlProps>;
|
|
4
|
+
export default _default;
|
|
5
|
+
type Story = StoryObj<typeof Modal.Control>;
|
|
6
|
+
export declare const GeneralUsage: Story;
|
|
7
|
+
export declare const MultipleModals: Story;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { TButtonProps } from "../Button";
|
|
3
|
+
export type TUseModalProps = {
|
|
4
|
+
activeModal: string;
|
|
5
|
+
isOpen: boolean;
|
|
6
|
+
open: (value: string) => void;
|
|
7
|
+
close: () => void;
|
|
8
|
+
};
|
|
9
|
+
export declare const useModal: import("zustand").UseBoundStore<import("zustand").StoreApi<TUseModalProps>>;
|
|
10
|
+
export type TModalContentProps = {
|
|
11
|
+
children: React.ReactNode;
|
|
12
|
+
value: string;
|
|
13
|
+
};
|
|
14
|
+
export type TModalControlProps = {
|
|
15
|
+
children: React.ReactNode;
|
|
16
|
+
value: string;
|
|
17
|
+
} & TButtonProps;
|
|
18
|
+
export type TModalHeaderProps = {
|
|
19
|
+
title: string;
|
|
20
|
+
};
|
|
21
|
+
export declare const Modal: {
|
|
22
|
+
Content: ({ value, children }: TModalContentProps) => React.ReactPortal;
|
|
23
|
+
Control: ({ value, children, ...rest }: TModalControlProps) => React.JSX.Element;
|
|
24
|
+
Header: ({ title }: TModalHeaderProps) => React.JSX.Element;
|
|
25
|
+
};
|
|
@@ -4,7 +4,7 @@ import { NumberField } from ".";
|
|
|
4
4
|
declare const _default: import("@storybook/types").ComponentAnnotations<import("@storybook/react").ReactRenderer, import(".").TNumberFieldProps<import("react-hook-form").FieldValues>>;
|
|
5
5
|
export default _default;
|
|
6
6
|
type Story = StoryObj<typeof NumberField>;
|
|
7
|
-
export declare const
|
|
7
|
+
export declare const GeneralUsage: Story;
|
|
8
8
|
export declare const Error: {
|
|
9
9
|
render: () => React.JSX.Element;
|
|
10
10
|
};
|
|
@@ -3,5 +3,5 @@ import { ProgressIndicator } from ".";
|
|
|
3
3
|
declare const _default: import("@storybook/types").ComponentAnnotations<import("@storybook/react").ReactRenderer, import(".").TProgressIndicatorProps>;
|
|
4
4
|
export default _default;
|
|
5
5
|
type Story = StoryObj<typeof ProgressIndicator>;
|
|
6
|
-
export declare const
|
|
6
|
+
export declare const GeneralUsage: Story;
|
|
7
7
|
export declare const Size: Story;
|
|
@@ -2,7 +2,7 @@ import React from "react";
|
|
|
2
2
|
export type TProgressIndicatorProps = {
|
|
3
3
|
label?: string;
|
|
4
4
|
size?: "small" | "medium" | "full-width";
|
|
5
|
-
current
|
|
6
|
-
max
|
|
5
|
+
current?: number;
|
|
6
|
+
max?: number;
|
|
7
7
|
};
|
|
8
8
|
export declare const ProgressIndicator: ({ label, size, current, max, }: TProgressIndicatorProps) => React.JSX.Element;
|
|
@@ -7,5 +7,5 @@ declare const _default: import("@storybook/types").ComponentAnnotations<import("
|
|
|
7
7
|
} & Omit<import("@radix-ui/react-radio-group").RadioGroupProps, "name">>;
|
|
8
8
|
export default _default;
|
|
9
9
|
type Story = StoryObj<typeof RadioGroup.Root>;
|
|
10
|
-
export declare const
|
|
10
|
+
export declare const GeneralUsage: Story;
|
|
11
11
|
export declare const Error: Story;
|
|
@@ -3,6 +3,6 @@ import { Range } from ".";
|
|
|
3
3
|
declare const _default: import("@storybook/types").ComponentAnnotations<import("@storybook/react").ReactRenderer, import(".").TRangeProps<import("react-hook-form").FieldValues>>;
|
|
4
4
|
export default _default;
|
|
5
5
|
type Story = StoryObj<typeof Range>;
|
|
6
|
-
export declare const
|
|
7
|
-
export declare const
|
|
6
|
+
export declare const GeneralUsage: Story;
|
|
7
|
+
export declare const Labels: Story;
|
|
8
8
|
export declare const Helper: Story;
|
|
@@ -3,5 +3,5 @@ import { Select } from ".";
|
|
|
3
3
|
declare const _default: import("@storybook/types").ComponentAnnotations<import("@storybook/react").ReactRenderer, import(".").TSelectProps<import("react-hook-form").FieldValues>>;
|
|
4
4
|
export default _default;
|
|
5
5
|
type Story = StoryObj<typeof Select>;
|
|
6
|
-
export declare const
|
|
7
|
-
export declare const
|
|
6
|
+
export declare const GeneralUsage: Story;
|
|
7
|
+
export declare const Labeling: Story;
|
|
@@ -3,7 +3,7 @@ import { TextField } from ".";
|
|
|
3
3
|
declare const _default: import("@storybook/types").ComponentAnnotations<import("@storybook/react").ReactRenderer, import(".").TTextFieldProps<import("react-hook-form").FieldValues>>;
|
|
4
4
|
export default _default;
|
|
5
5
|
type Story = StoryObj<typeof TextField>;
|
|
6
|
-
export declare const
|
|
6
|
+
export declare const GeneralUsage: Story;
|
|
7
7
|
export declare const Error: Story;
|
|
8
8
|
export declare const HelperText: Story;
|
|
9
9
|
export declare const RightContent: Story;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { StoryObj } from "@storybook/react";
|
|
2
|
+
import { Toast } from ".";
|
|
3
|
+
declare const _default: import("@storybook/types").ComponentAnnotations<import("@storybook/react").ReactRenderer, import(".").TToastRootProps>;
|
|
4
|
+
export default _default;
|
|
5
|
+
type Story = StoryObj<typeof Toast>;
|
|
6
|
+
export declare const GeneralUsage: Story;
|
|
7
|
+
export declare const Variants: Story;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
export type TToastRootProps = {
|
|
3
|
+
children: React.ReactNode;
|
|
4
|
+
};
|
|
5
|
+
export type TToastTitleProps = {
|
|
6
|
+
className?: string;
|
|
7
|
+
children: React.ReactNode;
|
|
8
|
+
};
|
|
9
|
+
export type TToastDescriptionProps = {
|
|
10
|
+
children: React.ReactNode;
|
|
11
|
+
};
|
|
12
|
+
export declare const Toast: {
|
|
13
|
+
Root: ({ children }: TToastRootProps) => React.JSX.Element;
|
|
14
|
+
Title: ({ className, children }: TToastTitleProps) => React.JSX.Element;
|
|
15
|
+
Description: ({ children }: TToastDescriptionProps) => React.JSX.Element;
|
|
16
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { StoryObj } from "@storybook/react";
|
|
2
|
+
import { Tooltip } from ".";
|
|
3
|
+
declare const _default: import("@storybook/types").ComponentAnnotations<import("@storybook/react").ReactRenderer, import("@radix-ui/react-tooltip").TooltipProps>;
|
|
4
|
+
export default _default;
|
|
5
|
+
type Story = StoryObj<typeof Tooltip>;
|
|
6
|
+
export declare const GeneralUsage: Story;
|
|
7
|
+
export declare const OpenByDefault: Story;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import * as RadixTooltip from "@radix-ui/react-tooltip";
|
|
3
|
+
export type TTooltipRootProps = React.ComponentProps<typeof RadixTooltip.Root>;
|
|
4
|
+
export type TTooltipTriggerProps = React.ComponentProps<typeof RadixTooltip.Trigger>;
|
|
5
|
+
export type TTooltipContentProps = React.ComponentProps<typeof RadixTooltip.Content>;
|
|
6
|
+
export declare const Tooltip: {
|
|
7
|
+
Root: ({ children, ...rest }: TTooltipRootProps) => React.JSX.Element;
|
|
8
|
+
Trigger: ({ className, children, ...rest }: TTooltipTriggerProps) => React.JSX.Element;
|
|
9
|
+
Content: ({ className, children, ...rest }: TTooltipContentProps) => React.JSX.Element;
|
|
10
|
+
};
|
|
@@ -8,7 +8,7 @@ declare const _default: import("@storybook/types").ComponentAnnotations<import("
|
|
|
8
8
|
} & Omit<any, "ref">>;
|
|
9
9
|
export default _default;
|
|
10
10
|
type Story = StoryObj<typeof Typography>;
|
|
11
|
-
export declare const
|
|
11
|
+
export declare const GeneralUsage: Story;
|
|
12
12
|
export declare const Variants: Story;
|
|
13
13
|
export declare const Polymorphic: Story;
|
|
14
14
|
export declare const DangerousHTML: Story;
|
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
export * from "./Button";
|
|
2
|
+
export * from './Callout';
|
|
2
3
|
export * from "./Columns";
|
|
3
4
|
export * from "./DatePicker";
|
|
4
5
|
export * from "./Disclosure";
|
|
5
6
|
export * from "./Form";
|
|
7
|
+
export * from "./Loading";
|
|
8
|
+
export * from "./Modal";
|
|
6
9
|
export * from "./NumberField";
|
|
10
|
+
export * from "./ProgressIndicator";
|
|
7
11
|
export * from "./RadioGroup";
|
|
8
12
|
export * from "./Range";
|
|
9
13
|
export * from "./Select";
|
|
10
14
|
export * from './TextField';
|
|
15
|
+
export * from "./Toast";
|
|
16
|
+
export * from './Tooltip';
|
|
11
17
|
export * from './Typography';
|
|
12
|
-
export * from './Callout';
|
package/dist/styles/global.css
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
|
|
2
2
|
/* Import all tokens from each section of Design System */
|
|
3
3
|
@import "./tokens/index.css";
|
|
4
|
+
@import "../product/components/Toast/toast-base.css";
|
|
4
5
|
|
|
5
6
|
* {
|
|
6
7
|
box-sizing: border-box;
|
|
@@ -18,3 +19,6 @@
|
|
|
18
19
|
white-space: nowrap;
|
|
19
20
|
width: 1px;
|
|
20
21
|
}
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
package/dist/types.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import React$1, { PropsWithChildren, HTMLProps, ReactNode, DetailedHTMLProps, InputHTMLAttributes } from 'react';
|
|
2
|
+
import { MaterialSymbolProps } from 'react-material-symbols';
|
|
2
3
|
import { FieldValues, Path, UseFormReturn, FieldError } from 'react-hook-form';
|
|
4
|
+
import * as zustand from 'zustand';
|
|
3
5
|
import * as RadixRadioGroup from '@radix-ui/react-radio-group';
|
|
4
|
-
import
|
|
6
|
+
import * as RadixTooltip from '@radix-ui/react-tooltip';
|
|
5
7
|
|
|
6
8
|
type Merge<T, U> = Omit<T, keyof U> & U;
|
|
7
9
|
type PropsWithAs<P, T extends React.ElementType> = P & {
|
|
@@ -15,17 +17,62 @@ type TButtonDefaultProps = {
|
|
|
15
17
|
variant?: "primary" | "secondary" | "tertiary" | "ghost" | "danger";
|
|
16
18
|
};
|
|
17
19
|
type TActionButtonProps = {
|
|
20
|
+
/**
|
|
21
|
+
* The size changing variant of the button.
|
|
22
|
+
*/
|
|
18
23
|
visualType?: "action";
|
|
24
|
+
/**
|
|
25
|
+
* The colour changing variant of the button.
|
|
26
|
+
*/
|
|
19
27
|
variant?: "standard" | "secondary" | "tertiary" | "ghost" | "danger";
|
|
20
28
|
};
|
|
21
|
-
type
|
|
29
|
+
type TTextButtonProps = {
|
|
30
|
+
visualType?: "text";
|
|
31
|
+
variant?: "primary" | "secondary";
|
|
32
|
+
};
|
|
33
|
+
type ConditionalProps = TButtonDefaultProps | TActionButtonProps | TTextButtonProps;
|
|
22
34
|
interface IButtonOwnProps extends React$1.ButtonHTMLAttributes<HTMLButtonElement>, PropsWithChildren {
|
|
35
|
+
/**
|
|
36
|
+
* Polymorphic prop to define the element type of the button, currently
|
|
37
|
+
* we only support 2 types: button and span.
|
|
38
|
+
*/
|
|
23
39
|
as?: "button" | "span";
|
|
40
|
+
/**
|
|
41
|
+
* Appends the className to the button element.
|
|
42
|
+
*/
|
|
24
43
|
className?: string;
|
|
44
|
+
/**
|
|
45
|
+
* To be used when the contents of the button is only an icon this props
|
|
46
|
+
* will correct the padding as the padding is different to a button that includes text.
|
|
47
|
+
*/
|
|
25
48
|
onlyIcon?: boolean;
|
|
26
49
|
}
|
|
27
|
-
type
|
|
28
|
-
declare function Button<T extends React$1.ElementType = typeof defaultElement>({ as, children, variant, className, visualType, onlyIcon, ...rest }:
|
|
50
|
+
type TButtonProps<T extends React$1.ElementType = typeof defaultElement> = PolymorphicPropsWithoutRef<IButtonOwnProps, T> & ConditionalProps;
|
|
51
|
+
declare function Button<T extends React$1.ElementType = typeof defaultElement>({ as, children, variant, className, visualType, onlyIcon, ...rest }: TButtonProps<T>): React$1.JSX.Element;
|
|
52
|
+
|
|
53
|
+
type TIconProps = {
|
|
54
|
+
size?: "regular" | "large" | "xlarge";
|
|
55
|
+
weight?: "light" | "normal" | "medium";
|
|
56
|
+
} & Omit<MaterialSymbolProps, "size" | "weight">;
|
|
57
|
+
declare const Icon: ({ size, weight, ...rest }: TIconProps) => React$1.JSX.Element;
|
|
58
|
+
|
|
59
|
+
type TTypographyProps<C extends React$1.ElementType = 'p'> = {
|
|
60
|
+
as?: C;
|
|
61
|
+
variant?: 'form-label' | 'form-helper' | 'form-button' | 'form-input-normal' | 'form-input-semi-bold' | 'content-regular-light' | 'content-regular' | 'content-regular-semi-bold' | 'content-large-light' | 'content-large' | 'content-large-semi-bold' | 'content-title-light' | 'content-title' | 'content-title-semi-bold';
|
|
62
|
+
children?: React$1.ReactNode;
|
|
63
|
+
} & React$1.ComponentPropsWithoutRef<C>;
|
|
64
|
+
declare const Typography: <C extends React$1.ElementType<any, keyof React$1.JSX.IntrinsicElements> = "p">({ as, variant, children, className, ...rest }: TTypographyProps<C>) => React$1.JSX.Element;
|
|
65
|
+
|
|
66
|
+
type TCalloutRootProps = {
|
|
67
|
+
type?: "info" | "warning" | "error";
|
|
68
|
+
};
|
|
69
|
+
type TCalloutIconProps = TIconProps;
|
|
70
|
+
type TCalloutTextProps = TTypographyProps<"p">;
|
|
71
|
+
declare const Callout: {
|
|
72
|
+
Root: ({ type, children, }: PropsWithChildren<TCalloutRootProps>) => React$1.JSX.Element;
|
|
73
|
+
Icon: (props: TIconProps) => React$1.JSX.Element;
|
|
74
|
+
Text: ({ children, ...props }: PropsWithChildren<TCalloutTextProps>) => React$1.JSX.Element;
|
|
75
|
+
};
|
|
29
76
|
|
|
30
77
|
type TColumnsProps = {
|
|
31
78
|
cols: number;
|
|
@@ -55,6 +102,41 @@ type TFormProps<T extends FieldValues> = PropsWithChildren<HTMLProps<HTMLFormEle
|
|
|
55
102
|
};
|
|
56
103
|
declare const Form: <T extends FieldValues>({ methods, children, onSubmit, ...rest }: TFormProps<T>) => React$1.JSX.Element;
|
|
57
104
|
|
|
105
|
+
declare const sizes: {
|
|
106
|
+
small: string;
|
|
107
|
+
medium: string;
|
|
108
|
+
large: string;
|
|
109
|
+
full: string;
|
|
110
|
+
};
|
|
111
|
+
type TLoadingProps = {
|
|
112
|
+
size?: keyof typeof sizes;
|
|
113
|
+
};
|
|
114
|
+
declare const Loading: ({ size }: TLoadingProps) => React$1.JSX.Element;
|
|
115
|
+
|
|
116
|
+
type TUseModalProps = {
|
|
117
|
+
activeModal: string;
|
|
118
|
+
isOpen: boolean;
|
|
119
|
+
open: (value: string) => void;
|
|
120
|
+
close: () => void;
|
|
121
|
+
};
|
|
122
|
+
declare const useModal: zustand.UseBoundStore<zustand.StoreApi<TUseModalProps>>;
|
|
123
|
+
type TModalContentProps = {
|
|
124
|
+
children: React$1.ReactNode;
|
|
125
|
+
value: string;
|
|
126
|
+
};
|
|
127
|
+
type TModalControlProps = {
|
|
128
|
+
children: React$1.ReactNode;
|
|
129
|
+
value: string;
|
|
130
|
+
} & TButtonProps;
|
|
131
|
+
type TModalHeaderProps = {
|
|
132
|
+
title: string;
|
|
133
|
+
};
|
|
134
|
+
declare const Modal: {
|
|
135
|
+
Content: ({ value, children }: TModalContentProps) => React$1.ReactPortal;
|
|
136
|
+
Control: ({ value, children, ...rest }: TModalControlProps) => React$1.JSX.Element;
|
|
137
|
+
Header: ({ title }: TModalHeaderProps) => React$1.JSX.Element;
|
|
138
|
+
};
|
|
139
|
+
|
|
58
140
|
type TNumberFieldProps<T extends FieldValues> = {
|
|
59
141
|
id: string;
|
|
60
142
|
label: string;
|
|
@@ -68,6 +150,14 @@ type TNumberFieldProps<T extends FieldValues> = {
|
|
|
68
150
|
};
|
|
69
151
|
declare const NumberField: <T extends FieldValues>(props: TNumberFieldProps<T>) => React$1.JSX.Element;
|
|
70
152
|
|
|
153
|
+
type TProgressIndicatorProps = {
|
|
154
|
+
label?: string;
|
|
155
|
+
size?: "small" | "medium" | "full-width";
|
|
156
|
+
current?: number;
|
|
157
|
+
max?: number;
|
|
158
|
+
};
|
|
159
|
+
declare const ProgressIndicator: ({ label, size, current, max, }: TProgressIndicatorProps) => React$1.JSX.Element;
|
|
160
|
+
|
|
71
161
|
type TRadioGroupProps<T extends FieldValues> = {
|
|
72
162
|
name: Path<T>;
|
|
73
163
|
label: string;
|
|
@@ -130,28 +220,29 @@ type TTextFieldProps<T extends FieldValues> = {
|
|
|
130
220
|
};
|
|
131
221
|
declare const TextField: <T extends FieldValues>(props: TTextFieldProps<T>) => React$1.JSX.Element;
|
|
132
222
|
|
|
133
|
-
type
|
|
134
|
-
|
|
135
|
-
variant?: 'form-label' | 'form-helper' | 'form-button' | 'form-input-normal' | 'form-input-semi-bold' | 'content-regular-light' | 'content-regular' | 'content-regular-semi-bold' | 'content-large-light' | 'content-large' | 'content-large-semi-bold' | 'content-title-light' | 'content-title' | 'content-title-semi-bold';
|
|
136
|
-
children?: React$1.ReactNode;
|
|
137
|
-
} & React$1.ComponentPropsWithoutRef<C>;
|
|
138
|
-
declare const Typography: <C extends React$1.ElementType<any, keyof React$1.JSX.IntrinsicElements> = "p">({ as, variant, children, className, ...rest }: TTypographyProps<C>) => React$1.JSX.Element;
|
|
139
|
-
|
|
140
|
-
type TIconProps = {
|
|
141
|
-
size?: "regular" | "large" | "xlarge";
|
|
142
|
-
weight?: "light" | "normal" | "medium";
|
|
143
|
-
} & Omit<MaterialSymbolProps, "size" | "weight">;
|
|
144
|
-
declare const Icon: ({ size, weight, ...rest }: TIconProps) => React$1.JSX.Element;
|
|
145
|
-
|
|
146
|
-
type TCalloutRootProps = {
|
|
147
|
-
type?: "info" | "warning" | "error";
|
|
223
|
+
type TToastRootProps = {
|
|
224
|
+
children: React$1.ReactNode;
|
|
148
225
|
};
|
|
149
|
-
type
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
226
|
+
type TToastTitleProps = {
|
|
227
|
+
className?: string;
|
|
228
|
+
children: React$1.ReactNode;
|
|
229
|
+
};
|
|
230
|
+
type TToastDescriptionProps = {
|
|
231
|
+
children: React$1.ReactNode;
|
|
232
|
+
};
|
|
233
|
+
declare const Toast: {
|
|
234
|
+
Root: ({ children }: TToastRootProps) => React$1.JSX.Element;
|
|
235
|
+
Title: ({ className, children }: TToastTitleProps) => React$1.JSX.Element;
|
|
236
|
+
Description: ({ children }: TToastDescriptionProps) => React$1.JSX.Element;
|
|
237
|
+
};
|
|
238
|
+
|
|
239
|
+
type TTooltipRootProps = React$1.ComponentProps<typeof RadixTooltip.Root>;
|
|
240
|
+
type TTooltipTriggerProps = React$1.ComponentProps<typeof RadixTooltip.Trigger>;
|
|
241
|
+
type TTooltipContentProps = React$1.ComponentProps<typeof RadixTooltip.Content>;
|
|
242
|
+
declare const Tooltip: {
|
|
243
|
+
Root: ({ children, ...rest }: TTooltipRootProps) => React$1.JSX.Element;
|
|
244
|
+
Trigger: ({ className, children, ...rest }: TTooltipTriggerProps) => React$1.JSX.Element;
|
|
245
|
+
Content: ({ className, children, ...rest }: TTooltipContentProps) => React$1.JSX.Element;
|
|
155
246
|
};
|
|
156
247
|
|
|
157
|
-
export { Button, Callout, Columns, DatePicker, Disclosure, Form, type IButtonOwnProps,
|
|
248
|
+
export { Button, Callout, Columns, DatePicker, Disclosure, Form, type IButtonOwnProps, Icon, Loading, Modal, NumberField, ProgressIndicator, RadioGroup, Range, Select, type TActionButtonProps, type TButtonDefaultProps, type TButtonProps, type TCalloutIconProps, type TCalloutRootProps, type TCalloutTextProps, type TColumnsProps, type TDatePicker, type TDisclosureProps, type TIconProps, type TItem, type TLoadingProps, type TModalContentProps, type TModalControlProps, type TModalHeaderProps, type TNumberFieldProps, type TProgressIndicatorProps, type TRadioGroupProps, type TRangeProps, type TSelectProps, type TTextButtonProps, type TTextFieldProps, type TToastDescriptionProps, type TToastRootProps, type TToastTitleProps, type TTooltipContentProps, type TTooltipRootProps, type TTooltipTriggerProps, type TTypographyProps, type TUseModalProps, TextField, Toast, Tooltip, Typography, useModal };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kroo-web/design-system",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.41",
|
|
4
4
|
"description": "Web design system for Kroo including the components for the marketing site and the product side.",
|
|
5
5
|
"main": "dist/cjs/index.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -58,21 +58,24 @@
|
|
|
58
58
|
"rollup-plugin-postcss": "^4.0.2",
|
|
59
59
|
"storybook": "^7.6.17",
|
|
60
60
|
"typescript": "^5.4.2",
|
|
61
|
-
"vitest": "^1.3.1"
|
|
61
|
+
"vitest": "^1.3.1",
|
|
62
|
+
"zod": "^3.22.4"
|
|
62
63
|
},
|
|
63
64
|
"dependencies": {
|
|
64
65
|
"@radix-ui/react-radio-group": "^1.1.3",
|
|
66
|
+
"@radix-ui/react-tooltip": "^1.0.7",
|
|
65
67
|
"clsx": "^2.1.0",
|
|
66
68
|
"downshift": "^8.5.0",
|
|
67
69
|
"framer-motion": "^11.0.8",
|
|
68
70
|
"postcss": "^8.4.35",
|
|
69
71
|
"react-material-symbols": "^4.4.0",
|
|
70
|
-
"
|
|
72
|
+
"zustand": "^4.5.2"
|
|
71
73
|
},
|
|
72
74
|
"peerDependencies": {
|
|
73
|
-
"react-hook-form": "^7.51.0",
|
|
74
75
|
"@hookform/resolvers": "^3.3.4",
|
|
75
76
|
"react": "^18.0.0",
|
|
76
|
-
"react-dom": "^18.0.0"
|
|
77
|
+
"react-dom": "^18.0.0",
|
|
78
|
+
"react-hook-form": "^7.51.0",
|
|
79
|
+
"react-toastify": "^10.0.5"
|
|
77
80
|
}
|
|
78
81
|
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|