@companix/uikit 0.0.2 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (254) hide show
  1. package/dist/bundle.es.js +61 -0
  2. package/dist/bundle.es10.js +87 -0
  3. package/dist/bundle.es11.js +75 -0
  4. package/dist/bundle.es12.js +38 -0
  5. package/dist/bundle.es13.js +33 -0
  6. package/dist/bundle.es14.js +18 -0
  7. package/dist/bundle.es15.js +11 -0
  8. package/dist/bundle.es16.js +35 -0
  9. package/dist/bundle.es17.js +27 -0
  10. package/dist/bundle.es18.js +23 -0
  11. package/dist/bundle.es19.js +24 -0
  12. package/dist/bundle.es20.js +15 -0
  13. package/dist/bundle.es21.js +41 -0
  14. package/dist/bundle.es22.js +18 -0
  15. package/dist/bundle.es23.js +36 -0
  16. package/dist/bundle.es24.js +23 -0
  17. package/dist/bundle.es25.js +42 -0
  18. package/dist/bundle.es26.js +114 -0
  19. package/dist/bundle.es27.js +115 -0
  20. package/dist/bundle.es28.js +38 -0
  21. package/dist/bundle.es29.js +13 -0
  22. package/dist/bundle.es3.js +45 -0
  23. package/dist/bundle.es30.js +27 -0
  24. package/dist/bundle.es31.js +38 -0
  25. package/dist/bundle.es35.js +43 -0
  26. package/dist/bundle.es36.js +442 -0
  27. package/dist/bundle.es37.js +24 -0
  28. package/dist/bundle.es38.js +26 -0
  29. package/dist/bundle.es39.js +83 -0
  30. package/dist/bundle.es4.js +14 -0
  31. package/dist/bundle.es40.js +20 -0
  32. package/dist/bundle.es41.js +16 -0
  33. package/dist/bundle.es43.js +7 -0
  34. package/dist/bundle.es44.js +23 -0
  35. package/dist/bundle.es45.js +16 -0
  36. package/dist/bundle.es46.js +72 -0
  37. package/dist/bundle.es47.js +70 -0
  38. package/dist/bundle.es48.js +34 -0
  39. package/dist/bundle.es49.js +70 -0
  40. package/dist/bundle.es5.js +88 -0
  41. package/dist/bundle.es50.js +33 -0
  42. package/dist/bundle.es51.js +78 -0
  43. package/dist/bundle.es52.js +51 -0
  44. package/dist/bundle.es53.js +45 -0
  45. package/dist/bundle.es54.js +40 -0
  46. package/dist/bundle.es55.js +36 -0
  47. package/dist/bundle.es56.js +9 -0
  48. package/dist/bundle.es57.js +9 -0
  49. package/dist/bundle.es58.js +7 -0
  50. package/dist/bundle.es59.js +9 -0
  51. package/dist/bundle.es6.js +87 -0
  52. package/dist/bundle.es60.js +8 -0
  53. package/dist/bundle.es61.js +19 -0
  54. package/dist/bundle.es62.js +15 -0
  55. package/dist/bundle.es63.js +22 -0
  56. package/dist/bundle.es64.js +45 -0
  57. package/dist/bundle.es65.js +28 -0
  58. package/dist/bundle.es66.js +34 -0
  59. package/dist/bundle.es67.js +6 -0
  60. package/dist/bundle.es68.js +12 -0
  61. package/dist/bundle.es69.js +47 -0
  62. package/dist/bundle.es7.js +80 -0
  63. package/dist/bundle.es70.js +11 -0
  64. package/dist/bundle.es71.js +18 -0
  65. package/dist/bundle.es72.js +32 -0
  66. package/dist/bundle.es73.js +35 -0
  67. package/dist/bundle.es74.js +6 -0
  68. package/dist/bundle.es75.js +7 -0
  69. package/dist/bundle.es76.js +7 -0
  70. package/dist/bundle.es77.js +11 -0
  71. package/dist/bundle.es78.js +17 -0
  72. package/dist/bundle.es79.js +7 -0
  73. package/dist/bundle.es8.js +29 -0
  74. package/dist/bundle.es80.js +17 -0
  75. package/dist/bundle.es81.js +25 -0
  76. package/dist/bundle.es9.js +47 -0
  77. package/dist/types/Button/index.d.ts +20 -0
  78. package/dist/types/ButtonGroup/index.d.ts +7 -0
  79. package/dist/types/Checkbox/index.d.ts +10 -0
  80. package/dist/types/Countdown/index.d.ts +7 -0
  81. package/dist/types/DateInput/index.d.ts +13 -0
  82. package/dist/types/DatePicker/Calendar.d.ts +14 -0
  83. package/dist/types/DatePicker/CalendarHeader.d.ts +10 -0
  84. package/dist/types/DatePicker/index.d.ts +12 -0
  85. package/dist/types/Dialog/index.d.ts +12 -0
  86. package/dist/types/DialogAlert/Alert.d.ts +19 -0
  87. package/dist/types/DialogAlert/Viewport.d.ts +8 -0
  88. package/dist/types/DialogAlert/index.d.ts +11 -0
  89. package/dist/types/Drawer/index.d.ts +13 -0
  90. package/dist/types/File/index.d.ts +10 -0
  91. package/dist/types/Form/index.d.ts +17 -0
  92. package/dist/types/Icon/index.d.ts +7 -0
  93. package/dist/types/LoadButton/index.d.ts +5 -0
  94. package/dist/types/NumberInput/index.d.ts +6 -0
  95. package/dist/types/OptionItem/OptionItem.d.ts +7 -0
  96. package/dist/types/OptionItem/OptionsList.d.ts +8 -0
  97. package/dist/types/Popover/index.d.ts +26 -0
  98. package/dist/types/Radio/index.d.ts +20 -0
  99. package/dist/types/Scrollable/ImitateScroll.d.ts +10 -0
  100. package/dist/types/Scrollable/index.d.ts +33 -0
  101. package/dist/types/Select/SelectInput.d.ts +14 -0
  102. package/dist/types/Select/index.d.ts +15 -0
  103. package/dist/types/SelectTags/index.d.ts +15 -0
  104. package/dist/types/Spinner/index.d.ts +8 -0
  105. package/dist/types/Stepper/index.d.ts +8 -0
  106. package/dist/types/Switch/index.d.ts +10 -0
  107. package/dist/types/Tabs/index.d.ts +13 -0
  108. package/dist/types/TextArea/index.d.ts +7 -0
  109. package/dist/types/Toaster/RemoveListener.d.ts +3 -0
  110. package/dist/types/Toaster/Toast.d.ts +9 -0
  111. package/dist/types/Toaster/Viewport.d.ts +13 -0
  112. package/dist/types/Toaster/index.d.ts +15 -0
  113. package/dist/types/Tooltip/index.d.ts +8 -0
  114. package/dist/types/__hooks/use-frooze-closing.d.ts +5 -0
  115. package/dist/types/__hooks/use-loading.d.ts +8 -0
  116. package/dist/types/__hooks/use-local-storage.d.ts +1 -0
  117. package/dist/types/__hooks/use-popover-position.d.ts +8 -0
  118. package/dist/types/__hooks/use-previos.d.ts +2 -0
  119. package/dist/types/__hooks/use-resize.d.ts +3 -0
  120. package/dist/types/__hooks/use-scrollbox.d.ts +7 -0
  121. package/dist/types/__hooks/use-stepper-input.d.ts +13 -0
  122. package/dist/types/__hooks/use-update.d.ts +1 -0
  123. package/dist/types/__hooks/useCalendar.d.ts +17 -0
  124. package/dist/types/__hooks/useCalendarOptions-copy.d.ts +22 -0
  125. package/dist/types/__hooks/useCalendarOptions.d.ts +31 -0
  126. package/dist/types/__libs/calendar.d.ts +25 -0
  127. package/dist/types/__utils/utils.d.ts +25 -0
  128. package/dist/types/index.d.ts +31 -0
  129. package/dist/types/types.d.ts +13 -0
  130. package/dist/uikit.css +1 -0
  131. package/package.json +10 -6
  132. package/.eslintrc +0 -54
  133. package/declaration.d.ts +0 -4
  134. package/index.html +0 -12
  135. package/playground/App.tsx +0 -166
  136. package/playground/Example.tsx +0 -14
  137. package/playground/Test.tsx +0 -44
  138. package/playground/animation-test-1/index.scss +0 -20
  139. package/playground/animation-test-1/index.tsx +0 -17
  140. package/playground/animation-test-2/index.scss +0 -62
  141. package/playground/animation-test-2/index.tsx +0 -32
  142. package/playground/bootstrap.tsx +0 -19
  143. package/playground/buttons/index.tsx +0 -132
  144. package/playground/checkbox/index.tsx +0 -64
  145. package/playground/date-input/index.tsx +0 -45
  146. package/playground/date-picker/index.tsx +0 -41
  147. package/playground/dialog/index.tsx +0 -92
  148. package/playground/dialog-alert/index.tsx +0 -47
  149. package/playground/drawer/index.tsx +0 -55
  150. package/playground/index.css +0 -33
  151. package/playground/index.scss +0 -270
  152. package/playground/input/index.tsx +0 -112
  153. package/playground/number-inputs/index.tsx +0 -50
  154. package/playground/popovers/index.tsx +0 -70
  155. package/playground/radio-group/index.tsx +0 -69
  156. package/playground/select/index.tsx +0 -72
  157. package/playground/select-tags/index.tsx +0 -36
  158. package/playground/styles.scss +0 -2
  159. package/playground/switch/index.tsx +0 -44
  160. package/playground/tabs/index.tsx +0 -16
  161. package/playground/test.scss +0 -0
  162. package/playground/text-area/index.tsx +0 -17
  163. package/playground/text-input/index.tsx +0 -12
  164. package/playground/toaster/index.tsx +0 -156
  165. package/playground/tooltip/index.tsx +0 -26
  166. package/src/Button/Button.scss +0 -128
  167. package/src/Button/index.tsx +0 -72
  168. package/src/ButtonGroup/ButtonGroup.scss +0 -18
  169. package/src/ButtonGroup/index.tsx +0 -20
  170. package/src/Checkbox/Checkbox.scss +0 -115
  171. package/src/Checkbox/index.tsx +0 -46
  172. package/src/Countdown/index.tsx +0 -54
  173. package/src/DateInput/DateInput.scss +0 -11
  174. package/src/DateInput/index.tsx +0 -96
  175. package/src/DatePicker/Calendar.scss +0 -125
  176. package/src/DatePicker/Calendar.tsx +0 -157
  177. package/src/DatePicker/CalendarHeader.tsx +0 -139
  178. package/src/DatePicker/DatePicker.scss +0 -0
  179. package/src/DatePicker/index.tsx +0 -177
  180. package/src/Dialog/Dialog.scss +0 -25
  181. package/src/Dialog/Popup.scss +0 -55
  182. package/src/Dialog/index.tsx +0 -31
  183. package/src/DialogAlert/Alert.scss +0 -52
  184. package/src/DialogAlert/Alert.tsx +0 -78
  185. package/src/DialogAlert/Viewport.tsx +0 -52
  186. package/src/DialogAlert/index.tsx +0 -37
  187. package/src/Drawer/Drawer.scss +0 -112
  188. package/src/Drawer/index.tsx +0 -46
  189. package/src/File/index.tsx +0 -60
  190. package/src/Form/Form.scss +0 -70
  191. package/src/Form/Input.scss +0 -24
  192. package/src/Form/index.tsx +0 -131
  193. package/src/Icon/icon.scss +0 -18
  194. package/src/Icon/index.tsx +0 -43
  195. package/src/LoadButton/index.tsx +0 -17
  196. package/src/NumberInput/index.tsx +0 -74
  197. package/src/OptionItem/Option.scss +0 -89
  198. package/src/OptionItem/OptionItem.tsx +0 -49
  199. package/src/OptionItem/OptionsList.tsx +0 -26
  200. package/src/Popover/Popover.scss +0 -80
  201. package/src/Popover/index.tsx +0 -117
  202. package/src/Radio/Radio.scss +0 -148
  203. package/src/Radio/index.tsx +0 -68
  204. package/src/Scrollable/ImitateScroll.tsx +0 -141
  205. package/src/Scrollable/Scrollable.scss +0 -50
  206. package/src/Scrollable/index.tsx +0 -141
  207. package/src/Select/Select.scss +0 -80
  208. package/src/Select/SelectInput.tsx +0 -131
  209. package/src/Select/index.tsx +0 -134
  210. package/src/SelectTags/SelectTags.scss +0 -66
  211. package/src/SelectTags/index.tsx +0 -192
  212. package/src/Spinner/Spinner.scss +0 -14
  213. package/src/Spinner/index.tsx +0 -19
  214. package/src/Stepper/StepperInput.scss +0 -35
  215. package/src/Stepper/index.tsx +0 -76
  216. package/src/Switch/Switch.scss +0 -102
  217. package/src/Switch/index.tsx +0 -49
  218. package/src/Tabs/Tabs.scss +0 -58
  219. package/src/Tabs/index.tsx +0 -89
  220. package/src/TextArea/TextArea.scss +0 -34
  221. package/src/TextArea/index.tsx +0 -51
  222. package/src/Toaster/RemoveListener.tsx +0 -11
  223. package/src/Toaster/Toast.tsx +0 -69
  224. package/src/Toaster/Toaster.scss +0 -151
  225. package/src/Toaster/Viewport.tsx +0 -117
  226. package/src/Toaster/index.tsx +0 -52
  227. package/src/Tooltip/Tooltip.scss +0 -28
  228. package/src/Tooltip/index.tsx +0 -33
  229. package/src/__hooks/use-frooze-closing.ts +0 -51
  230. package/src/__hooks/use-loading.ts +0 -34
  231. package/src/__hooks/use-local-storage.ts +0 -19
  232. package/src/__hooks/use-popover-position.ts +0 -24
  233. package/src/__hooks/use-previos.ts +0 -25
  234. package/src/__hooks/use-resize.ts +0 -41
  235. package/src/__hooks/use-scrollbox.ts +0 -45
  236. package/src/__hooks/use-stepper-input.ts +0 -82
  237. package/src/__hooks/use-update.ts +0 -19
  238. package/src/__hooks/useCalendar.ts +0 -104
  239. package/src/__hooks/useCalendarOptions-copy.ts +0 -87
  240. package/src/__hooks/useCalendarOptions.ts +0 -68
  241. package/src/__libs/calendar.ts +0 -175
  242. package/src/__utils/utils.ts +0 -137
  243. package/src/css.scss +0 -120
  244. package/src/index.scss +0 -22
  245. package/src/index.ts +0 -36
  246. package/src/mixins.scss +0 -99
  247. package/src/theme.scss +0 -103
  248. package/src/types.ts +0 -14
  249. package/tailwind.config.js +0 -91
  250. package/themes/classic/animations.scss +0 -179
  251. package/themes/classic/classic.scss +0 -493
  252. package/tsconfig.json +0 -27
  253. package/vite.build.ts +0 -35
  254. package/vite.config.ts +0 -33
