@musecat/uikit 0.1.1 → 0.1.3

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.
Files changed (58) hide show
  1. package/.agents/references/Components/Box.md +60 -0
  2. package/.agents/references/Components/Button.md +49 -0
  3. package/.agents/references/Components/Card.md +67 -0
  4. package/.agents/references/Components/Checkbox.md +48 -0
  5. package/.agents/references/Components/CodeBox.md +31 -0
  6. package/.agents/references/Components/ContextMenu.md +82 -0
  7. package/.agents/references/Components/ContributionGraph.md +61 -0
  8. package/.agents/references/Components/DatePicker.md +92 -0
  9. package/.agents/references/Components/Divider.md +56 -0
  10. package/.agents/references/Components/Header.md +52 -0
  11. package/.agents/references/Components/Icon.md +82 -0
  12. package/.agents/references/Components/Input.md +60 -0
  13. package/.agents/references/Components/Label.md +78 -0
  14. package/.agents/references/Components/Layout.md +102 -0
  15. package/.agents/references/Components/Maps.md +63 -0
  16. package/.agents/references/Components/Nav.md +68 -0
  17. package/.agents/references/Components/Pagination.md +67 -0
  18. package/.agents/references/Components/Pill.md +75 -0
  19. package/.agents/references/Components/Profile.md +76 -0
  20. package/.agents/references/Components/Progress.md +72 -0
  21. package/.agents/references/Components/Radio.md +68 -0
  22. package/.agents/references/Components/Select.md +80 -0
  23. package/.agents/references/Components/Skeleton.md +48 -0
  24. package/.agents/references/Components/Spinner.md +62 -0
  25. package/.agents/references/Components/Text.md +73 -0
  26. package/.agents/references/Components/TimePicker.md +72 -0
  27. package/.agents/references/Components/Timeline.md +97 -0
  28. package/.agents/references/Components/Title.md +108 -0
  29. package/.agents/references/Components/Toggle.md +53 -0
  30. package/.agents/references/Components/Tooltip.md +62 -0
  31. package/.agents/references/Frameworks/DNDView.md +82 -0
  32. package/.agents/references/Frameworks/Dialog.md +109 -0
  33. package/.agents/references/Frameworks/EdgeEffect.md +64 -0
  34. package/.agents/references/Frameworks/HScrollView.md +76 -0
  35. package/.agents/references/Frameworks/ImageView.md +67 -0
  36. package/.agents/references/Frameworks/Motion.md +62 -0
  37. package/.agents/references/Frameworks/Pressable.md +79 -0
  38. package/.agents/references/Frameworks/Squircle.md +50 -0
  39. package/.agents/references/Frameworks/Theme.md +68 -0
  40. package/.agents/references/Frameworks/Toaster.md +67 -0
  41. package/.agents/references/Frameworks/View.md +81 -0
  42. package/.agents/references/Frameworks/_shared.md +74 -0
  43. package/.agents/references/Styles/Animation.md +43 -0
  44. package/.agents/references/Styles/Color.md +45 -0
  45. package/.agents/references/Styles/Font.md +37 -0
  46. package/.agents/references/Styles/Icon.md +43 -0
  47. package/.agents/references/Styles/Importer.md +19 -0
  48. package/.agents/references/Styles/System.md +27 -0
  49. package/.agents/references/Styles/Textstyle.md +45 -0
  50. package/.agents/references/Styles/Theme.md +51 -0
  51. package/.agents/references/Styles/Viewport-global.md +42 -0
  52. package/.agents/references/Styles/Viewport.md +42 -0
  53. package/AGENTS.md +54 -0
  54. package/CLAUDE.md +1 -0
  55. package/README.md +4 -0
  56. package/package.json +4 -1
  57. package/packages/Styles/_icon.scss +2 -0
  58. package/packages/Styles/_importer.scss +0 -1
