ownui-system 0.0.8 → 0.0.11

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 CHANGED
@@ -17,6 +17,10 @@ npx tailwindcss init -p
17
17
  - configure tailwind.config
18
18
 
19
19
  ```
20
+ const plugin = require("tailwindcss/plugin");
21
+ const { colors, twTypographyMap } = require("ownui-system");
22
+
23
+
20
24
  /** @type {import('tailwindcss').Config} */
21
25
  export default {
22
26
  content: [
@@ -24,8 +28,15 @@ export default {
24
28
  "./src/**/*.{js,ts,jsx,tsx}",
25
29
  ],
26
30
  theme: {
31
+ colors,
27
32
  extend: {},
28
33
  },
34
+ plugins: [
35
+ plugin(function ({ addUtilities }) {
36
+ // Add your custom styles here
37
+ addUtilities(twTypographyMap, ["responsive", "hover"]);
38
+ }),
39
+ ],
29
40
  };
30
41
 
31
42
  ```
@@ -59,8 +70,15 @@ export default {
59
70
  "./node_modules/ownui-system/dist/**/*.{js,jsx,ts,tsx}"
60
71
  ],
61
72
  theme: {
73
+ colors,
62
74
  extend: {},
63
75
  },
76
+ plugins: [
77
+ plugin(function ({ addUtilities }) {
78
+ // Add your custom styles here
79
+ addUtilities(twTypographyMap, ["responsive", "hover"]);
80
+ }),
81
+ ],
64
82
  };
65
83
 
