@indielayer/ui 0.2.3 → 1.0.0-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +28 -12
- package/env.d.ts +1 -0
- package/lib/components/alert/Alert.vue.d.ts +42 -0
- package/lib/components/avatar/Avatar.vue.d.ts +49 -0
- package/lib/components/badge/Badge.vue.d.ts +70 -0
- package/lib/components/breadcrumbs/Breadcrumbs.vue.d.ts +30 -0
- package/lib/components/button/Button.vue.d.ts +87 -0
- package/lib/components/button/ButtonGroup.vue.d.ts +49 -0
- package/lib/components/card/Card.vue.d.ts +17 -0
- package/lib/components/checkbox/Checkbox.vue.d.ts +81 -0
- package/lib/components/collapse/Collapse.vue.d.ts +47 -0
- package/lib/components/container/Container.vue.d.ts +14 -0
- package/lib/components/divider/Divider.vue.d.ts +10 -0
- package/lib/components/drawer/Drawer.vue.d.ts +73 -0
- package/lib/components/form/Form.vue.d.ts +46 -0
- package/lib/components/icon/Icon.vue.d.ts +36 -0
- package/lib/components/image/Image.vue.d.ts +8 -0
- package/lib/components/index.d.ts +45 -0
- package/lib/components/input/Input.vue.d.ts +114 -0
- package/lib/components/link/Link.vue.d.ts +36 -0
- package/lib/components/menu/Menu.vue.d.ts +50 -0
- package/lib/components/menu/MenuItem.vue.d.ts +102 -0
- package/lib/components/modal/Modal.vue.d.ts +34 -0
- package/lib/components/notifications/Notifications.vue.d.ts +104 -0
- package/lib/components/pagination/Pagination.vue.d.ts +58 -0
- package/lib/components/pagination/PaginationItem.vue.d.ts +32 -0
- package/lib/components/popover/Popover.vue.d.ts +64 -0
- package/lib/components/popover/PopoverContainer.vue.d.ts +14 -0
- package/lib/components/progress/Progress.vue.d.ts +42 -0
- package/lib/components/radio/Radio.vue.d.ts +79 -0
- package/lib/components/scroll/Scroll.vue.d.ts +29 -0
- package/lib/components/select/Select.vue.d.ts +100 -0
- package/lib/components/skeleton/Skeleton.vue.d.ts +14 -0
- package/lib/components/slider/Slider.vue.d.ts +96 -0
- package/lib/components/spacer/Spacer.vue.d.ts +2 -0
- package/lib/components/spinner/Spinner.vue.d.ts +16 -0
- package/lib/components/tab/Tab.vue.d.ts +47 -0
- package/lib/components/tab/TabGroup.vue.d.ts +41 -0
- package/lib/components/table/Table.vue.d.ts +81 -0
- package/lib/components/table/TableBody.vue.d.ts +2 -0
- package/lib/components/table/TableCell.vue.d.ts +33 -0
- package/lib/components/table/TableHead.vue.d.ts +2 -0
- package/lib/components/table/TableHeader.vue.d.ts +33 -0
- package/lib/components/table/TableRow.vue.d.ts +23 -0
- package/lib/components/tag/Tag.vue.d.ts +45 -0
- package/lib/components/textarea/Textarea.vue.d.ts +101 -0
- package/lib/components/toggle/Toggle.vue.d.ts +79 -0
- package/lib/components/tooltip/Tooltip.vue.d.ts +2 -0
- package/lib/composables/colors-utils.d.ts +8 -0
- package/lib/composables/colors.d.ts +26 -0
- package/lib/composables/common.d.ts +14 -0
- package/lib/composables/css.d.ts +5 -0
- package/lib/composables/index.d.ts +7 -0
- package/lib/composables/inputtable.d.ts +37 -0
- package/lib/composables/interactive.d.ts +10 -0
- package/lib/composables/keys.d.ts +7 -0
- package/lib/composables/notification.d.ts +1 -0
- package/lib/create.d.ts +11 -0
- package/lib/index.cjs.js +15 -0
- package/lib/index.d.ts +6 -0
- package/lib/index.es.js +6164 -0
- package/lib/install.d.ts +4 -0
- package/lib/nuxt.js +32 -0
- package/lib/nuxt.plugin.js +8 -0
- package/lib/style.css +1 -0
- package/lib/tailwind.preset.js +43 -14
- package/lib/version.d.ts +2 -0
- package/package.json +48 -28
- package/src/components/alert/Alert.vue +164 -0
- package/src/components/avatar/Avatar.vue +114 -97
- package/src/components/badge/Badge.vue +107 -0
- package/src/components/breadcrumbs/Breadcrumbs.vue +60 -0
- package/src/components/button/Button.vue +405 -128
- package/src/components/button/ButtonGroup.vue +73 -0
- package/src/components/card/Card.vue +16 -21
- package/src/components/checkbox/Checkbox.vue +162 -85
- package/src/components/collapse/Collapse.vue +152 -89
- package/src/components/container/Container.vue +13 -11
- package/src/components/divider/Divider.vue +15 -19
- package/src/components/drawer/Drawer.vue +244 -0
- package/src/components/form/Form.vue +32 -22
- package/src/components/icon/Icon.vue +43 -33
- package/src/components/image/Image.vue +26 -20
- package/src/components/index.ts +45 -0
- package/src/components/input/Input.vue +149 -146
- package/src/components/link/Link.vue +73 -52
- package/src/components/menu/Menu.vue +118 -0
- package/src/components/menu/MenuItem.vue +277 -0
- package/src/components/modal/Modal.vue +157 -93
- package/src/components/notifications/Notifications.vue +318 -0
- package/src/components/pagination/Pagination.vue +157 -50
- package/src/components/pagination/PaginationItem.vue +49 -26
- package/src/components/popover/Popover.vue +167 -146
- package/src/components/popover/PopoverContainer.vue +13 -18
- package/src/components/progress/Progress.vue +68 -102
- package/src/components/radio/Radio.vue +161 -92
- package/src/components/scroll/Scroll.vue +143 -0
- package/src/components/select/Select.vue +362 -109
- package/src/components/skeleton/Skeleton.vue +13 -11
- package/src/components/slider/Slider.vue +240 -0
- package/src/components/spacer/Spacer.vue +8 -0
- package/src/components/spinner/Spinner.vue +28 -28
- package/src/components/tab/Tab.vue +100 -0
- package/src/components/tab/TabGroup.vue +151 -0
- package/src/components/table/Table.vue +101 -86
- package/src/components/table/TableBody.vue +8 -6
- package/src/components/table/TableCell.vue +43 -55
- package/src/components/table/TableHead.vue +9 -7
- package/src/components/table/TableHeader.vue +39 -54
- package/src/components/table/TableRow.vue +26 -34
- package/src/components/tag/Tag.vue +67 -62
- package/src/components/textarea/Textarea.vue +116 -126
- package/src/components/toggle/Toggle.vue +117 -101
- package/src/components/tooltip/Tooltip.vue +18 -14
- package/src/composables/colors-utils.ts +378 -0
- package/src/composables/colors.ts +82 -0
- package/src/composables/common.ts +20 -0
- package/src/composables/css.ts +45 -0
- package/src/composables/index.ts +7 -0
- package/src/composables/{inputtable.js → inputtable.ts} +45 -74
- package/src/composables/interactive.ts +16 -0
- package/src/composables/keys.ts +8 -0
- package/src/composables/notification.ts +10 -0
- package/src/create.ts +36 -0
- package/src/exports/nuxt.js +32 -0
- package/src/exports/nuxt.plugin.js +8 -0
- package/src/exports/tailwind.preset.js +55 -0
- package/src/index.ts +8 -0
- package/src/install.ts +8 -0
- package/src/shims-vue.d.ts +6 -0
- package/src/version.ts +1 -0
- package/volar.d.ts +52 -0
- package/lib/cjs/components/avatar/Avatar.vue.js +0 -9
- package/lib/cjs/components/avatar/Avatar.vue_vue_type_script_lang.js +0 -86
- package/lib/cjs/components/avatar/Avatar.vue_vue_type_template_id_2549fb8f_lang.js +0 -50
- package/lib/cjs/components/button/Button.vue.js +0 -9
- package/lib/cjs/components/button/Button.vue_vue_type_script_lang.js +0 -82
- package/lib/cjs/components/button/Button.vue_vue_type_template_id_5975756f_lang.js +0 -100
- package/lib/cjs/components/card/Card.vue.js +0 -9
- package/lib/cjs/components/card/Card.vue_vue_type_script_lang.js +0 -18
- package/lib/cjs/components/card/Card.vue_vue_type_template_id_7be81122_lang.js +0 -22
- package/lib/cjs/components/checkbox/Checkbox.vue.js +0 -9
- package/lib/cjs/components/checkbox/Checkbox.vue_vue_type_script_lang.js +0 -58
- package/lib/cjs/components/checkbox/Checkbox.vue_vue_type_template_id_fa43bd62_lang.js +0 -102
- package/lib/cjs/components/collapse/Collapse.vue.js +0 -9
- package/lib/cjs/components/collapse/Collapse.vue_vue_type_script_lang.js +0 -66
- package/lib/cjs/components/collapse/Collapse.vue_vue_type_template_id_06a1c88f_lang.js +0 -64
- package/lib/cjs/components/colors.vue.js +0 -12
- package/lib/cjs/components/colors.vue_vue_type_template_id_79d16100_lang.js +0 -406
- package/lib/cjs/components/container/Container.vue.js +0 -9
- package/lib/cjs/components/container/Container.vue_vue_type_script_lang.js +0 -14
- package/lib/cjs/components/container/Container.vue_vue_type_template_id_05f5acf3_lang.js +0 -16
- package/lib/cjs/components/divider/Divider.vue.js +0 -9
- package/lib/cjs/components/divider/Divider.vue_vue_type_script_lang.js +0 -18
- package/lib/cjs/components/divider/Divider.vue_vue_type_template_id_3a349aa3_lang.js +0 -49
- package/lib/cjs/components/form/Form.vue.js +0 -9
- package/lib/cjs/components/form/Form.vue_vue_type_script_lang.js +0 -95
- package/lib/cjs/components/form/Form.vue_vue_type_template_id_a6cab022_lang.js +0 -20
- package/lib/cjs/components/icon/Icon.vue.js +0 -9
- package/lib/cjs/components/icon/Icon.vue_vue_type_script_lang.js +0 -26
- package/lib/cjs/components/icon/Icon.vue_vue_type_template_id_0933a10f_lang.js +0 -32
- package/lib/cjs/components/image/Image.vue.js +0 -9
- package/lib/cjs/components/image/Image.vue_vue_type_script_lang.js +0 -28
- package/lib/cjs/components/image/Image.vue_vue_type_template_id_f1ec3bb2_lang.js +0 -13
- package/lib/cjs/components/index.js +0 -87
- package/lib/cjs/components/input/Input.vue.js +0 -9
- package/lib/cjs/components/input/Input.vue_vue_type_script_lang.js +0 -101
- package/lib/cjs/components/input/Input.vue_vue_type_template_id_21c870c5_lang.js +0 -126
- package/lib/cjs/components/link/Link.vue.js +0 -9
- package/lib/cjs/components/link/Link.vue_vue_type_script_lang.js +0 -47
- package/lib/cjs/components/link/Link.vue_vue_type_template_id_044f59af_lang.js +0 -59
- package/lib/cjs/components/modal/Modal.vue.js +0 -9
- package/lib/cjs/components/modal/Modal.vue_vue_type_script_lang.js +0 -55
- package/lib/cjs/components/modal/Modal.vue_vue_type_template_id_177f8d4b_lang.js +0 -81
- package/lib/cjs/components/note/Note.vue.js +0 -9
- package/lib/cjs/components/note/Note.vue_vue_type_script_lang.js +0 -24
- package/lib/cjs/components/note/Note.vue_vue_type_template_id_2b99d6a2_lang.js +0 -100
- package/lib/cjs/components/pagination/Pagination.vue.js +0 -9
- package/lib/cjs/components/pagination/Pagination.vue_vue_type_script_lang.js +0 -43
- package/lib/cjs/components/pagination/Pagination.vue_vue_type_template_id_084845ef_lang.js +0 -54
- package/lib/cjs/components/pagination/PaginationItem.vue.js +0 -9
- package/lib/cjs/components/pagination/PaginationItem.vue_vue_type_script_lang.js +0 -24
- package/lib/cjs/components/pagination/PaginationItem.vue_vue_type_template_id_241a3fbc_lang.js +0 -27
- package/lib/cjs/components/popover/Popover.vue.js +0 -10
- package/lib/cjs/components/popover/Popover.vue_vue_type_script_lang.js +0 -72
- package/lib/cjs/components/popover/Popover.vue_vue_type_style_index_0_id_da70cc8a_lang.css.js +0 -8
- package/lib/cjs/components/popover/Popover.vue_vue_type_template_id_da70cc8a_lang.js +0 -63
- package/lib/cjs/components/popover/PopoverContainer.vue.js +0 -9
- package/lib/cjs/components/popover/PopoverContainer.vue_vue_type_script_lang.js +0 -21
- package/lib/cjs/components/popover/PopoverContainer.vue_vue_type_template_id_798f1294_lang.js +0 -16
- package/lib/cjs/components/popover/PopoverItem.vue.js +0 -9
- package/lib/cjs/components/popover/PopoverItem.vue_vue_type_script_lang.js +0 -34
- package/lib/cjs/components/popover/PopoverItem.vue_vue_type_template_id_84692424_lang.js +0 -50
- package/lib/cjs/components/progress/Progress.vue.js +0 -9
- package/lib/cjs/components/progress/Progress.vue_vue_type_script_lang.js +0 -62
- package/lib/cjs/components/progress/Progress.vue_vue_type_template_id_9ab7cee2_lang.js +0 -77
- package/lib/cjs/components/radio/Radio.vue.js +0 -9
- package/lib/cjs/components/radio/Radio.vue_vue_type_script_lang.js +0 -61
- package/lib/cjs/components/radio/Radio.vue_vue_type_template_id_808cc132_lang.js +0 -120
- package/lib/cjs/components/select/Select.vue.js +0 -9
- package/lib/cjs/components/select/Select.vue_vue_type_script_lang.js +0 -62
- package/lib/cjs/components/select/Select.vue_vue_type_template_id_18b7de2f_lang.js +0 -122
- package/lib/cjs/components/skeleton/Skeleton.vue.js +0 -9
- package/lib/cjs/components/skeleton/Skeleton.vue_vue_type_script_lang.js +0 -14
- package/lib/cjs/components/skeleton/Skeleton.vue_vue_type_template_id_6ac606e2_lang.js +0 -18
- package/lib/cjs/components/spacer/Spacer.vue.js +0 -12
- package/lib/cjs/components/spacer/Spacer.vue_vue_type_template_id_793ae82f_lang.js +0 -13
- package/lib/cjs/components/spinner/Spinner.vue.js +0 -9
- package/lib/cjs/components/spinner/Spinner.vue_vue_type_script_lang.js +0 -14
- package/lib/cjs/components/spinner/Spinner.vue_vue_type_template_id_714bd8a3_lang.js +0 -29
- package/lib/cjs/components/status/StatusDot.vue.js +0 -9
- package/lib/cjs/components/status/StatusDot.vue_vue_type_script_lang.js +0 -24
- package/lib/cjs/components/status/StatusDot.vue_vue_type_template_id_367d150a_lang.js +0 -25
- package/lib/cjs/components/table/Table.vue.js +0 -9
- package/lib/cjs/components/table/Table.vue_vue_type_script_lang.js +0 -117
- package/lib/cjs/components/table/Table.vue_vue_type_template_id_c0433c66_lang.js +0 -88
- package/lib/cjs/components/table/TableBody.vue.js +0 -9
- package/lib/cjs/components/table/TableBody.vue_vue_type_script_lang.js +0 -7
- package/lib/cjs/components/table/TableBody.vue_vue_type_template_id_7288bc0f_lang.js +0 -13
- package/lib/cjs/components/table/TableCell.vue.js +0 -9
- package/lib/cjs/components/table/TableCell.vue_vue_type_script_lang.js +0 -63
- package/lib/cjs/components/table/TableCell.vue_vue_type_template_id_5349a862_lang.js +0 -35
- package/lib/cjs/components/table/TableHead.vue.js +0 -9
- package/lib/cjs/components/table/TableHead.vue_vue_type_script_lang.js +0 -7
- package/lib/cjs/components/table/TableHead.vue_vue_type_template_id_6ae9fd66_lang.js +0 -18
- package/lib/cjs/components/table/TableHeader.vue.js +0 -9
- package/lib/cjs/components/table/TableHeader.vue_vue_type_script_lang.js +0 -48
- package/lib/cjs/components/table/TableHeader.vue_vue_type_template_id_9d5bd38c_lang.js +0 -78
- package/lib/cjs/components/table/TableRow.vue.js +0 -9
- package/lib/cjs/components/table/TableRow.vue_vue_type_script_lang.js +0 -33
- package/lib/cjs/components/table/TableRow.vue_vue_type_template_id_7c4a8ffd_lang.js +0 -26
- package/lib/cjs/components/tabs/Tab.vue.js +0 -9
- package/lib/cjs/components/tabs/Tab.vue_vue_type_script_lang.js +0 -62
- package/lib/cjs/components/tabs/Tab.vue_vue_type_template_id_3cfc6374_lang.js +0 -29
- package/lib/cjs/components/tabs/Tabs.vue.js +0 -9
- package/lib/cjs/components/tabs/Tabs.vue_vue_type_script_lang.js +0 -37
- package/lib/cjs/components/tabs/Tabs.vue_vue_type_template_id_663bac2f_lang.js +0 -16
- package/lib/cjs/components/tag/Tag.vue.js +0 -9
- package/lib/cjs/components/tag/Tag.vue_vue_type_script_lang.js +0 -39
- package/lib/cjs/components/tag/Tag.vue_vue_type_template_id_0aa571b6_lang.js +0 -77
- package/lib/cjs/components/textarea/Textarea.vue.js +0 -9
- package/lib/cjs/components/textarea/Textarea.vue_vue_type_script_lang.js +0 -113
- package/lib/cjs/components/textarea/Textarea.vue_vue_type_template_id_03d2272f_lang.js +0 -70
- package/lib/cjs/components/toast/Toast.vue.js +0 -9
- package/lib/cjs/components/toast/Toast.vue_vue_type_script_lang.js +0 -87
- package/lib/cjs/components/toast/Toast.vue_vue_type_template_id_fe243282_lang.js +0 -64
- package/lib/cjs/components/toggle/Toggle.vue.js +0 -9
- package/lib/cjs/components/toggle/Toggle.vue_vue_type_script_lang.js +0 -58
- package/lib/cjs/components/toggle/Toggle.vue_vue_type_template_id_5a9e0b2f_lang.js +0 -96
- package/lib/cjs/components/tooltip/Tooltip.vue.js +0 -9
- package/lib/cjs/components/tooltip/Tooltip.vue_vue_type_script_lang.js +0 -15
- package/lib/cjs/components/tooltip/Tooltip.vue_vue_type_template_id_213cff12_lang.js +0 -30
- package/lib/cjs/composables/common.js +0 -28
- package/lib/cjs/composables/inputtable.js +0 -162
- package/lib/cjs/composables/interactive.js +0 -41
- package/lib/cjs/index.js +0 -129
- package/lib/cjs/node_modules/style-inject/dist/style-inject.es.js +0 -30
- package/lib/esm/components/avatar/Avatar.vue.js +0 -6
- package/lib/esm/components/avatar/Avatar.vue_vue_type_script_lang.js +0 -84
- package/lib/esm/components/avatar/Avatar.vue_vue_type_template_id_2549fb8f_lang.js +0 -46
- package/lib/esm/components/button/Button.vue.js +0 -6
- package/lib/esm/components/button/Button.vue_vue_type_script_lang.js +0 -80
- package/lib/esm/components/button/Button.vue_vue_type_template_id_5975756f_lang.js +0 -96
- package/lib/esm/components/card/Card.vue.js +0 -6
- package/lib/esm/components/card/Card.vue_vue_type_script_lang.js +0 -16
- package/lib/esm/components/card/Card.vue_vue_type_template_id_7be81122_lang.js +0 -18
- package/lib/esm/components/checkbox/Checkbox.vue.js +0 -6
- package/lib/esm/components/checkbox/Checkbox.vue_vue_type_script_lang.js +0 -56
- package/lib/esm/components/checkbox/Checkbox.vue_vue_type_template_id_fa43bd62_lang.js +0 -98
- package/lib/esm/components/collapse/Collapse.vue.js +0 -6
- package/lib/esm/components/collapse/Collapse.vue_vue_type_script_lang.js +0 -64
- package/lib/esm/components/collapse/Collapse.vue_vue_type_template_id_06a1c88f_lang.js +0 -60
- package/lib/esm/components/colors.vue.js +0 -10
- package/lib/esm/components/colors.vue_vue_type_template_id_79d16100_lang.js +0 -402
- package/lib/esm/components/container/Container.vue.js +0 -6
- package/lib/esm/components/container/Container.vue_vue_type_script_lang.js +0 -12
- package/lib/esm/components/container/Container.vue_vue_type_template_id_05f5acf3_lang.js +0 -12
- package/lib/esm/components/divider/Divider.vue.js +0 -6
- package/lib/esm/components/divider/Divider.vue_vue_type_script_lang.js +0 -16
- package/lib/esm/components/divider/Divider.vue_vue_type_template_id_3a349aa3_lang.js +0 -45
- package/lib/esm/components/form/Form.vue.js +0 -6
- package/lib/esm/components/form/Form.vue_vue_type_script_lang.js +0 -93
- package/lib/esm/components/form/Form.vue_vue_type_template_id_a6cab022_lang.js +0 -16
- package/lib/esm/components/icon/Icon.vue.js +0 -6
- package/lib/esm/components/icon/Icon.vue_vue_type_script_lang.js +0 -24
- package/lib/esm/components/icon/Icon.vue_vue_type_template_id_0933a10f_lang.js +0 -28
- package/lib/esm/components/image/Image.vue.js +0 -6
- package/lib/esm/components/image/Image.vue_vue_type_script_lang.js +0 -26
- package/lib/esm/components/image/Image.vue_vue_type_template_id_f1ec3bb2_lang.js +0 -9
- package/lib/esm/components/index.js +0 -40
- package/lib/esm/components/input/Input.vue.js +0 -6
- package/lib/esm/components/input/Input.vue_vue_type_script_lang.js +0 -99
- package/lib/esm/components/input/Input.vue_vue_type_template_id_21c870c5_lang.js +0 -122
- package/lib/esm/components/link/Link.vue.js +0 -6
- package/lib/esm/components/link/Link.vue_vue_type_script_lang.js +0 -45
- package/lib/esm/components/link/Link.vue_vue_type_template_id_044f59af_lang.js +0 -55
- package/lib/esm/components/modal/Modal.vue.js +0 -6
- package/lib/esm/components/modal/Modal.vue_vue_type_script_lang.js +0 -53
- package/lib/esm/components/modal/Modal.vue_vue_type_template_id_177f8d4b_lang.js +0 -77
- package/lib/esm/components/note/Note.vue.js +0 -6
- package/lib/esm/components/note/Note.vue_vue_type_script_lang.js +0 -22
- package/lib/esm/components/note/Note.vue_vue_type_template_id_2b99d6a2_lang.js +0 -96
- package/lib/esm/components/pagination/Pagination.vue.js +0 -6
- package/lib/esm/components/pagination/Pagination.vue_vue_type_script_lang.js +0 -41
- package/lib/esm/components/pagination/Pagination.vue_vue_type_template_id_084845ef_lang.js +0 -50
- package/lib/esm/components/pagination/PaginationItem.vue.js +0 -6
- package/lib/esm/components/pagination/PaginationItem.vue_vue_type_script_lang.js +0 -22
- package/lib/esm/components/pagination/PaginationItem.vue_vue_type_template_id_241a3fbc_lang.js +0 -23
- package/lib/esm/components/popover/Popover.vue.js +0 -7
- package/lib/esm/components/popover/Popover.vue_vue_type_script_lang.js +0 -70
- package/lib/esm/components/popover/Popover.vue_vue_type_style_index_0_id_da70cc8a_lang.css.js +0 -6
- package/lib/esm/components/popover/Popover.vue_vue_type_template_id_da70cc8a_lang.js +0 -59
- package/lib/esm/components/popover/PopoverContainer.vue.js +0 -6
- package/lib/esm/components/popover/PopoverContainer.vue_vue_type_script_lang.js +0 -19
- package/lib/esm/components/popover/PopoverContainer.vue_vue_type_template_id_798f1294_lang.js +0 -12
- package/lib/esm/components/popover/PopoverItem.vue.js +0 -6
- package/lib/esm/components/popover/PopoverItem.vue_vue_type_script_lang.js +0 -32
- package/lib/esm/components/popover/PopoverItem.vue_vue_type_template_id_84692424_lang.js +0 -46
- package/lib/esm/components/progress/Progress.vue.js +0 -6
- package/lib/esm/components/progress/Progress.vue_vue_type_script_lang.js +0 -60
- package/lib/esm/components/progress/Progress.vue_vue_type_template_id_9ab7cee2_lang.js +0 -73
- package/lib/esm/components/radio/Radio.vue.js +0 -6
- package/lib/esm/components/radio/Radio.vue_vue_type_script_lang.js +0 -59
- package/lib/esm/components/radio/Radio.vue_vue_type_template_id_808cc132_lang.js +0 -116
- package/lib/esm/components/select/Select.vue.js +0 -6
- package/lib/esm/components/select/Select.vue_vue_type_script_lang.js +0 -60
- package/lib/esm/components/select/Select.vue_vue_type_template_id_18b7de2f_lang.js +0 -118
- package/lib/esm/components/skeleton/Skeleton.vue.js +0 -6
- package/lib/esm/components/skeleton/Skeleton.vue_vue_type_script_lang.js +0 -12
- package/lib/esm/components/skeleton/Skeleton.vue_vue_type_template_id_6ac606e2_lang.js +0 -14
- package/lib/esm/components/spacer/Spacer.vue.js +0 -10
- package/lib/esm/components/spacer/Spacer.vue_vue_type_template_id_793ae82f_lang.js +0 -9
- package/lib/esm/components/spinner/Spinner.vue.js +0 -6
- package/lib/esm/components/spinner/Spinner.vue_vue_type_script_lang.js +0 -12
- package/lib/esm/components/spinner/Spinner.vue_vue_type_template_id_714bd8a3_lang.js +0 -25
- package/lib/esm/components/status/StatusDot.vue.js +0 -6
- package/lib/esm/components/status/StatusDot.vue_vue_type_script_lang.js +0 -22
- package/lib/esm/components/status/StatusDot.vue_vue_type_template_id_367d150a_lang.js +0 -21
- package/lib/esm/components/table/Table.vue.js +0 -6
- package/lib/esm/components/table/Table.vue_vue_type_script_lang.js +0 -115
- package/lib/esm/components/table/Table.vue_vue_type_template_id_c0433c66_lang.js +0 -84
- package/lib/esm/components/table/TableBody.vue.js +0 -6
- package/lib/esm/components/table/TableBody.vue_vue_type_script_lang.js +0 -5
- package/lib/esm/components/table/TableBody.vue_vue_type_template_id_7288bc0f_lang.js +0 -9
- package/lib/esm/components/table/TableCell.vue.js +0 -6
- package/lib/esm/components/table/TableCell.vue_vue_type_script_lang.js +0 -61
- package/lib/esm/components/table/TableCell.vue_vue_type_template_id_5349a862_lang.js +0 -31
- package/lib/esm/components/table/TableHead.vue.js +0 -6
- package/lib/esm/components/table/TableHead.vue_vue_type_script_lang.js +0 -5
- package/lib/esm/components/table/TableHead.vue_vue_type_template_id_6ae9fd66_lang.js +0 -14
- package/lib/esm/components/table/TableHeader.vue.js +0 -6
- package/lib/esm/components/table/TableHeader.vue_vue_type_script_lang.js +0 -46
- package/lib/esm/components/table/TableHeader.vue_vue_type_template_id_9d5bd38c_lang.js +0 -74
- package/lib/esm/components/table/TableRow.vue.js +0 -6
- package/lib/esm/components/table/TableRow.vue_vue_type_script_lang.js +0 -31
- package/lib/esm/components/table/TableRow.vue_vue_type_template_id_7c4a8ffd_lang.js +0 -22
- package/lib/esm/components/tabs/Tab.vue.js +0 -6
- package/lib/esm/components/tabs/Tab.vue_vue_type_script_lang.js +0 -60
- package/lib/esm/components/tabs/Tab.vue_vue_type_template_id_3cfc6374_lang.js +0 -25
- package/lib/esm/components/tabs/Tabs.vue.js +0 -6
- package/lib/esm/components/tabs/Tabs.vue_vue_type_script_lang.js +0 -35
- package/lib/esm/components/tabs/Tabs.vue_vue_type_template_id_663bac2f_lang.js +0 -12
- package/lib/esm/components/tag/Tag.vue.js +0 -6
- package/lib/esm/components/tag/Tag.vue_vue_type_script_lang.js +0 -37
- package/lib/esm/components/tag/Tag.vue_vue_type_template_id_0aa571b6_lang.js +0 -73
- package/lib/esm/components/textarea/Textarea.vue.js +0 -6
- package/lib/esm/components/textarea/Textarea.vue_vue_type_script_lang.js +0 -111
- package/lib/esm/components/textarea/Textarea.vue_vue_type_template_id_03d2272f_lang.js +0 -66
- package/lib/esm/components/toast/Toast.vue.js +0 -6
- package/lib/esm/components/toast/Toast.vue_vue_type_script_lang.js +0 -85
- package/lib/esm/components/toast/Toast.vue_vue_type_template_id_fe243282_lang.js +0 -60
- package/lib/esm/components/toggle/Toggle.vue.js +0 -6
- package/lib/esm/components/toggle/Toggle.vue_vue_type_script_lang.js +0 -56
- package/lib/esm/components/toggle/Toggle.vue_vue_type_template_id_5a9e0b2f_lang.js +0 -92
- package/lib/esm/components/tooltip/Tooltip.vue.js +0 -6
- package/lib/esm/components/tooltip/Tooltip.vue_vue_type_script_lang.js +0 -13
- package/lib/esm/components/tooltip/Tooltip.vue_vue_type_template_id_213cff12_lang.js +0 -26
- package/lib/esm/composables/common.js +0 -23
- package/lib/esm/composables/inputtable.js +0 -155
- package/lib/esm/composables/interactive.js +0 -35
- package/lib/esm/index.js +0 -85
- package/lib/esm/node_modules/style-inject/dist/style-inject.es.js +0 -28
- package/lib/umd/index.js +0 -4349
- package/src/components/colors.vue +0 -396
- package/src/components/index.js +0 -40
- package/src/components/note/Note.vue +0 -74
- package/src/components/popover/PopoverItem.vue +0 -65
- package/src/components/status/StatusDot.vue +0 -41
- package/src/components/tabs/Tab.vue +0 -81
- package/src/components/tabs/Tabs.vue +0 -44
- package/src/components/toast/Toast.vue +0 -139
- package/src/composables/common.js +0 -21
- package/src/composables/interactive.js +0 -36
- package/src/index.js +0 -16
- package/src/nuxt.js +0 -13
- package/src/tailwind.preset.js +0 -24
|
@@ -0,0 +1,318 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { defineComponent, ref, provide, watch, type PropType } from 'vue'
|
|
3
|
+
import { injectNotificationKey } from '../../composables/keys'
|
|
4
|
+
import { useColors } from '../../composables/colors'
|
|
5
|
+
import { useCSS } from '../../composables/css'
|
|
6
|
+
|
|
7
|
+
import XIcon from '../../components/icon/Icon.vue'
|
|
8
|
+
|
|
9
|
+
const validators = {
|
|
10
|
+
align: ['left','right'],
|
|
11
|
+
position: ['bottom','top'],
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export type NotificationAlign = 'left' | 'right'
|
|
15
|
+
export type NotificationPosition = 'bottom' | 'top'
|
|
16
|
+
export type NotificationAction = {
|
|
17
|
+
onClick: ()=> void,
|
|
18
|
+
label: string,
|
|
19
|
+
color?: string
|
|
20
|
+
}
|
|
21
|
+
export type NotificationEvent = {
|
|
22
|
+
id?: number,
|
|
23
|
+
icon?: string,
|
|
24
|
+
action?: NotificationAction,
|
|
25
|
+
iconColor?: string,
|
|
26
|
+
title?: string,
|
|
27
|
+
style?: string,
|
|
28
|
+
message?: string,
|
|
29
|
+
timeout?: number,
|
|
30
|
+
removable?: boolean,
|
|
31
|
+
align?: NotificationAlign,
|
|
32
|
+
position?: NotificationPosition
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export default defineComponent({
|
|
36
|
+
name: 'XNotifications',
|
|
37
|
+
|
|
38
|
+
components: {
|
|
39
|
+
XIcon,
|
|
40
|
+
},
|
|
41
|
+
|
|
42
|
+
validators,
|
|
43
|
+
|
|
44
|
+
props: {
|
|
45
|
+
...useColors.props('primary'),
|
|
46
|
+
align: {
|
|
47
|
+
type: String as PropType<NotificationAlign>,
|
|
48
|
+
default: 'right',
|
|
49
|
+
validator: (value: string) => validators.align.includes(value),
|
|
50
|
+
},
|
|
51
|
+
position: {
|
|
52
|
+
type: String as PropType<NotificationPosition>,
|
|
53
|
+
default: 'bottom',
|
|
54
|
+
validator: (value: string) => validators.position.includes(value),
|
|
55
|
+
},
|
|
56
|
+
timeout: {
|
|
57
|
+
type: Number,
|
|
58
|
+
default: 3500,
|
|
59
|
+
},
|
|
60
|
+
removable: {
|
|
61
|
+
type: Boolean,
|
|
62
|
+
default: true,
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
|
|
66
|
+
expose: ['log', 'info', 'success', 'warn', 'warning', 'error'],
|
|
67
|
+
|
|
68
|
+
setup(props) {
|
|
69
|
+
const internalAlign = ref(props.align)
|
|
70
|
+
const internalPosition = ref(props.position)
|
|
71
|
+
const notifications = ref<NotificationEvent []>([])
|
|
72
|
+
const listRef = ref<HTMLElement | null>(null)
|
|
73
|
+
const css = useCSS('notification')
|
|
74
|
+
const colors = useColors()
|
|
75
|
+
|
|
76
|
+
const removeIcon = '<path d="M6 18L18 6M6 6l12 12" />'
|
|
77
|
+
|
|
78
|
+
provide(injectNotificationKey, {
|
|
79
|
+
log,
|
|
80
|
+
info,
|
|
81
|
+
warn,
|
|
82
|
+
error,
|
|
83
|
+
warning: warn,
|
|
84
|
+
success,
|
|
85
|
+
})
|
|
86
|
+
|
|
87
|
+
watch(() => props.align, (align) => { internalAlign.value = align })
|
|
88
|
+
watch(() => props.position, (position) => { internalPosition.value = position })
|
|
89
|
+
|
|
90
|
+
function log(notification: NotificationEvent | string) {
|
|
91
|
+
const isMessage = typeof notification === 'string'
|
|
92
|
+
const preset = {
|
|
93
|
+
message: isMessage ? notification : undefined,
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
add(isMessage ? preset : {
|
|
97
|
+
...preset,
|
|
98
|
+
...notification,
|
|
99
|
+
})
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
function info(notification: NotificationEvent | string) {
|
|
103
|
+
const isMessage = typeof notification === 'string'
|
|
104
|
+
const preset = {
|
|
105
|
+
icon: '<path fill-rule="evenodd" d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a1 1 0 000 2v3a1 1 0 001 1h1a1 1 0 100-2v-3a1 1 0 00-1-1H9z" clip-rule="evenodd" />',
|
|
106
|
+
iconColor: 'sky',
|
|
107
|
+
message: isMessage ? notification : undefined,
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
add(isMessage ? preset : {
|
|
111
|
+
...preset,
|
|
112
|
+
...notification,
|
|
113
|
+
})
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
function success(notification: NotificationEvent | string) {
|
|
117
|
+
const isMessage = typeof notification === 'string'
|
|
118
|
+
const preset = {
|
|
119
|
+
icon: '<path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z" clip-rule="evenodd" />',
|
|
120
|
+
iconColor: 'success',
|
|
121
|
+
message: isMessage ? notification : undefined,
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
add(isMessage ? preset : {
|
|
125
|
+
...preset,
|
|
126
|
+
...notification,
|
|
127
|
+
})
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
function warn(notification: NotificationEvent | string) {
|
|
131
|
+
const isMessage = typeof notification === 'string'
|
|
132
|
+
const preset = {
|
|
133
|
+
icon: '<path fill-rule="evenodd" d="M8.257 3.099c.765-1.36 2.722-1.36 3.486 0l5.58 9.92c.75 1.334-.213 2.98-1.742 2.98H4.42c-1.53 0-2.493-1.646-1.743-2.98l5.58-9.92zM11 13a1 1 0 11-2 0 1 1 0 012 0zm-1-8a1 1 0 00-1 1v3a1 1 0 002 0V6a1 1 0 00-1-1z" clip-rule="evenodd" />',
|
|
134
|
+
iconColor: 'warning',
|
|
135
|
+
message: isMessage ? notification : undefined,
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
add(isMessage ? preset : {
|
|
139
|
+
...preset,
|
|
140
|
+
...notification,
|
|
141
|
+
})
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
function error(notification: NotificationEvent | string) {
|
|
145
|
+
const isMessage = typeof notification === 'string'
|
|
146
|
+
const preset = {
|
|
147
|
+
icon: '<path fill-rule="evenodd" d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7 4a1 1 0 11-2 0 1 1 0 012 0zm-1-9a1 1 0 00-1 1v4a1 1 0 102 0V6a1 1 0 00-1-1z" clip-rule="evenodd" />',
|
|
148
|
+
iconColor: 'error',
|
|
149
|
+
message: isMessage ? notification : undefined,
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
add(isMessage ? preset : {
|
|
153
|
+
...preset,
|
|
154
|
+
...notification,
|
|
155
|
+
})
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
function add(notification: NotificationEvent) {
|
|
159
|
+
const mergeProps = {
|
|
160
|
+
id: Date.now(),
|
|
161
|
+
iconColor: props.color,
|
|
162
|
+
timeout: props.timeout,
|
|
163
|
+
align: internalAlign.value,
|
|
164
|
+
position: internalPosition.value,
|
|
165
|
+
removable: props.removable,
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
const merged = {
|
|
169
|
+
...mergeProps,
|
|
170
|
+
...notification,
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
internalAlign.value = merged.align
|
|
174
|
+
internalPosition.value = merged.position
|
|
175
|
+
|
|
176
|
+
const color = colors.getPalette(merged.iconColor)
|
|
177
|
+
const colorAction = colors.getPalette(merged.action?.color || 'primary')
|
|
178
|
+
|
|
179
|
+
const cssVariables = css.variables({
|
|
180
|
+
icon: color[400],
|
|
181
|
+
action: colorAction[400],
|
|
182
|
+
hover: {
|
|
183
|
+
action: colorAction[500],
|
|
184
|
+
},
|
|
185
|
+
dark: {
|
|
186
|
+
icon: color[500],
|
|
187
|
+
action: colorAction[500],
|
|
188
|
+
hover: {
|
|
189
|
+
action: colorAction[600],
|
|
190
|
+
},
|
|
191
|
+
},
|
|
192
|
+
})
|
|
193
|
+
|
|
194
|
+
merged.style = Object.keys(cssVariables).map((key) => `${key}: ${cssVariables[key]}`).join(';')
|
|
195
|
+
|
|
196
|
+
notifications.value.push(merged)
|
|
197
|
+
|
|
198
|
+
listRef.value?.scrollTo({ top: 0, behavior: 'smooth' })
|
|
199
|
+
|
|
200
|
+
if (merged.timeout) setTimer(merged, merged.timeout)
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
function remove(event: NotificationEvent) {
|
|
204
|
+
notifications.value = notifications.value.filter((e) => e.id !== event.id)
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
function setTimer(notification: NotificationEvent, timeout: number) {
|
|
208
|
+
setTimeout(() => {
|
|
209
|
+
remove(notification)
|
|
210
|
+
}, timeout)
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
return {
|
|
214
|
+
notifications,
|
|
215
|
+
listRef,
|
|
216
|
+
remove,
|
|
217
|
+
log,
|
|
218
|
+
info,
|
|
219
|
+
warn,
|
|
220
|
+
error,
|
|
221
|
+
warning: warn,
|
|
222
|
+
success,
|
|
223
|
+
removeIcon,
|
|
224
|
+
internalAlign,
|
|
225
|
+
internalPosition,
|
|
226
|
+
}
|
|
227
|
+
},
|
|
228
|
+
|
|
229
|
+
})
|
|
230
|
+
</script>
|
|
231
|
+
|
|
232
|
+
<template>
|
|
233
|
+
<slot></slot>
|
|
234
|
+
<Teleport to="body">
|
|
235
|
+
<div
|
|
236
|
+
ref="listRef"
|
|
237
|
+
class="fixed z-40 w-full sm:w-auto overflow-y-auto max-h-screen"
|
|
238
|
+
:class="{
|
|
239
|
+
// align
|
|
240
|
+
'left-0': internalAlign === 'left',
|
|
241
|
+
'right-0': internalAlign === 'right',
|
|
242
|
+
// position
|
|
243
|
+
'top-0': internalPosition === 'top',
|
|
244
|
+
'bottom-0': internalPosition === 'bottom',
|
|
245
|
+
}"
|
|
246
|
+
>
|
|
247
|
+
<transition-group
|
|
248
|
+
tag="ul"
|
|
249
|
+
class="flex flex-col items-end"
|
|
250
|
+
:class="{ 'flex-col-reverse': internalPosition }"
|
|
251
|
+
enter-active-class="transition ease-out duration-200"
|
|
252
|
+
leave-active-class="transition ease-out duration-100"
|
|
253
|
+
enter-class="transform translate-y-2 opacity-0"
|
|
254
|
+
enter-to-class="transform translate-y-0 opacity-100"
|
|
255
|
+
leave-class="transform translate-y-0 opacity-100"
|
|
256
|
+
leave-to-class="transform translate-y-2 opacity-0"
|
|
257
|
+
move-class="ease-in-out duration-200"
|
|
258
|
+
mode="out-in"
|
|
259
|
+
>
|
|
260
|
+
<li
|
|
261
|
+
v-for="notification in notifications"
|
|
262
|
+
:key="notification.id"
|
|
263
|
+
class="w-full sm:w-[520px]"
|
|
264
|
+
:class="[
|
|
265
|
+
'px-4',
|
|
266
|
+
{
|
|
267
|
+
'pb-2': internalPosition === 'bottom',
|
|
268
|
+
'pt-2': internalPosition === 'top',
|
|
269
|
+
}
|
|
270
|
+
]"
|
|
271
|
+
:style="notification.style"
|
|
272
|
+
>
|
|
273
|
+
<div
|
|
274
|
+
class="flex items-center rounded-md px-4 py-3 bg-gray-800 dark:bg-gray-50 text-white dark:text-gray-900"
|
|
275
|
+
>
|
|
276
|
+
<x-icon
|
|
277
|
+
v-if="notification.icon"
|
|
278
|
+
filled
|
|
279
|
+
:icon="notification.icon"
|
|
280
|
+
class="
|
|
281
|
+
mr-4 shrink-0
|
|
282
|
+
text-[color:var(--x-notification-icon)]
|
|
283
|
+
dark:text-[color:var(--x-dark-notification-icon)]
|
|
284
|
+
"
|
|
285
|
+
viewBox="0 0 20 20"
|
|
286
|
+
/>
|
|
287
|
+
<div class="flex items-center flex-wrap">
|
|
288
|
+
<span v-if="notification.title" class="font-semibold mr-2">{{ notification.title }}</span>
|
|
289
|
+
<span>{{ notification.message }}</span>
|
|
290
|
+
</div>
|
|
291
|
+
<x-spacer/>
|
|
292
|
+
<div
|
|
293
|
+
v-if="notification.action"
|
|
294
|
+
class="
|
|
295
|
+
ml-3
|
|
296
|
+
font-semibold
|
|
297
|
+
cursor-pointer
|
|
298
|
+
text-[color:var(--x-notification-action)]
|
|
299
|
+
hover:text-[color:var(--x-notification-action-hover)]
|
|
300
|
+
dark:text-[color:var(--x-dark-notification-action)]
|
|
301
|
+
dark:hover:text-[color:var(--x-dark-notification-action-hover)]
|
|
302
|
+
"
|
|
303
|
+
@click="notification.action.onClick"
|
|
304
|
+
>
|
|
305
|
+
{{ notification.action.label }}
|
|
306
|
+
</div>
|
|
307
|
+
<x-icon
|
|
308
|
+
v-if="notification.removable"
|
|
309
|
+
:icon="removeIcon"
|
|
310
|
+
class="text-gray-400 hover:text-gray-500 ml-3 shrink-0 cursor-pointer"
|
|
311
|
+
@click="() => {remove(notification)}"
|
|
312
|
+
/>
|
|
313
|
+
</div>
|
|
314
|
+
</li>
|
|
315
|
+
</transition-group>
|
|
316
|
+
</div>
|
|
317
|
+
</Teleport>
|
|
318
|
+
</template>
|
|
@@ -1,74 +1,181 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { computed, defineComponent, ref, watch, type PropType } from 'vue'
|
|
3
|
+
import { useCSS } from '../../composables/css'
|
|
4
|
+
import { useCommon } from '../../composables/common'
|
|
5
|
+
import { useColors } from '../../composables/colors'
|
|
6
|
+
|
|
7
|
+
import XIcon from '../../components/icon/Icon.vue'
|
|
8
|
+
import XButton from '../../components/button/Button.vue'
|
|
9
|
+
import XPaginationItem from './PaginationItem.vue'
|
|
10
|
+
|
|
11
|
+
export default defineComponent({
|
|
12
|
+
name: 'XPagination',
|
|
13
|
+
|
|
14
|
+
components: {
|
|
15
|
+
XIcon,
|
|
16
|
+
XButton,
|
|
17
|
+
XPaginationItem,
|
|
18
|
+
},
|
|
19
|
+
|
|
20
|
+
validators: {
|
|
21
|
+
...useCommon.validators(),
|
|
22
|
+
},
|
|
23
|
+
|
|
24
|
+
props: {
|
|
25
|
+
...useCommon.props(),
|
|
26
|
+
links: Boolean,
|
|
27
|
+
totalPages: {
|
|
28
|
+
type: Number,
|
|
29
|
+
default: 1,
|
|
30
|
+
},
|
|
31
|
+
modelValue: {
|
|
32
|
+
type: Number,
|
|
33
|
+
default: 1,
|
|
34
|
+
},
|
|
35
|
+
variant: {
|
|
36
|
+
type: String as PropType<'simple' | 'quick' | 'dots'>,
|
|
37
|
+
default: 'simple',
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
|
|
41
|
+
emits: ['update:modelValue'],
|
|
42
|
+
|
|
43
|
+
setup(props, { emit }) {
|
|
44
|
+
const pages = computed(() => {
|
|
45
|
+
if (props.totalPages === 3) return [2]
|
|
46
|
+
if (props.totalPages > 2) {
|
|
47
|
+
if (props.modelValue === 1 || props.modelValue === 2) return [2, 3]
|
|
48
|
+
if (props.modelValue === props.totalPages || props.modelValue === props.totalPages - 1) return [props.totalPages - 2, props.totalPages - 1]
|
|
49
|
+
|
|
50
|
+
return [props.modelValue - 1, props.modelValue, props.modelValue + 1]
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
return []
|
|
54
|
+
})
|
|
55
|
+
|
|
56
|
+
const dotsClass = computed(() => {
|
|
57
|
+
if (props.size === 'xs') return 'h-2 w-2'
|
|
58
|
+
else if (props.size === 'sm') return 'h-3 w-3'
|
|
59
|
+
else if (props.size === 'lg') return 'h-4 w-4'
|
|
60
|
+
else if (props.size === 'xl') return 'h-5 w-5'
|
|
61
|
+
|
|
62
|
+
return 'h-3 w-3'
|
|
63
|
+
})
|
|
64
|
+
|
|
65
|
+
const css = useCSS('pagination')
|
|
66
|
+
const colors = useColors()
|
|
67
|
+
const color = colors.getPalette('primary')
|
|
68
|
+
const style = css.get('bg', color[500])
|
|
69
|
+
|
|
70
|
+
const quickInput = ref<string>(props.modelValue + '')
|
|
71
|
+
|
|
72
|
+
function onQuickInput() {
|
|
73
|
+
const number = parseInt(quickInput.value)
|
|
74
|
+
|
|
75
|
+
if (number >= 0 && number <= props.totalPages) {
|
|
76
|
+
emit('update:modelValue', number)
|
|
77
|
+
} else {
|
|
78
|
+
quickInput.value = props.modelValue + ''
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
watch(() => props.modelValue, (value) => {
|
|
83
|
+
quickInput.value = props.modelValue + ''
|
|
84
|
+
})
|
|
85
|
+
|
|
86
|
+
function prevPage() {
|
|
87
|
+
if (props.modelValue > 1) emit('update:modelValue', props.modelValue - 1)
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
function nextPage() {
|
|
91
|
+
if (props.modelValue < props.totalPages) emit('update:modelValue', props.modelValue + 1)
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
const dotsIcon = '<path d="M5 12h.01M12 12h.01M19 12h.01M6 12a1 1 0 11-2 0 1 1 0 012 0zm7 0a1 1 0 11-2 0 1 1 0 012 0zm7 0a1 1 0 11-2 0 1 1 0 012 0z" />'
|
|
95
|
+
const prevIcon = '<path d="M15 19l-7-7 7-7" />'
|
|
96
|
+
const nextIcon = '<path d="M9 5l7 7-7 7" />'
|
|
97
|
+
|
|
98
|
+
const quickButtonSize = computed(() => {
|
|
99
|
+
if (props.size === 'xs') return 'xs'
|
|
100
|
+
else if (props.size === 'sm') return 'sm'
|
|
101
|
+
else if (props.size === 'lg') return 'md'
|
|
102
|
+
else if (props.size === 'xl') return 'lg'
|
|
103
|
+
|
|
104
|
+
return 'sm'
|
|
105
|
+
})
|
|
106
|
+
|
|
107
|
+
return {
|
|
108
|
+
pages,
|
|
109
|
+
dotsIcon,
|
|
110
|
+
dotsClass,
|
|
111
|
+
prevIcon,
|
|
112
|
+
nextIcon,
|
|
113
|
+
quickInput,
|
|
114
|
+
quickButtonSize,
|
|
115
|
+
style,
|
|
116
|
+
onQuickInput,
|
|
117
|
+
prevPage,
|
|
118
|
+
nextPage,
|
|
119
|
+
}
|
|
120
|
+
},
|
|
121
|
+
})
|
|
122
|
+
</script>
|
|
123
|
+
|
|
1
124
|
<template>
|
|
2
|
-
<ul class="flex items-
|
|
125
|
+
<ul v-if="variant === 'quick'" class="flex items-center">
|
|
126
|
+
<x-button
|
|
127
|
+
:icon="prevIcon"
|
|
128
|
+
:size="quickButtonSize"
|
|
129
|
+
:disabled="modelValue <= 1"
|
|
130
|
+
@click="prevPage"
|
|
131
|
+
/>
|
|
132
|
+
<div class="mx-9 flex items-center">
|
|
133
|
+
<span class="text-gray-600 mr-2">Page</span>
|
|
134
|
+
<x-input v-model="quickInput" :size="size" class="w-[2.75rem] text-center" @keydown.enter="onQuickInput" />
|
|
135
|
+
<span class="text-gray-600 ml-2">of {{ totalPages }}</span>
|
|
136
|
+
</div>
|
|
137
|
+
<x-button
|
|
138
|
+
:icon="nextIcon"
|
|
139
|
+
:size="quickButtonSize"
|
|
140
|
+
:disabled="modelValue >= totalPages"
|
|
141
|
+
@click="nextPage"
|
|
142
|
+
/>
|
|
143
|
+
</ul>
|
|
144
|
+
<ul v-else-if="variant === 'simple'" class="flex items-center space-x-2">
|
|
3
145
|
<x-pagination-item
|
|
4
146
|
:value="1"
|
|
5
147
|
:links="links"
|
|
6
148
|
:size="size"
|
|
7
149
|
:selected="modelValue === 1"
|
|
8
|
-
|
|
9
|
-
@input="(value) => $emit('update:modelValue', value)"
|
|
150
|
+
@input="(value: Event) => $emit('update:modelValue', value)"
|
|
10
151
|
/>
|
|
11
|
-
<
|
|
152
|
+
<x-icon v-if="totalPages > 3 && modelValue > 3" class="mx-1" :icon="dotsIcon" :size="size"/>
|
|
12
153
|
<x-pagination-item
|
|
13
154
|
v-for="i in pages"
|
|
14
155
|
:key="i"
|
|
15
|
-
class="mx-1"
|
|
16
156
|
:value="i"
|
|
17
157
|
:links="links"
|
|
18
158
|
:size="size"
|
|
19
159
|
:selected="modelValue === i"
|
|
20
|
-
@input="(value) => $emit('update:modelValue', value)"
|
|
160
|
+
@input="(value: Event) => $emit('update:modelValue', value)"
|
|
21
161
|
/>
|
|
22
|
-
<
|
|
162
|
+
<x-icon v-if="totalPages > 3 && modelValue < totalPages - 2" class="mx-1" :icon="dotsIcon" :size="size"/>
|
|
23
163
|
<x-pagination-item
|
|
24
164
|
v-if="totalPages > 1"
|
|
25
165
|
:value="totalPages"
|
|
26
166
|
:links="links"
|
|
27
167
|
:size="size"
|
|
28
|
-
class="ml-1"
|
|
29
168
|
:selected="modelValue === totalPages"
|
|
30
|
-
@input="(value) => $emit('update:modelValue', value)"
|
|
169
|
+
@input="(value: Event) => $emit('update:modelValue', value)"
|
|
31
170
|
/>
|
|
32
171
|
</ul>
|
|
172
|
+
<ul v-else-if="variant === 'dots'" class="flex space-x-6" :style="style">
|
|
173
|
+
<li
|
|
174
|
+
v-for="i in totalPages"
|
|
175
|
+
:key="i"
|
|
176
|
+
class="rounded-full cursor-pointer"
|
|
177
|
+
:class="[dotsClass, i === modelValue ? 'bg-[color:var(--x-pagination-bg)]': 'bg-gray-100 hover:bg-gray-200']"
|
|
178
|
+
@click="$emit('update:modelValue', i)"
|
|
179
|
+
></li>
|
|
180
|
+
</ul>
|
|
33
181
|
</template>
|
|
34
|
-
|
|
35
|
-
<script>
|
|
36
|
-
import XPaginationItem from './PaginationItem.vue'
|
|
37
|
-
|
|
38
|
-
export default {
|
|
39
|
-
components: {
|
|
40
|
-
XPaginationItem,
|
|
41
|
-
},
|
|
42
|
-
props: {
|
|
43
|
-
totalPages: {
|
|
44
|
-
type: Number,
|
|
45
|
-
default: 1,
|
|
46
|
-
},
|
|
47
|
-
modelValue: {
|
|
48
|
-
type: Number,
|
|
49
|
-
default: 1,
|
|
50
|
-
},
|
|
51
|
-
size: {
|
|
52
|
-
type: String,
|
|
53
|
-
default: null,
|
|
54
|
-
},
|
|
55
|
-
links: {
|
|
56
|
-
type: Boolean,
|
|
57
|
-
default: false,
|
|
58
|
-
},
|
|
59
|
-
},
|
|
60
|
-
computed: {
|
|
61
|
-
pages() {
|
|
62
|
-
if (this.totalPages === 3) return [2]
|
|
63
|
-
if (this.totalPages > 2) {
|
|
64
|
-
if (this.modelValue === 1 || this.modelValue === 2) return [2, 3]
|
|
65
|
-
if (this.modelValue === this.totalPages || this.modelValue === this.totalPages - 1) return [this.totalPages - 2, this.totalPages - 1]
|
|
66
|
-
|
|
67
|
-
return [this.modelValue - 1, this.modelValue, this.modelValue + 1]
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
return []
|
|
71
|
-
},
|
|
72
|
-
},
|
|
73
|
-
}
|
|
74
|
-
</script>
|
|
@@ -1,35 +1,58 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { computed, defineComponent } from 'vue'
|
|
3
|
+
import { useCommon } from '../../composables/common'
|
|
4
|
+
|
|
5
|
+
import XButton from '../../components/button/Button.vue'
|
|
6
|
+
|
|
7
|
+
export default defineComponent({
|
|
8
|
+
name: 'XPaginationItem',
|
|
9
|
+
|
|
10
|
+
components: {
|
|
11
|
+
XButton,
|
|
12
|
+
},
|
|
13
|
+
|
|
14
|
+
validators: {
|
|
15
|
+
...useCommon.validators(),
|
|
16
|
+
},
|
|
17
|
+
|
|
18
|
+
props: {
|
|
19
|
+
...useCommon.props(),
|
|
20
|
+
value: {
|
|
21
|
+
type: Number,
|
|
22
|
+
default: 0,
|
|
23
|
+
},
|
|
24
|
+
selected: Boolean,
|
|
25
|
+
links: Boolean,
|
|
26
|
+
},
|
|
27
|
+
|
|
28
|
+
emits: ['input'],
|
|
29
|
+
|
|
30
|
+
setup(props) {
|
|
31
|
+
const classes = computed(() => {
|
|
32
|
+
if (props.size === 'xs') return '!leading-none !p-1 min-w-[1.375rem]'
|
|
33
|
+
else if (props.size === 'sm') return '!leading-none !p-2 min-w-[2rem]'
|
|
34
|
+
else if (props.size === 'lg') return '!leading-none !p-3 min-w-[2.75rem]'
|
|
35
|
+
else if (props.size === 'xl') return '!leading-none !p-4 min-w-[3.375rem]'
|
|
36
|
+
|
|
37
|
+
return '!leading-none !p-2 min-w-[2.125rem]'
|
|
38
|
+
})
|
|
39
|
+
|
|
40
|
+
return {
|
|
41
|
+
classes,
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
})
|
|
45
|
+
</script>
|
|
46
|
+
|
|
1
47
|
<template>
|
|
2
48
|
<li>
|
|
3
49
|
<x-button
|
|
4
|
-
:to="links ? `?page=${value}` :
|
|
50
|
+
:to="links ? `?page=${value}` : undefined"
|
|
5
51
|
:size="size"
|
|
6
|
-
class="
|
|
52
|
+
:class="classes"
|
|
7
53
|
:outlined="!selected"
|
|
8
|
-
:color="selected ? 'primary' :
|
|
54
|
+
:color="selected ? 'primary' : undefined"
|
|
9
55
|
@click="!selected ? $emit('input', value) : null"
|
|
10
56
|
>{{ value }}</x-button>
|
|
11
57
|
</li>
|
|
12
58
|
</template>
|
|
13
|
-
|
|
14
|
-
<script>
|
|
15
|
-
export default {
|
|
16
|
-
props: {
|
|
17
|
-
value: {
|
|
18
|
-
type: Number,
|
|
19
|
-
default: 0,
|
|
20
|
-
},
|
|
21
|
-
selected: {
|
|
22
|
-
type: Boolean,
|
|
23
|
-
default: false,
|
|
24
|
-
},
|
|
25
|
-
size: {
|
|
26
|
-
type: String,
|
|
27
|
-
default: null,
|
|
28
|
-
},
|
|
29
|
-
links: {
|
|
30
|
-
type: Boolean,
|
|
31
|
-
default: false,
|
|
32
|
-
},
|
|
33
|
-
},
|
|
34
|
-
}
|
|
35
|
-
</script>
|