@open-xamu-co/ui-components-vue 4.0.0-next.2 → 4.0.0-next.21

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.
Files changed (54) hide show
  1. package/CHANGELOG.md +327 -0
  2. package/dist/components/action/ButtonLink.vue.d.ts +7 -1
  3. package/dist/components/base/Box.vue.d.ts +3 -3
  4. package/dist/components/base/Wrapper.vue.d.ts +1 -1
  5. package/dist/components/box/Editor.stories.d.ts +6 -0
  6. package/dist/components/box/Editor.vue.d.ts +33 -0
  7. package/dist/components/collapse/Simple.vue.d.ts +10 -2
  8. package/dist/components/form/Input.stories.d.ts +1 -0
  9. package/dist/components/form/InputLoop.vue.d.ts +1 -1
  10. package/dist/components/form/InputNValues.vue.d.ts +1 -1
  11. package/dist/components/form/InputOptions.vue.d.ts +9 -0
  12. package/dist/components/form/Simple.vue.d.ts +2 -2
  13. package/dist/components/input/Code.stories.d.ts +6 -0
  14. package/dist/components/input/Code.vue.d.ts +42 -0
  15. package/dist/components/input/File.stories.d.ts +1 -0
  16. package/dist/components/input/File.vue.d.ts +3 -1
  17. package/dist/components/loader/ContentFetch.vue.d.ts +10 -4
  18. package/dist/components/modal/Simple.stories.d.ts +1 -0
  19. package/dist/components/modal/Simple.vue.d.ts +9 -2
  20. package/dist/components/pagination/Content.vue.d.ts +10 -4
  21. package/dist/components/pagination/ContentTable.vue.d.ts +24 -11
  22. package/dist/components/pagination/Simple.vue.d.ts +2 -2
  23. package/dist/components/table/Body.vue.d.ts +1 -1
  24. package/dist/components/table/HeadActions.vue.d.ts +1 -1
  25. package/dist/components/table/HeadContent.vue.d.ts +1 -1
  26. package/dist/components/table/Simple.stories.d.ts +4 -0
  27. package/dist/components/table/Simple.vue.d.ts +2 -2
  28. package/dist/components/value/Complex.vue.d.ts +10 -1
  29. package/dist/components/value/List.vue.d.ts +13 -2
  30. package/dist/components/value/Simple.vue.d.ts +1 -1
  31. package/dist/composables/async.d.ts +4 -1
  32. package/dist/composables/markdown.d.ts +8 -0
  33. package/dist/composables/theme.d.ts +3 -1
  34. package/dist/index-BkugQnzT.cjs +75 -0
  35. package/dist/index-DJHxJ3Bp.js +83445 -0
  36. package/dist/index.cjs +1 -1
  37. package/dist/index.d.ts +3 -0
  38. package/dist/index.js +39 -36
  39. package/dist/plugin.cjs +1 -1
  40. package/dist/plugin.js +118 -110
  41. package/dist/{theme-DWMJmaKP.js → theme-CDT3li7P.js} +1 -0
  42. package/dist/{theme-CChhGSbE.cjs → theme-DQ7tgo8n.cjs} +1 -1
  43. package/dist/theme.cjs +1 -1
  44. package/dist/theme.js +3 -2
  45. package/dist/types/plugin.d.ts +8 -0
  46. package/dist/types/props/base.d.ts +106 -0
  47. package/dist/types/props/index.d.ts +4 -0
  48. package/dist/types/props/modal.d.ts +67 -0
  49. package/dist/types/props/table.d.ts +253 -0
  50. package/dist/types/props/value.d.ts +37 -0
  51. package/package.json +20 -7
  52. package/dist/index-C46FseEI.js +0 -7098
  53. package/dist/index-w1g0Tp05.cjs +0 -4
  54. package/dist/types/props.d.ts +0 -408
