@mw-kit/mw-ui 0.3.4 → 1.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.
- package/.eslintignore +28 -0
- package/.eslintrc.js +35 -0
- package/.prettierignore +27 -0
- package/.prettierrc.json +10 -0
- package/.storybook/main.js +13 -0
- package/.storybook/preview.js +21 -0
- package/.travis.yml +4 -0
- package/.vscode/settings.json +3 -0
- package/README.md +46 -40
- package/bitbucket-pipelines.yml +69 -0
- package/docker-compose.yml +14 -0
- package/example/README.md +5 -0
- package/example/favicon.ico +0 -0
- package/example/index.html +46 -0
- package/example/manifest.json +15 -0
- package/example/package.json +43 -0
- package/example/public/favicon.ico +0 -0
- package/example/public/index.html +46 -0
- package/example/public/manifest.json +15 -0
- package/example/src/App.tsx +47 -0
- package/example/src/index.tsx +11 -0
- package/example/src/react-app-env.d.ts +1 -0
- package/example/src/setupTests.ts +5 -0
- package/example/tsconfig.json +30 -0
- package/example/yarn.lock +694 -0
- package/exec.sh +11 -0
- package/hooks/pre-push +3 -0
- package/package.json +102 -69
- package/public/favicon.ico +0 -0
- package/public/index.html +43 -0
- package/public/logo192.png +0 -0
- package/public/logo512.png +0 -0
- package/public/manifest.json +25 -0
- package/public/robots.txt +3 -0
- package/shell/autotag.sh +169 -0
- package/shell/bash.sh +3 -0
- package/shell/install.sh +9 -0
- package/shell/logs.sh +3 -0
- package/shell/npx.sh +3 -0
- package/shell/restart.sh +5 -0
- package/shell/start.sh +7 -0
- package/shell/stop.sh +3 -0
- package/shell/tags.sh +24 -0
- package/shell/yarn.sh +7 -0
- package/src/addons/Portal/index.ts +26 -0
- package/src/addons/Portal/interfaces.ts +5 -0
- package/src/assets/icons/close.svg +1 -0
- package/src/assets/icons/feather/activity.svg +1 -0
- package/src/assets/icons/feather/airplay.svg +1 -0
- package/src/assets/icons/feather/alert-circle.svg +1 -0
- package/src/assets/icons/feather/alert-octagon.svg +1 -0
- package/src/assets/icons/feather/alert-triangle.svg +1 -0
- package/src/assets/icons/feather/align-center.svg +1 -0
- package/src/assets/icons/feather/align-justify.svg +1 -0
- package/src/assets/icons/feather/align-left.svg +1 -0
- package/src/assets/icons/feather/align-right.svg +1 -0
- package/src/assets/icons/feather/anchor.svg +1 -0
- package/src/assets/icons/feather/aperture.svg +1 -0
- package/src/assets/icons/feather/archive.svg +1 -0
- package/src/assets/icons/feather/arrow-down-circle.svg +1 -0
- package/src/assets/icons/feather/arrow-down-left.svg +1 -0
- package/src/assets/icons/feather/arrow-down-right.svg +1 -0
- package/src/assets/icons/feather/arrow-down.svg +1 -0
- package/src/assets/icons/feather/arrow-left-circle.svg +1 -0
- package/src/assets/icons/feather/arrow-left.svg +1 -0
- package/src/assets/icons/feather/arrow-right-circle.svg +1 -0
- package/src/assets/icons/feather/arrow-right.svg +1 -0
- package/src/assets/icons/feather/arrow-up-circle.svg +1 -0
- package/src/assets/icons/feather/arrow-up-left.svg +1 -0
- package/src/assets/icons/feather/arrow-up-right.svg +1 -0
- package/src/assets/icons/feather/arrow-up.svg +1 -0
- package/src/assets/icons/feather/at-sign.svg +1 -0
- package/src/assets/icons/feather/award.svg +1 -0
- package/src/assets/icons/feather/bar-chart-2.svg +1 -0
- package/src/assets/icons/feather/bar-chart.svg +1 -0
- package/src/assets/icons/feather/battery-charging.svg +1 -0
- package/src/assets/icons/feather/battery.svg +1 -0
- package/src/assets/icons/feather/bell-off.svg +1 -0
- package/src/assets/icons/feather/bell.svg +1 -0
- package/src/assets/icons/feather/bluetooth.svg +1 -0
- package/src/assets/icons/feather/bold.svg +1 -0
- package/src/assets/icons/feather/book-open.svg +1 -0
- package/src/assets/icons/feather/book.svg +1 -0
- package/src/assets/icons/feather/bookmark.svg +1 -0
- package/src/assets/icons/feather/box.svg +1 -0
- package/src/assets/icons/feather/briefcase.svg +1 -0
- package/src/assets/icons/feather/calendar.svg +1 -0
- package/src/assets/icons/feather/camera-off.svg +1 -0
- package/src/assets/icons/feather/camera.svg +1 -0
- package/src/assets/icons/feather/cast.svg +1 -0
- package/src/assets/icons/feather/check-circle.svg +1 -0
- package/src/assets/icons/feather/check-square.svg +1 -0
- package/src/assets/icons/feather/check.svg +1 -0
- package/src/assets/icons/feather/chevron-down.svg +1 -0
- package/src/assets/icons/feather/chevron-left.svg +1 -0
- package/src/assets/icons/feather/chevron-right.svg +1 -0
- package/src/assets/icons/feather/chevron-up.svg +1 -0
- package/src/assets/icons/feather/chevrons-down.svg +1 -0
- package/src/assets/icons/feather/chevrons-left.svg +1 -0
- package/src/assets/icons/feather/chevrons-right.svg +1 -0
- package/src/assets/icons/feather/chevrons-up.svg +1 -0
- package/src/assets/icons/feather/chrome.svg +1 -0
- package/src/assets/icons/feather/circle.svg +1 -0
- package/src/assets/icons/feather/clipboard.svg +1 -0
- package/src/assets/icons/feather/clock.svg +1 -0
- package/src/assets/icons/feather/cloud-drizzle.svg +1 -0
- package/src/assets/icons/feather/cloud-lightning.svg +1 -0
- package/src/assets/icons/feather/cloud-off.svg +1 -0
- package/src/assets/icons/feather/cloud-rain.svg +1 -0
- package/src/assets/icons/feather/cloud-snow.svg +1 -0
- package/src/assets/icons/feather/cloud.svg +1 -0
- package/src/assets/icons/feather/code.svg +1 -0
- package/src/assets/icons/feather/codepen.svg +1 -0
- package/src/assets/icons/feather/codesandbox.svg +1 -0
- package/src/assets/icons/feather/coffee.svg +1 -0
- package/src/assets/icons/feather/columns.svg +1 -0
- package/src/assets/icons/feather/command.svg +1 -0
- package/src/assets/icons/feather/compass.svg +1 -0
- package/src/assets/icons/feather/copy.svg +1 -0
- package/src/assets/icons/feather/corner-down-left.svg +1 -0
- package/src/assets/icons/feather/corner-down-right.svg +1 -0
- package/src/assets/icons/feather/corner-left-down.svg +1 -0
- package/src/assets/icons/feather/corner-left-up.svg +1 -0
- package/src/assets/icons/feather/corner-right-down.svg +1 -0
- package/src/assets/icons/feather/corner-right-up.svg +1 -0
- package/src/assets/icons/feather/corner-up-left.svg +1 -0
- package/src/assets/icons/feather/corner-up-right.svg +1 -0
- package/src/assets/icons/feather/cpu.svg +1 -0
- package/src/assets/icons/feather/credit-card.svg +1 -0
- package/src/assets/icons/feather/crop.svg +1 -0
- package/src/assets/icons/feather/crosshair.svg +1 -0
- package/src/assets/icons/feather/database.svg +1 -0
- package/src/assets/icons/feather/delete.svg +1 -0
- package/src/assets/icons/feather/disc.svg +1 -0
- package/src/assets/icons/feather/divide-circle.svg +1 -0
- package/src/assets/icons/feather/divide-square.svg +1 -0
- package/src/assets/icons/feather/divide.svg +1 -0
- package/src/assets/icons/feather/dollar-sign.svg +1 -0
- package/src/assets/icons/feather/download-cloud.svg +1 -0
- package/src/assets/icons/feather/download.svg +1 -0
- package/src/assets/icons/feather/dribbble.svg +1 -0
- package/src/assets/icons/feather/droplet.svg +1 -0
- package/src/assets/icons/feather/edit-2.svg +1 -0
- package/src/assets/icons/feather/edit-3.svg +1 -0
- package/src/assets/icons/feather/edit.svg +1 -0
- package/src/assets/icons/feather/external-link.svg +1 -0
- package/src/assets/icons/feather/eye-off.svg +1 -0
- package/src/assets/icons/feather/eye.svg +1 -0
- package/src/assets/icons/feather/facebook.svg +1 -0
- package/src/assets/icons/feather/fast-forward.svg +1 -0
- package/src/assets/icons/feather/feather.svg +1 -0
- package/src/assets/icons/feather/figma.svg +1 -0
- package/src/assets/icons/feather/file-minus.svg +1 -0
- package/src/assets/icons/feather/file-plus.svg +1 -0
- package/src/assets/icons/feather/file-text.svg +1 -0
- package/src/assets/icons/feather/file.svg +1 -0
- package/src/assets/icons/feather/film.svg +1 -0
- package/src/assets/icons/feather/filter.svg +1 -0
- package/src/assets/icons/feather/flag.svg +1 -0
- package/src/assets/icons/feather/folder-minus.svg +1 -0
- package/src/assets/icons/feather/folder-plus.svg +1 -0
- package/src/assets/icons/feather/folder.svg +1 -0
- package/src/assets/icons/feather/framer.svg +1 -0
- package/src/assets/icons/feather/frown.svg +1 -0
- package/src/assets/icons/feather/gift.svg +1 -0
- package/src/assets/icons/feather/git-branch.svg +1 -0
- package/src/assets/icons/feather/git-commit.svg +1 -0
- package/src/assets/icons/feather/git-merge.svg +1 -0
- package/src/assets/icons/feather/git-pull-request.svg +1 -0
- package/src/assets/icons/feather/github.svg +1 -0
- package/src/assets/icons/feather/gitlab.svg +1 -0
- package/src/assets/icons/feather/globe.svg +1 -0
- package/src/assets/icons/feather/grid.svg +1 -0
- package/src/assets/icons/feather/hard-drive.svg +1 -0
- package/src/assets/icons/feather/hash.svg +1 -0
- package/src/assets/icons/feather/headphones.svg +1 -0
- package/src/assets/icons/feather/heart.svg +1 -0
- package/src/assets/icons/feather/help-circle.svg +1 -0
- package/src/assets/icons/feather/hexagon.svg +1 -0
- package/src/assets/icons/feather/home.svg +1 -0
- package/src/assets/icons/feather/image.svg +1 -0
- package/src/assets/icons/feather/inbox.svg +1 -0
- package/src/assets/icons/feather/index.ts +581 -0
- package/src/assets/icons/feather/info.svg +1 -0
- package/src/assets/icons/feather/instagram.svg +1 -0
- package/src/assets/icons/feather/italic.svg +1 -0
- package/src/assets/icons/feather/key.svg +1 -0
- package/src/assets/icons/feather/layers.svg +1 -0
- package/src/assets/icons/feather/layout.svg +1 -0
- package/src/assets/icons/feather/life-buoy.svg +1 -0
- package/src/assets/icons/feather/link-2.svg +1 -0
- package/src/assets/icons/feather/link.svg +1 -0
- package/src/assets/icons/feather/linkedin.svg +1 -0
- package/src/assets/icons/feather/list.svg +1 -0
- package/src/assets/icons/feather/loader.svg +1 -0
- package/src/assets/icons/feather/lock.svg +1 -0
- package/src/assets/icons/feather/log-in.svg +1 -0
- package/src/assets/icons/feather/log-out.svg +1 -0
- package/src/assets/icons/feather/mail.svg +1 -0
- package/src/assets/icons/feather/map-pin.svg +1 -0
- package/src/assets/icons/feather/map.svg +1 -0
- package/src/assets/icons/feather/maximize-2.svg +1 -0
- package/src/assets/icons/feather/maximize.svg +1 -0
- package/src/assets/icons/feather/meh.svg +1 -0
- package/src/assets/icons/feather/menu.svg +1 -0
- package/src/assets/icons/feather/message-circle.svg +1 -0
- package/src/assets/icons/feather/message-square.svg +1 -0
- package/src/assets/icons/feather/mic-off.svg +1 -0
- package/src/assets/icons/feather/mic.svg +1 -0
- package/src/assets/icons/feather/minimize-2.svg +1 -0
- package/src/assets/icons/feather/minimize.svg +1 -0
- package/src/assets/icons/feather/minus-circle.svg +1 -0
- package/src/assets/icons/feather/minus-square.svg +1 -0
- package/src/assets/icons/feather/minus.svg +1 -0
- package/src/assets/icons/feather/monitor.svg +1 -0
- package/src/assets/icons/feather/moon.svg +1 -0
- package/src/assets/icons/feather/more-horizontal.svg +1 -0
- package/src/assets/icons/feather/more-vertical.svg +1 -0
- package/src/assets/icons/feather/mouse-pointer.svg +1 -0
- package/src/assets/icons/feather/move.svg +1 -0
- package/src/assets/icons/feather/music.svg +1 -0
- package/src/assets/icons/feather/navigation-2.svg +1 -0
- package/src/assets/icons/feather/navigation.svg +1 -0
- package/src/assets/icons/feather/octagon.svg +1 -0
- package/src/assets/icons/feather/package.svg +1 -0
- package/src/assets/icons/feather/paperclip.svg +1 -0
- package/src/assets/icons/feather/pause-circle.svg +1 -0
- package/src/assets/icons/feather/pause.svg +1 -0
- package/src/assets/icons/feather/pen-tool.svg +1 -0
- package/src/assets/icons/feather/percent.svg +1 -0
- package/src/assets/icons/feather/phone-call.svg +1 -0
- package/src/assets/icons/feather/phone-forwarded.svg +1 -0
- package/src/assets/icons/feather/phone-incoming.svg +1 -0
- package/src/assets/icons/feather/phone-missed.svg +1 -0
- package/src/assets/icons/feather/phone-off.svg +1 -0
- package/src/assets/icons/feather/phone-outgoing.svg +1 -0
- package/src/assets/icons/feather/phone.svg +1 -0
- package/src/assets/icons/feather/pie-chart.svg +1 -0
- package/src/assets/icons/feather/play-circle.svg +1 -0
- package/src/assets/icons/feather/play.svg +1 -0
- package/src/assets/icons/feather/plus-circle.svg +1 -0
- package/src/assets/icons/feather/plus-square.svg +1 -0
- package/src/assets/icons/feather/plus.svg +1 -0
- package/src/assets/icons/feather/pocket.svg +1 -0
- package/src/assets/icons/feather/power.svg +1 -0
- package/src/assets/icons/feather/printer.svg +1 -0
- package/src/assets/icons/feather/radio.svg +1 -0
- package/src/assets/icons/feather/refresh-ccw.svg +1 -0
- package/src/assets/icons/feather/refresh-cw.svg +1 -0
- package/src/assets/icons/feather/repeat.svg +1 -0
- package/src/assets/icons/feather/rewind.svg +1 -0
- package/src/assets/icons/feather/rotate-ccw.svg +1 -0
- package/src/assets/icons/feather/rotate-cw.svg +1 -0
- package/src/assets/icons/feather/rss.svg +1 -0
- package/src/assets/icons/feather/save.svg +1 -0
- package/src/assets/icons/feather/scissors.svg +1 -0
- package/src/assets/icons/feather/search.svg +1 -0
- package/src/assets/icons/feather/send.svg +1 -0
- package/src/assets/icons/feather/server.svg +1 -0
- package/src/assets/icons/feather/settings.svg +1 -0
- package/src/assets/icons/feather/share-2.svg +1 -0
- package/src/assets/icons/feather/share.svg +1 -0
- package/src/assets/icons/feather/shield-off.svg +1 -0
- package/src/assets/icons/feather/shield.svg +1 -0
- package/src/assets/icons/feather/shopping-bag.svg +1 -0
- package/src/assets/icons/feather/shopping-cart.svg +1 -0
- package/src/assets/icons/feather/shuffle.svg +1 -0
- package/src/assets/icons/feather/sidebar.svg +1 -0
- package/src/assets/icons/feather/skip-back.svg +1 -0
- package/src/assets/icons/feather/skip-forward.svg +1 -0
- package/src/assets/icons/feather/slack.svg +1 -0
- package/src/assets/icons/feather/slash.svg +1 -0
- package/src/assets/icons/feather/sliders.svg +1 -0
- package/src/assets/icons/feather/smartphone.svg +1 -0
- package/src/assets/icons/feather/smile.svg +1 -0
- package/src/assets/icons/feather/speaker.svg +1 -0
- package/src/assets/icons/feather/square.svg +1 -0
- package/src/assets/icons/feather/star.svg +1 -0
- package/src/assets/icons/feather/stop-circle.svg +1 -0
- package/src/assets/icons/feather/sun.svg +1 -0
- package/src/assets/icons/feather/sunrise.svg +1 -0
- package/src/assets/icons/feather/sunset.svg +1 -0
- package/src/assets/icons/feather/table.svg +1 -0
- package/src/assets/icons/feather/tablet.svg +1 -0
- package/src/assets/icons/feather/tag.svg +1 -0
- package/src/assets/icons/feather/target.svg +1 -0
- package/src/assets/icons/feather/terminal.svg +1 -0
- package/src/assets/icons/feather/thermometer.svg +1 -0
- package/src/assets/icons/feather/thumbs-down.svg +1 -0
- package/src/assets/icons/feather/thumbs-up.svg +1 -0
- package/src/assets/icons/feather/toggle-left.svg +1 -0
- package/src/assets/icons/feather/toggle-right.svg +1 -0
- package/src/assets/icons/feather/tool.svg +1 -0
- package/src/assets/icons/feather/trash-2.svg +1 -0
- package/src/assets/icons/feather/trash.svg +1 -0
- package/src/assets/icons/feather/trello.svg +1 -0
- package/src/assets/icons/feather/trending-down.svg +1 -0
- package/src/assets/icons/feather/trending-up.svg +1 -0
- package/src/assets/icons/feather/triangle.svg +1 -0
- package/src/assets/icons/feather/truck.svg +1 -0
- package/src/assets/icons/feather/tv.svg +1 -0
- package/src/assets/icons/feather/twitch.svg +1 -0
- package/src/assets/icons/feather/twitter.svg +1 -0
- package/src/assets/icons/feather/type.svg +1 -0
- package/src/assets/icons/feather/umbrella.svg +1 -0
- package/src/assets/icons/feather/underline.svg +1 -0
- package/src/assets/icons/feather/unlock.svg +1 -0
- package/src/assets/icons/feather/upload-cloud.svg +1 -0
- package/src/assets/icons/feather/upload.svg +1 -0
- package/src/assets/icons/feather/user-check.svg +1 -0
- package/src/assets/icons/feather/user-minus.svg +1 -0
- package/src/assets/icons/feather/user-plus.svg +1 -0
- package/src/assets/icons/feather/user-x.svg +1 -0
- package/src/assets/icons/feather/user.svg +1 -0
- package/src/assets/icons/feather/users.svg +1 -0
- package/src/assets/icons/feather/video-off.svg +1 -0
- package/src/assets/icons/feather/video.svg +1 -0
- package/src/assets/icons/feather/voicemail.svg +1 -0
- package/src/assets/icons/feather/volume-1.svg +1 -0
- package/src/assets/icons/feather/volume-2.svg +1 -0
- package/src/assets/icons/feather/volume-x.svg +1 -0
- package/src/assets/icons/feather/volume.svg +1 -0
- package/src/assets/icons/feather/watch.svg +1 -0
- package/src/assets/icons/feather/wifi-off.svg +1 -0
- package/src/assets/icons/feather/wifi.svg +1 -0
- package/src/assets/icons/feather/wind.svg +1 -0
- package/src/assets/icons/feather/x-circle.svg +1 -0
- package/src/assets/icons/feather/x-octagon.svg +1 -0
- package/src/assets/icons/feather/x-square.svg +1 -0
- package/src/assets/icons/feather/x.svg +1 -0
- package/src/assets/icons/feather/youtube.svg +1 -0
- package/src/assets/icons/feather/zap-off.svg +1 -0
- package/src/assets/icons/feather/zap.svg +1 -0
- package/src/assets/icons/feather/zoom-in.svg +1 -0
- package/src/assets/icons/feather/zoom-out.svg +1 -0
- package/src/assets/icons/flags/flags.png +0 -0
- package/src/assets/icons/flags/index.ts +120 -0
- package/src/components/AbsoluteContainer/index.tsx +62 -0
- package/src/components/AbsoluteContainer/interfaces.ts +39 -0
- package/src/components/AbsoluteContainer/styles.ts +93 -0
- package/src/components/Button/constants.ts +17 -0
- package/src/components/Button/index.tsx +47 -0
- package/src/components/Button/interfaces.ts +33 -0
- package/src/components/Button/styles.ts +126 -0
- package/src/components/Button/theme.ts +8 -0
- package/src/components/Calendar/index.tsx +375 -0
- package/src/components/Calendar/interfaces.ts +21 -0
- package/src/components/Calendar/styles.ts +161 -0
- package/src/components/CalendarInterval/index.tsx +93 -0
- package/src/components/CalendarInterval/interfaces.ts +17 -0
- package/src/components/CalendarInterval/styles.ts +9 -0
- package/src/components/Card/index.tsx +9 -0
- package/src/components/Card/interfaces.ts +5 -0
- package/src/components/Card/styled.ts +60 -0
- package/src/components/Icon/index.tsx +66 -0
- package/src/components/Icon/interfaces.ts +42 -0
- package/src/components/Icon/styled.ts +64 -0
- package/src/components/Indicator/index.tsx +14 -0
- package/src/components/Indicator/interfaces.ts +6 -0
- package/src/components/Indicator/styles.ts +49 -0
- package/src/components/Input/components/Checkbox/index.tsx +35 -0
- package/src/components/Input/components/Checkbox/interfaces.ts +27 -0
- package/src/components/Input/components/Checkbox/styles.ts +168 -0
- package/src/components/Input/components/Date/functions.ts +1 -0
- package/src/components/Input/components/Date/index.tsx +188 -0
- package/src/components/Input/components/Date/interfaces.ts +10 -0
- package/src/components/Input/components/Date/styles.ts +5 -0
- package/src/components/Input/components/DatePicker/index.tsx +143 -0
- package/src/components/Input/components/DatePicker/interfaces.ts +21 -0
- package/src/components/Input/components/DatePicker/styles.ts +64 -0
- package/src/components/Input/components/Input/functions.ts +35 -0
- package/src/components/Input/components/Input/index.tsx +204 -0
- package/src/components/Input/components/Input/interfaces.ts +46 -0
- package/src/components/Input/components/Input/styles.ts +140 -0
- package/src/components/Input/components/Password/index.tsx +63 -0
- package/src/components/Input/components/Password/interfaces.ts +9 -0
- package/src/components/Input/components/Phone/countries.ts +107 -0
- package/src/components/Input/components/Phone/index.tsx +179 -0
- package/src/components/Input/components/Phone/interfaces.ts +47 -0
- package/src/components/Input/components/Phone/styles.ts +27 -0
- package/src/components/Input/components/RadioButton/index.tsx +28 -0
- package/src/components/Input/components/RadioButton/interfaces.ts +16 -0
- package/src/components/Input/components/RadioButton/styles.ts +96 -0
- package/src/components/Input/components/Range/index.tsx +186 -0
- package/src/components/Input/components/Range/interfaces.ts +37 -0
- package/src/components/Input/components/Range/styles.ts +218 -0
- package/src/components/Input/components/Select/context.ts +8 -0
- package/src/components/Input/components/Select/index.tsx +226 -0
- package/src/components/Input/components/Select/interfaces.ts +49 -0
- package/src/components/Input/components/Select/styles.ts +17 -0
- package/src/components/Input/components/Switch/index.tsx +28 -0
- package/src/components/Input/components/Switch/interfaces.ts +16 -0
- package/src/components/Input/components/Switch/styles.ts +100 -0
- package/src/components/Input/components/Time/index.tsx +152 -0
- package/src/components/Input/components/Time/interfaces.ts +6 -0
- package/src/components/Input/index.tsx +95 -0
- package/src/components/Loader/index.ts +55 -0
- package/src/components/Loader/interfaces.ts +8 -0
- package/src/components/Menu/index.tsx +139 -0
- package/src/components/Menu/interfaces.ts +63 -0
- package/src/components/Menu/styles.ts +79 -0
- package/src/components/Modal/component.tsx +114 -0
- package/src/components/Modal/contants.ts +15 -0
- package/src/components/Modal/index.ts +18 -0
- package/src/components/Modal/interfaces.ts +60 -0
- package/src/components/Modal/styles.ts +91 -0
- package/src/components/Modal/templates/Audit/index.tsx +45 -0
- package/src/components/Modal/templates/Audit/interfaces.ts +17 -0
- package/src/components/Modal/templates/Audit/styles.ts +5 -0
- package/src/components/Modal/templates/ConfirmDelete/index.tsx +47 -0
- package/src/components/Modal/templates/ConfirmDelete/interfaces.ts +16 -0
- package/src/components/Modal/templates/ConfirmDelete/styles.ts +5 -0
- package/src/components/Modal/templates/ConfirmEdit/index.tsx +51 -0
- package/src/components/Modal/templates/ConfirmEdit/interfaces.ts +18 -0
- package/src/components/Modal/templates/ConfirmEdit/styles.ts +5 -0
- package/src/components/Modal/templates/index.ts +3 -0
- package/src/components/Placeholder/components/Template1/index.tsx +27 -0
- package/src/components/Placeholder/components/Template1/styles.ts +68 -0
- package/src/components/Placeholder/components/Template10/index.tsx +29 -0
- package/src/components/Placeholder/components/Template10/styles.ts +79 -0
- package/src/components/Placeholder/components/Template2/index.tsx +25 -0
- package/src/components/Placeholder/components/Template2/styles.ts +43 -0
- package/src/components/Placeholder/components/Template3/index.tsx +18 -0
- package/src/components/Placeholder/components/Template3/styles.ts +15 -0
- package/src/components/Placeholder/components/Template4/index.tsx +20 -0
- package/src/components/Placeholder/components/Template4/styles.ts +50 -0
- package/src/components/Placeholder/components/Template5/index.tsx +40 -0
- package/src/components/Placeholder/components/Template5/styles.ts +64 -0
- package/src/components/Placeholder/components/Template6/index.tsx +33 -0
- package/src/components/Placeholder/components/Template6/styles.ts +63 -0
- package/src/components/Placeholder/components/Template7/index.tsx +23 -0
- package/src/components/Placeholder/components/Template7/styles.ts +73 -0
- package/src/components/Placeholder/components/Template8/index.tsx +30 -0
- package/src/components/Placeholder/components/Template8/styles.ts +66 -0
- package/src/components/Placeholder/components/Template9/index.tsx +20 -0
- package/src/components/Placeholder/components/Template9/styles.ts +74 -0
- package/src/components/Placeholder/index.tsx +56 -0
- package/src/components/Placeholder/interfaces.ts +21 -0
- package/src/components/Placeholder/styles.ts +35 -0
- package/src/components/ProgressBar/index.tsx +16 -0
- package/src/components/ProgressBar/interfaces.ts +4 -0
- package/src/components/ProgressBar/styles.ts +51 -0
- package/src/components/ScrollContainer/index.tsx +99 -0
- package/src/components/ScrollContainer/interfaces.ts +9 -0
- package/src/components/Tabs/index.tsx +55 -0
- package/src/components/Tabs/interfaces.ts +44 -0
- package/src/components/Tabs/styles.ts +65 -0
- package/src/components/TextArea/index.tsx +9 -0
- package/src/components/TextArea/interfaces.ts +10 -0
- package/src/components/TextArea/styles.ts +13 -0
- package/src/components/Toast/index.tsx +20 -0
- package/src/components/Toast/interfaces.ts +7 -0
- package/src/components/Toast/styles.ts +88 -0
- package/src/components/index.ts +17 -0
- package/src/components/theme.ts +7 -0
- package/src/functions/common.ts +3 -0
- package/src/functions/formatters.ts +170 -0
- package/src/functions/validators.ts +93 -0
- package/src/hooks/onClickOut.ts +28 -0
- package/src/index.ts +8 -0
- package/src/interfaces.ts +4 -0
- package/src/stories/components/Input/MwCheckbox/MwCheckBox.stories.tsx +20 -0
- package/src/stories/components/Input/MwCheckbox/argTypes.ts +82 -0
- package/src/stories/components/Input/MwDate/MwDate.stories.tsx +31 -0
- package/src/stories/components/Input/MwDate/argTypes.ts +74 -0
- package/src/stories/components/Input/MwDatePicker/MwDatePicker.stories.tsx +33 -0
- package/src/stories/components/Input/MwDatePicker/argTypes.ts +6 -0
- package/src/stories/components/Input/MwInput/MwInput.stories.tsx +21 -0
- package/src/stories/components/Input/MwInput/argTypes.ts +93 -0
- package/src/stories/components/Input/MwIntlTel/MwIntlTel.stories.tsx +31 -0
- package/src/stories/components/Input/MwIntlTel/argTypes.ts +67 -0
- package/src/stories/components/Input/MwPassword/MwPassword.stories.tsx +20 -0
- package/src/stories/components/Input/MwPassword/argTypes.ts +51 -0
- package/src/stories/components/Input/MwRadioButton/MwSwitch.stories.tsx +22 -0
- package/src/stories/components/Input/MwRadioButton/argtypes.ts +81 -0
- package/src/stories/components/Input/MwRange/MwRange.stories.tsx +33 -0
- package/src/stories/components/Input/MwRange/argTypes.ts +83 -0
- package/src/stories/components/Input/MwSelect/MwSelect.stories.tsx +20 -0
- package/src/stories/components/Input/MwSelect/argTypes.ts +133 -0
- package/src/stories/components/Input/MwSwitch/MwSwitch.stories.tsx +20 -0
- package/src/stories/components/Input/MwSwitch/argTypes.ts +73 -0
- package/src/stories/components/Input/MwTime/MwTime.stories.tsx +20 -0
- package/src/stories/components/Input/MwTime/argTypes.ts +88 -0
- package/src/stories/components/MwButton/MwButton.stories.tsx +19 -0
- package/src/stories/components/MwButton/argTypes.ts +81 -0
- package/src/stories/components/MwCalendar/MwCalendar.stories.tsx +39 -0
- package/src/stories/components/MwCalendar/argTypes.ts +15 -0
- package/src/stories/components/MwCalendarInterval/MwCalendarInterval.stories.tsx +39 -0
- package/src/stories/components/MwCalendarInterval/argTypes.ts +15 -0
- package/src/stories/components/MwCard/MwCard.stories.tsx +19 -0
- package/src/stories/components/MwCard/argTypes.ts +27 -0
- package/src/stories/components/MwIcon/MwIcon.stories.tsx +19 -0
- package/src/stories/components/MwIcon/argTypes.ts +48 -0
- package/src/stories/components/MwIndicator/MwIndicator.stories.tsx +19 -0
- package/src/stories/components/MwIndicator/argTypes.ts +38 -0
- package/src/stories/components/MwLoader/MwLoader.stories.tsx +19 -0
- package/src/stories/components/MwLoader/argTypes.ts +33 -0
- package/src/stories/components/MwModal/MwModal.stories.tsx +81 -0
- package/src/stories/components/MwModal/argTypes.ts +71 -0
- package/src/stories/components/MwPlaceholder/Template1/MwTemplate1.stories.tsx +23 -0
- package/src/stories/components/MwPlaceholder/Template1/argTypes.ts +22 -0
- package/src/stories/components/MwPlaceholder/Template10/MwTemplate1.stories.tsx +23 -0
- package/src/stories/components/MwPlaceholder/Template10/argTypes.ts +22 -0
- package/src/stories/components/MwPlaceholder/Template2/MwTemplate1.stories.tsx +23 -0
- package/src/stories/components/MwPlaceholder/Template2/argTypes.ts +22 -0
- package/src/stories/components/MwPlaceholder/Template3/MwTemplate1.stories.tsx +23 -0
- package/src/stories/components/MwPlaceholder/Template3/argTypes.ts +22 -0
- package/src/stories/components/MwPlaceholder/Template4/MwTemplate1.stories.tsx +23 -0
- package/src/stories/components/MwPlaceholder/Template4/argTypes.ts +22 -0
- package/src/stories/components/MwPlaceholder/Template5/MwTemplate1.stories.tsx +23 -0
- package/src/stories/components/MwPlaceholder/Template5/argTypes.ts +22 -0
- package/src/stories/components/MwPlaceholder/Template6/MwTemplate1.stories.tsx +23 -0
- package/src/stories/components/MwPlaceholder/Template6/argTypes.ts +22 -0
- package/src/stories/components/MwPlaceholder/Template7/MwTemplate1.stories.tsx +23 -0
- package/src/stories/components/MwPlaceholder/Template7/argTypes.ts +22 -0
- package/src/stories/components/MwPlaceholder/Template8/MwTemplate1.stories.tsx +23 -0
- package/src/stories/components/MwPlaceholder/Template8/argTypes.ts +22 -0
- package/src/stories/components/MwPlaceholder/Template9/MwTemplate1.stories.tsx +23 -0
- package/src/stories/components/MwPlaceholder/Template9/argTypes.ts +22 -0
- package/src/stories/components/MwProgressBar/MwIndicator.stories.tsx +19 -0
- package/src/stories/components/MwProgressBar/argTypes.ts +22 -0
- package/src/stories/components/MwTabs/MwTabs.stories.tsx +29 -0
- package/src/stories/components/MwTabs/argTypes.ts +78 -0
- package/src/stories/components/MwTextArea/MwTextArea.stories.tsx +19 -0
- package/src/stories/components/MwTextArea/argTypes.ts +29 -0
- package/src/stories/components/MwToast/MwIcon.stories.tsx +19 -0
- package/src/stories/components/MwToast/argTypes.ts +45 -0
- package/src/stories/examples/Introduction.stories.mdx +219 -0
- package/src/stories/examples/assets/code-brackets.svg +1 -0
- package/src/stories/examples/assets/colors.svg +1 -0
- package/src/stories/examples/assets/comments.svg +1 -0
- package/src/stories/examples/assets/direction.svg +1 -0
- package/src/stories/examples/assets/flow.svg +1 -0
- package/src/stories/examples/assets/plugin.svg +1 -0
- package/src/stories/examples/assets/repo.svg +1 -0
- package/src/stories/examples/assets/stackalt.svg +1 -0
- package/src/stories/interfaces.ts +17 -0
- package/src/styled.d.ts +9 -0
- package/src/theme/constants.ts +129 -0
- package/src/theme/globals.tsx +15 -0
- package/src/theme/index.tsx +68 -0
- package/src/theme/interfaces.ts +24 -0
- package/src/theme/useCssVars.ts +49 -0
- package/src/typings.d.ts +20 -0
- package/tsconfig.json +23 -0
- package/dist/index.d.ts +0 -6
- package/dist/index.js +0 -30
- package/dist/index.js.map +0 -1
- package/dist/index.modern.js +0 -11
- package/dist/index.modern.js.map +0 -1
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
import React, { useState } from 'react'
|
|
2
|
+
import { filterObject } from '../../../../functions/formatters'
|
|
3
|
+
|
|
4
|
+
import useOnClickOut from '../../../../hooks/onClickOut'
|
|
5
|
+
import Button from '../../../Button'
|
|
6
|
+
import Checkbox from '../Checkbox'
|
|
7
|
+
import Input from '../Input'
|
|
8
|
+
import { InputProps } from '../../components/Input/interfaces'
|
|
9
|
+
import Menu from '../../../Menu'
|
|
10
|
+
import { Option } from '../../../Menu/interfaces'
|
|
11
|
+
import Provider, { useContext } from './context'
|
|
12
|
+
import { Data, SelectProps } from './interfaces'
|
|
13
|
+
import * as S from './styles'
|
|
14
|
+
|
|
15
|
+
const Header = () => {
|
|
16
|
+
const context = useContext()
|
|
17
|
+
|
|
18
|
+
if (!context.props.search && !context.props.multiple) {
|
|
19
|
+
return <React.Fragment />
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const [value, setValue] = useState<string>('')
|
|
23
|
+
|
|
24
|
+
const {
|
|
25
|
+
props: { search, options },
|
|
26
|
+
checked,
|
|
27
|
+
setChecked,
|
|
28
|
+
} = context
|
|
29
|
+
|
|
30
|
+
const onClick = () =>
|
|
31
|
+
setChecked((prev) =>
|
|
32
|
+
prev.length === options.length
|
|
33
|
+
? []
|
|
34
|
+
: options.map((option) => option.value),
|
|
35
|
+
)
|
|
36
|
+
|
|
37
|
+
return (
|
|
38
|
+
<S.HeaderContainer>
|
|
39
|
+
{context.props.type === 'select-multiple' && context.props.selectAll && (
|
|
40
|
+
<S.SelectAllContainer>
|
|
41
|
+
<b>Selecionados ({checked.length})</b>
|
|
42
|
+
|
|
43
|
+
<Button
|
|
44
|
+
type='button'
|
|
45
|
+
content='Selecionar todos'
|
|
46
|
+
appearance='link'
|
|
47
|
+
onClick={onClick}
|
|
48
|
+
color='darkBlue'
|
|
49
|
+
/>
|
|
50
|
+
</S.SelectAllContainer>
|
|
51
|
+
)}
|
|
52
|
+
|
|
53
|
+
{search && (
|
|
54
|
+
<Input
|
|
55
|
+
type='search'
|
|
56
|
+
placeholder='Pesquisa'
|
|
57
|
+
onChange={(event) => setValue(event.target.value)}
|
|
58
|
+
value={value}
|
|
59
|
+
onPressEnter={() => search(value)}
|
|
60
|
+
icon={{
|
|
61
|
+
icon: {
|
|
62
|
+
type: 'feather',
|
|
63
|
+
icon: 'search',
|
|
64
|
+
},
|
|
65
|
+
onClick: () => search(value),
|
|
66
|
+
}}
|
|
67
|
+
/>
|
|
68
|
+
)}
|
|
69
|
+
</S.HeaderContainer>
|
|
70
|
+
)
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
const Footer = () => {
|
|
74
|
+
const context = useContext()
|
|
75
|
+
|
|
76
|
+
if (context.props.type !== 'select-multiple') return <React.Fragment />
|
|
77
|
+
|
|
78
|
+
const {
|
|
79
|
+
props: { setValue },
|
|
80
|
+
checked,
|
|
81
|
+
setOpen,
|
|
82
|
+
} = context
|
|
83
|
+
|
|
84
|
+
const onClick = () => {
|
|
85
|
+
setValue([...checked])
|
|
86
|
+
setOpen(false)
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
return (
|
|
90
|
+
<Button
|
|
91
|
+
type='button'
|
|
92
|
+
content='Aplicar'
|
|
93
|
+
onClick={onClick}
|
|
94
|
+
style={{ marginRight: '-3.5px' }}
|
|
95
|
+
/>
|
|
96
|
+
)
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
const getOptions = (
|
|
100
|
+
props: SelectProps,
|
|
101
|
+
checked: (string | number)[],
|
|
102
|
+
setChecked: React.Dispatch<React.SetStateAction<(string | number)[]>>,
|
|
103
|
+
): Option<{ value: string | number }>[] => {
|
|
104
|
+
if (props.type === 'select-multiple') {
|
|
105
|
+
return props.options.map((option) => {
|
|
106
|
+
return {
|
|
107
|
+
label: (
|
|
108
|
+
<Checkbox
|
|
109
|
+
type='checkbox'
|
|
110
|
+
checked={checked.includes(option.value)}
|
|
111
|
+
label={option.label}
|
|
112
|
+
onChange={(event) => {
|
|
113
|
+
const isChecked = event.target.checked
|
|
114
|
+
|
|
115
|
+
setChecked((prev) => {
|
|
116
|
+
const newState = prev.filter((v) => v !== option.value)
|
|
117
|
+
|
|
118
|
+
if (isChecked) newState.push(option.value)
|
|
119
|
+
|
|
120
|
+
return newState
|
|
121
|
+
})
|
|
122
|
+
}}
|
|
123
|
+
padding={{
|
|
124
|
+
top: 's3',
|
|
125
|
+
left: 's3',
|
|
126
|
+
right: 's3',
|
|
127
|
+
bottom: 's3',
|
|
128
|
+
}}
|
|
129
|
+
/>
|
|
130
|
+
),
|
|
131
|
+
onClick: () => {},
|
|
132
|
+
data: {
|
|
133
|
+
value: option.value,
|
|
134
|
+
},
|
|
135
|
+
keepOpen: true,
|
|
136
|
+
}
|
|
137
|
+
})
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
return props.options.map((option) => {
|
|
141
|
+
return {
|
|
142
|
+
label: option.label,
|
|
143
|
+
onClick:
|
|
144
|
+
option.onClick ||
|
|
145
|
+
((_index: number, data: Data) => {
|
|
146
|
+
props.setValue(data.value)
|
|
147
|
+
}),
|
|
148
|
+
data: {
|
|
149
|
+
value: option.value,
|
|
150
|
+
},
|
|
151
|
+
}
|
|
152
|
+
})
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
const Select = React.forwardRef(
|
|
156
|
+
(props: SelectProps, ref?: React.ForwardedRef<HTMLInputElement>) => {
|
|
157
|
+
const { onScrollEnd, position, disableAutoPosition, search, type } = props
|
|
158
|
+
|
|
159
|
+
const [open, setOpen] = useState<boolean>(false)
|
|
160
|
+
const [checked, setChecked] = useState<(string | number)[]>(
|
|
161
|
+
Array.isArray(props.value) ? [...props.value] : [],
|
|
162
|
+
)
|
|
163
|
+
|
|
164
|
+
const options = getOptions(props, checked, setChecked)
|
|
165
|
+
|
|
166
|
+
const inputProps = filterObject<SelectProps, InputProps>(props, [
|
|
167
|
+
'type',
|
|
168
|
+
'onScrollEnd',
|
|
169
|
+
'options',
|
|
170
|
+
'position',
|
|
171
|
+
'disableAutoPosition',
|
|
172
|
+
])
|
|
173
|
+
|
|
174
|
+
if (props.type === 'select-multiple') {
|
|
175
|
+
if (props.value.length > 0) {
|
|
176
|
+
inputProps.value =
|
|
177
|
+
props.value.length > 1
|
|
178
|
+
? `Há ${props.value.length} seleções`
|
|
179
|
+
: `Há ${props.value.length} seleção`
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
return (
|
|
184
|
+
<Provider.Provider value={{ props, open, setOpen, checked, setChecked }}>
|
|
185
|
+
<S.RelativeContainer ref={useOnClickOut(() => setOpen(false))}>
|
|
186
|
+
<Input
|
|
187
|
+
{...inputProps}
|
|
188
|
+
type='search'
|
|
189
|
+
readOnly
|
|
190
|
+
onClick={() => {
|
|
191
|
+
setOpen((prev) => !prev)
|
|
192
|
+
}}
|
|
193
|
+
icon={{
|
|
194
|
+
position: 'right',
|
|
195
|
+
icon: {
|
|
196
|
+
type: 'semantic',
|
|
197
|
+
icon: open ? 'caret up' : 'caret down',
|
|
198
|
+
width: '14px',
|
|
199
|
+
},
|
|
200
|
+
}}
|
|
201
|
+
ref={ref}
|
|
202
|
+
/>
|
|
203
|
+
<Menu
|
|
204
|
+
open={open}
|
|
205
|
+
close={() => setOpen(false)}
|
|
206
|
+
options={options}
|
|
207
|
+
onScrollEnd={onScrollEnd}
|
|
208
|
+
width='100%'
|
|
209
|
+
bordered
|
|
210
|
+
spacing={type === 'select-multiple' ? undefined : 's3'}
|
|
211
|
+
position={position}
|
|
212
|
+
disableAutoPosition={disableAutoPosition}
|
|
213
|
+
references={{ bottom: '35px' }}
|
|
214
|
+
before={<Header />}
|
|
215
|
+
after={<Footer />}
|
|
216
|
+
scrollHeight={search ? '135px' : '165px'}
|
|
217
|
+
/>
|
|
218
|
+
</S.RelativeContainer>
|
|
219
|
+
</Provider.Provider>
|
|
220
|
+
)
|
|
221
|
+
},
|
|
222
|
+
)
|
|
223
|
+
|
|
224
|
+
Select.displayName = 'Select'
|
|
225
|
+
|
|
226
|
+
export default Select
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { ElementOrString } from '../../../../interfaces'
|
|
2
|
+
import { Position } from '../../../AbsoluteContainer/interfaces'
|
|
3
|
+
import { InputProps } from '../Input/interfaces'
|
|
4
|
+
|
|
5
|
+
export interface Data {
|
|
6
|
+
value: string | number
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
interface Option extends Data {
|
|
10
|
+
label: ElementOrString
|
|
11
|
+
onClick?: (index: number, data: Data) => void
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
interface CommonProps
|
|
15
|
+
extends Omit<
|
|
16
|
+
InputProps,
|
|
17
|
+
'type' | 'mask' | 'icon' | 'setValue' | 'name' | 'value'
|
|
18
|
+
> {
|
|
19
|
+
onScrollEnd?: () => Promise<void>
|
|
20
|
+
position?: Position
|
|
21
|
+
disableAutoPosition?: boolean
|
|
22
|
+
search?: (value: string) => Promise<void>
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export interface OneSelectProps extends CommonProps {
|
|
26
|
+
type: 'select'
|
|
27
|
+
options: Option[]
|
|
28
|
+
name?: string
|
|
29
|
+
setValue: (value: string | number) => void
|
|
30
|
+
value?: string | number
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export interface MultSelectProps extends CommonProps {
|
|
34
|
+
type: 'select-multiple'
|
|
35
|
+
options: Option[]
|
|
36
|
+
setValue: (value: (string | number)[]) => void
|
|
37
|
+
value: (string | number)[]
|
|
38
|
+
selectAll?: boolean
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export type SelectProps = OneSelectProps | MultSelectProps
|
|
42
|
+
|
|
43
|
+
export interface ContextInterface {
|
|
44
|
+
props: SelectProps
|
|
45
|
+
open: boolean
|
|
46
|
+
setOpen: React.Dispatch<React.SetStateAction<boolean>>
|
|
47
|
+
checked: (string | number)[]
|
|
48
|
+
setChecked: React.Dispatch<React.SetStateAction<(string | number)[]>>
|
|
49
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import styled, { css } from 'styled-components'
|
|
2
|
+
|
|
3
|
+
export const RelativeContainer = styled.div`
|
|
4
|
+
position: relative;
|
|
5
|
+
`
|
|
6
|
+
export const HeaderContainer = styled.div`
|
|
7
|
+
${({ theme }) => css`
|
|
8
|
+
padding: ${theme.spacings.s3} calc(${theme.spacings.s3} * 0.75)
|
|
9
|
+
${theme.spacings.s1} ${theme.spacings.s3};
|
|
10
|
+
`}
|
|
11
|
+
`
|
|
12
|
+
|
|
13
|
+
export const SelectAllContainer = styled.div`
|
|
14
|
+
margin-bottom: ${({ theme }) => theme.spacings.s1};
|
|
15
|
+
display: flex;
|
|
16
|
+
justify-content: space-between;
|
|
17
|
+
`
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { filterObject } from '../../../../functions/formatters'
|
|
3
|
+
import { SwitchProps } from './interfaces'
|
|
4
|
+
import * as S from './styles'
|
|
5
|
+
|
|
6
|
+
const Switch = (props: SwitchProps) => {
|
|
7
|
+
const { label, disabled, required, invalid } = props
|
|
8
|
+
|
|
9
|
+
const htmlProps = filterObject<
|
|
10
|
+
SwitchProps,
|
|
11
|
+
React.InputHTMLAttributes<HTMLInputElement>
|
|
12
|
+
>(props, ['label', 'invalid', 'required'])
|
|
13
|
+
|
|
14
|
+
return (
|
|
15
|
+
<S.Label
|
|
16
|
+
disabled={disabled ? 1 : 0}
|
|
17
|
+
required={required ? 1 : 0}
|
|
18
|
+
invalid={invalid ? 1 : 0}
|
|
19
|
+
>
|
|
20
|
+
<input {...htmlProps} type='checkbox' />
|
|
21
|
+
<span></span>
|
|
22
|
+
|
|
23
|
+
{label && <S.LabelContainer>{label}</S.LabelContainer>}
|
|
24
|
+
</S.Label>
|
|
25
|
+
)
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export default Switch
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ElementOrString } from '../../../../interfaces'
|
|
2
|
+
|
|
3
|
+
export interface SwitchProps
|
|
4
|
+
extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'type'> {
|
|
5
|
+
label?: ElementOrString
|
|
6
|
+
required?: boolean
|
|
7
|
+
invalid?: boolean
|
|
8
|
+
type: 'switch'
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export interface LabelProps
|
|
12
|
+
extends React.LabelHTMLAttributes<HTMLLabelElement> {
|
|
13
|
+
disabled?: 1 | 0
|
|
14
|
+
required?: 1 | 0
|
|
15
|
+
invalid?: 1 | 0
|
|
16
|
+
}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import styled, { css } from 'styled-components'
|
|
2
|
+
import { LabelProps } from './interfaces'
|
|
3
|
+
|
|
4
|
+
export const LabelContainer = styled.div`
|
|
5
|
+
${({ theme }) => theme.useTypography('p')}
|
|
6
|
+
line-height: 14px;
|
|
7
|
+
display: flex;
|
|
8
|
+
align-items: center;
|
|
9
|
+
`
|
|
10
|
+
|
|
11
|
+
export const Label = styled.label<LabelProps>`
|
|
12
|
+
display: flex;
|
|
13
|
+
gap: ${({ theme }) => theme.spacings.s1};
|
|
14
|
+
position: relative;
|
|
15
|
+
|
|
16
|
+
${({ disabled }) => {
|
|
17
|
+
if (!disabled) {
|
|
18
|
+
return css`
|
|
19
|
+
> span {
|
|
20
|
+
cursor: pointer;
|
|
21
|
+
}
|
|
22
|
+
`
|
|
23
|
+
}
|
|
24
|
+
return css`
|
|
25
|
+
opacity: 0.5;
|
|
26
|
+
`
|
|
27
|
+
}}
|
|
28
|
+
|
|
29
|
+
${({ required }) => {
|
|
30
|
+
if (!required) return
|
|
31
|
+
return css`
|
|
32
|
+
> ${LabelContainer} {
|
|
33
|
+
:after {
|
|
34
|
+
content: '*';
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
`
|
|
38
|
+
}}
|
|
39
|
+
|
|
40
|
+
${({ invalid }) => {
|
|
41
|
+
if (!invalid) {
|
|
42
|
+
return css`
|
|
43
|
+
> span:before {
|
|
44
|
+
border-color: ${({ theme }) => theme.colors.lightGrey};
|
|
45
|
+
}
|
|
46
|
+
> input:checked + span {
|
|
47
|
+
background-color: ${({ theme }) => theme.colors.blue};
|
|
48
|
+
}
|
|
49
|
+
`
|
|
50
|
+
}
|
|
51
|
+
return css`
|
|
52
|
+
> span:before {
|
|
53
|
+
border-color: ${({ theme }) => theme.colors.warningRed};
|
|
54
|
+
}
|
|
55
|
+
> input:checked + span {
|
|
56
|
+
background-color: ${({ theme }) => theme.colors.warningRed};
|
|
57
|
+
}
|
|
58
|
+
`
|
|
59
|
+
}}
|
|
60
|
+
|
|
61
|
+
> input {
|
|
62
|
+
position: absolute;
|
|
63
|
+
height: 0%;
|
|
64
|
+
width: 0%;
|
|
65
|
+
opacity: 0;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
> span {
|
|
69
|
+
position: relative;
|
|
70
|
+
width: 50px;
|
|
71
|
+
height: calc(${({ theme }) => theme.spacings.s4} + 1px);
|
|
72
|
+
background-color: ${({ theme }) => theme.colors.warningGray};
|
|
73
|
+
border-radius: 20px;
|
|
74
|
+
transition-property: background-color;
|
|
75
|
+
transition-duration: 0.4s;
|
|
76
|
+
transition-timing-function: ease-in-out;
|
|
77
|
+
box-sizing: content-box;
|
|
78
|
+
:before {
|
|
79
|
+
content: '';
|
|
80
|
+
transition-property: left;
|
|
81
|
+
transition-duration: 0.4s;
|
|
82
|
+
transition-timing-function: ease-in-out;
|
|
83
|
+
position: absolute;
|
|
84
|
+
border-width: 1px;
|
|
85
|
+
border-style: solid;
|
|
86
|
+
border-radius: 100%;
|
|
87
|
+
left: 0;
|
|
88
|
+
box-shadow: 0px 1px 3px ${({ theme }) => theme.getColor('black', 10)};
|
|
89
|
+
width: calc(${({ theme }) => theme.spacings.s4} - 1px);
|
|
90
|
+
height: calc(${({ theme }) => theme.spacings.s4} - 1px);
|
|
91
|
+
background-color: ${({ theme }) => theme.colors.white};
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
> input:checked + span {
|
|
96
|
+
:before {
|
|
97
|
+
left: calc(100% - ${({ theme }) => theme.spacings.s4} - 1px);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
`
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import Input from '../Input'
|
|
3
|
+
import { TimeProps } from './interfaces'
|
|
4
|
+
|
|
5
|
+
const mask = (v: string, seconds?: boolean) => {
|
|
6
|
+
v = v.replace(/[^0-9\s]/g, '')
|
|
7
|
+
|
|
8
|
+
while (v.length > 0 && parseInt(v[0]) > 2) {
|
|
9
|
+
v = v.substring(1)
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
if (v.length > 1) {
|
|
13
|
+
if (v[0] === '2') {
|
|
14
|
+
while (v.length > 1 && parseInt(v[1]) > 3) {
|
|
15
|
+
v = v[0] + v.substring(2)
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
if (v.length > 2) {
|
|
21
|
+
while (v.length > 2 && parseInt(v[2]) > 5) {
|
|
22
|
+
v = v.substring(0, 2) + v.substring(3)
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
if (v.length > 4) {
|
|
27
|
+
while (v.length > 4 && parseInt(v[4]) > 5) {
|
|
28
|
+
v = v.substring(0, 4) + v.substring(5)
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
v = v.substring(0, seconds ? 6 : 4)
|
|
33
|
+
|
|
34
|
+
if (v.length < 3) return v
|
|
35
|
+
else if (v.length < 5) return v.substring(0, 2) + ':' + v.substring(2)
|
|
36
|
+
else return v.substring(0, 2) + ':' + v.substring(2, 4) + ':' + v.substring(4)
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
const Time = React.forwardRef(
|
|
40
|
+
(props: TimeProps, ref?: React.ForwardedRef<HTMLInputElement>) => {
|
|
41
|
+
const { seconds } = props
|
|
42
|
+
|
|
43
|
+
const _onKeyDown = props.onKeyDown || (() => {})
|
|
44
|
+
|
|
45
|
+
const onKeyDown: React.KeyboardEventHandler<HTMLInputElement> = (event) => {
|
|
46
|
+
const target = event.target as HTMLInputElement
|
|
47
|
+
|
|
48
|
+
const todayDate = new Date()
|
|
49
|
+
|
|
50
|
+
const curH = todayDate.getHours()
|
|
51
|
+
const curM = todayDate.getMinutes()
|
|
52
|
+
const curS = todayDate.getSeconds()
|
|
53
|
+
|
|
54
|
+
const value = target.value.replace(/[^0-9\s]/g, '')
|
|
55
|
+
|
|
56
|
+
let tmp = value.substring(0, 2)
|
|
57
|
+
let h = tmp.length === 0 ? curH : parseInt(tmp.padEnd(2, '0'))
|
|
58
|
+
|
|
59
|
+
tmp = value.substring(2, 4)
|
|
60
|
+
let m = tmp.length === 0 ? curM : parseInt(tmp.padEnd(2, '0'))
|
|
61
|
+
|
|
62
|
+
tmp = value.substring(4, 6)
|
|
63
|
+
let s = tmp.length === 0 ? curS : parseInt(tmp.padEnd(2, '0'))
|
|
64
|
+
|
|
65
|
+
if (event.key === 'ArrowUp') {
|
|
66
|
+
const date = new Date()
|
|
67
|
+
date.setHours(h)
|
|
68
|
+
date.setMinutes(m)
|
|
69
|
+
date.setSeconds(s)
|
|
70
|
+
|
|
71
|
+
if (seconds) {
|
|
72
|
+
date.setSeconds(s + 1)
|
|
73
|
+
|
|
74
|
+
h = date.getHours()
|
|
75
|
+
m = date.getMinutes()
|
|
76
|
+
s = date.getSeconds()
|
|
77
|
+
|
|
78
|
+
target.value = [
|
|
79
|
+
h.toString().padStart(2, '0'),
|
|
80
|
+
m.toString().padStart(2, '0'),
|
|
81
|
+
s.toString().padStart(2, '0'),
|
|
82
|
+
].join(':')
|
|
83
|
+
} else {
|
|
84
|
+
date.setMinutes(m + 1)
|
|
85
|
+
|
|
86
|
+
h = date.getHours()
|
|
87
|
+
m = date.getMinutes()
|
|
88
|
+
s = date.getSeconds()
|
|
89
|
+
|
|
90
|
+
target.value = [
|
|
91
|
+
h.toString().padStart(2, '0'),
|
|
92
|
+
m.toString().padStart(2, '0'),
|
|
93
|
+
].join(':')
|
|
94
|
+
}
|
|
95
|
+
} else if (event.key === 'ArrowDown') {
|
|
96
|
+
const date = new Date()
|
|
97
|
+
date.setHours(h)
|
|
98
|
+
date.setMinutes(m)
|
|
99
|
+
date.setSeconds(s)
|
|
100
|
+
|
|
101
|
+
if (seconds) {
|
|
102
|
+
date.setSeconds(s - 1)
|
|
103
|
+
|
|
104
|
+
h = date.getHours()
|
|
105
|
+
m = date.getMinutes()
|
|
106
|
+
s = date.getSeconds()
|
|
107
|
+
|
|
108
|
+
target.value = [
|
|
109
|
+
h.toString().padStart(2, '0'),
|
|
110
|
+
m.toString().padStart(2, '0'),
|
|
111
|
+
s.toString().padStart(2, '0'),
|
|
112
|
+
].join(':')
|
|
113
|
+
} else {
|
|
114
|
+
date.setMinutes(m - 1)
|
|
115
|
+
|
|
116
|
+
h = date.getHours()
|
|
117
|
+
m = date.getMinutes()
|
|
118
|
+
s = date.getSeconds()
|
|
119
|
+
|
|
120
|
+
target.value = [
|
|
121
|
+
h.toString().padStart(2, '0'),
|
|
122
|
+
m.toString().padStart(2, '0'),
|
|
123
|
+
].join(':')
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
_onKeyDown(event)
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
const placeholder =
|
|
131
|
+
props.placeholder === undefined
|
|
132
|
+
? seconds
|
|
133
|
+
? '––:––:––'
|
|
134
|
+
: '––:––'
|
|
135
|
+
: props.placeholder
|
|
136
|
+
|
|
137
|
+
return (
|
|
138
|
+
<Input
|
|
139
|
+
{...props}
|
|
140
|
+
type='text'
|
|
141
|
+
placeholder={placeholder}
|
|
142
|
+
mask={(v: string) => mask(v, seconds)}
|
|
143
|
+
onKeyDown={onKeyDown}
|
|
144
|
+
ref={ref}
|
|
145
|
+
/>
|
|
146
|
+
)
|
|
147
|
+
},
|
|
148
|
+
)
|
|
149
|
+
|
|
150
|
+
Time.displayName = 'Time'
|
|
151
|
+
|
|
152
|
+
export default Time
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
|
|
3
|
+
import DefaultInput from './components/Input'
|
|
4
|
+
import { InputProps as DefaultInputProps } from './components/Input/interfaces'
|
|
5
|
+
|
|
6
|
+
import Checkbox from './components/Checkbox'
|
|
7
|
+
import { CheckboxProps } from './components/Checkbox/interfaces'
|
|
8
|
+
|
|
9
|
+
import Date from './components/Date'
|
|
10
|
+
import { DateProps } from './components/Date/interfaces'
|
|
11
|
+
|
|
12
|
+
import Time from './components/Time'
|
|
13
|
+
import { TimeProps } from './components/Time/interfaces'
|
|
14
|
+
|
|
15
|
+
import Select from './components/Select'
|
|
16
|
+
import { MultSelectProps, OneSelectProps } from './components/Select/interfaces'
|
|
17
|
+
|
|
18
|
+
import Password from './components/Password'
|
|
19
|
+
import { PasswordProps } from './components/Password/interfaces'
|
|
20
|
+
|
|
21
|
+
import Phone, { getDetails } from './components/Phone'
|
|
22
|
+
import { PhoneProps } from './components/Phone/interfaces'
|
|
23
|
+
|
|
24
|
+
import DatePicker from './components/DatePicker'
|
|
25
|
+
import { DatePickerProps } from './components/DatePicker/interfaces'
|
|
26
|
+
|
|
27
|
+
import { SwitchProps } from './components/Switch/interfaces'
|
|
28
|
+
import Switch from './components/Switch'
|
|
29
|
+
|
|
30
|
+
import Range from './components/Range'
|
|
31
|
+
import { RangeProps } from './components/Range/interfaces'
|
|
32
|
+
|
|
33
|
+
import { RadioButtonProps } from './components/RadioButton/interfaces'
|
|
34
|
+
import RadioButton from './components/RadioButton'
|
|
35
|
+
|
|
36
|
+
export type Props =
|
|
37
|
+
| DateProps
|
|
38
|
+
| TimeProps
|
|
39
|
+
| CheckboxProps
|
|
40
|
+
| OneSelectProps
|
|
41
|
+
| MultSelectProps
|
|
42
|
+
| PasswordProps
|
|
43
|
+
| PhoneProps
|
|
44
|
+
| DatePickerProps
|
|
45
|
+
| RangeProps
|
|
46
|
+
| DefaultInputProps
|
|
47
|
+
| SwitchProps
|
|
48
|
+
| RadioButtonProps
|
|
49
|
+
|
|
50
|
+
const Input = React.forwardRef(
|
|
51
|
+
(props: Props, ref?: React.ForwardedRef<HTMLInputElement>) => {
|
|
52
|
+
switch (props.type) {
|
|
53
|
+
case 'date': {
|
|
54
|
+
return <Date {...props} ref={ref} />
|
|
55
|
+
}
|
|
56
|
+
case 'time': {
|
|
57
|
+
return <Time {...props} ref={ref} />
|
|
58
|
+
}
|
|
59
|
+
case 'checkbox': {
|
|
60
|
+
return <Checkbox {...props} ref={ref} />
|
|
61
|
+
}
|
|
62
|
+
case 'select': {
|
|
63
|
+
return <Select {...props} ref={ref} />
|
|
64
|
+
}
|
|
65
|
+
case 'select-multiple': {
|
|
66
|
+
return <Select {...props} ref={ref} />
|
|
67
|
+
}
|
|
68
|
+
case 'password': {
|
|
69
|
+
return <Password {...props} ref={ref} />
|
|
70
|
+
}
|
|
71
|
+
case 'phone': {
|
|
72
|
+
return <Phone {...props} ref={ref} />
|
|
73
|
+
}
|
|
74
|
+
case 'datepicker': {
|
|
75
|
+
return <DatePicker {...props} ref={ref} />
|
|
76
|
+
}
|
|
77
|
+
case 'range': {
|
|
78
|
+
return <Range {...props} ref={ref} />
|
|
79
|
+
}
|
|
80
|
+
case 'switch': {
|
|
81
|
+
return <Switch {...props} />
|
|
82
|
+
}
|
|
83
|
+
case 'radio': {
|
|
84
|
+
return <RadioButton {...props} />
|
|
85
|
+
}
|
|
86
|
+
default: {
|
|
87
|
+
return <DefaultInput {...props} ref={ref} />
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
)
|
|
92
|
+
|
|
93
|
+
Input.displayName = 'Input'
|
|
94
|
+
|
|
95
|
+
export default Input
|