ingred-ui 23.2.2 → 23.3.0

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,12 +1,4 @@
1
1
  import * as React from "react";
2
- import * as Styled from "./styled";
3
- export type BadgeColor = "primary" | "secondary" | "success" | "warning" | "danger" | "basic";
4
- export type BadgeProps = React.ComponentPropsWithoutRef<"a" | "span"> & {
5
- color: BadgeColor;
6
- type?: Styled.BadgeType;
7
- fontSize?: string;
8
- fontWeight?: string;
9
- component?: "span" | "a";
10
- };
2
+ import { BadgeProps } from "./types";
11
3
  declare const Badge: React.ForwardRefExoticComponent<BadgeProps & React.RefAttributes<HTMLSpanElement | HTMLAnchorElement>>;
12
4
  export default Badge;
@@ -3,20 +3,37 @@ import { StoryObj } from "@storybook/react";
3
3
  import Badge from "./Badge";
4
4
  declare const _default: {
5
5
  title: string;
6
- components: React.ForwardRefExoticComponent<import("./Badge").BadgeProps & React.RefAttributes<HTMLSpanElement | HTMLAnchorElement>>;
6
+ components: React.ForwardRefExoticComponent<import("./types").BadgeProps & React.RefAttributes<HTMLSpanElement | HTMLAnchorElement>>;
7
7
  parameters: {
8
8
  docs: {
9
9
  source: {
10
10
  language: string;
11
11
  };
12
12
  page: () => JSX.Element;
13
+ description: {
14
+ component: string;
15
+ };
16
+ };
17
+ };
18
+ argTypes: {
19
+ color: {
20
+ control: {
21
+ type: string;
22
+ };
23
+ options: string[];
24
+ };
25
+ size: {
26
+ control: {
27
+ type: string;
28
+ };
29
+ options: string[];
13
30
  };
14
31
  };
15
32
  };
16
33
  export default _default;
17
- export declare const Primary: StoryObj<typeof Badge>;
18
- export declare const Secondary: StoryObj<typeof Badge>;
19
- export declare const Success: StoryObj<typeof Badge>;
20
- export declare const Warning: StoryObj<typeof Badge>;
21
- export declare const Danger: StoryObj<typeof Badge>;
22
- export declare const Basic: StoryObj<typeof Badge>;
34
+ export declare const Normal: StoryObj<typeof Badge>;
35
+ export declare const NormalWithIcon: StoryObj<typeof Badge>;
36
+ export declare const Pill: StoryObj<typeof Badge>;
37
+ export declare const Signal: StoryObj<typeof Badge>;
38
+ export declare const SizesComparison: StoryObj<typeof Badge>;
39
+ export declare const ColorVariations: StoryObj<typeof Badge>;
@@ -1,2 +1,2 @@
1
1
  export { default } from "./Badge";