@@ -0,0 +1,106 @@
1
+ import type { iFormOption, tFormAutocomplete, tIndicative, tProp, tProps, tPropsModifier, tThemeModifier, tThemeTuple, tSizeModifier } from "@open-xamu-co/ui-common-types";
2
+ export interface iUseModifiersProps {
3
+ hidden?: string | tPropsModifier<string>;
4
+ size?: tSizeModifier | number;
5
+ }
6
+ export interface iUseStateProps {
7
+ /**
8
+ * Alert state: Mostly useful on actions
9
+ * Included here to make his usage less verbose
10
+ *
11
+ * @state
12
+ * @example is--alert
13
+ */
14
+ alert?: boolean;
15
+ /**
16
+ * Active state: Mostly useful on actions
17
+ * Included here to make his usage less verbose
18
+ *
19
+ * @state
20
+ * @example is--active
21
+ */
22
+ active?: boolean;
23
+ /**
24
+ * Invalid state: Mostly useful on inputs
25
+ * Included here to make his usage less verbose
26
+ *
27
+ * @state
28
+ * @example is--invalid
29
+ */
30
+ invalid?: boolean;
31
+ /**
32
+ * prevent theme overrides
33
+ *
34
+ * @state
35
+ * @example no--overrides
36
+ */
37
+ noThemeOverride?: boolean;
38
+ /**
39
+ * Component states
40
+ *
41
+ * @example invalid, active, alert
42
+ */
43
+ state?: Record<string, boolean>;
44
+ }
45
+ export interface iUseThemeProps {
46
+ theme?: tThemeTuple | tProp<tThemeModifier>;
47
+ /** invert given theme */
48
+ invertTheme?: boolean;
49
+ /**
50
+ * apply shadow if given theme or themes are active
51
+ */
52
+ shadow?: boolean | tThemeModifier[];
53
+ }
54
+ export interface iUseThemeTooltipProps {
55
+ ariaLabel?: string;
56
+ /**
57
+ * Show given text as tooltip on hover.
58
+ *
59
+ * Includes aria-label tag automatically
60
+ */
61
+ tooltip?: tProp;
62
+ tooltipPosition?: "right" | "left" | "bottom" | "top";
63
+ tooltipAsText?: boolean;
64
+ }
65
+ export interface iActionProps {
66
+ to?: string | Record<string, unknown>;
67
+ href?: string;
68
+ target?: string;
69
+ tel?: string;
70
+ disabled?: boolean;
71
+ mailto?: string;
72
+ type?: "button" | "submit" | "reset";
73
+ tag?: string;
74
+ toggle?: tProp<"dropdown" | "list">;
75
+ round?: string | tPropsModifier<string>;
76
+ toggleState?: tProps<string>;
77
+ indicative?: tIndicative;
78
+ whatsapp?: boolean | string;
79
+ download?: string;
80
+ tabindex?: string;
81
+ }
82
+ interface iInputLikeProps {
83
+ id?: string;
84
+ name?: string;
85
+ placeholder?: string;
86
+ title?: string;
87
+ required?: boolean;
88
+ disabled?: boolean;
89
+ tabindex?: string;
90
+ }
91
+ export interface iInputProps extends iInputLikeProps {
92
+ /**
93
+ * Input type
94
+ * TODO?: limit types
95
+ */
96
+ type?: string;
97
+ autocomplete?: tFormAutocomplete;
98
+ }
99
+ export interface iSelectProps extends iInputLikeProps {
100
+ options?: Array<string | number | iFormOption>;
101
+ /**
102
+ * Multiple fields
103
+ */
104
+ multiple?: boolean;
105
+ }
106
+ export {};
@@ -0,0 +1,4 @@
1
+ export * from "./base";
2
+ export * from "./modal";
3
+ export * from "./table";
4
+ export * from "./value";
@@ -0,0 +1,67 @@
1
+ import type { RendererElement } from "vue";
2
+ import type { iUseThemeProps } from "./base";
3
+ export interface iModalButtonConfig {
4
+ title?: string;
5
+ visible?: boolean;
6
+ btnClass?: string;
7
+ }
8
+ export interface iModalProps extends iUseThemeProps {
9
+ /**
10
+ * Modal is loading
11
+ * Some of the modal contents could be still loading
12
+ */
13
+ loading?: boolean;
14
+ /**
15
+ * The title of the modal shown in .x-modal-header div. If empty title is not rendered
16
+ */
17
+ title?: string;
18
+ subtitle?: string;
19
+ /**
20
+ * :class object which is attached to the modal modal element
21
+ */
22
+ modalClass?: string | string[] | Record<string, boolean>;
23
+ /**
24
+ * :class object which is attached to the modal modal content element
25
+ *
26
+ * Useless if content slot is used
27
+ */
28
+ modalContentClass?: string | string[] | Record<string, boolean>;
29
+ /**
30
+ * Save button config
31
+ */
32
+ saveButton?: iModalButtonConfig & {
33
+ disabled?: boolean;
34
+ };
35
+ /**
36
+ * Cancel button config
37
+ */
38
+ cancelButton?: iModalButtonConfig;
39
+ /**
40
+ * Are modal requirement meet?
41
+ * This is intended to prevent the usage of certain modals
42
+ *
43
+ * This should not depend on any internal state
44
+ *
45
+ * @example User does not have enough permissions
46
+ */
47
+ hide?: boolean;
48
+ /** Message to show when modal is hidden */
49
+ hideMessage?: string;
50
+ /** Hides the footer */
51
+ hideFooter?: boolean;
52
+ /** disables modal */
53
+ disabled?: boolean;
54
+ /**
55
+ * Target element to append the modal to
56
+ *
57
+ * Another modal could be the target so it appears nested
58
+ *
59
+ * @default body
60
+ */
61
+ target?: string | RendererElement;
62
+ /**
63
+ * Shows/hides the modal
64
+ * @private
65
+ */
66
+ modelValue?: boolean;
67
+ }
@@ -0,0 +1,253 @@
1
+ import type { AllowedComponentProps } from "vue";
2
+ import type { iProperty, tPropertyOrderFn, tOrderBy, iNodeFn, iNodeStreamFn, tProps, tSizeModifier, iPagination, iPageInfo, tOrder, tProp, tThemeModifier, tThemeTuple } from "@open-xamu-co/ui-common-types";
3
+ import type { vComponent } from "../plugin";
4
+ import type { iUseThemeProps } from "./base";
5
+ import type { iModalProps } from "./modal";
6
+ import type { iValueComplexProps } from "./value";
7
+ /**
8
+ * Table property with additional meta for internal usage
9
+ */
10
+ export interface iTablePropertyMeta<Ti extends Record<string, any>> extends iProperty<Record<string, any>, Ti, vComponent<iValueComplexProps>> {
11
+ /** Property name */
12
+ value: string;
13
+ canSort: boolean;
14
+ }
15
+ export interface iTableProps<Ti extends Record<string, any>, Tm extends Record<string, any> = Ti> extends iUseThemeProps {
16
+ /**
17
+ * Theme for the node divider
18
+ * @default theme
19
+ */
20
+ nodesDividerTheme?: tThemeTuple | tProp<tThemeModifier>;
21
+ /**
22
+ * Table nodes
23
+ * an array of nodes
24
+ *
25
+ * @old rows
26
+ */
27
+ nodes: Ti[];
28
+ /**
29
+ * Map nodes as required
30
+ * Also useful to omit nodes from the array
31
+ */
32
+ mapNodes?: (nodes: NoInfer<Ti>[]) => (Tm | undefined)[];
33
+ hydrateNodes?: (newNodes: NoInfer<Ti>[] | null, newErrors?: unknown) => void;
34
+ /**
35
+ * Table column names
36
+ * an array of property names
37
+ *
38
+ * @old columns
39
+ */
40
+ properties?: iProperty<any, NoInfer<Ti>, vComponent<iValueComplexProps>>[];
41
+ /**
42
+ * Custom property order
43
+ */
44
+ propertyOrder?: tPropertyOrderFn;
45
+ /**
46
+ * read only table
47
+ * @old editable(inverse)
48
+ */
49
+ readonly?: boolean;
50
+ /**
51
+ * Do nodes support pagination?
52
+ */
53
+ sort?: boolean | tOrderBy;
54
+ /**
55
+ * Function used to update a node
56
+ */
57
+ updateNode?: iNodeFn<NoInfer<Ti>> | iNodeStreamFn<NoInfer<Ti>>;
58
+ /**
59
+ * Function used to delete a node
60
+ */
61
+ deleteNode?: iNodeFn<NoInfer<Ti>> | iNodeStreamFn<NoInfer<Ti>>;
62
+ /**
63
+ * Function used to duplicate a node
64
+ */
65
+ cloneNode?: iNodeFn<NoInfer<Ti>> | iNodeStreamFn<NoInfer<Ti>>;
66
+ /**
67
+ * Function used to create a node children
68
+ *
69
+ * Useful to display the add button for the default slot contents
70
+ */
71
+ createNodeChildren?: iNodeFn<NoInfer<Ti>> | iNodeStreamFn<NoInfer<Ti>>;
72
+ swal?: {
73
+ updatedTitle?: string;
74
+ updatedText?: string;
75
+ notUpdatedTitle?: string;
76
+ notUpdatedText?: string;
77
+ clonedTitle?: string;
78
+ clonedText?: string;
79
+ notClonedTitle?: string;
80
+ notClonedText?: string;
81
+ deletedTitle?: string;
82
+ deletedText?: string;
83
+ notDeletedTitle?: string;
84
+ notDeletedText?: string;
85
+ createdChildrenTitle?: string;
86
+ createdChildrenText?: string;
87
+ notCreatedChildrenTitle?: string;
88
+ notCreatedChildrenText?: string;
89
+ };
90
+ /**
91
+ * Conditionally disable creating children for this particular property
92
+ */
93
+ disableCreateNodeChildren?: (p: NoInfer<Ti>) => boolean;
94
+ /**
95
+ * Conditionally show children for this particular property,
96
+ */
97
+ showNodeChildren?: (p: NoInfer<Ti>) => boolean;
98
+ /**
99
+ * Content clasess
100
+ */
101
+ classes?: tProps<string>;
102
+ /**
103
+ * Refresh the content
104
+ */
105
+ refresh?: () => unknown;
106
+ /**
107
+ * Table is nested within another
108
+ */
109
+ nested?: boolean;
110
+ /**
111
+ * Default children visibility
112
+ */
113
+ childrenVisibility?: boolean;
114
+ /**
115
+ * Human readable name
116
+ *
117
+ * @fallback property name
118
+ */
119
+ childrenName?: string;
120
+ childrenCountKey?: keyof NoInfer<Ti> | keyof NoInfer<Tm>;
121
+ modalProps?: iModalProps & AllowedComponentProps;
122
+ /**
123
+ * Prevent node functions from triggering refresh event (useful with firebase hydration)
124
+ */
125
+ omitRefresh?: boolean;
126
+ size?: tSizeModifier;
127
+ /**
128
+ * Filter & order nodes through the router
129
+ */
130
+ withRoute?: boolean | iPagination;
131
+ /**
132
+ * Page info
133
+ */
134
+ pageInfo?: iPageInfo;
135
+ /**
136
+ * Show real node id or given component
137
+ */
138
+ preferId?: boolean | string | vComponent<{
139
+ index: number;
140
+ node: NoInfer<Ti>;
141
+ }>;
142
+ /**
143
+ * Make the table container opaque
144
+ */
145
+ opaque?: boolean;
146
+ }
147
+ /**
148
+ * Cached node visibility
149
+ */
150
+ export interface iNodeVisibility {
151
+ disableCreateNodeChildren?: boolean;
152
+ showNodeChildren?: boolean;
153
+ /** Amount of children (childrenCountKey) */
154
+ childrenCount: number;
155
+ }
156
+ export interface iMappedNode<Ti extends Record<string, any>, Tm extends Record<string, any> = Ti> {
157
+ node: Tm;
158
+ index: number;
159
+ visibility: iNodeVisibility;
160
+ hydrateNode: (newNode: Ti | null, _newErrors?: unknown) => void;
161
+ createNodeChildrenAndRefresh: iNodeFn<Ti>;
162
+ }
163
+ export interface iMappedNodes<Ti extends Record<string, any>, Tm extends Record<string, any> = Ti> {
164
+ nodes: iMappedNode<Ti, Tm>[];
165
+ length: number;
166
+ /** One of the nodes has children */
167
+ withChildren: boolean;
168
+ }
169
+ /**
170
+ * Internal table component props
171
+ * Not intended to be used directly
172
+ *
173
+ * @internal
174
+ */
175
+ export interface iTableChildProps<Ti extends Record<string, any>, Tm extends Record<string, any> = Ti> extends iTableProps<Ti, Tm> {
176
+ mappedNodes: iMappedNodes<Ti, Tm>;
177
+ /**
178
+ * Table unique identifier
179
+ *
180
+ * Prefer a predictable identifier
181
+ */
182
+ tableId: string;
183
+ /**
184
+ * Node property metadata
185
+ *
186
+ * This one assumes all objects within nodes are all the same
187
+ */
188
+ propertiesMeta: iTablePropertyMeta<Ti>[];
189
+ isReadOnly: boolean;
190
+ /** Ordering property */
191
+ ordering: Record<string, tOrder>;
192
+ /**
193
+ * Selected nodes
194
+ */
195
+ selectedNodes: boolean[];
196
+ /**
197
+ * Open nodes
198
+ * Node with children is open
199
+ */
200
+ openNodes: boolean[];
201
+ selectedNodesCount: number;
202
+ openNodesCount: number;
203
+ /**
204
+ * Can show children
205
+ */
206
+ canShowChildren(visibility: iNodeVisibility, mappedIndex: number): boolean;
207
+ /**
208
+ * Set pagination order
209
+ *
210
+ * @replace
211
+ */
212
+ setOrdering(property: string): void;
213
+ /**
214
+ * Toggle nodes selection
215
+ */
216
+ selectAll(value?: boolean): void;
217
+ /**
218
+ * Toggle nodes children visibility
219
+ */
220
+ openAll(value?: boolean): void;
221
+ /**
222
+ * Toggle nodes children visibility
223
+ */
224
+ toggleChildren(index: number): void;
225
+ /**
226
+ * Updates given node
227
+ * sometimes it could fail but still update (api issue)
228
+ *
229
+ * @single
230
+ */
231
+ updateNodeAndRefresh: iNodeFn<Ti>;
232
+ /**
233
+ * Clones given node
234
+ * sometimes it could fail but still clone (api issue)
235
+ *
236
+ * @single
237
+ */
238
+ cloneNodeAndRefresh: iNodeFn<Ti, [Ti, ((m?: boolean) => any) | undefined, HTMLElement?]>;
239
+ /**
240
+ * Deletes given node
241
+ * sometimes it could fail but still delete (api issue)
242
+ *
243
+ * @single
244
+ */
245
+ deleteNodeAndRefresh: iNodeFn<Ti, [Ti, ((m?: boolean) => any) | undefined, HTMLElement?]>;
246
+ /**
247
+ * Deletes multiple selected nodes
248
+ * sometimes it could fail but still delete (api issue)
249
+ *
250
+ * @batch
251
+ */
252
+ deleteNodesAndRefresh(nodes?: Ti[]): Promise<void>;
253
+ }
@@ -0,0 +1,37 @@
1
+ import type { AllowedComponentProps } from "vue";
2
+ import type { iProperty, tProps, tSizeModifier } from "@open-xamu-co/ui-common-types";
3
+ import type { iUseThemeProps } from "./base";
4
+ import type { iModalProps } from "./modal";
5
+ export interface iValueComplexProps extends iUseThemeProps {
6
+ /**
7
+ * Cell value
8
+ */
9
+ value: any;
10
+ /**
11
+ * Cell column property
12
+ */
13
+ property?: iProperty<any, any>;
14
+ /**
15
+ * Cell node, aka parent node
16
+ *
17
+ * The value prop will be a property of this node
18
+ */
19
+ node?: Record<string, any>;
20
+ /**
21
+ * This type seems to collide with nuxt/vue types
22
+ * Setting it to any for compatibility
23
+ */
24
+ readonly?: any;
25
+ classes?: tProps<string>;
26
+ /**
27
+ * Refresh the content
28
+ */
29
+ refresh?: () => unknown;
30
+ modalProps?: iModalProps & AllowedComponentProps;
31
+ /**
32
+ * Prevent node functions from triggering refresh event (useful with firebase hydration)
33
+ */
34
+ omitRefresh?: boolean;
35
+ verbose?: boolean;
36
+ size?: tSizeModifier;
37
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@open-xamu-co/ui-components-vue",
3
- "version": "4.0.0-next.2",
3
+ "version": "4.0.0-next.21",
4
4
  "description": "Vue component system for the xamu project",
5
5
  "scripts": {
6
6
  "build:entries": "rimraf dist && vite build",
@@ -61,18 +61,30 @@
61
61
  }
62
62
  },
