@shipfox/react-ui 0.11.0 → 0.12.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.
- package/.turbo/turbo-build.log +6 -6
- package/.turbo/turbo-check.log +2 -2
- package/.turbo/turbo-type.log +1 -1
- package/CHANGELOG.md +6 -0
- package/dist/components/calendar/calendar.d.ts +5 -0
- package/dist/components/calendar/calendar.d.ts.map +1 -0
- package/dist/components/calendar/calendar.js +46 -0
- package/dist/components/calendar/calendar.js.map +1 -0
- package/dist/components/calendar/index.d.ts +2 -0
- package/dist/components/calendar/index.d.ts.map +1 -0
- package/dist/components/calendar/index.js +3 -0
- package/dist/components/calendar/index.js.map +1 -0
- package/dist/components/date-picker/date-picker.d.ts +19 -0
- package/dist/components/date-picker/date-picker.d.ts.map +1 -0
- package/dist/components/date-picker/date-picker.js +114 -0
- package/dist/components/date-picker/date-picker.js.map +1 -0
- package/dist/components/date-picker/date-picker.stories.js +333 -0
- package/dist/components/date-picker/date-picker.stories.js.map +1 -0
- package/dist/components/date-picker/index.d.ts +2 -0
- package/dist/components/date-picker/index.d.ts.map +1 -0
- package/dist/components/date-picker/index.js +3 -0
- package/dist/components/date-picker/index.js.map +1 -0
- package/dist/components/date-time-range-picker/date-time-range-picker.d.ts +24 -0
- package/dist/components/date-time-range-picker/date-time-range-picker.d.ts.map +1 -0
- package/dist/components/date-time-range-picker/date-time-range-picker.js +130 -0
- package/dist/components/date-time-range-picker/date-time-range-picker.js.map +1 -0
- package/dist/components/date-time-range-picker/index.d.ts +2 -0
- package/dist/components/date-time-range-picker/index.d.ts.map +1 -0
- package/dist/components/date-time-range-picker/index.js +3 -0
- package/dist/components/date-time-range-picker/index.js.map +1 -0
- package/dist/components/index.d.ts +4 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +4 -0
- package/dist/components/index.js.map +1 -1
- package/dist/components/inline-tips/inline-tips.stories.js +5 -0
- package/dist/components/inline-tips/inline-tips.stories.js.map +1 -1
- package/dist/components/item/item.stories.js +15 -8
- package/dist/components/item/item.stories.js.map +1 -1
- package/dist/components/modal/modal.stories.js +14 -6
- package/dist/components/modal/modal.stories.js.map +1 -1
- package/dist/components/popover/index.d.ts +2 -0
- package/dist/components/popover/index.d.ts.map +1 -0
- package/dist/components/popover/index.js +3 -0
- package/dist/components/popover/index.js.map +1 -0
- package/dist/components/popover/popover.d.ts +10 -0
- package/dist/components/popover/popover.d.ts.map +1 -0
- package/dist/components/popover/popover.js +47 -0
- package/dist/components/popover/popover.js.map +1 -0
- package/dist/components/textarea/textarea.stories.js +8 -2
- package/dist/components/textarea/textarea.stories.js.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +1 -1
- package/src/components/calendar/calendar.tsx +90 -0
- package/src/components/calendar/index.ts +1 -0
- package/src/components/date-picker/date-picker.stories.tsx +230 -0
- package/src/components/date-picker/date-picker.tsx +179 -0
- package/src/components/date-picker/index.ts +1 -0
- package/src/components/date-time-range-picker/date-time-range-picker.tsx +211 -0
- package/src/components/date-time-range-picker/index.ts +1 -0
- package/src/components/index.ts +4 -0
- package/src/components/inline-tips/inline-tips.stories.tsx +5 -0
- package/src/components/item/item.stories.tsx +65 -56
- package/src/components/modal/modal.stories.tsx +16 -6
- package/src/components/popover/index.ts +1 -0
- package/src/components/popover/popover.tsx +60 -0
- package/src/components/textarea/textarea.stories.tsx +8 -2
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import type {Meta, StoryObj} from '@storybook/react';
|
|
2
2
|
import {Button} from 'components/button/button';
|
|
3
|
+
import {DatePicker} from 'components/date-picker';
|
|
3
4
|
import {Icon} from 'components/icon/icon';
|
|
4
5
|
import {Input} from 'components/input/input';
|
|
5
6
|
import {Label} from 'components/label/label';
|
|
7
|
+
import {useState} from 'react';
|
|
6
8
|
import {
|
|
7
9
|
Item,
|
|
8
10
|
ItemActions,
|
|
@@ -38,6 +40,8 @@ const meta = {
|
|
|
38
40
|
export default meta;
|
|
39
41
|
type Story = StoryObj<typeof meta>;
|
|
40
42
|
|
|
43
|
+
const DEFAULT_START_DATE = new Date('2024-01-01T00:00:00.000Z');
|
|
44
|
+
|
|
41
45
|
export const Default: Story = {
|
|
42
46
|
args: {
|
|
43
47
|
variant: 'default',
|
|
@@ -89,62 +93,67 @@ export const Variants: Story = {
|
|
|
89
93
|
|
|
90
94
|
export const ImportPastJobsModal: Story = {
|
|
91
95
|
args: {},
|
|
92
|
-
render: () =>
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
<ItemContent className="px-24 py-16">
|
|
114
|
-
<ItemDescription className="mb-16 text-sm text-foreground-neutral-subtle">
|
|
115
|
-
Backfill your CI history by importing past runs from your Github repo. We'll handle the
|
|
116
|
-
rest by creating a background task to import the data for you.
|
|
117
|
-
</ItemDescription>
|
|
118
|
-
<div className="flex flex-col gap-20">
|
|
119
|
-
<div className="flex flex-col gap-8">
|
|
120
|
-
<Label htmlFor="repo-owner">Repository owner</Label>
|
|
121
|
-
<Input id="repo-owner" type="text" defaultValue="apache" />
|
|
122
|
-
</div>
|
|
123
|
-
<div className="flex flex-col gap-8">
|
|
124
|
-
<Label htmlFor="repo-name">Repository name</Label>
|
|
125
|
-
<Input id="repo-name" type="text" defaultValue="kafka" />
|
|
96
|
+
render: () => {
|
|
97
|
+
const [date, setDate] = useState<Date | undefined>(DEFAULT_START_DATE);
|
|
98
|
+
|
|
99
|
+
return (
|
|
100
|
+
<div className="flex w-full max-w-lg flex-col">
|
|
101
|
+
<Item variant="neutral">
|
|
102
|
+
<ItemHeader className="justify-between px-24 py-16">
|
|
103
|
+
<ItemTitle className="text-lg font-medium text-foreground-neutral-base">
|
|
104
|
+
Import past jobs from GitHub
|
|
105
|
+
</ItemTitle>
|
|
106
|
+
<div className="flex items-center gap-8">
|
|
107
|
+
<kbd className="flex items-center justify-center rounded-8 border border-border-neutral-base shadow-button-neutral bg-background-field-base text-xs text-foreground-neutral-subtle px-4">
|
|
108
|
+
esc
|
|
109
|
+
</kbd>
|
|
110
|
+
<Button
|
|
111
|
+
variant="transparent"
|
|
112
|
+
size="xs"
|
|
113
|
+
className="rounded-4 p-2 cursor-pointer bg-transparent border-none text-foreground-neutral-muted hover:text-foreground-neutral-base hover:bg-background-components-hover transition-colors duration-150 outline-none focus-visible:ring-2 focus-visible:ring-background-accent-blue-base focus-visible:ring-offset-2 w-24 h-24"
|
|
114
|
+
>
|
|
115
|
+
<Icon name="close" />
|
|
116
|
+
</Button>
|
|
126
117
|
</div>
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
118
|
+
</ItemHeader>
|
|
119
|
+
<ItemSeparator />
|
|
120
|
+
<ItemContent className="px-24 py-16">
|
|
121
|
+
<ItemDescription className="mb-16 text-sm text-foreground-neutral-subtle">
|
|
122
|
+
Backfill your CI history by importing past runs from your GitHub repo. We'll handle
|
|
123
|
+
the rest by creating a background task to import the data for you.
|
|
124
|
+
</ItemDescription>
|
|
125
|
+
<div className="flex flex-col gap-20">
|
|
126
|
+
<div className="flex flex-col gap-8">
|
|
127
|
+
<Label htmlFor="repo-owner">Repository owner</Label>
|
|
128
|
+
<Input id="repo-owner" type="text" defaultValue="apache" />
|
|
129
|
+
</div>
|
|
130
|
+
<div className="flex flex-col gap-8">
|
|
131
|
+
<Label htmlFor="repo-name">Repository name</Label>
|
|
132
|
+
<Input id="repo-name" type="text" defaultValue="kafka" />
|
|
133
|
+
</div>
|
|
134
|
+
<div className="flex flex-col gap-8">
|
|
135
|
+
<Label htmlFor="start-date">Start date</Label>
|
|
136
|
+
<DatePicker
|
|
137
|
+
id="start-date"
|
|
138
|
+
date={date}
|
|
139
|
+
onDateSelect={setDate}
|
|
140
|
+
onClear={() => setDate(undefined)}
|
|
141
|
+
placeholder="DD/MM/YYYY"
|
|
142
|
+
/>
|
|
143
|
+
</div>
|
|
135
144
|
</div>
|
|
136
|
-
</
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
</
|
|
146
|
-
</
|
|
147
|
-
</
|
|
148
|
-
|
|
149
|
-
|
|
145
|
+
</ItemContent>
|
|
146
|
+
<ItemSeparator />
|
|
147
|
+
<ItemFooter className="justify-end gap-8 px-24 py-16">
|
|
148
|
+
<Button variant="transparent" size="sm">
|
|
149
|
+
Cancel
|
|
150
|
+
</Button>
|
|
151
|
+
<Button variant="primary" size="sm">
|
|
152
|
+
Import
|
|
153
|
+
</Button>
|
|
154
|
+
</ItemFooter>
|
|
155
|
+
</Item>
|
|
156
|
+
</div>
|
|
157
|
+
);
|
|
158
|
+
},
|
|
150
159
|
};
|
|
@@ -14,6 +14,7 @@ import {
|
|
|
14
14
|
CodeBlockHeader,
|
|
15
15
|
CodeBlockItem,
|
|
16
16
|
} from 'components/code-block';
|
|
17
|
+
import {DatePicker} from 'components/date-picker';
|
|
17
18
|
import {DynamicItem} from 'components/dynamic-item';
|
|
18
19
|
import {Icon} from 'components/icon';
|
|
19
20
|
import {Input} from 'components/input';
|
|
@@ -39,6 +40,8 @@ const OPEN_MODAL_REGEX = /open modal/i;
|
|
|
39
40
|
const IMPORT_JOBS_REGEX = /import past jobs from github/i;
|
|
40
41
|
const GITHUB_ACTIONS_REGEX = /run github actions on shipfox/i;
|
|
41
42
|
|
|
43
|
+
const DEFAULT_START_DATE = new Date('2025-12-06T00:00:00.000Z');
|
|
44
|
+
|
|
42
45
|
const meta = {
|
|
43
46
|
title: 'Components/Modal',
|
|
44
47
|
component: Modal,
|
|
@@ -129,19 +132,20 @@ export const ImportForm: Story = {
|
|
|
129
132
|
},
|
|
130
133
|
render: () => {
|
|
131
134
|
const [open, setOpen] = useState(false);
|
|
135
|
+
const [date, setDate] = useState<Date | undefined>(DEFAULT_START_DATE);
|
|
132
136
|
|
|
133
137
|
return (
|
|
134
138
|
<div className="flex h-[calc(100vh/2)] w-[calc(100vw/2)] items-center justify-center rounded-16 bg-background-subtle-base shadow-tooltip">
|
|
135
139
|
<Modal open={open} onOpenChange={setOpen}>
|
|
136
140
|
<ModalTrigger asChild>
|
|
137
|
-
<Button>Import past jobs from
|
|
141
|
+
<Button>Import past jobs from GitHub</Button>
|
|
138
142
|
</ModalTrigger>
|
|
139
143
|
<ModalContent aria-describedby={undefined}>
|
|
140
|
-
<ModalTitle className="sr-only">Import past jobs from
|
|
141
|
-
<ModalHeader title="Import past jobs from
|
|
144
|
+
<ModalTitle className="sr-only">Import past jobs from GitHub</ModalTitle>
|
|
145
|
+
<ModalHeader title="Import past jobs from GitHub" />
|
|
142
146
|
<ModalBody className="gap-20">
|
|
143
147
|
<Text size="sm" className="text-foreground-neutral-subtle w-full">
|
|
144
|
-
Backfill your CI history by importing past runs from your
|
|
148
|
+
Backfill your CI history by importing past runs from your GitHub repo. We'll
|
|
145
149
|
handle the rest by creating a background task to import the data for you.
|
|
146
150
|
</Text>
|
|
147
151
|
<div className="flex flex-col gap-20 w-full">
|
|
@@ -154,8 +158,14 @@ export const ImportForm: Story = {
|
|
|
154
158
|
<Input placeholder="kafka" />
|
|
155
159
|
</div>
|
|
156
160
|
<div className="flex flex-col gap-8 w-full">
|
|
157
|
-
<Label>Start date</Label>
|
|
158
|
-
<
|
|
161
|
+
<Label htmlFor="start-date">Start date</Label>
|
|
162
|
+
<DatePicker
|
|
163
|
+
id="start-date"
|
|
164
|
+
date={date}
|
|
165
|
+
onDateSelect={setDate}
|
|
166
|
+
onClear={() => setDate(undefined)}
|
|
167
|
+
placeholder="DD/MM/YYYY"
|
|
168
|
+
/>
|
|
159
169
|
</div>
|
|
160
170
|
</div>
|
|
161
171
|
</ModalBody>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './popover';
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import * as PopoverPrimitive from '@radix-ui/react-popover';
|
|
2
|
+
import type {ComponentProps} from 'react';
|
|
3
|
+
import {cn} from 'utils/cn';
|
|
4
|
+
|
|
5
|
+
function Popover({...props}: ComponentProps<typeof PopoverPrimitive.Root>) {
|
|
6
|
+
return <PopoverPrimitive.Root {...props} />;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
function PopoverTrigger({...props}: ComponentProps<typeof PopoverPrimitive.Trigger>) {
|
|
10
|
+
return <PopoverPrimitive.Trigger {...props} />;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
function PopoverAnchor({...props}: ComponentProps<typeof PopoverPrimitive.Anchor>) {
|
|
14
|
+
return <PopoverPrimitive.Anchor {...props} />;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function PopoverPortal({...props}: ComponentProps<typeof PopoverPrimitive.Portal>) {
|
|
18
|
+
return <PopoverPrimitive.Portal {...props} />;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function PopoverContent({
|
|
22
|
+
className,
|
|
23
|
+
align = 'center',
|
|
24
|
+
sideOffset = 4,
|
|
25
|
+
...props
|
|
26
|
+
}: ComponentProps<typeof PopoverPrimitive.Content>) {
|
|
27
|
+
return (
|
|
28
|
+
<PopoverPortal>
|
|
29
|
+
<PopoverPrimitive.Content
|
|
30
|
+
align={align}
|
|
31
|
+
sideOffset={sideOffset}
|
|
32
|
+
className={cn(
|
|
33
|
+
'z-50 rounded-10 bg-background-neutral-overlay shadow-tooltip outline-none',
|
|
34
|
+
'data-[state=open]:animate-in data-[state=closed]:animate-out',
|
|
35
|
+
'data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0',
|
|
36
|
+
'data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95',
|
|
37
|
+
'data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2',
|
|
38
|
+
'data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2',
|
|
39
|
+
className,
|
|
40
|
+
)}
|
|
41
|
+
{...props}
|
|
42
|
+
/>
|
|
43
|
+
</PopoverPortal>
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function PopoverArrow({className, ...props}: ComponentProps<typeof PopoverPrimitive.Arrow>) {
|
|
48
|
+
return (
|
|
49
|
+
<PopoverPrimitive.Arrow
|
|
50
|
+
className={cn('fill-background-neutral-overlay', className)}
|
|
51
|
+
{...props}
|
|
52
|
+
/>
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function PopoverClose({...props}: ComponentProps<typeof PopoverPrimitive.Close>) {
|
|
57
|
+
return <PopoverPrimitive.Close {...props} />;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export {Popover, PopoverTrigger, PopoverAnchor, PopoverContent, PopoverArrow, PopoverClose};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import {argosScreenshot} from '@argos-ci/storybook/vitest';
|
|
1
2
|
import type {Meta, StoryObj} from '@storybook/react';
|
|
2
3
|
import {Code, Header} from 'components/typography';
|
|
3
4
|
import {Textarea} from './textarea';
|
|
@@ -25,7 +26,12 @@ export default meta;
|
|
|
25
26
|
|
|
26
27
|
type Story = StoryObj<typeof meta>;
|
|
27
28
|
|
|
28
|
-
export const Default: Story = {
|
|
29
|
+
export const Default: Story = {
|
|
30
|
+
play: async (ctx) => {
|
|
31
|
+
await new Promise((resolve) => setTimeout(resolve, 100));
|
|
32
|
+
await argosScreenshot(ctx, 'Textarea Default');
|
|
33
|
+
},
|
|
34
|
+
};
|
|
29
35
|
|
|
30
36
|
const variants = ['base', 'component'] as const;
|
|
31
37
|
const sizes = ['base', 'small'] as const;
|
|
@@ -163,7 +169,7 @@ export const DesignMock: Story = {
|
|
|
163
169
|
<Code variant="label" className="text-foreground-neutral-subtle">
|
|
164
170
|
Size=Base (32), State={state.name}, Color={variant.label}
|
|
165
171
|
</Code>
|
|
166
|
-
<div className="w-
|
|
172
|
+
<div className="w-280">
|
|
167
173
|
<Textarea
|
|
168
174
|
placeholder="Placeholder"
|
|
169
175
|
variant={variant.key}
|