2
- export type { BadgeProps } from "./Badge";
2
+ export type { BadgeProps, BadgeColor, BadgeType, BadgeSize } from "./types";
@@ -1,10 +1,25 @@
1
- export type BadgeType = "normal" | "pill";
2
- type Props = {
1
+ import { BadgeSize } from "./types";
2
+ export declare const NormalBadge: import("styled-components").StyledComponent<"span", import("styled-components").DefaultTheme, {
3
3
  color: string;
4
4
  backgroundColor: string;
5
- type: BadgeType;
6
- fontSize: string;
7
- fontWeight: string;
8
- };
9
- export declare const Container: import("styled-components").StyledComponent<"span", import("styled-components").DefaultTheme, Props, never>;
10
- export {};
5
+ size?: BadgeSize | undefined;
6
+ fontSize?: string | undefined;
7
+ fontWeight?: string | undefined;
8
+ }, never>;
9
+ export declare const PillBadge: import("styled-components").StyledComponent<"span", import("styled-components").DefaultTheme, {
10
+ color: string;
11
+ backgroundColor: string;
12
+ size?: BadgeSize | undefined;
13
+ fontSize?: string | undefined;
14
+ fontWeight?: string | undefined;
15
+ }, never>;
16
+ export declare const SignalWrapper: import("styled-components").StyledComponent<"span", import("styled-components").DefaultTheme, {
17
+ size?: BadgeSize | undefined;
18
+ fontSize?: string | undefined;
19
+ fontWeight?: string | undefined;
20
+ }, never>;
21
+ export declare const SignalDot: import("styled-components").StyledComponent<"span", import("styled-components").DefaultTheme, {
22
+ backgroundColor: string;
23
+ size?: BadgeSize | undefined;
24
+ }, never>;
25
+ export declare const Icon: import("styled-components").StyledComponent<"span", import("styled-components").DefaultTheme, {}, never>;
@@ -0,0 +1,118 @@
1
+ import React from "react";
2
+ import { Theme } from "../../themes";
3
+ export type BadgeColor = "primary" | "secondary" | "success" | "warning" | "danger" | "basic";
4
+ export type BadgeType = "normal" | "pill" | "signal";
5
+ export type BadgeSize = "medium" | "small";
6
+ export declare const BADGE_SIZE: {
7
+ small: {
8
+ iconSize: number;
9
+ height: string;
10
+ pillHeight: string;
11
+ gap: string;
12
+ padding: (theme: Theme) => string;
13
+ signalPadding: (theme: Theme) => string;
14
+ signalGap: (theme: Theme) => string;
15
+ dotSize: string;
16
+ fontSize: string;
17
+ };
18
+ medium: {
19
+ iconSize: number;
20
+ height: string;
21
+ pillHeight: string;
22
+ gap: string;
23
+ padding: (theme: Theme) => string;
24
+ signalPadding: (theme: Theme) => string;
25
+ signalGap: (theme: Theme) => string;
26
+ dotSize: string;
27
+ fontSize: string;
28
+ };
29
+ };
30
+ export declare const BACKGROUND_COLOR_MAP: {
31
+ normal: {
32
+ primary: (theme: Theme) => string;
33
+ secondary: (theme: Theme) => string;
34
+ success: (theme: Theme) => string;
35
+ warning: (theme: Theme) => string;
36
+ danger: (theme: Theme) => string;
37
+ basic: (theme: Theme) => string;
38
+ };
39
+ pill: {
40
+ primary: (theme: Theme) => string;
41
+ secondary: (theme: Theme) => string;
42
+ success: (theme: Theme) => string;
43
+ warning: (theme: Theme) => string;
44
+ danger: (theme: Theme) => string;
45
+ basic: (theme: Theme) => string;
46
+ };
47
+ signal: {
48
+ primary: (theme: Theme) => string;
49
+ secondary: (theme: Theme) => string;
50
+ success: (theme: Theme) => string;
51
+ warning: (theme: Theme) => string;
52
+ danger: (theme: Theme) => string;
53
+ basic: (theme: Theme) => string;
54
+ };
55
+ };
56
+ export declare const TEXT_COLOR_MAP: {
57
+ normal: {
58
+ primary: (theme: Theme) => string;
59
+ secondary: (theme: Theme) => string;
60
+ success: (theme: Theme) => string;
61
+ warning: (theme: Theme) => string;
62
+ danger: (theme: Theme) => string;
63
+ basic: (theme: Theme) => string;
64
+ };
65
+ pill: {
66
+ primary: (theme: Theme) => string;
67
+ secondary: (theme: Theme) => string;
68
+ success: (theme: Theme) => string;
69
+ warning: (theme: Theme) => string;
70
+ danger: (theme: Theme) => string;
71
+ basic: (theme: Theme) => string;
72
+ };
73
+ signal: {
74
+ primary: (theme: Theme) => string;
75
+ secondary: (theme: Theme) => string;
76
+ success: (theme: Theme) => string;
77
+ warning: (theme: Theme) => string;
78
+ danger: (theme: Theme) => string;
79
+ basic: (theme: Theme) => string;
80
+ };
81
+ };
82
+ export declare const getBackgroundColor: (key: BadgeColor, theme: Theme, type: BadgeType) => string;
83
+ export declare const getTextColor: (key: BadgeColor, theme: Theme, type: BadgeType) => string;
84
+ export type BadgeProps = React.ComponentPropsWithoutRef<"a" | "span"> & {
85
+ /**
86
+ * バッジの色
87
+ */
88
+ color: BadgeColor;
89
+ /**
90
+ * バッジのタイプ
91
+ * @default "normal"
92
+ */
93
+ type?: BadgeType;
94
+ /**
95
+ * フォントサイズ
96
+ * @default "13px"
97
+ */
98
+ fontSize?: string;
99
+ /**
100
+ * フォントの太さ
101
+ * @default "normal"
102
+ */
103
+ fontWeight?: string;
104
+ /**
105
+ * 使用するHTML要素
106
+ * @default "span"
107
+ */
108
+ component?: "span" | "a";
109
+ /**
110
+ * バッジのサイズ
111
+ * @default "medium"
112
+ */
113
+ size?: BadgeSize;
114
+ /**
115
+ * アイコン要素
116
+ */
117
+ icon?: React.ReactNode;
118
+ };
@@ -0,0 +1,10 @@
1
+ import * as React from "react";
2
+ declare const Banner: React.ForwardRefExoticComponent<{
3
+ type?: import("./types").BannerType | undefined;
4
+ size?: import("./types").BannerSize | undefined;
5
+ message?: React.ReactNode;
6
+ children?: React.ReactNode;
7
+ className?: string | undefined;
8
+ onClose?: (() => void) | undefined;
9
+ } & React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
10
+ export default Banner;
@@ -0,0 +1,79 @@
1
+ import React from "react";
2
+ import { StoryObj } from "@storybook/react";
3
+ import { BannerProps } from "./types";
4
+ declare const _default: {
5
+ title: string;
6
+ component: React.ForwardRefExoticComponent<{
7
+ type?: import("./types").BannerType | undefined;
8
+ size?: import("./types").BannerSize | undefined;
9
+ message?: React.ReactNode;
10
+ children?: React.ReactNode;
11
+ className?: string | undefined;
12
+ onClose?: (() => void) | undefined;
13
+ } & React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
14
+ parameters: {
15
+ docs: {
16
+ description: {
17
+ component: string;
18
+ };
19
+ };
20
+ };
21
+ argTypes: {
22
+ type: {
23
+ description: string;
24
+ control: {
25
+ type: string;
26
+ options: string[];
27
+ };
28
+ table: {
29
+ type: {
30
+ summary: string;
31
+ };
32
+ defaultValue: {
33
+ summary: string;
34
+ };
35
+ };
36
+ };
37
+ size: {
38
+ description: string;
39
+ control: {
40
+ type: string;
41
+ options: string[];
42
+ };
43
+ table: {
44
+ type: {
45
+ summary: string;
46
+ };
47
+ defaultValue: {
48
+ summary: string;
49
+ };
50
+ };
51
+ };
52
+ message: {
53
+ description: string;
54
+ control: {
55
+ type: string;
56
+ };
57
+ };
58
+ children: {
59
+ description: string;
60
+ };
61
+ className: {
62
+ description: string;
63
+ };
64
+ onClose: {
65
+ description: string;
66
+ action: string;
67
+ };
68
+ };
69
+ };
70
+ export default _default;
71
+ export declare const Info: StoryObj<BannerProps>;
72
+ export declare const Warning: StoryObj<BannerProps>;
73
+ export declare const Error: StoryObj<BannerProps>;
74
+ export declare const Small: StoryObj<BannerProps>;
75
+ export declare const Medium: StoryObj<BannerProps>;
76
+ export declare const ClosableDemo: StoryObj<BannerProps>;
77
+ export declare const WithImage: StoryObj<BannerProps>;
78
+ export declare const RichContent: StoryObj<BannerProps>;
79
+ export declare const AllVariants: StoryObj;
@@ -0,0 +1 @@
1
+ import "@testing-library/jest-dom";
@@ -0,0 +1,2 @@
1
+ export { default } from "./Banner";
2
+ export type { BannerProps, BannerType, BannerSize } from "./types";
@@ -0,0 +1,12 @@
1
+ import { BannerType, BannerSize } from "./types";
2
+ type ContainerProps = {
3
+ type: BannerType;
4
+ size: BannerSize;
5
+ };
6
+ type ContentWrapperProps = {
7
+ size: BannerSize;
8
+ };
9
+ export declare const Container: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, ContainerProps, never>;
10
+ export declare const ContentWrapper: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, ContentWrapperProps, never>;
11
+ export declare const CloseButton: import("styled-components").StyledComponent<"button", import("styled-components").DefaultTheme, {}, never>;
12
+ export {};
@@ -0,0 +1,42 @@
1
+ import * as React from "react";
2
+ /**
3
+ * バナーのタイプを定義します
4
+ * info: 情報提供用
5
+ * warning: 警告用
6
+ * error: エラー用
7
+ */
8
+ export type BannerType = "info" | "warning" | "error";
9
+ /**
10
+ * バナーのサイズを定義します
11
+ * small: 小さいサイズ
12
+ * medium: 中サイズ(デフォルト)
13
+ */
14
+ export type BannerSize = "small" | "medium";
15
+ export type BannerProps = {
16
+ /**
17
+ * バナーのタイプ
18
+ * @default "info"
19
+ */
20
+ type?: BannerType;
21
+ /**
22
+ * バナーのサイズ
23
+ * @default "medium"
24
+ */
25
+ size?: BannerSize;
26
+ /**
27
+ * バナーに表示するメッセージ(childrenと併用する場合はこちらが優先されます)
28
+ */
29
+ message?: React.ReactNode;
30
+ /**
31
+ * バナーの内容(messageと併用する場合はmessageが優先されます)
32
+ */
33
+ children?: React.ReactNode;
34
+ /**
35
+ * 追加のCSSクラス
36
+ */
37
+ className?: string;
38
+ /**
39
+ * 閉じるボタンがクリックされたときのコールバック関数
40
+ */
41
+ onClose?: () => void;
42
+ } & React.HTMLAttributes<HTMLDivElement>;
@@ -1,10 +1,45 @@
1
1
  import * as React from "react";