63
63
  "dependencies": {
64
+ "@codemirror/lang-markdown": "^6.5.0",
64
65
  "@fortawesome/fontawesome-common-types": "^6.4.0",
65
- "@open-xamu-co/ui-common-enums": "^3.1.0-next.1",
66
- "@open-xamu-co/ui-common-helpers": "^4.0.0-next.1",
66
+ "@fsegurai/codemirror-theme-material-light": "^6.2.3",
67
+ "@open-xamu-co/ui-common-enums": "^4.0.0-next.2",
68
+ "@open-xamu-co/ui-common-helpers": "^4.0.0-next.6",
69
+ "codemirror": "^6.0.2",
67
70
  "lodash-es": "^4.17.21",
71
+ "markdown-it": "^14.1.0",
72
+ "markdown-it-abbr": "^2.0.0",
73
+ "markdown-it-anchor": "^9.2.0",
74
+ "markdown-it-footnote": "^4.0.0",
75
+ "markdown-it-highlightjs": "^4.2.0",
76
+ "markdown-it-sub": "^2.0.0",
77
+ "markdown-it-sup": "^2.0.0",
78
+ "markdown-it-task-lists": "^2.1.1",
79
+ "markdown-it-toc-done-right": "^4.2.0",
68
80
  "sweetalert2": "^11.11.1",
69
81
  "ts-md5": "^1.3.1",
70
82
  "validator": "^13.11.0",
71
83
  "vue-color": "^3.3.1"
72
84
  },
