@woobee/ui 0.2.1 → 0.2.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.
- package/README.md +99 -0
- package/SKIPPED.md +0 -8
- package/dist/index.d.mts +75 -1
- package/dist/index.d.ts +75 -1
- package/dist/index.js +501 -160
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +423 -85
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -99,6 +99,14 @@ This library uses custom Tailwind color tokens. Add these to your Tailwind CSS c
|
|
|
99
99
|
| `SortIcon` | `import { SortIcon } from '@woobee/ui'` |
|
|
100
100
|
| `InlinePrompt` | `import { InlinePrompt } from '@woobee/ui'` |
|
|
101
101
|
|
|
102
|
+
### Navigation
|
|
103
|
+
|
|
104
|
+
| Component | Import |
|
|
105
|
+
|-----------|--------|
|
|
106
|
+
| `Breadcrumb` | `import { Breadcrumb } from '@woobee/ui'` |
|
|
107
|
+
| `Tab` | `import { Tab } from '@woobee/ui'` |
|
|
108
|
+
| `ButtonGroup` | `import { ButtonGroup } from '@woobee/ui'` |
|
|
109
|
+
|
|
102
110
|
### Overlays
|
|
103
111
|
|
|
104
112
|
| Component | Import |
|
|
@@ -154,6 +162,97 @@ import { Button } from '@woobee/ui'
|
|
|
154
162
|
</Button>
|
|
155
163
|
```
|
|
156
164
|
|
|
165
|
+
### Breadcrumb
|
|
166
|
+
|
|
167
|
+
Breadcrumb navigation component decoupled from the router (e.g. Next.js) using the `linkComponent` and `onBack` props.
|
|
168
|
+
|
|
169
|
+
```tsx
|
|
170
|
+
import { Breadcrumb } from '@woobee/ui'
|
|
171
|
+
import Link from 'next/link' // or any custom Link component
|
|
172
|
+
|
|
173
|
+
<Breadcrumb
|
|
174
|
+
links={[
|
|
175
|
+
{ name: 'Home', href: '/' },
|
|
176
|
+
{ name: 'Projects', href: '/projects' },
|
|
177
|
+
{ name: 'WooBee', href: '/projects/woobee' }
|
|
178
|
+
]}
|
|
179
|
+
onBack={() => window.history.back()}
|
|
180
|
+
linkComponent={({ href, className, children }) => (
|
|
181
|
+
<Link href={href} className={className}>
|
|
182
|
+
{children}
|
|
183
|
+
</Link>
|
|
184
|
+
)}
|
|
185
|
+
/>
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
### Tab
|
|
189
|
+
|
|
190
|
+
A navigation/tab component decoupled from the router, supporting redirection using a custom `linkComponent` or state management via `onChange`.
|
|
191
|
+
|
|
192
|
+
```tsx
|
|
193
|
+
import { Tab } from '@woobee/ui'
|
|
194
|
+
import Link from 'next/link'
|
|
195
|
+
|
|
196
|
+
<Tab
|
|
197
|
+
items={[
|
|
198
|
+
{ id: 'overview', label: 'Overview', link: '/overview' },
|
|
199
|
+
{ id: 'settings', label: 'Settings', link: '/settings' }
|
|
200
|
+
]}
|
|
201
|
+
label="label"
|
|
202
|
+
value="overview"
|
|
203
|
+
allowRedirect={true}
|
|
204
|
+
onChange={(item) => console.log('Tab changed:', item.id)}
|
|
205
|
+
linkComponent={({ href, className, children, onClick }) => (
|
|
206
|
+
<Link href={href} className={className} onClick={onClick}>
|
|
207
|
+
{children}
|
|
208
|
+
</Link>
|
|
209
|
+
)}
|
|
210
|
+
/>
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
### ButtonGroup
|
|
214
|
+
|
|
215
|
+
A versatile group of buttons or navigation links, supporting custom routing via `linkComponent` and nested dropdown menus via `subgroupModal`.
|
|
216
|
+
|
|
217
|
+
```tsx
|
|
218
|
+
import { ButtonGroup } from '@woobee/ui'
|
|
219
|
+
import Link from 'next/link'
|
|
220
|
+
|
|
221
|
+
<ButtonGroup
|
|
222
|
+
buttons={[
|
|
223
|
+
{ id: 'home', label: 'Home', url: '/' },
|
|
224
|
+
{
|
|
225
|
+
id: 'settings',
|
|
226
|
+
label: 'Settings',
|
|
227
|
+
subgroups: [
|
|
228
|
+
{ id: 'profile', label: 'Profile Settings', url: '/settings/profile' },
|
|
229
|
+
{ id: 'security', label: 'Security', url: '/settings/security' }
|
|
230
|
+
]
|
|
231
|
+
}
|
|
232
|
+
]}
|
|
233
|
+
activeId="home"
|
|
234
|
+
direction="horizontal"
|
|
235
|
+
onChange={(id) => console.log('Button clicked:', id)}
|
|
236
|
+
linkComponent={({ href, children }) => (
|
|
237
|
+
<Link href={href}>
|
|
238
|
+
{children}
|
|
239
|
+
</Link>
|
|
240
|
+
)}
|
|
241
|
+
subgroupModal={({ open, label, items, onClose, onChange }) => (
|
|
242
|
+
// Render custom modal here for subgroups
|
|
243
|
+
open ? (
|
|
244
|
+
<div className="subgroup-modal">
|
|
245
|
+
<h4>{label}</h4>
|
|
246
|
+
{items?.map(item => (
|
|
247
|
+
<a key={item.id} href={item.url}>{item.label}</a>
|
|
248
|
+
))}
|
|
249
|
+
<button onClick={onClose}>Close</button>
|
|
250
|
+
</div>
|
|
251
|
+
) : null
|
|
252
|
+
)}
|
|
253
|
+
/>
|
|
254
|
+
```
|
|
255
|
+
|
|
157
256
|
### Modal
|
|
158
257
|
|
|
159
258
|
```tsx
|
package/SKIPPED.md
CHANGED
|
@@ -6,14 +6,6 @@ They can be added in future iterations once their dependencies are decoupled.
|
|
|
6
6
|
|
|
7
7
|
---
|
|
8
8
|
|
|
9
|
-
## Components with Next.js / Router Dependencies
|
|
10
|
-
|
|
11
|
-
| Component | Source File | Blocking Dependency |
|
|
12
|
-
|-----------|-----------|---------------------|
|
|
13
|
-
| **ButtonGroup** | `ui/ButtonGroup.js` | `next/link`, `useRouter`, `NAV_LINKS` constants, `NavigationModal` |
|
|
14
|
-
| **Breadcrumb** | `ui/Breadcrumb/index.js` | `next/link`, `useRouter` |
|
|
15
|
-
| **Tab** | `ui/Tab/index.js` | `next/link` |
|
|
16
|
-
|
|
17
9
|
## Components with App Context Dependencies
|
|
18
10
|
|
|
19
11
|
| Component | Source File | Blocking Dependency |
|
package/dist/index.d.mts
CHANGED
|
@@ -199,6 +199,80 @@ interface InlinePromptProps {
|
|
|
199
199
|
}
|
|
200
200
|
declare function InlinePrompt({ title, onConfirm, className, withText, confirmText, cancelText, opts, }: InlinePromptProps): React.JSX.Element;
|
|
201
201
|
|
|
202
|
+
interface BreadcrumbLink {
|
|
203
|
+
name: string;
|
|
204
|
+
href: string;
|
|
205
|
+
}
|
|
206
|
+
interface BreadcrumbProps {
|
|
207
|
+
links?: BreadcrumbLink[];
|
|
208
|
+
onBack?: () => void;
|
|
209
|
+
linkComponent?: (props: {
|
|
210
|
+
href: string;
|
|
211
|
+
className?: string;
|
|
212
|
+
children: ReactNode;
|
|
213
|
+
}) => ReactNode;
|
|
214
|
+
}
|
|
215
|
+
declare function Breadcrumb({ links, onBack, linkComponent: LinkComponent, }: BreadcrumbProps): React.JSX.Element;
|
|
216
|
+
|
|
217
|
+
interface TabItem {
|
|
218
|
+
id: string;
|
|
219
|
+
link?: string;
|
|
220
|
+
[key: string]: any;
|
|
221
|
+
}
|
|
222
|
+
interface TabProps {
|
|
223
|
+
items: TabItem[];
|
|
224
|
+
label: string;
|
|
225
|
+
value?: string | null;
|
|
226
|
+
defaultValue?: string | null;
|
|
227
|
+
allowRedirect?: boolean;
|
|
228
|
+
onChange?: (item: TabItem) => void;
|
|
229
|
+
rightContent?: ReactNode;
|
|
230
|
+
linkComponent?: (props: {
|
|
231
|
+
href: string;
|
|
232
|
+
className?: string;
|
|
233
|
+
children: ReactNode;
|
|
234
|
+
onClick?: () => void;
|
|
235
|
+
}) => ReactNode;
|
|
236
|
+
}
|
|
237
|
+
declare function Tab({ items, label, value, defaultValue, allowRedirect, onChange, rightContent, linkComponent, }: TabProps): React.JSX.Element;
|
|
238
|
+
|
|
239
|
+
interface ButtonGroupNavLink {
|
|
240
|
+
url: string;
|
|
241
|
+
label: string;
|
|
242
|
+
icon?: ReactNode;
|
|
243
|
+
}
|
|
244
|
+
interface ButtonGroupItem {
|
|
245
|
+
id: string;
|
|
246
|
+
label?: string;
|
|
247
|
+
image?: ReactNode | string;
|
|
248
|
+
icon?: ReactNode;
|
|
249
|
+
url?: string;
|
|
250
|
+
subgroups?: ButtonGroupItem[];
|
|
251
|
+
}
|
|
252
|
+
interface ButtonGroupProps {
|
|
253
|
+
buttons?: ButtonGroupItem[];
|
|
254
|
+
direction?: 'horizontal' | 'vertical';
|
|
255
|
+
iconPosition?: 'front' | 'back';
|
|
256
|
+
activeId?: string;
|
|
257
|
+
onChange?: (id: string) => void;
|
|
258
|
+
className?: string;
|
|
259
|
+
itemClassName?: string;
|
|
260
|
+
currentPath?: string;
|
|
261
|
+
navLinks?: ButtonGroupNavLink[];
|
|
262
|
+
linkComponent?: (props: {
|
|
263
|
+
href: string;
|
|
264
|
+
children: ReactNode;
|
|
265
|
+
}) => ReactNode;
|
|
266
|
+
subgroupModal?: (props: {
|
|
267
|
+
open: boolean;
|
|
268
|
+
label?: string;
|
|
269
|
+
items?: ButtonGroupItem[];
|
|
270
|
+
onClose: () => void;
|
|
271
|
+
onChange?: (id: string) => void;
|
|
272
|
+
}) => ReactNode;
|
|
273
|
+
}
|
|
274
|
+
declare function ButtonGroup({ buttons, direction, iconPosition, activeId, onChange, className, itemClassName, currentPath, navLinks, linkComponent, subgroupModal, }: ButtonGroupProps): React.JSX.Element;
|
|
275
|
+
|
|
202
276
|
interface HTMLHeadingProps {
|
|
203
277
|
id?: string;
|
|
204
278
|
className?: string;
|
|
@@ -576,4 +650,4 @@ interface ModalFooterProps {
|
|
|
576
650
|
darkMode?: boolean;
|
|
577
651
|
}
|
|
578
652
|
|
|
579
|
-
export { B, type BoldProps, Button, type ButtonProps, type ButtonSize, type ButtonVariant, CheckboxList, type CheckboxListProps, ConfirmationBox, type ConfirmationBoxProps, type ConfirmationType, Coverflow, type CoverflowImage, type CoverflowProps, DataGrid, type DataGridHeaderConfig, type DataGridProps, Dragger, type DraggerProps, Drawer, type DrawerAnimationProps, type DrawerLevel, type DrawerProps, type DrawerTheme, type ExcelColumn, ExcelTable, type ExcelTableProps, H1, H2, H3, H4, type HTMLHeadingProps, InlinePrompt, type InlinePromptProps, Input, type InputProps, type InputType, Label, type LabelProps, Loading, type LoadingLayout, type LoadingProps, Modal, ModalContext, type ModalFooterProps, type ModalOpts, type ModalProps, ModalProvider, type ModalSize, NoData, type NoDataProps, Popover, type PopoverAction, type PopoverActionItem, PopoverContext, type PopoverContextProps, type PopoverProps, PopoverProvider, type PopoverState, type ResizeListenerProps, type ResizeValues, Select, SelectInput, type SelectInputItem, type SelectInputProps, type SelectProps, type SortDirection, SortIcon, type SortIconProps, type TabOption, Table, type TableProps, Tabs, type TabsProps, Tag, TagGroup, type TagGroupProps, TagInput, type TagInputProps, type TagItem, type TagProps, type TagSize, Tbody, Td, type TdProps, Textarea, type TextareaProps, Th, type ThProps, Thead, ThemeContext, type ThemeContextProps, ThemeProvider, ThemeToggle, Toggle, type ToggleProps, type ToggleSize, Tr, Transition, type TransitionProps, bestTextColorForBg, classNameObject, classNames, debounce, moveItem, numberFormatter, useDebounce, useModalContext, usePopoverContext, useResizeListener, useThemeContext };
|
|
653
|
+
export { B, type BoldProps, Breadcrumb, type BreadcrumbLink, type BreadcrumbProps, Button, ButtonGroup, type ButtonGroupItem, type ButtonGroupNavLink, type ButtonGroupProps, type ButtonProps, type ButtonSize, type ButtonVariant, CheckboxList, type CheckboxListProps, ConfirmationBox, type ConfirmationBoxProps, type ConfirmationType, Coverflow, type CoverflowImage, type CoverflowProps, DataGrid, type DataGridHeaderConfig, type DataGridProps, Dragger, type DraggerProps, Drawer, type DrawerAnimationProps, type DrawerLevel, type DrawerProps, type DrawerTheme, type ExcelColumn, ExcelTable, type ExcelTableProps, H1, H2, H3, H4, type HTMLHeadingProps, InlinePrompt, type InlinePromptProps, Input, type InputProps, type InputType, Label, type LabelProps, Loading, type LoadingLayout, type LoadingProps, Modal, ModalContext, type ModalFooterProps, type ModalOpts, type ModalProps, ModalProvider, type ModalSize, NoData, type NoDataProps, Popover, type PopoverAction, type PopoverActionItem, PopoverContext, type PopoverContextProps, type PopoverProps, PopoverProvider, type PopoverState, type ResizeListenerProps, type ResizeValues, Select, SelectInput, type SelectInputItem, type SelectInputProps, type SelectProps, type SortDirection, SortIcon, type SortIconProps, Tab, type TabItem, type TabOption, type TabProps, Table, type TableProps, Tabs, type TabsProps, Tag, TagGroup, type TagGroupProps, TagInput, type TagInputProps, type TagItem, type TagProps, type TagSize, Tbody, Td, type TdProps, Textarea, type TextareaProps, Th, type ThProps, Thead, ThemeContext, type ThemeContextProps, ThemeProvider, ThemeToggle, Toggle, type ToggleProps, type ToggleSize, Tr, Transition, type TransitionProps, bestTextColorForBg, classNameObject, classNames, debounce, moveItem, numberFormatter, useDebounce, useModalContext, usePopoverContext, useResizeListener, useThemeContext };
|
package/dist/index.d.ts
CHANGED
|
@@ -199,6 +199,80 @@ interface InlinePromptProps {
|
|
|
199
199
|
}
|
|
200
200
|
declare function InlinePrompt({ title, onConfirm, className, withText, confirmText, cancelText, opts, }: InlinePromptProps): React.JSX.Element;
|
|
201
201
|
|
|
202
|
+
interface BreadcrumbLink {
|
|
203
|
+
name: string;
|
|
204
|
+
href: string;
|
|
205
|
+
}
|
|
206
|
+
interface BreadcrumbProps {
|
|
207
|
+
links?: BreadcrumbLink[];
|
|
208
|
+
onBack?: () => void;
|
|
209
|
+
linkComponent?: (props: {
|
|
210
|
+
href: string;
|
|
211
|
+
className?: string;
|
|
212
|
+
children: ReactNode;
|
|
213
|
+
}) => ReactNode;
|
|
214
|
+
}
|
|
215
|
+
declare function Breadcrumb({ links, onBack, linkComponent: LinkComponent, }: BreadcrumbProps): React.JSX.Element;
|
|
216
|
+
|
|
217
|
+
interface TabItem {
|
|
218
|
+
id: string;
|
|
219
|
+
link?: string;
|
|
220
|
+
[key: string]: any;
|
|
221
|
+
}
|
|
222
|
+
interface TabProps {
|
|
223
|
+
items: TabItem[];
|
|
224
|
+
label: string;
|
|
225
|
+
value?: string | null;
|
|
226
|
+
defaultValue?: string | null;
|
|
227
|
+
allowRedirect?: boolean;
|
|
228
|
+
onChange?: (item: TabItem) => void;
|
|
229
|
+
rightContent?: ReactNode;
|
|
230
|
+
linkComponent?: (props: {
|
|
231
|
+
href: string;
|
|
232
|
+
className?: string;
|
|
233
|
+
children: ReactNode;
|
|
234
|
+
onClick?: () => void;
|
|
235
|
+
}) => ReactNode;
|
|
236
|
+
}
|
|
237
|
+
declare function Tab({ items, label, value, defaultValue, allowRedirect, onChange, rightContent, linkComponent, }: TabProps): React.JSX.Element;
|
|
238
|
+
|
|
239
|
+
interface ButtonGroupNavLink {
|
|
240
|
+
url: string;
|
|
241
|
+
label: string;
|
|
242
|
+
icon?: ReactNode;
|
|
243
|
+
}
|
|
244
|
+
interface ButtonGroupItem {
|
|
245
|
+
id: string;
|
|
246
|
+
label?: string;
|
|
247
|
+
image?: ReactNode | string;
|
|
248
|
+
icon?: ReactNode;
|
|
249
|
+
url?: string;
|
|
250
|
+
subgroups?: ButtonGroupItem[];
|
|
251
|
+
}
|
|
252
|
+
interface ButtonGroupProps {
|
|
253
|
+
buttons?: ButtonGroupItem[];
|
|
254
|
+
direction?: 'horizontal' | 'vertical';
|
|
255
|
+
iconPosition?: 'front' | 'back';
|
|
256
|
+
activeId?: string;
|
|
257
|
+
onChange?: (id: string) => void;
|
|
258
|
+
className?: string;
|
|
259
|
+
itemClassName?: string;
|
|
260
|
+
currentPath?: string;
|
|
261
|
+
navLinks?: ButtonGroupNavLink[];
|
|
262
|
+
linkComponent?: (props: {
|
|
263
|
+
href: string;
|
|
264
|
+
children: ReactNode;
|
|
265
|
+
}) => ReactNode;
|
|
266
|
+
subgroupModal?: (props: {
|
|
267
|
+
open: boolean;
|
|
268
|
+
label?: string;
|
|
269
|
+
items?: ButtonGroupItem[];
|
|
270
|
+
onClose: () => void;
|
|
271
|
+
onChange?: (id: string) => void;
|
|
272
|
+
}) => ReactNode;
|
|
273
|
+
}
|
|
274
|
+
declare function ButtonGroup({ buttons, direction, iconPosition, activeId, onChange, className, itemClassName, currentPath, navLinks, linkComponent, subgroupModal, }: ButtonGroupProps): React.JSX.Element;
|
|
275
|
+
|
|
202
276
|
interface HTMLHeadingProps {
|
|
203
277
|
id?: string;
|
|
204
278
|
className?: string;
|
|
@@ -576,4 +650,4 @@ interface ModalFooterProps {
|
|
|
576
650
|
darkMode?: boolean;
|
|
577
651
|
}
|
|
578
652
|
|
|
579
|
-
export { B, type BoldProps, Button, type ButtonProps, type ButtonSize, type ButtonVariant, CheckboxList, type CheckboxListProps, ConfirmationBox, type ConfirmationBoxProps, type ConfirmationType, Coverflow, type CoverflowImage, type CoverflowProps, DataGrid, type DataGridHeaderConfig, type DataGridProps, Dragger, type DraggerProps, Drawer, type DrawerAnimationProps, type DrawerLevel, type DrawerProps, type DrawerTheme, type ExcelColumn, ExcelTable, type ExcelTableProps, H1, H2, H3, H4, type HTMLHeadingProps, InlinePrompt, type InlinePromptProps, Input, type InputProps, type InputType, Label, type LabelProps, Loading, type LoadingLayout, type LoadingProps, Modal, ModalContext, type ModalFooterProps, type ModalOpts, type ModalProps, ModalProvider, type ModalSize, NoData, type NoDataProps, Popover, type PopoverAction, type PopoverActionItem, PopoverContext, type PopoverContextProps, type PopoverProps, PopoverProvider, type PopoverState, type ResizeListenerProps, type ResizeValues, Select, SelectInput, type SelectInputItem, type SelectInputProps, type SelectProps, type SortDirection, SortIcon, type SortIconProps, type TabOption, Table, type TableProps, Tabs, type TabsProps, Tag, TagGroup, type TagGroupProps, TagInput, type TagInputProps, type TagItem, type TagProps, type TagSize, Tbody, Td, type TdProps, Textarea, type TextareaProps, Th, type ThProps, Thead, ThemeContext, type ThemeContextProps, ThemeProvider, ThemeToggle, Toggle, type ToggleProps, type ToggleSize, Tr, Transition, type TransitionProps, bestTextColorForBg, classNameObject, classNames, debounce, moveItem, numberFormatter, useDebounce, useModalContext, usePopoverContext, useResizeListener, useThemeContext };
|
|
653
|
+
export { B, type BoldProps, Breadcrumb, type BreadcrumbLink, type BreadcrumbProps, Button, ButtonGroup, type ButtonGroupItem, type ButtonGroupNavLink, type ButtonGroupProps, type ButtonProps, type ButtonSize, type ButtonVariant, CheckboxList, type CheckboxListProps, ConfirmationBox, type ConfirmationBoxProps, type ConfirmationType, Coverflow, type CoverflowImage, type CoverflowProps, DataGrid, type DataGridHeaderConfig, type DataGridProps, Dragger, type DraggerProps, Drawer, type DrawerAnimationProps, type DrawerLevel, type DrawerProps, type DrawerTheme, type ExcelColumn, ExcelTable, type ExcelTableProps, H1, H2, H3, H4, type HTMLHeadingProps, InlinePrompt, type InlinePromptProps, Input, type InputProps, type InputType, Label, type LabelProps, Loading, type LoadingLayout, type LoadingProps, Modal, ModalContext, type ModalFooterProps, type ModalOpts, type ModalProps, ModalProvider, type ModalSize, NoData, type NoDataProps, Popover, type PopoverAction, type PopoverActionItem, PopoverContext, type PopoverContextProps, type PopoverProps, PopoverProvider, type PopoverState, type ResizeListenerProps, type ResizeValues, Select, SelectInput, type SelectInputItem, type SelectInputProps, type SelectProps, type SortDirection, SortIcon, type SortIconProps, Tab, type TabItem, type TabOption, type TabProps, Table, type TableProps, Tabs, type TabsProps, Tag, TagGroup, type TagGroupProps, TagInput, type TagInputProps, type TagItem, type TagProps, type TagSize, Tbody, Td, type TdProps, Textarea, type TextareaProps, Th, type ThProps, Thead, ThemeContext, type ThemeContextProps, ThemeProvider, ThemeToggle, Toggle, type ToggleProps, type ToggleSize, Tr, Transition, type TransitionProps, bestTextColorForBg, classNameObject, classNames, debounce, moveItem, numberFormatter, useDebounce, useModalContext, usePopoverContext, useResizeListener, useThemeContext };
|