@fewangsit/wangsvue-gsts 1.0.0-alpha.4 → 1.0.0-alpha.5

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.
@@ -1,66 +1,6 @@
1
- import { ClassComponent } from '../ts-helpers';
1
+ import { BadgeProps as BaseBadgeProps } from '../.././components/badge/Badge.vue.d';
2
+ export * from '../.././components/badge/Badge.vue.d';
2
3
 
3
- export interface BadgeComponentConfigs {
4
- /**
5
- * The component configurasion to set the severity based on given label. If provided, props.severity might be omitted.
6
- *
7
- * @param label The badge label
8
- * @returns The matched severity of given label
9
- */
10
- getSeverity?: (label?: string) => BadgeProps['severity'];
4
+ export interface BadgeProps extends Omit<BaseBadgeProps, 'severity'> {
5
+ severity: BaseBadgeProps['severity'] | 'fixed-primary' | 'supply-primary';
11
6
  }
12
-
13
- /**
14
- * Props for Badge component
15
- */
16
- export interface BadgeProps extends BadgeComponentConfigs {
17
- /**
18
- * The text to be displayed.
19
- */
20
- label: string;
21
- /**
22
- * Whether the badge text is editable.
23
- */
24
- editable?: boolean;
25
- /**
26
- * Sets the severity level for styling purposes. This prop might be omitted if getSeverity is provided.
27
- */
28
- severity?: 'success' | 'info' | 'danger' | 'warning' | 'dark' | 'primary';
29
- /**
30
- * Specifies the format for text truncation rules based on the usage context.
31
- */
32
- format?: 'username' | 'nowrap';
33
- /**
34
- * Whether to show the remove icon or not. Clicking the remove icon will emit 'remove' event.
35
- */
36
- removable?: boolean;
37
- /**
38
- * Whether to set badge become disabled.
39
- */
40
- disabled?: boolean;
41
- }
42
-
43
- /**
44
- * Emits for Badge component
45
- */
46
- export type BadgeEmits = {
47
- 'remove': [];
48
- /**
49
- * Emits when the text is edited.
50
- * Only available when props.editable=true
51
- */
52
- 'update:label': [label: string | null];
53
- };
54
-
55
- /**
56
- * **WangsVue - Badge**
57
- *
58
- * _Badge is a component for displaying a text with optional remove functionality._
59
- *
60
- * @group components
61
- */
62
- export default class Badge extends ClassComponent<
63
- BadgeProps,
64
- unknown,
65
- BadgeEmits
66
- > {}
@@ -1,56 +1,19 @@
1
- import { Slot } from 'vue';
2
- import { BadgeProps } from 'lib/components/badge/Badge.vue.d';
3
- import { ClassComponent, HintedString } from '../ts-helpers.d';
1
+ import { BadgeGroupProps as BaseBadgeGroupProps, ObjectBadge as BaseObjectBadge } from '../.././components/badgegroup/BadgeGroup.vue.d';
2
+ export * from '../.././components/badgegroup/BadgeGroup.vue.d';
4
3
 
5
4
  export type ObjectBadge = {
6
5
  text: string;
7
- severity: 'success' | 'danger' | 'warning' | 'dark' | 'primary';
6
+ severity: BaseObjectBadge['severity'] | 'fixed-primary' | 'supply-primary';
8
7
  };
9
8
 
10
9
  export interface BadgeGroupProps
11
- extends Omit<BadgeProps, 'label' | 'disabled' | 'removable'> {
10
+ extends Omit<BaseBadgeGroupProps, 'severity' | 'labels'> {
11
+ severity?:
12
+ | BaseBadgeGroupProps['severity']
13
+ | 'fixed-primary'
14
+ | 'supply-primary';
12
15
  /**
13
16
  * Support data type object to determine severity for specific text
14
17
  */
15
18
  labels: string[] | ObjectBadge[];
16
- /**
17
- * Determine whether severity of text "more" is customizable
18
- *
19
- * @default undefined
20
- */
21
- textMoreSeverity?: HintedString<
22
- 'secondary' | 'info' | 'success' | 'warning' | 'danger' | 'contrast'
23
- >;
24
- /**
25
- * The text shown on the more button
26
- *
27
- * @default 'more'
28
- */
29
- textMore?: string;
30
- /**
31
- * Maximum number of label to be shown.
32
- */
33
- limit?: number;
34
- /**
35
- * The dialog header shown on more button clicked
36
- */
37
- headerLabel?: string;
38
- /**
39
- * Specify if the badge should be emptyable
40
- * @default false
41
- */
42
- emptyable?: boolean;
43
19
  }
44
-
45
- export interface BadgeGroupSlots {
46
- /**
47
- * Slot for custom more dialog content
48
- */
49
- dialogcontent: Slot<{ labels: string[] }>;
50
- }
51
-
52
- export default class Badge extends ClassComponent<
53
- BadgeGroupProps,
54
- BadgeGroupSlots,
55
- unknown
56
- > {}
@@ -1,185 +1,6 @@
1
- import { ButtonHTMLAttributes, VNode } from 'vue';
2
- import { WangsIcons } from '../icon/Icon.vue.d';
3
- import { TooltipOptions } from 'primevue/tooltip';
4
- import { GlobalComponentConstructor } from '../ts-helpers.d';
5
- import { ClassComponent, HintedString } from '../ts-helpers';
1
+ import { ButtonProps as BaseButtonProps } from '../.././components/button/Button.vue.d';
2
+ export * from '../.././components/button/Button.vue.d';
6
3
 
7
- /**
8
- * Defines valid properties in Button component.
9
- */
10
- export interface ButtonProps extends /* @vue-ignore */ ButtonHTMLAttributes {
11
- /**
12
- * Inline style of the button.
13
- */
14
- style?: any;
15
- /**
16
- * Style class of the button.
17
- */
18
- class?: any;
19
- /**
20
- * Text of the button.
21
- */
22
- label?: string | undefined;
23
- /**
24
- * Name of the icon.
25
- */
26
- icon?: WangsIcons | undefined;
27
- /**
28
- * Position of the icon.
29
- * @defaultValue left
30
- */
31
- iconPos?: 'left' | 'right' | 'top' | 'bottom' | undefined;
32
- /**
33
- * Style class of the icon.
34
- */
35
- iconClass?: string | undefined;
36
- /**
37
- * Tooltip/information to show on button hover.
38
- */
39
- tooltip?: string | TooltipOptions;
40
- /**
41
- * Set the position of tooltip.
42
- * @default bottom
43
- */
44
- tooltipPos?: 'top' | 'right' | 'bottom' | 'left';
45
- /**
46
- * Value of the badge.
47
- */
48
- badge?: string | undefined;
49
- /**
50
- * Style class of the badge.
51
- */
52
- badgeClass?: string | undefined;
53
- /**
54
- * Severity type of the badge.
55
- */
56
- badgeSeverity?:
57
- | HintedString<
58
- 'secondary' | 'info' | 'success' | 'warning' | 'danger' | 'contrast'
59
- >
60
- | null
61
- | undefined;
62
- /**
63
- * Whether the button is in loading state.
64
- * @defaultValue false
65
- */
66
- loading?: boolean | undefined;
67
- /**
68
- * Icon to display in loading state.
69
- */
70
- loadingIcon?: string | undefined;
71
- /**
72
- * Add a link style to the button.
73
- * @defaultValue false
74
- */
75
- link?: boolean | undefined;
76
- /**
77
- * Defines the style of the button.
78
- */
79
- severity?:
80
- | HintedString<
81
- | 'secondary'
82
- | 'success'
83
- | 'info'
84
- | 'warning'
85
- | 'help'
86
- | 'danger'
87
- | 'contrast'
88
- >
89
- | undefined;
90
- /**
91
- * Add a shadow to indicate elevation.
92
- * @defaultValue false
93
- */
94
- raised?: boolean | undefined;
95
- /**
96
- * Add a circular border radius to the button.
97
- * @defaultValue false
98
- */
99
- rounded?: boolean | undefined;
100
- /**
101
- * Add a textual class to the button without a background initially.
102
- * @defaultValue false
103
- */
104
- text?: boolean | undefined;
105
- /**
106
- * Add a border class without a background initially.
107
- * @defaultValue false
108
- */
109
- outlined?: boolean | undefined;
110
- /**
111
- * Defines the size of the button.
112
- */
113
- size?: 'small' | 'large' | undefined;
114
- /**
115
- * Add a plain textual class to the button without a background initially.
116
- * @defaultValue false
117
- */
118
- plain?: boolean | undefined;
4
+ export interface ButtonProps extends BaseButtonProps {
5
+ severity: BaseButtonProps['severity'] | 'fixed-primary' | 'supply-primary';
119
6
  }
120
-
121
- /**
122
- * Defines current options in Button component.
123
- */
124
- export interface ButtonContext {
125
- /**
126
- * Current disabled state of the element as a boolean.
127
- * @defaultValue false
128
- */
129
- disabled: boolean;
130
- }
131
-
132
- /**
133
- * Defines valid slots in Button component.
134
- */
135
- export interface ButtonSlots {
136
- /**
137
- * Custom content such as icons, images and text can be placed inside the button via the default slot. Note that when slot is used, label, icon and badge properties are not included.
138
- */
139
- default(): VNode[];
140
- /**
141
- * Custom icon template.
142
- * @param {Object} scope - icon slot's params.
143
- */
144
- icon(scope: {
145
- /**
146
- * Style class of the icon.
147
- */
148
- class: string;
149
- }): VNode[];
150
- /**
151
- * Custom loading icon template.
152
- * @param {Object} scope - loading icon slot's params.
153
- */
154
- loadingicon(scope: {
155
- /**
156
- * Style class of the loading icon.
157
- */
158
- class: string;
159
- }): VNode[];
160
- }
161
-
162
- /**
163
- * **WangsVue - Button**
164
- *
165
- * _Button is an extension to standard button element with icons and theming._
166
- *
167
- * [Live Demo](https://fewangsit.github.io/wangsvue/table)
168
- * --- ---
169
- * ![WangsVue](https://www.wangs.id/wp-content/uploads/2023/12/cropped-Logo_Wangsid-removebg-preview-192x192.png)
170
- *
171
- * @group Component
172
- */
173
- declare class Button extends ClassComponent<
174
- ButtonProps,
175
- ButtonSlots,
176
- Record<string, unknown>
177
- > {}
178
-
179
- declare module '@vue/runtime-core' {
180
- interface GlobalComponents {
181
- Button: GlobalComponentConstructor<Button>;
182
- }
183
- }
184
-
185
- export default Button;
@@ -32,6 +32,7 @@ export type WangsIcons =
32
32
  | 'assignment'
33
33
  | 'attachment-2'
34
34
  | 'audit'
35
+ | 'barcode'
35
36
  | 'barricade-line'
36
37
  | 'bell'
37
38
  | 'bell-alert'
@@ -51,6 +52,7 @@ export type WangsIcons =
51
52
  | 'checkbox-circle'
52
53
  | 'checkbox-circle-fill'
53
54
  | 'checkbox-blank-circle'
55
+ | 'checkbox-blank-circle-fill'
54
56
  | 'checkbox-multiple'
55
57
  | 'close'
56
58
  | 'close-circle'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fewangsit/wangsvue-gsts",
3
- "version": "1.0.0-alpha.4",
3
+ "version": "1.0.0-alpha.5",
4
4
  "author": "Wangsit FE Developer",
5
5
  "description": "Global Settings Tagsamurai VueJS Component Library",
6
6
  "type": "module",
@@ -1,114 +1,3 @@
1
- import { WangsIcons } from '../components/icon/Icon.vue.d';
2
- export type ToastSeverity = 'success' | 'error' | 'info';
3
- export interface ToastParams {
4
- /**
5
- * The main message to display in the toast. Will be formatted based on template message.
6
- */
7
- message: string;
8
- /**
9
- * Indicates whether the message is customized and does not follow the default message template.
10
- * If true, custom formatting will be applied.
11
- */
12
- customMessage?: boolean;
13
- /**
14
- * The severity level of the toast message.
15
- * Can be 'success', 'error', or 'info'.
16
- */
17
- severity?: ToastSeverity;
18
- /**
19
- * The icon to display in the toast.
20
- */
21
- icon?: WangsIcons;
22
- /**
23
- * The custom CSS class to apply to the icon.
24
- */
25
- iconClass?: any;
26
- /**
27
- * The error object from a catch statement, used to provide additional details for error toasts.
28
- * Accepts any type of error object.
29
- */
30
- error?: unknown;
31
- /**
32
- * The duration for which the toast will be displayed, in milliseconds.
33
- * Set to 0 to show the message infinitely.
34
- *
35
- * @default 3000 - 3 seconds
36
- */
37
- life?: number;
38
- /**
39
- * The name of the message group to which this toast belongs.
40
- */
41
- group?: string;
42
- /**
43
- * Unique identifier of the toast message.
44
- */
45
- messageId?: string;
46
- }
47
- export interface ToastMethod {
48
- add(params: ToastParams): void;
49
- /**
50
- * Clears the messages that belongs to the group.
51
- * @param {string} group - Name of the message group.
52
- */
53
- removeGroup(group: string): void;
54
- removeAllGroups(): void;
55
- }
56
- /**
57
- * Configuration options for the `useToast` hook.
58
- */
59
- export interface UseToastConfig {
60
- /**
61
- * Default message templates for each severity level.
62
- * Keys represent the severity, and values are the template strings.
63
- *
64
- * @example
65
- * {
66
- * success: 'Success, {message}',
67
- * error: 'Error, {message} {additionalMessage}',
68
- * info: 'Info, {message} {additionalMessage}',
69
- * }
70
- */
71
- template?: Record<string, string>;
72
- /**
73
- * Icons for each severity level.
74
- * Keys represent the severity, and values are the corresponding icon identifiers.
75
- *
76
- * @example
77
- * {
78
- * success: 'emotion-happy-fill',
79
- * error: 'emotion-unhappy-fill',
80
- * }
81
- */
82
- icons?: Record<string, WangsIcons>;
83
- }
84
- /**
85
- * Hook to create and manage toast notifications.
86
- *
87
- * @param {UseToastConfig} config - Configuration object for the toast notifications.
88
- * Refer to {@link UseToastConfig} for the structure and details of this object.
89
- *
90
- * @returns {ToastMethod} A method to trigger toast notifications.
91
- * The method accepts {@link ToastParams} to customize individual notifications.
92
- *
93
- * @example
94
- * const toast = useToast({
95
- * template: {
96
- * success: 'Success, {message}',
97
- * error: 'Error, {message} {additionalMessage}',
98
- * info: 'Info, {message} {additionalMessage}',
99
- * },
100
- * icons: {
101
- * success: 'emotion-happy-fill',
102
- * error: 'emotion-unhappy-fill',
103
- * }
104
- * });
105
- *
106
- * // Overiding the default config with ToastParams
107
- * toast.add({
108
- * message: 'Operation completed successfully!',
109
- * customMessage: true,
110
- * icon: 'custom-success-icon',
111
- * });
112
- */
113
- declare const useToast: ({ icons, template }?: UseToastConfig) => ToastMethod;
1
+ import { ToastMethod } from '.././utils';
2
+ declare const useToast: () => ToastMethod;
114
3
  export default useToast;