@flux-ui/types 3.0.0-next.0

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 ADDED
@@ -0,0 +1,45 @@
1
+ # Flux
2
+
3
+ This repository contains the source code for the basic components that are used throughout our front-end projects. It
4
+ targets Vue 3+. Please read the following instructions and checks in order to proceed.
5
+
6
+ ## 📦 Registry
7
+
8
+ - The UI library package is available under `@flux-ui/flux`.
9
+ - The Dashboard library package is available under `@flux-ui/dashboard`.
10
+ - The internal package is available under `@flux-ui/internals`.
11
+
12
+ ## ⚠️ Requirements
13
+
14
+ - Install Node.js ^22
15
+ - Install pnpm using `npm i -g pnpm`.
16
+ - Configure a new environment variable `FONTAWESOME_NPM_AUTH_TOKEN`. This should be a valid Font Awesome private npm auth token.
17
+ - Use `pnpm install` to install the required packages.
18
+ - Use `pnpm dev` to start a build watcher for both targets.
19
+ - Use `pnpm build` to build a production bundle.
20
+ - Use `pnpm link` to link the dist folder of flux to your global node_modules.
21
+
22
+ ## 🪵 Git
23
+
24
+ All commit messages and branches will be in English.
25
+
26
+ ### Branches
27
+
28
+ - **Main** — Contains the latest stable release and is the exact source that is running in production.
29
+ - **Develop** — Contains the latest staging release that is marked for deployment and is the exact source that is running on staging.
30
+ - **Feature branches** — Any feature should have its own feature branch. Once complete, the branch should be merged into the _develop_ branch and the feature branch should be deleted.
31
+ - **Bugfix branches** — When a bug is found, it should be fixed within a bugfix branch. Once complete the branch should be merged into the _develop_ branch and the feature branch should be deleted.
32
+
33
+ ### Commit messages
34
+
35
+ Commit messages are bound to the following templates:
36
+
37
+ - `<type>: <message> `
38
+ - `<type>(<feature>): <message>`
39
+ - `<type>(<feature>): <message> [<issue-number>]`
40
+
41
+ #### Examples
42
+
43
+ - `feat(expandable): adds header slot to expandable.`
44
+ - `feat(expandable): adds header slot to expandable. [FLUX-123]`
45
+ - `chore: adds vue 3 build target.`
package/package.json ADDED
@@ -0,0 +1,46 @@
1
+ {
2
+ "name": "@flux-ui/types",
3
+ "version": "3.0.0-next.0",
4
+ "type": "module",
5
+ "license": "MIT",
6
+ "funding": "https://github.com/sponsors/basmilius",
7
+ "homepage": "https://flux.bas.dev",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "git+https://github.com/basmilius/flux.git",
11
+ "directory": "packages/primitives"
12
+ },
13
+ "keywords": [
14
+ "ui library",
15
+ "component library",
16
+ "design system",
17
+ "vue",
18
+ "vue 3",
19
+ "ui",
20
+ "components",
21
+ "flux"
22
+ ],
23
+ "scripts": {
24
+ "prepublishOnly": "cp ../../README.md ."
25
+ },
26
+ "exports": {
27
+ ".": "./src/index.ts"
28
+ },
29
+ "publishConfig": {
30
+ "access": "public",
31
+ "provenance": true
32
+ },
33
+ "files": [
34
+ "src",
35
+ "tsconfig.json"
36
+ ],
37
+ "main": "./src/index.ts",
38
+ "module": "./src/index.ts",
39
+ "types": "./src/index.ts",
40
+ "typings": "./src/index.ts",
41
+ "sideEffects": false,
42
+ "dependencies": {},
43
+ "devDependencies": {
44
+ "@types/luxon": "^3.6.2"
45
+ }
46
+ }
package/src/common.ts ADDED
@@ -0,0 +1,140 @@
1
+ import type { FontAwesome } from './font-awesome';
2
+ import type { MaterialSymbol } from './material-symbols';
3
+
4
+ export type FluxIconName = FontAwesome | MaterialSymbol;
5
+ export type FluxFontAwesomeIconName = FontAwesome;
6
+ export type FluxMaterialIconName = MaterialSymbol;
7
+
8
+ export type FluxColor =
9
+ | 'gray'
10
+ | 'primary'
11
+ | 'danger'
12
+ | 'info'
13
+ | 'success'
14
+ | 'warning';
15
+
16
+ export type FluxDirection =
17
+ | 'horizontal'
18
+ | 'vertical';
19
+
20
+ export type FluxInputMask =
21
+ | 'bic'
22
+ | 'iban'
23
+ | 'vat';
24
+
25
+ export type FluxInputType =
26
+ | 'color'
27
+ | 'date'
28
+ | 'datetime-local'
29
+ | 'email'
30
+ | 'file'
31
+ | 'month'
32
+ | 'number'
33
+ | 'password'
34
+ | 'search'
35
+ | 'tel'
36
+ | 'text'
37
+ | 'time'
38
+ | 'url'
39
+ | 'week';
40
+
41
+ export type FluxPressableType =
42
+ | 'button'
43
+ | 'link'
44
+ | 'route'
45
+ | 'none';
46
+
47
+ export type FluxSize =
48
+ | 'small'
49
+ | 'medium'
50
+ | 'large';
51
+
52
+ export type FluxTo = {
53
+ name?: string;
54
+ path?: string;
55
+ hash?: string;
56
+ query?: Record<string, string | (string | null)[] | null | undefined>;
57
+ params?: Record<string, string | number>;
58
+ state?: Record<string, string | number | boolean>;
59
+ append?: boolean;
60
+ replace?: boolean;
61
+ };
62
+
63
+ export type FluxMaybePromise<T> = T | Promise<T>;
64
+
65
+ export type FluxAutoCompleteType =
66
+ | AutoCompleteToken
67
+ | AutoCompleteContactToken
68
+ | AutoCompleteRecipientType
69
+ | AutoCompleteGroupIdentifier
70
+ | `${AutoCompleteGroupIdentifier} ${AutoCompleteToken}`
71
+ | `${AutoCompleteGroupIdentifier} ${AutoCompleteContactToken}`
72
+ | (string & {});
73
+
74
+ type AutoCompleteGroupIdentifier =
75
+ | 'billing'
76
+ | 'shipping';
77
+
78
+ type AutoCompleteRecipientType =
79
+ | 'home'
80
+ | 'work'
81
+ | 'mobile'
82
+ | 'fax'
83
+ | 'page';
84
+
85
+ type AutoCompleteContactToken =
86
+ | 'tel'
87
+ | 'tel-country-code'
88
+ | 'tel-national'
89
+ | 'tel-area-code'
90
+ | 'tel-local'
91
+ | 'tel-extension'
92
+ | 'email'
93
+ | 'impp';
94
+
95
+ type AutoCompleteToken =
96
+ | 'name'
97
+ | 'honorific-prefix'
98
+ | 'given-name'
99
+ | 'additional-name'
100
+ | 'family-name'
101
+ | 'honorific-suffix'
102
+ | 'nickname'
103
+ | 'username'
104
+ | 'new-password'
105
+ | 'current-password'
106
+ | 'one-time-code'
107
+ | 'organization-title'
108
+ | 'organization'
109
+ | 'street-address'
110
+ | 'address-line1'
111
+ | 'address-line2'
112
+ | 'address-line3'
113
+ | 'address-level4'
114
+ | 'address-level3'
115
+ | 'address-level2'
116
+ | 'address-level1'
117
+ | 'country'
118
+ | 'country-name'
119
+ | 'postal-code'
120
+ | 'cc-name'
121
+ | 'cc-given-name'
122
+ | 'cc-additional-name'
123
+ | 'cc-family-name'
124
+ | 'cc-number'
125
+ | 'cc-exp'
126
+ | 'cc-exp-month'
127
+ | 'cc-exp-year'
128
+ | 'cc-csc'
129
+ | 'cc-type'
130
+ | 'transaction-currency'
131
+ | 'transaction-amount'
132
+ | 'language'
133
+ | 'bday'
134
+ | 'bday-day'
135
+ | 'bday-month'
136
+ | 'bday-year'
137
+ | 'sex'
138
+ | 'url'
139
+ | 'photo'
140
+ | 'webauthn';
@@ -0,0 +1,55 @@
1
+ import type { FluxIconName, FluxPressableType, FluxSize, FluxTo } from './common';
2
+
3
+ export type FluxButtonSize = FluxSize | 'xl';
4
+
5
+ export type FluxButtonEmits = {
6
+ click: [MouseEvent];
7
+ mouseenter: [MouseEvent];
8
+ mouseleave: [MouseEvent];
9
+ };
10
+
11
+ export type FluxButtonProps = {
12
+ readonly type?: FluxPressableType;
13
+ readonly disabled?: boolean;
14
+ readonly iconLeading?: FluxIconName | null;
15
+ readonly iconTrailing?: FluxIconName | null;
16
+ readonly isFilled?: boolean;
17
+ readonly isLoading?: boolean;
18
+ readonly isSubmit?: boolean;
19
+ readonly label?: string;
20
+ readonly size?: FluxButtonSize;
21
+ readonly tabindex?: string | number;
22
+ readonly href?: string;
23
+ readonly rel?: string;
24
+ readonly target?: string;
25
+ readonly to?: FluxTo;
26
+ };
27
+
28
+ export type FluxButtonSlots = {
29
+ default(): any;
30
+ after(): any;
31
+ before(): any;
32
+ iconLeading(): any;
33
+ iconTrailing(): any;
34
+ label(): any;
35
+ }
36
+
37
+ export type FluxFocalPointObject = {
38
+ readonly x: number;
39
+ readonly y: number;
40
+ };
41
+
42
+ export type FluxLegendObject = {
43
+ readonly color: string;
44
+ readonly label: string;
45
+ }
46
+
47
+ export type FluxPercentageBarItemObject = FluxLegendObject & {
48
+ readonly icon: FluxIconName;
49
+ readonly value: number;
50
+ };
51
+
52
+ export type FluxSegmentedControlItemObject = {
53
+ readonly icon?: FluxIconName;
54
+ readonly label?: string;
55
+ };
package/src/filter.ts ADDED
@@ -0,0 +1,69 @@
1
+ import type { DateTime } from 'luxon';
2
+ import type { FluxIconName } from './common';
3
+
4
+ export type FluxFilterBase = {
5
+ getValueLabel(value: FluxFilterValue): Promise<string | null>;
6
+
7
+ readonly icon?: FluxIconName;
8
+ readonly label: string;
9
+ readonly name: string;
10
+ };
11
+
12
+ export type FluxFilterItem =
13
+ | FluxFilterDateEntry
14
+ | FluxFilterDateRangeEntry
15
+ | FluxFilterOptionEntry
16
+ | FluxFilterOptionsEntry
17
+ | FluxFilterRangeEntry;
18
+
19
+ export type FluxFilterDateEntry = FluxFilterBase & {
20
+ readonly type: 'date';
21
+ };
22
+
23
+ export type FluxFilterDateRangeEntry = FluxFilterBase & {
24
+ readonly type: 'dateRange';
25
+ };
26
+
27
+ export type FluxFilterOptionEntry = FluxFilterBase & {
28
+ readonly type: 'option';
29
+ };
30
+
31
+ export type FluxFilterOptionsEntry = FluxFilterBase & {
32
+ readonly type: 'options';
33
+ };
34
+
35
+ export type FluxFilterRangeEntry = FluxFilterBase & {
36
+ readonly type: 'range';
37
+ };
38
+
39
+ export type FluxFilterOptionHeader = {
40
+ readonly title: string;
41
+ };
42
+
43
+ export type FluxFilterOptionItem = {
44
+ readonly label: string;
45
+ readonly value: FluxFilterValueSingle;
46
+ };
47
+
48
+ export type FluxFilterOptionRow =
49
+ | FluxFilterOptionHeader
50
+ | FluxFilterOptionItem;
51
+
52
+ export type FluxFilterValueSingle =
53
+ | DateTime
54
+ | string
55
+ | boolean
56
+ | number
57
+ | null;
58
+
59
+ export type FluxFilterValue =
60
+ | FluxFilterValueSingle
61
+ | FluxFilterValueSingle[];
62
+
63
+ export type FluxFilterState = {
64
+ get resettable(): string[];
65
+
66
+ reset(): void;
67
+ } & {
68
+ [key: string]: FluxFilterValue | Function;
69
+ };