2
2
  import { Property } from "csstype";
3
+ import { InputSize, InputVariant } from "./types";
3
4
  export type InputProps = (React.ComponentPropsWithoutRef<"input"> | React.ComponentPropsWithoutRef<"textarea">) & {
5
+ /**
6
+ * 入力タイプ
7
+ */
4
8
  type?: string;
9
+ /**
10
+ * エラー状態
11
+ * @default false
12
+ */
5
13
  error?: boolean;
14
+ /**
15
+ * マルチライン入力(テキストエリア)
16
+ * @default false
17
+ */
6
18
  multiline?: boolean;
19
+ /**
20
+ * テキストエリアのリサイズ設定
21
+ * @default "both"
22
+ */
7
23
  resize?: Property.Resize;
24
+ /**
25
+ * コンポーネントのサイズ
26
+ * @default "medium"
27
+ */
28
+ size?: InputSize;
29
+ /**
30
+ * コンポーネントのバリアント
31
+ * @default "light"
32
+ */
33
+ variant?: InputVariant;
34
+ /**
35
+ * 幅を親要素に合わせる
36
+ * @default false
37
+ */
38
+ fullWidth?: boolean;
39
+ /**
40
+ * エラーメッセージ(アクセシビリティ用)
41
+ */
42
+ errorMessage?: string;
8
43
  };
