@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
package/.eslintrc
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
{
|
|
2
|
+
"env": {
|
|
3
|
+
"node": true,
|
|
4
|
+
"browser": true,
|
|
5
|
+
"es6": true
|
|
6
|
+
},
|
|
7
|
+
"extends": [
|
|
8
|
+
"plugin:react/recommended",
|
|
9
|
+
"plugin:react-hooks/recommended",
|
|
10
|
+
"react-app"
|
|
11
|
+
],
|
|
12
|
+
"parser": "@typescript-eslint/parser",
|
|
13
|
+
"plugins": ["react"],
|
|
14
|
+
"parserOptions": {
|
|
15
|
+
"sourceType": "module",
|
|
16
|
+
"requireConfigFile": false,
|
|
17
|
+
"ecmaFeatures": {
|
|
18
|
+
"jsx": true
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
"settings": {
|
|
22
|
+
"react": {
|
|
23
|
+
"version": "detect"
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
"rules": {
|
|
27
|
+
"no-var": "error",
|
|
28
|
+
"typescript-eslint/typescript-estree": "off",
|
|
29
|
+
"react-hooks/exhaustive-deps": "off",
|
|
30
|
+
"react/react-in-jsx-scope": "off",
|
|
31
|
+
"react/no-children-prop": "off",
|
|
32
|
+
"react/display-name": "off",
|
|
33
|
+
"jsx-a11y/aria-role": "off",
|
|
34
|
+
"react/prop-types": "off",
|
|
35
|
+
"react/jsx-no-target-blank": "off",
|
|
36
|
+
"import/no-anonymous-default-export": "off",
|
|
37
|
+
"import/no-extraneous-dependencies": [
|
|
38
|
+
"error",
|
|
39
|
+
{
|
|
40
|
+
"devDependencies": true,
|
|
41
|
+
"peerDependencies": false
|
|
42
|
+
}
|
|
43
|
+
],
|
|
44
|
+
"no-throw-literal": "off",
|
|
45
|
+
"react/no-multi-comp": [2, { "ignoreStateless": true }],
|
|
46
|
+
"no-restricted-syntax": [
|
|
47
|
+
"error",
|
|
48
|
+
{
|
|
49
|
+
"selector": "CallExpression[arguments.length=1][callee.property.name='reduce']",
|
|
50
|
+
"message": "Provide initialValue to .reduce()."
|
|
51
|
+
}
|
|
52
|
+
]
|
|
53
|
+
}
|
|
54
|
+
}
|
package/declaration.d.ts
ADDED
package/index.html
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<title>Playground</title>
|
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
7
|
+
</head>
|
|
8
|
+
<body>
|
|
9
|
+
<div id="root"></div>
|
|
10
|
+
<script type="module" src="./playground/bootstrap.tsx"></script>
|
|
11
|
+
</body>
|
|
12
|
+
</html>
|
package/package.json
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@companix/uikit",
|
|
3
|
+
"version": "0.0.01",
|
|
4
|
+
"module": "./dist/bundle.es.js",
|
|
5
|
+
"types": "./src/index.ts",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"author": "Pavel Victorov",
|
|
8
|
+
"scripts": {
|
|
9
|
+
"echo": "echo \"uikit\"",
|
|
10
|
+
"dev": "vite --config vite.config.ts",
|
|
11
|
+
"build": "rm -rf dist && vite build --config vite.build.ts"
|
|
12
|
+
},
|
|
13
|
+
"sideEffects": [
|
|
14
|
+
"./dist/uikit.css"
|
|
15
|
+
],
|
|
16
|
+
"license": "ISC",
|
|
17
|
+
"peerDependencies": {
|
|
18
|
+
"react": "^18.3.1",
|
|
19
|
+
"react-dom": "^18.3.1"
|
|
20
|
+
},
|
|
21
|
+
"dependencies": {
|
|
22
|
+
"@companix/utils-browser": "file:../utils-browser",
|
|
23
|
+
"@companix/utils-js": "file:../utils-js",
|
|
24
|
+
"@fortawesome/free-solid-svg-icons": "^7.1.0",
|
|
25
|
+
"@fortawesome/react-fontawesome": "^3.1.1",
|
|
26
|
+
"@radix-ui/react-alert-dialog": "^1.1.15",
|
|
27
|
+
"@radix-ui/react-checkbox": "^1.3.3",
|
|
28
|
+
"@radix-ui/react-dialog": "^1.1.15",
|
|
29
|
+
"@radix-ui/react-popover": "^1.1.15",
|
|
30
|
+
"@radix-ui/react-radio-group": "^1.3.8",
|
|
31
|
+
"@radix-ui/react-switch": "^1.2.6",
|
|
32
|
+
"@radix-ui/react-tabs": "^1.1.13",
|
|
33
|
+
"@radix-ui/react-toast": "^1.2.15",
|
|
34
|
+
"@radix-ui/react-visually-hidden": "^1.2.4",
|
|
35
|
+
"classnames": "^2.5.1",
|
|
36
|
+
"font-awesome": "^4.7.0",
|
|
37
|
+
"react-input-mask": "^2.0.4",
|
|
38
|
+
"react-merge-refs": "^3.0.2"
|
|
39
|
+
},
|
|
40
|
+
"devDependencies": {
|
|
41
|
+
"sass": "^1.96.0",
|
|
42
|
+
"sass-embedded": "^1.96.0",
|
|
43
|
+
"rollup-plugin-scss": "^4.0.1",
|
|
44
|
+
"@blueprintjs/core": "^6.2.1",
|
|
45
|
+
"@radix-ui/react-icons": "^1.3.2",
|
|
46
|
+
"@react-aria/interactions": "^3.25.3",
|
|
47
|
+
"@rollup/plugin-eslint": "^9.0.5",
|
|
48
|
+
"@rollup/plugin-typescript": "^11.1.6",
|
|
49
|
+
"@tailwindcss/vite": "^4.1.12",
|
|
50
|
+
"@types/react": "^18.3.1",
|
|
51
|
+
"@types/react-dom": "^18.3.1",
|
|
52
|
+
"@types/react-input-mask": "^3.0.6",
|
|
53
|
+
"@typescript-eslint/parser": "^5.62.0",
|
|
54
|
+
"@vitejs/plugin-react": "^4.6.0",
|
|
55
|
+
"eslint-config-react-app": "^7.0.1",
|
|
56
|
+
"eslint-plugin-import": "^2.29.1",
|
|
57
|
+
"eslint-plugin-react": "^7.34.3",
|
|
58
|
+
"eslint-plugin-react-hooks": "^4.6.2",
|
|
59
|
+
"eslint-webpack-plugin": "^4.2.0",
|
|
60
|
+
"react": "^18.3.1",
|
|
61
|
+
"react-dom": "^18.3.1",
|
|
62
|
+
"rollup-plugin-auto-external": "^2.0.0",
|
|
63
|
+
"vite": "^7.0.0",
|
|
64
|
+
"vite-plugin-checker": "^0.9.3"
|
|
65
|
+
}
|
|
66
|
+
}
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
// import { Test1Animation } from './animation-test-1'
|
|
2
|
+
// import { Test2Animation, Test2CompletedAnimation } from './animation-test-2'
|
|
3
|
+
// import { SelectExample } from './select'
|
|
4
|
+
// import { PopupExample } from './popup'
|
|
5
|
+
// import { TextInput } from './text-input'
|
|
6
|
+
// import { NumberInputs } from './number-inputs'
|
|
7
|
+
// import { Button } from '../Button'
|
|
8
|
+
// import { useState } from 'react'
|
|
9
|
+
// import { Drawer } from '../Drawer'
|
|
10
|
+
// import { Popup } from '../Popup'
|
|
11
|
+
// import { TestApp } from './Test'
|
|
12
|
+
import { useLayoutEffect } from 'react'
|
|
13
|
+
import { ButtonsExample, ButtonsGroupExample } from './buttons'
|
|
14
|
+
import { PopoversExample } from './popovers'
|
|
15
|
+
import { Example } from './Example'
|
|
16
|
+
import { SelectExample } from './select'
|
|
17
|
+
import { TooltipExample } from './tooltip'
|
|
18
|
+
import { CheckboxExample } from './checkbox'
|
|
19
|
+
import { RadioGroupExample } from './radio-group'
|
|
20
|
+
import { TabsExample } from './tabs'
|
|
21
|
+
import { ToasterExample } from './toaster'
|
|
22
|
+
import { DialogExample } from './dialog'
|
|
23
|
+
import { InputsExample } from './input'
|
|
24
|
+
import { TextAreaExample } from './text-area'
|
|
25
|
+
import { SelectTagsExample } from './select-tags'
|
|
26
|
+
import { DateInputExample } from './date-input'
|
|
27
|
+
import { DatePickerExample } from './date-picker'
|
|
28
|
+
import { SwitchExample } from './switch'
|
|
29
|
+
import { DialogAlertExample } from './dialog-alert'
|
|
30
|
+
import { DrawerExample } from './drawer'
|
|
31
|
+
// import { Tabs } from '../Tabs'
|
|
32
|
+
|
|
33
|
+
export const App = () => {
|
|
34
|
+
useLayoutEffect(() => {
|
|
35
|
+
document.body.classList.add('theme-light')
|
|
36
|
+
}, [])
|
|
37
|
+
|
|
38
|
+
// return <TestApp />
|
|
39
|
+
return (
|
|
40
|
+
<div className="examples-list">
|
|
41
|
+
<div />
|
|
42
|
+
<div />
|
|
43
|
+
{/* <div style={{ height: '200px', width: '100%', position: 'relative' }}>
|
|
44
|
+
<div className="row-group" style={{ position: 'absolute' }}>
|
|
45
|
+
<Test1Animation />
|
|
46
|
+
<Test2Animation />
|
|
47
|
+
<Test2CompletedAnimation />
|
|
48
|
+
</div>
|
|
49
|
+
</div>
|
|
50
|
+
<TabsApp />
|
|
51
|
+
<ButtonsExample />
|
|
52
|
+
<SelectExample /> */}
|
|
53
|
+
<Example name="Popovers">
|
|
54
|
+
<PopoversExample />
|
|
55
|
+
</Example>
|
|
56
|
+
<Example name="Tooltip">
|
|
57
|
+
<TooltipExample />
|
|
58
|
+
</Example>
|
|
59
|
+
<Example name="Dialog">
|
|
60
|
+
<DialogExample />
|
|
61
|
+
</Example>
|
|
62
|
+
<Example name="DialogAlert">
|
|
63
|
+
<DialogAlertExample />
|
|
64
|
+
</Example>
|
|
65
|
+
<Example name="Drawer">
|
|
66
|
+
<DrawerExample />
|
|
67
|
+
</Example>
|
|
68
|
+
<Example name="Input">
|
|
69
|
+
<InputsExample />
|
|
70
|
+
</Example>
|
|
71
|
+
<Example name="TextArea">
|
|
72
|
+
<TextAreaExample />
|
|
73
|
+
</Example>
|
|
74
|
+
<Example name="Select">
|
|
75
|
+
<SelectExample />
|
|
76
|
+
</Example>
|
|
77
|
+
<Example name="SelectTags">
|
|
78
|
+
<SelectTagsExample />
|
|
79
|
+
</Example>
|
|
80
|
+
<Example name="DateInput">
|
|
81
|
+
<DateInputExample />
|
|
82
|
+
</Example>
|
|
83
|
+
<Example name="DatePicker">
|
|
84
|
+
<DatePickerExample />
|
|
85
|
+
</Example>
|
|
86
|
+
<Example name="Checkbox">
|
|
87
|
+
<CheckboxExample />
|
|
88
|
+
</Example>
|
|
89
|
+
<Example name="RadioGroup">
|
|
90
|
+
<RadioGroupExample />
|
|
91
|
+
</Example>
|
|
92
|
+
<Example name="Switch">
|
|
93
|
+
<SwitchExample />
|
|
94
|
+
</Example>
|
|
95
|
+
<Example name="Tabs">
|
|
96
|
+
<TabsExample />
|
|
97
|
+
</Example>
|
|
98
|
+
<Example name="Buttons">
|
|
99
|
+
<ButtonsExample />
|
|
100
|
+
</Example>
|
|
101
|
+
<Example name="ButtonGroup">
|
|
102
|
+
<ButtonsGroupExample />
|
|
103
|
+
</Example>
|
|
104
|
+
<Example name="Toaster">
|
|
105
|
+
<ToasterExample />
|
|
106
|
+
</Example>
|
|
107
|
+
|
|
108
|
+
{/* <div className="flex flex-col gap-10">
|
|
109
|
+
<DrawerApp />
|
|
110
|
+
<PopupApp />
|
|
111
|
+
</div>
|
|
112
|
+
<PopupExample />
|
|
113
|
+
<TextInput />
|
|
114
|
+
<NumberInputs /> */}
|
|
115
|
+
<div />
|
|
116
|
+
<div />
|
|
117
|
+
</div>
|
|
118
|
+
)
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
// const TabsApp = () => {
|
|
122
|
+
// const [tab, setTab] = useState('tab-1')
|
|
123
|
+
|
|
124
|
+
// return (
|
|
125
|
+
// <div>
|
|
126
|
+
// <Tabs onChange={setTab} value={tab}>
|
|
127
|
+
// <Tabs.Tab value="tab-1">Tab1</Tabs.Tab>
|
|
128
|
+
// <Tabs.Tab value="tab-2">Tab2</Tabs.Tab>
|
|
129
|
+
// </Tabs>
|
|
130
|
+
// Active: {tab}
|
|
131
|
+
// </div>
|
|
132
|
+
// )
|
|
133
|
+
// }
|
|
134
|
+
|
|
135
|
+
// const DrawerApp = () => {
|
|
136
|
+
// const [isOpen, setOpen] = useState(false)
|
|
137
|
+
|
|
138
|
+
// return (
|
|
139
|
+
// <>
|
|
140
|
+
// <Drawer onClose={() => setOpen(false)} isOpen={isOpen} size="60%">
|
|
141
|
+
// <Content close={() => setOpen(false)} />
|
|
142
|
+
// </Drawer>
|
|
143
|
+
// <Button onClick={() => setOpen((value) => !value)}>{isOpen ? 'Close' : 'Open'} drawer</Button>
|
|
144
|
+
// </>
|
|
145
|
+
// )
|
|
146
|
+
// }
|
|
147
|
+
|
|
148
|
+
// const Content = ({ close }: { close: () => void }) => {
|
|
149
|
+
// console.log('RENDER')
|
|
150
|
+
// return <div onClick={close}>App: click to close</div>
|
|
151
|
+
// }
|
|
152
|
+
|
|
153
|
+
// const PopupApp = () => {
|
|
154
|
+
// const [isOpen, setOpen] = useState(false)
|
|
155
|
+
|
|
156
|
+
// return (
|
|
157
|
+
// <>
|
|
158
|
+
// <Popup onClose={() => setOpen(false)} isOpen={isOpen} className="popup-1">
|
|
159
|
+
// <div style={{ padding: '10px' }}>
|
|
160
|
+
// <Button onClick={() => setOpen(false)}>App: click to close</Button>
|
|
161
|
+
// </div>
|
|
162
|
+
// </Popup>
|
|
163
|
+
// <Button onClick={() => setOpen((value) => !value)}>{isOpen ? 'Close' : 'Open'} popup</Button>
|
|
164
|
+
// </>
|
|
165
|
+
// )
|
|
166
|
+
// }
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
interface ExampleProps {
|
|
2
|
+
children: React.ReactNode
|
|
3
|
+
pane?: React.ReactNode
|
|
4
|
+
name: string
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export const Example = ({ name, children, pane }: ExampleProps) => {
|
|
8
|
+
return (
|
|
9
|
+
<div className="sample">
|
|
10
|
+
<div className="sample-name">{name}</div>
|
|
11
|
+
<div>{children}</div>
|
|
12
|
+
</div>
|
|
13
|
+
)
|
|
14
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import './test.scss'
|
|
2
|
+
|
|
3
|
+
// import { Popover } from '../Popover'
|
|
4
|
+
// import { Calendar } from '../DatePicker/Calendar'
|
|
5
|
+
import { useLayoutEffect } from 'react'
|
|
6
|
+
import { DatePickerControl } from './date-picker'
|
|
7
|
+
|
|
8
|
+
const PopoverDemo = () => {
|
|
9
|
+
return (
|
|
10
|
+
<div style={{ width: '280px' }}>
|
|
11
|
+
<DatePickerControl size="md" />
|
|
12
|
+
</div>
|
|
13
|
+
)
|
|
14
|
+
// const [value, setValue] = useState(new Date())
|
|
15
|
+
|
|
16
|
+
// return (
|
|
17
|
+
// <Popover
|
|
18
|
+
// open
|
|
19
|
+
// fitMaxHeight={false}
|
|
20
|
+
// content={() => <Calendar value={value} onChange={setValue} disableFuture />}
|
|
21
|
+
// >
|
|
22
|
+
// <div></div>
|
|
23
|
+
// </Popover>
|
|
24
|
+
// )
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// const Check = () => {
|
|
28
|
+
// console.log('render')
|
|
29
|
+
// return <div>Check</div>
|
|
30
|
+
// }
|
|
31
|
+
|
|
32
|
+
export const TestApp = () => {
|
|
33
|
+
useLayoutEffect(() => {
|
|
34
|
+
document.body.classList.add('theme-light')
|
|
35
|
+
}, [])
|
|
36
|
+
|
|
37
|
+
return (
|
|
38
|
+
<div className="examples-list" style={{ alignItems: 'center' }}>
|
|
39
|
+
<div />
|
|
40
|
+
<PopoverDemo />
|
|
41
|
+
<div />
|
|
42
|
+
</div>
|
|
43
|
+
)
|
|
44
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
.test-1-animation {
|
|
2
|
+
transition-duration: 4s;
|
|
3
|
+
transition-property: all;
|
|
4
|
+
transition-timing-function: linear;
|
|
5
|
+
|
|
6
|
+
// presets before transition in (initial state)
|
|
7
|
+
&[data-closed][data-enter] {
|
|
8
|
+
opacity: 0;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
// transition in
|
|
12
|
+
&[data-enter] {
|
|
13
|
+
opacity: 1;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
// transition out
|
|
17
|
+
&[data-leave] {
|
|
18
|
+
opacity: 0;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import './index.scss'
|
|
2
|
+
// import { useState } from 'react'
|
|
3
|
+
|
|
4
|
+
export const Test1Animation = () => {
|
|
5
|
+
// const [open, setOpen] = useState(false)
|
|
6
|
+
|
|
7
|
+
return (
|
|
8
|
+
<div style={{ padding: '40px', display: 'flex', gap: '20px' }}>
|
|
9
|
+
<div style={{ padding: '10px', width: '200px' }}>
|
|
10
|
+
{/* <button onClick={() => setOpen((open) => !open)}>Animation 1</button> */}
|
|
11
|
+
{/* <Transition show={open}> */}
|
|
12
|
+
<div className="test-1-animation box-styles">Target element</div>
|
|
13
|
+
{/* </Transition> */}
|
|
14
|
+
</div>
|
|
15
|
+
</div>
|
|
16
|
+
)
|
|
17
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
// Описание test-2-animation: анимация запускается через transform, а исчезает через opacity
|
|
2
|
+
|
|
3
|
+
// Данный пример необходим для понимания прерывания enter анимации
|
|
4
|
+
// Анимация появления (data-enter) намеренно сделана долгой, чтобы запустить завершение анимации ещё до окончания анимации enter.
|
|
5
|
+
// В случае если анимация enter была бы окончена, вызов завершения анимации запускал бы этап [data-leave], однако при вызове завершения
|
|
6
|
+
// в моменте выполнения enter, [data-leave] не будет вызван, а вместо этого будет добавлен атрибут [data-closed], который запустит анимацию вспять, до initial состояния, которое описано в [data-closed][data-enter]
|
|
7
|
+
|
|
8
|
+
.test-2-animation {
|
|
9
|
+
// initial - начальное состояние (перед появлением)
|
|
10
|
+
&[data-closed][data-enter] {
|
|
11
|
+
transform: scale(0.3);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
// animate from initial - анимация до конечного состояния, от начального
|
|
15
|
+
&[data-enter] {
|
|
16
|
+
transform: scale(1);
|
|
17
|
+
transition-delay: 0;
|
|
18
|
+
transition-duration: 2s;
|
|
19
|
+
transition-property: transform;
|
|
20
|
+
transition-timing-function: linear;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
// exit - анимация завершения
|
|
24
|
+
&[data-leave] {
|
|
25
|
+
transition-delay: 0;
|
|
26
|
+
transition-duration: 1s;
|
|
27
|
+
transition-property: opacity;
|
|
28
|
+
transition-timing-function: linear;
|
|
29
|
+
opacity: 0;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// В данном примере, анимировано прерывание enter
|
|
34
|
+
|
|
35
|
+
.test-2-completed-animation {
|
|
36
|
+
// начальное состояние
|
|
37
|
+
// также будет запускаться при прерывании enter-анимации
|
|
38
|
+
&[data-closed][data-enter] {
|
|
39
|
+
// описываем начальное состояние (перед появлением). Обращаю внимание что "opacity: 0" не будет учтен при data-enter анимации
|
|
40
|
+
transform: scale(0.3);
|
|
41
|
+
opacity: 0;
|
|
42
|
+
// стили использующиеся при прерывании data-enter анимации (переход в начальное состояние)
|
|
43
|
+
transition-duration: 200ms;
|
|
44
|
+
transition-property: transform, opacity; // учитываем opacity
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
// animate - анимация появления запускаемая от начального до конечного состояния
|
|
48
|
+
&[data-enter] {
|
|
49
|
+
transform: scale(1);
|
|
50
|
+
transition-duration: 2s;
|
|
51
|
+
transition-property: transform;
|
|
52
|
+
transition-timing-function: linear;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// exit - анимация завершения
|
|
56
|
+
&[data-leave] {
|
|
57
|
+
transition-duration: 1s;
|
|
58
|
+
transition-property: opacity;
|
|
59
|
+
transition-timing-function: linear;
|
|
60
|
+
opacity: 0;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import './index.scss'
|
|
2
|
+
// import { useState } from 'react'
|
|
3
|
+
|
|
4
|
+
export const Test2Animation = () => {
|
|
5
|
+
// const [open, setOpen] = useState(false)
|
|
6
|
+
|
|
7
|
+
return (
|
|
8
|
+
<div style={{ padding: '40px', display: 'flex', gap: '20px' }}>
|
|
9
|
+
<div style={{ padding: '10px', width: '200px' }}>
|
|
10
|
+
{/* <button onClick={() => setOpen((open) => !open)}>Animation 2(*1)</button> */}
|
|
11
|
+
{/* <Transition show={open}> */}
|
|
12
|
+
<div className="test-2-animation box-styles">Target element</div>
|
|
13
|
+
{/* </Transition> */}
|
|
14
|
+
</div>
|
|
15
|
+
</div>
|
|
16
|
+
)
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export const Test2CompletedAnimation = () => {
|
|
20
|
+
// const [open, setOpen] = useState(false)
|
|
21
|
+
|
|
22
|
+
return (
|
|
23
|
+
<div style={{ padding: '40px', display: 'flex', gap: '20px' }}>
|
|
24
|
+
<div style={{ padding: '10px', width: '200px' }}>
|
|
25
|
+
{/* <button onClick={() => setOpen((open) => !open)}>Animation 2(*2)</button> */}
|
|
26
|
+
{/* <Transition show={open}> */}
|
|
27
|
+
<div className="test-2-completed-animation box-styles">Target element</div>
|
|
28
|
+
{/* </Transition> */}
|
|
29
|
+
</div>
|
|
30
|
+
</div>
|
|
31
|
+
)
|
|
32
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import './styles.scss'
|
|
2
|
+
|
|
3
|
+
import './index.scss'
|
|
4
|
+
import './index.css'
|
|
5
|
+
import '../src/theme.scss'
|
|
6
|
+
|
|
7
|
+
import { createRoot } from 'react-dom/client'
|
|
8
|
+
import { App } from './App'
|
|
9
|
+
// import { TestApp } from './Test'
|
|
10
|
+
|
|
11
|
+
createRoot(document.getElementById('root')!).render(<App />)
|
|
12
|
+
|
|
13
|
+
const error = console.error
|
|
14
|
+
console.error = (...args: any) => {
|
|
15
|
+
if (/defaultProps/.test(args[0])) return
|
|
16
|
+
if (/findDOMNode/.test(args[0])) return
|
|
17
|
+
|
|
18
|
+
error(...args)
|
|
19
|
+
}
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import { Appearance, Button, Mode, Size } from '@/Button'
|
|
2
|
+
import {
|
|
3
|
+
faPlay,
|
|
4
|
+
faPause,
|
|
5
|
+
faBookmark,
|
|
6
|
+
faArrowRight,
|
|
7
|
+
faChevronRight,
|
|
8
|
+
faFolderBlank,
|
|
9
|
+
faEye,
|
|
10
|
+
faCaretDown,
|
|
11
|
+
faPen,
|
|
12
|
+
faFile
|
|
13
|
+
} from '@fortawesome/free-solid-svg-icons'
|
|
14
|
+
import { Icon } from '@/Icon'
|
|
15
|
+
import { ButtonGroup } from '@/ButtonGroup'
|
|
16
|
+
|
|
17
|
+
const appearances: Appearance[] = ['primary', 'neutral', 'positive', 'negative']
|
|
18
|
+
const modes: Mode[] = ['default', 'outline', 'minimal']
|
|
19
|
+
const sizes: Size[] = ['sm', 'md', 'lg']
|
|
20
|
+
|
|
21
|
+
export const ButtonsExample = () => {
|
|
22
|
+
return (
|
|
23
|
+
<div className="col-group">
|
|
24
|
+
{appearances.map((appearance) => {
|
|
25
|
+
return (
|
|
26
|
+
<div className="row-group" key={`appearance-${appearance}`}>
|
|
27
|
+
{modes.map((mode) => (
|
|
28
|
+
<Button key={`mode-1-${appearance}-${mode}`} appearance={appearance} mode={mode}>
|
|
29
|
+
Button
|
|
30
|
+
</Button>
|
|
31
|
+
))}
|
|
32
|
+
{[...modes].reverse().map((mode) => (
|
|
33
|
+
<Button key={`mode-2-${appearance}-${mode}`} appearance={appearance} mode={mode} disabled>
|
|
34
|
+
Button
|
|
35
|
+
</Button>
|
|
36
|
+
))}
|
|
37
|
+
</div>
|
|
38
|
+
)
|
|
39
|
+
})}
|
|
40
|
+
<div className="row-group">
|
|
41
|
+
{sizes.map((size) => (
|
|
42
|
+
<Button key={`size-${size}`} icon={<Icon icon={faBookmark} size="xxxs" />} size={size}>
|
|
43
|
+
Button
|
|
44
|
+
</Button>
|
|
45
|
+
))}
|
|
46
|
+
</div>
|
|
47
|
+
<div className="row-group">
|
|
48
|
+
<Button icon={<Icon icon={faPause} size="xxxs" />} size="md"></Button>
|
|
49
|
+
<Button icon={<Icon icon={faPlay} size="xxxs" />} size="md">
|
|
50
|
+
Button
|
|
51
|
+
</Button>
|
|
52
|
+
<Button iconRight={<Icon icon={faArrowRight} size="xxxs" />}>Button</Button>
|
|
53
|
+
<Button fill iconRight={<Icon icon={faChevronRight} size="xxxs" className="quieter" />}>
|
|
54
|
+
Button
|
|
55
|
+
</Button>
|
|
56
|
+
<Button
|
|
57
|
+
fill
|
|
58
|
+
icon={<Icon icon={faFolderBlank} size="xxxs" />}
|
|
59
|
+
iconRight={<Icon icon={faChevronRight} size="xxxs" className="quieter" />}
|
|
60
|
+
>
|
|
61
|
+
Button
|
|
62
|
+
</Button>
|
|
63
|
+
</div>
|
|
64
|
+
<div className="row-group">
|
|
65
|
+
<Button fill align="left">
|
|
66
|
+
Left
|
|
67
|
+
</Button>
|
|
68
|
+
<Button fill align="center">
|
|
69
|
+
Center
|
|
70
|
+
</Button>
|
|
71
|
+
<Button fill align="right">
|
|
72
|
+
Right
|
|
73
|
+
</Button>
|
|
74
|
+
</div>
|
|
75
|
+
<div className="row-group">
|
|
76
|
+
<Button loading>Button fullwidth</Button>
|
|
77
|
+
<Button disabled>Button disabled</Button>
|
|
78
|
+
<Button fill>Button fullwidth</Button>
|
|
79
|
+
</div>
|
|
80
|
+
</div>
|
|
81
|
+
)
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export const ButtonsGroupExample = () => {
|
|
85
|
+
return (
|
|
86
|
+
<div className="col-group">
|
|
87
|
+
<div className="row-group">
|
|
88
|
+
<ButtonGroup>
|
|
89
|
+
<Button>Button One</Button>
|
|
90
|
+
<Button>Button Two</Button>
|
|
91
|
+
<Button>Button Three</Button>
|
|
92
|
+
</ButtonGroup>
|
|
93
|
+
</div>
|
|
94
|
+
<div className="row-group">
|
|
95
|
+
<ButtonGroup fill>
|
|
96
|
+
<Button>Secondary</Button>
|
|
97
|
+
<Button fill>Primary</Button>
|
|
98
|
+
</ButtonGroup>
|
|
99
|
+
</div>
|
|
100
|
+
<div className="row-group">
|
|
101
|
+
<ButtonGroup>
|
|
102
|
+
<Button icon={<Icon icon={faBookmark} size="xxxs" />} />
|
|
103
|
+
<Button>Button name</Button>
|
|
104
|
+
</ButtonGroup>
|
|
105
|
+
<ButtonGroup>
|
|
106
|
+
<Button>Button name</Button>
|
|
107
|
+
<Button icon={<Icon icon={faBookmark} size="xxxs" />} />
|
|
108
|
+
</ButtonGroup>
|
|
109
|
+
<ButtonGroup>
|
|
110
|
+
<Button
|
|
111
|
+
icon={<Icon icon={faFile} size="xxxs" />}
|
|
112
|
+
iconRight={<Icon icon={faCaretDown} size="xxxs" className="quieter" />}
|
|
113
|
+
>
|
|
114
|
+
File
|
|
115
|
+
</Button>
|
|
116
|
+
<Button
|
|
117
|
+
icon={<Icon icon={faPen} size="xxxs" />}
|
|
118
|
+
iconRight={<Icon icon={faCaretDown} size="xxxs" className="quieter" />}
|
|
119
|
+
>
|
|
120
|
+
Edit
|
|
121
|
+
</Button>
|
|
122
|
+
<Button
|
|
123
|
+
icon={<Icon icon={faEye} size="xxxs" />}
|
|
124
|
+
iconRight={<Icon icon={faCaretDown} size="xxxs" className="quieter" />}
|
|
125
|
+
>
|
|
126
|
+
View
|
|
127
|
+
</Button>
|
|
128
|
+
</ButtonGroup>
|
|
129
|
+
</div>
|
|
130
|
+
</div>
|
|
131
|
+
)
|
|
132
|
+
}
|