@@ -1,60 +0,0 @@
1
- import { VisuallyHidden } from '@radix-ui/react-visually-hidden'
2
- import { useRef } from 'react'
3
-
4
- export interface FileOverlayProps {
5
- multiple?: true
6
- onChange?: (file: File[]) => void
7
- children: React.ReactNode
8
- mimes?: string[]
9
- disabled?: boolean
10
- className?: string
11
- }
12
-
13
- const FileOverlay = ({
14
- onChange,
15
- disabled,
16
- mimes,
17
- children,
18
- multiple,
19
- className
20
- }: FileOverlayProps) => {
21
- const ref = useRef<HTMLInputElement>(null)
22
-
23
- const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {
24
- if (disabled) {
25
- return
26
- }
27
-
28
- if (e.target.files) {
29
- onChange?.(Array.from(e.target.files))
30
- }
31
-
32
- if (ref.current) {
33
- ref.current.value = ''
34
- }
35
- }
36
-
37
- return (
38
- <label className={className}>
39
- {children}
40
- <VisuallyHidden asChild>
41
- <input
42
- ref={ref}
43
- hidden
44
- type="file"
45
- autoComplete="off"
46
- autoCapitalize="none"
47
- autoCorrect="off"
48
- spellCheck="false"
49
- aria-autocomplete="none"
50
- multiple={multiple}
51
- accept={(mimes ?? []).join(', ')}
52
- onChange={handleChange}
53
- disabled={disabled}
54
- />
55
- </VisuallyHidden>
56
- </label>
57
- )
58
- }
59
-
60
- export { FileOverlay }
@@ -1,70 +0,0 @@
1
- @use '../mixins.scss';
2
-
3
- @mixin use-size($size) {
4
- &[data-size='#{$size}'] {
5
- .form-input {
6
- @include mixins.use-styles(form, size, $size);
7
- }
8
- }
9
- }
10
-
11
- .form {
12
- position: relative;
13
-
14
- @include mixins.use-styles(form);
15
-
16
- @include use-size(sm);
17
- @include use-size(md);
18
- @include use-size(lg);
19
-
20
- &-space-margin {
21
- margin: 0px var(--form_space, 0);
22
- }
23
-
24
- &:hover {
25
- @include mixins.use-styles(form, hover);
26
- }
27
-
28
- &:active {
29
- @include mixins.use-styles(form, active);
30
- }
31
-
32
- &[data-fill] {
33
- width: 100%;
34
-
35
- .form-input {
36
- width: 100%;
37
- }
38
- }
39
-
40
- &[data-required] {
41
- @include mixins.use-styles(form, required);
42
- }
43
-
44
- &[data-disabled] {
45
- @include mixins.use-styles(form, disabled);
46
-
47
- .form-input {
48
- cursor: inherit;
49
- }
50
- }
51
-
52
- &:focus-within {
53
- @include mixins.use-styles(form, focus);
54
- }
55
- }
56
-
57
- .form-input {
58
- outline: none;
59
-
60
- &::-webkit-outer-spin-button,
61
- &::-webkit-inner-spin-button {
62
- -webkit-appearance: none;
63
- }
64
-
65
- &::placeholder {
66
- user-select: none;
67
-
68
- @include mixins.use-styles(form, placeholder);
69
- }
70
- }
@@ -1,24 +0,0 @@
1
- .form-input-base {
2
- padding: 0px var(--form_space, 0);
3
- border-radius: var(--form_border-radius);
4
-
5
- &-left-element {
6
- position: absolute;
7
- left: 0;
8
- top: 0;
9
- bottom: 0;
10
- pointer-events: none;
11
- display: flex;
12
- align-items: center;
13
- }
14
-
15
- &-right-element {
16
- position: absolute;
17
- right: 0;
18
- top: 0;
19
- bottom: 0;
20
- pointer-events: none;
21
- display: flex;
22
- align-items: center;
23
- }
24
- }
@@ -1,131 +0,0 @@
1
- import cn from 'classnames'
2
- import InputMask from 'react-input-mask'
3
-
4
- import { useLayoutAndUpdate } from '../__hooks/use-update'
5
- import { attr } from '@companix/utils-browser'
6
- import { forwardRef, useCallback, useRef } from 'react'
7
- import { mergeRefs } from 'react-merge-refs'
8
-
9
- export interface FormProps extends React.HTMLAttributes<HTMLDivElement> {
10
- required?: boolean
11
- disabled?: boolean
12
- leftElement?: React.ReactNode
13
- rightElement?: React.ReactNode
14
- placeholder?: string
15
- value?: string | number
16
- readOnly?: boolean
17
- onValueChange?: (value: string, targetElement: HTMLInputElement) => void
18
- onChange?: (event: React.ChangeEvent<HTMLInputElement>) => void
19
- inputRef?: React.RefObject<HTMLInputElement>
20
- size?: 'sm' | 'md' | 'lg'
21
- fill?: boolean
22
- mask?: string
23
- maskChar?: string
24
- }
25
-
26
- export const Form = forwardRef<HTMLDivElement, FormProps>(
27
- (
28
- {
29
- required,
30
- size,
31
- fill,
32
- leftElement,
33
- rightElement,
34
- onChange,
35
- onValueChange,
36
- readOnly,
37
- className,
38
- value,
39
- placeholder,
40
- disabled,
41
- mask,
42
- maskChar,
43
- inputRef: clientInputRef,
44
- ...containerProps
45
- },
46
- ref
47
- ) => {
48
- const inputRef = useRef<HTMLInputElement>(null)
49
-
50
- const rightRef = useRef<HTMLSpanElement>(null)
51
- const leftRef = useRef<HTMLSpanElement>(null)
52
-
53
- const elements = { Right: rightRef, Left: leftRef }
54
-
55
- const updateInputWidth = useCallback((side: 'Left' | 'Right') => {
56
- if (inputRef.current) {
57
- const input = inputRef.current.style
58
- const element = elements[side]
59
-
60
- if (element.current && element.current.clientWidth) {
61
- if (input[`padding${side}`] !== `${element.current.clientWidth}px`) {
62
- input[`padding${side}`] = `${element.current.clientWidth}px`
63
- }
64
- } else {
65
- if (input[`padding${side}`]) {
66
- input[`padding${side}`] = ''
67
- }
68
- }
69
- }
70
- }, [])
71
-
72
- useLayoutAndUpdate(() => {
73
- updateInputWidth('Left')
74
- updateInputWidth('Right')
75
- }, [rightElement, leftElement])
76
-
77
- const handleInputChange = useCallback((event: React.ChangeEvent<HTMLInputElement>) => {
78
- onChange?.(event)
79
- onValueChange?.(event.target.value, event.target)
80
- }, [])
81
-
82
- return (
83
- <div
84
- ref={ref}
85
- className={cn('form', className)}
86
- data-size={size ?? 'md'}
87
- data-fill={attr(fill)}
88
- data-required={attr(required)}
89
- data-disabled={attr(disabled)}
90
- {...containerProps}
91
- >
92
- {leftElement && (
93
- <span ref={leftRef} className="form-input-base-left-element">
94
- {leftElement}
95
- </span>
96
- )}
97
- <Input
98
- type="text"
99
- ref={mergeRefs([inputRef, clientInputRef])}
100
- className="form-input form-input-base"
101
- aria-disabled={disabled}
102
- onChange={handleInputChange}
103
- value={value}
104
- placeholder={placeholder}
105
- disabled={disabled}
106
- readOnly={readOnly}
107
- maskChar={maskChar}
108
- mask={mask}
109
- />
110
- {rightElement && (
111
- <span ref={rightRef} className="form-input-base-right-element">
112
- {rightElement}
113
- </span>
114
- )}
115
- </div>
116
- )
117
- }
118
- )
119
-
120
- interface InputProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'children'> {
121
- mask?: string
122
- maskChar?: string
123
- }
124
-
125
- const Input = forwardRef<HTMLInputElement, InputProps>(({ mask, maskChar, ...inputProps }, ref) => {
126
- if (mask) {
127
- return <InputMask inputRef={ref} mask={mask} maskChar={maskChar} {...inputProps} />
128
- }
129
-
130
- return <input ref={ref} {...inputProps} />
131
- })
@@ -1,18 +0,0 @@
1
- @use '../mixins.scss';
2
-
3
- $icon-sizes: xxxs, xxs, xs, s, m, l, xl, xxl, xxxl;
4
-
5
- @each $size in $icon-sizes {
6
- .icon-size-#{$size} {
7
- @include mixins.use-size(icon, size, $size);
8
- }
9
- }
10
-
11
- :where(svg:not([fill])) {
12
- fill: currentcolor;
13
- }
14
-
15
- .icon {
16
- // display: inline-block;
17
- flex-shrink: 0;
18
- }
@@ -1,43 +0,0 @@
1
- import classNames from 'classnames'
2
- import { IconDefinition } from '@fortawesome/free-solid-svg-icons'
3
- import { forwardRef } from 'react'
4
-
5
- export interface IconProps {
6
- icon: IconDefinition
7
- size?: 'xxxs' | 'xxs' | 'xs' | 's' | 'm' | 'l' | 'xl' | 'xxl' | 'xxxl'
8
- className?: string
9
- }
10
-
11
- export const Icon = forwardRef<SVGSVGElement, IconProps>(
12
- ({ icon, className, size = 'm', ...restProps }, ref) => {
13
- const [width, height, , , svgPathData] = icon.icon
14
-
15
- return (
16
- <svg
17
- ref={ref}
18
- data-prefix={icon.prefix}
19
- data-icon={icon.iconName}
20
- viewBox={`0 0 ${width} ${height}`}
21
- className={classNames(`icon icon-size-${size}`, className)}
22
- {...restProps}
23
- role="img"
24
- >
25
- <Paths paths={svgPathData} />
26
- </svg>
27
- )
28
- }
29
- )
30
-
31
- const Paths = ({ paths }: { paths: string[] | string }) => {
32
- if (Array.isArray(paths)) {
33
- return (
34
- <g>
35
- {paths.map((d, i) => (
36
- <path key={`-d-${i}`} fill="currentColor" d={d} />
37
- ))}
38
- </g>
39
- )
40
- }
41
-
42
- return <path fill="currentColor" d={paths} />
43
- }
@@ -1,17 +0,0 @@
1
- import { Button, ButtonProps } from '../Button'
2
- import { UseLoadingProps, useLoading } from '../__hooks/use-loading'
3
-
4
- export interface LoadButtonProps extends UseLoadingProps, Omit<ButtonProps, 'onClick'> {}
5
-
6
- export const LoadButton = ({ onClick, appearance = 'primary', ...rest }: LoadButtonProps) => {
7
- const { isLoading, isError, handleClick } = useLoading({ onClick })
8
-
9
- return (
10
- <Button
11
- appearance={isError ? 'negative' : appearance}
12
- {...rest}
13
- loading={isLoading}
14
- onClick={handleClick}
15
- />
16
- )
17
- }
@@ -1,74 +0,0 @@
1
- import { useRef, useState } from 'react'
2
- import { Form, FormProps } from '../Form'
3
-
4
- export interface NumberInputProps extends Omit<FormProps, 'value' | 'onChange'> {
5
- value: number | null
6
- onChange: (value: number | null) => void
7
- }
8
-
9
- export const NumberInput = ({ value, onChange, ...props }: NumberInputProps) => {
10
- const [, rerender] = useState([])
11
- const input = useRef<string>(getInputValue(value))
12
-
13
- if (+input.current !== value) {
14
- input.current = getInputValue(value)
15
- }
16
-
17
- return (
18
- <Form
19
- {...props}
20
- value={input.current}
21
- onChange={(e) => {
22
- const source = (e.currentTarget.value as string).trim()
23
-
24
- if (source === '') {
25
- input.current = ''
26
- return onChange(null)
27
- }
28
-
29
- if (source.startsWith('.')) {
30
- return
31
- }
32
-
33
- const numbersigns = source.replace('.', '').split('')
34
-
35
- if (numbersigns.some((symbol) => isNaN(parseInt(symbol)))) {
36
- return
37
- }
38
-
39
- input.current = clean(source.split(''))
40
-
41
- if (+input.current === value) {
42
- return rerender([])
43
- }
44
-
45
- onChange(+input.current)
46
- }}
47
- />
48
- )
49
- }
50
-
51
- const getInputValue = (value: number | null) => {
52
- return value === null ? '' : value.toString()
53
- }
54
-
55
- const clean = (signs: string[]) => {
56
- const result = [...signs]
57
- const source = [...signs]
58
-
59
- if (source.every((value) => value === '0')) {
60
- return '0'
61
- }
62
-
63
- for (let i = 0; i < source.length; i++) {
64
- if (source[i] !== '0') {
65
- break
66
- }
67
-
68
- if (source[i] === '0' && source[i + 1] !== '.') {
69
- result.shift()
70
- }
71
- }
72
-
73
- return result.join('')
74
- }
@@ -1,89 +0,0 @@
1
- @use '../mixins.scss';
2
-
3
- .option-list {
4
- display: flex;
5
- flex-direction: column;
6
-
7
- @include mixins.use-styles(option, list);
8
- }
9
-
10
- .option {
11
- display: flex;
12
- align-items: center;
13
-
14
- @include mixins.use-styles(option);
15
-
16
- &-icon {
17
- @include mixins.use-styles(option, icon);
18
-
19
- svg {
20
- @include mixins.use-size(option, icon, size);
21
- }
22
- }
23
-
24
- &-content {
25
- display: flex;
26
- flex-direction: column;
27
- flex-grow: 1;
28
- min-width: 0;
29
- max-width: 100%;
30
-
31
- &-inner {
32
- @include mixins.use-styles(option, content, layout);
33
- }
34
- }
35
-
36
- &-title {
37
- word-break: break-word;
38
- }
39
-
40
- &-label {
41
- @include mixins.use-styles(option, label);
42
- }
43
-
44
- &-check {
45
- @include mixins.use-styles(option, check);
46
-
47
- svg {
48
- @include mixins.use-size(option, check, size);
49
- }
50
- }
51
-
52
- & > * {
53
- margin-right: 8px;
54
- }
55
-
56
- & > :last-child {
57
- margin-right: 0;
58
- }
59
-
60
- &:not([data-disabled]) {
61
- cursor: pointer;
62
-
63
- &:hover {
64
- @include mixins.use-styles(option, hover);
65
- }
66
-
67
- &:active {
68
- @include mixins.use-styles(option, active);
69
- }
70
- }
71
-
72
- &[data-selected] {
73
- @include mixins.use-styles(option, selected);
74
- }
75
-
76
- &[data-disabled] {
77
- user-select: none;
78
-
79
- @include mixins.use-styles(option, disabled);
80
- }
81
-
82
- &[data-minimal] {
83
- @include mixins.use-styles(option, minimal);
84
-
85
- &[data-selected] {
86
- @include mixins.use-styles(option, minimal, selected);
87
- }
88
- }
89
- }
@@ -1,49 +0,0 @@
1
- import cn from 'classnames'
2
-
3
- import { Icon } from '../Icon'
4
- import { attr } from '@companix/utils-browser'
5
- import { forwardRef } from 'react'
6
- import { faCheck } from '@fortawesome/free-solid-svg-icons'
7
- import { Option } from '../types'
8
-
9
- interface OptionProps
10
- extends Omit<React.HTMLAttributes<HTMLDivElement>, 'title'>,
11
- Omit<Option<unknown>, 'value'> {
12
- active?: boolean
13
- minimal?: boolean
14
- }
15
-
16
- export const OptionItem = forwardRef<HTMLDivElement, OptionProps>(
17
- ({ title, icon, active, label, disabled, minimal, onClick, className, ...rest }, ref) => {
18
- const handleClick = (event: React.MouseEvent<HTMLDivElement>) => {
19
- if (!disabled) {
20
- onClick?.(event)
21
- }
22
- }
23
-
24
- return (
25
- <div
26
- ref={ref}
27
- {...rest}
28
- className={cn('option', className)}
29
- data-selected={attr(active)}
30
- data-disabled={attr(disabled)}
31
- data-minimal={attr(minimal)}
32
- onClick={handleClick}
33
- >
34
- <div className="option-content">
35
- {icon && <div className="option-icon">{icon}</div>}
36
- <div className="option-content-layout">
37
- <div className="option-title">{title}</div>
38
- {label && <div className="option-label">{label}</div>}
39
- </div>
40
- </div>
41
- {active && !minimal && (
42
- <div className="option-check">
43
- <Icon icon={faCheck} />
44
- </div>
45
- )}
46
- </div>
47
- )
48
- }
49
- )
@@ -1,26 +0,0 @@
1
- import { Scrollable } from '../Scrollable'
2
-
3
- interface MenuProps {
4
- children: React.ReactNode
5
- maxHeight?: number
6
- scrollboxRef?: React.Ref<HTMLDivElement>
7
- optionsWrapperRef?: React.Ref<HTMLDivElement>
8
- }
9
-
10
- export const OptionsList = ({ children, maxHeight, scrollboxRef, optionsWrapperRef }: MenuProps) => {
11
- return (
12
- <Scrollable
13
- ref={scrollboxRef}
14
- implementation="inner"
15
- padding={10}
16
- thumbPadding={3}
17
- thumbColor="#0000002b"
18
- maxHeight={maxHeight}
19
- scrollY
20
- >
21
- <div className="option-list" ref={optionsWrapperRef}>
22
- {children}
23
- </div>
24
- </Scrollable>
25
- )
26
- }
@@ -1,80 +0,0 @@
1
- @use '../mixins.scss';
2
-
3
- .popover {
4
- outline: none;
5
- @include mixins.use-styles(popover);
6
-
7
- &[data-match-target='width'] {
8
- width: var(--radix-popover-trigger-width);
9
- }
10
-
11
- &[data-match-target='min-width'] {
12
- min-width: var(--radix-popover-trigger-width);
13
- }
14
-
15
- &-content {
16
- position: relative;
17
- display: flex;
18
- flex-direction: column;
19
-
20
- &[data-fit-max-height] {
21
- max-height: var(--radix-popover-content-available-height);
22
- }
23
-
24
- @include mixins.use-styles(popover, content);
25
- }
26
-
27
- &-arrow {
28
- position: relative;
29
-
30
- &-icon {
31
- position: relative;
32
- }
33
-
34
- &-border {
35
- fill: #111418;
36
- fill-opacity: 0.1;
37
- }
38
-
39
- &-fill {
40
- fill: mixins.get-var-name(popover, content, background);
41
- }
42
-
43
- &:before {
44
- border-radius: 1px;
45
- content: '';
46
- display: block;
47
- position: absolute;
48
- transform: rotate(45deg);
49
- height: 20px;
50
- margin: 5px;
51
- width: 20px;
52
- box-shadow: 1px 1px 6px rgba(17, 20, 24, 0.2);
53
- margin-top: -14px;
54
- }
55
- }
56
-
57
- &[data-appearance='default'] {
58
- &[data-state='open'] {
59
- transform-origin: var(--radix-popover-content-transform-origin);
60
- @include mixins.use-styles(popover, default, in);
61
- }
62
-
63
- &[data-state='closed'] {
64
- transform-origin: var(--radix-popover-content-transform-origin);
65
- @include mixins.use-styles(popover, default, out);
66
- }
67
- }
68
-
69
- &[data-appearance='minimal'] {
70
- &[data-state='open'] {
71
- transform-origin: var(--radix-popover-content-transform-origin);
72
- @include mixins.use-styles(popover, minimal, in);
73
- }
74
-
75
- &[data-state='closed'] {
76
- transform-origin: var(--radix-popover-content-transform-origin);
77
- @include mixins.use-styles(popover, minimal, out);
78
- }
79
- }
80
- }