@@ -0,0 +1,60 @@
1
+ # Box
2
+
3
+ ## Purpose
4
+
5
+ The Box component serves as a basic layout container for content. By combining an inner element (`Box.Content`) and a bottom area (`Box.Footer`), it can compose a consistent panel or card-shaped UI.
6
+
7
+ ## Usage Logic
8
+
9
+ - `Box`: The base wrapper component, built on the View component, applying theme and layout properties.
10
+ - `Box.Content`: The body area, which can embed a title, loading state, icon, etc., and notifies child elements via Context that they are inside the box.
11
+ - `Box.Footer`: Located at the bottom of the Box, providing buttons (Pressable) or additional text. May include a divider (Divider).
12
+
13
+ ## Type Signatures
14
+
15
+ ```typescript
16
+ interface BoxProps extends ThemeSystemProps, RadiusProps, BorderProps {
17
+ children?: React.ReactNode;
18
+ className?: string;
19
+ style?: React.CSSProperties;
20
+ }
21
+
22
+ interface BoxContentProps {
23
+ children?: React.ReactNode;
24
+ title?: React.ReactNode;
25
+ titleSize?: TitleProps["titleType"];
26
+ icon?: IconProps;
27
+ loading?: boolean;
28
+ card?: boolean;
29
+ padding?: UIKitSizeValue;
30
+ }
31
+
32
+ interface BoxFooterProps extends ThemeSystemProps, BorderProps, RadiusProps {
33
+ children?: React.ReactNode;
34
+ title?: React.ReactNode;
35
+ pressable?: PressableProps;
36
+ divider?: DividerProps;
37
+ }
38
+ ```
39
+
40
+ ## Example Code
41
+
42
+ ```tsx
43
+ import Box from "@/packages/Components/Box/Box";
44
+
45
+ export default function Example() {
46
+ return (
47
+ <Box themePreset="UIPrimary" border="Light" radius="Regular">
48
+ <Box.Content title="Information" loading={false}>
49
+ <p>This is the main content area.</p>
50
+ </Box.Content>
51
+ <Box.Footer
52
+ pressable={{ onClick: () => alert("Clicked!") }}
53
+ title="Action"
54
+ >
55
+ Confirm
56
+ </Box.Footer>
57
+ </Box>
58
+ );
59
+ }
60
+ ```
@@ -0,0 +1,49 @@
1
+ # Button
2
+
3
+ ## Purpose
4
+
5
+ A versatile button component supporting various styles, icon placement, and asynchronous states (Promise).
6
+
7
+ ## Usage Logic
8
+
9
+ - `Button` is built on Pressable and can express text, icons, and asynchronous results (loading/success/error) together.
10
+ - The `iconEnd` prop or props like `modal`, `column` support various layouts (vertical arrangement, full-width modal button, etc.).
11
+ - When a `promise` prop is given, it automatically renders loading and completion state icons and disables click events.
12
+
13
+ ## Type Signatures
14
+
15
+ ```typescript
16
+ interface ButtonProps extends ThemeSystemProps, RadiusProps, BorderProps {
17
+ icon?: IconProps;
18
+ pressable?: PressableProps;
19
+ textType?: TextProps["type"];
20
+ sizeFull?: boolean;
21
+ promise?: {
22
+ type: "loading" | "success" | "error";
23
+ text?: React.ReactNode;
24
+ };
25
+ text?: React.ReactNode;
26
+ column?: boolean;
27
+ modal?: boolean;
28
+ iconEnd?: ButtonIconEndProps;
29
+ reversed?: boolean;
30
+ }
31
+ ```
32
+
33
+ ## Example Code
34
+
35
+ ```tsx
36
+ import Button from "@/packages/Components/Button/Button";
37
+
38
+ export default function Example() {
39
+ return (
40
+ <Button
41
+ text="Submit"
42
+ themePreset="UIPrimary"
43
+ promise={{ type: "loading", text: "Loading..." }}
44
+ pressable={{ onClick: () => console.log("Submit") }}
45
+ icon={{ icon: "iCheck" }}
46
+ />
47
+ );
48
+ }
49
+ ```
@@ -0,0 +1,67 @@
1
+ # Card
2
+
3
+ ## Purpose
4
+
5
+ A card component supporting basic information grouping and accordion (foldable) expansion.
6
+
7
+ ## Usage Logic
8
+
9
+ - `Card`: Automatically branches to render `Card.default` or `Card.foldable` depending on the presence of the `accordion` prop.
10
+ - `Card.default`: Can arrange title, caption, icon, a custom right-side component (`customRight`), and Pill tags horizontally or vertically.
11
+ - `Card.foldable`: Includes an expand/collapse animation on click (using `motion/react`), and the open state can be controlled and synchronized via the `accordion` object. Also supports radius change animation.
12
+
13
+ ## Type Signatures
14
+
15
+ ```typescript
16
+ interface CardBaseProps extends BorderProps, RadiusProps {
17
+ vertical?: boolean;
18
+ contained?: boolean;
19
+ pressable?: PressableProps;
20
+ title?: React.ReactNode;
21
+ caption?: React.ReactNode;
22
+ icon?: IconProps;
23
+ arrow?: IconProps | boolean;
24
+ pill?: PillProps[] | PillProps;
25
+ customRight?: React.ReactNode;
26
+ }
27
+
28
+ interface CardDefaultProps extends CardBaseProps, ThemeSystemProps {
29
+ accordion?: never;
30
+ }
31
+
32
+ interface CardFoldableProps extends Omit<
33
+ CardBaseProps,
34
+ "title" | "caption" | "vertical"
35
+ > {
36
+ accordion: CardAccordionProps;
37
+ themePreset?: Stateful<ThemePreset>;
38
+ title?: Stateful<React.ReactNode>;
39
+ caption?: Stateful<React.ReactNode>;
40
+ }
41
+
42
+ type CardProps = CardDefaultProps | CardFoldableProps;
43
+ ```
44
+
45
+ ## Example Code
46
+
47
+ ```tsx
48
+ import Card from "@/packages/Components/Card/Card";
49
+
50
+ export default function Example() {
51
+ return (
52
+ <>
53
+ <Card
54
+ title="Static Card"
55
+ caption="Sub description"
56
+ icon={{ icon: "iInfo" }}
57
+ />
58
+ <Card
59
+ title={{ normal: "Expandable", activated: "Expanded!" }}
60
+ accordion={{ name: "group1", value: "item1" }}
61
+ >
62
+ <p>Hidden content revealed on click.</p>
63
+ </Card>
64
+ </>
65
+ );
66
+ }
67
+ ```
@@ -0,0 +1,48 @@
1
+ # Checkbox
2
+
3
+ ## Purpose
4
+
5
+ A checkbox element for receiving a boolean value from the user, with custom design and animation applied.
6
+
7
+ ## Usage Logic
8
+
9
+ - Visually hides the native `<input type="checkbox">` and renders a designed checkbox using `Icon` and `View`.
10
+ - Supports both controlled/uncontrolled components (`checked`, `defaultChecked`).
11
+ - A label text can be composed via the `title` prop, and `reversed` swaps the order of the checkbox and text.
12
+
13
+ ## Type Signatures
14
+
15
+ ```typescript
16
+ interface CheckboxProps
17
+ extends
18
+ Omit<
19
+ React.InputHTMLAttributes<HTMLInputElement>,
20
+ "size" | "title" | "color"
21
+ >,
22
+ BorderProps,
23
+ RadiusProps,
24
+ ThemeSystemProps {
25
+ title?: React.ReactNode;
26
+ titleType?: TextProps["type"];
27
+ titleSpaceBetween?: boolean;
28
+ reversed?: boolean;
29
+ size?: UIKitSizeValue;
30
+ }
31
+ ```
32
+
33
+ ## Example Code
34
+
35
+ ```tsx
36
+ import Checkbox from "@/packages/Components/Checkbox/Checkbox";
37
+
38
+ export default function Example() {
39
+ return (
40
+ <Checkbox
41
+ title="Accept terms and conditions"
42
+ size={24}
43
+ onChange={(e) => console.log(e.target.checked)}
44
+ radius="ExtraLight"
45
+ />
46
+ );
47
+ }
48
+ ```
@@ -0,0 +1,31 @@
1
+ # CodeBox
2
+
3
+ ## Purpose
4
+
5
+ A component that displays code snippets with language syntax highlighting and includes a built-in code copy feature.
6
+
7
+ ## Usage Logic
8
+
9
+ - Uses `PrismJS` to parse and highlight code. (HTML is injected internally.)
10
+ - Automatically places the language name at the top and a copy button (`CodeBox.copy` module) according to the supported language.
11
+ - Supports theme and layout (Radius, Border, etc.).
12
+
13
+ ## Type Signatures
14
+
15
+ ```typescript
16
+ interface CodeBoxProps extends ThemeSystemProps, RadiusProps, BorderProps {
17
+ code: string;
18
+ language?: string;
19
+ }
20
+ ```
21
+
22
+ ## Example Code
23
+
24
+ ```tsx
25
+ import CodeBox from "@/packages/Components/CodeBox/CodeBox";
26
+
27
+ export default function Example() {
28
+ const sampleCode = `const hello = 'world';\nconsole.log(hello);`;
29
+ return <CodeBox code={sampleCode} language="typescript" radius="Regular" />;
30
+ }
31
+ ```
@@ -0,0 +1,82 @@
1
+ # ContextMenu
2
+
3
+ ## Purpose
4
+
5
+ A context menu that displays a list of menu items as a popover or bottom sheet (on mobile) and lets the user select an item.
6
+
7
+ ## Usage Logic
8
+
9
+ - Built on the `Dialog` framework, it renders responsively as a popover or sheet depending on screen size (`isMobile`) and `mobileMode`.
10
+ - Fully supports keyboard navigation (ArrowUp/Down, Home, End, Enter, Space), including a visual focus auto-scroll (Ensure Visible) logic.
11
+ - Manages option items via the `contents` array, with individual items rendered by the submodule `ContextMenu.options.tsx`.
12
+
13
+ ## Type Signatures
14
+
15
+ ```typescript
16
+ interface ContentItem {
17
+ type: "option";
18
+ value: string | number;
19
+ label: ReactNode;
20
+ icon?: string;
21
+ description?: string;
22
+ disabled?: boolean;
23
+ selected?: boolean;
24
+ onClick?: () => void;
25
+ }
26
+
27
+ interface ContextMenuProps {
28
+ open: boolean;
29
+ onOpenChange: (open: boolean) => void;
30
+ anchorRef: React.RefObject<HTMLElement | null>;
31
+ popoverOwnerId: string;
32
+ listId: string;
33
+ isInteractionDisabled: boolean;
34
+ contents: ContentItem[];
35
+ mobileMode?: DialogMobileMode;
36
+ showCheck?: boolean;
37
+ }
38
+ ```
39
+
40
+ ## Example Code
41
+
42
+ ```tsx
43
+ import ContextMenu from "@/packages/Components/ContextMenu/ContextMenu";
44
+ import { useRef, useState } from "react";
45
+
46
+ export default function Example() {
47
+ const [open, setOpen] = useState(false);
48
+ const ref = useRef<HTMLButtonElement>(null);
49
+
50
+ const options = [
51
+ {
52
+ type: "option" as const,
53
+ value: "1",
54
+ label: "Edit",
55
+ onClick: () => console.log("Edit"),
56
+ },
57
+ {
58
+ type: "option" as const,
59
+ value: "2",
60
+ label: "Delete",
61
+ onClick: () => console.log("Delete"),
62
+ },
63
+ ];
64
+
65
+ return (
66
+ <>
67
+ <button ref={ref} onClick={() => setOpen(true)}>
68
+ Open Menu
69
+ </button>
70
+ <ContextMenu
71
+ open={open}
72
+ onOpenChange={setOpen}
73
+ anchorRef={ref}
74
+ popoverOwnerId="example-menu"
75
+ listId="example-menu-list"
76
+ isInteractionDisabled={false}
77
+ contents={options}
78
+ />
79
+ </>
80
+ );
81
+ }
82
+ ```
@@ -0,0 +1,61 @@
1
+ # ContributionGraph
2
+
3
+ ## 1. Purpose
4
+
5
+ - A GitHub contribution-graph style visualization component.
6
+ - Role: Maps daily activity data into 0~4 levels and displays the activity pattern over a period such as a year as a grid.
7
+
8
+ ## 2. Usage Logic
9
+
10
+ - Receives an array of per-date activity objects via the `data` property.
11
+ - Calculates the entire grid to display based on `endDate` and `visibleDays`; by default it shows the most recent 1 year (Rolling Year) from the end date.
12
+ - Supports month titles, weekday labels, and left-right drag scrolling (including pointer/mouse-based touch scrolling).
13
+ - Inherits `ThemeSystemProps` so design tokens like `themePreset`, `radius`, `border` can be injected externally.
14
+
15
+ ## 3. Type Signatures
16
+
17
+ ```typescript
18
+ export interface ContributionActivity {
19
+ date: string | Date;
20
+ level: 0 | 1 | 2 | 3 | 4;
21
+ total_count?: number;
22
+ changelog_count?: number;
23
+ flag_count?: number;
24
+ legacy_ticket_count?: number;
25
+ }
26
+
27
+ export interface ContributionGraphProps
28
+ extends ThemeSystemProps, RadiusProps, BorderProps {
29
+ "data-color-mode"?: string;
30
+ className?: string;
31
+ style?: React.CSSProperties;
32
+ data?: ContributionActivity[];
33
+ endDate?: string | Date;
34
+ visibleDays?: number;
35
+ locale?: string;
36
+ }
37
+ ```
38
+
39
+ ## 4. Example Code
40
+
41
+ ```tsx
42
+ import ContributionGraph from "@/packages/Components/ContributionGraph/ContributionGraph";
43
+
44
+ export default function Example() {
45
+ const data = [
46
+ { date: "2024-01-01", level: 3, total_count: 5 },
47
+ { date: "2024-01-02", level: 1, total_count: 1 },
48
+ ];
49
+
50
+ return (
51
+ <ContributionGraph
52
+ data={data}
53
+ endDate={new Date()}
54
+ visibleDays={365}
55
+ locale="ko"
56
+ themePreset="BaseFull"
57
+ radius="Regular"
58
+ />
59
+ );
60
+ }
61
+ ```
@@ -0,0 +1,92 @@
1
+ # DatePicker
2
+
3
+ ## 1. Purpose
4
+
5
+ - A date and time selection component.
6
+ - Role: Provides a single date (`single`) or range (`range`) selection interface, with integrated time selection option (`showTime`). Supports both calendar selection via popover and direct editing of the input field.
7
+
8
+ ## 2. Usage Logic
9
+
10
+ - **Component Separation**:
11
+ - `DatePicker.tsx`: Externally exposed wrapper. Combines the field (core) and popover calendar.
12
+ - `DatePicker.core.tsx`: Actual input field UI and keyboard manipulation (arrows, number input) logic.
13
+ - `DatePicker.calendar.tsx`: Grid-based calendar interface rendered inside the popover.
14
+ - `hooks/useCalendar.ts`: Calendar paging (prev/next month, year navigation).
15
+ - `hooks/useSelection.ts`: Single/range date selection state management.
16
+ - `DatePicker.utils.ts`: Date calculation and string parsing utilities.
17
+ - **Mode Branching**: `mode="single"` (single date) or `mode="range"` (start-end range).
18
+ - **Time Combination**: When `showTime=true`, a `TimePickerCore` is embedded as an independent input field separate from the calendar. The `use12h` option switches between 12/24-hour formats.
19
+ - **Built-in Label**: Receives `LabelProps` such as `title`, `required`, `hint` to render a complete form element structure.
20
+
21
+ ## 3. Type Signatures
22
+
23
+ ```typescript
24
+ export type DatePickerMode = "single" | "range";
25
+
26
+ export interface DatePickerProps {
27
+ "data-color-mode"?: string;
28
+ className?: string;
29
+ style?: React.CSSProperties;
30
+ title?: string;
31
+ required?: boolean;
32
+ readOnly?: boolean;
33
+ disabled?: boolean;
34
+ hint?: {
35
+ type: "info" | "error" | "warning" | "success";
36
+ text: React.ReactNode;
37
+ };
38
+
39
+ mode?: DatePickerMode;
40
+
41
+ // Single mode props
42
+ value?: string;
43
+ defaultValue?: string;
44
+ onChange?: (value: string | null) => void;
45
+
46
+ // Range mode props
47
+ startDate?: string;
48
+ endDate?: string;
49
+ defaultStartDate?: string;
50
+ defaultEndDate?: string;
51
+ onRangeChange?: (start: string | null, end: string | null) => void;
52
+
53
+ placeholder?: string;
54
+ minDate?: string;
55
+ maxDate?: string;
56
+ disabledDaysOfWeek?: number[];
57
+
58
+ showTime?: boolean;
59
+ use12h?: boolean;
60
+ }
61
+ ```
62
+
63
+ ## 4. Example Code
64
+
65
+ ```tsx
66
+ import DatePicker from "@/packages/Components/DatePicker/DatePicker";
67
+
68
+ export default function Example() {
69
+ return (
70
+ <div style={{ display: "flex", flexDirection: "column", gap: "20px" }}>
71
+ {/* Single date selection */}
72
+ <DatePicker
73
+ mode="single"
74
+ title="Date of Birth"
75
+ defaultValue="1990-01-01"
76
+ onChange={(val) => console.log(val)}
77
+ />
78
+
79
+ {/* Range and time selection */}
80
+ <DatePicker
81
+ mode="range"
82
+ title="Event Period"
83
+ showTime
84
+ use12h
85
+ defaultStartDate="2024-05-01 10:00"
86
+ defaultEndDate="2024-05-07 18:00"
87
+ onRangeChange={(start, end) => console.log("Range:", start, end)}
88
+ />
89
+ </div>
90
+ );
91
+ }
92
+ ```
@@ -0,0 +1,56 @@
1
+ # Divider
2
+
3
+ ## 1. Purpose
4
+
5
+ - A visual separator component within a layout.
6
+ - Role: Renders a horizontal or vertical line to clearly mark structural separation between contents.
7
+
8
+ ## 2. Usage Logic
9
+
10
+ - Default is a horizontal line (`width: 100%`, `height: 1px`). With `vertical=true`, it renders as a vertical line (`width: 1.5px`, `height: stretch`).
11
+ - Controls surrounding margin size via `margin`, `marginVertical`, `marginHorizontal` props (mapped to `Size` token).
12
+ - With `gradient=true`, renders a linear gradient that fades out at both ends (fade effect).
13
+ - The default color is a semi-transparent version of `--color-base-reversed-6`, and `data-color-mode` can be injected.
14
+
15
+ ## 3. Type Signatures
16
+
17
+ ```typescript
18
+ import type { UIKitSizeValue } from "../../Frameworks/_shared/sizing";
19
+
20
+ export interface DividerProps {
21
+ "data-color-mode"?: string;
22
+ className?: string;
23
+ style?: React.CSSProperties;
24
+ vertical?: boolean;
25
+ margin?: UIKitSizeValue;
26
+ marginHorizontal?: UIKitSizeValue;
27
+ marginVertical?: UIKitSizeValue;
28
+ gradient?: boolean;
29
+ }
30
+ ```
31
+
32
+ ## 4. Example Code
33
+
34
+ ```tsx
35
+ import Divider from "@/packages/Components/Divider/Divider";
36
+
37
+ export default function Example() {
38
+ return (
39
+ <div>
40
+ <span>Top content</span>
41
+
42
+ {/* Default horizontal divider */}
43
+ <Divider margin={16} />
44
+
45
+ <span>Bottom content</span>
46
+
47
+ {/* Gradient vertical divider */}
48
+ <div style={{ display: "flex", height: "50px" }}>
49
+ <span>Left</span>
50
+ <Divider vertical gradient marginHorizontal={8} />
51
+ <span>Right</span>
52
+ </div>
53
+ </div>
54
+ );
55
+ }
56
+ ```
@@ -0,0 +1,52 @@
1
+ # Header
2
+
3
+ ## 1. Purpose
4
+
5
+ - A global or screen-level top navigation header component.
6
+ - Role: Provides a `position: fixed` layout at the top and includes a background blur transition (`EdgeEffect`) by default.
7
+
8
+ ## 2. Usage Logic
9
+
10
+ - Rendered fixed at the very top of the viewport (`top: 0`), applying a smooth overlay/blur fade effect on content scroll via the top EdgeEffect.
11
+ - Inject ReactNodes into `left`, `center`, `right` props respectively to arrange items flexibly.
12
+ - Controllable via separation of the inner content wrapper (`wrapperClassName`) and the top-level `<header>` (`className`).
13
+
14
+ ## 3. Type Signatures
15
+
16
+ ```typescript
17
+ export interface HeaderProps {
18
+ "data-color-mode"?: string;
19
+ left?: React.ReactNode;
20
+ center?: React.ReactNode;
21
+ right?: React.ReactNode;
22
+ className?: string;
23
+ wrapperClassName?: string;
24
+ }
25
+ ```
26
+
27
+ ## 4. Example Code
28
+
29
+ ```tsx
30
+ import Header from "@/packages/Components/Header/Header";
31
+ import Icon from "@/packages/Components/Icon/Icon";
32
+ import Text from "@/packages/Components/Text/Text";
33
+
34
+ export default function Example() {
35
+ return (
36
+ <Header
37
+ left={
38
+ <Icon
39
+ icon="iArrowKeyLeft"
40
+ pressable={{ onClick: () => history.back() }}
41
+ />
42
+ }
43
+ center={
44
+ <Text type="Title3" weight={600}>
45
+ Screen Title
46
+ </Text>
47
+ }
48
+ right={<Icon icon="iSearch" />}
49
+ />
50
+ );
51
+ }
52
+ ```
@@ -0,0 +1,82 @@
1
+ # Icon
2
+
3
+ ## 1. Purpose
4
+
5
+ - An integrated rendering view for icons, images, loading spinners, and SVGs.
6
+ - Role: Standardizes the output of icon font classes (`i*`), external image renderers, inline vectors (`SVG/data`), and the loading component (`Spinner`) under the same layout API.
7
+
8
+ ## 2. Usage Logic
9
+
10
+ - 4 main modes:
11
+ - **Icon font**: Injected as `icon="iCheck"`, `iconBrand="iBrandApple"`.
12
+ - **Image**: Injected as `image="/path/to.jpg"` (uses Next.js Image wrapper).
13
+ - **SVG**: References an internal `SVG.data` like `svg="logo"`. The `svgBordered` prop allows custom stroke color.
14
+ - **Spinner**: Activated with `spinner=true` (SpinnerOptions can be passed).
15
+ - With `box={true}`, it renders as a card-style icon with a rounded background. `boxOptions` controls details.
16
+ - Injecting `pressable={{ onClick: ... }}` makes it immediately act as a button-style (interactive) icon wrapper.
17
+ - `title` and `titleType` can attach a label (Text) next to the icon.
18
+
19
+ ## 3. Type Signatures
20
+
21
+ ```typescript
22
+ export interface IconProps extends ThemeSystemProps, RadiusProps, BorderProps {
23
+ "data-color-mode"?: string;
24
+ className?: string;
25
+ innerClassName?: string;
26
+ style?: React.CSSProperties;
27
+ title?: React.ReactNode;
28
+
29
+ // Box wrapper mode
30
+ box?: boolean;
31
+ boxOptions?: { padding?: UIKitSizeValue; background?: ThemePaint /* ... */ };
32
+
33
+ // Size constraints
34
+ size?: UIKitSizeValue;
35
+ width?: UIKitSizeValue;
36
+ height?: UIKitSizeValue;
37
+
38
+ // Mode triggers
39
+ icon?: string;
40
+ iconBrand?: string;
41
+ iconFill?: boolean;
42
+ image?: string;
43
+ svg?: string;
44
+ svgBordered?:
45
+ boolean | { fill?: string; stroke?: string; strokeWidth?: number | string };
46
+ spinner?: boolean;
47
+
48
+ // Functionality
49
+ pressable?: PressableProps;
50
+ opacity?: number;
51
+ }
52
+ ```
53
+
54
+ ## 4. Example Code
55
+
56
+ ```tsx
57
+ import Icon from "@/packages/Components/Icon/Icon";
58
+
59
+ export default function Example() {
60
+ return (
61
+ <div style={{ display: "flex", gap: "10px" }}>
62
+ {/* 1. Normal icon font */}
63
+ <Icon icon="iSettings" size={24} color="Blue3" />
64
+
65
+ {/* 2. Interactive box-style brand icon */}
66
+ <Icon
67
+ iconBrand="iBrandGithub"
68
+ box
69
+ themePreset="UIPrimary"
70
+ pressable={{ onClick: () => alert("Github") }}
71
+ />
72
+
73
+ {/* 3. Loading state */}
74
+ <Icon spinner title="Loading..." titleType="Caption1" />
75
+
76
+ {/* 4. Vector graphic and image */}
77
+ <Icon svg="logo" width={64} height={64} />
78
+ <Icon image="https://example.com/avatar.png" box radius="Circle" />
79
+ </div>
80
+ );
81
+ }
82
+ ```