@companix/uikit 0.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/.eslintrc +54 -0
- package/declaration.d.ts +4 -0
- package/index.html +12 -0
- package/package.json +66 -0
- package/playground/App.tsx +166 -0
- package/playground/Example.tsx +14 -0
- package/playground/Test.tsx +44 -0
- package/playground/animation-test-1/index.scss +20 -0
- package/playground/animation-test-1/index.tsx +17 -0
- package/playground/animation-test-2/index.scss +62 -0
- package/playground/animation-test-2/index.tsx +32 -0
- package/playground/bootstrap.tsx +19 -0
- package/playground/buttons/index.tsx +132 -0
- package/playground/checkbox/index.tsx +64 -0
- package/playground/date-input/index.tsx +45 -0
- package/playground/date-picker/index.tsx +41 -0
- package/playground/dialog/index.tsx +92 -0
- package/playground/dialog-alert/index.tsx +47 -0
- package/playground/drawer/index.tsx +55 -0
- package/playground/index.css +33 -0
- package/playground/index.scss +270 -0
- package/playground/input/index.tsx +112 -0
- package/playground/number-inputs/index.tsx +50 -0
- package/playground/popovers/index.tsx +70 -0
- package/playground/radio-group/index.tsx +69 -0
- package/playground/select/index.tsx +72 -0
- package/playground/select-tags/index.tsx +36 -0
- package/playground/styles.scss +2 -0
- package/playground/switch/index.tsx +44 -0
- package/playground/tabs/index.tsx +16 -0
- package/playground/test.scss +0 -0
- package/playground/text-area/index.tsx +17 -0
- package/playground/text-input/index.tsx +12 -0
- package/playground/toaster/index.tsx +156 -0
- package/playground/tooltip/index.tsx +26 -0
- package/src/Button/Button.scss +128 -0
- package/src/Button/index.tsx +72 -0
- package/src/ButtonGroup/ButtonGroup.scss +18 -0
- package/src/ButtonGroup/index.tsx +20 -0
- package/src/Checkbox/Checkbox.scss +115 -0
- package/src/Checkbox/index.tsx +46 -0
- package/src/Countdown/index.tsx +54 -0
- package/src/DateInput/DateInput.scss +11 -0
- package/src/DateInput/index.tsx +96 -0
- package/src/DatePicker/Calendar.scss +125 -0
- package/src/DatePicker/Calendar.tsx +157 -0
- package/src/DatePicker/CalendarHeader.tsx +139 -0
- package/src/DatePicker/DatePicker.scss +0 -0
- package/src/DatePicker/index.tsx +177 -0
- package/src/Dialog/Dialog.scss +25 -0
- package/src/Dialog/Popup.scss +55 -0
- package/src/Dialog/index.tsx +31 -0
- package/src/DialogAlert/Alert.scss +52 -0
- package/src/DialogAlert/Alert.tsx +78 -0
- package/src/DialogAlert/Viewport.tsx +52 -0
- package/src/DialogAlert/index.tsx +37 -0
- package/src/Drawer/Drawer.scss +112 -0
- package/src/Drawer/index.tsx +46 -0
- package/src/File/index.tsx +60 -0
- package/src/Form/Form.scss +70 -0
- package/src/Form/Input.scss +24 -0
- package/src/Form/index.tsx +131 -0
- package/src/Icon/icon.scss +18 -0
- package/src/Icon/index.tsx +43 -0
- package/src/LoadButton/index.tsx +17 -0
- package/src/NumberInput/index.tsx +74 -0
- package/src/OptionItem/Option.scss +89 -0
- package/src/OptionItem/OptionItem.tsx +49 -0
- package/src/OptionItem/OptionsList.tsx +26 -0
- package/src/Popover/Popover.scss +80 -0
- package/src/Popover/index.tsx +117 -0
- package/src/Radio/Radio.scss +148 -0
- package/src/Radio/index.tsx +68 -0
- package/src/Scrollable/ImitateScroll.tsx +141 -0
- package/src/Scrollable/Scrollable.scss +50 -0
- package/src/Scrollable/index.tsx +141 -0
- package/src/Select/Select.scss +80 -0
- package/src/Select/SelectInput.tsx +131 -0
- package/src/Select/index.tsx +134 -0
- package/src/SelectTags/SelectTags.scss +66 -0
- package/src/SelectTags/index.tsx +192 -0
- package/src/Spinner/Spinner.scss +14 -0
- package/src/Spinner/index.tsx +19 -0
- package/src/Stepper/StepperInput.scss +35 -0
- package/src/Stepper/index.tsx +76 -0
- package/src/Switch/Switch.scss +102 -0
- package/src/Switch/index.tsx +49 -0
- package/src/Tabs/Tabs.scss +58 -0
- package/src/Tabs/index.tsx +89 -0
- package/src/TextArea/TextArea.scss +34 -0
- package/src/TextArea/index.tsx +51 -0
- package/src/Toaster/RemoveListener.tsx +11 -0
- package/src/Toaster/Toast.tsx +69 -0
- package/src/Toaster/Toaster.scss +151 -0
- package/src/Toaster/Viewport.tsx +117 -0
- package/src/Toaster/index.tsx +52 -0
- package/src/Tooltip/Tooltip.scss +28 -0
- package/src/Tooltip/index.tsx +33 -0
- package/src/__hooks/use-frooze-closing.ts +51 -0
- package/src/__hooks/use-loading.ts +34 -0
- package/src/__hooks/use-local-storage.ts +19 -0
- package/src/__hooks/use-popover-position.ts +24 -0
- package/src/__hooks/use-previos.ts +25 -0
- package/src/__hooks/use-resize.ts +41 -0
- package/src/__hooks/use-scrollbox.ts +45 -0
- package/src/__hooks/use-stepper-input.ts +82 -0
- package/src/__hooks/use-update.ts +19 -0
- package/src/__hooks/useCalendar.ts +104 -0
- package/src/__hooks/useCalendarOptions-copy.ts +87 -0
- package/src/__hooks/useCalendarOptions.ts +68 -0
- package/src/__libs/calendar.ts +175 -0
- package/src/__utils/utils.ts +137 -0
- package/src/css.scss +120 -0
- package/src/index.scss +22 -0
- package/src/index.ts +36 -0
- package/src/mixins.scss +99 -0
- package/src/theme.scss +103 -0
- package/src/types.ts +14 -0
- package/tailwind.config.js +91 -0
- package/themes/classic/animations.scss +179 -0
- package/themes/classic/classic.scss +493 -0
- package/tsconfig.json +27 -0
- package/vite.build.ts +35 -0
- package/vite.config.ts +33 -0
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { Icon } from '@/Icon'
|
|
2
|
+
import { Form } from '@/Form'
|
|
3
|
+
import { faEye, faEyeSlash, faSearch } from '@fortawesome/free-solid-svg-icons'
|
|
4
|
+
import { useState } from 'react'
|
|
5
|
+
|
|
6
|
+
const sizes = ['lg', 'md', 'sm'] as const
|
|
7
|
+
|
|
8
|
+
export const InputsExample = () => {
|
|
9
|
+
return (
|
|
10
|
+
<div className="col-group">
|
|
11
|
+
<div className="row-group">
|
|
12
|
+
<PasswordInput />
|
|
13
|
+
<PasswordInput2 />
|
|
14
|
+
<ChangeSize />
|
|
15
|
+
<Form
|
|
16
|
+
fill
|
|
17
|
+
placeholder="Fullwidth input"
|
|
18
|
+
leftElement={<Icon size="xxs" icon={faSearch} className="quieter form-space-margin" />}
|
|
19
|
+
/>
|
|
20
|
+
</div>
|
|
21
|
+
<div style={{ height: '1px', background: '#eeeeee', margin: '12px 0px' }} />
|
|
22
|
+
<div className="flex gap-10">
|
|
23
|
+
<div className="flex flex-col gap-10">
|
|
24
|
+
{sizes.map((size) => {
|
|
25
|
+
return <Form key={`input-size-${size}`} size={size} placeholder={`Input size ${size}`} />
|
|
26
|
+
})}
|
|
27
|
+
</div>
|
|
28
|
+
<div className="flex flex-col gap-10">
|
|
29
|
+
{sizes.map((size) => {
|
|
30
|
+
return (
|
|
31
|
+
<Form
|
|
32
|
+
key={`input-size-${size}-disabled`}
|
|
33
|
+
size={size}
|
|
34
|
+
placeholder={`Input disabled ${size}`}
|
|
35
|
+
leftElement={<Icon size="xxs" icon={faSearch} className="quieter form-space-margin" />}
|
|
36
|
+
disabled
|
|
37
|
+
/>
|
|
38
|
+
)
|
|
39
|
+
})}
|
|
40
|
+
</div>
|
|
41
|
+
<div className="flex flex-col gap-10">
|
|
42
|
+
{sizes.map((size) => {
|
|
43
|
+
return (
|
|
44
|
+
<Form
|
|
45
|
+
key={`input-size-${size}-required`}
|
|
46
|
+
size={size}
|
|
47
|
+
placeholder={`Input required ${size}`}
|
|
48
|
+
leftElement={<Icon size="xxs" icon={faSearch} className="quieter form-space-margin" />}
|
|
49
|
+
required
|
|
50
|
+
/>
|
|
51
|
+
)
|
|
52
|
+
})}
|
|
53
|
+
</div>
|
|
54
|
+
</div>
|
|
55
|
+
</div>
|
|
56
|
+
)
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
const PasswordInput = () => {
|
|
60
|
+
const [state, setState] = useState(false)
|
|
61
|
+
|
|
62
|
+
return (
|
|
63
|
+
<Form
|
|
64
|
+
placeholder={`Slot right`}
|
|
65
|
+
rightElement={
|
|
66
|
+
<div
|
|
67
|
+
onClick={() => setState((x) => !x)}
|
|
68
|
+
data-side={'right'}
|
|
69
|
+
className="form-slot center h-full cursor-pointer"
|
|
70
|
+
>
|
|
71
|
+
{state ? <Icon size="xxs" icon={faEye} /> : <Icon size="xxs" icon={faEyeSlash} />}
|
|
72
|
+
</div>
|
|
73
|
+
}
|
|
74
|
+
/>
|
|
75
|
+
)
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
const PasswordInput2 = () => {
|
|
79
|
+
return (
|
|
80
|
+
<Form
|
|
81
|
+
placeholder={`Slot left`}
|
|
82
|
+
leftElement={
|
|
83
|
+
<div data-side={'left'} className="form-slot center h-full gap-6 cursor-pointer">
|
|
84
|
+
<Icon size="xxs" icon={faEye} />
|
|
85
|
+
</div>
|
|
86
|
+
}
|
|
87
|
+
/>
|
|
88
|
+
)
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
const ChangeSize = () => {
|
|
92
|
+
const [value, setValue] = useState('')
|
|
93
|
+
|
|
94
|
+
return (
|
|
95
|
+
<Form
|
|
96
|
+
placeholder="Dynamic element"
|
|
97
|
+
value={value}
|
|
98
|
+
onValueChange={setValue}
|
|
99
|
+
leftElement={<Icon size="xxs" icon={faSearch} className="quieter form-space-margin" />}
|
|
100
|
+
rightElement={
|
|
101
|
+
<div className="form-space-margin flex items-center h-full cursor-pointer">
|
|
102
|
+
<div
|
|
103
|
+
className="rounded-md px-4 pointer-events-auto"
|
|
104
|
+
style={{ backgroundColor: 'rgba(143, 153, 168, .15)' }}
|
|
105
|
+
>
|
|
106
|
+
{Math.floor(10000 / Math.max(1, Math.pow(value.length, 2)))}
|
|
107
|
+
</div>
|
|
108
|
+
</div>
|
|
109
|
+
}
|
|
110
|
+
/>
|
|
111
|
+
)
|
|
112
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { useState } from 'react'
|
|
2
|
+
import { StepperInput } from '@/Stepper'
|
|
3
|
+
import { NumberInput } from '@/NumberInput'
|
|
4
|
+
|
|
5
|
+
export const NumberInputs = () => {
|
|
6
|
+
return (
|
|
7
|
+
<div className="flex flex-col gap-22" style={{ width: '200px' }}>
|
|
8
|
+
<div>NumberInputs</div>
|
|
9
|
+
<div>
|
|
10
|
+
<NumbInput1 />
|
|
11
|
+
</div>
|
|
12
|
+
<div>
|
|
13
|
+
<NumbInput2 />
|
|
14
|
+
</div>
|
|
15
|
+
<div>
|
|
16
|
+
<NumbInput3 />
|
|
17
|
+
</div>
|
|
18
|
+
</div>
|
|
19
|
+
)
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const NumbInput1 = () => {
|
|
23
|
+
const [value, onChange] = useState(0)
|
|
24
|
+
return (
|
|
25
|
+
<div className="flex flex-col">
|
|
26
|
+
<StepperInput buttons step={0.01} value={value} onChange={onChange} />
|
|
27
|
+
<div onClick={() => onChange(0)}>set 0</div>
|
|
28
|
+
</div>
|
|
29
|
+
)
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const NumbInput2 = () => {
|
|
33
|
+
const [value, onChange] = useState(0)
|
|
34
|
+
|
|
35
|
+
return <StepperInput step={1} value={value} onChange={onChange} />
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const NumbInput3 = () => {
|
|
39
|
+
const [value, onChange] = useState<number | null>(0)
|
|
40
|
+
|
|
41
|
+
console.log(value)
|
|
42
|
+
|
|
43
|
+
return (
|
|
44
|
+
<div>
|
|
45
|
+
<NumberInput value={value} onChange={onChange} />
|
|
46
|
+
<div onClick={() => onChange(1122)}>Set 1122</div>
|
|
47
|
+
<div onClick={() => onChange(null)}>Set null</div>
|
|
48
|
+
</div>
|
|
49
|
+
)
|
|
50
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { Button } from '@/Button'
|
|
2
|
+
import { Popover, PopoverProps } from '@/Popover'
|
|
3
|
+
import { useState } from 'react'
|
|
4
|
+
|
|
5
|
+
export const PopoversExample = () => {
|
|
6
|
+
const [minimal] = useState(false)
|
|
7
|
+
const [arrows] = useState(true)
|
|
8
|
+
|
|
9
|
+
return (
|
|
10
|
+
<div className="docs-popover-placement-example">
|
|
11
|
+
<div className="docs-example-grid">
|
|
12
|
+
<div className="docs-example-grid-1-1" />
|
|
13
|
+
<div className="docs-example-grid-1-2">
|
|
14
|
+
<div style={{ display: 'flex', gap: '10px' }}>
|
|
15
|
+
<PlacementPopover side="bottom" align="start" minimal={minimal} showArrows={arrows} />
|
|
16
|
+
<PlacementPopover side="bottom" align="center" minimal={minimal} showArrows={arrows} />
|
|
17
|
+
<PlacementPopover side="bottom" align="end" minimal={minimal} showArrows={arrows} />
|
|
18
|
+
</div>
|
|
19
|
+
</div>
|
|
20
|
+
<div className="docs-example-grid-1-3" />
|
|
21
|
+
<div className="docs-example-grid-2-1">
|
|
22
|
+
<div style={{ display: 'flex', gap: '10px', flexDirection: 'column' }}>
|
|
23
|
+
<PlacementPopover side="right" align="start" minimal={minimal} showArrows={arrows} />
|
|
24
|
+
<PlacementPopover side="right" align="center" minimal={minimal} showArrows={arrows} />
|
|
25
|
+
<PlacementPopover side="right" align="end" minimal={minimal} showArrows={arrows} />
|
|
26
|
+
</div>
|
|
27
|
+
</div>
|
|
28
|
+
<div className="docs-example-grid-2-2">
|
|
29
|
+
<em>Button positions are flipped here so that all popovers open inward.</em>
|
|
30
|
+
</div>
|
|
31
|
+
<div className="docs-example-grid-2-3">
|
|
32
|
+
<div style={{ display: 'flex', flexDirection: 'column', gap: '10px' }}>
|
|
33
|
+
<PlacementPopover side="left" align="start" minimal={minimal} showArrows={arrows} />
|
|
34
|
+
<PlacementPopover side="left" align="center" minimal={minimal} showArrows={arrows} />
|
|
35
|
+
<PlacementPopover side="left" align="end" minimal={minimal} showArrows={arrows} />
|
|
36
|
+
</div>
|
|
37
|
+
</div>
|
|
38
|
+
<div className="docs-example-grid-3-1" />
|
|
39
|
+
<div className="docs-example-grid-3-2">
|
|
40
|
+
<div style={{ display: 'flex', gap: '10px' }}>
|
|
41
|
+
<PlacementPopover side="top" align="start" minimal={minimal} showArrows={arrows} />
|
|
42
|
+
<PlacementPopover side="top" align="center" minimal={minimal} showArrows={arrows} />
|
|
43
|
+
<PlacementPopover side="top" align="end" minimal={minimal} showArrows={arrows} />
|
|
44
|
+
</div>
|
|
45
|
+
</div>
|
|
46
|
+
<div className="docs-example-grid-3-3" />
|
|
47
|
+
</div>
|
|
48
|
+
</div>
|
|
49
|
+
)
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
const PlacementPopover = (props: Omit<PopoverProps, 'content' | 'children'>) => {
|
|
53
|
+
return (
|
|
54
|
+
<Popover
|
|
55
|
+
{...props}
|
|
56
|
+
// sideOffset={0}
|
|
57
|
+
|
|
58
|
+
content={() => (
|
|
59
|
+
<div className="p-12">
|
|
60
|
+
<div>Popover content: {props.align}</div>
|
|
61
|
+
<div>Popover content: {props.side}</div>
|
|
62
|
+
</div>
|
|
63
|
+
)}
|
|
64
|
+
>
|
|
65
|
+
<Button fill>
|
|
66
|
+
{props.side} {props.align}
|
|
67
|
+
</Button>
|
|
68
|
+
</Popover>
|
|
69
|
+
)
|
|
70
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { RadioGroup } from '@/Radio'
|
|
2
|
+
import { useState } from 'react'
|
|
3
|
+
|
|
4
|
+
export const RadioGroupExample = () => {
|
|
5
|
+
return (
|
|
6
|
+
<div className="col-group">
|
|
7
|
+
<div className="flex gap-24">
|
|
8
|
+
<RadioGroupControl
|
|
9
|
+
size="md"
|
|
10
|
+
options={[
|
|
11
|
+
{ value: 'soup', label: 'Soup with tomatos' },
|
|
12
|
+
{ value: 'salat', label: 'Salat olivie' },
|
|
13
|
+
{ value: 'sandwich', label: 'Sandwich S7 Airlines' }
|
|
14
|
+
]}
|
|
15
|
+
/>
|
|
16
|
+
<RadioGroupControl
|
|
17
|
+
size="sm"
|
|
18
|
+
options={[
|
|
19
|
+
{ value: 'soup', label: 'Soup with tomatos' },
|
|
20
|
+
{ value: 'salat', label: 'Salat olivie' },
|
|
21
|
+
{ value: 'sandwich', label: 'Sandwich S7 Airlines' }
|
|
22
|
+
]}
|
|
23
|
+
/>
|
|
24
|
+
<RadioGroupControl
|
|
25
|
+
size="sm"
|
|
26
|
+
disabled
|
|
27
|
+
options={[
|
|
28
|
+
{ value: 'soup', label: 'Soup with tomatos' },
|
|
29
|
+
{ value: 'salat', label: 'Salat olivie' },
|
|
30
|
+
{ value: 'sandwich', label: 'Sandwich S7 Airlines' }
|
|
31
|
+
]}
|
|
32
|
+
/>
|
|
33
|
+
</div>
|
|
34
|
+
<div style={{ height: '1px', background: '#eeeeee', margin: '12px 0px' }} />
|
|
35
|
+
<RadioGroupControl
|
|
36
|
+
options={[
|
|
37
|
+
{ value: 'soup', label: 'Basic plan' },
|
|
38
|
+
{ value: 'salat', label: 'Professional plan' },
|
|
39
|
+
{
|
|
40
|
+
value: 'sandwich',
|
|
41
|
+
label:
|
|
42
|
+
'This plan includes full access to all features, priority customer support, advanced security options, detailed analytics, and the ability to customize the system to fit internal processes. It is intended for companies that need reliability, scalability, and long-term support across multiple departments.'
|
|
43
|
+
}
|
|
44
|
+
]}
|
|
45
|
+
/>
|
|
46
|
+
<div style={{ height: '1px', background: '#eeeeee', margin: '12px 0px' }} />
|
|
47
|
+
<RadioGroupControl
|
|
48
|
+
required
|
|
49
|
+
options={[
|
|
50
|
+
{ value: 'soup', label: 'New York' },
|
|
51
|
+
{ value: 'salat', label: 'Beijing' }
|
|
52
|
+
]}
|
|
53
|
+
/>
|
|
54
|
+
</div>
|
|
55
|
+
)
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
interface Props<T> {
|
|
59
|
+
size?: 'sm' | 'md'
|
|
60
|
+
options: { value: T; label: string }[]
|
|
61
|
+
disabled?: boolean
|
|
62
|
+
required?: boolean
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
const RadioGroupControl = <T extends string>(props: Props<T>) => {
|
|
66
|
+
const [value, setValue] = useState<null | T>(null)
|
|
67
|
+
|
|
68
|
+
return <RadioGroup {...props} value={value} onChange={setValue} />
|
|
69
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { useState } from 'react'
|
|
2
|
+
import { Select } from '@/Select'
|
|
3
|
+
import { Icon } from '@/Icon'
|
|
4
|
+
import { faGift } from '@fortawesome/free-solid-svg-icons'
|
|
5
|
+
|
|
6
|
+
export const SelectExample = () => {
|
|
7
|
+
return (
|
|
8
|
+
<div className="col-group">
|
|
9
|
+
<div className="row-group">
|
|
10
|
+
<div style={{ minWidth: '200px', width: '200px' }}>
|
|
11
|
+
<SelectItem />
|
|
12
|
+
</div>
|
|
13
|
+
<div style={{ display: 'flex', justifyContent: 'center', minWidth: '240px', width: '240px' }}>
|
|
14
|
+
<SelectItem
|
|
15
|
+
clearButton
|
|
16
|
+
icon={<Icon icon={faGift} size="xxs" className="form-space-margin" />}
|
|
17
|
+
/>
|
|
18
|
+
</div>
|
|
19
|
+
<div style={{ minWidth: 0, width: '100%' }}>
|
|
20
|
+
<SelectItem fill icon={<Icon icon={faGift} size="xxs" className="form-space-margin" />} />
|
|
21
|
+
</div>
|
|
22
|
+
</div>
|
|
23
|
+
{/* <div style={{ height: '1px', background: '#eeeeee', margin: '12px 0px' }} />
|
|
24
|
+
<div className="row-group">
|
|
25
|
+
<div style={{ minWidth: '200px', width: '200px' }}>
|
|
26
|
+
<SelectItem />
|
|
27
|
+
</div>
|
|
28
|
+
<div style={{ display: 'flex', justifyContent: 'center', minWidth: '240px', width: '240px' }}>
|
|
29
|
+
<SelectItem
|
|
30
|
+
clearButton
|
|
31
|
+
icon={<Icon icon={faGift} size="xxs" className="form-space-margin" />}
|
|
32
|
+
/>
|
|
33
|
+
</div>
|
|
34
|
+
<div style={{ minWidth: 0, width: '100%' }}>
|
|
35
|
+
<SelectItem fill icon={<Icon icon={faGift} size="xxs" className="form-space-margin" />} />
|
|
36
|
+
</div>
|
|
37
|
+
</div> */}
|
|
38
|
+
</div>
|
|
39
|
+
)
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
interface ItemProps {
|
|
43
|
+
fill?: boolean
|
|
44
|
+
clearButton?: boolean
|
|
45
|
+
icon?: React.ReactNode
|
|
46
|
+
size?: 'sm' | 'md' | 'lg'
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const SelectItem = ({ fill, clearButton, icon, size }: ItemProps) => {
|
|
50
|
+
const [value, onChange] = useState<null | number>(null)
|
|
51
|
+
|
|
52
|
+
return (
|
|
53
|
+
<Select<number>
|
|
54
|
+
value={value}
|
|
55
|
+
onChange={onChange}
|
|
56
|
+
leftElement={icon}
|
|
57
|
+
fill={fill}
|
|
58
|
+
size={size}
|
|
59
|
+
clearButton={clearButton}
|
|
60
|
+
placeholder="Не выбрано"
|
|
61
|
+
options={[
|
|
62
|
+
{ value: 1, title: 'Vladimir Putin' },
|
|
63
|
+
{ value: 2, title: 'Donald Trump' },
|
|
64
|
+
{ value: 3, title: 'Sergey Lavrov' },
|
|
65
|
+
...new Array(10).fill(0).map((_, i) => ({
|
|
66
|
+
title: `Value ${i + 4}`,
|
|
67
|
+
value: i + 4
|
|
68
|
+
}))
|
|
69
|
+
]}
|
|
70
|
+
/>
|
|
71
|
+
)
|
|
72
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { SelectTags } from '@/SelectTags'
|
|
2
|
+
import { useState } from 'react'
|
|
3
|
+
|
|
4
|
+
export const SelectTagsExample = () => {
|
|
5
|
+
return (
|
|
6
|
+
<div className="col-group">
|
|
7
|
+
<div className="row-group">
|
|
8
|
+
<div style={{ maxWidth: '380px' }}>
|
|
9
|
+
<SelectTagsControl />
|
|
10
|
+
</div>
|
|
11
|
+
</div>
|
|
12
|
+
</div>
|
|
13
|
+
)
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const SelectTagsControl = ({ fill }: { fill?: boolean } = {}) => {
|
|
17
|
+
const [value, onChange] = useState<number[]>([])
|
|
18
|
+
|
|
19
|
+
return (
|
|
20
|
+
<SelectTags<number>
|
|
21
|
+
value={value}
|
|
22
|
+
onChange={onChange}
|
|
23
|
+
fill={fill}
|
|
24
|
+
placeholder="Выберите варианты"
|
|
25
|
+
options={[
|
|
26
|
+
{ value: 1, title: 'Vladimir Putin' },
|
|
27
|
+
{ value: 2, title: 'Donald Trump' },
|
|
28
|
+
{ value: 3, title: 'Sergey Lavrov' },
|
|
29
|
+
...new Array(10).fill(0).map((_, i) => ({
|
|
30
|
+
title: `Value ${i + 4}`,
|
|
31
|
+
value: i + 4
|
|
32
|
+
}))
|
|
33
|
+
]}
|
|
34
|
+
/>
|
|
35
|
+
)
|
|
36
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { Icon } from '@/Icon'
|
|
2
|
+
import { Switch, SwitchProps } from '@/Switch'
|
|
3
|
+
import { faCheck, faClose } from '@fortawesome/free-solid-svg-icons'
|
|
4
|
+
import { useState } from 'react'
|
|
5
|
+
|
|
6
|
+
const longtext = `The expanded form makes it easy to schedule meetings: fields to fill out are displayed on the left, and the participants' schedule is shown on the right.`
|
|
7
|
+
|
|
8
|
+
export const SwitchExample = () => {
|
|
9
|
+
return (
|
|
10
|
+
<div className="col-group">
|
|
11
|
+
<div className="flex gap-24">
|
|
12
|
+
<div className="flex flex-col gap-12">
|
|
13
|
+
<SwitchControl label="Accept terms and conditions" />
|
|
14
|
+
<SwitchControl
|
|
15
|
+
label="I want to recieve promote emails"
|
|
16
|
+
checkedIcon={<Icon icon={faCheck} />}
|
|
17
|
+
uncheckedIcon={<Icon icon={faClose} />}
|
|
18
|
+
/>
|
|
19
|
+
</div>
|
|
20
|
+
<div className="flex flex-col gap-12">
|
|
21
|
+
<SwitchControl label="Accept terms and conditions" disabled defaultChecked />
|
|
22
|
+
<SwitchControl label="I want to recieve promote emails" disabled />
|
|
23
|
+
</div>
|
|
24
|
+
</div>
|
|
25
|
+
<div style={{ height: '1px', background: '#eeeeee', margin: '12px 0px' }} />
|
|
26
|
+
<div className="flex flex-col gap-12">
|
|
27
|
+
<SwitchControl label="Accept terms and conditions" defaultChecked />
|
|
28
|
+
<SwitchControl defaultChecked label={'Use the advanced form to create events'} />
|
|
29
|
+
<SwitchControl label={longtext + ' ' + longtext} defaultChecked />
|
|
30
|
+
</div>
|
|
31
|
+
</div>
|
|
32
|
+
)
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
interface Props extends Omit<SwitchProps, 'checked' | 'onCheckedChange'> {
|
|
36
|
+
label?: React.ReactNode
|
|
37
|
+
defaultChecked?: boolean
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const SwitchControl = ({ defaultChecked, ...props }: Props) => {
|
|
41
|
+
const [checked, setCheck] = useState(defaultChecked ?? false)
|
|
42
|
+
|
|
43
|
+
return <Switch {...props} checked={checked} onCheckedChange={setCheck} />
|
|
44
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Tabs } from '@/Tabs'
|
|
2
|
+
import { useState } from 'react'
|
|
3
|
+
|
|
4
|
+
export const TabsExample = () => {
|
|
5
|
+
const [value, onChange] = useState<string>('account')
|
|
6
|
+
|
|
7
|
+
return (
|
|
8
|
+
<div>
|
|
9
|
+
<Tabs value={value} onChange={onChange}>
|
|
10
|
+
<Tabs.Tab value="account">Account</Tabs.Tab>
|
|
11
|
+
<Tabs.Tab value="password">Password</Tabs.Tab>
|
|
12
|
+
<Tabs.Tab value="settings">Settings</Tabs.Tab>
|
|
13
|
+
</Tabs>
|
|
14
|
+
</div>
|
|
15
|
+
)
|
|
16
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { TextArea } from '@/TextArea'
|
|
2
|
+
|
|
3
|
+
export const TextAreaExample = () => {
|
|
4
|
+
return (
|
|
5
|
+
<div className="col-group">
|
|
6
|
+
<div className="flex items-start gap-10">
|
|
7
|
+
<TextArea grow placeholder="Auto growing" />
|
|
8
|
+
<TextArea grow placeholder="Growing limited" style={{ maxHeight: '240px' }} />
|
|
9
|
+
<TextArea placeholder="Resizable and fill" fill />
|
|
10
|
+
</div>
|
|
11
|
+
<div className="flex items-start gap-10">
|
|
12
|
+
<TextArea grow placeholder="Auto growing" disabled />
|
|
13
|
+
<TextArea grow placeholder="Growing limited" style={{ maxHeight: '240px' }} required />
|
|
14
|
+
</div>
|
|
15
|
+
</div>
|
|
16
|
+
)
|
|
17
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Form } from '@/Form'
|
|
2
|
+
|
|
3
|
+
export const TextInput = () => {
|
|
4
|
+
return (
|
|
5
|
+
<div style={{ width: '200px' }}>
|
|
6
|
+
<div style={{ color: '#ffffff', marginBottom: '10px' }}>TextInput</div>
|
|
7
|
+
<div style={{ marginBottom: '20px' }}>
|
|
8
|
+
<Form />
|
|
9
|
+
</div>
|
|
10
|
+
</div>
|
|
11
|
+
)
|
|
12
|
+
}
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
import { Button } from '@/Button'
|
|
2
|
+
import { ButtonGroup } from '@/ButtonGroup'
|
|
3
|
+
import { Icon } from '@/Icon'
|
|
4
|
+
import { createToaster } from '@/Toaster'
|
|
5
|
+
import { faCircleCheck, faCircleInfo, faTriangleExclamation } from '@fortawesome/free-solid-svg-icons'
|
|
6
|
+
import { useState } from 'react'
|
|
7
|
+
|
|
8
|
+
const Toaster = createToaster({ duration: 2500, align: 'center' })
|
|
9
|
+
|
|
10
|
+
export const ToasterExample = () => {
|
|
11
|
+
const [side, setSide] = useState<'top' | 'bottom'>('top')
|
|
12
|
+
const [align, setAlign] = useState<'center' | 'left' | 'right'>('center')
|
|
13
|
+
|
|
14
|
+
return (
|
|
15
|
+
<div>
|
|
16
|
+
<div className="col-group">
|
|
17
|
+
<div className="row-group">
|
|
18
|
+
<ButtonGroup>
|
|
19
|
+
<Button active={side === 'top'} onClick={() => setSide('top')}>
|
|
20
|
+
top
|
|
21
|
+
</Button>
|
|
22
|
+
<Button active={side === 'bottom'} onClick={() => setSide('bottom')}>
|
|
23
|
+
bottom
|
|
24
|
+
</Button>
|
|
25
|
+
</ButtonGroup>
|
|
26
|
+
<ButtonGroup>
|
|
27
|
+
<Button active={align === 'left'} onClick={() => setAlign('left')}>
|
|
28
|
+
left
|
|
29
|
+
</Button>
|
|
30
|
+
<Button active={align === 'center'} onClick={() => setAlign('center')}>
|
|
31
|
+
center
|
|
32
|
+
</Button>
|
|
33
|
+
<Button active={align === 'right'} onClick={() => setAlign('right')}>
|
|
34
|
+
right
|
|
35
|
+
</Button>
|
|
36
|
+
</ButtonGroup>
|
|
37
|
+
</div>
|
|
38
|
+
<div className="row-group">
|
|
39
|
+
<Button
|
|
40
|
+
appearance="neutral"
|
|
41
|
+
onClick={() => {
|
|
42
|
+
Toaster.send({
|
|
43
|
+
appearance: 'neutral',
|
|
44
|
+
title: 'Event created',
|
|
45
|
+
description: 'Sunday, December 21, 2025 at 2:45 AM'
|
|
46
|
+
})
|
|
47
|
+
}}
|
|
48
|
+
>
|
|
49
|
+
Create event
|
|
50
|
+
</Button>
|
|
51
|
+
<Button
|
|
52
|
+
onClick={() => {
|
|
53
|
+
Toaster.send({
|
|
54
|
+
appearance: 'neutral',
|
|
55
|
+
title: 'The text is copied'
|
|
56
|
+
})
|
|
57
|
+
}}
|
|
58
|
+
>
|
|
59
|
+
Copy text
|
|
60
|
+
</Button>
|
|
61
|
+
<Button
|
|
62
|
+
onClick={() => {
|
|
63
|
+
Toaster.send({
|
|
64
|
+
appearance: 'positive',
|
|
65
|
+
title: 'Move files is completed!',
|
|
66
|
+
description: 'Moved 6 files'
|
|
67
|
+
})
|
|
68
|
+
}}
|
|
69
|
+
>
|
|
70
|
+
Move files
|
|
71
|
+
</Button>
|
|
72
|
+
<Button
|
|
73
|
+
onClick={() =>
|
|
74
|
+
Toaster.send({
|
|
75
|
+
appearance: 'negative',
|
|
76
|
+
title: 'Permission error',
|
|
77
|
+
description:
|
|
78
|
+
'You do not have permissions to perform this action. Please contact your system administrator to request the appropriate access rights.'
|
|
79
|
+
})
|
|
80
|
+
}
|
|
81
|
+
>
|
|
82
|
+
Delete root
|
|
83
|
+
</Button>
|
|
84
|
+
</div>
|
|
85
|
+
<div className="row-group">
|
|
86
|
+
<Button
|
|
87
|
+
appearance="primary"
|
|
88
|
+
onClick={() => {
|
|
89
|
+
Toaster.send({
|
|
90
|
+
appearance: 'primary',
|
|
91
|
+
title: 'Event has been created',
|
|
92
|
+
description: 'Be at the area 10 minutes before the event time',
|
|
93
|
+
icon: <Icon icon={faCircleInfo} />
|
|
94
|
+
})
|
|
95
|
+
}}
|
|
96
|
+
>
|
|
97
|
+
Primary
|
|
98
|
+
</Button>
|
|
99
|
+
<Button
|
|
100
|
+
appearance="neutral"
|
|
101
|
+
onClick={() => {
|
|
102
|
+
Toaster.send({
|
|
103
|
+
appearance: 'neutral',
|
|
104
|
+
title: 'Event has been created',
|
|
105
|
+
description: 'Be at the area 10 minutes before the event time',
|
|
106
|
+
icon: <Icon icon={faCircleInfo} />
|
|
107
|
+
})
|
|
108
|
+
}}
|
|
109
|
+
>
|
|
110
|
+
Neutral
|
|
111
|
+
</Button>
|
|
112
|
+
<Button
|
|
113
|
+
appearance="positive"
|
|
114
|
+
onClick={() => {
|
|
115
|
+
Toaster.send({
|
|
116
|
+
appearance: 'positive',
|
|
117
|
+
title: 'Event has been created',
|
|
118
|
+
description: 'Be at the area 10 minutes before the event time',
|
|
119
|
+
icon: <Icon icon={faCircleCheck} />
|
|
120
|
+
})
|
|
121
|
+
}}
|
|
122
|
+
>
|
|
123
|
+
Positive
|
|
124
|
+
</Button>
|
|
125
|
+
<Button
|
|
126
|
+
appearance="negative"
|
|
127
|
+
onClick={() => {
|
|
128
|
+
Toaster.send({
|
|
129
|
+
appearance: 'negative',
|
|
130
|
+
title: 'Event has been created',
|
|
131
|
+
description: 'Be at the area 10 minutes before the event time',
|
|
132
|
+
icon: <Icon icon={faTriangleExclamation} />
|
|
133
|
+
})
|
|
134
|
+
}}
|
|
135
|
+
>
|
|
136
|
+
Negative
|
|
137
|
+
</Button>
|
|
138
|
+
<Button
|
|
139
|
+
appearance="neutral"
|
|
140
|
+
onClick={() => {
|
|
141
|
+
Toaster.send({
|
|
142
|
+
appearance: 'warning',
|
|
143
|
+
title: 'Event has been created',
|
|
144
|
+
description: 'Be at the area 10 minutes before the event time',
|
|
145
|
+
icon: <Icon icon={faTriangleExclamation} />
|
|
146
|
+
})
|
|
147
|
+
}}
|
|
148
|
+
>
|
|
149
|
+
Warning
|
|
150
|
+
</Button>
|
|
151
|
+
</div>
|
|
152
|
+
</div>
|
|
153
|
+
<Toaster.Viewport align={align} side={side} />
|
|
154
|
+
</div>
|
|
155
|
+
)
|
|
156
|
+
}
|