73
85
  "devDependencies": {
74
- "@open-xamu-co/ui-common-types": "^4.0.0-next.2",
75
- "@open-xamu-co/ui-styles": "^5.0.0-next.2",
86
+ "@open-xamu-co/ui-common-types": "^4.0.0-next.6",
87
+ "@open-xamu-co/ui-styles": "^5.0.0-next.4",
76
88
  "@playwright/test": "^1.57.0",
77
89
  "@storybook/addon-docs": "^10.1.9",
78
90
  "@storybook/addon-links": "^10.1.9",
@@ -81,10 +93,11 @@
81
93
  "@storybook/vue3-vite": "^10.1.9",
82
94
  "@types/jsdom": "^27.0.0",
83
95
  "@types/lodash-es": "^4.14.192",
96
+ "@types/markdown-it": "^14",
84
97
  "@types/validator": "^13.11.1",
85
98
  "@vitejs/plugin-vue": "^6.0.2",
86
- "@vitest/browser-playwright": "^4.0.14",
87
- "@vitest/coverage-v8": "^4.0.14",
99
+ "@vitest/browser-playwright": "^4.0.16",
100
+ "@vitest/coverage-v8": "^4.0.16",
88
101
  "jsdom": "^27.2.0",
89
102
  "msw": "^2.12.4",
90
103
  "playwright": "^1.57.0",