├── src
├── components
│ ├── kbd
│ │ ├── index.ts
│ │ ├── kbd.tsx
│ │ └── utils.ts
│ ├── slider
│ │ ├── hooks.ts
│ │ ├── index.ts
│ │ ├── steps.tsx
│ │ ├── context.ts
│ │ └── handle.tsx
│ ├── button-group
│ │ ├── index.ts
│ │ └── button-group.tsx
│ ├── guideline
│ │ ├── index.tsx
│ │ └── context.ts
│ ├── fab
│ │ ├── index.ts
│ │ └── context.ts
│ ├── tag
│ │ ├── index.ts
│ │ └── context.ts
│ ├── chat
│ │ ├── index.ts
│ │ └── context.ts
│ ├── icon
│ │ ├── index.ts
│ │ ├── .DS_Store
│ │ ├── icons
│ │ │ ├── file
│ │ │ │ ├── index.tsx
│ │ │ │ └── file-upload.tsx
│ │ │ ├── mock
│ │ │ │ └── index.ts
│ │ │ ├── home
│ │ │ │ └── index.tsx
│ │ │ ├── device
│ │ │ │ ├── index.ts
│ │ │ │ └── dark-mode.tsx
│ │ │ ├── toggle
│ │ │ │ ├── index.ts
│ │ │ │ ├── star.tsx
│ │ │ │ ├── star-half.tsx
│ │ │ │ └── star-outline.tsx
│ │ │ ├── hardware
│ │ │ │ ├── keyboard_backspace.svg
│ │ │ │ ├── start.svg
│ │ │ │ ├── keyboard_return.svg
│ │ │ │ ├── keyboard_control_key.svg
│ │ │ │ ├── keyboard_option_key.svg
│ │ │ │ ├── laptop_chromebook.svg
│ │ │ │ ├── power_input.svg
│ │ │ │ ├── keyboard_tab.svg
│ │ │ │ ├── tablet.svg
│ │ │ │ ├── laptop.svg
│ │ │ │ ├── keyboard_capslock.svg
│ │ │ │ ├── smartphone.svg
│ │ │ │ ├── tv.svg
│ │ │ │ ├── computer.svg
│ │ │ │ ├── monitor.svg
│ │ │ │ ├── desktop_mac.svg
│ │ │ │ ├── dock.svg
│ │ │ │ ├── desktop_windows.svg
│ │ │ │ ├── keyboard_double_arrow_down.svg
│ │ │ │ ├── keyboard_double_arrow_up.svg
│ │ │ │ ├── phone_android.svg
│ │ │ │ ├── security.svg
│ │ │ │ ├── tablet_android.svg
│ │ │ │ ├── device_hub.svg
│ │ │ │ ├── laptop_windows.svg
│ │ │ │ ├── phonelink.svg
│ │ │ │ ├── browser_updated.svg
│ │ │ │ ├── smart_display.svg
│ │ │ │ ├── headphones.svg
│ │ │ │ ├── home_max.svg
│ │ │ │ ├── sim_card.svg
│ │ │ │ ├── developer_board.svg
│ │ │ │ ├── scanner.svg
│ │ │ │ ├── cast.svg
│ │ │ │ ├── home_mini.svg
│ │ │ │ ├── headset_mic.svg
│ │ │ │ ├── memory.svg
│ │ │ │ ├── cast_connected.svg
│ │ │ │ ├── phone_iphone.svg
│ │ │ │ ├── tablet_mac.svg
│ │ │ │ ├── gamepad.svg
│ │ │ │ ├── connected_tv.svg
│ │ │ │ ├── headset.svg
│ │ │ │ ├── keyboard.svg
│ │ │ │ ├── keyboard-arrow-left.tsx
│ │ │ │ ├── keyboard_hide.svg
│ │ │ │ ├── laptop_mac.svg
│ │ │ │ ├── cast_for_education.svg
│ │ │ │ ├── adf_scanner.svg
│ │ │ │ ├── keyboard_alt.svg
│ │ │ │ ├── device_unknown.svg
│ │ │ │ ├── keyboard-arrow-up.tsx
│ │ │ │ ├── keyboard-arrow-right.tsx
│ │ │ │ ├── keyboard-arrow-down.tsx
│ │ │ │ ├── headphones_battery.svg
│ │ │ │ ├── mouse.svg
│ │ │ │ ├── speaker.svg
│ │ │ │ ├── keyboard-double-arrow-right.tsx
│ │ │ │ ├── phonelink_off.svg
│ │ │ │ ├── smart_screen.svg
│ │ │ │ ├── index.ts
│ │ │ │ ├── keyboard-double-arrow-left.tsx
│ │ │ │ ├── keyboard_voice.svg
│ │ │ │ ├── watch.svg
│ │ │ │ ├── router.svg
│ │ │ │ ├── browser_not_supported.svg
│ │ │ │ ├── devices_other.svg
│ │ │ │ ├── speaker_group.svg
│ │ │ │ ├── videogame_asset.svg
│ │ │ │ ├── smart_toy.svg
│ │ │ │ ├── earbuds_battery.svg
│ │ │ │ ├── keyboard_command_key.svg
│ │ │ │ ├── videogame_asset_off.svg
│ │ │ │ ├── headset_off.svg
│ │ │ │ └── developer_board_off.svg
│ │ │ ├── content
│ │ │ │ ├── index.ts
│ │ │ │ ├── clear.tsx
│ │ │ │ ├── redo.tsx
│ │ │ │ ├── undo.tsx
│ │ │ │ ├── font-download.tsx
│ │ │ │ └── link-off.tsx
│ │ │ ├── navigation
│ │ │ │ ├── index.ts
│ │ │ │ ├── menu.tsx
│ │ │ │ ├── check.tsx
│ │ │ │ ├── close.tsx
│ │ │ │ ├── menu-open.tsx
│ │ │ │ ├── unfold-more.tsx
│ │ │ │ ├── more-horiz.tsx
│ │ │ │ └── cancel.tsx
│ │ │ ├── index.ts
│ │ │ ├── alert
│ │ │ │ ├── index.ts
│ │ │ │ ├── warning.tsx
│ │ │ │ ├── error.tsx
│ │ │ │ ├── warning-amber.tsx
│ │ │ │ ├── error-outline.tsx
│ │ │ │ ├── add-alert.tsx
│ │ │ │ ├── notification-important.tsx
│ │ │ │ └── auto-delete.tsx
│ │ │ ├── action
│ │ │ │ ├── swap-horiz.tsx
│ │ │ │ ├── turned-in.tsx
│ │ │ │ ├── swap-vert.tsx
│ │ │ │ ├── code.tsx
│ │ │ │ ├── done.tsx
│ │ │ │ ├── delete.tsx
│ │ │ │ ├── logout.tsx
│ │ │ │ ├── open-in-new.tsx
│ │ │ │ ├── check-circle.tsx
│ │ │ │ ├── done-outline.tsx
│ │ │ │ ├── check-circle-outline.tsx
│ │ │ │ ├── schedule.tsx
│ │ │ │ ├── translate.tsx
│ │ │ │ ├── visibility.tsx
│ │ │ │ ├── preview.tsx
│ │ │ │ └── zoom-out.tsx
│ │ │ ├── editor
│ │ │ │ ├── format-italic.tsx
│ │ │ │ ├── notes.tsx
│ │ │ │ ├── format-strikethrough.tsx
│ │ │ │ ├── format-underlined.tsx
│ │ │ │ ├── index.ts
│ │ │ │ ├── checklist.tsx
│ │ │ │ ├── superscript.tsx
│ │ │ │ ├── insert-link.tsx
│ │ │ │ ├── subscript.tsx
│ │ │ │ ├── attch-file.tsx
│ │ │ │ └── format-bold.tsx
│ │ │ ├── image
│ │ │ │ ├── looks-one.tsx
│ │ │ │ ├── looks-four.tsx
│ │ │ │ ├── index.ts
│ │ │ │ ├── looks-five.tsx
│ │ │ │ ├── looks-two.tsx
│ │ │ │ ├── looks-six.tsx
│ │ │ │ ├── looks-three.tsx
│ │ │ │ ├── edit.tsx
│ │ │ │ └── bedtime.tsx
│ │ │ └── __test__
│ │ │ │ └── index.test.tsx
│ │ ├── context.ts
│ │ └── hoc.ts
│ ├── menu
│ │ ├── index.ts
│ │ └── context.ts
│ ├── rate
│ │ ├── index.ts
│ │ └── context.ts
│ ├── tabs
│ │ ├── index.ts
│ │ └── context.ts
│ ├── tour
│ │ ├── index.ts
│ │ ├── context.ts
│ │ └── hooks.ts
│ ├── tree
│ │ ├── index.ts
│ │ └── context.ts
│ ├── badge
│ │ ├── index.ts
│ │ └── context.ts
│ ├── bench
│ │ ├── index.ts
│ │ └── context.ts
│ ├── button
│ │ ├── index.ts
│ │ └── context.ts
│ ├── clock
│ │ ├── index.ts
│ │ └── context.ts
│ ├── dialog
│ │ ├── index.ts
│ │ └── context.ts
│ ├── drawer
│ │ ├── index.ts
│ │ ├── context.ts
│ │ └── hooks.ts
│ ├── empty
│ │ ├── index.ts
│ │ ├── context.ts
│ │ └── __test__
│ │ │ └── index.test.tsx
│ ├── popper
│ │ ├── index.ts
│ │ ├── context.tsx
│ │ └── popper.tsx
│ ├── portal
│ │ └── index.ts
│ ├── quote
│ │ ├── index.ts
│ │ ├── context.ts
│ │ └── styles.ts
│ ├── select
│ │ ├── index.ts
│ │ └── context.ts
│ ├── space
│ │ ├── index.ts
│ │ └── context.ts
│ ├── steps
│ │ ├── index.ts
│ │ └── context.ts
│ ├── switch
│ │ ├── index.ts
│ │ └── context.ts
│ ├── table
│ │ ├── index.ts
│ │ └── context.ts
│ ├── upload
│ │ ├── index.ts
│ │ ├── utils.ts
│ │ └── context.ts
│ ├── divider
│ │ ├── index.ts
│ │ ├── context.ts
│ │ └── hooks.ts
│ ├── loading
│ │ ├── index.ts
│ │ └── context.ts
│ ├── tooltip
│ │ ├── index.ts
│ │ ├── context.ts
│ │ └── tooltip.tsx
│ ├── cascader
│ │ ├── index.ts
│ │ └── context.ts
│ ├── collapse
│ │ ├── index.ts
│ │ └── context.ts
│ ├── ellipsis
│ │ ├── index.ts
│ │ └── context.ts
│ ├── otp-input
│ │ └── index.ts
│ ├── progress
│ │ ├── index.ts
│ │ ├── context.ts
│ │ └── progress.tsx
│ ├── skeleton
│ │ ├── index.ts
│ │ └── context.ts
│ ├── textarea
│ │ ├── index.tsx
│ │ └── context.ts
│ ├── timeline
│ │ ├── index.ts
│ │ └── context.ts
│ ├── transfer
│ │ ├── index.ts
│ │ └── context.ts
│ ├── countdown
│ │ ├── index.ts
│ │ └── context.ts
│ ├── highlight
│ │ ├── index.ts
│ │ └── context.ts
│ ├── split-panel
│ │ ├── index.ts
│ │ └── context.ts
│ ├── waterfall
│ │ ├── index.ts
│ │ └── context.ts
│ ├── watermark
│ │ └── index.ts
│ ├── breadcrumb
│ │ ├── index.ts
│ │ └── context.ts
│ ├── date-picker
│ │ ├── index.ts
│ │ ├── context.ts
│ │ └── hooks.ts
│ ├── i18n-button
│ │ ├── index.ts
│ │ └── context.ts
│ ├── icon-button
│ │ └── index.ts
│ ├── input
│ │ ├── index.ts
│ │ └── context.ts
│ ├── pagination
│ │ ├── index.ts
│ │ └── context.ts
│ ├── popconfirm
│ │ ├── index.ts
│ │ └── context.ts
│ ├── time-picker
│ │ ├── index.ts
│ │ ├── context.ts
│ │ └── hooks.ts
│ ├── number-input
│ │ ├── index.ts
│ │ ├── hooks.ts
│ │ └── number-input.tsx
│ ├── button-toggle
│ │ ├── index.ts
│ │ ├── context.ts
│ │ ├── button-toggle.tsx
│ │ └── types.ts
│ ├── password-input
│ │ ├── index.ts
│ │ └── context.ts
│ ├── session-storage
│ │ ├── index.tsx
│ │ └── session-storage.tsx
│ ├── visually-hidden
│ │ ├── index.ts
│ │ └── context.ts
│ ├── date-range-picker
│ │ ├── index.ts
│ │ └── context.ts
│ ├── form
│ │ ├── field
│ │ │ ├── index.ts
│ │ │ └── supporting.tsx
│ │ ├── list
│ │ │ ├── context.ts
│ │ │ └── index.tsx
│ │ ├── index.ts
│ │ └── hooks
│ │ │ ├── use-form.ts
│ │ │ └── use-watch.ts
│ ├── ripple
│ │ └── index.ts
│ ├── picker
│ │ ├── index.ts
│ │ └── context.ts
│ ├── grid
│ │ ├── index.ts
│ │ └── context.ts
│ ├── message
│ │ ├── index.ts
│ │ └── messager.ts
│ ├── theme
│ │ ├── index.ts
│ │ └── theme-provider.tsx
│ ├── calendar
│ │ ├── index.ts
│ │ └── context.ts
│ ├── config
│ │ ├── index.ts
│ │ ├── hooks.ts
│ │ ├── context.ts
│ │ └── provider.tsx
│ ├── markdown
│ │ ├── hooks.ts
│ │ └── context.ts
│ ├── popover
│ │ ├── index.ts
│ │ ├── context.ts
│ │ └── hooks.ts
│ ├── radio
│ │ ├── index.ts
│ │ ├── context.ts
│ │ └── group.tsx
│ ├── checkbox
│ │ ├── index.ts
│ │ ├── context.ts
│ │ ├── Indeterminate.tsx
│ │ └── check.tsx
│ ├── avatar
│ │ ├── index.ts
│ │ └── context.ts
│ ├── image
│ │ ├── index.ts
│ │ ├── preview
│ │ │ └── context.ts
│ │ └── context.ts
│ ├── notification
│ │ ├── context.ts
│ │ └── index.ts
│ ├── rich-text-editor
│ │ ├── plugins
│ │ │ ├── editable
│ │ │ │ └── index.tsx
│ │ │ └── markdown-shortcut
│ │ │ │ └── index.tsx
│ │ ├── utils
│ │ │ └── get-element-by-node.tsx
│ │ └── context.ts
│ └── layout
│ │ ├── index.ts
│ │ └── context.ts
├── hooks
│ ├── use-resize-observer.ts
│ ├── use-gutters.ts
│ ├── use-class-names.ts
│ └── use-container.ts
├── locale
│ ├── locales
│ │ └── index.ts
│ ├── context.ts
│ ├── index.ts
│ └── use-locale.ts
├── types
│ ├── slider.ts
│ ├── empty.ts
│ ├── password-input.ts
│ ├── markdown.ts
│ ├── quote.ts
│ ├── highlight.ts
│ ├── visually-hidden.ts
│ ├── date-picker.ts
│ ├── option.ts
│ ├── skeleton.ts
│ ├── number-input.ts
│ ├── element.ts
│ ├── guideline.ts
│ ├── i18n-button.ts
│ ├── ellipsis.ts
│ ├── tooltip.ts
│ ├── date-range-picker.ts
│ ├── countdown.ts
│ ├── kbd.ts
│ ├── message.ts
│ ├── otp-input.ts
│ ├── space.ts
│ ├── portal.ts
│ ├── loading.ts
│ ├── progress.ts
│ ├── badge.ts
│ ├── time-picker.ts
│ ├── ripple.ts
│ ├── waterfall.ts
│ ├── divider.ts
│ ├── popconfirm.ts
│ ├── tag.ts
│ ├── textarea.ts
│ └── clock.ts
├── __test__
│ └── index.test.ts
├── env.d.ts
└── utils
│ ├── keyboard.ts
│ ├── date.ts
│ └── react.ts
├── .npmrc
├── scripts
└── contributors.mjs
├── .gitignore
├── .changeset
├── config.json
└── README.md
├── .storybook
├── preview.ts
└── main.ts
├── jest.config.js
├── stories
├── clock.stories.tsx
├── tooltip.stories.tsx
├── select.stories.ts
├── markdown.stories.ts
├── fab.stories.tsx
├── progress.stories.tsx
├── transfer.stories.ts
├── tabs.stories.ts
├── dialog.stories.ts
├── layout.stories.tsx
└── upload.stories.tsx
├── .github
└── dependabot.yml
└── README.md
/src/components/kbd/index.ts:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/components/slider/hooks.ts:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/components/slider/index.ts:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/components/button-group/index.ts:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/components/guideline/index.tsx:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/.npmrc:
--------------------------------------------------------------------------------
1 | # registry=https://registry.npmmirror.com
2 | git-checks=false
3 |
--------------------------------------------------------------------------------
/src/components/fab/index.ts:
--------------------------------------------------------------------------------
1 | import Fab from "./fab";
2 |
3 | export { Fab };
4 |
--------------------------------------------------------------------------------
/src/components/tag/index.ts:
--------------------------------------------------------------------------------
1 | import Tag from "./tag";
2 |
3 | export { Tag };
4 |
--------------------------------------------------------------------------------
/src/components/chat/index.ts:
--------------------------------------------------------------------------------
1 | import Chat from "./chat";
2 |
3 | export { Chat };
4 |
--------------------------------------------------------------------------------
/src/components/icon/index.ts:
--------------------------------------------------------------------------------
1 | import Icon from "./icon";
2 |
3 | export { Icon };
4 |
--------------------------------------------------------------------------------
/src/components/menu/index.ts:
--------------------------------------------------------------------------------
1 | import Menu from "./menu";
2 |
3 | export { Menu };
4 |
--------------------------------------------------------------------------------
/src/components/rate/index.ts:
--------------------------------------------------------------------------------
1 | import Rate from "./rate";
2 |
3 | export { Rate };
4 |
--------------------------------------------------------------------------------
/src/components/tabs/index.ts:
--------------------------------------------------------------------------------
1 | import Tabs from "./tabs";
2 |
3 | export { Tabs };
4 |
--------------------------------------------------------------------------------
/src/components/tour/index.ts:
--------------------------------------------------------------------------------
1 | import Tour from "./tour";
2 |
3 | export { Tour };
4 |
--------------------------------------------------------------------------------
/src/components/tree/index.ts:
--------------------------------------------------------------------------------
1 | import Tree from "./tree";
2 |
3 | export { Tree };
4 |
--------------------------------------------------------------------------------
/src/components/badge/index.ts:
--------------------------------------------------------------------------------
1 | import Badge from "./badge";
2 |
3 | export { Badge };
4 |
--------------------------------------------------------------------------------
/src/components/bench/index.ts:
--------------------------------------------------------------------------------
1 | import Bench from "./bench";
2 |
3 | export { Bench };
4 |
--------------------------------------------------------------------------------
/src/components/button/index.ts:
--------------------------------------------------------------------------------
1 | import Button from "./button";
2 |
3 | export { Button };
4 |
--------------------------------------------------------------------------------
/src/components/clock/index.ts:
--------------------------------------------------------------------------------
1 | import Clock from "./clock";
2 |
3 | export { Clock };
4 |
--------------------------------------------------------------------------------
/src/components/dialog/index.ts:
--------------------------------------------------------------------------------
1 | import Dialog from "./dialog";
2 |
3 | export { Dialog };
4 |
--------------------------------------------------------------------------------
/src/components/drawer/index.ts:
--------------------------------------------------------------------------------
1 | import Drawer from "./drawer";
2 |
3 | export { Drawer };
4 |
--------------------------------------------------------------------------------
/src/components/empty/index.ts:
--------------------------------------------------------------------------------
1 | import Empty from "./empty";
2 |
3 | export { Empty };
4 |
--------------------------------------------------------------------------------
/src/components/popper/index.ts:
--------------------------------------------------------------------------------
1 | import Popper from "./popper";
2 |
3 | export { Popper };
4 |
--------------------------------------------------------------------------------
/src/components/portal/index.ts:
--------------------------------------------------------------------------------
1 | import Portal from "./portal";
2 |
3 | export { Portal };
4 |
--------------------------------------------------------------------------------
/src/components/quote/index.ts:
--------------------------------------------------------------------------------
1 | import Quote from "./quote";
2 |
3 | export { Quote };
4 |
--------------------------------------------------------------------------------
/src/components/select/index.ts:
--------------------------------------------------------------------------------
1 | import Select from "./select";
2 |
3 | export { Select };
4 |
--------------------------------------------------------------------------------
/src/components/slider/steps.tsx:
--------------------------------------------------------------------------------
1 | const Steps = () => {};
2 |
3 | export default Steps;
4 |
--------------------------------------------------------------------------------
/src/components/space/index.ts:
--------------------------------------------------------------------------------
1 | import Space from "./space";
2 |
3 | export { Space };
4 |
--------------------------------------------------------------------------------
/src/components/steps/index.ts:
--------------------------------------------------------------------------------
1 | import Steps from "./steps";
2 |
3 | export { Steps };
4 |
--------------------------------------------------------------------------------
/src/components/switch/index.ts:
--------------------------------------------------------------------------------
1 | import Switch from "./switch";
2 |
3 | export { Switch };
4 |
--------------------------------------------------------------------------------
/src/components/table/index.ts:
--------------------------------------------------------------------------------
1 | import Table from "./table";
2 |
3 | export { Table };
4 |
--------------------------------------------------------------------------------
/src/components/upload/index.ts:
--------------------------------------------------------------------------------
1 | import Upload from "./upload";
2 |
3 | export { Upload };
4 |
--------------------------------------------------------------------------------
/src/components/divider/index.ts:
--------------------------------------------------------------------------------
1 | import Divider from "./divider";
2 |
3 | export { Divider };
4 |
--------------------------------------------------------------------------------
/src/components/loading/index.ts:
--------------------------------------------------------------------------------
1 | import Loading from "./loading";
2 |
3 | export { Loading };
4 |
--------------------------------------------------------------------------------
/src/components/tooltip/index.ts:
--------------------------------------------------------------------------------
1 | import Tooltip from "./tooltip";
2 |
3 | export { Tooltip };
4 |
--------------------------------------------------------------------------------
/src/components/cascader/index.ts:
--------------------------------------------------------------------------------
1 | import Cascader from "./cascader";
2 |
3 | export { Cascader };
4 |
--------------------------------------------------------------------------------
/src/components/collapse/index.ts:
--------------------------------------------------------------------------------
1 | import Collapse from "./collapse";
2 |
3 | export { Collapse };
4 |
--------------------------------------------------------------------------------
/src/components/ellipsis/index.ts:
--------------------------------------------------------------------------------
1 | import Ellipsis from "./ellipsis";
2 |
3 | export { Ellipsis };
4 |
--------------------------------------------------------------------------------
/src/components/otp-input/index.ts:
--------------------------------------------------------------------------------
1 | import OtpInput from "./otp-input";
2 |
3 | export { OtpInput };
4 |
--------------------------------------------------------------------------------
/src/components/progress/index.ts:
--------------------------------------------------------------------------------
1 | import Progress from "./progress";
2 |
3 | export { Progress };
4 |
--------------------------------------------------------------------------------
/src/components/skeleton/index.ts:
--------------------------------------------------------------------------------
1 | import Skeleton from "./skeleton";
2 |
3 | export { Skeleton };
4 |
--------------------------------------------------------------------------------
/src/components/textarea/index.tsx:
--------------------------------------------------------------------------------
1 | import Textarea from "./textarea";
2 |
3 | export { Textarea };
4 |
--------------------------------------------------------------------------------
/src/components/timeline/index.ts:
--------------------------------------------------------------------------------
1 | import Timeline from "./timeline";
2 |
3 | export { Timeline };
4 |
--------------------------------------------------------------------------------
/src/components/transfer/index.ts:
--------------------------------------------------------------------------------
1 | import Transfer from "./transfer";
2 |
3 | export { Transfer };
4 |
--------------------------------------------------------------------------------
/src/components/countdown/index.ts:
--------------------------------------------------------------------------------
1 | import Countdown from "./countdown";
2 |
3 | export { Countdown };
4 |
--------------------------------------------------------------------------------
/src/components/highlight/index.ts:
--------------------------------------------------------------------------------
1 | import Highlight from "./highlight";
2 |
3 | export { Highlight };
4 |
--------------------------------------------------------------------------------
/src/components/icon/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aiszlab/musae/HEAD/src/components/icon/.DS_Store
--------------------------------------------------------------------------------
/src/components/split-panel/index.ts:
--------------------------------------------------------------------------------
1 | import SplitPanel from './split-panel'
2 |
3 | export { SplitPanel }
--------------------------------------------------------------------------------
/src/components/waterfall/index.ts:
--------------------------------------------------------------------------------
1 | import Waterfall from "./waterfall";
2 |
3 | export { Waterfall };
4 |
--------------------------------------------------------------------------------
/src/components/watermark/index.ts:
--------------------------------------------------------------------------------
1 | import Watermark from "./watermark";
2 |
3 | export { Watermark };
4 |
--------------------------------------------------------------------------------
/scripts/contributors.mjs:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env zx
2 |
3 | import { $ } from "zx";
4 |
5 | await $`git log`.text();
6 |
--------------------------------------------------------------------------------
/src/components/breadcrumb/index.ts:
--------------------------------------------------------------------------------
1 | import Breadcrumb from "./breadcrumb";
2 |
3 | export { Breadcrumb };
4 |
--------------------------------------------------------------------------------
/src/components/date-picker/index.ts:
--------------------------------------------------------------------------------
1 | import DatePicker from "./date-picker";
2 |
3 | export { DatePicker };
4 |
--------------------------------------------------------------------------------
/src/components/i18n-button/index.ts:
--------------------------------------------------------------------------------
1 | import I18nButton from "./i18n-button";
2 |
3 | export { I18nButton };
4 |
--------------------------------------------------------------------------------
/src/components/icon-button/index.ts:
--------------------------------------------------------------------------------
1 | import IconButton from "./icon-button";
2 |
3 | export { IconButton };
4 |
--------------------------------------------------------------------------------
/src/components/input/index.ts:
--------------------------------------------------------------------------------
1 | import Input, { styles } from "./input";
2 |
3 | export { Input, styles };
4 |
--------------------------------------------------------------------------------
/src/components/pagination/index.ts:
--------------------------------------------------------------------------------
1 | import Pagination from "./pagination";
2 |
3 | export { Pagination };
4 |
--------------------------------------------------------------------------------
/src/components/popconfirm/index.ts:
--------------------------------------------------------------------------------
1 | import Popconfirm from "./popconfirm";
2 |
3 | export { Popconfirm };
4 |
--------------------------------------------------------------------------------
/src/components/time-picker/index.ts:
--------------------------------------------------------------------------------
1 | import TimePicker from "./time-picker";
2 |
3 | export { TimePicker };
4 |
--------------------------------------------------------------------------------
/src/components/button-group/button-group.tsx:
--------------------------------------------------------------------------------
1 | const ButtonGroup = () => {};
2 |
3 | export default ButtonGroup;
4 |
--------------------------------------------------------------------------------
/src/components/icon/icons/file/index.tsx:
--------------------------------------------------------------------------------
1 | import FileUpload from "./file-upload";
2 |
3 | export { FileUpload };
4 |
--------------------------------------------------------------------------------
/src/components/number-input/index.ts:
--------------------------------------------------------------------------------
1 | import NumberInput from "./number-input";
2 |
3 | export { NumberInput };
4 |
--------------------------------------------------------------------------------
/src/hooks/use-resize-observer.ts:
--------------------------------------------------------------------------------
1 | const useResizeObserver = () => {
2 |
3 | }
4 |
5 | export { useResizeObserver }
--------------------------------------------------------------------------------
/src/components/button-toggle/index.ts:
--------------------------------------------------------------------------------
1 | import ButtonToggle from "./button-toggle";
2 |
3 | export { ButtonToggle };
4 |
--------------------------------------------------------------------------------
/src/components/password-input/index.ts:
--------------------------------------------------------------------------------
1 | import PasswordInput from "./password-input";
2 |
3 | export { PasswordInput };
4 |
--------------------------------------------------------------------------------
/src/components/session-storage/index.tsx:
--------------------------------------------------------------------------------
1 | import SessionStorage from "./session-storage";
2 |
3 | export { SessionStorage };
4 |
--------------------------------------------------------------------------------
/src/components/visually-hidden/index.ts:
--------------------------------------------------------------------------------
1 | import VisuallyHidden from "./visually-hidden";
2 |
3 | export { VisuallyHidden };
4 |
--------------------------------------------------------------------------------
/src/locale/locales/index.ts:
--------------------------------------------------------------------------------
1 | import en_US from "./en_US";
2 | import zh_CN from "./zh_CN";
3 |
4 | export { en_US, zh_CN };
5 |
--------------------------------------------------------------------------------
/src/components/button-toggle/context.ts:
--------------------------------------------------------------------------------
1 | import { createContext } from "react";
2 |
3 | export const Context = createContext({});
4 |
--------------------------------------------------------------------------------
/src/components/date-range-picker/index.ts:
--------------------------------------------------------------------------------
1 | import DateRangePicker from "./date-range-picker";
2 |
3 | export { DateRangePicker };
4 |
--------------------------------------------------------------------------------
/src/components/form/field/index.ts:
--------------------------------------------------------------------------------
1 | import Field from "./field";
2 | import Layout from "./layout";
3 |
4 | export { Field, Layout };
5 |
--------------------------------------------------------------------------------
/src/components/ripple/index.ts:
--------------------------------------------------------------------------------
1 | import Ripple from "./ripple";
2 |
3 | export { Ripple };
4 | export { useRipple } from "./hooks";
5 |
--------------------------------------------------------------------------------
/src/components/fab/context.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * @description
3 | * class names
4 | */
5 | export const CLASS_NAMES = {
6 | fab: "fab",
7 | };
8 |
--------------------------------------------------------------------------------
/src/components/picker/index.ts:
--------------------------------------------------------------------------------
1 | import Picker from "./picker";
2 | import { Context } from "./context";
3 |
4 | export { Picker, Context };
5 |
--------------------------------------------------------------------------------
/src/components/tag/context.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * @description
3 | * class names
4 | */
5 | export const CLASS_NAMES = {
6 | tag: "tag",
7 | };
8 |
--------------------------------------------------------------------------------
/src/components/grid/index.ts:
--------------------------------------------------------------------------------
1 | import Row from "./row";
2 | import Col from "./col";
3 |
4 | export const Grid = {
5 | Row,
6 | Col,
7 | };
8 |
--------------------------------------------------------------------------------
/src/components/icon/context.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * @description
3 | * class names
4 | */
5 | export const CLASS_NAMES = {
6 | icon: "icon",
7 | };
8 |
--------------------------------------------------------------------------------
/src/components/icon/icons/mock/index.ts:
--------------------------------------------------------------------------------
1 | import Github from "./github";
2 | import Loading from "./loading";
3 |
4 | export { Github, Loading };
5 |
--------------------------------------------------------------------------------
/src/components/ellipsis/context.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * @description class names
3 | */
4 | export const CLASS_NAMES = {
5 | ellipsis: "ellipsis",
6 | };
7 |
--------------------------------------------------------------------------------
/src/components/message/index.ts:
--------------------------------------------------------------------------------
1 | import { useMessage } from "./hooks";
2 | import Message from "./messager";
3 |
4 | export { useMessage, Message };
5 |
--------------------------------------------------------------------------------
/src/components/select/context.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * @description
3 | * class names
4 | */
5 | export const CLASS_NAMES = {
6 | select: "select",
7 | };
8 |
--------------------------------------------------------------------------------
/src/components/skeleton/context.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * @description
3 | * class names
4 | */
5 | export const CLASS_NAMES = {
6 | skeleton: "skeleton",
7 | };
8 |
--------------------------------------------------------------------------------
/src/components/countdown/context.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * @description
3 | * class names
4 | */
5 | export const CLASS_NAMES = {
6 | countdown: "countdown",
7 | };
8 |
--------------------------------------------------------------------------------
/src/components/icon/icons/home/index.tsx:
--------------------------------------------------------------------------------
1 | import WindPower from "./wind-power";
2 | import SmartToy from "./smart-toy";
3 |
4 | export { WindPower, SmartToy };
5 |
--------------------------------------------------------------------------------
/src/components/i18n-button/context.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * @description
3 | * class names
4 | */
5 | export const CLASS_NAMES = {
6 | i18nButton: "i18n-button",
7 | };
8 |
--------------------------------------------------------------------------------
/src/components/icon/icons/device/index.ts:
--------------------------------------------------------------------------------
1 | import DarkMode from "./dark-mode";
2 | import LightMode from "./light-mode";
3 |
4 | export { DarkMode, LightMode };
5 |
--------------------------------------------------------------------------------
/src/components/theme/index.ts:
--------------------------------------------------------------------------------
1 | import ThemeProvider from "./theme-provider";
2 | import { useTheme } from "./hooks";
3 |
4 | export { ThemeProvider, useTheme };
5 |
--------------------------------------------------------------------------------
/src/components/badge/context.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * @description
3 | * class names
4 | */
5 | export const CLASS_NAMES = {
6 | badge: "badge",
7 | tail: "badge__tail",
8 | };
9 |
--------------------------------------------------------------------------------
/src/components/calendar/index.ts:
--------------------------------------------------------------------------------
1 | import Calendar from "./calendar";
2 | import ContributionCalendar from "./contribution";
3 |
4 | export { Calendar, ContributionCalendar };
5 |
--------------------------------------------------------------------------------
/src/components/config/index.ts:
--------------------------------------------------------------------------------
1 | import ConfigProvider from "./provider";
2 | import { useConfiguration } from "./hooks";
3 |
4 | export { ConfigProvider, useConfiguration };
5 |
--------------------------------------------------------------------------------
/src/components/markdown/hooks.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * @description in client side
3 | * use @lexical packages to convert md into html
4 | */
5 | export const useMarkdown = () => {};
6 |
--------------------------------------------------------------------------------
/src/types/slider.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * @description 滑块轨道`Props`
3 | */
4 | export interface TrackProps {
5 | /**
6 | * @description 大小
7 | */
8 | size?: number;
9 | }
10 |
--------------------------------------------------------------------------------
/src/components/button-toggle/button-toggle.tsx:
--------------------------------------------------------------------------------
1 | import React from "react";
2 |
3 | const ButtonToggle = () => {
4 | return
;
5 | };
6 |
7 | export default ButtonToggle;
8 |
--------------------------------------------------------------------------------
/src/components/quote/context.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * @description
3 | * class names
4 | */
5 | const CLASS_NAMES = {
6 | quote: "quote",
7 | };
8 |
9 | export { CLASS_NAMES };
10 |
--------------------------------------------------------------------------------
/src/components/space/context.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * @description
3 | * class names
4 | */
5 | const CLASS_NAMES = {
6 | space: "space",
7 | };
8 |
9 | export { CLASS_NAMES };
10 |
--------------------------------------------------------------------------------
/src/types/empty.ts:
--------------------------------------------------------------------------------
1 | import { ComponentProps } from "./element";
2 |
3 | /**
4 | * @description
5 | * empty props
6 | */
7 | export interface EmptyProps extends ComponentProps {}
8 |
--------------------------------------------------------------------------------
/src/components/textarea/context.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * @description
3 | * class names
4 | */
5 | export const CLASS_NAMES = {
6 | textarea: "textarea",
7 | input: "textarea__input",
8 | };
9 |
--------------------------------------------------------------------------------
/src/components/tooltip/context.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * @description
3 | * class names
4 | */
5 | const CLASS_NAMES = {
6 | tooltip: "tooltip",
7 | };
8 |
9 | export { CLASS_NAMES };
10 |
--------------------------------------------------------------------------------
/src/__test__/index.test.ts:
--------------------------------------------------------------------------------
1 | import * as Musae from "../index";
2 |
3 | describe("`Musae` Entry", () => {
4 | test("without src", () => {
5 | expect(Musae).not.toBeNull();
6 | });
7 | });
8 |
--------------------------------------------------------------------------------
/src/components/date-picker/context.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * @description
3 | * class names
4 | */
5 | export const CLASS_NAMES = {
6 | picker: "date-picker",
7 | input: "date-picker__input",
8 | };
9 |
--------------------------------------------------------------------------------
/src/components/divider/context.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * @description
3 | * class names
4 | */
5 | export const CLASS_NAMES = {
6 | divider: "divider",
7 | label: "divider__label",
8 | } as const;
9 |
--------------------------------------------------------------------------------
/src/components/empty/context.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * @description
3 | * class name
4 | */
5 | export const CLASS_NAMES = {
6 | empty: "empty",
7 | description: "empty__description",
8 | } as const;
9 |
--------------------------------------------------------------------------------
/src/env.d.ts:
--------------------------------------------------------------------------------
1 | declare module "react" {
2 | interface CSSProperties {
3 | // 允许`CSS`自定义变量
4 | [$$Key$$: `--${string}`]: string | number | undefined;
5 | }
6 | }
7 |
8 | export {};
9 |
--------------------------------------------------------------------------------
/src/components/cascader/context.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * @description
3 | * class names
4 | */
5 | export const CLASS_NAMES = {
6 | cascader: "cascader",
7 | options: "cascader__options",
8 | } as const;
9 |
--------------------------------------------------------------------------------
/src/components/waterfall/context.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * @description
3 | * class names
4 | */
5 | export const CLASS_NAMES = {
6 | waterfall: "waterfall",
7 | sequential: "waterfall--sequential",
8 | };
9 |
--------------------------------------------------------------------------------
/src/components/icon/icons/toggle/index.ts:
--------------------------------------------------------------------------------
1 | import Star from "./star";
2 | import StarHalf from "./star-half";
3 | import StarOutline from "./star-outline";
4 |
5 | export { Star, StarHalf, StarOutline };
6 |
--------------------------------------------------------------------------------
/src/components/password-input/context.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * @description
3 | * class names
4 | */
5 | const CLASS_NAMES = {
6 | passwordInput: "password-input",
7 | };
8 |
9 | export { CLASS_NAMES };
10 |
--------------------------------------------------------------------------------
/src/components/popper/context.tsx:
--------------------------------------------------------------------------------
1 | /**
2 | * @description
3 | * class names
4 | */
5 | export const CLASS_NAMES = {
6 | popper: "popper",
7 | dropdown: "dropdown",
8 | arrow: "arrow",
9 | };
10 |
--------------------------------------------------------------------------------
/src/components/visually-hidden/context.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * @description
3 | * class names
4 | */
5 | const CLASS_NAMES = {
6 | visuallyHidden: "visually-hidden",
7 | };
8 |
9 | export { CLASS_NAMES };
10 |
--------------------------------------------------------------------------------
/src/components/popover/index.ts:
--------------------------------------------------------------------------------
1 | import Popover from "./popover";
2 | import type { PopoverProps, PopoverRef } from "../../types/popover";
3 |
4 | export { Popover };
5 | export type { PopoverProps, PopoverRef };
6 |
--------------------------------------------------------------------------------
/src/types/password-input.ts:
--------------------------------------------------------------------------------
1 | import { InputProps } from "./input";
2 |
3 | /**
4 | * @description
5 | * password input props
6 | */
7 | export type PasswordInputProps = Omit;
8 |
--------------------------------------------------------------------------------
/src/components/button/context.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * @description
3 | * class names
4 | */
5 | const CLASS_NAMES = {
6 | button: "button",
7 | leading: "button__leading",
8 | };
9 |
10 | export { CLASS_NAMES };
11 |
--------------------------------------------------------------------------------
/src/locale/context.ts:
--------------------------------------------------------------------------------
1 | import { type Locale } from "../types/locale";
2 | import { createContext } from "react";
3 | import locale from "./locales/en_US";
4 |
5 | export const LocaleContext = createContext(locale);
6 |
--------------------------------------------------------------------------------
/src/locale/index.ts:
--------------------------------------------------------------------------------
1 | import { LocaleContext } from "./context";
2 | import { useLocale } from "./use-locale";
3 | import DEFAULT_LOCALE from "./locales/zh_CN";
4 |
5 | export { LocaleContext, useLocale, DEFAULT_LOCALE };
6 |
--------------------------------------------------------------------------------
/src/components/popover/context.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * @description
3 | * class names
4 | */
5 | export const CLASS_NAMES = {
6 | popover: "popover",
7 | title: "popover__title",
8 | content: "popover__content",
9 | };
10 |
--------------------------------------------------------------------------------
/src/components/highlight/context.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * @description
3 | * class names
4 | */
5 | const CLASS_NAMES = {
6 | highlight: "highlight",
7 | capture: "highlight__capture",
8 | };
9 |
10 | export { CLASS_NAMES };
11 |
--------------------------------------------------------------------------------
/src/components/radio/index.ts:
--------------------------------------------------------------------------------
1 | import _Radio from "./radio";
2 | import Group from "./group";
3 | import type { TypedRadio } from "../../types/radio";
4 |
5 | export const Radio: TypedRadio = Object.assign(_Radio, {
6 | Group,
7 | });
8 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # build output
2 | dist
3 |
4 | # package manager
5 | node_modules
6 | node-compile-cache
7 |
8 | # editor
9 | .idea
10 | .vscode
11 |
12 | # unit test
13 | coverage
14 |
15 | *storybook.log
16 |
17 | storybook-static
18 |
--------------------------------------------------------------------------------
/src/components/pagination/context.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * @description
3 | * class names
4 | */
5 | const CLASS_NAMES = {
6 | pagination: "pagination",
7 | sizeSelector: "pagination__size-selector",
8 | };
9 |
10 | export { CLASS_NAMES };
11 |
--------------------------------------------------------------------------------
/src/components/checkbox/index.ts:
--------------------------------------------------------------------------------
1 | import _Checkbox from "./checkbox";
2 | import Group from "./group";
3 | import styles from "./styles";
4 |
5 | export const Checkbox = Object.assign(_Checkbox, {
6 | Group,
7 | });
8 |
9 | export { styles };
10 |
--------------------------------------------------------------------------------
/src/components/icon/icons/hardware/keyboard_backspace.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/components/config/hooks.ts:
--------------------------------------------------------------------------------
1 | import { useContext } from "react";
2 | import Context from "./context";
3 |
4 | /**
5 | * @description
6 | * configuration
7 | */
8 | export const useConfiguration = () => {
9 | return useContext(Context);
10 | };
11 |
--------------------------------------------------------------------------------
/src/components/loading/context.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * @description
3 | * class names
4 | */
5 | export const CLASS_NAMES = {
6 | loading: "loading",
7 | spin: "loading__spin",
8 | spinning: "loading__spin-spinning",
9 | content: "loading__content",
10 | };
11 |
--------------------------------------------------------------------------------
/src/components/input/context.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * @description
3 | * class names
4 | */
5 | export const CLASS_NAMES = {
6 | inputor: "input__inputor",
7 | input: "input",
8 | focused: "input__inputor--focused",
9 | invalid: "input__inputor--invalid",
10 | };
11 |
--------------------------------------------------------------------------------
/src/components/avatar/index.ts:
--------------------------------------------------------------------------------
1 | import _Avatar from "./avatar";
2 | import Group from "./group";
3 | import type { TypedAvatar } from "../../types/avatar";
4 |
5 | const Avatar: TypedAvatar = Object.assign(_Avatar, {
6 | Group,
7 | });
8 |
9 | export { Avatar };
10 |
--------------------------------------------------------------------------------
/src/components/button-toggle/types.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * @description
3 | * button toggle props
4 | */
5 | export type ButtonToggleProps = {};
6 |
7 | /**
8 | * @description
9 | * context value
10 | */
11 | export type ContextValue = {
12 | selected: unknown;
13 | };
14 |
--------------------------------------------------------------------------------
/src/components/date-range-picker/context.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * @description
3 | * class names
4 | */
5 | export const CLASS_NAMES = {
6 | picker: "date-range-picker",
7 | input: "date-range-picker__input",
8 | separator: "date-range-picker__separator",
9 | } as const;
10 |
--------------------------------------------------------------------------------
/src/components/icon/icons/hardware/start.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/types/markdown.ts:
--------------------------------------------------------------------------------
1 | import { ComponentProps } from "./element";
2 |
3 | /**
4 | * @description
5 | * markdown props
6 | */
7 | export type MarkdownProps = ComponentProps & {
8 | /**
9 | * @description
10 | * value
11 | */
12 | value: string;
13 | };
14 |
--------------------------------------------------------------------------------
/src/components/config/context.ts:
--------------------------------------------------------------------------------
1 | import { createContext } from "react";
2 | import type { ContextValue } from "../../types/config";
3 |
4 | const Context = createContext({
5 | notifier: null,
6 | prefix: "musae",
7 | });
8 |
9 | export default Context;
10 |
--------------------------------------------------------------------------------
/src/components/guideline/context.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * @description
3 | * class names
4 | */
5 | export const CLASS_NAMES = {
6 | guideline: "guideline",
7 | figure: "guideline__figure",
8 | label: "guideline__caption-label",
9 | caption: "guideline__caption",
10 | };
11 |
--------------------------------------------------------------------------------
/src/components/icon/icons/content/index.ts:
--------------------------------------------------------------------------------
1 | import Clear from "./clear";
2 | import Redo from "./redo";
3 | import Undo from "./undo";
4 | import LinkOff from "./link-off";
5 | import FontDownload from "./font-download";
6 |
7 | export { Clear, Redo, Undo, LinkOff, FontDownload };
8 |
--------------------------------------------------------------------------------
/src/components/icon/icons/hardware/keyboard_return.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/components/image/index.ts:
--------------------------------------------------------------------------------
1 | import _Image from "./image";
2 | import type { TypedImage } from "../../types/image";
3 | import Group from "./preview/group";
4 |
5 | const Image = Object.assign(_Image, {
6 | Group,
7 | }) satisfies TypedImage;
8 |
9 | export { Image };
10 |
--------------------------------------------------------------------------------
/src/types/quote.ts:
--------------------------------------------------------------------------------
1 | import type { ComponentProps } from "./element";
2 |
3 | /**
4 | * @description
5 | * quote props
6 | */
7 | export type QuoteProps = ComponentProps & {
8 | /**
9 | * @description
10 | * children
11 | */
12 | children?: string;
13 | };
14 |
--------------------------------------------------------------------------------
/src/components/icon/icons/hardware/keyboard_control_key.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/components/icon/icons/hardware/keyboard_option_key.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/components/image/preview/context.ts:
--------------------------------------------------------------------------------
1 | import { createContext } from "react";
2 | import type { PreviewGroupContextValue } from "../../../types/image";
3 |
4 | const PreviewGroupContext = createContext(null);
5 |
6 | export default PreviewGroupContext;
7 |
--------------------------------------------------------------------------------
/src/components/drawer/context.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * @description
3 | * class names
4 | */
5 | export const CLASS_NAMES = {
6 | drawer: "drawer",
7 | overlay: "drawer__overlay",
8 | panel: "drawer__panel",
9 | header: "drawer__header",
10 | body: "drawer__body",
11 | } as const;
12 |
--------------------------------------------------------------------------------
/src/components/icon/icons/hardware/laptop_chromebook.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/components/notification/context.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * @description
3 | * class names
4 | */
5 | export const CLASS_NAMES = {
6 | notification: "notification",
7 | title: "notification__title",
8 | description: "notification__description",
9 | closer: "notification__closer",
10 | };
11 |
--------------------------------------------------------------------------------
/src/components/icon/icons/hardware/power_input.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/utils/keyboard.ts:
--------------------------------------------------------------------------------
1 | export enum Keyboard {
2 | Escape = "Escape",
3 | Backspace = "Backspace",
4 | Delete = "Delete",
5 | Space = " ",
6 | ArrowLeft = "ArrowLeft",
7 | ArrowRight = "ArrowRight",
8 | ArrowUp = "ArrowUp",
9 | ArrowDown = "ArrowDown",
10 | Enter= 'Enter'
11 | }
12 |
--------------------------------------------------------------------------------
/src/components/icon/icons/hardware/keyboard_tab.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/types/highlight.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * @description
3 | * highlight props
4 | */
5 | export type HighlightProps = {
6 | /**
7 | * @description
8 | * children
9 | */
10 | children: string;
11 |
12 | /**
13 | * @description
14 | * capture
15 | */
16 | capture?: string | RegExp;
17 | };
18 |
--------------------------------------------------------------------------------
/src/components/icon/icons/hardware/tablet.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/components/clock/context.ts:
--------------------------------------------------------------------------------
1 | import { createContext } from "react";
2 |
3 | /**
4 | * @description
5 | * class names
6 | */
7 | export const CLASS_NAMES = {
8 | clock: "clock",
9 | column: "clock__column",
10 | };
11 |
12 | export const Context = createContext({
13 | classNames: CLASS_NAMES,
14 | });
15 |
--------------------------------------------------------------------------------
/src/components/icon/icons/hardware/laptop.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/components/icon/icons/hardware/keyboard_capslock.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/components/icon/icons/hardware/smartphone.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/components/icon/icons/hardware/tv.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/types/visually-hidden.ts:
--------------------------------------------------------------------------------
1 | import type { DOMAttributes, ReactNode } from "react";
2 |
3 | /**
4 | * @description
5 | * visually hidden props
6 | */
7 | export type VisuallyHiddenProps = DOMAttributes & {
8 | /**
9 | * @description
10 | * children
11 | */
12 | children?: ReactNode;
13 | };
14 |
--------------------------------------------------------------------------------
/src/components/icon/icons/hardware/computer.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/components/icon/icons/hardware/monitor.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/components/radio/context.ts:
--------------------------------------------------------------------------------
1 | import { createContext } from "react";
2 | import type { ContextValue } from "../../types/radio";
3 |
4 | /**
5 | * @description
6 | * class name
7 | */
8 | export const CLASS_NAMES = {
9 | radio: "radio",
10 | };
11 |
12 | export const Context = createContext(null);
13 |
--------------------------------------------------------------------------------
/src/components/icon/icons/hardware/desktop_mac.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/components/icon/icons/hardware/dock.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/.changeset/config.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "https://unpkg.com/@changesets/config@3.0.1/schema.json",
3 | "changelog": "@changesets/cli/changelog",
4 | "commit": false,
5 | "fixed": [],
6 | "linked": [],
7 | "access": "restricted",
8 | "baseBranch": "main",
9 | "updateInternalDependencies": "patch",
10 | "ignore": []
11 | }
12 |
--------------------------------------------------------------------------------
/src/components/icon/icons/hardware/desktop_windows.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/components/icon/icons/hardware/keyboard_double_arrow_down.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/components/icon/icons/hardware/keyboard_double_arrow_up.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/components/icon/icons/hardware/phone_android.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/components/icon/icons/hardware/security.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/components/rich-text-editor/plugins/editable/index.tsx:
--------------------------------------------------------------------------------
1 | interface Props {
2 | isEditable: boolean;
3 | }
4 |
5 | /**
6 | * @description
7 | * editable plugin
8 | */
9 | const EditablePlugin = ({ isEditable }: Props) => {
10 | if (isEditable) return null;
11 | return null;
12 | };
13 |
14 | export default EditablePlugin;
15 |
--------------------------------------------------------------------------------
/src/components/popconfirm/context.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * @description
3 | * class names
4 | */
5 | const CLASS_NAMES = {
6 | popconfirm: "popconfirm",
7 | leading: "popconfirm__leading",
8 | title: "popconfirm__title",
9 | description: "popconfirm__description",
10 | footer: "popconfirm__footer",
11 | };
12 |
13 | export { CLASS_NAMES };
14 |
--------------------------------------------------------------------------------
/src/components/switch/context.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * @description
3 | * class names
4 | */
5 | const CLASS_NAMES = {
6 | switch: "switch",
7 | slider: "switch__slider",
8 | supporting: "switch__supporting",
9 | leading: "switch__supporting-leading",
10 | trailing: "switch__supporting-trailing",
11 | };
12 |
13 | export { CLASS_NAMES };
14 |
--------------------------------------------------------------------------------
/src/components/upload/utils.ts:
--------------------------------------------------------------------------------
1 | import type { FileItem, RemoteFileItem, UploadedItem } from "../../types/upload";
2 |
3 | /**
4 | * @description
5 | * check current value is provided by user
6 | */
7 | export const isRemoteFile = (file: FileItem): file is RemoteFileItem => {
8 | return !file.key || !(file as UploadedItem).file;
9 | };
10 |
--------------------------------------------------------------------------------
/src/components/icon/icons/hardware/tablet_android.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/components/icon/icons/hardware/device_hub.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/.storybook/preview.ts:
--------------------------------------------------------------------------------
1 | import type { Preview } from "@storybook/react-vite";
2 | import "../dist/styles.css";
3 |
4 | const preview: Preview = {
5 | parameters: {
6 | controls: {
7 | matchers: {
8 | color: /(background|color)$/i,
9 | date: /Date$/i,
10 | },
11 | },
12 | },
13 | };
14 |
15 | export default preview;
16 |
--------------------------------------------------------------------------------
/jest.config.js:
--------------------------------------------------------------------------------
1 | /**
2 | * @returns {Promise}
3 | */
4 | const config = async () => {
5 | return {
6 | testEnvironment: "jsdom",
7 | transformIgnorePatterns: ["node_modules/(?!(.pnpm|@aiszlab/relax)/)"],
8 | transform: {
9 | "\\.[jt]sx?$": "babel-jest",
10 | },
11 | };
12 | };
13 |
14 | export default config;
15 |
--------------------------------------------------------------------------------
/src/utils/date.ts:
--------------------------------------------------------------------------------
1 | import type { Dayjs } from "dayjs";
2 |
3 | /**
4 | * @description
5 | * get first sunday of the month
6 | */
7 | export const firstSundayInMonth = (date: Dayjs) => {
8 | const _from = date.startOf("month");
9 |
10 | if (_from.day() === 0) {
11 | return _from;
12 | }
13 |
14 | return _from.startOf("week").add(1, "week");
15 | };
16 |
--------------------------------------------------------------------------------
/src/components/breadcrumb/context.ts:
--------------------------------------------------------------------------------
1 | import { createContext } from "react";
2 |
3 | /**
4 | * @description
5 | * class names
6 | */
7 | export const CLASS_NAMES = {
8 | breadcrumb: "breadcrumb",
9 | item: "breadcrumb__item",
10 | separator: "breadcrumb__separator",
11 | };
12 |
13 | export const Context = createContext({
14 | classNames: CLASS_NAMES,
15 | });
16 |
--------------------------------------------------------------------------------
/src/components/icon/icons/hardware/laptop_windows.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/components/icon/icons/hardware/phonelink.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/components/notification/index.ts:
--------------------------------------------------------------------------------
1 | import type { HolderRef, Notifier, Type, NotificationConfig } from "../../types/notification";
2 | import Holder from "./holder";
3 | import { useNotification } from "./hooks";
4 | import Notification from "./notifier";
5 |
6 | export type { HolderRef, Notifier, Type, NotificationConfig };
7 | export { Holder, useNotification, Notification };
8 |
--------------------------------------------------------------------------------
/src/components/progress/context.ts:
--------------------------------------------------------------------------------
1 | import { createContext } from "react";
2 |
3 | /**
4 | * @description
5 | * class names
6 | */
7 | const CLASS_NAMES = {
8 | progress: "progress",
9 | segment: "progress__segment",
10 | };
11 |
12 | const Context = createContext({
13 | classNames: CLASS_NAMES,
14 | });
15 |
16 | export default Context;
17 | export { CLASS_NAMES };
18 |
--------------------------------------------------------------------------------
/src/components/rich-text-editor/utils/get-element-by-node.tsx:
--------------------------------------------------------------------------------
1 | import { type LexicalNode, type LexicalEditor } from "lexical";
2 |
3 | export function getElementByNode(
4 | editor: LexicalEditor,
5 | node?: LexicalNode | null,
6 | ): HTMLElement | null {
7 | if (!node) return null;
8 | const key = node.getKey();
9 | return editor._keyToDOMMap.get(key) ?? null;
10 | }
11 |
--------------------------------------------------------------------------------
/src/components/drawer/hooks.ts:
--------------------------------------------------------------------------------
1 | import type { Placement } from "../../types/drawer";
2 |
3 | export const PLACEMENTS: Record = {
4 | right: ["translateX(100%)", "translateX(0)"],
5 | left: ["translateX(-100%)", "translateX(0)"],
6 | bottom: ["translateY(100%)", "translateY(0)"],
7 | top: ["translateY(-100%)", "translateY(0)"],
8 | };
9 |
--------------------------------------------------------------------------------
/src/components/icon/icons/hardware/browser_updated.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/components/icon/icons/navigation/index.ts:
--------------------------------------------------------------------------------
1 | import Cancel from "./cancel";
2 | import MoreHoriz from "./more-horiz";
3 | import Close from "./close";
4 | import Check from "./check";
5 | import UnfoldMore from "./unfold-more";
6 | import MenuOpen from "./menu-open";
7 | import Menu from "./menu";
8 |
9 | export { Cancel, Close, MoreHoriz, Check, UnfoldMore, MenuOpen, Menu };
10 |
--------------------------------------------------------------------------------
/src/components/icon/icons/hardware/smart_display.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/components/icon/icons/hardware/headphones.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/components/icon/icons/index.ts:
--------------------------------------------------------------------------------
1 | export * from "./action";
2 | export * from "./alert";
3 | export * from "./content";
4 | export * from "./hardware";
5 | export * from "./navigation";
6 | export * from "./image";
7 | export * from "./toggle";
8 | export * from "./editor";
9 | export * from "./mock";
10 | export * from "./home";
11 | export * from "./device";
12 | export * from "./file";
13 |
--------------------------------------------------------------------------------
/src/components/grid/context.ts:
--------------------------------------------------------------------------------
1 | import { createContext } from "react";
2 |
3 | /**
4 | * @description
5 | * class names
6 | */
7 | export const CLASS_NAMES = {
8 | row: "grid__row",
9 | col: "grid__col",
10 | };
11 |
12 | /**
13 | * Grid Span
14 | */
15 | export const SPANS = 24;
16 |
17 | export const Context = createContext({
18 | classNames: CLASS_NAMES,
19 | });
20 |
--------------------------------------------------------------------------------
/src/components/icon/icons/hardware/home_max.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/.storybook/main.ts:
--------------------------------------------------------------------------------
1 | import type { StorybookConfig } from "@storybook/react-vite";
2 |
3 | const config: StorybookConfig = {
4 | stories: ["../stories/**/*.mdx", "../stories/**/*.stories.@(js|jsx|mjs|ts|tsx)"],
5 | addons: ["@storybook/addon-docs", "@storybook/addon-onboarding"],
6 | framework: {
7 | name: "@storybook/react-vite",
8 | options: {},
9 | },
10 | };
11 | export default config;
12 |
--------------------------------------------------------------------------------
/src/components/icon/icons/hardware/sim_card.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/components/icon/icons/hardware/developer_board.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/components/icon/icons/hardware/scanner.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/components/image/context.ts:
--------------------------------------------------------------------------------
1 | import { createContext } from "react";
2 |
3 | /**
4 | * class name
5 | */
6 | export const CLASS_NAMES = {
7 | image: "image",
8 | img: "img",
9 | overlay: "overlay",
10 | };
11 |
12 | /**
13 | * image context
14 | * @description 图片上下文,提供图片额外定制的能力
15 | */
16 | export default createContext<{
17 | /**
18 | * 移除图片
19 | */
20 | onRemove?: () => void;
21 | }>({});
22 |
--------------------------------------------------------------------------------
/src/components/markdown/context.ts:
--------------------------------------------------------------------------------
1 | import { createContext } from "react";
2 |
3 | /**
4 | * @description class names
5 | */
6 | const CLASS_NAMES = {
7 | markdown: "markdown",
8 | loading: "markdown__loading",
9 | } as const;
10 |
11 | const Context = createContext<{ classNames: typeof CLASS_NAMES }>({
12 | classNames: CLASS_NAMES,
13 | });
14 |
15 | export default Context;
16 | export { CLASS_NAMES };
17 |
--------------------------------------------------------------------------------
/src/components/time-picker/context.ts:
--------------------------------------------------------------------------------
1 | import { createContext } from "react";
2 |
3 | /**
4 | * @description
5 | * class names
6 | */
7 | export const CLASS_NAMES = {
8 | picker: "time-picker",
9 | input: "time-picker__input",
10 | panel: "time-picker__panel",
11 | panelFooter: "time-picker__panel-footer",
12 | };
13 |
14 | export const Context = createContext({
15 | classNames: CLASS_NAMES,
16 | });
17 |
--------------------------------------------------------------------------------
/src/components/icon/icons/hardware/cast.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/components/icon/icons/hardware/home_mini.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/types/date-picker.ts:
--------------------------------------------------------------------------------
1 | import type { Dayjs } from "dayjs";
2 |
3 | /**
4 | * @description
5 | * date picker props
6 | */
7 | export interface DatePickerProps {
8 | /**
9 | * @description
10 | * value
11 | * @default void 0
12 | */
13 | value?: Dayjs;
14 |
15 | /**
16 | * @description
17 | * change handler
18 | * @default void 0
19 | */
20 | onChange?: (value: Dayjs) => void;
21 | }
22 |
--------------------------------------------------------------------------------
/stories/clock.stories.tsx:
--------------------------------------------------------------------------------
1 | import type { Meta, StoryObj } from "@storybook/react-vite";
2 | import { Clock } from "../dist";
3 |
4 | const meta: Meta = {
5 | title: "clock",
6 | component: Clock,
7 | parameters: {},
8 | tags: ["autodocs"],
9 | argTypes: {},
10 | };
11 |
12 | export default meta;
13 | type Story = StoryObj;
14 |
15 | export const Normal: Story = {};
16 |
--------------------------------------------------------------------------------
/src/components/icon/icons/hardware/headset_mic.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/components/icon/icons/hardware/memory.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/components/icon/hoc.ts:
--------------------------------------------------------------------------------
1 | import { type FC, createElement } from "react";
2 | import type { AsProps, IconProps } from "../../types/icon";
3 | import Icon from "./icon";
4 |
5 | /**
6 | * @description
7 | * with icon
8 | */
9 | export const withIcon = (as: FC) => {
10 | return (props: Omit) => {
11 | return createElement(Icon, {
12 | ...props,
13 | as,
14 | });
15 | };
16 | };
17 |
--------------------------------------------------------------------------------
/src/types/option.ts:
--------------------------------------------------------------------------------
1 | import type { Key, ReactNode } from "react";
2 |
3 | export interface Option {
4 | /**
5 | * @description
6 | * value
7 | * @requires
8 | */
9 | value: Key;
10 |
11 | /**
12 | * @description
13 | * label
14 | * @default void 0
15 | */
16 | label?: ReactNode;
17 |
18 | /**
19 | * @description
20 | * children
21 | * @default void 0
22 | */
23 | children?: Option[];
24 | }
25 |
--------------------------------------------------------------------------------
/src/components/layout/index.ts:
--------------------------------------------------------------------------------
1 | import _Layout from "./layout";
2 | import type { TypedLayout } from "../../types/layout";
3 | import Header from "./header";
4 | import Sidebar from "./sidebar";
5 | import Main from "./main";
6 | import Footer from "./footer";
7 | import Heading from "./heading";
8 |
9 | export const Layout: TypedLayout = Object.assign(_Layout, {
10 | Header,
11 | Sidebar,
12 | Main,
13 | Footer,
14 | Heading,
15 | });
16 |
--------------------------------------------------------------------------------
/src/components/picker/context.ts:
--------------------------------------------------------------------------------
1 | import { createContext } from "react";
2 | import type { ContextValue } from "../../types/picker";
3 |
4 | export const CLASS_NAMES = {
5 | picker: "picker",
6 | focused: "picker--focused",
7 | invalid: "picker--invalid",
8 | dropdown: "picker__dropdown",
9 | } as const;
10 |
11 | export const Context = createContext({
12 | open: null,
13 | isFocused: false,
14 | isOpen: false,
15 | });
16 |
--------------------------------------------------------------------------------
/src/types/skeleton.ts:
--------------------------------------------------------------------------------
1 | import type { ComponentProps } from "./element";
2 | import type { ReactNode } from "react";
3 |
4 | /**
5 | * @description
6 | * skeleton props
7 | */
8 | export type SkeletonProps = ComponentProps & {
9 | /**
10 | * @description
11 | * animation
12 | * @default true
13 | */
14 | animation?: boolean;
15 |
16 | /**
17 | * @description
18 | * children
19 | */
20 | children?: ReactNode;
21 | };
22 |
--------------------------------------------------------------------------------
/src/components/rate/context.ts:
--------------------------------------------------------------------------------
1 | import { createContext } from "react";
2 |
3 | /**
4 | * @description
5 | * class names
6 | */
7 | const CLASS_NAMES = {
8 | rate: "rate",
9 | star: "rate__star",
10 | half: "rate__star-half",
11 | full: "rate__star-full",
12 | };
13 |
14 | const Context = createContext<{ classNames: typeof CLASS_NAMES }>({
15 | classNames: CLASS_NAMES,
16 | });
17 |
18 | export default Context;
19 | export { CLASS_NAMES };
20 |
--------------------------------------------------------------------------------
/src/types/number-input.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * @description
3 | * number input props
4 | */
5 | export type NumberInputProps = {
6 | /**
7 | * @description
8 | * value
9 | */
10 | value?: number;
11 |
12 | /**
13 | * @description
14 | * number input change handler
15 | */
16 | onChange?: (value: number) => void;
17 |
18 | /**
19 | * @description
20 | * formatter
21 | */
22 | formatter?: (value?: string) => string;
23 | };
24 |
--------------------------------------------------------------------------------
/src/components/icon/icons/alert/index.ts:
--------------------------------------------------------------------------------
1 | import ErrorOutline from "./error-outline";
2 | import AddAlert from "./add-alert";
3 | import AutoDelete from "./auto-delete";
4 | import Error from "./error";
5 | import NotificationImportant from "./notification-important";
6 | import Warning from "./warning";
7 | import WarningAmber from "./warning-amber";
8 |
9 | export { ErrorOutline, AddAlert, AutoDelete, Error, NotificationImportant, Warning, WarningAmber };
10 |
--------------------------------------------------------------------------------
/src/components/icon/icons/hardware/cast_connected.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/components/icon/icons/hardware/phone_iphone.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/components/icon/icons/hardware/tablet_mac.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/components/session-storage/session-storage.tsx:
--------------------------------------------------------------------------------
1 | import React from "react";
2 |
3 | interface SessionStorageProps {
4 | key: string;
5 | value: string;
6 | }
7 |
8 | const SessionStorage = ({ key, value }: SessionStorageProps) => {
9 | return (
10 |
15 | );
16 | };
17 |
18 | export default SessionStorage;
19 |
--------------------------------------------------------------------------------
/src/types/element.ts:
--------------------------------------------------------------------------------
1 | import type { CSSProperties } from "react";
2 |
3 | /**
4 | * @author murukal
5 | * @description
6 | * component always has foundation props
7 | * like class name, style
8 | */
9 | export interface ComponentProps {
10 | /**
11 | * @description
12 | * class name
13 | */
14 | className?: string;
15 |
16 | /**
17 | * @description
18 | * style for current component
19 | */
20 | style?: CSSProperties;
21 | }
22 |
--------------------------------------------------------------------------------
/src/components/avatar/context.ts:
--------------------------------------------------------------------------------
1 | import { createContext } from "react";
2 | import type { ContextValue } from "../../types/avatar";
3 |
4 | /**
5 | * @description
6 | * class names
7 | */
8 | const CLASS_NAMES = {
9 | avatar: "avatar",
10 | group: "avatar__group",
11 | };
12 |
13 | /**
14 | * @description
15 | * context
16 | */
17 | const Context = createContext(null);
18 |
19 | export default Context;
20 | export { CLASS_NAMES };
21 |
--------------------------------------------------------------------------------
/src/components/icon/icons/hardware/gamepad.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/types/guideline.ts:
--------------------------------------------------------------------------------
1 | import { ComponentProps } from "./element";
2 |
3 | /**
4 | * @description
5 | * guideline props
6 | */
7 | export type GuidelineProps = ComponentProps & {
8 | /**
9 | * @description
10 | * figure
11 | */
12 | figure: string;
13 |
14 | /**
15 | * @description
16 | * recommend
17 | */
18 | recommend?: boolean;
19 |
20 | /**
21 | * @description
22 | * caption
23 | */
24 | caption?: string;
25 | };
26 |
--------------------------------------------------------------------------------
/src/types/i18n-button.ts:
--------------------------------------------------------------------------------
1 | import type { Locale } from "./locale";
2 | import type { ButtonProps } from "./button";
3 | import type { ComponentProps } from "./element";
4 |
5 | /**
6 | * @description
7 | * i18n button props
8 | */
9 | export type I18nButtonProps = ComponentProps &
10 | Pick & {
11 | /**
12 | * @description
13 | * change handler
14 | */
15 | onChange?: (locale?: Locale) => void;
16 | };
17 |
--------------------------------------------------------------------------------
/src/components/form/list/context.ts:
--------------------------------------------------------------------------------
1 | import { createContext } from "react";
2 | import type { FieldsValue } from "../../../utils/form";
3 | import { type Fields } from "./fields";
4 |
5 | interface ContextValue {
6 | fields?: Fields;
7 | onChange?: (field: string, value: V) => void;
8 | values?: V[];
9 | }
10 |
11 | /**
12 | * `List` Context
13 | */
14 | const Context = createContext>({});
15 |
16 | export { Context };
17 |
--------------------------------------------------------------------------------
/src/components/icon/icons/alert/warning.tsx:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import { withIcon } from "../../hoc";
3 |
4 | const Warning = withIcon(({ size }) => {
5 | return (
6 |
9 | );
10 | });
11 |
12 | export default Warning;
13 |
--------------------------------------------------------------------------------
/src/components/icon/icons/action/swap-horiz.tsx:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import { withIcon } from "../../hoc";
3 |
4 | const SwapHoriz = withIcon(({ size }) => {
5 | return (
6 |
9 | );
10 | });
11 |
12 | export default SwapHoriz;
13 |
--------------------------------------------------------------------------------
/src/components/tour/context.ts:
--------------------------------------------------------------------------------
1 | import { createContext } from "react";
2 |
3 | /**
4 | * @description
5 | * class names
6 | */
7 | const CLASS_NAMES = {
8 | tour: "tour",
9 | overlay: "tour__overlay",
10 | spotlight: "tour__spotlight",
11 | title: "tour__title",
12 | description: "tour__description",
13 | footer: "tour__footer",
14 | };
15 |
16 | const Context = createContext({
17 | classNames: CLASS_NAMES,
18 | });
19 |
20 | export { Context, CLASS_NAMES };
21 |
--------------------------------------------------------------------------------
/src/components/icon/icons/hardware/connected_tv.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/components/icon/icons/hardware/headset.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/components/rich-text-editor/context.ts:
--------------------------------------------------------------------------------
1 | import { createContext } from "react";
2 |
3 | /**
4 | * @description
5 | * class names
6 | */
7 | export const CLASS_NAMES = {
8 | default: "rich-text-editor",
9 | textarea: "rich-text-editor__textarea",
10 | checkbox: "rich-text-editor__checkbox",
11 | toolbar: "rich-text-editor__toolbar",
12 | } as const;
13 |
14 | const Context = createContext({
15 | classNames: CLASS_NAMES,
16 | });
17 |
18 | export { Context };
19 |
--------------------------------------------------------------------------------
/src/components/icon/icons/hardware/keyboard.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/stories/tooltip.stories.tsx:
--------------------------------------------------------------------------------
1 | import type { Meta, StoryObj } from "@storybook/react-vite";
2 | import { Tooltip } from "../dist";
3 |
4 | const meta: Meta = {
5 | title: "tooltip",
6 | component: Tooltip,
7 | parameters: {},
8 | tags: ["autodocs"],
9 | };
10 |
11 | export default meta;
12 | type Story = StoryObj;
13 |
14 | export const Normal: Story = {
15 | args: {
16 | children: "tooltip",
17 | title: "tooltip",
18 | },
19 | };
20 |
--------------------------------------------------------------------------------
/src/components/form/index.ts:
--------------------------------------------------------------------------------
1 | import _Form from "./form";
2 | import type { TypedForm } from "../../types/form";
3 | import Item from "./item";
4 | import { useForm } from "./use-form";
5 | import List from "./list";
6 | import { useWatch } from "./hooks/use-watch";
7 | import { useFormContext } from "./context";
8 |
9 | const Form: TypedForm = Object.assign(_Form, {
10 | Item,
11 | List,
12 | useForm,
13 | useWatch,
14 | useFormContext,
15 | });
16 |
17 | export { Form };
18 |
--------------------------------------------------------------------------------
/src/components/icon/icons/navigation/menu.tsx:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import { withIcon } from "../../hoc";
3 |
4 | const Menu = withIcon(({ size }) => {
5 | return (
6 |
15 | );
16 | });
17 |
18 | export default Menu;
19 |
--------------------------------------------------------------------------------
/src/components/checkbox/context.ts:
--------------------------------------------------------------------------------
1 | import { createContext } from "react";
2 | import type { ContextValue } from "../../types/checkbox";
3 |
4 | /**
5 | * @description
6 | * checkbox class names
7 | */
8 | export const CLASS_NAMES = {
9 | checkbox: "checkbox",
10 | layer: "checkbox__layer",
11 | inputer: "checkbox__inputer",
12 | input: "checkbox__input",
13 | label: "checkbox__label",
14 | };
15 |
16 | const Context = createContext(null);
17 |
18 | export default Context;
19 |
--------------------------------------------------------------------------------
/src/components/icon/icons/hardware/keyboard-arrow-left.tsx:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import { withIcon } from "../../hoc";
3 |
4 | const KeyboardArrowLeft = withIcon(({ size }) => {
5 | return (
6 |
9 | );
10 | });
11 |
12 | export default KeyboardArrowLeft;
13 |
--------------------------------------------------------------------------------
/src/components/icon/icons/hardware/keyboard_hide.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/stories/select.stories.ts:
--------------------------------------------------------------------------------
1 | import type { Meta, StoryObj } from "@storybook/react-vite";
2 | import { Select } from "../dist";
3 |
4 | const meta: Meta = {
5 | title: "select",
6 | component: Select,
7 | parameters: {},
8 | tags: ["autodocs"],
9 | };
10 |
11 | export default meta;
12 | type Story = StoryObj;
13 |
14 | export const Normal: Story = {
15 | args: {},
16 | };
17 |
18 | export const TagsMode: Story = {
19 | args: {
20 | mode: "tags",
21 | },
22 | };
23 |
--------------------------------------------------------------------------------
/src/components/divider/hooks.ts:
--------------------------------------------------------------------------------
1 | import { useMemo } from "react";
2 | import type { Align } from "../../types/divider";
3 |
4 | const OFFSETS: Record = {
5 | center: 50,
6 | left: 5,
7 | right: 95,
8 | };
9 |
10 | interface UseOffsetProps {
11 | align: Align;
12 | }
13 |
14 | /**
15 | * @description
16 | * offset for children
17 | */
18 | export const useOffset = ({ align }: UseOffsetProps) => {
19 | return useMemo(() => {
20 | return OFFSETS[align];
21 | }, [align]);
22 | };
23 |
--------------------------------------------------------------------------------
/src/components/icon/icons/hardware/laptop_mac.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/components/icon/icons/hardware/cast_for_education.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/components/layout/context.ts:
--------------------------------------------------------------------------------
1 | import { createContext } from "react";
2 |
3 | /**
4 | * @description class names
5 | */
6 | export const CLASS_NAMES = {
7 | layout: "layout",
8 | heading: "layout__heading",
9 | header: "layout__header",
10 | sidebar: "layout__sidebar",
11 | main: "layout__main",
12 | footer: "layout__footer",
13 | } as const;
14 |
15 | /**
16 | * @description context
17 | */
18 | const Context = createContext({
19 | classNames: CLASS_NAMES,
20 | });
21 |
22 | export default Context;
23 |
--------------------------------------------------------------------------------
/src/components/icon/icons/editor/format-italic.tsx:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import { withIcon } from "../../hoc";
3 |
4 | const FormatItalic = withIcon(({ size }) => {
5 | return (
6 |
15 | );
16 | });
17 |
18 | export default FormatItalic;
19 |
--------------------------------------------------------------------------------
/src/components/icon/icons/hardware/adf_scanner.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/components/icon/icons/toggle/star.tsx:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import { withIcon } from "../../hoc";
3 |
4 | const Star = withIcon(({ size }) => {
5 | return (
6 |
12 | );
13 | });
14 |
15 | export default Star;
16 |
--------------------------------------------------------------------------------
/src/components/slider/context.ts:
--------------------------------------------------------------------------------
1 | import { createContext } from "react";
2 |
3 | /**
4 | * @description 滑块组件类名
5 | */
6 | export const CLASS_NAMES = {
7 | slider: "slider",
8 | handle: "slider__handle",
9 | track: "slider__track",
10 | active: "slider__track--active",
11 | inactive: "slider__track--inactive",
12 | };
13 |
14 | /**
15 | * @description 滑块组件上下文
16 | */
17 | const Context = createContext<{ classNames: typeof CLASS_NAMES }>({
18 | classNames: CLASS_NAMES,
19 | });
20 |
21 | export default Context;
22 |
--------------------------------------------------------------------------------
/src/components/icon/icons/hardware/keyboard_alt.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/hooks/use-gutters.ts:
--------------------------------------------------------------------------------
1 | import { useMemo } from "react";
2 |
3 | export type Gutters = [columnGutter: number, rowGutter: number];
4 |
5 | export type Gutter = number | Gutters;
6 |
7 | export const useGutters = ({ gutter }: { gutter: Gutter }) => {
8 | const columnGutter = typeof gutter === "number" ? gutter : gutter[0];
9 | const rowGutter = typeof gutter === "number" ? gutter : gutter[1];
10 |
11 | // col gutter and row gutter
12 | return useMemo(() => [columnGutter, rowGutter], [columnGutter, rowGutter]);
13 | };
14 |
--------------------------------------------------------------------------------
/src/types/ellipsis.ts:
--------------------------------------------------------------------------------
1 | import { ComponentProps } from "./element";
2 |
3 | /**
4 | * @description Ellipsis Props
5 | */
6 | export interface EllipsisProps extends ComponentProps {
7 | /**
8 | * @description value
9 | *
10 | * @default ""
11 | */
12 | value?: string;
13 |
14 | /**
15 | * @description text overflow
16 | *
17 | * @default "..."
18 | */
19 | textOverflow?: string;
20 |
21 | /**
22 | * @description line clamp
23 | *
24 | * @default 1
25 | */
26 | lineClamp?: number;
27 | }
28 |
--------------------------------------------------------------------------------
/src/types/tooltip.ts:
--------------------------------------------------------------------------------
1 | import type { ReactNode } from "react";
2 | import type { ComponentProps } from "./element";
3 | import type { PopoverProps } from "./popover";
4 |
5 | /**
6 | * @description
7 | * tooltip props
8 | */
9 | export type TooltipProps = ComponentProps & {
10 | /**
11 | * @description
12 | * title
13 | * @default void 0
14 | */
15 | title?: ReactNode;
16 |
17 | /**
18 | * @description
19 | * a trigger element.
20 | * @requires
21 | */
22 | children: PopoverProps["children"];
23 | };
24 |
--------------------------------------------------------------------------------
/.changeset/README.md:
--------------------------------------------------------------------------------
1 | # Changesets
2 |
3 | Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
4 | with multi-package repos, or single-package repos to help you version and publish your code. You can
5 | find the full documentation for it [in our repository](https://github.com/changesets/changesets)
6 |
7 | We have a quick list of common questions to get you started engaging with this project in
8 | [our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)
9 |
--------------------------------------------------------------------------------
/src/components/checkbox/Indeterminate.tsx:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import { ComponentProps } from "../../types/element";
3 |
4 | const Indeterminate = ({ className, style }: ComponentProps) => {
5 | return (
6 |
15 | );
16 | };
17 |
18 | export default Indeterminate;
19 |
--------------------------------------------------------------------------------
/src/components/icon/icons/hardware/device_unknown.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/components/icon/icons/hardware/keyboard-arrow-up.tsx:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import { withIcon } from "../../hoc";
3 |
4 | const KeyboardArrowUp = withIcon(({ size }) => {
5 | return (
6 |
12 | );
13 | });
14 |
15 | export default KeyboardArrowUp;
16 |
--------------------------------------------------------------------------------
/src/types/date-range-picker.ts:
--------------------------------------------------------------------------------
1 | import type { Dayjs } from "dayjs";
2 | import type { Partialable } from "@aiszlab/relax/types";
3 |
4 | /**
5 | * @description
6 | * date range picker props
7 | */
8 | export interface DateRangePickerProps {
9 | /**
10 | * @description
11 | * value
12 | * @default void 0
13 | */
14 | value?: [Partialable, Partialable];
15 |
16 | /**
17 | * @description
18 | * change handler
19 | * @default void 0
20 | */
21 | onChange?: (value: [Dayjs, Dayjs]) => void;
22 | }
23 |
--------------------------------------------------------------------------------
/src/components/dialog/context.ts:
--------------------------------------------------------------------------------
1 | import { createContext } from "react";
2 | import type { DialogContextValue } from "../../types/dialog";
3 |
4 | /**
5 | * @description
6 | * class name
7 | */
8 | export const CLASS_NAMES = {
9 | dialog: "dialog",
10 | overlay: "dialog__overlay",
11 | panel: "dialog__panel",
12 | header: "dialog__header",
13 | body: "dialog__body",
14 | footer: "dialog__footer",
15 | } as const;
16 |
17 | /**
18 | * `Dialog`.`Context`
19 | */
20 | export const DialogContext = createContext({});
21 |
--------------------------------------------------------------------------------
/src/components/icon/icons/alert/error.tsx:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import { withIcon } from "../../hoc";
3 |
4 | const Error = withIcon(({ size }) => {
5 | return (
6 |
12 | );
13 | });
14 |
15 | export default Error;
16 |
--------------------------------------------------------------------------------
/src/components/icon/icons/alert/warning-amber.tsx:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import { withIcon } from "../../hoc";
3 |
4 | const WarningAmber = withIcon(({ size }) => {
5 | return (
6 |
12 | );
13 | });
14 |
15 | export default WarningAmber;
16 |
--------------------------------------------------------------------------------
/src/components/icon/icons/editor/notes.tsx:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import { withIcon } from "../../hoc";
3 |
4 | const Notes = withIcon(({ size }) => {
5 | return (
6 |
18 | );
19 | });
20 |
21 | export default Notes;
22 |
--------------------------------------------------------------------------------
/src/components/icon/icons/hardware/keyboard-arrow-right.tsx:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import { withIcon } from "../../hoc";
3 |
4 | const KeyboardArrowRight = withIcon(({ size }) => {
5 | return (
6 |
12 | );
13 | });
14 |
15 | export default KeyboardArrowRight;
16 |
--------------------------------------------------------------------------------
/src/components/calendar/context.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * @description
3 | * class names
4 | */
5 | export const CLASS_NAMES = {
6 | calendar: "calendar",
7 | header: "calendar__header",
8 | heading: "calendar__heading",
9 | headCell: "calendar__head-cell",
10 | dateCell: "calendar__date-cell",
11 | dateCellSelected: "calendar__date-cell--selected",
12 | dateCellInRange: "calendar__date--in-range",
13 | dateCellRangeFrom: "calendar__date--range-from",
14 | dateCellRangeTo: "calendar__date--range-to",
15 | date: "calendar__date",
16 | } as const;
17 |
--------------------------------------------------------------------------------
/src/components/empty/__test__/index.test.tsx:
--------------------------------------------------------------------------------
1 | import { render } from "@testing-library/react";
2 | import Empty from "../empty";
3 | import React from "react";
4 | import "@testing-library/jest-dom";
5 |
6 | describe("`Empty` Component", () => {
7 | test("component render", () => {
8 | const { container } = render();
9 |
10 | // node render in dom tree
11 | expect(container.querySelector(".musae-empty")).toBeInTheDocument();
12 | expect(container.querySelector(".musae-empty__description")).toBeInTheDocument();
13 | });
14 | });
15 |
--------------------------------------------------------------------------------
/src/components/icon/icons/hardware/keyboard-arrow-down.tsx:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import { withIcon } from "../../hoc";
3 |
4 | const KeyboardArrowDown = withIcon((props) => {
5 | return (
6 |
12 | );
13 | });
14 |
15 | export default KeyboardArrowDown;
16 |
--------------------------------------------------------------------------------
/.github/dependabot.yml:
--------------------------------------------------------------------------------
1 | # To get started with Dependabot version updates, you'll need to specify which
2 | # package ecosystems to update and where the package manifests are located.
3 | # Please see the documentation for all configuration options:
4 | # https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
5 |
6 | version: 2
7 | updates:
8 | - package-ecosystem: "npm" # See documentation for possible values
9 | directory: "/" # Location of package manifests
10 | schedule:
11 | interval: "weekly"
12 |
--------------------------------------------------------------------------------
/src/components/icon/icons/hardware/headphones_battery.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/hooks/use-class-names.ts:
--------------------------------------------------------------------------------
1 | import { useMemo } from "react";
2 | import { useConfiguration } from "../components/config/hooks";
3 |
4 | /**
5 | * @description
6 | * in component, inject prefix class names
7 | */
8 | export const useClassNames = >(classNames: C) => {
9 | const { prefix } = useConfiguration();
10 |
11 | return useMemo(() => {
12 | return Object.fromEntries(
13 | Object.entries(classNames).map(([key, value]) => [key, `${prefix}-${value}`]),
14 | ) as C;
15 | }, [classNames, prefix]);
16 | };
17 |
--------------------------------------------------------------------------------
/src/components/icon/icons/action/turned-in.tsx:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import { withIcon } from "../../hoc";
3 |
4 | const TurnedIn = withIcon(({ size }) => {
5 | return (
6 |
18 | );
19 | });
20 |
21 | export default TurnedIn;
22 |
--------------------------------------------------------------------------------
/src/components/chat/context.ts:
--------------------------------------------------------------------------------
1 | import { createContext } from "react";
2 | import type { ContextValue } from "../../types/chat";
3 |
4 | /**
5 | * @description
6 | * class names
7 | */
8 | export const CLASS_NAMES = {
9 | chat: "chat",
10 | messages: "chat__messages",
11 | footer: "chat__footer",
12 | item: "chat__item",
13 | send: "chat__item-send-message",
14 | receive: "chat__item-receive-message",
15 | } as const;
16 |
17 | export const Context = createContext({
18 | classNames: CLASS_NAMES,
19 | });
20 |
--------------------------------------------------------------------------------
/stories/markdown.stories.ts:
--------------------------------------------------------------------------------
1 | import type { Meta, StoryObj } from "@storybook/react-vite";
2 | import { Markdown } from "../dist";
3 |
4 | const meta: Meta = {
5 | title: "markdown",
6 | component: Markdown,
7 | parameters: {
8 | layout: "centered",
9 | },
10 | tags: ["autodocs"],
11 | };
12 |
13 | export default meta;
14 | type Story = StoryObj;
15 |
16 | export const RichText: Story = {
17 | args: {
18 | value: `# Heading1
19 | ## Heading2
20 | ### Heading3
21 | #### Heading4`,
22 | },
23 | };
24 |
--------------------------------------------------------------------------------
/src/components/icon/icons/action/swap-vert.tsx:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import { withIcon } from "../../hoc";
3 |
4 | const SwapVert = withIcon(({ size }) => {
5 | return (
6 |
12 | );
13 | });
14 |
15 | export default SwapVert;
16 |
--------------------------------------------------------------------------------
/src/components/icon/icons/hardware/mouse.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/components/icon/icons/action/code.tsx:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import { withIcon } from "../../hoc";
3 |
4 | const Code = withIcon(({ size }) => {
5 | return (
6 |
18 | );
19 | });
20 |
21 | export default Code;
22 |
--------------------------------------------------------------------------------
/src/components/icon/icons/hardware/speaker.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/components/icon/icons/action/done.tsx:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import { withIcon } from "../../hoc";
3 |
4 | const Done = withIcon(({ size }) => {
5 | return (
6 |
18 | );
19 | });
20 |
21 | export default Done;
22 |
--------------------------------------------------------------------------------
/src/components/upload/context.ts:
--------------------------------------------------------------------------------
1 | import type { ContextValue } from "../../types/upload";
2 | import { createContext } from "react";
3 |
4 | /**
5 | * @description
6 | * class names
7 | */
8 | export const CLASS_NAMES = {
9 | upload: "upload",
10 | uploader: "upload__uploader",
11 | uploadedList: "upload__uploaded-list",
12 | uploadedItem: "upload__uploaded-item",
13 | uploadedItemPicture: "upload__uploaded-item--picture",
14 | } as const;
15 |
16 | export const Context = createContext({
17 | classNames: CLASS_NAMES,
18 | });
19 |
--------------------------------------------------------------------------------
/stories/fab.stories.tsx:
--------------------------------------------------------------------------------
1 | import type { Meta, StoryObj } from "@storybook/react-vite";
2 | import { Fab } from "../dist";
3 | import AccountCircle from "../dist/components/icon/icons/action/account-circle";
4 | import React from "react";
5 |
6 | const meta: Meta = {
7 | title: "fab",
8 | component: Fab,
9 | parameters: {},
10 | tags: ["autodocs"],
11 | argTypes: {},
12 | };
13 |
14 | export default meta;
15 | type Story = StoryObj;
16 |
17 | export const Normal: Story = {
18 | args: {
19 | children: ,
20 | },
21 | };
22 |
--------------------------------------------------------------------------------
/src/components/checkbox/check.tsx:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import { ComponentProps } from "../../types/element";
3 |
4 | const Check = ({ className, style }: ComponentProps) => {
5 | return (
6 |
18 | );
19 | };
20 |
21 | export default Check;
22 |
--------------------------------------------------------------------------------
/src/components/icon/icons/action/delete.tsx:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import { withIcon } from "../../hoc";
3 |
4 | const Delete = withIcon(({ size }) => {
5 | return (
6 |
18 | );
19 | });
20 |
21 | export default Delete;
22 |
--------------------------------------------------------------------------------
/src/components/icon/icons/hardware/keyboard-double-arrow-right.tsx:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import { withIcon } from "../../hoc";
3 |
4 | const KeyboardDoubleArrowRight = withIcon(({ size }) => {
5 | return (
6 |
10 | );
11 | });
12 |
13 | export default KeyboardDoubleArrowRight;
14 |
--------------------------------------------------------------------------------
/src/components/icon/icons/hardware/phonelink_off.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/components/icon/icons/hardware/smart_screen.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/components/icon/icons/navigation/check.tsx:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import { withIcon } from "../../hoc";
3 |
4 | const Check = withIcon(({ size }) => {
5 | return (
6 |
18 | );
19 | });
20 |
21 | export default Check;
22 |
--------------------------------------------------------------------------------
/src/components/icon/icons/navigation/close.tsx:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import { withIcon } from "../../hoc";
3 |
4 | const Close = withIcon(({ size }) => {
5 | return (
6 |
18 | );
19 | });
20 |
21 | export default Close;
22 |
--------------------------------------------------------------------------------
/src/components/rich-text-editor/plugins/markdown-shortcut/index.tsx:
--------------------------------------------------------------------------------
1 | import { MarkdownShortcutPlugin as _MarkdownShortcutPlugin } from "@lexical/react/LexicalMarkdownShortcutPlugin";
2 | import { createElement } from "react";
3 | import { TRANSFORMERS as _TRANSFORMERS, CHECK_LIST } from "@lexical/markdown";
4 |
5 | const TRANSFORMERS = [CHECK_LIST, ..._TRANSFORMERS];
6 |
7 | const MarkdownShortcutPlugin = () => {
8 | return createElement(_MarkdownShortcutPlugin, {
9 | transformers: TRANSFORMERS,
10 | });
11 | };
12 |
13 | export default MarkdownShortcutPlugin;
14 | export { TRANSFORMERS };
15 |
--------------------------------------------------------------------------------
/src/components/icon/icons/hardware/index.ts:
--------------------------------------------------------------------------------
1 | import KeyboardDoubleArrowLeft from "./keyboard-double-arrow-left";
2 | import KeyboardDoubleArrowRight from "./keyboard-double-arrow-right";
3 | import KeyboardArrowLeft from "./keyboard-arrow-left";
4 | import KeyboardArrowRight from "./keyboard-arrow-right";
5 | import KeyboardArrowUp from "./keyboard-arrow-up";
6 | import KeyboardArrowDown from "./keyboard-arrow-down";
7 |
8 | export {
9 | KeyboardDoubleArrowLeft,
10 | KeyboardArrowDown,
11 | KeyboardArrowLeft,
12 | KeyboardArrowRight,
13 | KeyboardArrowUp,
14 | KeyboardDoubleArrowRight,
15 | };
16 |
--------------------------------------------------------------------------------
/src/components/icon/icons/hardware/keyboard-double-arrow-left.tsx:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import { withIcon } from "../../hoc";
3 |
4 | const KeyboardDoubleArrowLeft = withIcon(({ size }) => {
5 | return (
6 |
10 | );
11 | });
12 |
13 | export default KeyboardDoubleArrowLeft;
14 |
--------------------------------------------------------------------------------
/src/components/icon/icons/toggle/star-half.tsx:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import { withIcon } from "../../hoc";
3 |
4 | const StarHalf = withIcon(({ size }) => {
5 | return (
6 |
12 | );
13 | });
14 |
15 | export default StarHalf;
16 |
--------------------------------------------------------------------------------
/src/components/icon/icons/navigation/menu-open.tsx:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import { withIcon } from "../../hoc";
3 |
4 | const MenuOpen = withIcon(({ size }) => {
5 | return (
6 |
18 | );
19 | });
20 |
21 | export default MenuOpen;
22 |
--------------------------------------------------------------------------------
/src/components/icon/icons/action/logout.tsx:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import { withIcon } from "../../hoc";
3 |
4 | const Logout = withIcon(({ size }) => {
5 | return (
6 |
18 | );
19 | });
20 |
21 | export default Logout;
22 |
--------------------------------------------------------------------------------
/src/components/icon/icons/editor/format-strikethrough.tsx:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import { withIcon } from "../../hoc";
3 |
4 | const FormatStrikethrough = withIcon(({ size }) => {
5 | return (
6 |
18 | );
19 | });
20 |
21 | export default FormatStrikethrough;
22 |
--------------------------------------------------------------------------------
/src/components/icon/icons/hardware/keyboard_voice.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/components/icon/icons/hardware/watch.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/components/popper/popper.tsx:
--------------------------------------------------------------------------------
1 | import React, { forwardRef } from "react";
2 | import type { PopperProps, PopperRef } from "../../types/popper";
3 | import { Portal } from "../portal";
4 | import Dropdown from "./dropdown";
5 |
6 | const Popper = forwardRef(
7 | ({ destroyable, placement = "bottom-start", container, ...props }, ref) => {
8 | return (
9 |
10 |
11 |
12 | );
13 | },
14 | );
15 |
16 | export default Popper;
17 |
--------------------------------------------------------------------------------
/stories/progress.stories.tsx:
--------------------------------------------------------------------------------
1 | import type { Meta, StoryObj } from "@storybook/react-vite";
2 | import { Progress } from "../dist";
3 |
4 | const meta: Meta = {
5 | title: "progress",
6 | component: Progress,
7 | parameters: {},
8 | tags: ["autodocs"],
9 | argTypes: {},
10 | };
11 |
12 | export default meta;
13 | type Story = StoryObj;
14 |
15 | export const Normal: Story = {
16 | args: {
17 | value: 50,
18 | },
19 | };
20 |
21 | export const Circular: Story = {
22 | args: {
23 | variant: "circular",
24 | value: 50,
25 | },
26 | };
27 |
--------------------------------------------------------------------------------
/stories/transfer.stories.ts:
--------------------------------------------------------------------------------
1 | import type { Meta, StoryObj } from "@storybook/react-vite";
2 | import { Transfer } from "../dist";
3 |
4 | const meta: Meta = {
5 | title: "transfer",
6 | component: Transfer,
7 | parameters: {},
8 | tags: ["autodocs"],
9 | };
10 |
11 | export default meta;
12 | type Story = StoryObj;
13 |
14 | export const Normal: Story = {
15 | args: {
16 | options: Array.from({ length: 30 }).map((_, pos) => {
17 | return {
18 | value: pos,
19 | label: `Option ${pos}`,
20 | };
21 | }),
22 | },
23 | };
24 |
--------------------------------------------------------------------------------
/src/components/icon/icons/hardware/router.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/components/icon/icons/image/looks-one.tsx:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import { withIcon } from "../../hoc";
3 |
4 | const LooksOne = withIcon(({ size }) => {
5 | return (
6 |
18 | );
19 | });
20 |
21 | export default LooksOne;
22 |
--------------------------------------------------------------------------------
/src/components/split-panel/context.ts:
--------------------------------------------------------------------------------
1 | import { createContext } from "react";
2 | import { ContextValue } from "../../types/split-panel";
3 |
4 | /**
5 | * @description class names
6 | */
7 | export const CLASS_NAMES = {
8 | splitPanel: "split-panel",
9 | panel: "split-panel__panel",
10 | divider: "split-panel__divider",
11 | dragger: "split-panel__divider-dragger",
12 | };
13 |
14 | /**
15 | * @description context
16 | */
17 | const Context = createContext<{ classNames: typeof CLASS_NAMES } & ContextValue>({
18 | classNames: CLASS_NAMES,
19 | orientation: "horizontal",
20 | });
21 |
22 | export default Context;
23 |
--------------------------------------------------------------------------------
/src/components/icon/icons/hardware/browser_not_supported.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/components/icon/icons/hardware/devices_other.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/components/kbd/kbd.tsx:
--------------------------------------------------------------------------------
1 | import React, { forwardRef } from "react";
2 | import { KBD_KEYS, KBD_LABELS } from "./utils";
3 | import { toArray } from "@aiszlab/relax";
4 | import type { KbdProps } from "../../types/kbd";
5 |
6 | const Kbd = forwardRef(({ keys, children }, ref) => {
7 | return (
8 |
9 | {toArray(keys ?? []).map((key, index) => (
10 |
11 | {KBD_KEYS[key]}
12 |
13 | ))}
14 |
15 | {!!children && {children}}
16 |
17 | );
18 | });
19 |
20 | export default Kbd;
21 |
--------------------------------------------------------------------------------
/src/components/icon/icons/image/looks-four.tsx:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import { withIcon } from "../../hoc";
3 |
4 | const LooksFour = withIcon(({ size }) => {
5 | return (
6 |
18 | );
19 | });
20 |
21 | export default LooksFour;
22 |
--------------------------------------------------------------------------------
/src/components/icon/icons/navigation/unfold-more.tsx:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import { withIcon } from "../../hoc";
3 |
4 | const UnfoldMore = withIcon(({ size }) => {
5 | return (
6 |
18 | );
19 | });
20 |
21 | export default UnfoldMore;
22 |
--------------------------------------------------------------------------------
/src/components/icon/icons/__test__/index.test.tsx:
--------------------------------------------------------------------------------
1 | import React, { createElement, type FC } from "react";
2 | import * as icons from "..";
3 | import { render } from "@testing-library/react";
4 |
5 | const Icons = ({ children }: { children: Record }) => {
6 | return (
7 |
8 | {Object.keys(children).map((key) => {
9 | return createElement(children[key], { key });
10 | })}
11 |
12 | );
13 | };
14 |
15 | describe("icons", () => {
16 | it("icons render", () => {
17 | const { asFragment } = render({icons});
18 | expect(asFragment()).toMatchSnapshot();
19 | });
20 | });
21 |
--------------------------------------------------------------------------------
/src/components/icon/icons/action/open-in-new.tsx:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import { withIcon } from "../../hoc";
3 |
4 | const OpenInNew = withIcon(({ size }) => {
5 | return (
6 |
18 | );
19 | });
20 |
21 | export default OpenInNew;
22 |
--------------------------------------------------------------------------------
/src/components/icon/icons/toggle/star-outline.tsx:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import { withIcon } from "../../hoc";
3 |
4 | const StarOutline = withIcon(({ size }) => {
5 | return (
6 |
12 | );
13 | });
14 |
15 | export default StarOutline;
16 |
--------------------------------------------------------------------------------
/src/types/countdown.ts:
--------------------------------------------------------------------------------
1 | import type { ComponentProps } from "./element";
2 | import type { ButtonProps } from "./button";
3 |
4 | /**
5 | * @description
6 | * countdown props
7 | */
8 | export type CountdownProps = Pick<
9 | ButtonProps,
10 | "children" | "disabled" | "variant" | "color" | "size" | "shape" | "ripple" | "onClick"
11 | > &
12 | ComponentProps & {
13 | /**
14 | * @description
15 | * count total after every trigger
16 | * @default 60
17 | */
18 | count?: number;
19 |
20 | /**
21 | * @description
22 | * interval, unit(ms)
23 | * @default 1000
24 | */
25 | interval?: number;
26 | };
27 |
--------------------------------------------------------------------------------
/src/types/kbd.ts:
--------------------------------------------------------------------------------
1 | import type { ReactNode } from "react";
2 |
3 | export type KbdKey =
4 | | "command"
5 | | "shift"
6 | | "ctrl"
7 | | "option"
8 | | "enter"
9 | | "delete"
10 | | "escape"
11 | | "tab"
12 | | "capslock"
13 | | "up"
14 | | "right"
15 | | "down"
16 | | "left"
17 | | "pageup"
18 | | "pagedown"
19 | | "home"
20 | | "end"
21 | | "help"
22 | | "space";
23 |
24 | export interface KbdProps {
25 | /**
26 | * @description
27 | * The key or keys to be displayed.
28 | */
29 | keys?: KbdKey | KbdKey[];
30 |
31 | /**
32 | * @description
33 | * children
34 | */
35 | children: ReactNode;
36 | }
37 |
--------------------------------------------------------------------------------
/src/types/message.ts:
--------------------------------------------------------------------------------
1 | import type { NotificationConfig, Type } from "../components/notification";
2 |
3 | export type MessageConfig = Omit;
4 |
5 | export type OpenHandler = (config: Omit) => Promise;
6 |
7 | /**
8 | * @author murukal
9 | *
10 | * @description
11 | * messager
12 | */
13 | export type Messager = Record;
14 |
15 | /**
16 | * @description
17 | * typed message
18 | */
19 | export type TypedMessage = {
20 | /**
21 | * @description
22 | * open
23 | */
24 | open: (config: MessageConfig) => Promise;
25 | } & Messager;
26 |
--------------------------------------------------------------------------------
/stories/tabs.stories.ts:
--------------------------------------------------------------------------------
1 | import type { Meta, StoryObj } from "@storybook/react-vite";
2 | import { Tabs } from "../dist";
3 | import { range } from "@aiszlab/relax";
4 |
5 | const meta: Meta = {
6 | title: "tabs",
7 | component: Tabs,
8 | parameters: {},
9 | tags: ["autodocs"],
10 | };
11 |
12 | export default meta;
13 | type Story = StoryObj;
14 |
15 | export const Scrollable: Story = {
16 | args: {
17 | items: range(0, 30).map((key) => {
18 | return {
19 | key,
20 | label: key.toString(),
21 | children: `panel ${key}`,
22 | };
23 | }),
24 | },
25 | };
26 |
--------------------------------------------------------------------------------
/src/components/icon/icons/editor/format-underlined.tsx:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import { withIcon } from "../../hoc";
3 |
4 | const FormatUnderlined = withIcon(({ size }) => {
5 | return (
6 |
18 | );
19 | });
20 |
21 | export default FormatUnderlined;
22 |
--------------------------------------------------------------------------------
/src/components/icon/icons/alert/error-outline.tsx:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import { withIcon } from "../../hoc";
3 |
4 | const ErrorOutline = withIcon(({ size }) => {
5 | return (
6 |
12 | );
13 | });
14 |
15 | export default ErrorOutline;
16 |
--------------------------------------------------------------------------------
/src/components/tabs/context.ts:
--------------------------------------------------------------------------------
1 | import { createContext } from "react";
2 | import type { ContextValue } from "../../types/tabs";
3 |
4 | /**
5 | * @description
6 | * class names
7 | */
8 | export const CLASS_NAMES = {
9 | tabs: "tabs",
10 | navigation: "tabs__navigation",
11 | navigator: "tabs__navigator",
12 | list: "tabs__tab-list",
13 | tab: "tabs__item",
14 | indicator: "tabs__indicator",
15 | panels: "tabs__panels",
16 | panel: "tabs__panel",
17 | } as const;
18 |
19 | export const Context = createContext<
20 | | ContextValue & {
21 | classNames: typeof CLASS_NAMES;
22 | }
23 | >({
24 | items: [],
25 | classNames: CLASS_NAMES,
26 | });
27 |
--------------------------------------------------------------------------------
/src/components/icon/icons/content/clear.tsx:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import { withIcon } from "../../hoc";
3 |
4 | const Redo = withIcon(({ size }) => {
5 | return (
6 |
18 | );
19 | });
20 |
21 | export default Redo;
22 |
--------------------------------------------------------------------------------
/src/components/icon/icons/content/redo.tsx:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import { withIcon } from "../../hoc";
3 |
4 | const Clear = withIcon(({ size }) => {
5 | return (
6 |
18 | );
19 | });
20 |
21 | export default Clear;
22 |
--------------------------------------------------------------------------------
/src/components/icon/icons/action/check-circle.tsx:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import { withIcon } from "../../hoc";
3 |
4 | const CheckCircle = withIcon(({ size }) => {
5 | return (
6 |
12 | );
13 | });
14 |
15 | export default CheckCircle;
16 |
--------------------------------------------------------------------------------
/src/components/icon/icons/action/done-outline.tsx:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import { withIcon } from "../../hoc";
3 |
4 | const DoneOutline = withIcon(({ size }) => {
5 | return (
6 |
18 | );
19 | });
20 |
21 | export default DoneOutline;
22 |
--------------------------------------------------------------------------------
/src/components/icon/icons/content/undo.tsx:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import { withIcon } from "../../hoc";
3 |
4 | const Undo = withIcon(({ size }) => {
5 | return (
6 |
18 | );
19 | });
20 |
21 | export default Undo;
22 |
--------------------------------------------------------------------------------
/src/components/timeline/context.ts:
--------------------------------------------------------------------------------
1 | import { createContext } from "react";
2 | import type { ContextValue } from "../../types/timeline";
3 |
4 | /**
5 | * @description
6 | * class names
7 | */
8 | export const CLASS_NAMES = {
9 | timeline: "timeline",
10 | item: "timeline__item",
11 | leading: "timeline__item-leading",
12 | sign: "timeline__item-leading-sign",
13 | dot: "timeline__item-leading-dot",
14 | label: "timeline__item-label",
15 | description: "timeline__item-description",
16 | } as const;
17 |
18 | export const Context = createContext({
19 | mode: "right",
20 | max: 0,
21 | classNames: CLASS_NAMES,
22 | });
23 |
--------------------------------------------------------------------------------
/src/components/icon/icons/image/index.ts:
--------------------------------------------------------------------------------
1 | import Bedtime from "./bedtime";
2 | import WbSunny from "./wb-sunny";
3 | import RotateLeft from "./rotate-left";
4 | import RotateRight from "./rotate-right";
5 | import LooksOne from "./looks-one";
6 | import LooksTwo from "./looks-two";
7 | import LooksThree from "./looks-three";
8 | import LooksFour from "./looks-four";
9 | import LooksFive from "./looks-five";
10 | import LooksSix from "./looks-six";
11 | import Edit from "./edit";
12 |
13 | export {
14 | Bedtime,
15 | RotateLeft,
16 | RotateRight,
17 | WbSunny,
18 | LooksOne,
19 | LooksTwo,
20 | LooksThree,
21 | LooksFour,
22 | LooksFive,
23 | LooksSix,
24 | Edit,
25 | };
26 |
--------------------------------------------------------------------------------
/src/components/icon/icons/image/looks-five.tsx:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import { withIcon } from "../../hoc";
3 |
4 | const LooksFive = withIcon(({ size }) => {
5 | return (
6 |
18 | );
19 | });
20 |
21 | export default LooksFive;
22 |
--------------------------------------------------------------------------------
/stories/dialog.stories.ts:
--------------------------------------------------------------------------------
1 | import type { Meta, StoryObj } from "@storybook/react-vite";
2 | import { Dialog } from "../dist";
3 |
4 | const meta: Meta = {
5 | title: "dialog",
6 | component: Dialog,
7 | parameters: {},
8 | tags: ["autodocs"],
9 | argTypes: {
10 | open: {
11 | type: "boolean",
12 | },
13 | },
14 | };
15 |
16 | export default meta;
17 | type Story = StoryObj;
18 |
19 | export const Normal: Story = {
20 | args: {
21 | children: "使用一个简单的弹窗",
22 | },
23 | };
24 |
25 | export const WithTitle: Story = {
26 | args: {
27 | title: "标题",
28 | children: "使用一个带有标题的弹窗",
29 | },
30 | };
31 |
--------------------------------------------------------------------------------
/src/types/otp-input.ts:
--------------------------------------------------------------------------------
1 | import type { ComponentProps } from "./element";
2 |
3 | /**
4 | * @description
5 | * otp input props
6 | */
7 | export type OtpInputProps = ComponentProps & {
8 | /**
9 | * @description
10 | * length
11 | * @default 6
12 | */
13 | length?: number;
14 |
15 | /**
16 | * @description
17 | * value change handler
18 | * @default void 0
19 | */
20 | onChange?: (value: string) => void;
21 |
22 | /**
23 | * @description
24 | * value
25 | * @default void 0
26 | */
27 | value?: string;
28 |
29 | // TODO docs
30 | /**
31 | * @description
32 | * invalid
33 | * @default false
34 | */
35 | invalid?: boolean;
36 | };
37 |
--------------------------------------------------------------------------------
/src/components/icon/icons/action/check-circle-outline.tsx:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import { withIcon } from "../../hoc";
3 |
4 | const CheckCircleOutline = withIcon(({ size }) => {
5 | return (
6 |
12 | );
13 | });
14 |
15 | export default CheckCircleOutline;
16 |
--------------------------------------------------------------------------------
/src/components/table/context.ts:
--------------------------------------------------------------------------------
1 | import { createContext, useContext } from "react";
2 | import type { ContextValue } from "../../types/table";
3 |
4 | export const CLASS_NAMES = {
5 | table: "table",
6 | header: "table__header",
7 | body: "table__body",
8 | } as const;
9 |
10 | const Context = createContext & { classNames: typeof CLASS_NAMES }>({
11 | bordered: false,
12 | classNames: CLASS_NAMES,
13 | });
14 |
15 | export { Context };
16 |
17 | /**
18 | * @author murukal
19 | * @description
20 | * use table context hook
21 | */
22 | export const useTable = () => {
23 | return useContext(Context) as ContextValue & { classNames: typeof CLASS_NAMES };
24 | };
25 |
--------------------------------------------------------------------------------
/src/types/space.ts:
--------------------------------------------------------------------------------
1 | import type { ReactNode } from "react";
2 | import type { Gutter } from "../hooks/use-gutters";
3 | import type { ComponentProps } from "./element";
4 |
5 | type Orientation = "horizontal" | "vertical";
6 |
7 | /**
8 | * @description
9 | * space props
10 | */
11 | export type SpaceProps = ComponentProps & {
12 | /**
13 | * @description
14 | * children
15 | * @default void 0
16 | */
17 | children?: ReactNode;
18 |
19 | /**
20 | * @description
21 | * gutter
22 | * @default 4
23 | */
24 | gutter?: Gutter;
25 |
26 | /**
27 | * @description
28 | * orientation
29 | * @default "horizontal"
30 | */
31 | orientation?: Orientation;
32 | };
33 |
--------------------------------------------------------------------------------
/src/components/icon/icons/hardware/speaker_group.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/components/icon/icons/image/looks-two.tsx:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import { withIcon } from "../../hoc";
3 |
4 | const LooksTwo = withIcon(({ size }) => {
5 | return (
6 |
18 | );
19 | });
20 |
21 | export default LooksTwo;
22 |
--------------------------------------------------------------------------------
/src/components/message/messager.ts:
--------------------------------------------------------------------------------
1 | import { Notification, type Type } from "../notification";
2 | import type { TypedMessage, MessageConfig, OpenHandler } from "../../types/message";
3 |
4 | const METHODS: Type[] = ["error", "info", "loading", "success", "warning"];
5 |
6 | const Message: TypedMessage = Object.assign(
7 | {
8 | open: (message: MessageConfig) => {
9 | Notification.open(message);
10 | },
11 | },
12 | ...METHODS.map((type) => ({
13 | [type]: ((message) => {
14 | return Notification.open({
15 | ...message,
16 | placement: "top",
17 | type,
18 | });
19 | }) satisfies OpenHandler,
20 | })),
21 | );
22 |
23 | export default Message;
24 |
--------------------------------------------------------------------------------
/src/components/transfer/context.ts:
--------------------------------------------------------------------------------
1 | import { createContext } from "react";
2 | import type { ContextValue } from "../../types/transfer";
3 |
4 | /**
5 | * @description
6 | * class names
7 | */
8 | export const CLASS_NAMES = {
9 | transfer: "transfer",
10 | operation: "transfer__operation",
11 | list: "transfer__list",
12 | title: "transfer__list-title",
13 | item: "transfer__list-item",
14 | header: "transfer__list-header",
15 | body: "transfer__list-body",
16 | };
17 |
18 | /**
19 | * @description
20 | * transfer context
21 | */
22 | export const Context = createContext({
23 | disabled: false,
24 | classNames: CLASS_NAMES,
25 | });
26 |
--------------------------------------------------------------------------------
/src/components/icon/icons/editor/index.ts:
--------------------------------------------------------------------------------
1 | import FormatBold from "./format-bold";
2 | import FormatItalic from "./format-italic";
3 | import FormatUnderlined from "./format-underlined";
4 | import InsertLink from "./insert-link";
5 | import FormatStrikethrough from "./format-strikethrough";
6 | import Subscript from "./subscript";
7 | import Superscript from "./superscript";
8 | import Notes from "./notes";
9 | import Checklist from "./checklist";
10 | import AttachFile from "./attch-file";
11 |
12 | export {
13 | FormatBold,
14 | FormatItalic,
15 | FormatUnderlined,
16 | InsertLink,
17 | FormatStrikethrough,
18 | Subscript,
19 | Superscript,
20 | Notes,
21 | Checklist,
22 | AttachFile,
23 | };
24 |
--------------------------------------------------------------------------------
/src/components/icon/icons/content/font-download.tsx:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import { withIcon } from "../../hoc";
3 |
4 | const FontDownload = withIcon(({ size }) => {
5 | return (
6 |
18 | );
19 | });
20 |
21 | export default FontDownload;
22 |
--------------------------------------------------------------------------------
/src/components/icon/icons/hardware/videogame_asset.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/components/progress/progress.tsx:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import type { ProgressProps } from "../../types/progress";
3 | import Linear from "./linear";
4 | import Circular from "./circular";
5 | import { useClassNames } from "../../hooks/use-class-names";
6 | import Context, { CLASS_NAMES } from "./context";
7 |
8 | const Progress = ({ variant = "linear", value = 0 }: ProgressProps) => {
9 | const classNames = useClassNames(CLASS_NAMES);
10 |
11 | return (
12 |
13 | {variant === "circular" && }
14 | {variant === "linear" && }
15 |
16 | );
17 | };
18 |
19 | export default Progress;
20 |
--------------------------------------------------------------------------------
/src/types/portal.ts:
--------------------------------------------------------------------------------
1 | import { Voidable } from "@aiszlab/relax/types";
2 | import type { ReactNode } from "react";
3 |
4 | /**
5 | * @description
6 | * portal props
7 | */
8 | export interface PortalProps {
9 | /**
10 | * @description
11 | * children
12 | */
13 | children?: ReactNode;
14 |
15 | /**
16 | * @description
17 | * destroyable
18 | */
19 | destroyable?: boolean;
20 |
21 | /**
22 | * @description
23 | * open
24 | */
25 | open?: boolean;
26 |
27 | /**
28 | * @description
29 | * lockable
30 | */
31 | lockable?: boolean;
32 |
33 | /**
34 | * @description
35 | * container
36 | */
37 | container?: (() => Voidable) | HTMLElement | null;
38 | }
39 |
--------------------------------------------------------------------------------
/src/components/form/hooks/use-form.ts:
--------------------------------------------------------------------------------
1 | import { isUndefined, useUpdateEffect } from "@aiszlab/relax";
2 | import type { UsingForm } from "../../../types/form";
3 | import { type FieldsValue } from "../../../utils/form";
4 | import { useForm as _useForm } from "../use-form";
5 |
6 | /**
7 | * hook for `Form` used internal
8 | */
9 | function useForm({ value, form: _form, ...usingForm }: UsingForm = {}) {
10 | const form = _useForm({ value, form: _form, ...usingForm });
11 |
12 | useUpdateEffect(() => {
13 | if (isUndefined(value)) {
14 | return;
15 | }
16 |
17 | form.setFieldsValue(value);
18 | }, [value, form]);
19 |
20 | return form;
21 | }
22 |
23 | export { useForm };
24 |
--------------------------------------------------------------------------------
/src/components/icon/icons/image/looks-six.tsx:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import { withIcon } from "../../hoc";
3 |
4 | const LooksSix = withIcon(({ size }) => {
5 | return (
6 |
18 | );
19 | });
20 |
21 | export default LooksSix;
22 |
--------------------------------------------------------------------------------
/src/components/icon/icons/action/schedule.tsx:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import { withIcon } from "../../hoc";
3 |
4 | const Schedule = withIcon(({ size }) => {
5 | return (
6 |
18 | );
19 | });
20 |
21 | export default Schedule;
22 |
--------------------------------------------------------------------------------
/src/components/steps/context.ts:
--------------------------------------------------------------------------------
1 | import { createContext } from "react";
2 | import type { ContextValue } from "../../types/steps";
3 |
4 | /**
5 | * @description
6 | * class names
7 | */
8 | export const CLASS_NAMES = {
9 | steps: "steps",
10 | item: "steps__item",
11 | done: "steps__item--done",
12 | doing: "steps__item--doing",
13 | todo: "steps__item--todo",
14 | leading: "steps__item-leading",
15 | sign: "steps__item-leading-sign",
16 | title: "steps__item-title",
17 | description: "steps__item-description",
18 | };
19 |
20 | export const Context = createContext({
21 | type: "horizontal",
22 | max: 0,
23 | value: 0,
24 | classNames: CLASS_NAMES,
25 | });
26 |
--------------------------------------------------------------------------------
/src/components/icon/icons/editor/checklist.tsx:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import { withIcon } from "../../hoc";
3 |
4 | const Checklist = withIcon(({ size }) => {
5 | return (
6 |
18 | );
19 | });
20 |
21 | export default Checklist;
22 |
--------------------------------------------------------------------------------
/src/components/icon/icons/image/looks-three.tsx:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import { withIcon } from "../../hoc";
3 |
4 | const LooksThree = withIcon(({ size }) => {
5 | return (
6 |
18 | );
19 | });
20 |
21 | export default LooksThree;
22 |
--------------------------------------------------------------------------------
/src/components/collapse/context.ts:
--------------------------------------------------------------------------------
1 | import { createContext } from "react";
2 | import type { ContextValue } from "../../types/collapse";
3 |
4 | export const CLASS_NAMES = {
5 | collapse: "collapse",
6 | item: "collapse__item",
7 | itemActive: "collapse__item--active",
8 | header: "collapse__item-header",
9 | collapser: "collapse__header-collapser",
10 | panel: "collapse__item-panel",
11 | panelActive: "collapse__item-panel--active",
12 | content: "collapse__item-content",
13 | };
14 |
15 | /**
16 | * @description
17 | * `Collapse` Context
18 | */
19 | export const Context = createContext({
20 | activeKeys: new Set(),
21 | toggle: () => {},
22 | classNames: CLASS_NAMES,
23 | });
24 |
--------------------------------------------------------------------------------
/src/components/number-input/hooks.ts:
--------------------------------------------------------------------------------
1 | import { isUndefined, useControlledState, useEvent } from "@aiszlab/relax";
2 |
3 | /**
4 | * @description
5 | * number input value hook
6 | */
7 | export const useValue = ({ value: _value }: { value?: number }) => {
8 | const [value, setValue] = useControlledState(_value?.toString());
9 |
10 | const change = useEvent((___value: string) => {
11 | // ignore invalid character
12 | if (!/^-?(?:\d+)?(\.)?\d*$/.test(___value) && ___value !== "") {
13 | return;
14 | }
15 |
16 | // uncontrolled, change state only
17 | if (isUndefined(_value)) {
18 | setValue(___value);
19 | return;
20 | }
21 | });
22 |
23 | return {
24 | value,
25 | change,
26 | };
27 | };
28 |
--------------------------------------------------------------------------------
/src/locale/use-locale.ts:
--------------------------------------------------------------------------------
1 | import type { Locale, LocaleCode } from "../types/locale";
2 | import { LocaleContext } from "./context";
3 | import { useContext, useMemo } from "react";
4 |
5 | export type LocaleComponentToken = Exclude;
6 |
7 | type UsedLocale = [Locale[C], LocaleCode];
8 |
9 | export const useLocale = (
10 | componentName: C,
11 | ): UsedLocale => {
12 | const localeContextValue = useContext(LocaleContext);
13 |
14 | const locale = useMemo(() => {
15 | return localeContextValue[componentName];
16 | }, [componentName, localeContextValue]);
17 |
18 | return [locale, localeContextValue.locale];
19 | };
20 |
--------------------------------------------------------------------------------
/src/components/icon/icons/editor/superscript.tsx:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import { withIcon } from "../../hoc";
3 |
4 | const Superscript = withIcon(({ size }) => {
5 | return (
6 |
18 | );
19 | });
20 |
21 | export default Superscript;
22 |
--------------------------------------------------------------------------------
/src/components/quote/styles.ts:
--------------------------------------------------------------------------------
1 | import { create as $create } from "@stylexjs/stylex";
2 | import { sizes, spacing } from "../theme/tokens.stylex";
3 | import { type ThemeColorVariable } from "../../hooks/use-theme-color-vars";
4 |
5 | const styles = $create({
6 | quote: {
7 | // reset styles
8 | margin: spacing.none,
9 |
10 | // apply styles
11 | position: "relative",
12 | paddingInlineStart: spacing.medium,
13 |
14 | "::before": {
15 | content: '""',
16 | position: "absolute",
17 | insetBlock: 0,
18 | insetInlineStart: 0,
19 | width: sizes.xxxxxxxxxxsmall,
20 | backgroundColor: "var(--color-outline)" satisfies ThemeColorVariable,
21 | },
22 | },
23 | });
24 |
25 | export default styles;
26 |
--------------------------------------------------------------------------------
/src/components/icon/icons/editor/insert-link.tsx:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import { withIcon } from "../../hoc";
3 |
4 | const InsertLink = withIcon(({ size }) => {
5 | return (
6 |
18 | );
19 | });
20 |
21 | export default InsertLink;
22 |
--------------------------------------------------------------------------------
/src/components/icon/icons/editor/subscript.tsx:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import { withIcon } from "../../hoc";
3 |
4 | const Subscript = withIcon(({ size }) => {
5 | return (
6 |
18 | );
19 | });
20 |
21 | export default Subscript;
22 |
--------------------------------------------------------------------------------
/src/components/icon/icons/hardware/smart_toy.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/components/icon/icons/navigation/more-horiz.tsx:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import { withIcon } from "../../hoc";
3 |
4 | const MoreHoriz = withIcon(({ size }) => {
5 | return (
6 |
18 | );
19 | });
20 |
21 | export default MoreHoriz;
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | musae
2 |
3 | ## Introduction
4 |
5 | Next-generation UI Component suite for `React`.
6 |
7 | ## 📦 Install
8 |
9 | ```bash
10 | ## use npm
11 | npm install musae
12 |
13 | ## use pnpm
14 | pnpm add musae
15 |
16 | ## use yarn
17 | yarn add musae
18 | ```
19 |
20 | ## Overview
21 |
22 | `musae` is a complete UI suite for `React` consisting of a rich set of UI components, icons, blocks, and application templates.
23 |
24 | ## Theming
25 |
26 | `musae` has powerful theme customization based on CSS-in-JS.
27 |
28 | ## 🔨 Usage
29 |
30 | ```tsx
31 | import React from "react";
32 | import { Button } from "musae";
33 | import "musae/styles.css";
34 |
35 | const App = () => ;
36 |
37 | export default App;
38 | ```
39 |
--------------------------------------------------------------------------------
/src/hooks/use-container.ts:
--------------------------------------------------------------------------------
1 | import { isDomUsable, isFunction } from "@aiszlab/relax";
2 | import type { PortalProps } from "../types/portal";
3 | import { useMemo } from "react";
4 |
5 | /**
6 | * @description
7 | * container
8 | */
9 | export const useContainer = ({
10 | container,
11 | useBody = true,
12 | }: {
13 | container: PortalProps["container"];
14 | useBody?: boolean;
15 | }) => {
16 | const _container =
17 | (isFunction(container) ? container() : container) ??
18 | (isDomUsable() && useBody ? document.body : null);
19 |
20 | const isDocumentBody = useMemo(() => {
21 | return isDomUsable() && _container === document.body;
22 | }, [_container]);
23 |
24 | return {
25 | container: _container,
26 | isDocumentBody,
27 | };
28 | };
29 |
--------------------------------------------------------------------------------
/src/components/icon/icons/image/edit.tsx:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import { withIcon } from "../../hoc";
3 |
4 | const Edit = withIcon(({ size }) => {
5 | return (
6 |
18 | );
19 | });
20 |
21 | export default Edit;
22 |
--------------------------------------------------------------------------------
/src/types/loading.ts:
--------------------------------------------------------------------------------
1 | import type { ReactNode } from "react";
2 | import type { ComponentProps } from "./element";
3 |
4 | type Size = "small" | "medium" | "large";
5 |
6 | /**
7 | * @author murukal
8 | *
9 | * @description
10 | * loading props
11 | */
12 | export type LoadingProps = ComponentProps & {
13 | /**
14 | * @description
15 | * size
16 | * @default "medium"
17 | */
18 | size?: Size;
19 |
20 | /**
21 | * @description
22 | * overlay shown
23 | * @default true
24 | */
25 | overlay?: boolean;
26 |
27 | /**
28 | * @description
29 | * children
30 | * @default void 0
31 | */
32 | children?: ReactNode;
33 |
34 | /**
35 | * @description
36 | * loading
37 | * @default true
38 | */
39 | loading?: boolean;
40 | };
41 |
--------------------------------------------------------------------------------
/src/types/progress.ts:
--------------------------------------------------------------------------------
1 | import type { RequiredIn } from "@aiszlab/relax/types";
2 | import type { ComponentProps } from "./element";
3 |
4 | type Variant = "linear" | "circular";
5 |
6 | /**
7 | * @description
8 | * `Progress` props
9 | */
10 | export type ProgressProps = ComponentProps & {
11 | /**
12 | * @description
13 | * variant
14 | */
15 | variant?: Variant;
16 |
17 | /**
18 | * @description
19 | * value
20 | */
21 | value?: number;
22 | };
23 |
24 | /**
25 | * @description
26 | * `Circular` Props
27 | */
28 | export type CircularProps = RequiredIn<
29 | Pick,
30 | "value"
31 | >;
32 |
33 | /**
34 | * @description
35 | * `Linear` Props
36 | */
37 | export type LinearProps = CircularProps;
38 |
--------------------------------------------------------------------------------
/src/components/bench/context.ts:
--------------------------------------------------------------------------------
1 | import { using } from "@aiszlab/relax/react";
2 |
3 | /**
4 | * @description class names
5 | */
6 | export const CLASS_NAMES = {
7 | bench: "bench",
8 | heading: "bench__heading",
9 | header: "bench__header",
10 | trailing: "bench__header-trailing",
11 | sidebar: "bench__sidebar",
12 | expander: "bench__expander",
13 | main: "bench__main",
14 | };
15 |
16 | /**
17 | * @description global store
18 | */
19 | export const useStore = using<{
20 | isCollapsed: boolean;
21 | collapse: VoidFunction;
22 | expand: VoidFunction;
23 | }>((setState) => ({
24 | isCollapsed: false,
25 | collapse: () => setState((prev) => ({ ...prev, isCollapsed: true })),
26 | expand: () => setState((prev) => ({ ...prev, isCollapsed: false })),
27 | }));
28 |
--------------------------------------------------------------------------------
/src/components/icon/icons/navigation/cancel.tsx:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import { withIcon } from "../../hoc";
3 |
4 | const Cancel = withIcon(({ size }) => {
5 | return (
6 |
18 | );
19 | });
20 |
21 | export default Cancel;
22 |
--------------------------------------------------------------------------------
/src/components/icon/icons/hardware/earbuds_battery.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/types/badge.ts:
--------------------------------------------------------------------------------
1 | import type { ReactNode } from "react";
2 | import type { ComponentProps } from "../types/element";
3 |
4 | type Placement = "top-right" | "top-left" | "bottom-right" | "bottom-left";
5 |
6 | /**
7 | * @description
8 | * badge props
9 | */
10 | export type BadgeProps = ComponentProps & {
11 | /**
12 | * @description
13 | * children
14 | * @requires
15 | */
16 | children: ReactNode;
17 |
18 | /**
19 | * @description
20 | * content
21 | * @default void 0
22 | */
23 | content?: ReactNode;
24 |
25 | /**
26 | * @description
27 | * invisible
28 | * @default false
29 | */
30 | invisible?: boolean;
31 |
32 | /**
33 | * @description
34 | * placement
35 | * @default "top-right"
36 | */
37 | placement?: Placement;
38 | };
39 |
--------------------------------------------------------------------------------
/src/components/tree/context.ts:
--------------------------------------------------------------------------------
1 | import { Key, createContext } from "react";
2 | import { ContextValue } from "../../types/tree";
3 |
4 | /**
5 | * @description
6 | * class names
7 | */
8 | const CLASS_NAMES = {
9 | tree: "tree",
10 | list: "tree__list",
11 | listHidden: "tree__list--hidden",
12 | holder: "tree__holder",
13 | node: "tree__node",
14 | title: "tree__node-title",
15 | expander: "tree__node-expander",
16 | checkbox: "tree__node-checkbox",
17 | };
18 |
19 | const Context = createContext({
20 | checkedKeys: new Set(),
21 | expandedKeys: new Set(),
22 | selectedKeys: new Set(),
23 | selectable: true,
24 | classNames: CLASS_NAMES,
25 | });
26 |
27 | export default Context;
28 | export { CLASS_NAMES };
29 |
--------------------------------------------------------------------------------
/stories/layout.stories.tsx:
--------------------------------------------------------------------------------
1 | import type { Meta, StoryObj } from "@storybook/react-vite";
2 | import { Layout } from "../dist";
3 | import React from "react";
4 |
5 | const meta: Meta = {
6 | title: "layout",
7 | component: Layout,
8 | parameters: {},
9 | tags: ["autodocs"],
10 | argTypes: {},
11 | };
12 |
13 | export default meta;
14 | type Story = StoryObj;
15 |
16 | export const Normal: Story = {
17 | args: {
18 | children: [
19 | heading,
20 | header,
21 | sidebar,
22 | main,
23 | footer,
24 | ],
25 | },
26 | };
27 |
--------------------------------------------------------------------------------
/src/components/icon/icons/action/translate.tsx:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import { withIcon } from "../../hoc";
3 |
4 | const Translate = withIcon(({ size }) => {
5 | return (
6 |
18 | );
19 | });
20 |
21 | export default Translate;
22 |
--------------------------------------------------------------------------------
/src/components/icon/icons/alert/add-alert.tsx:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import { withIcon } from "../../hoc";
3 |
4 | const AddAlert = withIcon(({ size }) => {
5 | return (
6 |
12 | );
13 | });
14 |
15 | export default AddAlert;
16 |
--------------------------------------------------------------------------------
/src/utils/react.ts:
--------------------------------------------------------------------------------
1 | import { Partialable } from "@aiszlab/relax/types";
2 | import { Children, isValidElement, type ReactNode } from "react";
3 |
4 | interface ElementProps {
5 | children?: ReactNode;
6 | }
7 |
8 | /**
9 | * @description
10 | * get the string of component children
11 | */
12 | export const toReactNodeText = (children: ReactNode): Partialable => {
13 | const _children = Children.toArray(children);
14 |
15 | for (const child of _children) {
16 | if (typeof child === "string" || typeof child === "number") {
17 | return child.toString();
18 | }
19 |
20 | if (isValidElement(child)) {
21 | const textInChild = toReactNodeText(child.props.children);
22 |
23 | if (textInChild) {
24 | return textInChild;
25 | }
26 | }
27 | }
28 | };
29 |
--------------------------------------------------------------------------------
/src/types/time-picker.ts:
--------------------------------------------------------------------------------
1 | import type { Dayjs } from "dayjs";
2 | import type { ComponentProps } from "./element";
3 |
4 | /**
5 | * @description
6 | * time picker props
7 | */
8 | export interface TimePickerProps extends ComponentProps {
9 | /**
10 | * @description
11 | * value
12 | * @default void 0
13 | */
14 | value?: Dayjs;
15 |
16 | /**
17 | * @description
18 | * change handler
19 | * @default void 0
20 | */
21 | onChange?: (value: Dayjs) => void;
22 | }
23 |
24 | /**
25 | * @description
26 | * panel props
27 | */
28 | export type PanelProps = Pick;
29 |
30 | /**
31 | * @description
32 | * panel ref
33 | */
34 | export type PanelRef = {
35 | /**
36 | * @description
37 | * value reset handler
38 | */
39 | reset: () => void;
40 | };
41 |
--------------------------------------------------------------------------------
/src/components/form/list/index.tsx:
--------------------------------------------------------------------------------
1 | import { type TypedFormList, type FormListProps } from "../../../types/form";
2 | import { type FieldsValue } from "../../../utils/form";
3 | import React from "react";
4 | import { List } from "./list";
5 | import Item from "../item";
6 | import { Item as ListItem } from "./item";
7 |
8 | /**
9 | * wrapped `Form.List` Component
10 | */
11 | function _List({
12 | children,
13 | ...itemProps
14 | }: FormListProps) {
15 | // no render, return null
16 | if (!children) return null;
17 |
18 | return (
19 | -
20 |
{children}
21 |
22 | );
23 | }
24 |
25 | const TypedList: TypedFormList = Object.assign(_List, {
26 | Item: ListItem,
27 | });
28 |
29 | export default TypedList;
30 |
--------------------------------------------------------------------------------
/src/types/ripple.ts:
--------------------------------------------------------------------------------
1 | import type { Key } from "react";
2 |
3 | /**
4 | * @description
5 | * ripple
6 | */
7 | export type Ripple = {
8 | /**
9 | * @description
10 | * uuid,for list render
11 | */
12 | key: Key;
13 |
14 | /**
15 | * @description
16 | * trigger position x
17 | */
18 | x: number;
19 |
20 | /**
21 | * @description
22 | * trigger position y
23 | */
24 | y: number;
25 |
26 | /**
27 | * @description
28 | * ripple size
29 | */
30 | size: number;
31 | };
32 |
33 | /**
34 | * @description
35 | * ripple props
36 | */
37 | export type RippleProps = {
38 | /**
39 | * @description
40 | * rendered ripples
41 | */
42 | ripples: Ripple[];
43 |
44 | /**
45 | * @description
46 | * clear ripple handler
47 | */
48 | onClear: (key: Key) => void;
49 | };
50 |
--------------------------------------------------------------------------------
/src/components/menu/context.ts:
--------------------------------------------------------------------------------
1 | import { createContext } from "react";
2 | import { type ContextValue } from "../../types/menu";
3 |
4 | /**
5 | * @description
6 | * class names
7 | */
8 | export const CLASS_NAMES = {
9 | menu: "menu",
10 | horizontal: "menu--horizontal",
11 | group: "menu__group",
12 | hidden: "menu__group--hidden",
13 | collapser: "menu__collapser",
14 | item: "menu__item",
15 | } as const;
16 |
17 | /**
18 | * @author murukal
19 | *
20 | * @description
21 | * menu context for all menu group or menu item
22 | */
23 | export const Context = createContext({
24 | selectedKeys: new Set(),
25 | expandedKeys: new Set(),
26 | click: () => {},
27 | toggle: () => {},
28 | collect: () => {},
29 | size: "medium",
30 | classNames: CLASS_NAMES,
31 | });
32 |
--------------------------------------------------------------------------------
/src/components/icon/icons/editor/attch-file.tsx:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import { withIcon } from "../../hoc";
3 |
4 | const AttachFile = withIcon(({ size }) => {
5 | return (
6 |
18 | );
19 | });
20 |
21 | export default AttachFile;
22 |
--------------------------------------------------------------------------------
/src/types/waterfall.ts:
--------------------------------------------------------------------------------
1 | import type { ReactNode } from "react";
2 | import type { ComponentProps } from "./element";
3 | import type { Gutter } from "../hooks/use-gutters";
4 |
5 | /**
6 | * @description
7 | * waterfall props
8 | */
9 | export type WaterfallProps = ComponentProps & {
10 | /**
11 | * @description
12 | * columns
13 | * @default 4
14 | */
15 | columns?: number;
16 |
17 | /**
18 | * @description
19 | * gutter
20 | * @default 8
21 | */
22 | gutter?: Gutter;
23 |
24 | /**
25 | * @description
26 | * items
27 | * @default void 0
28 | */
29 | children?: Exclude>[];
30 |
31 | /**
32 | * @description
33 | * sequential
34 | * use list order rather than add to the shortest column
35 | * @default false
36 | */
37 | sequential?: boolean;
38 | };
39 |
--------------------------------------------------------------------------------
/src/components/icon/icons/alert/notification-important.tsx:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import { withIcon } from "../../hoc";
3 |
4 | const NotificationImportant = withIcon(({ size }) => {
5 | return (
6 |
12 | );
13 | });
14 |
15 | export default NotificationImportant;
16 |
--------------------------------------------------------------------------------
/src/components/icon/icons/editor/format-bold.tsx:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import { withIcon } from "../../hoc";
3 |
4 | const FormatBold = withIcon(({ size }) => {
5 | return (
6 |
18 | );
19 | });
20 |
21 | export default FormatBold;
22 |
--------------------------------------------------------------------------------
/src/components/slider/handle.tsx:
--------------------------------------------------------------------------------
1 | import { create as $create, props as $props } from "@stylexjs/stylex";
2 | import { sizes } from "../theme/tokens.stylex";
3 | import { useContext } from "react";
4 | import Context from "./context";
5 | import { stringify } from "@aiszlab/relax/class-name";
6 | import React from "react";
7 |
8 | const _styles = $create({
9 | default: {
10 | width: sizes.xxxxxxxxxsmall,
11 | height: sizes.xxlarge,
12 | borderRadius: sizes.infinity,
13 | backgroundColor: "var(--color-primary)",
14 | },
15 | });
16 |
17 | /**
18 | * @description 滑块句柄
19 | */
20 | const Handle = () => {
21 | const { classNames } = useContext(Context);
22 | const styled = $props(_styles.default);
23 |
24 | return ;
25 | };
26 |
27 | export default Handle;
28 |
--------------------------------------------------------------------------------
/src/components/tooltip/tooltip.tsx:
--------------------------------------------------------------------------------
1 | import type { TooltipProps } from "../../types/tooltip";
2 | import React from "react";
3 | import { Popover } from "../popover";
4 | import { stringify } from "@aiszlab/relax/class-name";
5 | import { useClassNames } from "../../hooks/use-class-names";
6 | import { CLASS_NAMES } from "./context";
7 |
8 | const Tooltip = ({ children, className, style, title }: TooltipProps) => {
9 | const classNames = useClassNames(CLASS_NAMES);
10 |
11 | // when `title` is invalid, use children only
12 | if (!title) {
13 | return children;
14 | }
15 |
16 | // `Tooltip` title is used into `Popover` content!!! not a bug!
17 | return (
18 |
19 | {children}
20 |
21 | );
22 | };
23 |
24 | export default Tooltip;
25 |
--------------------------------------------------------------------------------
/src/components/popover/hooks.ts:
--------------------------------------------------------------------------------
1 | import { toArray } from "@aiszlab/relax";
2 | import { useMemo } from "react";
3 | import type { TriggerBy } from "../../types/popover";
4 |
5 | /**
6 | * @description
7 | * used triggers
8 | */
9 | export const useTriggerBy = (triggerBy: TriggerBy | TriggerBy[]) => {
10 | const _triggerBy = useMemo(() => new Set(toArray(triggerBy)), [triggerBy]);
11 |
12 | const isHoverable = useMemo(() => _triggerBy.has("hover"), [_triggerBy]);
13 |
14 | const isFocusable = useMemo(() => _triggerBy.has("focus"), [_triggerBy]);
15 |
16 | const isClickable = useMemo(() => _triggerBy.has("click"), [_triggerBy]);
17 |
18 | const isContextMenuable = useMemo(() => _triggerBy.has("contextMenu"), [_triggerBy]);
19 |
20 | return {
21 | isHoverable,
22 | isFocusable,
23 | isClickable,
24 | isContextMenuable,
25 | };
26 | };
27 |
--------------------------------------------------------------------------------
/src/components/form/field/supporting.tsx:
--------------------------------------------------------------------------------
1 | import React, { type ReactNode } from "react";
2 | import { create as $create, props as $props } from "@stylexjs/stylex";
3 | import { useTheme } from "../../theme";
4 | import { spacing } from "../../theme/tokens.stylex";
5 |
6 | const styles = $create({
7 | supporting: {
8 | color: "var(--color-secondary)",
9 | marginBlock: spacing.xxxxxsmall,
10 | },
11 | });
12 |
13 | const Supporting = ({ children }: { children?: ReactNode }) => {
14 | const theme = useTheme();
15 |
16 | const styled = $props(styles.supporting);
17 |
18 | return (
19 |
26 | {children}
27 |
28 | );
29 | };
30 |
31 | export default Supporting;
32 |
--------------------------------------------------------------------------------
/src/types/divider.ts:
--------------------------------------------------------------------------------
1 | import type { ReactNode } from "react";
2 | import type { ComponentProps } from "./element";
3 | import type { Gutter } from "../hooks/use-gutters";
4 |
5 | export type Align = "center" | "left" | "right";
6 |
7 | export type Orientation = "horizontal" | "vertical";
8 |
9 | /**
10 | * @description
11 | * divider props
12 | */
13 | export interface DividerProps extends ComponentProps {
14 | /**
15 | * @description
16 | * children
17 | * @default void 0
18 | */
19 | children?: ReactNode;
20 |
21 | /**
22 | * @description
23 | * align
24 | * @default "center"
25 | */
26 | align?: Align;
27 |
28 | /**
29 | * @description
30 | * orientation
31 | * @default "horizontal"
32 | */
33 | orientation?: Orientation;
34 |
35 | /**
36 | * @description
37 | * margin
38 | */
39 | margin?: Gutter;
40 | }
41 |
--------------------------------------------------------------------------------
/src/components/icon/icons/hardware/keyboard_command_key.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/components/icon/icons/image/bedtime.tsx:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import { withIcon } from "../../hoc";
3 |
4 | const Bedtime = withIcon(({ size }) => {
5 | return (
6 |
18 | );
19 | });
20 |
21 | export default Bedtime;
22 |
--------------------------------------------------------------------------------
/src/components/icon/icons/device/dark-mode.tsx:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import { withIcon } from "../../hoc";
3 |
4 | const DarkMode = withIcon(({ size }) => {
5 | return (
6 |
18 | );
19 | });
20 |
21 | export default DarkMode;
22 |
--------------------------------------------------------------------------------
/src/types/popconfirm.ts:
--------------------------------------------------------------------------------
1 | import type { DOMAttributes, ReactNode, RefAttributes } from "react";
2 | import type { PopoverProps } from "../components/popover";
3 | import type { ComponentProps } from "./element";
4 |
5 | export type ChildProps = Pick, "onClick"> & RefAttributes;
6 |
7 | /**
8 | * @description
9 | * popconfirm props
10 | */
11 | export type PopconfirmProps = Pick<
12 | PopoverProps>,
13 | "placement" | "title" | "content" | "offset"
14 | > &
15 | ComponentProps & {
16 | /**
17 | * @description
18 | * confirm handler
19 | */
20 | onConfirm?: () => void;
21 |
22 | /**
23 | * @description
24 | * cancel handler
25 | */
26 | onCancel?: () => void;
27 |
28 | /**
29 | * @description
30 | * children
31 | */
32 | children?: ReactNode;
33 | };
34 |
--------------------------------------------------------------------------------
/src/components/icon/icons/action/visibility.tsx:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import { withIcon } from "../../hoc";
3 |
4 | const Visibility = withIcon(({ size }) => {
5 | return (
6 |
12 | );
13 | });
14 |
15 | export default Visibility;
16 |
--------------------------------------------------------------------------------
/src/components/icon/icons/hardware/videogame_asset_off.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/components/icon/icons/file/file-upload.tsx:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import { withIcon } from "../../hoc";
3 |
4 | const FileUpload = withIcon(({ size }) => {
5 | return (
6 |
18 | );
19 | });
20 |
21 | export default FileUpload;
22 |
--------------------------------------------------------------------------------
/src/types/tag.ts:
--------------------------------------------------------------------------------
1 | import type { MouseEvent, ReactNode } from "react";
2 | import type { ComponentProps } from "./element";
3 |
4 | type Size = "small" | "medium" | "large";
5 |
6 | /**
7 | * @description
8 | * tag props
9 | */
10 | export type TagProps = ComponentProps & {
11 | /**
12 | * @description
13 | * children
14 | * @default void 0
15 | */
16 | children?: ReactNode;
17 |
18 | /**
19 | * @description
20 | * size
21 | * @default "medium"
22 | */
23 | size?: Size;
24 |
25 | /**
26 | * @description
27 | * if current tag is closable
28 | * @default false
29 | */
30 | closable?: boolean;
31 |
32 | /**
33 | * @description
34 | * close handler
35 | */
36 | onClose?: (event: MouseEvent) => void;
37 |
38 | /**
39 | * @description
40 | * leading node
41 | * @default void 0
42 | */
43 | leading?: ReactNode;
44 | };
45 |
--------------------------------------------------------------------------------
/src/components/icon/icons/alert/auto-delete.tsx:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import { withIcon } from "../../hoc";
3 |
4 | const AutoDelete = withIcon(({ size }) => {
5 | return (
6 |
14 | );
15 | });
16 |
17 | export default AutoDelete;
18 |
--------------------------------------------------------------------------------
/src/components/form/hooks/use-watch.ts:
--------------------------------------------------------------------------------
1 | import { useState } from "react";
2 | import { FORM_TOKEN, type FieldsValue } from "../../../utils/form";
3 | import { useFormContext } from "../context";
4 | import { useMounted } from "@aiszlab/relax";
5 | import type { UsedForm } from "../../../types/form";
6 |
7 | /**
8 | * @description watch form item
9 | */
10 | export const useWatch = (
11 | name: FieldKey,
12 | usedForm?: UsedForm,
13 | ) => {
14 | const [value, setValue] = useState();
15 | const { form } = useFormContext();
16 |
17 | useMounted(() => {
18 | if (!name) return;
19 |
20 | const unregister = (usedForm?.[FORM_TOKEN] ?? form)?.watch(name, (_changedValue) => {
21 | setValue(_changedValue);
22 | });
23 |
24 | return () => {
25 | unregister?.();
26 | };
27 | });
28 |
29 | return value;
30 | };
31 |
--------------------------------------------------------------------------------
/src/types/textarea.ts:
--------------------------------------------------------------------------------
1 | import type { TextareaHTMLAttributes } from "react";
2 | import type { ComponentProps } from "./element";
3 |
4 | /**
5 | * @description
6 | * textarea props
7 | */
8 | export type TextareaProps = ComponentProps &
9 | Pick, "onBlur" | "placeholder"> & {
10 | /**
11 | * @description
12 | * value
13 | */
14 | value?: string;
15 |
16 | /**
17 | * @description
18 | * invalid
19 | * @default false
20 | */
21 | invalid?: boolean;
22 |
23 | /**
24 | * @description
25 | * value change handler
26 | */
27 | onChange?: (value: string) => void;
28 |
29 | /**
30 | * @description
31 | * resize
32 | * when `true`, show `resize`
33 | * @default true
34 | */
35 | resize?: boolean;
36 |
37 | /**
38 | * border
39 | */
40 | border?: boolean;
41 | };
42 |
--------------------------------------------------------------------------------
/src/components/theme/theme-provider.tsx:
--------------------------------------------------------------------------------
1 | import React, { useMemo } from "react";
2 | import type { Props, Theme } from "../../types/theme";
3 | import { Context, PALETTE, useSwitchable } from "./hooks";
4 | import { merge } from "@aiszlab/relax";
5 |
6 | /**
7 | * @author murukal
8 | *
9 | * @description
10 | * theme provider
11 | * if user provider theme, we will merge it with presets theme
12 | */
13 | const ThemeProvider = ({ theme: _theme, children }: Props) => {
14 | const theme = useMemo(() => {
15 | if (!_theme) {
16 | return {
17 | palette: PALETTE,
18 | };
19 | }
20 |
21 | return merge(_theme, {
22 | palette: PALETTE,
23 | });
24 | }, [_theme]);
25 |
26 | const { mode, toggle, colors } = useSwitchable({ theme });
27 |
28 | return {children};
29 | };
30 |
31 | export default ThemeProvider;
32 |
--------------------------------------------------------------------------------
/src/types/clock.ts:
--------------------------------------------------------------------------------
1 | import type { ComponentProps } from "./element";
2 |
3 | export type TimeUnit = "hour" | "minute" | "second";
4 |
5 | type Value = [number, number, number];
6 |
7 | /**
8 | * @description
9 | * clock props
10 | */
11 | export type ClockProps = ComponentProps & {
12 | /**
13 | * @description
14 | * value
15 | * @default void 0
16 | */
17 | value?: Value;
18 |
19 | /**
20 | * @description
21 | * change handler
22 | * @default void 0
23 | */
24 | onChange?: (value: Value) => void;
25 | };
26 |
27 | /**
28 | * @description
29 | * column props
30 | */
31 | export interface ColumnProps {
32 | /**
33 | * @description
34 | * value
35 | */
36 | value?: number;
37 |
38 | /**
39 | * @description
40 | * unit
41 | */
42 | unit: TimeUnit;
43 |
44 | /**
45 | * @description
46 | * change handler
47 | */
48 | onChange?: (value: number) => void;
49 | }
50 |
--------------------------------------------------------------------------------
/src/components/time-picker/hooks.ts:
--------------------------------------------------------------------------------
1 | import { useControlledState } from "@aiszlab/relax";
2 | import type { TimePickerProps } from "../../types/time-picker";
3 | import dayjs from "dayjs";
4 | import { type RefObject, useCallback } from "react";
5 | import type { PickerRef } from "../../types/picker";
6 | import type { Nullable } from "@aiszlab/relax/types";
7 |
8 | /**
9 | * @description
10 | * value
11 | */
12 | export const useValue = ([valueInProps, pickerRef]: [
13 | TimePickerProps["value"],
14 | RefObject>,
15 | ]) => {
16 | const [value, setValue] = useControlledState(valueInProps, { defaultState: dayjs() });
17 |
18 | const onChange = useCallback["onChange"]>(
19 | (value) => {
20 | setValue(value);
21 | pickerRef.current?.close();
22 | },
23 | [setValue, pickerRef],
24 | );
25 |
26 | return {
27 | value,
28 | onChange,
29 | };
30 | };
31 |
--------------------------------------------------------------------------------
/src/components/tour/hooks.ts:
--------------------------------------------------------------------------------
1 | import { useCounter } from "@aiszlab/relax";
2 | import type { TourStep } from "../../types/tour";
3 | import { useEffect } from "react";
4 |
5 | /**
6 | * @description
7 | * use step
8 | */
9 | export const useStep = ({ steps, open }: { steps: TourStep[]; open: boolean }) => {
10 | const [stepAt, { add, subtract, reset }] = useCounter(0, { min: 0, max: steps.length - 1 });
11 | const step = steps[stepAt];
12 | const hasNext = stepAt < steps.length - 1;
13 | const hasPrev = stepAt > 0;
14 |
15 | const next = () => {
16 | add();
17 | };
18 |
19 | const prev = () => {
20 | subtract();
21 | };
22 |
23 | useEffect(() => {
24 | if (open) {
25 | reset();
26 | return;
27 | }
28 | // eslint-disable-next-line react-hooks/exhaustive-deps
29 | }, [open]);
30 |
31 | return {
32 | step,
33 | hasNext,
34 | hasPrev,
35 | next,
36 | prev,
37 | };
38 | };
39 |
--------------------------------------------------------------------------------
/src/components/icon/icons/hardware/headset_off.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/components/icon/icons/hardware/developer_board_off.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/components/date-picker/hooks.ts:
--------------------------------------------------------------------------------
1 | import { useControlledState } from "@aiszlab/relax";
2 | import type { DatePickerProps } from "../../types/date-picker";
3 | import { type RefObject, useCallback } from "react";
4 | import type { PickerRef } from "../../types/picker";
5 | import type { Nullable } from "@aiszlab/relax/types";
6 |
7 | /**
8 | * @description
9 | * value
10 | */
11 | export const useValue = ([_value, _change, _ref]: [
12 | DatePickerProps["value"],
13 | DatePickerProps["onChange"],
14 | RefObject>,
15 | ]) => {
16 | const [value, setValue] = useControlledState(_value);
17 |
18 | // change handler
19 | const onChange = useCallback["onChange"]>(
20 | (_value) => {
21 | setValue(_value);
22 | _change?.(_value);
23 | _ref.current?.close();
24 | },
25 | [_change, setValue, _ref],
26 | );
27 |
28 | return {
29 | value,
30 | onChange,
31 | };
32 | };
33 |
--------------------------------------------------------------------------------
/src/components/icon/icons/action/preview.tsx:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import { withIcon } from "../../hoc";
3 |
4 | const Preview = withIcon(({ size }) => {
5 | return (
6 |
18 | );
19 | });
20 |
21 | export default Preview;
22 |
--------------------------------------------------------------------------------
/src/components/radio/group.tsx:
--------------------------------------------------------------------------------
1 | import React, { useCallback, useMemo } from "react";
2 | import { Context } from "./context";
3 | import type { ContextValue, RadioGroupProps } from "../../types/radio";
4 | import { useControlledState } from "@aiszlab/relax";
5 |
6 | const Group = ({ disabled = false, children, ...props }: RadioGroupProps) => {
7 | // controlled value
8 | const [value, setValue] = useControlledState(props.value);
9 |
10 | // value change handler
11 | const change = useCallback(
12 | (value) => {
13 | setValue(value);
14 | },
15 | [setValue],
16 | );
17 |
18 | // context value
19 | const contextValue = useMemo(
20 | () => ({
21 | value,
22 | change,
23 | isDisabled: disabled,
24 | }),
25 | [value, change, disabled],
26 | );
27 |
28 | return {children};
29 | };
30 |
31 | export default Group;
32 |
--------------------------------------------------------------------------------
/src/components/number-input/number-input.tsx:
--------------------------------------------------------------------------------
1 | import React, { useMemo } from "react";
2 | import { Input } from "../input";
3 | import { useEvent, useFocus } from "@aiszlab/relax";
4 | import { useValue } from "./hooks";
5 | import type { NumberInputProps } from "../../types/number-input";
6 |
7 | const NumberInput = ({ value: __value, formatter: _formatter }: NumberInputProps) => {
8 | const [isFocused, focusProps] = useFocus();
9 | const { value: _value, change } = useValue({ value: __value });
10 |
11 | // formatter
12 | const formatter = useEvent((value?: string) => {
13 | if (!_formatter) return _value;
14 | formatter(value);
15 | });
16 |
17 | const value = useMemo(() => {
18 | if (isFocused) {
19 | return _value;
20 | }
21 | return formatter(_value);
22 | }, [isFocused, formatter, _value]);
23 |
24 | return ;
25 | };
26 |
27 | export default NumberInput;
28 |
--------------------------------------------------------------------------------
/src/components/icon/icons/action/zoom-out.tsx:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import { withIcon } from "../../hoc";
3 |
4 | const ZoomOut = withIcon(({ size }) => {
5 | return (
6 |
12 | );
13 | });
14 |
15 | export default ZoomOut;
16 |
--------------------------------------------------------------------------------
/src/components/icon/icons/content/link-off.tsx:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import { withIcon } from "../../hoc";
3 |
4 | const LinkOff = withIcon(({ size }) => {
5 | return (
6 |
18 | );
19 | });
20 |
21 | export default LinkOff;
22 |
--------------------------------------------------------------------------------
/src/components/kbd/utils.ts:
--------------------------------------------------------------------------------
1 | import type { KbdKey } from "../../types/kbd";
2 |
3 | export const KBD_KEYS: Record = {
4 | command: "⌘",
5 | shift: "⇧",
6 | ctrl: "⌃",
7 | option: "⌥",
8 | enter: "↵",
9 | delete: "⌫",
10 | escape: "⎋",
11 | tab: "⇥",
12 | capslock: "⇪",
13 | up: "↑",
14 | right: "→",
15 | down: "↓",
16 | left: "←",
17 | pageup: "⇞",
18 | pagedown: "⇟",
19 | home: "↖",
20 | end: "↘",
21 | help: "?",
22 | space: "␣",
23 | };
24 |
25 | export const KBD_LABELS: Record = {
26 | command: "Command",
27 | shift: "Shift",
28 | ctrl: "Control",
29 | option: "Option",
30 | enter: "Enter",
31 | delete: "Delete",
32 | escape: "Escape",
33 | tab: "Tab",
34 | capslock: "Caps Lock",
35 | up: "Up",
36 | right: "Right",
37 | down: "Down",
38 | left: "Left",
39 | pageup: "Page Up",
40 | pagedown: "Page Down",
41 | home: "Home",
42 | end: "End",
43 | help: "Help",
44 | space: "Space",
45 | };
46 |
--------------------------------------------------------------------------------
/stories/upload.stories.tsx:
--------------------------------------------------------------------------------
1 | import type { Meta, StoryObj } from "@storybook/react-vite";
2 | import { Upload } from "../dist";
3 |
4 | const meta: Meta = {
5 | title: "upload",
6 | component: Upload,
7 | parameters: {},
8 | tags: ["autodocs"],
9 | argTypes: {},
10 | };
11 |
12 | export default meta;
13 | type Story = StoryObj;
14 |
15 | export const Normal: Story = {
16 | args: {
17 | renderItem: "picture",
18 | value: [
19 | {
20 | status: "success",
21 | url: "https://fantu-1304340057.cos.ap-shanghai.myqcloud.com/stack-logos/4eddf664-1bb3-4cc1-800d-518aa5e884fe",
22 | },
23 | ],
24 | multiple: true,
25 | },
26 | };
27 |
28 | export const PictureFallback: Story = {
29 | args: {
30 | renderItem: "picture",
31 | value: [
32 | {
33 | status: "success",
34 | url: "invalid-url",
35 | },
36 | ],
37 | multiple: true,
38 | },
39 | };
40 |
--------------------------------------------------------------------------------
/src/components/config/provider.tsx:
--------------------------------------------------------------------------------
1 | import React, { useMemo, useRef } from "react";
2 | import Context from "./context";
3 | import { Holder, type HolderRef } from "../notification";
4 | import type { ConfigProps } from "../../types/config";
5 | import { LocaleContext, DEFAULT_LOCALE } from "../../locale";
6 | import { merge } from "@aiszlab/relax";
7 |
8 | const ConfigProvider = ({ children, prefix = "musae", locale: _locale }: ConfigProps) => {
9 | const notifierRef = useRef(null);
10 |
11 | const locale = useMemo(() => {
12 | return merge(DEFAULT_LOCALE, _locale ?? {});
13 | }, [_locale]);
14 |
15 | return (
16 |
22 |
23 | {children}
24 |
25 |
26 |
27 | );
28 | };
29 |
30 | export default ConfigProvider;
31 |
--------------------------------------------------------------------------------