9
44
  declare const Input: React.ForwardRefExoticComponent<InputProps & React.RefAttributes<HTMLInputElement | HTMLTextAreaElement>>;
10
45
  export default Input;
@@ -7,8 +7,17 @@ declare const _default: {
7
7
  args: {
8
8
  placeholder: string;
9
9
  };
10
+ parameters: {
11
+ docs: {
12
+ description: {
13
+ component: string;
14
+ };
15
+ };
16
+ };
10
17
  };
11
18
  export default _default;
12
19
  export declare const Example: StoryObj<InputProps>;
20
+ export declare const Sizes: StoryObj<InputProps>;
21
+ export declare const Variants: StoryObj<InputProps>;
22
+ export declare const FullWidth: StoryObj<InputProps>;
13
23
  export declare const Textarea: StoryObj<InputProps>;
14
- export declare const DesignSamples: StoryObj<InputProps>;
@@ -1,2 +1,3 @@
1
1
  export { default } from "./Input";
2
2
  export type { InputProps } from "./Input";
3
+ export type { InputSize, InputVariant, InputSizeConfig, InputVariantConfig, } from "./types";
@@ -1,5 +1,12 @@
1
+ /// <reference types="react" />
2
+ import { InputSize, InputVariant } from "./types";
1
3
  export declare const Input: import("styled-components").StyledComponent<"input", import("styled-components").DefaultTheme, {
2
- isError: boolean;
4
+ $error: boolean;
3
5
  width?: string | number | undefined;
4
6
  resize?: string | undefined;
7
+ $size?: InputSize | undefined;
8
+ $variant?: InputVariant | undefined;
9
+ $fullWidth?: boolean | undefined;
10
+ $isFocused?: boolean | undefined;
11
+ as?: string | import("react").ComponentType<any> | undefined;
5
12
  }, never>;
@@ -0,0 +1,23 @@
1
+ import { Theme } from "../../themes";
2
+ export type InputSize = "small" | "medium" | "large";
3
+ export type InputVariant = "light" | "dark";
4
+ export type InputSizeConfig = {
5
+ height: string;
6
+ fontSize: string;
7
+ padding: string;
8
+ borderRadius: string;
9
+ };
10
+ export declare const TEXTAREA_PADDING = "8px";
11
+ export declare const INPUT_SIZES: Record<InputSize, InputSizeConfig>;
12
+ export type InputVariantConfig = {
13
+ background: string;
14
+ borderColor: string;
15
+ hoverBorderColor: string;
16
+ focusBorderColor: string;
17
+ focusShadowColor: string;
18
+ };
19
+ export declare const getInputVariantConfig: (theme: Theme) => Record<InputVariant, InputVariantConfig>;
20
+ export declare const getErrorStyles: (theme: Theme) => {
21
+ borderColor: string;
22
+ shadowColor: string;
23
+ };
@@ -6,6 +6,8 @@ export { default as Backdrop } from "./Backdrop";
6
6
  export * from "./Backdrop";
7
7
  export { default as Badge } from "./Badge";
8
8
  export * from "./Badge";
9
+ export { default as Banner } from "./Banner";
10
+ export * from "./Banner";
9
11
  export { default as Button } from "./Button";
10
12
  export * from "./Button";
11
13
  export { default as ButtonGroup } from "./ButtonGroup";