@keboola/design 1.3.1 → 2.0.1
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/dist/icons.cjs +32 -0
- package/dist/icons.js +1 -1
- package/dist/index.cjs +507 -103
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +495 -106
- package/dist/index.js.map +1 -1
- package/dist/markdown-editor.cjs +78 -42
- package/dist/markdown-editor.cjs.map +1 -1
- package/dist/markdown-editor.js +78 -42
- package/dist/markdown-editor.js.map +1 -1
- package/dist/mermaid.cjs +32 -9
- package/dist/mermaid.cjs.map +1 -1
- package/dist/mermaid.js +32 -9
- package/dist/mermaid.js.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +8 -6
- package/src/blocks/AIKit/PlanApproval.tsx +29 -12
- package/src/blocks/AIKit/PromptInput.test.tsx +53 -0
- package/src/blocks/AIKit/PromptInput.tsx +1 -1
- package/src/blocks/AIKit/Question.tsx +39 -11
- package/src/blocks/AIKit/SuggestedPrompt.stories.tsx +2 -8
- package/src/blocks/EmptyState/EmptyState.stories.tsx +5 -5
- package/src/blocks/EmptyState/EmptyState.tsx +2 -2
- package/src/blocks/ErrorState/ErrorState.stories.tsx +6 -6
- package/src/blocks/ErrorState/ErrorState.tsx +18 -3
- package/src/blocks/InputOtp/InputOtp.stories.tsx +214 -0
- package/src/blocks/InputOtp/InputOtp.test.tsx +162 -0
- package/src/blocks/InputOtp/InputOtp.tsx +62 -0
- package/src/blocks/InputOtp/InputOtpGroup.tsx +13 -0
- package/src/blocks/InputOtp/InputOtpSeparator.tsx +23 -0
- package/src/blocks/InputOtp/InputOtpSlot.styles.ts +52 -0
- package/src/blocks/InputOtp/InputOtpSlot.tsx +44 -0
- package/src/blocks/InputOtp/context.ts +23 -0
- package/src/blocks/InputOtp/index.ts +23 -0
- package/src/blocks/PageHeader/AGENTS.md +1 -1
- package/src/blocks/PageHeader/PageHeader.stories.tsx +6 -3
- package/src/blocks/PageHeader/PageHeaderIndex.tsx +2 -2
- package/src/blocks/PageLayout/AGENTS.md +3 -3
- package/src/blocks/PageLayout/PageLayout.stories.tsx +7 -4
- package/src/blocks/PageLayout/PageLayout.tsx +1 -18
- package/src/blocks/PageToolbar/PageToolbar.stories.tsx +79 -74
- package/src/blocks/PageToolbar/PageToolbar.tsx +45 -4
- package/src/blocks/PageToolbar/PageToolbarToken.tsx +61 -0
- package/src/blocks/SearchInput/SearchInput.tsx +2 -2
- package/src/components/Alert/AlertDescription.tsx +5 -0
- package/src/components/Alert/AlertIcon.tsx +1 -1
- package/src/components/Badge/Badge.stories.tsx +3 -5
- package/src/components/Badge/BadgeAddon.tsx +1 -1
- package/src/components/Badge/BadgeButton.tsx +1 -1
- package/src/components/Breadcrumb/Breadcrumb.stories.tsx +4 -4
- package/src/components/Breadcrumb/BreadcrumbLink.tsx +1 -1
- package/src/components/Breadcrumb/BreadcrumbSeparator.tsx +1 -1
- package/src/components/Button/ButtonInline.stories.tsx +3 -3
- package/src/components/Button/ButtonInline.tsx +4 -0
- package/src/components/Button/styles.ts +33 -10
- package/src/components/Card/Card.stories.tsx +2 -2
- package/src/components/Combobox/ComboboxItemIndicator.tsx +1 -1
- package/src/components/Command/CommandItem/CommandItem.tsx +1 -1
- package/src/components/DropdownMenu/DropdownMenuItemIndicator.tsx +4 -4
- package/src/components/DropdownMenu/ItemIcon.tsx +1 -1
- package/src/components/FormGroup/FormGroup.stories.tsx +2 -2
- package/src/components/HoverCard/HoverCardContent.tsx +5 -0
- package/src/components/Input/Input.stories.tsx +2 -2
- package/src/components/InputGroup/InputGroup.stories.tsx +4 -5
- package/src/components/InputGroup/InputGroup.tsx +1 -1
- package/src/components/InputGroup/InputGroupAddon.tsx +35 -24
- package/src/components/Kbd/Kbd.stories.tsx +2 -2
- package/src/components/Label/Label.stories.tsx +2 -2
- package/src/components/Modal/ModalBody.tsx +5 -0
- package/src/components/Modal/ModalIcon.tsx +1 -1
- package/src/components/Navbar/Navbar.stories.tsx +4 -5
- package/src/components/Navbar/NavbarMenuItemAdornment.tsx +2 -2
- package/src/components/Pagination/Pagination.stories.tsx +0 -1
- package/src/components/Pagination/PaginationEllipsis.tsx +1 -1
- package/src/components/Popover/PopoverContent.tsx +4 -0
- package/src/components/Select/SelectContent.tsx +1 -1
- package/src/components/Select/SelectTrigger.tsx +1 -1
- package/src/components/Separator/Separator.stories.tsx +19 -0
- package/src/components/Separator/Separator.test.tsx +39 -0
- package/src/components/Separator/Separator.tsx +42 -11
- package/src/components/Sidebar/Sidebar.stories.tsx +6 -5
- package/src/components/Sidebar/SidebarGroup/SidebarGroupAction.tsx +1 -1
- package/src/components/Sidebar/SidebarMenu/SidebarMenuAction.tsx +1 -1
- package/src/components/Sidebar/SidebarMenu/SidebarMenuIcon.tsx +1 -1
- package/src/components/Table/Table.stories.tsx +16 -16
- package/src/components/Timeline/Timeline.stories.tsx +8 -8
- package/src/components/Timeline/TimelineConnector.tsx +5 -1
- package/src/components/Toast/ToastDismiss.tsx +1 -1
- package/src/components/Toast/ToastRoot.tsx +1 -1
- package/src/components/Toggle/Toggle.tsx +1 -1
- package/src/components/ToggleGroup/ToggleGroup.stories.tsx +60 -0
- package/src/components/ToggleGroup/ToggleGroup.tsx +99 -0
- package/src/components/ToggleGroup/index.ts +1 -0
- package/src/components/Tooltip/Tooltip.stories.tsx +2 -2
- package/src/hooks/useAutosizeInput.stories.tsx +2 -2
- package/src/icons/index.ts +8 -0
- package/src/index.ts +2 -0
- package/src/patterns/FilterToolbar.stories.tsx +248 -44
|
@@ -4,6 +4,8 @@ import type { Decorator, Meta, StoryObj } from '@storybook/react-vite';
|
|
|
4
4
|
import type { InputType } from 'storybook/internal/types';
|
|
5
5
|
|
|
6
6
|
import {
|
|
7
|
+
AlertTriangle,
|
|
8
|
+
Ellipsis,
|
|
7
9
|
Expand,
|
|
8
10
|
Gauge,
|
|
9
11
|
Keboola,
|
|
@@ -21,7 +23,6 @@ import { cn } from '../../utils';
|
|
|
21
23
|
import { Button } from '../Button';
|
|
22
24
|
import { ButtonGroup } from '../ButtonGroup';
|
|
23
25
|
import { DropdownMenu } from '../DropdownMenu';
|
|
24
|
-
import { Icon } from '../Icon';
|
|
25
26
|
import { Link } from '../Link';
|
|
26
27
|
import { Modal } from '../Modal';
|
|
27
28
|
|
|
@@ -547,7 +548,7 @@ export const MenuAction: Story = {
|
|
|
547
548
|
<DropdownMenu>
|
|
548
549
|
<DropdownMenu.Trigger asChild>
|
|
549
550
|
<Sidebar.MenuAction showOnHover>
|
|
550
|
-
<
|
|
551
|
+
<Ellipsis />
|
|
551
552
|
<span className="tw-sr-only">Actions</span>
|
|
552
553
|
</Sidebar.MenuAction>
|
|
553
554
|
</DropdownMenu.Trigger>
|
|
@@ -571,7 +572,7 @@ export const MenuAction: Story = {
|
|
|
571
572
|
</Sidebar.MenuButton>
|
|
572
573
|
|
|
573
574
|
<Sidebar.MenuAction asChild>
|
|
574
|
-
<
|
|
575
|
+
<AlertTriangle className="tw-text-warning-600" />
|
|
575
576
|
</Sidebar.MenuAction>
|
|
576
577
|
</Sidebar.MenuItem>
|
|
577
578
|
<Sidebar.MenuItem>
|
|
@@ -579,7 +580,7 @@ export const MenuAction: Story = {
|
|
|
579
580
|
<span className="tw-truncate">As Non-actionable with Very long text</span>
|
|
580
581
|
</Sidebar.MenuButton>
|
|
581
582
|
<Sidebar.MenuAction asChild>
|
|
582
|
-
<
|
|
583
|
+
<AlertTriangle className="tw-text-warning-600" />
|
|
583
584
|
</Sidebar.MenuAction>
|
|
584
585
|
</Sidebar.MenuItem>
|
|
585
586
|
<Sidebar.MenuItem>
|
|
@@ -589,7 +590,7 @@ export const MenuAction: Story = {
|
|
|
589
590
|
</Sidebar.MenuButton>
|
|
590
591
|
<Sidebar.MenuAction asChild>
|
|
591
592
|
<Link href="#">
|
|
592
|
-
<
|
|
593
|
+
<Gauge className="tw-text-warning-600" />
|
|
593
594
|
<span className="tw-sr-only">Dashboard</span>
|
|
594
595
|
</Link>
|
|
595
596
|
</Sidebar.MenuAction>
|
|
@@ -6,8 +6,8 @@ import { EmptyState } from '../../blocks/EmptyState';
|
|
|
6
6
|
import { ErrorState } from '../../blocks/ErrorState';
|
|
7
7
|
import { SearchInput } from '../../blocks/SearchInput';
|
|
8
8
|
import { Button } from '../../components/Button';
|
|
9
|
-
import { Icon } from '../../components/Icon';
|
|
10
9
|
import { Pagination } from '../../components/Pagination';
|
|
10
|
+
import { ChevronDown, ChevronsUpDown, ChevronUp, CircleAlert, Search } from '../../icons';
|
|
11
11
|
|
|
12
12
|
import { Table } from './Table';
|
|
13
13
|
|
|
@@ -141,19 +141,19 @@ const SortHeader = ({
|
|
|
141
141
|
direction: SortDir;
|
|
142
142
|
onClick: () => void;
|
|
143
143
|
children: ReactNode;
|
|
144
|
-
}) =>
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
className="tw-size-3 tw-text-muted-foreground"
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
144
|
+
}) => {
|
|
145
|
+
const SortIcon = !active ? ChevronsUpDown : direction === 'asc' ? ChevronUp : ChevronDown;
|
|
146
|
+
return (
|
|
147
|
+
<button
|
|
148
|
+
type="button"
|
|
149
|
+
onClick={onClick}
|
|
150
|
+
className="tw-group tw-flex tw-cursor-pointer tw-items-center tw-gap-1 tw-border-0 tw-bg-transparent tw-p-0 tw-font-medium tw-text-inherit"
|
|
151
|
+
>
|
|
152
|
+
{children}
|
|
153
|
+
<SortIcon className="tw-size-3 tw-text-muted-foreground" />
|
|
154
|
+
</button>
|
|
155
|
+
);
|
|
156
|
+
};
|
|
157
157
|
|
|
158
158
|
/**
|
|
159
159
|
* Canonical entity-list pattern: `Table` (presentational) composed with `SearchInput`, `Pagination`,
|
|
@@ -213,7 +213,7 @@ export const AsEntityList: Story = {
|
|
|
213
213
|
{filtered.length === 0 ? (
|
|
214
214
|
<EmptyState>
|
|
215
215
|
<EmptyState.Icon>
|
|
216
|
-
<
|
|
216
|
+
<Search />
|
|
217
217
|
</EmptyState.Icon>
|
|
218
218
|
<EmptyState.Title>No tokens match your search</EmptyState.Title>
|
|
219
219
|
<EmptyState.Description>
|
|
@@ -313,7 +313,7 @@ export const AsEntityListError: Story = {
|
|
|
313
313
|
<SearchInput allowClear placeholder="Search tokens…" disabled className="tw-w-72" />
|
|
314
314
|
<ErrorState>
|
|
315
315
|
<ErrorState.Icon>
|
|
316
|
-
<
|
|
316
|
+
<CircleAlert />
|
|
317
317
|
</ErrorState.Icon>
|
|
318
318
|
<ErrorState.Title>Couldn't load tokens</ErrorState.Title>
|
|
319
319
|
<ErrorState.Description>
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { ComponentProps } from 'react';
|
|
2
2
|
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
3
3
|
|
|
4
|
+
import { Check, Circle, Search, Warehouse } from '../../icons';
|
|
4
5
|
import { Alert } from '../Alert';
|
|
5
6
|
import { ButtonInline } from '../Button';
|
|
6
|
-
import { Icon } from '../Icon';
|
|
7
7
|
|
|
8
8
|
import { Timeline } from './Timeline';
|
|
9
9
|
|
|
@@ -94,21 +94,21 @@ export const Icons: Story = {
|
|
|
94
94
|
<Timeline {...props}>
|
|
95
95
|
<Timeline.Item>
|
|
96
96
|
<Timeline.Connector variant="icon">
|
|
97
|
-
<
|
|
97
|
+
<Check />
|
|
98
98
|
</Timeline.Connector>
|
|
99
99
|
<Timeline.Content>Checked</Timeline.Content>
|
|
100
100
|
</Timeline.Item>
|
|
101
101
|
|
|
102
102
|
<Timeline.Item>
|
|
103
103
|
<Timeline.Connector variant="icon">
|
|
104
|
-
<
|
|
104
|
+
<Circle />
|
|
105
105
|
</Timeline.Connector>
|
|
106
106
|
<Timeline.Content>Dot</Timeline.Content>
|
|
107
107
|
</Timeline.Item>
|
|
108
108
|
|
|
109
109
|
<Timeline.Item>
|
|
110
110
|
<Timeline.Connector variant="icon">
|
|
111
|
-
<
|
|
111
|
+
<Search />
|
|
112
112
|
</Timeline.Connector>
|
|
113
113
|
<Timeline.Content>Search</Timeline.Content>
|
|
114
114
|
</Timeline.Item>
|
|
@@ -184,7 +184,7 @@ export const Nested: Story = {
|
|
|
184
184
|
<Timeline variant="solid">
|
|
185
185
|
<Timeline.Item>
|
|
186
186
|
<Timeline.Connector variant="icon">
|
|
187
|
-
<
|
|
187
|
+
<Warehouse />
|
|
188
188
|
</Timeline.Connector>
|
|
189
189
|
<Timeline.Content className="tw-gap-2">
|
|
190
190
|
<h4>Create SQL Transformation</h4>
|
|
@@ -194,7 +194,7 @@ export const Nested: Story = {
|
|
|
194
194
|
<Timeline.Item>
|
|
195
195
|
<Timeline.Connector variant="line" />
|
|
196
196
|
<Timeline.Content className="tw-gap-2">
|
|
197
|
-
<
|
|
197
|
+
<Warehouse className="tw-size-4 tw-text-neutral-400" />
|
|
198
198
|
<div className="tw-flex tw-flex-col">
|
|
199
199
|
<h4>Documentation Query</h4>
|
|
200
200
|
<div className="tw-flex tw-gap-2">
|
|
@@ -207,7 +207,7 @@ export const Nested: Story = {
|
|
|
207
207
|
<Timeline.Item>
|
|
208
208
|
<Timeline.Connector variant="line" />
|
|
209
209
|
<Timeline.Content className="tw-gap-2">
|
|
210
|
-
<
|
|
210
|
+
<Warehouse className="tw-size-4 tw-text-neutral-400" />
|
|
211
211
|
<div className="tw-flex tw-flex-col">
|
|
212
212
|
<h4>Documentation Query</h4>
|
|
213
213
|
<div className="tw-flex tw-gap-2">
|
|
@@ -220,7 +220,7 @@ export const Nested: Story = {
|
|
|
220
220
|
<Timeline.Item>
|
|
221
221
|
<Timeline.Connector align="start" variant="line" />
|
|
222
222
|
<Timeline.Content className="tw-gap-2">
|
|
223
|
-
<
|
|
223
|
+
<Warehouse className="tw-size-4 tw-text-neutral-400" />
|
|
224
224
|
<div className="tw-flex tw-flex-col">
|
|
225
225
|
<h4>Documentation Query</h4>
|
|
226
226
|
<div className="tw-flex tw-gap-2">
|
|
@@ -74,7 +74,11 @@ const connector = cva(
|
|
|
74
74
|
'tw-text-nowrap',
|
|
75
75
|
'tw-text-xs',
|
|
76
76
|
],
|
|
77
|
-
icon: [
|
|
77
|
+
icon: [
|
|
78
|
+
'tw-bg-white',
|
|
79
|
+
'[&_svg:not([class*="tw-size-"])]:tw-size-4',
|
|
80
|
+
'[&_svg]:tw-text-neutral-300',
|
|
81
|
+
],
|
|
78
82
|
line: [
|
|
79
83
|
'tw-min-w-8',
|
|
80
84
|
'tw-overflow-hidden',
|
|
@@ -112,7 +112,7 @@ export const ToastRoot = ({
|
|
|
112
112
|
'tw-aspect-square',
|
|
113
113
|
'tw-size-5',
|
|
114
114
|
'tw-shrink-0',
|
|
115
|
-
'[&_svg]:tw-size-5',
|
|
115
|
+
'[&_svg:not([class*="tw-size-"])]:tw-size-5',
|
|
116
116
|
'tw-text-white',
|
|
117
117
|
'group-data-[variant=default]/toast:tw-text-popover-foreground',
|
|
118
118
|
)}
|
|
@@ -185,7 +185,7 @@ export const Toggle = ({
|
|
|
185
185
|
</span>
|
|
186
186
|
)}
|
|
187
187
|
{icon && (
|
|
188
|
-
<span className="tw-inline-flex tw-size-4 tw-shrink-0 tw-items-center tw-justify-center tw-align-middle [&_svg]:tw-size-4">
|
|
188
|
+
<span className="tw-inline-flex tw-size-4 tw-shrink-0 tw-items-center tw-justify-center tw-align-middle [&_svg:not([class*='tw-size-'])]:tw-size-4">
|
|
189
189
|
{renderLegacyIcon(icon)}
|
|
190
190
|
</span>
|
|
191
191
|
)}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { useState } from 'react';
|
|
2
|
+
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
3
|
+
|
|
4
|
+
import { Bold, Italic, LayoutGrid, List, Underline } from '../../icons';
|
|
5
|
+
|
|
6
|
+
import { ToggleGroup } from './ToggleGroup';
|
|
7
|
+
|
|
8
|
+
const ViewSwitcherStory = () => {
|
|
9
|
+
const [value, setValue] = useState<'list' | 'grid'>('list');
|
|
10
|
+
return (
|
|
11
|
+
<ToggleGroup
|
|
12
|
+
type="single"
|
|
13
|
+
value={value}
|
|
14
|
+
onValueChange={(next) => next && setValue(next as 'list' | 'grid')}
|
|
15
|
+
aria-label="View mode"
|
|
16
|
+
>
|
|
17
|
+
<ToggleGroup.Item value="list" aria-label="List view">
|
|
18
|
+
<List className="tw-size-4" />
|
|
19
|
+
</ToggleGroup.Item>
|
|
20
|
+
<ToggleGroup.Item value="grid" aria-label="Grid view">
|
|
21
|
+
<LayoutGrid className="tw-size-4" />
|
|
22
|
+
</ToggleGroup.Item>
|
|
23
|
+
</ToggleGroup>
|
|
24
|
+
);
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
const WithLabelsStory = () => (
|
|
28
|
+
<ToggleGroup type="single" defaultValue="month" aria-label="Range">
|
|
29
|
+
<ToggleGroup.Item value="day">Day</ToggleGroup.Item>
|
|
30
|
+
<ToggleGroup.Item value="week">Week</ToggleGroup.Item>
|
|
31
|
+
<ToggleGroup.Item value="month">Month</ToggleGroup.Item>
|
|
32
|
+
</ToggleGroup>
|
|
33
|
+
);
|
|
34
|
+
|
|
35
|
+
const MultipleStory = () => (
|
|
36
|
+
<ToggleGroup type="multiple" defaultValue={['bold']} aria-label="Text formatting">
|
|
37
|
+
<ToggleGroup.Item value="bold" aria-label="Bold">
|
|
38
|
+
<Bold className="tw-size-4" />
|
|
39
|
+
</ToggleGroup.Item>
|
|
40
|
+
<ToggleGroup.Item value="italic" aria-label="Italic">
|
|
41
|
+
<Italic className="tw-size-4" />
|
|
42
|
+
</ToggleGroup.Item>
|
|
43
|
+
<ToggleGroup.Item value="underline" aria-label="Underline">
|
|
44
|
+
<Underline className="tw-size-4" />
|
|
45
|
+
</ToggleGroup.Item>
|
|
46
|
+
</ToggleGroup>
|
|
47
|
+
);
|
|
48
|
+
|
|
49
|
+
const meta = {
|
|
50
|
+
title: 'Components/ToggleGroup',
|
|
51
|
+
component: ToggleGroup,
|
|
52
|
+
args: { type: 'single' },
|
|
53
|
+
} satisfies Meta<typeof ToggleGroup>;
|
|
54
|
+
|
|
55
|
+
export default meta;
|
|
56
|
+
type Story = StoryObj<typeof meta>;
|
|
57
|
+
|
|
58
|
+
export const ViewSwitcher: Story = { render: () => <ViewSwitcherStory /> };
|
|
59
|
+
export const WithLabels: Story = { render: () => <WithLabelsStory /> };
|
|
60
|
+
export const Multiple: Story = { render: () => <MultipleStory /> };
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import type { ComponentProps, ElementRef, Ref } from 'react';
|
|
2
|
+
import * as ToggleGroupPrimitive from '@radix-ui/react-toggle-group';
|
|
3
|
+
import { cva, type VariantProps } from 'class-variance-authority';
|
|
4
|
+
|
|
5
|
+
import { cn } from '../../utils';
|
|
6
|
+
|
|
7
|
+
const rootVariants = cva(
|
|
8
|
+
[
|
|
9
|
+
'tailwindcss-preflight',
|
|
10
|
+
'tw-inline-flex',
|
|
11
|
+
'tw-items-center',
|
|
12
|
+
'tw-shrink-0',
|
|
13
|
+
'tw-bg-muted',
|
|
14
|
+
'tw-rounded-lg',
|
|
15
|
+
'tw-p-[3px]',
|
|
16
|
+
'tw-gap-0',
|
|
17
|
+
],
|
|
18
|
+
{
|
|
19
|
+
defaultVariants: { size: 'medium' },
|
|
20
|
+
variants: {
|
|
21
|
+
size: {
|
|
22
|
+
small: ['tw-h-8'],
|
|
23
|
+
medium: ['tw-h-9'],
|
|
24
|
+
large: ['tw-h-10'],
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
);
|
|
29
|
+
|
|
30
|
+
const itemClasses = cn(
|
|
31
|
+
'tailwindcss-preflight',
|
|
32
|
+
'tw-inline-flex',
|
|
33
|
+
'tw-items-center',
|
|
34
|
+
'tw-justify-center',
|
|
35
|
+
'tw-gap-2',
|
|
36
|
+
'tw-shrink-0',
|
|
37
|
+
'tw-whitespace-nowrap',
|
|
38
|
+
|
|
39
|
+
'tw-h-full',
|
|
40
|
+
'tw-rounded-md',
|
|
41
|
+
'tw-px-2',
|
|
42
|
+
'tw-py-1',
|
|
43
|
+
|
|
44
|
+
'tw-bg-transparent',
|
|
45
|
+
'tw-text-foreground',
|
|
46
|
+
'tw-text-sm',
|
|
47
|
+
'tw-font-medium',
|
|
48
|
+
|
|
49
|
+
'tw-transition-colors',
|
|
50
|
+
|
|
51
|
+
'disabled:tw-cursor-not-allowed',
|
|
52
|
+
'disabled:tw-opacity-50',
|
|
53
|
+
|
|
54
|
+
'!tw-outline-none',
|
|
55
|
+
'focus-visible:tw-ring-2',
|
|
56
|
+
'focus-visible:tw-ring-primary/50',
|
|
57
|
+
|
|
58
|
+
// hover on non-pressed
|
|
59
|
+
'not-disabled:[&[data-state=off]]:hover:tw-bg-background/60',
|
|
60
|
+
|
|
61
|
+
// pressed
|
|
62
|
+
'data-[state=on]:tw-bg-background',
|
|
63
|
+
'data-[state=on]:tw-shadow-[0_1px_2px_rgba(0,0,0,0.05),0_1px_1px_rgba(0,0,0,0.1)]',
|
|
64
|
+
|
|
65
|
+
'[&_svg]:tw-shrink-0',
|
|
66
|
+
'[&_svg]:tw-pointer-events-none',
|
|
67
|
+
"[&_svg:not([class*='tw-size-'])]:tw-size-4",
|
|
68
|
+
);
|
|
69
|
+
|
|
70
|
+
type RootProps = ComponentProps<typeof ToggleGroupPrimitive.Root> &
|
|
71
|
+
VariantProps<typeof rootVariants>;
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Segmented row of mutually-exclusive (or multi-select) options. Built on `@radix-ui/react-toggle-group`.
|
|
75
|
+
* For `type="single"`, `onValueChange` receives `""` when the user deselects the active item.
|
|
76
|
+
*/
|
|
77
|
+
const Root = ({
|
|
78
|
+
ref,
|
|
79
|
+
className,
|
|
80
|
+
size = 'medium',
|
|
81
|
+
...props
|
|
82
|
+
}: RootProps & { ref?: Ref<ElementRef<'div'>> }) => (
|
|
83
|
+
<ToggleGroupPrimitive.Root
|
|
84
|
+
ref={ref}
|
|
85
|
+
{...props}
|
|
86
|
+
className={cn(rootVariants({ size, className }))}
|
|
87
|
+
/>
|
|
88
|
+
);
|
|
89
|
+
|
|
90
|
+
type ItemProps = ComponentProps<typeof ToggleGroupPrimitive.Item>;
|
|
91
|
+
|
|
92
|
+
const Item = ({ ref, className, ...props }: ItemProps & { ref?: Ref<ElementRef<'button'>> }) => (
|
|
93
|
+
<ToggleGroupPrimitive.Item ref={ref} {...props} className={cn(itemClasses, className)} />
|
|
94
|
+
);
|
|
95
|
+
|
|
96
|
+
export const ToggleGroup = Object.assign(Root, {
|
|
97
|
+
/** Individual segment inside a `ToggleGroup`. `value` is required and must be unique within the group. */
|
|
98
|
+
Item,
|
|
99
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ToggleGroup } from './ToggleGroup';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { ComponentType } from 'react';
|
|
2
2
|
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
3
3
|
|
|
4
|
+
import { CircleHelp } from '../../icons';
|
|
4
5
|
import { Button } from '../Button';
|
|
5
|
-
import { Icon } from '../Icon';
|
|
6
6
|
|
|
7
7
|
import { Tooltip, TooltipProvider } from './Tooltip';
|
|
8
8
|
|
|
@@ -53,7 +53,7 @@ export const StaticExplanatory: Story = {
|
|
|
53
53
|
},
|
|
54
54
|
render: (args) => (
|
|
55
55
|
<Tooltip {...args}>
|
|
56
|
-
<
|
|
56
|
+
<CircleHelp className="tw-size-4 tw-text-neutral-400" />
|
|
57
57
|
</Tooltip>
|
|
58
58
|
),
|
|
59
59
|
parameters: {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { type ChangeEvent, useState } from 'react';
|
|
2
2
|
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
3
3
|
|
|
4
|
-
import { Icon } from '../components/Icon';
|
|
5
4
|
import { TextInput } from '../components/Input/TextInput/TextInput';
|
|
6
5
|
import { InputGroup } from '../components/InputGroup';
|
|
6
|
+
import { Search } from '../icons';
|
|
7
7
|
|
|
8
8
|
import { useAutosizeInput } from './useAutosizeInput';
|
|
9
9
|
|
|
@@ -102,7 +102,7 @@ export const WithInputGroup: Story = {
|
|
|
102
102
|
return (
|
|
103
103
|
<InputGroup className="!tw-inline-flex">
|
|
104
104
|
<InputGroup.Addon align="inline-start">
|
|
105
|
-
<
|
|
105
|
+
<Search className="tw-size-4 tw-text-neutral-400" />
|
|
106
106
|
</InputGroup.Addon>
|
|
107
107
|
<InputGroup.Input
|
|
108
108
|
ref={inputRef}
|
package/src/icons/index.ts
CHANGED
|
@@ -14,12 +14,14 @@ export {
|
|
|
14
14
|
ArrowRight,
|
|
15
15
|
ArrowRightLeft,
|
|
16
16
|
ArrowUp,
|
|
17
|
+
ArrowUpAZ,
|
|
17
18
|
ArrowUpRight,
|
|
18
19
|
Ban,
|
|
19
20
|
Bell,
|
|
20
21
|
BellRing,
|
|
21
22
|
Bold,
|
|
22
23
|
BookOpen,
|
|
24
|
+
Box,
|
|
23
25
|
Braces,
|
|
24
26
|
Bug,
|
|
25
27
|
Calendar,
|
|
@@ -99,6 +101,7 @@ export {
|
|
|
99
101
|
Link,
|
|
100
102
|
List,
|
|
101
103
|
ListChecks,
|
|
104
|
+
ListFilter,
|
|
102
105
|
ListOrdered,
|
|
103
106
|
Loader2,
|
|
104
107
|
Lock,
|
|
@@ -116,7 +119,11 @@ export {
|
|
|
116
119
|
MoveHorizontal,
|
|
117
120
|
MoveVertical,
|
|
118
121
|
OctagonAlert,
|
|
122
|
+
PanelBottomClose,
|
|
123
|
+
PanelBottomOpen,
|
|
119
124
|
PanelLeft,
|
|
125
|
+
PanelLeftClose,
|
|
126
|
+
PanelLeftOpen,
|
|
120
127
|
PartyPopper,
|
|
121
128
|
Pause,
|
|
122
129
|
Pencil,
|
|
@@ -155,6 +162,7 @@ export {
|
|
|
155
162
|
StickyNote,
|
|
156
163
|
Strikethrough,
|
|
157
164
|
Table,
|
|
165
|
+
TableProperties,
|
|
158
166
|
ThumbsDown,
|
|
159
167
|
ThumbsUp,
|
|
160
168
|
ToggleRight,
|
package/src/index.ts
CHANGED
|
@@ -37,6 +37,7 @@ export * from './components/ThemeProvider';
|
|
|
37
37
|
export * from './components/Avatar';
|
|
38
38
|
export * from './components/MarkedText';
|
|
39
39
|
export * from './components/Toggle';
|
|
40
|
+
export * from './components/ToggleGroup';
|
|
40
41
|
export * from './components/Timeline';
|
|
41
42
|
export * from './components/Kbd';
|
|
42
43
|
export * from './components/Collapsible';
|
|
@@ -80,6 +81,7 @@ export * from './blocks/AutoSaveTextarea';
|
|
|
80
81
|
export * from './blocks/ColorInput';
|
|
81
82
|
export * from './blocks/NumberInput';
|
|
82
83
|
export * from './blocks/PasswordInput';
|
|
84
|
+
export * from './blocks/InputOtp';
|
|
83
85
|
export * from './blocks/Form';
|
|
84
86
|
export { Truncated } from './components/Truncated';
|
|
85
87
|
export * from './components/ZoomableSvg';
|