@returnless/focus-ui 0.0.1
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/LICENSE.md +21 -0
- package/README.md +23 -0
- package/dist/focus-ui.es.js +33 -0
- package/dist/types/components/Accordion/Accordion.vue.d.ts +32 -0
- package/dist/types/components/Accordion/AccordionItem.vue.d.ts +2 -0
- package/dist/types/components/Accordion/index.d.ts +2 -0
- package/dist/types/components/index.d.ts +1 -0
- package/dist/types/index.d.ts +7 -0
- package/package.json +53 -0
- package/src/build-utils/generate-component-meta.ts +76 -0
- package/src/build-utils/update-component-list.js +31 -0
- package/src/build-utils/update-component-list.ts +32 -0
- package/src/components/Accordion/Accordion.vue +20 -0
- package/src/components/Accordion/AccordionContent.vue +14 -0
- package/src/components/Accordion/AccordionItem.vue +18 -0
- package/src/components/Accordion/AccordionTrigger.vue +35 -0
- package/src/components/Accordion/README.md +56 -0
- package/src/components/Accordion/index.ts +4 -0
- package/src/components/Alert/Alert.vue +55 -0
- package/src/components/Alert/AlertDescription.vue +8 -0
- package/src/components/Alert/AlertTitle.vue +11 -0
- package/src/components/Alert/DismissableAlertButton.vue +34 -0
- package/src/components/Alert/README.md +121 -0
- package/src/components/Alert/index.ts +3 -0
- package/src/components/AlertDialog/AlertDialog.vue +45 -0
- package/src/components/AlertDialog/AlertDialogActionButton.vue +9 -0
- package/src/components/AlertDialog/AlertDialogCancelButton.vue +15 -0
- package/src/components/AlertDialog/AlertDialogContent.vue +8 -0
- package/src/components/AlertDialog/AlertDialogDescription.vue +11 -0
- package/src/components/AlertDialog/AlertDialogFooter.vue +11 -0
- package/src/components/AlertDialog/AlertDialogHeader.vue +8 -0
- package/src/components/AlertDialog/AlertDialogTitle.vue +7 -0
- package/src/components/AlertDialog/README.md +85 -0
- package/src/components/AlertDialog/index.ts +8 -0
- package/src/components/Avatar/Avatar.vue +78 -0
- package/src/components/Avatar/README.md +122 -0
- package/src/components/Avatar/index.ts +1 -0
- package/src/components/Badge/Badge.vue +51 -0
- package/src/components/Badge/BadgeContent.vue +9 -0
- package/src/components/Badge/BadgeIcon.vue +7 -0
- package/src/components/Badge/README.md +131 -0
- package/src/components/Badge/index.ts +3 -0
- package/src/components/Button/Button.vue +63 -0
- package/src/components/Button/ButtonContent.vue +7 -0
- package/src/components/Button/ButtonIcon.vue +7 -0
- package/src/components/Button/README.md +228 -0
- package/src/components/Button/index.ts +3 -0
- package/src/components/ButtonGroup/ButtonGroup.vue +7 -0
- package/src/components/ButtonGroup/README.md +42 -0
- package/src/components/ButtonGroup/index.ts +1 -0
- package/src/components/Card/Card.vue +7 -0
- package/src/components/Card/CardDescription.vue +11 -0
- package/src/components/Card/CardFooter.vue +7 -0
- package/src/components/Card/CardHeader.vue +7 -0
- package/src/components/Card/CardSection.vue +7 -0
- package/src/components/Card/CardTitle.vue +8 -0
- package/src/components/Card/README.md +69 -0
- package/src/components/Card/index.ts +6 -0
- package/src/components/CategoryBar/CategoryBar.vue +25 -0
- package/src/components/CategoryBar/CategoryBarItem.vue +34 -0
- package/src/components/CategoryBar/README.md +17 -0
- package/src/components/CategoryBar/index.ts +2 -0
- package/src/components/Checkbox/Checkbox.vue +49 -0
- package/src/components/Checkbox/README.md +82 -0
- package/src/components/Checkbox/index.ts +1 -0
- package/src/components/Collapsible/README.md +25 -0
- package/src/components/DataTable/README.md +56 -0
- package/src/components/DatePicker/DatePicker.vue +140 -0
- package/src/components/DatePicker/DatePickerCard.vue +9 -0
- package/src/components/DatePicker/README.md +59 -0
- package/src/components/DatePicker/index.ts +2 -0
- package/src/components/DescriptionList/DescriptionList.vue +18 -0
- package/src/components/DescriptionList/DescriptionListDescription.vue +8 -0
- package/src/components/DescriptionList/DescriptionListItem.vue +21 -0
- package/src/components/DescriptionList/DescriptionListTerm.vue +11 -0
- package/src/components/DescriptionList/README.md +159 -0
- package/src/components/DescriptionList/index.ts +4 -0
- package/src/components/EmptyState/EmptyState.vue +13 -0
- package/src/components/EmptyState/EmptyStateActions.vue +11 -0
- package/src/components/EmptyState/EmptyStateContent.vue +7 -0
- package/src/components/EmptyState/EmptyStateDescription.vue +11 -0
- package/src/components/EmptyState/EmptyStateTitle.vue +7 -0
- package/src/components/EmptyState/README.md +102 -0
- package/src/components/EmptyState/index.ts +5 -0
- package/src/components/Feed/Feed.vue +7 -0
- package/src/components/Feed/FeedItem.vue +16 -0
- package/src/components/Feed/FeedItemBlock.vue +8 -0
- package/src/components/Feed/FeedItemDateIndicator.vue +11 -0
- package/src/components/Feed/FeedItemIcon.vue +26 -0
- package/src/components/Feed/FeedItemSimple.vue +8 -0
- package/src/components/Feed/README.md +115 -0
- package/src/components/Feed/index.ts +6 -0
- package/src/components/Form/Form.vue +30 -0
- package/src/components/Form/README.md +52 -0
- package/src/components/Form/index.ts +1 -0
- package/src/components/FormLayout/FormLayout.vue +7 -0
- package/src/components/FormLayout/README.md +59 -0
- package/src/components/FormLayout/index.ts +1 -0
- package/src/components/InputLabel/InputLabel.vue +32 -0
- package/src/components/InputLabel/index.ts +1 -0
- package/src/components/Link/Link.vue +38 -0
- package/src/components/Link/README.md +119 -0
- package/src/components/Link/index.ts +1 -0
- package/src/components/MetricCard/MetricCard.vue +11 -0
- package/src/components/MetricCard/MetricCardHeader.vue +7 -0
- package/src/components/MetricCard/MetricCardLabel.vue +9 -0
- package/src/components/MetricCard/MetricCardSection.vue +11 -0
- package/src/components/MetricCard/MetricCardValue.vue +8 -0
- package/src/components/MetricCard/README.md +53 -0
- package/src/components/MetricCard/index.ts +5 -0
- package/src/components/Navigation/Navigation.vue +8 -0
- package/src/components/Navigation/NavigationItem.vue +43 -0
- package/src/components/Navigation/NavigationSection.vue +27 -0
- package/src/components/Navigation/README.md +88 -0
- package/src/components/Navigation/index.ts +3 -0
- package/src/components/Page/Page.vue +38 -0
- package/src/components/Page/PageDescription.vue +11 -0
- package/src/components/Page/PageHeader.vue +34 -0
- package/src/components/Page/PageTitle.vue +9 -0
- package/src/components/Page/README.md +220 -0
- package/src/components/Page/index.ts +4 -0
- package/src/components/Pagination/Pagination.vue +8 -0
- package/src/components/Pagination/PaginationNextButton.vue +10 -0
- package/src/components/Pagination/PaginationPreviousButton.vue +10 -0
- package/src/components/Pagination/README.md +45 -0
- package/src/components/Pagination/index.ts +3 -0
- package/src/components/PinInput/PinInput.vue +169 -0
- package/src/components/PinInput/README.md +35 -0
- package/src/components/PinInput/index.ts +1 -0
- package/src/components/Popover/README.md +51 -0
- package/src/components/ProgressBar/ProgressBar.vue +33 -0
- package/src/components/ProgressBar/ProgressBarIndicator.vue +7 -0
- package/src/components/ProgressBar/README.md +98 -0
- package/src/components/ProgressBar/index.ts +2 -0
- package/src/components/RadioButton/README.md +111 -0
- package/src/components/RadioButton/RadioButton.vue +48 -0
- package/src/components/RadioButton/index.ts +1 -0
- package/src/components/Select/README.md +74 -0
- package/src/components/Select/Select.vue +91 -0
- package/src/components/Select/SelectGroup.vue +12 -0
- package/src/components/Select/SelectOption.vue +12 -0
- package/src/components/Select/index.ts +3 -0
- package/src/components/Separator/README.md +35 -0
- package/src/components/Separator/Separator.vue +7 -0
- package/src/components/Separator/index.ts +1 -0
- package/src/components/Spinner/README.md +53 -0
- package/src/components/Spinner/Spinner.vue +58 -0
- package/src/components/Spinner/index.ts +1 -0
- package/src/components/StatusIndicator/README.md +51 -0
- package/src/components/StatusIndicator/StatusIndicator.vue +38 -0
- package/src/components/StatusIndicator/index.ts +1 -0
- package/src/components/Tabs/README.md +53 -0
- package/src/components/Tabs/TabTrigger.vue +43 -0
- package/src/components/Tabs/Tabs.vue +13 -0
- package/src/components/Tabs/index.ts +2 -0
- package/src/components/Tag/README.md +27 -0
- package/src/components/TextField/README.md +317 -0
- package/src/components/TextField/TextField.vue +115 -0
- package/src/components/TextField/TextFieldPasswordIcon.vue +28 -0
- package/src/components/TextField/TextFieldSearchIcon.vue +11 -0
- package/src/components/TextField/index.ts +1 -0
- package/src/components/TextStyle/README.md +39 -0
- package/src/components/TextStyle/TextStyle.vue +24 -0
- package/src/components/TextStyle/index.ts +1 -0
- package/src/components/Toast/DismissToastAction.vue +34 -0
- package/src/components/Toast/README.md +167 -0
- package/src/components/Toast/Toast.vue +39 -0
- package/src/components/Toast/ToastGroup.vue +9 -0
- package/src/components/Toast/index.ts +2 -0
- package/src/components/Toggle/README.md +66 -0
- package/src/components/Toggle/Toggle.vue +86 -0
- package/src/components/Toggle/index.ts +1 -0
- package/src/components/Tooltip/README.md +51 -0
- package/src/components/Tooltip/Tooltip.vue +50 -0
- package/src/components/Tooltip/index.ts +1 -0
- package/src/components/TopBar/README.md +43 -0
- package/src/components/TopBar/TopBar.vue +7 -0
- package/src/components/TopBar/TopBarLogo.vue +8 -0
- package/src/components/TopBar/TopBarNavigation.vue +7 -0
- package/src/components/TopBar/TopBarNavigationItem.vue +13 -0
- package/src/components/TopBar/TopBarSearch.vue +15 -0
- package/src/components/TopBar/TopBarUserMenu.vue +20 -0
- package/src/components/TopBar/index.ts +6 -0
- package/src/components/VisuallyHidden/README.md +19 -0
- package/src/components/VisuallyHidden/VisuallyHidden.vue +25 -0
- package/src/components/VisuallyHidden/index.ts +1 -0
- package/src/components/index.ts +141 -0
- package/src/composables/index.ts +7 -0
- package/src/composables/useTailwindColor.ts +17 -0
- package/src/composables/useTheme.ts +29 -0
- package/src/composables/useToastNotifications.ts +55 -0
- package/src/composables/useUniqueId.ts +5 -0
- package/src/index.css +20 -0
- package/src/index.ts +12 -0
package/LICENSE.md
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Returnless.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# Returnless Focus-UI
|
|
2
|
+
|
|
3
|
+
A clean, opinionated, and functional UI library for Vue3.
|
|
4
|
+
|
|
5
|
+
https://returnless-com.github.io/focus-ui/
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
Install the package via npm:
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
npm install @returnless/focus-ui
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
### Run the docs
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
npm run docs:dev
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## License
|
|
22
|
+
|
|
23
|
+
Source code is licensed under the [MIT license](https://github.com/Returnless-com/focus-ui/blob/main/LICENSE.md).
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { defineComponent as i, openBlock as c, createElementBlock as r } from "vue";
|
|
2
|
+
const a = { class: "bg-red-500" }, l = /* @__PURE__ */ i({
|
|
3
|
+
__name: "Accordion",
|
|
4
|
+
props: {
|
|
5
|
+
orientation: { default: "vertical" }
|
|
6
|
+
},
|
|
7
|
+
setup(t) {
|
|
8
|
+
return (e, o) => (c(), r("div", a, " testgaaf "));
|
|
9
|
+
}
|
|
10
|
+
}), d = (t, e) => {
|
|
11
|
+
const o = t.__vccOpts || t;
|
|
12
|
+
for (const [s, _] of e)
|
|
13
|
+
o[s] = _;
|
|
14
|
+
return o;
|
|
15
|
+
}, f = {};
|
|
16
|
+
function p(t, e) {
|
|
17
|
+
return c(), r("div", null, " test ");
|
|
18
|
+
}
|
|
19
|
+
const u = /* @__PURE__ */ d(f, [["render", p]]), n = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
20
|
+
__proto__: null,
|
|
21
|
+
Accordion: l,
|
|
22
|
+
AccordionItem: u
|
|
23
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
24
|
+
function m(t) {
|
|
25
|
+
for (const e in n)
|
|
26
|
+
t.component(e, n[e]);
|
|
27
|
+
}
|
|
28
|
+
const g = { install: m };
|
|
29
|
+
export {
|
|
30
|
+
l as Accordion,
|
|
31
|
+
u as AccordionItem,
|
|
32
|
+
g as default
|
|
33
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToOption<{
|
|
2
|
+
/** The orientation of the accordion. */
|
|
3
|
+
orientation: "horizontal" | "vertical";
|
|
4
|
+
}>, {
|
|
5
|
+
orientation: string;
|
|
6
|
+
}>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToOption<{
|
|
7
|
+
/** The orientation of the accordion. */
|
|
8
|
+
orientation: "horizontal" | "vertical";
|
|
9
|
+
}>, {
|
|
10
|
+
orientation: string;
|
|
11
|
+
}>>>, {
|
|
12
|
+
orientation: "horizontal" | "vertical";
|
|
13
|
+
}, {}>;
|
|
14
|
+
export default _default;
|
|
15
|
+
|
|
16
|
+
type __VLS_WithDefaults<P, D> = {
|
|
17
|
+
[K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
|
|
18
|
+
default: D[K];
|
|
19
|
+
}> : P[K];
|
|
20
|
+
};
|
|
21
|
+
type __VLS_Prettify<T> = {
|
|
22
|
+
[K in keyof T]: T[K];
|
|
23
|
+
} & {};
|
|
24
|
+
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
25
|
+
type __VLS_TypePropsToOption<T> = {
|
|
26
|
+
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
27
|
+
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
28
|
+
} : {
|
|
29
|
+
type: import('vue').PropType<T[K]>;
|
|
30
|
+
required: true;
|
|
31
|
+
};
|
|
32
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Accordion, AccordionItem } from './Accordion';
|
package/package.json
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@returnless/focus-ui",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"scripts": {
|
|
5
|
+
"build": "rimraf dist && vue-tsc && vite build",
|
|
6
|
+
"docs:dev": "npm run docs:generate-component-list && npm run docs:generate-component-meta && vitepress dev docs",
|
|
7
|
+
"docs:generate-component-list": "npx tsx ./src/build-utils/update-component-list.ts",
|
|
8
|
+
"docs:generate-component-meta": "npx tsx ./src/build-utils/generate-component-meta.ts",
|
|
9
|
+
"docs:build": "npm run docs:generate-component-list && npm run docs:generate-component-meta && vitepress build docs",
|
|
10
|
+
"docs:preview": "vitepress preview docs"
|
|
11
|
+
},
|
|
12
|
+
"peerDependencies": {
|
|
13
|
+
"vue": "^3.3.4"
|
|
14
|
+
},
|
|
15
|
+
"devDependencies": {
|
|
16
|
+
"@floating-ui/vue": "^1.0.6",
|
|
17
|
+
"@heroicons/vue": "^2.1.3",
|
|
18
|
+
"@inertiajs/vue3": "^1.1.0",
|
|
19
|
+
"@stylistic/eslint-plugin": "^2.1.0",
|
|
20
|
+
"@tailwindcss/typography": "^0.5.13",
|
|
21
|
+
"@types/node": "^20.13.0",
|
|
22
|
+
"@typescript-eslint/eslint-plugin": "^7.11.0",
|
|
23
|
+
"@vitejs/plugin-vue": "^5.0.5",
|
|
24
|
+
"@vueuse/core": "^10.11.0",
|
|
25
|
+
"autoprefixer": "^10.4.19",
|
|
26
|
+
"dayjs": "^1.11.11",
|
|
27
|
+
"eslint": "^8.57.0",
|
|
28
|
+
"eslint-plugin-vue": "^9.26.0",
|
|
29
|
+
"postcss": "^8.4.38",
|
|
30
|
+
"rimraf": "^5.0.7",
|
|
31
|
+
"tailwindcss": "^3.4.3",
|
|
32
|
+
"typescript": "^5.4.5",
|
|
33
|
+
"vite": "^5.2.12",
|
|
34
|
+
"vitepress": "^1.2.3",
|
|
35
|
+
"vue-component-meta": "^2.0.19",
|
|
36
|
+
"vue-tsc": "^2.0.19"
|
|
37
|
+
},
|
|
38
|
+
"files": [
|
|
39
|
+
"src",
|
|
40
|
+
"dist"
|
|
41
|
+
],
|
|
42
|
+
"module": "./dist/focus-ui.es.js",
|
|
43
|
+
"exports": {
|
|
44
|
+
".": {
|
|
45
|
+
"types": "./dist/types/index.d.ts",
|
|
46
|
+
"import": "./dist/focus-ui.es.js"
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
"repository": {
|
|
50
|
+
"type": "git",
|
|
51
|
+
"url": "git+https://github.com/wuruoyun/vue-component-lib-starter.git"
|
|
52
|
+
}
|
|
53
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import fs, { existsSync, mkdirSync } from 'fs';
|
|
2
|
+
import { join, parse, resolve } from 'path';
|
|
3
|
+
import fg from 'fast-glob';
|
|
4
|
+
import type { ComponentMeta, MetaCheckerOptions } from 'vue-component-meta';
|
|
5
|
+
import { createComponentMetaChecker } from 'vue-component-meta';
|
|
6
|
+
|
|
7
|
+
export interface ComponentApiProps {
|
|
8
|
+
name: ComponentMeta['props'][number]['name'];
|
|
9
|
+
description: ComponentMeta['props'][number]['description'];
|
|
10
|
+
|
|
11
|
+
// required: ComponentMeta['props'][number]['required']
|
|
12
|
+
type: ComponentMeta['props'][number]['type'];
|
|
13
|
+
default: ComponentMeta['props'][number]['default'];
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export interface ComponentApi {
|
|
17
|
+
props: ComponentApiProps[];
|
|
18
|
+
events: ComponentMeta['events'];
|
|
19
|
+
slots: ComponentMeta['slots'];
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const checkerOptions: MetaCheckerOptions = {
|
|
23
|
+
forceUseTs: true,
|
|
24
|
+
schema: { ignore: ['MyIgnoredNestedProps'] },
|
|
25
|
+
printer: { newLine: 1 },
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
const tsconfigChecker = createComponentMetaChecker(
|
|
29
|
+
resolve(__dirname, '../../tsconfig.json'),
|
|
30
|
+
checkerOptions,
|
|
31
|
+
);
|
|
32
|
+
|
|
33
|
+
function filterMeta(meta: ComponentMeta): ComponentApi {
|
|
34
|
+
const props: ComponentApiProps[] = [];
|
|
35
|
+
|
|
36
|
+
meta.props.forEach((prop) => {
|
|
37
|
+
if (prop.global) {
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const { name, description, required, type, default: defaultValue } = prop;
|
|
42
|
+
|
|
43
|
+
props.push({
|
|
44
|
+
name: `${name}${required ? '' : '?'}`,
|
|
45
|
+
description: description,
|
|
46
|
+
type,
|
|
47
|
+
default: defaultValue || 'unknown',
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
return {
|
|
52
|
+
props,
|
|
53
|
+
events: meta.events,
|
|
54
|
+
slots: meta.slots.map((s) => ({ ...s, description: s.description })),
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
const components = fg.sync(['src/components/**/*.vue'], {
|
|
59
|
+
cwd: resolve(__dirname, '../../'),
|
|
60
|
+
absolute: true,
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
components.forEach((componentPath: string) => {
|
|
64
|
+
const componentName = parse(componentPath).name;
|
|
65
|
+
|
|
66
|
+
const metaDirPath = resolve(__dirname, '../../docs/component-meta');
|
|
67
|
+
|
|
68
|
+
if (!existsSync(metaDirPath)) {
|
|
69
|
+
mkdirSync(metaDirPath);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
const metaJsonFilePath = join(metaDirPath, `${componentName}.json`);
|
|
73
|
+
const meta = filterMeta(tsconfigChecker.getComponentMeta(componentPath));
|
|
74
|
+
|
|
75
|
+
fs.writeFileSync(metaJsonFilePath, JSON.stringify(meta, null, 2));
|
|
76
|
+
});
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
console.log('gaaf');
|
|
2
|
+
// import { readdirSync, existsSync, copyFileSync, writeFileSync } from 'fs';
|
|
3
|
+
// import { resolve, dirname } from 'path';
|
|
4
|
+
//
|
|
5
|
+
// const __dirname = resolve(dirname(''));
|
|
6
|
+
//
|
|
7
|
+
// const componentList = readdirSync(resolve(__dirname, '../components'))
|
|
8
|
+
// .filter((component: string) => existsSync(resolve(__dirname, `../components/${component}/README.md`)));
|
|
9
|
+
//
|
|
10
|
+
// // Copy the readme files.
|
|
11
|
+
// componentList.forEach((component: string) => {
|
|
12
|
+
// copyFileSync(
|
|
13
|
+
// resolve(__dirname, `../components/${component}/README.md`),
|
|
14
|
+
// resolve(__dirname, `../../docs/components/${component}.md`),
|
|
15
|
+
// );
|
|
16
|
+
// });
|
|
17
|
+
//
|
|
18
|
+
// const componentsFileContent = `\
|
|
19
|
+
// /**
|
|
20
|
+
// * Generated by: src/build-utils/update-comoonent-list.js
|
|
21
|
+
// * Generated on: ${new Date().toDateString()}
|
|
22
|
+
// */
|
|
23
|
+
//
|
|
24
|
+
// module.exports = [
|
|
25
|
+
// ${componentList
|
|
26
|
+
// .map((component: string) => ` '/components/${component}',`)
|
|
27
|
+
// .join('\n')}
|
|
28
|
+
// ];
|
|
29
|
+
// `;
|
|
30
|
+
//
|
|
31
|
+
// writeFileSync(resolve(__dirname, '../../docs/.vuepress/component-list.js'), componentsFileContent);
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { readdirSync, existsSync, copyFileSync, writeFileSync } from 'fs';
|
|
2
|
+
import { resolve, dirname } from 'path';
|
|
3
|
+
import { fileURLToPath } from 'url';
|
|
4
|
+
|
|
5
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
6
|
+
const __dirname = dirname(__filename);
|
|
7
|
+
|
|
8
|
+
const componentList = readdirSync(resolve(__dirname, '../components'))
|
|
9
|
+
.filter((component: string) => existsSync(resolve(__dirname, `../components/${component}/README.md`)));
|
|
10
|
+
|
|
11
|
+
// Copy the readme files.
|
|
12
|
+
componentList.forEach((component: string) => {
|
|
13
|
+
copyFileSync(
|
|
14
|
+
resolve(__dirname, `../components/${component}/README.md`),
|
|
15
|
+
resolve(__dirname, `../../docs/components/${component}.md`),
|
|
16
|
+
);
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
const componentsFileContent = `\
|
|
20
|
+
/**
|
|
21
|
+
* Generated by: src/build-utils/update-component-list.js
|
|
22
|
+
* Generated on: ${new Date().toDateString()}
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
module.exports = [
|
|
26
|
+
${componentList
|
|
27
|
+
.map((component: string) => ` { text: '${component}', link: 'components/${component}' },`)
|
|
28
|
+
.join('\n')}
|
|
29
|
+
];
|
|
30
|
+
`;
|
|
31
|
+
|
|
32
|
+
writeFileSync(resolve(__dirname, '../../docs/component-list.ts'), componentsFileContent);
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import { provide, ref } from 'vue';
|
|
3
|
+
|
|
4
|
+
withDefaults(defineProps<{
|
|
5
|
+
/** The orientation of the accordion. */
|
|
6
|
+
orientation?: 'horizontal' | 'vertical';
|
|
7
|
+
}>(), {
|
|
8
|
+
orientation: 'vertical',
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
const activeAccordionItem = ref<string | null>(null);
|
|
12
|
+
|
|
13
|
+
provide('activeAccordionItem', activeAccordionItem);
|
|
14
|
+
</script>
|
|
15
|
+
|
|
16
|
+
<template>
|
|
17
|
+
<div class="w-full">
|
|
18
|
+
<slot />
|
|
19
|
+
</div>
|
|
20
|
+
</template>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import { inject } from 'vue';
|
|
3
|
+
|
|
4
|
+
const accordionItemActive = inject<boolean>('accordionItemActive');
|
|
5
|
+
</script>
|
|
6
|
+
|
|
7
|
+
<template>
|
|
8
|
+
<div
|
|
9
|
+
:class="{ 'hidden': !accordionItemActive }"
|
|
10
|
+
class="py-3"
|
|
11
|
+
>
|
|
12
|
+
<slot />
|
|
13
|
+
</div>
|
|
14
|
+
</template>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import { computed, inject, provide, Ref } from 'vue';
|
|
3
|
+
import { useUniqueId } from '../../composables';
|
|
4
|
+
|
|
5
|
+
const accordionItemId = useUniqueId('accordion-item');
|
|
6
|
+
const activeAccordionItem = inject<Ref<string>>('activeAccordionItem')!;
|
|
7
|
+
|
|
8
|
+
const accordionItemActive = computed((): boolean => activeAccordionItem.value === accordionItemId);
|
|
9
|
+
|
|
10
|
+
provide('accordionItemId', accordionItemId);
|
|
11
|
+
provide('accordionItemActive', accordionItemActive);
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
<template>
|
|
15
|
+
<div class="border-b">
|
|
16
|
+
<slot />
|
|
17
|
+
</div>
|
|
18
|
+
</template>
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import { inject, Ref } from 'vue';
|
|
3
|
+
import { ChevronDownIcon, ChevronUpIcon } from '@heroicons/vue/16/solid';
|
|
4
|
+
import { TextStyle } from '../TextStyle';
|
|
5
|
+
|
|
6
|
+
const activeAccordionItem = inject<Ref<string>>('activeAccordionItem')!;
|
|
7
|
+
const accordionItemId = inject<string>('accordionItemId')!;
|
|
8
|
+
const accordionItemActive = inject<boolean>('accordionItemActive');
|
|
9
|
+
|
|
10
|
+
function toggleAccordionItem(): void {
|
|
11
|
+
activeAccordionItem.value = accordionItemId;
|
|
12
|
+
}
|
|
13
|
+
</script>
|
|
14
|
+
|
|
15
|
+
<template>
|
|
16
|
+
<button
|
|
17
|
+
class="w-full flex flex-1 items-center justify-between group"
|
|
18
|
+
@click="toggleAccordionItem"
|
|
19
|
+
>
|
|
20
|
+
<span class="py-3 group-hover:underline">
|
|
21
|
+
<TextStyle variant="strong">
|
|
22
|
+
<slot />
|
|
23
|
+
</TextStyle>
|
|
24
|
+
</span>
|
|
25
|
+
|
|
26
|
+
<ChevronDownIcon
|
|
27
|
+
v-if="!accordionItemActive"
|
|
28
|
+
class="w-4 h-4"
|
|
29
|
+
/>
|
|
30
|
+
<ChevronUpIcon
|
|
31
|
+
v-if="accordionItemActive"
|
|
32
|
+
class="w-4 h-4"
|
|
33
|
+
/>
|
|
34
|
+
</button>
|
|
35
|
+
</template>
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import { Accordion, AccordionContent, AccordionItem, AccordionTrigger } from '../../src/components';
|
|
3
|
+
import api from '../component-meta/Accordion.json';
|
|
4
|
+
</script>
|
|
5
|
+
|
|
6
|
+
# Accordion
|
|
7
|
+
|
|
8
|
+
A vertically stacked set of interactive headings that each reveal a section of content.
|
|
9
|
+
|
|
10
|
+
<ComponentApi :api="api" />
|
|
11
|
+
|
|
12
|
+
## Variants
|
|
13
|
+
|
|
14
|
+
### Default
|
|
15
|
+
|
|
16
|
+
Use to display a list of questions and answers. The user can click on a question to reveal the answer.
|
|
17
|
+
|
|
18
|
+
<ComponentWrapper>
|
|
19
|
+
<Accordion>
|
|
20
|
+
<AccordionItem>
|
|
21
|
+
<AccordionTrigger>Is it accessible?</AccordionTrigger>
|
|
22
|
+
<AccordionContent>Yes. It adheres to the AI-ARIA design system</AccordionContent>
|
|
23
|
+
</AccordionItem>
|
|
24
|
+
<AccordionItem>
|
|
25
|
+
<AccordionTrigger>Is it styled?</AccordionTrigger>
|
|
26
|
+
<AccordionContent>Yes. It comes with default styles that matches the other components' aesthetic.</AccordionContent>
|
|
27
|
+
</AccordionItem>
|
|
28
|
+
<AccordionItem>
|
|
29
|
+
<AccordionTrigger>Is it animated?</AccordionTrigger>
|
|
30
|
+
<AccordionContent>Yes. It's animated by default, but you can disable it if you prefer.</AccordionContent>
|
|
31
|
+
</AccordionItem>
|
|
32
|
+
</Accordion>
|
|
33
|
+
</ComponentWrapper>
|
|
34
|
+
|
|
35
|
+
```js-vue
|
|
36
|
+
<script lang="ts" setup>
|
|
37
|
+
import { Accordion, AccordionItem, AccordionTrigger, AccordionContent } from 'focus-ui';
|
|
38
|
+
</script>
|
|
39
|
+
|
|
40
|
+
<template>
|
|
41
|
+
<Accordion>
|
|
42
|
+
<AccordionItem>
|
|
43
|
+
<AccordionTrigger>Is it accessible?</AccordionTrigger>
|
|
44
|
+
<AccordionContent>Yes. It adheres to the AI-ARIA design system</AccordionContent>
|
|
45
|
+
</AccordionItem>
|
|
46
|
+
<AccordionItem>
|
|
47
|
+
<AccordionTrigger>Is it styled?</AccordionTrigger>
|
|
48
|
+
<AccordionContent>Yes. It comes with default styles that matches the other components' aesthetic.</AccordionContent>
|
|
49
|
+
</AccordionItem>
|
|
50
|
+
<AccordionItem>
|
|
51
|
+
<AccordionTrigger>Is it animated?</AccordionTrigger>
|
|
52
|
+
<AccordionContent>Yes. It's animated by default, but you can disable it if you prefer.</AccordionContent>
|
|
53
|
+
</AccordionItem>
|
|
54
|
+
</Accordion>
|
|
55
|
+
</template>
|
|
56
|
+
```
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import { computed, ref } from 'vue';
|
|
3
|
+
import DismissableAlertButton from './DismissableAlertButton.vue';
|
|
4
|
+
|
|
5
|
+
const props = withDefaults(defineProps<{
|
|
6
|
+
/** Whether the alert can be dismissed. */
|
|
7
|
+
dismissible?: boolean;
|
|
8
|
+
|
|
9
|
+
/** The variant of the alert. */
|
|
10
|
+
variant?: 'default' | 'destructive';
|
|
11
|
+
}>(), {
|
|
12
|
+
dismissible: true,
|
|
13
|
+
variant: 'default',
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
const emits = defineEmits<{
|
|
17
|
+
/** Emitted when the alert is dismissed. */
|
|
18
|
+
dismiss: [];
|
|
19
|
+
}>();
|
|
20
|
+
|
|
21
|
+
const alertDismissed = ref(false);
|
|
22
|
+
|
|
23
|
+
const classList = computed(() => {
|
|
24
|
+
return {
|
|
25
|
+
'border-red-500 text-red-900': props.variant === 'destructive',
|
|
26
|
+
'text-gray-900': props.variant === 'default',
|
|
27
|
+
};
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
const role = computed(() => props.variant === 'destructive' ? 'alert' : 'status');
|
|
31
|
+
|
|
32
|
+
function dismissAlert(): void {
|
|
33
|
+
emits('dismiss');
|
|
34
|
+
|
|
35
|
+
alertDismissed.value = true;
|
|
36
|
+
}
|
|
37
|
+
</script>
|
|
38
|
+
|
|
39
|
+
<template>
|
|
40
|
+
<div
|
|
41
|
+
v-if="! alertDismissed"
|
|
42
|
+
:class="classList"
|
|
43
|
+
:role="role"
|
|
44
|
+
class="relative rounded border bg-white px-4 py-3 shadow-sm"
|
|
45
|
+
tabindex="0"
|
|
46
|
+
>
|
|
47
|
+
<slot />
|
|
48
|
+
|
|
49
|
+
<DismissableAlertButton
|
|
50
|
+
v-if="dismissible"
|
|
51
|
+
:variant="variant"
|
|
52
|
+
@dismiss="dismissAlert"
|
|
53
|
+
/>
|
|
54
|
+
</div>
|
|
55
|
+
</template>
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { XMarkIcon } from '@heroicons/vue/16/solid';
|
|
3
|
+
import { computed } from 'vue';
|
|
4
|
+
|
|
5
|
+
const props = withDefaults(defineProps<{
|
|
6
|
+
/** The variant of the alert. */
|
|
7
|
+
variant?: 'default' | 'destructive';
|
|
8
|
+
}>(), {
|
|
9
|
+
variant: 'default',
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
defineEmits<{
|
|
13
|
+
dismiss: [];
|
|
14
|
+
}>();
|
|
15
|
+
|
|
16
|
+
const classList = computed(() => {
|
|
17
|
+
return {
|
|
18
|
+
'hover:bg-red-200': props.variant === 'destructive',
|
|
19
|
+
'hover:bg-slate-200': props.variant === 'default',
|
|
20
|
+
};
|
|
21
|
+
});
|
|
22
|
+
</script>
|
|
23
|
+
|
|
24
|
+
<template>
|
|
25
|
+
<button
|
|
26
|
+
aria-label="Dismiss notification"
|
|
27
|
+
class="absolute top-2 right-2 flex h-5 w-5 items-center justify-center rounded"
|
|
28
|
+
:class="classList"
|
|
29
|
+
type="button"
|
|
30
|
+
@click="$emit('dismiss')"
|
|
31
|
+
>
|
|
32
|
+
<XMarkIcon class="h-4 w-4" />
|
|
33
|
+
</button>
|
|
34
|
+
</template>
|