66
84
  ```
@@ -88,6 +106,6 @@ export default {
88
106
  - [x] BottomSheet
89
107
  - [x] Pagination
90
108
  - [x] Switch
109
+ - [x] Radio / RadioGroup
91
110
  - [ ] Tooltip
92
- - [ ] Radio / RadioGroup
93
111
  - [ ] Step
@@ -1,13 +1,16 @@
1
1
  /// <reference types="react" />
2
2
  type DropdownContextValue = {
3
3
  isOpen: boolean;
4
- selectedItem?: string;
4
+ selectedItem?: {
5
+ name: string;
6
+ value: string;
7
+ };
5
8
  color?: string;
6
- onSelect: (name: string) => void;
9
+ onSelect: (name: string, value: string) => void;
7
10
  onOpenChange: (isOpen: boolean) => void;
8
11
  };
9
12
  declare function useContext(): DropdownContextValue;
10
- export declare function useDropdownContext(): {
13
+ export default function useDropdownContext(): {
11
14
  DropdownProvider: import("react").Provider<DropdownContextValue | undefined>;
12
15
  useContext: typeof useContext;
13
16
  Context: import("react").Context<DropdownContextValue | undefined>;
@@ -0,0 +1,3 @@
1
+ import { ComponentProps } from "react";
2
+ declare function DropdownHeader({ ...rest }: ComponentProps<"div">): import("react/jsx-runtime").JSX.Element;
3
+ export default DropdownHeader;
@@ -2,8 +2,10 @@
2
2
  type DropdownItemProps = {
3
3
  className?: string;
4
4
  value: string;
5
+ name: string;
5
6
  children: React.ReactNode;
6
7
  disabled?: boolean;
7
- };
8
- declare function DropdownItem({ children, value, className, disabled, }: DropdownItemProps): import("react/jsx-runtime").JSX.Element;
8
+ right?: React.ReactNode;
9
+ } & React.ComponentProps<"li">;
10
+ declare function DropdownItem({ children, value, className, disabled, name, ...rest }: DropdownItemProps): import("react/jsx-runtime").JSX.Element;
9
11
  export default DropdownItem;
@@ -1,10 +1,11 @@
1
- /// <reference types="react" />
2
- interface DropdownProps {
3
- selectedItem: string;
4
- trigger: React.ReactNode;
5
- content?: React.ReactNode;
1
+ import { PropsWithChildren } from "react";
2
+ interface DropdownProps extends PropsWithChildren {
3
+ selectedItem: {
4
+ name: string;
5
+ value: string;
6
+ };
6
7
  color?: string;
7
- onSelect: (name: string) => void;
8
+ onSelect: (name: string, value: string) => void;
8
9
  }
9
- declare function Dropdown({ trigger, content, selectedItem, color, onSelect, }: DropdownProps): import("react/jsx-runtime").JSX.Element;
10
+ declare function Dropdown({ children, selectedItem, color, onSelect }: DropdownProps): import("react/jsx-runtime").JSX.Element;
10
11
  export default Dropdown;
@@ -1,17 +1,23 @@
1
1
  type UseDropdownProps = {
2
2
  isOpen: boolean;
3
- selectedItem: string;
3
+ selectedItem: {
4
+ name: string;
5
+ value: string;
6
+ };
4
7
  color?: string;
5
- onSelect: (name: string) => void;
8
+ onSelect: (name: string, value: string) => void;
6
9
  onOpen?: () => void;
7
10
  onClose?: () => void;
8
11
  onOpenChange: (isOpen: boolean) => void;
9
12
  };
10
13
  declare function useDropdown({ isOpen, selectedItem, color, onOpen, onClose, onSelect, onOpenChange, }: UseDropdownProps): {
11
14
  isOpen: boolean;
12
- selectedItem: string;
15
+ selectedItem: {
16
+ name: string;
17
+ value: string;
18
+ };
13
19
  color: string | undefined;
14
- onSelect: (name: string) => void;
20
+ onSelect: (name: string, value: string) => void;
15
21
  onOpenChange: (isOpen: boolean) => void;
16
22
  };
17
23
  export default useDropdown;
@@ -1,3 +1,2 @@
1
1
  export { default as Dropdown } from "./dropdown";
2
- export { default as DropdownBody } from "./dropdown-body";
3
2
  export { default as DropdownItem } from "./dropdown-item";
@@ -0,0 +1,14 @@
1
+ /// <reference types="react" />
2
+ import type { StoryObj } from "@storybook/react";
3
+ import { RadioItemProps } from "./radio-item";
4
+ declare const meta: {
5
+ title: string;
6
+ component: import("react").ForwardRefExoticComponent<Omit<RadioItemProps, "ref"> & import("react").RefAttributes<HTMLInputElement>>;
7
+ parameters: {
8
+ layout: string;
9
+ };
10
+ };
11
+ export default meta;
12
+ type Story = StoryObj<typeof meta>;
13
+ export declare const Default: Story;
14
+ export declare const CustomRadio: Story;
@@ -0,0 +1,7 @@
1
+ /// <reference types="react" />
2
+ import RadioGroup from "./radio-group";
3
+ declare const Radio: {
4
+ Group: typeof RadioGroup;
5
+ Item: import("react").ForwardRefExoticComponent<Omit<import("./radio-item").RadioItemProps, "ref"> & import("react").RefAttributes<HTMLInputElement>>;
6
+ };
7
+ export default Radio;
@@ -0,0 +1,11 @@
1
+ /// <reference types="react" />
2
+ type RadioContextValue = {
3
+ activeColor: string;
4
+ };
5
+ declare function useContext(): RadioContextValue;
6
+ export default function useRadioContext(): {
7
+ RadioProvider: import("react").Provider<RadioContextValue | undefined>;
8
+ useContext: typeof useContext;
9
+ Context: import("react").Context<RadioContextValue | undefined>;
10
+ };
11
+ export {};
@@ -0,0 +1,7 @@
1
+ import { PropsWithChildren } from "react";
2
+ interface RadioGroupProps extends PropsWithChildren {
3
+ className?: string;
4
+ activeColor?: string;
5
+ }
6
+ declare function RadioGroup({ className, children, activeColor, }: RadioGroupProps): import("react/jsx-runtime").JSX.Element;
7
+ export default RadioGroup;
@@ -0,0 +1,9 @@
1
+ import { ComponentProps } from "react";
2
+ export type RadioItemProps = {
3
+ name: string;
4
+ id: string;
5
+ activeColor?: string;
6
+ value?: string;
7
+ } & ComponentProps<"input">;
8
+ declare const RadioItem: import("react").ForwardRefExoticComponent<Omit<RadioItemProps, "ref"> & import("react").RefAttributes<HTMLInputElement>>;
9
+ export default RadioItem;
@@ -0,0 +1,4 @@
1
+ export declare const labelStyle = "relative flex align-middle font-semibold";
2
+ export declare const itemBaseStyle = "relative w-5 h-5 flex items-center justify-center rounded-full border-[2px] border-gray-400 left-0 top-[2px]";
3
+ export declare const itemAfterStyle = "after:transition-all after:contents-[''] after:scale-0 after:bg-gray-900 after:w-3 after:h-3 after:absolute after:rounded-full";
4
+ export declare const itemCheckedStyle = "peer-checked:w-5 peer-checked:h-5 peer-checked:after:scale-75 peer-checked:border-gray-900";
@@ -1,8 +1,8 @@
1
1
  import type { StoryObj } from "@storybook/react";
2
- import Tab from ".";
2
+ import TabItem from "./tab-item";
3
3
  declare const meta: {
4
4
  title: string;
5
- component: typeof Tab;
5
+ component: typeof TabItem;
6
6
  parameters: {
7
7
  layout: string;
8
8
  };
@@ -12,5 +12,5 @@ export default meta;
12
12
  type Story = StoryObj<typeof meta>;
13
13
  export declare const Default: Story;
14
14
  export declare const Box: Story;
15
- export declare const TextTabGroup: Story;
16
- export declare const BoxTabGroup: Story;
15
+ export declare const TextTab: Story;
16
+ export declare const BoxTab: Story;
@@ -1,12 +1,12 @@
1
- export declare const baseStyle: {
1
+ export declare const baseStyles: {
2
2
  text: string;
3
3
  box: string;
4
4
  };
5
- export declare const activeStyle: {
5
+ export declare const activeStyles: {
6
6
  text: string;
7
7
  box: string;
8
8
  };
9
- export declare const tabSize: {
9
+ export declare const tabSizeStyles: {
10
10
  text: {
11
11
  large: string;
12
12
  medium: string;
@@ -18,11 +18,11 @@ export declare const tabSize: {
18
18
  small: string;
19
19
  };
20
20
  };
21
- export declare const tabGroupBaseStyle: {
21
+ export declare const tabGroupBaseStyles: {
22
22
  text: string;
23
23
  box: string;
24
24
  };
25
- export declare const tabGroupGap: {
25
+ export declare const tabGroupGapStyles: {
26
26
  large: string;
27
27
  medium: string;
28
28
  small: string;
@@ -1,9 +1,7 @@
1
- /// <reference types="react" />
2
- interface TabProps {
3
- children: React.ReactNode;
4
- active?: boolean;
5
- className?: string;
6
- onClick?: () => void;
7
- }
8
- declare function Tab({ children, active, onClick }: TabProps): import("react/jsx-runtime").JSX.Element;
1
+ import TabGroup from "./tab-group";
2
+ import TabItem from "./tab-item";
3
+ declare const Tab: {
4
+ Item: typeof TabItem;
5
+ Group: typeof TabGroup;
6
+ };
9
7
  export default Tab;
@@ -0,0 +1,9 @@
1
+ /// <reference types="react" />
2
+ interface TabProps {
3
+ children: React.ReactNode;
4
+ active?: boolean;
5
+ className?: string;
6
+ onClick?: () => void;
7
+ }
8
+ declare function TabItem({ children, active, onClick }: TabProps): import("react/jsx-runtime").JSX.Element;
9
+ export default TabItem;