@velumweb/ui-kit 1.0.1 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/Button/Button.d.ts +32 -32
- package/dist/components/Button/Button.stories.d.ts +15 -15
- package/dist/components/Button/index.d.ts +1 -1
- package/dist/components/Container/Box.d.ts +33 -33
- package/dist/components/Container/index.d.ts +1 -1
- package/dist/components/Input/Input.d.ts +38 -38
- package/dist/components/Input/Input.stories.d.ts +14 -14
- package/dist/components/Input/index.d.ts +1 -1
- package/dist/components/Modal/Modal.d.ts +29 -29
- package/dist/components/Modal/Modal.stories.d.ts +13 -13
- package/dist/components/Modal/index.d.ts +1 -1
- package/dist/components/Toggle/Toggle.d.ts +18 -18
- package/dist/components/Toggle/Toggle.stories.d.ts +13 -13
- package/dist/components/Toggle/index.d.ts +1 -1
- package/dist/components/index.d.ts +6 -5
- package/dist/index.d.ts +2 -2
- package/dist/index.es.js +583 -569
- package/dist/index.es2.js +1 -1
- package/dist/theme.d.ts +2 -0
- package/dist/ui-kit.css +1 -1
- package/package.json +8 -3
- package/readme.md +19 -2
- package/.storybook/main.ts +0 -14
- package/.storybook/manager.ts +0 -32
- package/.storybook/preview.ts +0 -14
- package/CNAME +0 -1
- package/docs/CNAME +0 -1
- package/docs/assets/Button-CfaZpHIg.css +0 -1
- package/docs/assets/Button-DBH2W8EG.js +0 -1
- package/docs/assets/Button.stories-uPwy2cWr.js +0 -34
- package/docs/assets/Input-RjFZkyU_.css +0 -1
- package/docs/assets/Input.stories-BWPjJb-G.js +0 -21
- package/docs/assets/Modal-CWKTs3Ep.css +0 -1
- package/docs/assets/Modal.stories-eOcMgB-u.js +0 -7
- package/docs/assets/Toggle-BmcBtVup.css +0 -1
- package/docs/assets/Toggle.stories-MYi2irTa.js +0 -9
- package/docs/assets/iframe-CssGlRqL.js +0 -1062
- package/docs/assets/jsx-runtime-u17CrQMm.js +0 -1
- package/docs/assets/preload-helper-PPVm8Dsz.js +0 -1
- package/docs/assets/react-18-BQzlCVST.js +0 -9
- package/docs/assets/svg-lib/3-dots-horizontal-svgrepo-com.svg +0 -5
- package/docs/assets/svg-lib/about-empty-page-svgrepo-com.svg +0 -5
- package/docs/assets/svg-lib/alert-square.svg +0 -26
- package/docs/assets/svg-lib/arrow-bottom-svgrepo-com.svg +0 -9
- package/docs/assets/svg-lib/arrow-left-svgrepo-com.svg +0 -5
- package/docs/assets/svg-lib/arrow-right-svgrepo-com.svg +0 -5
- package/docs/assets/svg-lib/arrow-top-svgrepo-com.svg +0 -9
- package/docs/assets/svg-lib/checkmark-svgrepo-com.svg +0 -5
- package/docs/assets/svg-lib/clock-svgrepo-com.svg +0 -5
- package/docs/assets/svg-lib/cross-svgrepo-com.svg +0 -12
- package/docs/assets/svg-lib/download-svgrepo-com.svg +0 -5
- package/docs/assets/svg-lib/edit-pen-svgrepo-com.svg +0 -5
- package/docs/assets/svg-lib/favorite-svgrepo-com.svg +0 -5
- package/docs/assets/svg-lib/forbiden-svgrepo-com.svg +0 -9
- package/docs/assets/svg-lib/input-svgrepo-com.svg +0 -5
- package/docs/assets/svg-lib/link-svgrepo-com.svg +0 -5
- package/docs/assets/svg-lib/messages-alert-svgrepo-com.svg +0 -6
- package/docs/assets/svg-lib/messages-svgrepo-com.svg +0 -5
- package/docs/assets/svg-lib/mic-off-svgrepo-com.svg +0 -6
- package/docs/assets/svg-lib/mic-svgrepo-com.svg +0 -5
- package/docs/assets/svg-lib/music-svgrepo-com.svg +0 -6
- package/docs/assets/svg-lib/next-long-arrow-right-svgrepo-com.svg +0 -5
- package/docs/assets/svg-lib/notification-alert-svgrepo-com.svg +0 -6
- package/docs/assets/svg-lib/notification-svgrepo-com.svg +0 -5
- package/docs/assets/svg-lib/notifications-off-svgrepo-com.svg +0 -6
- package/docs/assets/svg-lib/party-simple-colored-svgrepo-com.svg +0 -11
- package/docs/assets/svg-lib/pattern-circles-svgrepo-com.svg +0 -5
- package/docs/assets/svg-lib/play-button-simple-svgrepo-com.svg +0 -5
- package/docs/assets/svg-lib/plus-outlined-svgrepo-com.svg +0 -5
- package/docs/assets/svg-lib/previous-long-arrow-left-svgrepo-com.svg +0 -5
- package/docs/assets/svg-lib/queue-listing-cards-svgrepo-com.svg +0 -6
- package/docs/assets/svg-lib/queue-remove-svgrepo-com.svg +0 -5
- package/docs/assets/svg-lib/recent-svgrepo-com.svg +0 -5
- package/docs/assets/svg-lib/remove-svgrepo-com.svg +0 -5
- package/docs/assets/svg-lib/repeat-svgrepo-com.svg +0 -5
- package/docs/assets/svg-lib/schedule-add-svgrepo-com.svg +0 -5
- package/docs/assets/svg-lib/schedule-alert-svgrepo-com.svg +0 -6
- package/docs/assets/svg-lib/schedule-remove-svgrepo-com.svg +0 -6
- package/docs/assets/svg-lib/schedule-svgrepo-com.svg +0 -5
- package/docs/assets/svg-lib/search-svgrepo-com.svg +0 -5
- package/docs/assets/svg-lib/session-abandon-svgrepo-com.svg +0 -5
- package/docs/assets/svg-lib/session-join-svgrepo-com.svg +0 -5
- package/docs/assets/svg-lib/session-leave-svgrepo-com.svg +0 -5
- package/docs/assets/svg-lib/settings-svgrepo-com.svg +0 -5
- package/docs/assets/svg-lib/share-svgrepo-com.svg +0 -5
- package/docs/assets/svg-lib/sound-off-svgrepo-com.svg +0 -6
- package/docs/assets/svg-lib/sound-svgrepo-com.svg +0 -5
- package/docs/assets/svg-lib/spectacles-svgrepo-com.svg +0 -5
- package/docs/assets/svg-lib/star-svgrepo-com.svg +0 -5
- package/docs/assets/svg-lib/user-avatar-with-alert-svgrepo-com.svg +0 -6
- package/docs/assets/svg-lib/user-banned-svgrepo-com.svg +0 -6
- package/docs/assets/svg-lib/user-svgrepo-com.svg +0 -5
- package/docs/assets/svglist.png +0 -0
- package/docs/components/Button/Button.d.ts +0 -32
- package/docs/components/Button/Button.stories.d.ts +0 -15
- package/docs/components/Button/index.d.ts +0 -1
- package/docs/components/Container/Box.d.ts +0 -33
- package/docs/components/Container/index.d.ts +0 -1
- package/docs/components/Input/Input.d.ts +0 -38
- package/docs/components/Input/Input.stories.d.ts +0 -14
- package/docs/components/Input/index.d.ts +0 -1
- package/docs/components/Modal/Modal.d.ts +0 -29
- package/docs/components/Modal/Modal.stories.d.ts +0 -13
- package/docs/components/Modal/index.d.ts +0 -1
- package/docs/components/Toggle/Toggle.d.ts +0 -18
- package/docs/components/Toggle/Toggle.stories.d.ts +0 -13
- package/docs/components/Toggle/index.d.ts +0 -1
- package/docs/components/index.d.ts +0 -5
- package/docs/favicon-wrapper.svg +0 -46
- package/docs/favicon.svg +0 -1
- package/docs/iframe.html +0 -686
- package/docs/index.d.ts +0 -1
- package/docs/index.html +0 -137
- package/docs/index.json +0 -1
- package/docs/makeColors.ts +0 -37
- package/docs/notes.txt +0 -11
- package/docs/nunito-sans-bold-italic.woff2 +0 -0
- package/docs/nunito-sans-bold.woff2 +0 -0
- package/docs/nunito-sans-italic.woff2 +0 -0
- package/docs/nunito-sans-regular.woff2 +0 -0
- package/docs/project.json +0 -1
- package/docs/sb-addons/storybook-1/manager-bundle.js +0 -3
- package/docs/sb-addons/storybook-core-server-presets-0/common-manager-bundle.js +0 -628
- package/docs/sb-common-assets/favicon-wrapper.svg +0 -46
- package/docs/sb-common-assets/favicon.svg +0 -1
- package/docs/sb-common-assets/nunito-sans-bold-italic.woff2 +0 -0
- package/docs/sb-common-assets/nunito-sans-bold.woff2 +0 -0
- package/docs/sb-common-assets/nunito-sans-italic.woff2 +0 -0
- package/docs/sb-common-assets/nunito-sans-regular.woff2 +0 -0
- package/docs/sb-manager/globals-runtime.js +0 -75597
- package/docs/sb-manager/globals.js +0 -24
- package/docs/sb-manager/manager-stores.js +0 -23
- package/docs/sb-manager/runtime.js +0 -19698
- package/docs/style_setter.js +0 -19
- package/docs/vite-inject-mocker-entry.js +0 -2
- package/index.html +0 -7
- package/public/assets/svg-lib/3-dots-horizontal-svgrepo-com.svg +0 -5
- package/public/assets/svg-lib/about-empty-page-svgrepo-com.svg +0 -5
- package/public/assets/svg-lib/alert-square.svg +0 -26
- package/public/assets/svg-lib/arrow-bottom-svgrepo-com.svg +0 -9
- package/public/assets/svg-lib/arrow-left-svgrepo-com.svg +0 -5
- package/public/assets/svg-lib/arrow-right-svgrepo-com.svg +0 -5
- package/public/assets/svg-lib/arrow-top-svgrepo-com.svg +0 -9
- package/public/assets/svg-lib/checkmark-svgrepo-com.svg +0 -5
- package/public/assets/svg-lib/clock-svgrepo-com.svg +0 -5
- package/public/assets/svg-lib/cross-svgrepo-com.svg +0 -12
- package/public/assets/svg-lib/download-svgrepo-com.svg +0 -5
- package/public/assets/svg-lib/edit-pen-svgrepo-com.svg +0 -5
- package/public/assets/svg-lib/favorite-svgrepo-com.svg +0 -5
- package/public/assets/svg-lib/forbiden-svgrepo-com.svg +0 -9
- package/public/assets/svg-lib/input-svgrepo-com.svg +0 -5
- package/public/assets/svg-lib/link-svgrepo-com.svg +0 -5
- package/public/assets/svg-lib/messages-alert-svgrepo-com.svg +0 -6
- package/public/assets/svg-lib/messages-svgrepo-com.svg +0 -5
- package/public/assets/svg-lib/mic-off-svgrepo-com.svg +0 -6
- package/public/assets/svg-lib/mic-svgrepo-com.svg +0 -5
- package/public/assets/svg-lib/music-svgrepo-com.svg +0 -6
- package/public/assets/svg-lib/next-long-arrow-right-svgrepo-com.svg +0 -5
- package/public/assets/svg-lib/notification-alert-svgrepo-com.svg +0 -6
- package/public/assets/svg-lib/notification-svgrepo-com.svg +0 -5
- package/public/assets/svg-lib/notifications-off-svgrepo-com.svg +0 -6
- package/public/assets/svg-lib/party-simple-colored-svgrepo-com.svg +0 -11
- package/public/assets/svg-lib/pattern-circles-svgrepo-com.svg +0 -5
- package/public/assets/svg-lib/play-button-simple-svgrepo-com.svg +0 -5
- package/public/assets/svg-lib/plus-outlined-svgrepo-com.svg +0 -5
- package/public/assets/svg-lib/previous-long-arrow-left-svgrepo-com.svg +0 -5
- package/public/assets/svg-lib/queue-listing-cards-svgrepo-com.svg +0 -6
- package/public/assets/svg-lib/queue-remove-svgrepo-com.svg +0 -5
- package/public/assets/svg-lib/recent-svgrepo-com.svg +0 -5
- package/public/assets/svg-lib/remove-svgrepo-com.svg +0 -5
- package/public/assets/svg-lib/repeat-svgrepo-com.svg +0 -5
- package/public/assets/svg-lib/schedule-add-svgrepo-com.svg +0 -5
- package/public/assets/svg-lib/schedule-alert-svgrepo-com.svg +0 -6
- package/public/assets/svg-lib/schedule-remove-svgrepo-com.svg +0 -6
- package/public/assets/svg-lib/schedule-svgrepo-com.svg +0 -5
- package/public/assets/svg-lib/search-svgrepo-com.svg +0 -5
- package/public/assets/svg-lib/session-abandon-svgrepo-com.svg +0 -5
- package/public/assets/svg-lib/session-join-svgrepo-com.svg +0 -5
- package/public/assets/svg-lib/session-leave-svgrepo-com.svg +0 -5
- package/public/assets/svg-lib/settings-svgrepo-com.svg +0 -5
- package/public/assets/svg-lib/share-svgrepo-com.svg +0 -5
- package/public/assets/svg-lib/sound-off-svgrepo-com.svg +0 -6
- package/public/assets/svg-lib/sound-svgrepo-com.svg +0 -5
- package/public/assets/svg-lib/spectacles-svgrepo-com.svg +0 -5
- package/public/assets/svg-lib/star-svgrepo-com.svg +0 -5
- package/public/assets/svg-lib/user-avatar-with-alert-svgrepo-com.svg +0 -6
- package/public/assets/svg-lib/user-banned-svgrepo-com.svg +0 -6
- package/public/assets/svg-lib/user-svgrepo-com.svg +0 -5
- package/public/assets/svglist.png +0 -0
- package/src/components/Button/Button.stories.ts +0 -64
- package/src/components/Button/Button.tsx +0 -99
- package/src/components/Button/button.scss +0 -147
- package/src/components/Button/index.ts +0 -1
- package/src/components/Container/Box.tsx +0 -83
- package/src/components/Container/box.scss +0 -41
- package/src/components/Container/index.ts +0 -1
- package/src/components/Input/Input.stories.ts +0 -49
- package/src/components/Input/Input.tsx +0 -172
- package/src/components/Input/index.ts +0 -1
- package/src/components/Input/input.scss +0 -69
- package/src/components/Modal/Modal.stories.ts +0 -33
- package/src/components/Modal/Modal.tsx +0 -125
- package/src/components/Modal/index.ts +0 -1
- package/src/components/Modal/modal.scss +0 -54
- package/src/components/Toggle/Toggle.stories.ts +0 -35
- package/src/components/Toggle/Toggle.tsx +0 -60
- package/src/components/Toggle/index.ts +0 -1
- package/src/components/Toggle/toggle.scss +0 -97
- package/src/components/index.ts +0 -5
- package/src/main.scss +0 -46
- package/src/style.ts +0 -1
- package/tsconfig.json +0 -15
- package/utils/makeColors.ts +0 -37
- package/utils/notes.txt +0 -11
- package/utils/style_setter.js +0 -19
- package/vite.config.ts +0 -42
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="utf-8"?><!-- Uploaded to: SVG Repo, www.svgrepo.com, Generator: SVG Repo Mixer Tools -->
|
|
2
|
-
<svg width="800px" height="800px" viewBox="0 0 24 24" id="_24x24_On_Light_User-Alert" data-name="24x24/On Light/User-Alert" xmlns="http://www.w3.org/2000/svg">
|
|
3
|
-
<rect id="view-box" width="24" height="24" fill="none"/>
|
|
4
|
-
<path id="Shape" d="M9.75,19.5A9.75,9.75,0,1,1,11.68.192,5.479,5.479,0,0,0,11,1.6,8.254,8.254,0,0,0,1.5,9.75a8.163,8.163,0,0,0,1.713,5.027A5.594,5.594,0,0,1,5.135,13.7c.141-.052.288-.1.475-.167l.443-.149c.855-.293,1.169-.481,1.244-.747l0-.009.005-.024a.771.771,0,0,0-.058-.519.907.907,0,0,0-.237-.271A4.359,4.359,0,0,1,5.5,8.417,4.29,4.29,0,0,1,9.75,4a4.1,4.1,0,0,1,1.072.143,5.505,5.505,0,0,0,.937,2.28A2.7,2.7,0,0,0,9.75,5.5,2.807,2.807,0,0,0,7,8.417a2.848,2.848,0,0,0,1,2.274,2.28,2.28,0,0,1,.571.695,2.208,2.208,0,0,1,.2,1.537,1.41,1.41,0,0,1-.045.171c-.244.9-.9,1.271-2.188,1.711l-.445.15c-.166.056-.3.1-.437.154a4.286,4.286,0,0,0-1.419.77,8.234,8.234,0,0,0,11.03,0,4.3,4.3,0,0,0-1.421-.751c-.112-.041-.229-.081-.377-.13l-.386-.13c-1.332-.45-2.015-.825-2.293-1.742a1.863,1.863,0,0,1-.055-.223,2.36,2.36,0,0,1,.138-1.4,2.122,2.122,0,0,1,.589-.795,2.815,2.815,0,0,0,1.042-2.3,3.018,3.018,0,0,0-.489-1.666A5.557,5.557,0,0,0,14,8.268q0,.074,0,.149a4.3,4.3,0,0,1-1.559,3.427.673.673,0,0,0-.194.255.92.92,0,0,0-.043.527c.006.031.01.046.013.055.08.26.431.461,1.342.769l.384.129c.147.05.279.095.408.141a5.6,5.6,0,0,1,1.935,1.058A8.169,8.169,0,0,0,18,9.75,8.308,8.308,0,0,0,17.9,8.5a5.478,5.478,0,0,0,1.4-.676A9.755,9.755,0,0,1,9.75,19.5ZM17.362,6.569h0a8.342,8.342,0,0,0-4.431-4.43,3.527,3.527,0,0,1,.782-1.3,9.774,9.774,0,0,1,4.946,4.945,3.525,3.525,0,0,1-1.3.781Z" transform="translate(2.25 2.25)" fill="#141124"/>
|
|
5
|
-
<path id="Shape-2" data-name="Shape" d="M3.5,7A3.5,3.5,0,1,1,7,3.5,3.5,3.5,0,0,1,3.5,7Z" transform="translate(15 2)" fill="#ff6359"/>
|
|
6
|
-
</svg>
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="utf-8"?><!-- Uploaded to: SVG Repo, www.svgrepo.com, Generator: SVG Repo Mixer Tools -->
|
|
2
|
-
<svg width="800px" height="800px" viewBox="0 0 24 24" id="_24x24_On_Light_User" data-name="24x24/On Light/User" xmlns="http://www.w3.org/2000/svg">
|
|
3
|
-
<rect id="view-box" width="24" height="24" fill="none"/>
|
|
4
|
-
<path id="Shape" d="M0,9.75A9.75,9.75,0,1,1,9.75,19.5,9.761,9.761,0,0,1,0,9.75ZM9.75,18a8.218,8.218,0,0,0,5.515-2.119,4.328,4.328,0,0,0-1.421-.75c-.112-.04-.229-.081-.377-.13l-.386-.13c-1.4-.471-2.023-.851-2.293-1.742a1.876,1.876,0,0,1-.055-.223,2.369,2.369,0,0,1,.138-1.4,2.123,2.123,0,0,1,.589-.795,2.823,2.823,0,0,0,1.042-2.3A2.832,2.832,0,0,0,9.75,5.5,2.8,2.8,0,0,0,7,8.417a2.843,2.843,0,0,0,1,2.274,2.278,2.278,0,0,1,.571.695,2.224,2.224,0,0,1,.2,1.537,1.152,1.152,0,0,1-.045.17c-.237.877-.847,1.254-2.188,1.712l-.445.15c-.173.059-.308.106-.437.154a4.312,4.312,0,0,0-1.419.771A8.216,8.216,0,0,0,9.75,18ZM14,8.417a4.32,4.32,0,0,1-1.559,3.427.672.672,0,0,0-.193.255.928.928,0,0,0-.043.527c.006.031.01.046.013.055.077.253.408.454,1.342.769l.384.129c.157.053.284.1.408.141a5.645,5.645,0,0,1,1.935,1.058,8.25,8.25,0,1,0-13.074,0A5.672,5.672,0,0,1,5.135,13.7c.144-.053.291-.1.475-.167l.443-.149c.863-.3,1.17-.484,1.244-.747,0,.006,0-.005.007-.033a.769.769,0,0,0-.058-.519.9.9,0,0,0-.237-.271A4.346,4.346,0,0,1,5.5,8.417,4.3,4.3,0,0,1,9.75,4,4.332,4.332,0,0,1,14,8.417Z" transform="translate(2.25 2.25)" fill="#abadb7"/>
|
|
5
|
-
<path id="Shape-2" data-name="Shape" d="M2.626.657.006,21.551a.75.75,0,0,0,1.488.187L4.115.843A.75.75,0,0,0,2.626.657Z" transform="translate(2.458 5.527) rotate(-45)" fill="#141124"/>
|
|
6
|
-
</svg>
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="utf-8"?><!-- Uploaded to: SVG Repo, www.svgrepo.com, Generator: SVG Repo Mixer Tools -->
|
|
2
|
-
<svg width="800px" height="800px" viewBox="0 0 24 24" id="_24x24_On_Light_User" data-name="24x24/On Light/User" xmlns="http://www.w3.org/2000/svg">
|
|
3
|
-
<rect id="view-box" width="24" height="24" fill="none"/>
|
|
4
|
-
<path id="Shape" d="M0,9.75A9.75,9.75,0,1,1,9.75,19.5,9.761,9.761,0,0,1,0,9.75ZM9.75,18a8.218,8.218,0,0,0,5.515-2.119,4.328,4.328,0,0,0-1.421-.75c-.112-.04-.229-.081-.377-.13l-.386-.13c-1.4-.471-2.023-.851-2.293-1.742a1.876,1.876,0,0,1-.055-.223,2.369,2.369,0,0,1,.138-1.4,2.123,2.123,0,0,1,.589-.795,2.823,2.823,0,0,0,1.042-2.3A2.832,2.832,0,0,0,9.75,5.5,2.8,2.8,0,0,0,7,8.417a2.843,2.843,0,0,0,1,2.274,2.278,2.278,0,0,1,.571.695,2.224,2.224,0,0,1,.2,1.537,1.152,1.152,0,0,1-.045.17c-.237.877-.847,1.254-2.188,1.712l-.445.15c-.173.059-.308.106-.437.154a4.312,4.312,0,0,0-1.419.771A8.216,8.216,0,0,0,9.75,18ZM14,8.417a4.32,4.32,0,0,1-1.559,3.427.672.672,0,0,0-.193.255.928.928,0,0,0-.043.527c.006.031.01.046.013.055.077.253.408.454,1.342.769l.384.129c.157.053.284.1.408.141a5.645,5.645,0,0,1,1.935,1.058,8.25,8.25,0,1,0-13.074,0A5.672,5.672,0,0,1,5.135,13.7c.144-.053.291-.1.475-.167l.443-.149c.863-.3,1.17-.484,1.244-.747,0,.006,0-.005.007-.033a.769.769,0,0,0-.058-.519.9.9,0,0,0-.237-.271A4.346,4.346,0,0,1,5.5,8.417,4.3,4.3,0,0,1,9.75,4,4.332,4.332,0,0,1,14,8.417Z" transform="translate(2.25 2.25)" fill="#141124"/>
|
|
5
|
-
</svg>
|
|
Binary file
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import type { StoryObj } from '@storybook/react-vite';
|
|
2
|
-
import { Button } from './Button';
|
|
3
|
-
|
|
4
|
-
const meta = {
|
|
5
|
-
title: 'Example Button',
|
|
6
|
-
component: Button,
|
|
7
|
-
parameters: {
|
|
8
|
-
layout: 'centered'
|
|
9
|
-
},
|
|
10
|
-
tags: ['autodocs'],
|
|
11
|
-
decorators: [
|
|
12
|
-
(Story) => {
|
|
13
|
-
const script = document.createElement('script')
|
|
14
|
-
script.src = '/style_setter.js'
|
|
15
|
-
script.type = 'module'
|
|
16
|
-
document.head.appendChild(script)
|
|
17
|
-
|
|
18
|
-
return Story()
|
|
19
|
-
},
|
|
20
|
-
],
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export default meta;
|
|
24
|
-
type Story = StoryObj<typeof meta>;
|
|
25
|
-
|
|
26
|
-
export const CustomButton: Story = {
|
|
27
|
-
args: {
|
|
28
|
-
text: 'Button Example',
|
|
29
|
-
type: 'primary',
|
|
30
|
-
size: 'medium',
|
|
31
|
-
corners: 'standard',
|
|
32
|
-
disabled: false,
|
|
33
|
-
cls: '',
|
|
34
|
-
onClick: () => console.log('CustomButton')
|
|
35
|
-
},
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
export const IconButton: Story = {
|
|
39
|
-
args: {
|
|
40
|
-
text: 'Exit',
|
|
41
|
-
type: 'secondary',
|
|
42
|
-
size: 'medium',
|
|
43
|
-
corners: 'standard',
|
|
44
|
-
disabled: false,
|
|
45
|
-
cls: '',
|
|
46
|
-
onClick: () => console.log('IconButton'),
|
|
47
|
-
iconPath: 'svg-lib/alert-square.svg',
|
|
48
|
-
labelAlign: 'bottom'
|
|
49
|
-
},
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
export const Icon: Story = {
|
|
53
|
-
args: {
|
|
54
|
-
onClick: () => console.log('Icon'),
|
|
55
|
-
iconPath: 'svg-lib/checkmark-svgrepo-com.svg',
|
|
56
|
-
type: 'transparent',
|
|
57
|
-
size: 'large',
|
|
58
|
-
corners: 'round',
|
|
59
|
-
disabled: false,
|
|
60
|
-
cls: '',
|
|
61
|
-
staticIcon: true
|
|
62
|
-
},
|
|
63
|
-
};
|
|
64
|
-
|
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Box } from "../Container";
|
|
3
|
-
import './button.scss';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Компонент кнопки
|
|
7
|
-
* - разные состояния
|
|
8
|
-
* - разные типы
|
|
9
|
-
* - разные размеры
|
|
10
|
-
* - разные углы
|
|
11
|
-
* - добавление иконки
|
|
12
|
-
*/
|
|
13
|
-
|
|
14
|
-
export interface ButtonProps {
|
|
15
|
-
/** Основная / Только текст / Вспомогательная */
|
|
16
|
-
type: 'primary' | 'transparent' | 'secondary';
|
|
17
|
-
|
|
18
|
-
/** Маленькая / Средняя / Большая */
|
|
19
|
-
size?: 'small' | 'medium' | 'large';
|
|
20
|
-
|
|
21
|
-
/** Углы прямые / Закругленные / Круглые */
|
|
22
|
-
corners?: 'square' | 'standard' | 'round';
|
|
23
|
-
|
|
24
|
-
/** Доступность кнопки */
|
|
25
|
-
disabled?: boolean,
|
|
26
|
-
|
|
27
|
-
/** Текст кнопки */
|
|
28
|
-
text?: string;
|
|
29
|
-
|
|
30
|
-
/** Событие при нажатии */
|
|
31
|
-
onClick?: (e?: MouseEvent) => void;
|
|
32
|
-
|
|
33
|
-
/** Дополнительные классы */
|
|
34
|
-
cls?: string;
|
|
35
|
-
|
|
36
|
-
/** Путь до иконки из assets */
|
|
37
|
-
iconPath?: string;
|
|
38
|
-
|
|
39
|
-
/** Расположение текста относительно иконки */
|
|
40
|
-
labelAlign?: 'right' | 'left' | 'bottom' | 'top';
|
|
41
|
-
|
|
42
|
-
/** Это просто информационная иконка */
|
|
43
|
-
staticIcon?: boolean;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
/** Элемент кнопки */
|
|
47
|
-
export const Button = ({
|
|
48
|
-
type = 'primary',
|
|
49
|
-
size = 'medium',
|
|
50
|
-
corners = 'standard',
|
|
51
|
-
disabled = false,
|
|
52
|
-
staticIcon = false,
|
|
53
|
-
cls = '',
|
|
54
|
-
text = '',
|
|
55
|
-
iconPath = '',
|
|
56
|
-
labelAlign = '',
|
|
57
|
-
onClick,
|
|
58
|
-
...props
|
|
59
|
-
}: ButtonProps) => {
|
|
60
|
-
const isIconCls = iconPath != '' && text === '' ? 'kit-btn--icon' : '';
|
|
61
|
-
|
|
62
|
-
let Content;
|
|
63
|
-
const IconContainer = () => (iconPath ? <div
|
|
64
|
-
className='kit-btn--svg'
|
|
65
|
-
style={{
|
|
66
|
-
maskImage: `url(assets/${iconPath})`,
|
|
67
|
-
WebkitMaskImage: `url(assets/${iconPath})`
|
|
68
|
-
}}
|
|
69
|
-
/> : null);
|
|
70
|
-
|
|
71
|
-
/** текст + иконка */
|
|
72
|
-
switch(labelAlign) {
|
|
73
|
-
case 'right': Content = () => (<Box direction='row'><IconContainer />{text as string}</Box>); break;
|
|
74
|
-
case 'left': Content = () => (<Box direction='row'>{text as string}<IconContainer /></Box>); break;
|
|
75
|
-
case 'top': Content = () => (<Box direction='column'>{text as string}<IconContainer /></Box>); break;
|
|
76
|
-
case 'bottom': Content = () => (<Box direction='column'><IconContainer />{text as string}</Box>); break;
|
|
77
|
-
default: Content = () => (<Box direction='row'>{ isIconCls ? <IconContainer /> : text as string}</Box>); break;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
return (
|
|
81
|
-
<button
|
|
82
|
-
type="button"
|
|
83
|
-
onClick={disabled || !onClick ? null : onClick}
|
|
84
|
-
className={[
|
|
85
|
-
'kit-btn',
|
|
86
|
-
`kit-btn--${size}`,
|
|
87
|
-
`kit-btn--${corners}`,
|
|
88
|
-
`kit-btn--${type}`,
|
|
89
|
-
disabled ? 'kit-btn--disabled' : '',
|
|
90
|
-
staticIcon ? 'kit-icon' : '',
|
|
91
|
-
isIconCls,
|
|
92
|
-
cls
|
|
93
|
-
].join(' ')}
|
|
94
|
-
{...props}
|
|
95
|
-
>
|
|
96
|
-
<Content />
|
|
97
|
-
</button>
|
|
98
|
-
);
|
|
99
|
-
};
|
|
@@ -1,147 +0,0 @@
|
|
|
1
|
-
@import '../../main.scss';
|
|
2
|
-
|
|
3
|
-
.kit-btn {
|
|
4
|
-
display: inline-block;
|
|
5
|
-
cursor: pointer;
|
|
6
|
-
border: 0;
|
|
7
|
-
font-weight: 700;
|
|
8
|
-
line-height: 1;
|
|
9
|
-
font-family: var(--font-family);
|
|
10
|
-
transition: background-color 0.3s ease;
|
|
11
|
-
padding: 8px 16px;
|
|
12
|
-
& > .kit-box {
|
|
13
|
-
width: fit-content;
|
|
14
|
-
}
|
|
15
|
-
&:active {
|
|
16
|
-
transform: translateY(0.5px);
|
|
17
|
-
box-shadow: 0 0 5px rgba(0, 0, 0, 0.3) inset;
|
|
18
|
-
}
|
|
19
|
-
&.kit-icon {
|
|
20
|
-
pointer-events: none;
|
|
21
|
-
}
|
|
22
|
-
&.kit-btn--disabled {
|
|
23
|
-
opacity: 0.5;
|
|
24
|
-
pointer-events: none;
|
|
25
|
-
user-select: none;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
// type
|
|
30
|
-
.kit-btn--primary {
|
|
31
|
-
background-color: var(--primary-btn-color);
|
|
32
|
-
color: var(--secondary-btn-color);
|
|
33
|
-
& > div > .kit-btn--svg {
|
|
34
|
-
background-color: var(--secondary-btn-color);
|
|
35
|
-
}
|
|
36
|
-
&:hover {
|
|
37
|
-
background-color: var(--hover-btn-color);
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
.kit-btn--secondary {
|
|
41
|
-
border: 1px var(--primary-btn-color) solid;
|
|
42
|
-
background-color: transparent;
|
|
43
|
-
color: var(--primary-btn-color);
|
|
44
|
-
& > div > .kit-btn--svg {
|
|
45
|
-
background-color: var(--primary-btn-color);
|
|
46
|
-
}
|
|
47
|
-
&:hover {
|
|
48
|
-
background-color: var(--hover-btn-color);
|
|
49
|
-
color: var(--secondary-btn-color);
|
|
50
|
-
border: 1px var(--hover-btn-color) solid;
|
|
51
|
-
& > div > .kit-btn--svg {
|
|
52
|
-
background-color: var(--secondary-btn-color);
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
.kit-btn--transparent {
|
|
57
|
-
border: none;
|
|
58
|
-
background-color: transparent;
|
|
59
|
-
color: var(--primary-btn-color);
|
|
60
|
-
& > div > .kit-btn--svg {
|
|
61
|
-
background-color: var(--primary-btn-color);
|
|
62
|
-
}
|
|
63
|
-
&:hover {
|
|
64
|
-
color: var(--hover-btn-color);
|
|
65
|
-
& > div > .kit-btn--svg {
|
|
66
|
-
background-color: var(--hover-btn-color);
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
&:active {
|
|
70
|
-
box-shadow: unset;
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
// size
|
|
75
|
-
.kit-btn--small {
|
|
76
|
-
font-size: 12px;
|
|
77
|
-
& > div > .kit-btn--svg {
|
|
78
|
-
width: 20px;
|
|
79
|
-
height: 20px;
|
|
80
|
-
}
|
|
81
|
-
&:not(.kit-btn--icon) > .kit-container--h > .kit-btn--svg {
|
|
82
|
-
width: 16px;
|
|
83
|
-
height: 16px;
|
|
84
|
-
}
|
|
85
|
-
&:not(.kit-btn--icon) > .kit-container--v > .kit-btn--svg {
|
|
86
|
-
width: 24px;
|
|
87
|
-
height: 24px;
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
.kit-btn--medium {
|
|
91
|
-
font-size: 14px;
|
|
92
|
-
& > div > .kit-btn--svg {
|
|
93
|
-
width: 24px;
|
|
94
|
-
height: 24px;
|
|
95
|
-
}
|
|
96
|
-
&:not(.kit-btn--icon) > .kit-container--h > .kit-btn--svg {
|
|
97
|
-
width: 20px;
|
|
98
|
-
height: 20px;
|
|
99
|
-
}
|
|
100
|
-
&:not(.kit-btn--icon) > .kit-container--v > .kit-btn--svg {
|
|
101
|
-
width: 28px;
|
|
102
|
-
height: 28px;
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
.kit-btn--large {
|
|
106
|
-
font-size: 16px;
|
|
107
|
-
& > div > .kit-btn--svg {
|
|
108
|
-
width: 32px;
|
|
109
|
-
height: 32px;
|
|
110
|
-
}
|
|
111
|
-
&:not(.kit-btn--icon) > .kit-container--h > .kit-btn--svg {
|
|
112
|
-
width: 24px;
|
|
113
|
-
height: 24px;
|
|
114
|
-
}
|
|
115
|
-
&:not(.kit-btn--icon) > .kit-container--v > .kit-btn--svg {
|
|
116
|
-
width: 32px;
|
|
117
|
-
height: 32px;
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
// border-radius
|
|
122
|
-
.kit-btn--standard {
|
|
123
|
-
border-radius: var(--corners-standard);
|
|
124
|
-
}
|
|
125
|
-
.kit-btn--round {
|
|
126
|
-
border-radius: var(--corners-round);
|
|
127
|
-
}
|
|
128
|
-
.kit-btn--square {
|
|
129
|
-
border-radius: var(--corners-square);
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
// icons
|
|
133
|
-
.kit-btn--icon {
|
|
134
|
-
padding: 8px;
|
|
135
|
-
overflow: hidden;
|
|
136
|
-
white-space: nowrap;
|
|
137
|
-
text-overflow: ellipsis;
|
|
138
|
-
}
|
|
139
|
-
.kit-btn--svg {
|
|
140
|
-
background-repeat: no-repeat;
|
|
141
|
-
background-position: center;
|
|
142
|
-
background-size: contain;
|
|
143
|
-
mask-size: contain;
|
|
144
|
-
mask-repeat: no-repeat;
|
|
145
|
-
-webkit-mask-size: contain;
|
|
146
|
-
-webkit-mask-repeat: no-repeat;
|
|
147
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./Button";
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
import React, { ReactNode } from 'react';
|
|
2
|
-
import './box.scss';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Компоненты контейнеры
|
|
6
|
-
* - разные направления
|
|
7
|
-
* - семантические обертки
|
|
8
|
-
* - позиционирование
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
export interface BoxProps {
|
|
13
|
-
/** Направление строка или столбец */
|
|
14
|
-
direction?: 'row' | 'column';
|
|
15
|
-
|
|
16
|
-
/** Горизонтальное выравнивание **/
|
|
17
|
-
align?: 'top' | 'center' | 'bottom';
|
|
18
|
-
|
|
19
|
-
/** Горизонтальное распределение **/
|
|
20
|
-
justify?: 'start' | 'end' | 'center' | 'space';
|
|
21
|
-
|
|
22
|
-
/** Перенос блоков внутри контейнера **/
|
|
23
|
-
wrapContent?: boolean;
|
|
24
|
-
|
|
25
|
-
/** Дополнительные классы */
|
|
26
|
-
cls?: string;
|
|
27
|
-
|
|
28
|
-
/** Расстояние между дочерними элементами */
|
|
29
|
-
gap?: number;
|
|
30
|
-
|
|
31
|
-
/** Внешние отступы */
|
|
32
|
-
margin?: number[];
|
|
33
|
-
|
|
34
|
-
/** Внутренние отступы */
|
|
35
|
-
padding?: number[];
|
|
36
|
-
|
|
37
|
-
/** Родительский тег для семантики */
|
|
38
|
-
parent?: 'header' | 'footer' | 'article' | 'section' | 'main' | 'div';
|
|
39
|
-
|
|
40
|
-
/** Содержимое контейнера **/
|
|
41
|
-
children: ReactNode | string;
|
|
42
|
-
|
|
43
|
-
/** Маска загрузки **/
|
|
44
|
-
mask?: boolean
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
/** Элемент контейнера */
|
|
48
|
-
export const Box = ({
|
|
49
|
-
direction = 'row',
|
|
50
|
-
align = 'center',
|
|
51
|
-
justify = 'center',
|
|
52
|
-
wrapContent = false,
|
|
53
|
-
cls = '',
|
|
54
|
-
gap = 8,
|
|
55
|
-
margin = [0],
|
|
56
|
-
padding = [0],
|
|
57
|
-
parent = 'div',
|
|
58
|
-
mask = false, // TODO loader
|
|
59
|
-
children,
|
|
60
|
-
...props
|
|
61
|
-
}: BoxProps) => {
|
|
62
|
-
const Parent = parent;
|
|
63
|
-
const margins = margin?.map(m => m + 'px').join(' ');
|
|
64
|
-
const paddings = padding?.map(m => m + 'px').join(' ');
|
|
65
|
-
|
|
66
|
-
return(
|
|
67
|
-
<Parent
|
|
68
|
-
className={[
|
|
69
|
-
'kit-box',
|
|
70
|
-
`kit-box--${direction}`,
|
|
71
|
-
`kit-box--align-${align}`,
|
|
72
|
-
`kit-box--justify-${justify}`,
|
|
73
|
-
wrapContent && 'kit-box--wrap',
|
|
74
|
-
cls
|
|
75
|
-
].join(' ')}
|
|
76
|
-
style={{ gap: `${gap}px`, margin: `${margins}`, padding: `${paddings}` }}
|
|
77
|
-
{...props}
|
|
78
|
-
>
|
|
79
|
-
{children}
|
|
80
|
-
</Parent>
|
|
81
|
-
)
|
|
82
|
-
|
|
83
|
-
};
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
.kit-box {
|
|
2
|
-
margin: 0;
|
|
3
|
-
padding: 0;
|
|
4
|
-
display: flex;
|
|
5
|
-
width: 100%;
|
|
6
|
-
flex-wrap: nowrap;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
.kit-box--row {
|
|
10
|
-
flex-direction: row;
|
|
11
|
-
}
|
|
12
|
-
.kit-box--column {
|
|
13
|
-
flex-direction: column;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
.kit-box--align-top {
|
|
17
|
-
align-items: flex-start;
|
|
18
|
-
}
|
|
19
|
-
.kit-box--align-center {
|
|
20
|
-
align-items: center;
|
|
21
|
-
}
|
|
22
|
-
.kit-box--align-bottom {
|
|
23
|
-
align-items: flex-end;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
.kit-box--justify-start {
|
|
27
|
-
justify-content: flex-start;
|
|
28
|
-
}
|
|
29
|
-
.kit-box--justify-end {
|
|
30
|
-
justify-content: flex-end;
|
|
31
|
-
}
|
|
32
|
-
.kit-box--justify-center {
|
|
33
|
-
justify-content: center;
|
|
34
|
-
}
|
|
35
|
-
.kit-box--justify-space {
|
|
36
|
-
justify-content: space-between;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
.kit-box--wrap {
|
|
40
|
-
flex-wrap: wrap;
|
|
41
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./Box";
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import type { StoryObj } from '@storybook/react-vite';
|
|
2
|
-
import { Input } from './Input';
|
|
3
|
-
|
|
4
|
-
const meta = {
|
|
5
|
-
title: 'Example Input',
|
|
6
|
-
component: Input,
|
|
7
|
-
parameters: {
|
|
8
|
-
layout: 'centered'
|
|
9
|
-
},
|
|
10
|
-
tags: ['autodocs'],
|
|
11
|
-
decorators: [
|
|
12
|
-
(Story) => {
|
|
13
|
-
const script = document.createElement('script')
|
|
14
|
-
script.src = '/style_setter.js'
|
|
15
|
-
script.type = 'module'
|
|
16
|
-
document.head.appendChild(script)
|
|
17
|
-
|
|
18
|
-
return Story()
|
|
19
|
-
},
|
|
20
|
-
],
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export default meta;
|
|
24
|
-
type Story = StoryObj<typeof meta>;
|
|
25
|
-
|
|
26
|
-
export const TextField: Story = {
|
|
27
|
-
args: {
|
|
28
|
-
label: 'Год вашего рождения',
|
|
29
|
-
value: '2026',
|
|
30
|
-
type: 'text',
|
|
31
|
-
bottomText: 'Пишите только цифры',
|
|
32
|
-
placeholder: 'Год в формате YYYY',
|
|
33
|
-
errorText: 'Допустимы только цифры',
|
|
34
|
-
mask: /^[0-9]+$/,
|
|
35
|
-
width: 300
|
|
36
|
-
},
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
export const Search: Story = {
|
|
40
|
-
args: {
|
|
41
|
-
value: '',
|
|
42
|
-
type: 'text',
|
|
43
|
-
placeholder: 'Найти по имени или году',
|
|
44
|
-
width: 250,
|
|
45
|
-
live: true,
|
|
46
|
-
isSearch: true
|
|
47
|
-
},
|
|
48
|
-
};
|
|
49
|
-
|
|
@@ -1,172 +0,0 @@
|
|
|
1
|
-
import React, {useState, useId} from 'react';
|
|
2
|
-
import { Button } from "../Button";
|
|
3
|
-
import './input.scss';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Компонент поля для ввода текста
|
|
7
|
-
* - тип (текст, цифры, пароль)
|
|
8
|
-
* - это поисковая строка (значок лупы)
|
|
9
|
-
* - валидация
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
export interface InputProps {
|
|
13
|
-
/** Значение */
|
|
14
|
-
value?: string | number;
|
|
15
|
-
|
|
16
|
-
/** Текстовое поле \ цифровое \ пароль \ textarea */
|
|
17
|
-
type?: 'text' | 'number' | 'password' | 'email' | 'date' | 'tel' | 'time' | 'textarea';
|
|
18
|
-
|
|
19
|
-
/** Углы прямые / Закругленные / Круглые */
|
|
20
|
-
corners?: 'square' | 'standard' | 'round';
|
|
21
|
-
|
|
22
|
-
/** Доступность поля */
|
|
23
|
-
disabled?: boolean,
|
|
24
|
-
|
|
25
|
-
/** Текст над полем */
|
|
26
|
-
label?: string;
|
|
27
|
-
|
|
28
|
-
/** Текст под полем */
|
|
29
|
-
bottomText?: string;
|
|
30
|
-
|
|
31
|
-
/** Плейсхолдер */
|
|
32
|
-
placeholder?: string;
|
|
33
|
-
|
|
34
|
-
/** Живой поиск */
|
|
35
|
-
live?: boolean;
|
|
36
|
-
|
|
37
|
-
/** Событие при изменении */
|
|
38
|
-
onChange?: (value?: string | number) => void;
|
|
39
|
-
|
|
40
|
-
/** Это поиск */
|
|
41
|
-
isSearch?: boolean;
|
|
42
|
-
|
|
43
|
-
/** Валидация */
|
|
44
|
-
mask?: RegExp;
|
|
45
|
-
|
|
46
|
-
/** Ошибки валидации */
|
|
47
|
-
errorText: string;
|
|
48
|
-
|
|
49
|
-
/** Ширина в px */
|
|
50
|
-
width?: number;
|
|
51
|
-
|
|
52
|
-
/** Дополнительные классы */
|
|
53
|
-
cls?: string;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
/** Элемент кнопки */
|
|
57
|
-
export const Input = ({
|
|
58
|
-
value='',
|
|
59
|
-
type='text',
|
|
60
|
-
corners='standard',
|
|
61
|
-
disabled=false,
|
|
62
|
-
label='',
|
|
63
|
-
bottomText='',
|
|
64
|
-
placeholder='',
|
|
65
|
-
errorText='',
|
|
66
|
-
live=false,
|
|
67
|
-
isSearch=false,
|
|
68
|
-
mask,
|
|
69
|
-
width,
|
|
70
|
-
onChange,
|
|
71
|
-
cls,
|
|
72
|
-
...props
|
|
73
|
-
}: InputProps) => {
|
|
74
|
-
const [internalValue, setInternalValue] = useState<string | number>(value);
|
|
75
|
-
const [error, setError] = useState<string>('');
|
|
76
|
-
const inputId = useId();
|
|
77
|
-
|
|
78
|
-
const handleChange = (e: ChangeEvent<HTMLInputElement | HTMLTextAreaElement>) => {
|
|
79
|
-
let val: string | number = e.target.value;
|
|
80
|
-
|
|
81
|
-
if (type === 'number') {
|
|
82
|
-
val = val.toString().replace(/\D/g, '');
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
if (mask && !mask.test(val.toString())) {
|
|
86
|
-
setError(errorText || 'Некорректное значение'); // TODO нормальные текстовки
|
|
87
|
-
} else {
|
|
88
|
-
setError('');
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
setInternalValue(val);
|
|
92
|
-
|
|
93
|
-
if (live && onChange) {
|
|
94
|
-
onChange(val);
|
|
95
|
-
}
|
|
96
|
-
};
|
|
97
|
-
|
|
98
|
-
const clearInput = () => {
|
|
99
|
-
setInternalValue('');
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
const handleBlur = (e: FocusEvent<HTMLInputElement | HTMLTextAreaElement>) => {
|
|
103
|
-
if (!live && onChange) {
|
|
104
|
-
onChange(internalValue);
|
|
105
|
-
}
|
|
106
|
-
};
|
|
107
|
-
|
|
108
|
-
const inputProps = {
|
|
109
|
-
value: internalValue,
|
|
110
|
-
placeholder,
|
|
111
|
-
onChange: handleChange,
|
|
112
|
-
onBlur: handleBlur,
|
|
113
|
-
className: [
|
|
114
|
-
'kit-input',
|
|
115
|
-
`kit-input--${corners}`,
|
|
116
|
-
disabled ? 'kit-input--disabled' : '',
|
|
117
|
-
error ? 'kit-input--error' : '',
|
|
118
|
-
cls
|
|
119
|
-
].join(' ').trim()
|
|
120
|
-
};
|
|
121
|
-
|
|
122
|
-
return (
|
|
123
|
-
<div className="kit-input--wrapper">
|
|
124
|
-
{ label && <div className='w5rem'>
|
|
125
|
-
<label
|
|
126
|
-
for={ inputId }
|
|
127
|
-
className="kit-input--label kit-input-secondary-text"
|
|
128
|
-
>
|
|
129
|
-
{ label }
|
|
130
|
-
</label>
|
|
131
|
-
</div> }
|
|
132
|
-
<div
|
|
133
|
-
className="kit-input--container"
|
|
134
|
-
style={{ 'width': width ? `${width}px` : 'auto' }}
|
|
135
|
-
>
|
|
136
|
-
{ type === 'textarea' ? (
|
|
137
|
-
<textarea
|
|
138
|
-
id={ inputId }
|
|
139
|
-
{ ...inputProps }
|
|
140
|
-
/>
|
|
141
|
-
) : (
|
|
142
|
-
<input
|
|
143
|
-
{ ...inputProps }
|
|
144
|
-
type={ type }
|
|
145
|
-
id={ inputId }
|
|
146
|
-
/>
|
|
147
|
-
)}
|
|
148
|
-
|
|
149
|
-
<div className='kit-input--icon-container'>
|
|
150
|
-
{ internalValue && <Button
|
|
151
|
-
type='transparent'
|
|
152
|
-
iconPath='svg-lib/input-svgrepo-com.svg'
|
|
153
|
-
size='small'
|
|
154
|
-
onClick={clearInput}
|
|
155
|
-
cls='kit-input--icon'
|
|
156
|
-
/> }
|
|
157
|
-
{ isSearch && <Button
|
|
158
|
-
type='transparent'
|
|
159
|
-
iconPath='svg-lib/search-svgrepo-com.svg'
|
|
160
|
-
size='small'
|
|
161
|
-
staticIcon={live}
|
|
162
|
-
onClick={() => onChange && onChange(internalValue)}
|
|
163
|
-
cls='kit-input--icon'
|
|
164
|
-
/> }
|
|
165
|
-
</div>
|
|
166
|
-
</div>
|
|
167
|
-
|
|
168
|
-
{ !error && bottomText && <div className="kit-input-bottomtext kit-input-secondary-text">{bottomText}</div> }
|
|
169
|
-
{ error && <div className="kit-input-errortext kit-input-secondary-text">{error}</div> }
|
|
170
|
-
</div>
|
|
171
|
-
);
|
|
172
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./Input";
|