platformcommons-web-lib 1.0.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/commons-shared-web-ui-1.0.0.tgz +0 -0
- package/documentation/alert.md +123 -0
- package/documentation/button-dropdown.md +126 -0
- package/documentation/button.md +184 -0
- package/documentation/cards-usage-guidelines.md +131 -0
- package/documentation/configurable-form.md +605 -0
- package/documentation/confirmation-modal.md +250 -0
- package/documentation/filter-sidebar.md +178 -0
- package/documentation/filter-table-selector.md +228 -0
- package/documentation/form-builder.md +597 -0
- package/documentation/form-components.md +384 -0
- package/documentation/nav.md +427 -0
- package/documentation/pagination.md +181 -0
- package/documentation/side-nav-documentation.md +169 -0
- package/documentation/smart-form.md +2177 -0
- package/documentation/smart-table.md +1198 -0
- package/documentation/snackbar.md +118 -0
- package/documentation/style-externalization.md +88 -0
- package/documentation/summary-card.md +279 -0
- package/ng-package.json +28 -0
- package/package.json +54 -0
- package/src/lib/modules/alert/alert.models.ts +6 -0
- package/src/lib/modules/alert/alert.module.ts +16 -0
- package/src/lib/modules/alert/alert.theme.scss +85 -0
- package/src/lib/modules/alert/components/alert/alert.component.html +27 -0
- package/src/lib/modules/alert/components/alert/alert.component.scss +92 -0
- package/src/lib/modules/alert/components/alert/alert.component.ts +81 -0
- package/src/lib/modules/button/button.models.ts +13 -0
- package/src/lib/modules/button/button.module.ts +16 -0
- package/src/lib/modules/button/button.theme.scss +121 -0
- package/src/lib/modules/button/components/button/button.component.html +22 -0
- package/src/lib/modules/button/components/button/button.component.scss +88 -0
- package/src/lib/modules/button/components/button/button.component.ts +67 -0
- package/src/lib/modules/button-dropdown/button-dropdown.models.ts +26 -0
- package/src/lib/modules/button-dropdown/button-dropdown.module.ts +22 -0
- package/src/lib/modules/button-dropdown/button-dropdown.theme.scss +87 -0
- package/src/lib/modules/button-dropdown/components/button-dropdown/button-dropdown.component.html +41 -0
- package/src/lib/modules/button-dropdown/components/button-dropdown/button-dropdown.component.scss +135 -0
- package/src/lib/modules/button-dropdown/components/button-dropdown/button-dropdown.component.ts +160 -0
- package/src/lib/modules/configurable-form/component/configurable-form.component.html +294 -0
- package/src/lib/modules/configurable-form/component/configurable-form.component.scss +503 -0
- package/src/lib/modules/configurable-form/component/configurable-form.component.ts +628 -0
- package/src/lib/modules/configurable-form/configurable-form.examples.ts +154 -0
- package/src/lib/modules/configurable-form/configurable-form.model.ts +131 -0
- package/src/lib/modules/configurable-form/configurable-form.module.ts +19 -0
- package/src/lib/modules/configurable-form/configurable-form.theme.scss +78 -0
- package/src/lib/modules/confirmation-modal/components/confirmation-modal/confirmation-modal.component.html +77 -0
- package/src/lib/modules/confirmation-modal/components/confirmation-modal/confirmation-modal.component.scss +395 -0
- package/src/lib/modules/confirmation-modal/components/confirmation-modal/confirmation-modal.component.ts +266 -0
- package/src/lib/modules/confirmation-modal/confirmation-modal.models.ts +71 -0
- package/src/lib/modules/confirmation-modal/confirmation-modal.module.ts +20 -0
- package/src/lib/modules/confirmation-modal/confirmation-modal.theme.scss +87 -0
- package/src/lib/modules/filter/components/filter/filter.component.html +131 -0
- package/src/lib/modules/filter/components/filter/filter.component.scss +245 -0
- package/src/lib/modules/filter/components/filter/filter.component.ts +216 -0
- package/src/lib/modules/filter/filter.models.ts +88 -0
- package/src/lib/modules/filter/filter.module.ts +24 -0
- package/src/lib/modules/filter/filter.theme.scss +92 -0
- package/src/lib/modules/filter-sidebar/components/filter-sidebar/filter-sidebar.component.html +112 -0
- package/src/lib/modules/filter-sidebar/components/filter-sidebar/filter-sidebar.component.scss +186 -0
- package/src/lib/modules/filter-sidebar/components/filter-sidebar/filter-sidebar.component.ts +163 -0
- package/src/lib/modules/filter-sidebar/filter-sidebar.models.ts +95 -0
- package/src/lib/modules/filter-sidebar/filter-sidebar.module.ts +24 -0
- package/src/lib/modules/filter-sidebar/filter-sidebar.theme.scss +38 -0
- package/src/lib/modules/filter-table-selector/components/filter-table-selector/filter-table-selector.component.html +73 -0
- package/src/lib/modules/filter-table-selector/components/filter-table-selector/filter-table-selector.component.scss +321 -0
- package/src/lib/modules/filter-table-selector/components/filter-table-selector/filter-table-selector.component.ts +361 -0
- package/src/lib/modules/filter-table-selector/filter-table-selector.models.ts +91 -0
- package/src/lib/modules/filter-table-selector/filter-table-selector.module.ts +22 -0
- package/src/lib/modules/filter-table-selector/filter-table-selector.theme.scss +36 -0
- package/src/lib/modules/form-builder/components/field-configurator/configurator-config-panel/configurator-config-panel.component.html +63 -0
- package/src/lib/modules/form-builder/components/field-configurator/configurator-config-panel/configurator-config-panel.component.scss +496 -0
- package/src/lib/modules/form-builder/components/field-configurator/configurator-config-panel/configurator-config-panel.component.ts +445 -0
- package/src/lib/modules/form-builder/components/field-configurator/configurator-tree/configurator-tree.component.html +75 -0
- package/src/lib/modules/form-builder/components/field-configurator/configurator-tree/configurator-tree.component.scss +210 -0
- package/src/lib/modules/form-builder/components/field-configurator/configurator-tree/configurator-tree.component.ts +55 -0
- package/src/lib/modules/form-builder/components/field-configurator/field-configurator.component.html +25 -0
- package/src/lib/modules/form-builder/components/field-configurator/field-configurator.component.scss +82 -0
- package/src/lib/modules/form-builder/components/field-configurator/field-configurator.component.ts +95 -0
- package/src/lib/modules/form-builder/components/field-selection/field-selection.component.html +20 -0
- package/src/lib/modules/form-builder/components/field-selection/field-selection.component.scss +37 -0
- package/src/lib/modules/form-builder/components/field-selection/field-selection.component.ts +94 -0
- package/src/lib/modules/form-builder/components/field-selection/group-node/group-node.component.html +46 -0
- package/src/lib/modules/form-builder/components/field-selection/group-node/group-node.component.scss +102 -0
- package/src/lib/modules/form-builder/components/field-selection/group-node/group-node.component.ts +50 -0
- package/src/lib/modules/form-builder/components/field-selection/selection-field-node/selection-field-node.component.html +35 -0
- package/src/lib/modules/form-builder/components/field-selection/selection-field-node/selection-field-node.component.scss +67 -0
- package/src/lib/modules/form-builder/components/field-selection/selection-field-node/selection-field-node.component.ts +34 -0
- package/src/lib/modules/form-builder/components/field-selection/selection-section-node/selection-section-node.component.html +68 -0
- package/src/lib/modules/form-builder/components/field-selection/selection-section-node/selection-section-node.component.scss +113 -0
- package/src/lib/modules/form-builder/components/field-selection/selection-section-node/selection-section-node.component.ts +74 -0
- package/src/lib/modules/form-builder/configs/field-type-schema.map.ts +533 -0
- package/src/lib/modules/form-builder/form-builder.module.ts +36 -0
- package/src/lib/modules/form-builder/form-builder.theme.scss +212 -0
- package/src/lib/modules/form-builder/index.ts +9 -0
- package/src/lib/modules/form-builder/models/builder.models.ts +7 -0
- package/src/lib/modules/form-builder/models/field-configurator.models.ts +38 -0
- package/src/lib/modules/form-builder/models/field-selection.models.ts +51 -0
- package/src/lib/modules/form-builder/services/field-configurator.service.ts +258 -0
- package/src/lib/modules/form-builder/services/field-selection.service.ts +300 -0
- package/src/lib/modules/form-builder/services/form-schema-tree.service.ts +652 -0
- package/src/lib/modules/form-builder/tokens/builder.tokens.ts +10 -0
- package/src/lib/modules/form-builder/utils/constants.ts +43 -0
- package/src/lib/modules/form-components/components/checkbox/_theme.scss +63 -0
- package/src/lib/modules/form-components/components/checkbox/checkbox.component.html +29 -0
- package/src/lib/modules/form-components/components/checkbox/checkbox.component.scss +111 -0
- package/src/lib/modules/form-components/components/checkbox/checkbox.component.ts +207 -0
- package/src/lib/modules/form-components/components/checkbox/checkbox.models.ts +35 -0
- package/src/lib/modules/form-components/components/datepicker/_theme.scss +82 -0
- package/src/lib/modules/form-components/components/datepicker/datepicker.component.html +42 -0
- package/src/lib/modules/form-components/components/datepicker/datepicker.component.scss +115 -0
- package/src/lib/modules/form-components/components/datepicker/datepicker.component.ts +267 -0
- package/src/lib/modules/form-components/components/datepicker/datepicker.models.ts +45 -0
- package/src/lib/modules/form-components/components/dropdown/_theme.scss +91 -0
- package/src/lib/modules/form-components/components/dropdown/dropdown.component.html +74 -0
- package/src/lib/modules/form-components/components/dropdown/dropdown.component.scss +252 -0
- package/src/lib/modules/form-components/components/dropdown/dropdown.component.ts +377 -0
- package/src/lib/modules/form-components/components/dropdown/dropdown.models.ts +53 -0
- package/src/lib/modules/form-components/components/input/_theme.scss +77 -0
- package/src/lib/modules/form-components/components/input/input.component.html +51 -0
- package/src/lib/modules/form-components/components/input/input.component.scss +128 -0
- package/src/lib/modules/form-components/components/input/input.component.ts +250 -0
- package/src/lib/modules/form-components/components/input/input.models.ts +55 -0
- package/src/lib/modules/form-components/components/radio/_theme.scss +61 -0
- package/src/lib/modules/form-components/components/radio/radio.component.html +22 -0
- package/src/lib/modules/form-components/components/radio/radio.component.scss +107 -0
- package/src/lib/modules/form-components/components/radio/radio.component.ts +181 -0
- package/src/lib/modules/form-components/components/radio/radio.models.ts +39 -0
- package/src/lib/modules/form-components/components/search/_theme.scss +73 -0
- package/src/lib/modules/form-components/components/search/search.component.html +15 -0
- package/src/lib/modules/form-components/components/search/search.component.scss +87 -0
- package/src/lib/modules/form-components/components/search/search.component.ts +213 -0
- package/src/lib/modules/form-components/components/search/search.models.ts +40 -0
- package/src/lib/modules/form-components/components/toggle/_theme.scss +45 -0
- package/src/lib/modules/form-components/components/toggle/toggle.component.html +15 -0
- package/src/lib/modules/form-components/components/toggle/toggle.component.scss +81 -0
- package/src/lib/modules/form-components/components/toggle/toggle.component.ts +166 -0
- package/src/lib/modules/form-components/components/toggle/toggle.models.ts +27 -0
- package/src/lib/modules/form-components/directives/click-outside.directive.ts +22 -0
- package/src/lib/modules/form-components/form-components.module.ts +41 -0
- package/src/lib/modules/form-components/form-components.theme.scss +25 -0
- package/src/lib/modules/material/material.module.ts +94 -0
- package/src/lib/modules/nav/components/nav/nav.component.html +34 -0
- package/src/lib/modules/nav/components/nav/nav.component.scss +171 -0
- package/src/lib/modules/nav/components/nav/nav.component.ts +82 -0
- package/src/lib/modules/nav/nav.models.ts +31 -0
- package/src/lib/modules/nav/nav.module.ts +17 -0
- package/src/lib/modules/nav/nav.theme.scss +86 -0
- package/src/lib/modules/pagination/components/pagination/pagination.component.html +52 -0
- package/src/lib/modules/pagination/components/pagination/pagination.component.scss +155 -0
- package/src/lib/modules/pagination/components/pagination/pagination.component.ts +109 -0
- package/src/lib/modules/pagination/pagination.module.ts +17 -0
- package/src/lib/modules/pagination/pagination.theme.scss +66 -0
- package/src/lib/modules/side-nav/components/side-nav/side-nav.component.html +56 -0
- package/src/lib/modules/side-nav/components/side-nav/side-nav.component.scss +342 -0
- package/src/lib/modules/side-nav/components/side-nav/side-nav.component.ts +135 -0
- package/src/lib/modules/side-nav/side-nav.models.ts +38 -0
- package/src/lib/modules/side-nav/side-nav.module.ts +16 -0
- package/src/lib/modules/side-nav/side-nav.theme.scss +111 -0
- package/src/lib/modules/smart-form/components/form-field/form-field.component.html +1109 -0
- package/src/lib/modules/smart-form/components/form-field/form-field.component.scss +1860 -0
- package/src/lib/modules/smart-form/components/form-field/form-field.component.ts +2232 -0
- package/src/lib/modules/smart-form/components/form-section/form-section.component.html +64 -0
- package/src/lib/modules/smart-form/components/form-section/form-section.component.scss +209 -0
- package/src/lib/modules/smart-form/components/form-section/form-section.component.ts +119 -0
- package/src/lib/modules/smart-form/components/smart-form/smart-form.component.html +253 -0
- package/src/lib/modules/smart-form/components/smart-form/smart-form.component.scss +689 -0
- package/src/lib/modules/smart-form/components/smart-form/smart-form.component.ts +1087 -0
- package/src/lib/modules/smart-form/index.ts +10 -0
- package/src/lib/modules/smart-form/models/form-schema.model.ts +700 -0
- package/src/lib/modules/smart-form/models/hierarchy-config.model.ts +21 -0
- package/src/lib/modules/smart-form/services/expression.service.ts +75 -0
- package/src/lib/modules/smart-form/services/smart-form-controller.service.ts +65 -0
- package/src/lib/modules/smart-form/smart-form.examples.ts +1324 -0
- package/src/lib/modules/smart-form/smart-form.module.ts +36 -0
- package/src/lib/modules/smart-form/smart-form.theme.scss +890 -0
- package/src/lib/modules/smart-form/utils/translation.utils.ts +82 -0
- package/src/lib/modules/smart-form/utils/trusted-url.pipe.ts +25 -0
- package/src/lib/modules/smart-form/utils/validation.utils.ts +98 -0
- package/src/lib/modules/smart-table/components/smart-table/smart-table.component.html +283 -0
- package/src/lib/modules/smart-table/components/smart-table/smart-table.component.scss +685 -0
- package/src/lib/modules/smart-table/components/smart-table/smart-table.component.ts +1118 -0
- package/src/lib/modules/smart-table/models/table-config.model.ts +202 -0
- package/src/lib/modules/smart-table/smart-table.module.ts +30 -0
- package/src/lib/modules/smart-table/smart-table.theme.scss +335 -0
- package/src/lib/modules/smart-table/utils/safe-html.pipe.ts +22 -0
- package/src/lib/modules/smart-table/utils/smart-table.utils.ts +18 -0
- package/src/lib/modules/snackbar/components/snackbar.component.html +41 -0
- package/src/lib/modules/snackbar/components/snackbar.component.scss +99 -0
- package/src/lib/modules/snackbar/components/snackbar.component.ts +18 -0
- package/src/lib/modules/snackbar/models/snackbar.models.ts +10 -0
- package/src/lib/modules/snackbar/services/snackbar.service.ts +40 -0
- package/src/lib/modules/snackbar/snackbar.module.ts +11 -0
- package/src/lib/modules/snackbar/snackbar.theme.scss +93 -0
- package/src/lib/modules/summary-card/components/summary-card/summary-card.component.html +47 -0
- package/src/lib/modules/summary-card/components/summary-card/summary-card.component.scss +199 -0
- package/src/lib/modules/summary-card/components/summary-card/summary-card.component.ts +126 -0
- package/src/lib/modules/summary-card/summary-card.module.ts +18 -0
- package/src/lib/modules/summary-card/summary-card.theme.scss +176 -0
- package/src/lib/shared-ui.module.ts +44 -0
- package/src/lib/styles/global.scss +152 -0
- package/src/lib/styles/utilities.scss +250 -0
- package/src/lib/utils/constants.ts +11 -0
- package/src/lib/utils/storage.utils.ts +37 -0
- package/src/lib/utils/string.utils.ts +23 -0
- package/src/lib/utils/translation.utils.ts +87 -0
- package/src/public-api.ts +104 -0
- package/tsconfig.lib.json +15 -0
|
Binary file
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
# Alert Component
|
|
2
|
+
|
|
3
|
+
A customizable alert component that supports standard variants and full style overrides, now with flexible icon support.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
To install the latest version of the `commons-shared-web-ui` library, run the following command:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install commons-shared-web-ui@latest
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
1. Import `AlertModule` in your feature module:
|
|
14
|
+
|
|
15
|
+
```typescript
|
|
16
|
+
import { AlertModule } from "commons-shared-web-ui";
|
|
17
|
+
|
|
18
|
+
@NgModule({
|
|
19
|
+
imports: [AlertModule],
|
|
20
|
+
})
|
|
21
|
+
export class FeatureModule {}
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
2. Include the theme mixin in your global styles:
|
|
25
|
+
|
|
26
|
+
```scss
|
|
27
|
+
@use "commons-shared-web-ui/lib/modules/alert/alert.theme" as alert;
|
|
28
|
+
|
|
29
|
+
// Default Theme
|
|
30
|
+
:root {
|
|
31
|
+
@include alert.alert-theme();
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// Custom Theme Override
|
|
35
|
+
.custom-theme {
|
|
36
|
+
@include alert.alert-theme(
|
|
37
|
+
(
|
|
38
|
+
info-bg: #e8f0fe,
|
|
39
|
+
warning-title-color: #e65100,
|
|
40
|
+
)
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### Configuration Key Reference
|
|
46
|
+
|
|
47
|
+
The `alert-theme` mixin accepts a map with the following optional keys.
|
|
48
|
+
|
|
49
|
+
| Key | Default | Description |
|
|
50
|
+
| ---------------- | ------------------------ | ------------------------------------ |
|
|
51
|
+
| **font-family** | `('Roboto', sans-serif)` | Font stack for the alerts. |
|
|
52
|
+
| **padding** | `1rem 2rem` | Internal padding (16px 32px). |
|
|
53
|
+
| **radius** | `0.75rem` | Border radius (12px). |
|
|
54
|
+
| **gap** | `1rem` | Gap between icon and content (16px). |
|
|
55
|
+
| **icon-size** | `1.25rem` | Size of the icon (20px). |
|
|
56
|
+
| **title-size** | `1rem` | Font size of the title (16px). |
|
|
57
|
+
| **message-size** | `0.875rem` | Font size of the message (14px). |
|
|
58
|
+
| **info-bg** | `#F1F3F4` | Background for info variant. |
|
|
59
|
+
| **warning-bg** | `#F9C80E1F` | Background for warning variant. |
|
|
60
|
+
| **success-bg** | `#E6F4EA` | Background for success variant. |
|
|
61
|
+
| **error-bg** | `#FCE8E6` | Background for error variant. |
|
|
62
|
+
|
|
63
|
+
---
|
|
64
|
+
|
|
65
|
+
## Usage & Examples
|
|
66
|
+
|
|
67
|
+
### 1. Standard Variants
|
|
68
|
+
|
|
69
|
+
```html
|
|
70
|
+
<lib-alert variant="info">This is an info alert</lib-alert>
|
|
71
|
+
<lib-alert variant="warning">This is a warning alert</lib-alert>
|
|
72
|
+
<lib-alert variant="success">This is a success alert</lib-alert>
|
|
73
|
+
<lib-alert variant="error">This is an error alert</lib-alert>
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### 2. Custom Icons
|
|
77
|
+
|
|
78
|
+
The alert supports automatic image detection for strings containing path separators or extensions.
|
|
79
|
+
|
|
80
|
+
```html
|
|
81
|
+
<!-- FontAwesome -->
|
|
82
|
+
<lib-alert icon="fa-solid fa-bell">Custom Bell Icon</lib-alert>
|
|
83
|
+
|
|
84
|
+
<!-- Auto-detected Image (String) -->
|
|
85
|
+
<lib-alert icon="assets/icons/custom-alert.svg">Image from path</lib-alert>
|
|
86
|
+
|
|
87
|
+
<!-- Material Icon (Object) -->
|
|
88
|
+
<lib-alert [icon]="{ type: 'material', value: 'check_circle' }"
|
|
89
|
+
>Material Icon</lib-alert
|
|
90
|
+
>
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
### 3. Styled Instance
|
|
94
|
+
|
|
95
|
+
```html
|
|
96
|
+
<lib-alert
|
|
97
|
+
variant="warning"
|
|
98
|
+
title="Attention Required"
|
|
99
|
+
borderRadius="0"
|
|
100
|
+
backgroundColor="#FFF9C4"
|
|
101
|
+
borderColor="#FBC02D"
|
|
102
|
+
>
|
|
103
|
+
This is a highly customized warning alert.
|
|
104
|
+
</lib-alert>
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
## API Reference
|
|
108
|
+
|
|
109
|
+
### Inputs
|
|
110
|
+
|
|
111
|
+
| Input | Type | Default | Description |
|
|
112
|
+
| ----------------- | --------------------------------- | -------- | ------------------------------------------- |
|
|
113
|
+
| `variant` | `AlertVariant` | `'info'` | Visual style variant. |
|
|
114
|
+
| `title` | `string` | `''` | Optional title. |
|
|
115
|
+
| `message` | `string` | `''` | Main message content. |
|
|
116
|
+
| `icon` | `boolean \| string \| IconConfig` | `true` | Icon config. Supports auto-image detection. |
|
|
117
|
+
| `customIcon` | `string` | `''` | Custom CSS class for icon. |
|
|
118
|
+
| `width` | `string` | - | CSS width override. |
|
|
119
|
+
| `borderRadius` | `string` | - | CSS border-radius override. |
|
|
120
|
+
| `padding` | `string` | - | CSS padding override. |
|
|
121
|
+
| `backgroundColor` | `string` | - | CSS background-color override. |
|
|
122
|
+
| `fontSize` | `string` | - | CSS font-size override. |
|
|
123
|
+
| `boxShadow` | `string` | - | CSS box-shadow override. |
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
# Button Dropdown Component
|
|
2
|
+
|
|
3
|
+
The `ButtonDropdownComponent` (`<lib-button-dropdown>`) groups multiple actions under a single primary button. It perfectly mimics the behavior of the Smart Table's action menu, allowing you to use it on generic detail pages or custom headers.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
Import the `ButtonDropdownModule` into your feature module. Note that this is separate from the standard `ButtonModule` to support advanced routing and modal integrations.
|
|
8
|
+
|
|
9
|
+
```typescript
|
|
10
|
+
import { ButtonDropdownModule } from "commons-shared-web-ui";
|
|
11
|
+
|
|
12
|
+
@NgModule({
|
|
13
|
+
imports: [
|
|
14
|
+
ButtonDropdownModule,
|
|
15
|
+
// ...
|
|
16
|
+
],
|
|
17
|
+
})
|
|
18
|
+
export class MyFeatureModule {}
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Basic Usage
|
|
22
|
+
|
|
23
|
+
The component looks and acts like a normal `<lib-button>` until clicked, at which point it opens a floating menu list of `actions`.
|
|
24
|
+
|
|
25
|
+
### Component
|
|
26
|
+
|
|
27
|
+
```typescript
|
|
28
|
+
import { DropdownAction } from "commons-shared-web-ui";
|
|
29
|
+
|
|
30
|
+
export class MyComponent {
|
|
31
|
+
userRecord = { id: 123, name: "John Doe" };
|
|
32
|
+
|
|
33
|
+
dropdownActions: DropdownAction[] = [
|
|
34
|
+
{
|
|
35
|
+
label: "Duplicate",
|
|
36
|
+
icon: "fa fa-copy",
|
|
37
|
+
type: "callback",
|
|
38
|
+
callback: (data) => this.duplicateRecord(data),
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
label: "Edit",
|
|
42
|
+
icon: "fa fa-edit",
|
|
43
|
+
type: "route",
|
|
44
|
+
route: "/users/:id/edit", // :id automatically replaced by userRecord.id
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
label: "Delete",
|
|
48
|
+
icon: "fa fa-trash",
|
|
49
|
+
type: "api",
|
|
50
|
+
color: "red", // Highlights the text/icon in red and adds a red hover state
|
|
51
|
+
apiUrl: "https://api.example.com/users/:id",
|
|
52
|
+
apiMethod: "DELETE",
|
|
53
|
+
confirmationNeeded: true,
|
|
54
|
+
confirmationMessage: "Are you sure you want to delete this user?",
|
|
55
|
+
},
|
|
56
|
+
];
|
|
57
|
+
|
|
58
|
+
duplicateRecord(user: any) {
|
|
59
|
+
console.log("Duplicating", user);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### Template
|
|
65
|
+
|
|
66
|
+
```html
|
|
67
|
+
<lib-button-dropdown
|
|
68
|
+
label="Actions"
|
|
69
|
+
variant="warning"
|
|
70
|
+
menuTheme="dark"
|
|
71
|
+
icon="fa fa-chevron-down"
|
|
72
|
+
[actions]="dropdownActions"
|
|
73
|
+
[data]="userRecord"
|
|
74
|
+
></lib-button-dropdown>
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
## API Reference
|
|
78
|
+
|
|
79
|
+
### Inputs
|
|
80
|
+
|
|
81
|
+
| Input | Type | Default | Description |
|
|
82
|
+
| ------------ | ----------------- | ---------------------- | -------------------------------------------------------------------- |
|
|
83
|
+
| `label` | `string` | `'Actions'` | The main text displayed on the button. |
|
|
84
|
+
| `variant` | `ButtonVariant` | `'primary'` | The style variant for the toggle button itself. |
|
|
85
|
+
| `menuTheme` | `'light'\|'dark'` | `'light'` | Toggles the dropdown menu background and text between light/dark. |
|
|
86
|
+
| `icon` | `string` | `'fa fa-chevron-down'` | FontAwesome or Material icon class for the button. |
|
|
87
|
+
| `actions` | `DropdownAction[]`| `[]` | Array of action configurations to display in the menu. |
|
|
88
|
+
| `data` | `any` | `null` | Context data passed to route parameter parsing or callback methods. |
|
|
89
|
+
| `disabled` | `boolean` | `false` | Disables the entire dropdown button. |
|
|
90
|
+
|
|
91
|
+
### DropdownAction Interface
|
|
92
|
+
|
|
93
|
+
| Property | Type | Description |
|
|
94
|
+
| --------------------- | ------------------------------------------------- | ----------------------------------------------------------------------------------------------- |
|
|
95
|
+
| `label` | `string` | Display text for the menu item. |
|
|
96
|
+
| `type` | `'api' \| 'route' \| 'callback'` | The execution behavior of the item. |
|
|
97
|
+
| `icon` | `string` | (Optional) Icon class for the item (e.g., `fa fa-edit`). |
|
|
98
|
+
| `variant` | `ButtonVariant` | (Optional) Applies full variant styles (primary, warning, danger, etc.) to the item block. |
|
|
99
|
+
| `color` | `string` | (Optional) Generic text color for the item. Using `'red'` triggers a destructive style. |
|
|
100
|
+
| `disabled` | `boolean` | (Optional) Disables this specific item. |
|
|
101
|
+
| `route` | `string` | (Required for `type: 'route'`) Internal path. Replaces `:prop` with `data[prop]`. |
|
|
102
|
+
| `apiUrl` | `string` | (Required for `type: 'api'`) External URL. Replaces `:prop` with `data[prop]`. |
|
|
103
|
+
| `apiMethod` | `'GET' \| 'POST' \| 'PUT' \| 'DELETE' \| 'PATCH'` | (Optional) HTTP method for `api` type. Default is `GET`. |
|
|
104
|
+
| `apiPayload` | `any` | (Optional) Body payload for POST/PUT/PATCH. Defaults to `data` if not provided. |
|
|
105
|
+
| `callback` | `(data: any) => void` | (Required for `type: 'callback'`) Function to execute. |
|
|
106
|
+
| `confirmationNeeded` | `boolean` | (Optional) Triggers a confirmation modal before execution. |
|
|
107
|
+
| `confirmationTitle` | `string` | (Optional) Title for the confirmation modal. Default: `'Please Confirm'`. |
|
|
108
|
+
| `confirmationMessage` | `string` | (Optional) Message for the confirmation modal. |
|
|
109
|
+
|
|
110
|
+
### Outputs
|
|
111
|
+
|
|
112
|
+
| Output | Payload | Description |
|
|
113
|
+
| ------------------ | ---------------------------------------------- | -------------------------------------------------------------------- |
|
|
114
|
+
| `actionClick` | `{ action: DropdownAction, data: any }` | Emitted when any item is clicked (after confirmation if applicable). |
|
|
115
|
+
| `apiActionStart` | `DropdownAction` | Emitted when an `api` type action begins execution. |
|
|
116
|
+
| `apiActionSuccess` | `{ action: DropdownAction, response: any }` | Emitted upon successful HTTP execution. |
|
|
117
|
+
| `apiActionError` | `{ action: DropdownAction, error: any }` | Emitted if the HTTP execution fails. |
|
|
118
|
+
|
|
119
|
+
## Advanced Execution
|
|
120
|
+
|
|
121
|
+
Just like the Smart Table, the `ButtonDropdownComponent` takes care of executing its own events.
|
|
122
|
+
|
|
123
|
+
- **Routing:** Automatically injects the Angular `Router` and executes route changes, handling parameterized `:id` replacements.
|
|
124
|
+
- **API Calls:** If an action has `type: 'api'` and an `apiUrl`, the component constructs the HTTP call, handles payload insertion, and automatically executes the HTTP request, exposing Success/Error events you can listen to if needed.
|
|
125
|
+
- **Confirmations:** Setting `confirmationNeeded: true` entirely intercepts the click, opens a standard `cc-confirmation-modal` overlay, and only proceeds to the route/API/callback if the user clicks "Confirm". No extra component logic is needed!
|
|
126
|
+
- **Smart Delete Inference:** If the component detects the action is a "Delete" action (via `apiMethod: 'DELETE'`, `variant: 'danger'`, `color: 'red'`, or the word "delete" in the label), the confirmation modal automatically styles itself with a Red Warning Icon, a Red "Delete" confirm button, changes the title to "Confirm Deletion", and generates a fallback message of *"Are you sure you want to delete this item? This action cannot be undone."* if you didn't provide a Custom `confirmationMessage`!
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
# Button Component Documentation
|
|
2
|
+
|
|
3
|
+
The `ButtonComponent` is a reusable, themed button control that supports the application's design system with plug-and-play styling.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- **Standard Variants**: Primary, Warning, Outline, Secondary, Success, Danger, Danger-Outline.
|
|
8
|
+
- **Theming**: Completely externalized theming support via SCSS mixins and CSS variables.
|
|
9
|
+
- **Independent**: No global palette dependencies.
|
|
10
|
+
- **Customization**: Direct input overrides for one-off styling (width, radius, color, etc.).
|
|
11
|
+
|
|
12
|
+
## Installation
|
|
13
|
+
|
|
14
|
+
To install the latest version of the `commons-shared-web-ui` library, run the following command:
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
npm install commons-shared-web-ui@latest
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
Import the `ButtonModule` into your feature module or `SharedModule`.
|
|
21
|
+
|
|
22
|
+
```typescript
|
|
23
|
+
import { ButtonModule } from "commons-shared-web-ui";
|
|
24
|
+
// Adjust path based on your library structure
|
|
25
|
+
|
|
26
|
+
@NgModule({
|
|
27
|
+
imports: [
|
|
28
|
+
ButtonModule,
|
|
29
|
+
// ...
|
|
30
|
+
],
|
|
31
|
+
})
|
|
32
|
+
export class MyFeatureModule {}
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Theming & Styling
|
|
36
|
+
|
|
37
|
+
The button uses **CSS Variables**. This means you can change the theme dynamically at runtime by applying a CSS class to a parent element (or the `body`).
|
|
38
|
+
|
|
39
|
+
### 1. Import the Button Mixin
|
|
40
|
+
|
|
41
|
+
In your application's styles (e.g., `styles.scss`):
|
|
42
|
+
|
|
43
|
+
```scss
|
|
44
|
+
@use "commons-shared-web-ui/src/lib/modules/button/button.theme" as button;
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### 2. Define Default & Custom Themes
|
|
48
|
+
|
|
49
|
+
Define your themes by including the mixin with different configurations.
|
|
50
|
+
|
|
51
|
+
```scss
|
|
52
|
+
// Default Theme (Light Mode)
|
|
53
|
+
:root {
|
|
54
|
+
@include button.button-theme(); // Default button styles
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// Dark Theme Example
|
|
58
|
+
.dark-theme {
|
|
59
|
+
// Override specific vars for dark mode
|
|
60
|
+
@include button.button-theme(
|
|
61
|
+
(
|
|
62
|
+
primary-bg: #ffffff,
|
|
63
|
+
primary-color: #000000,
|
|
64
|
+
secondary-bg: #333333,
|
|
65
|
+
secondary-color: #ffffff,
|
|
66
|
+
)
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
// Custom Brand Theme
|
|
71
|
+
.brand-theme {
|
|
72
|
+
@include button.button-theme(
|
|
73
|
+
(
|
|
74
|
+
primary-bg: #6200ee,
|
|
75
|
+
primary-radius: 20px,
|
|
76
|
+
)
|
|
77
|
+
);
|
|
78
|
+
}
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### 3. Switching Themes
|
|
82
|
+
|
|
83
|
+
To switch themes, simply toggle the class on a parent element. The components will automatically update.
|
|
84
|
+
|
|
85
|
+
```html
|
|
86
|
+
<!-- Default Theme -->
|
|
87
|
+
<lib-button variant="primary">Default Button</lib-button>
|
|
88
|
+
|
|
89
|
+
<!-- Dark Theme -->
|
|
90
|
+
<div class="dark-theme">
|
|
91
|
+
<lib-button variant="primary">Dark Mode Button</lib-button>
|
|
92
|
+
</div>
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
### Configuration Key Reference
|
|
96
|
+
|
|
97
|
+
The `button-theme` mixin accepts a map with the following optional keys. Any key not provided will fall back to its default value.
|
|
98
|
+
|
|
99
|
+
| Key | Default | Description |
|
|
100
|
+
| -------------------- | ------------------------ | ---------------------------------- |
|
|
101
|
+
| **font-family** | `('Roboto', sans-serif)` | Font stack for the buttons. |
|
|
102
|
+
| **font-weight** | `500` | Base font weight. |
|
|
103
|
+
| **font-size** | `1rem` | Base font size (16px). |
|
|
104
|
+
| **padding** | `0.5rem 1rem` | Base padding (8px 16px). |
|
|
105
|
+
| **primary-bg** | `#262125` | Background for primary variant. |
|
|
106
|
+
| **primary-color** | `#FFFFFF` | Text color for primary variant. |
|
|
107
|
+
| **primary-radius** | `0.5rem` | Border radius for primary variant. |
|
|
108
|
+
| **warning-bg** | `#F9C80E` | Background for warning variant. |
|
|
109
|
+
| **secondary-bg** | `#E8EAED` | Background for secondary variant. |
|
|
110
|
+
| **success-bg** | `#16A34A` | Background for success variant. |
|
|
111
|
+
| **danger-bg** | `#E63E30` | Background for danger variant. |
|
|
112
|
+
| **disabled-opacity** | `0.6` | Opacity when disabled. |
|
|
113
|
+
|
|
114
|
+
> [!NOTE]
|
|
115
|
+
> All variants support `-bg`, `-color`, `-radius`, and `-border` keys in the theme map.
|
|
116
|
+
|
|
117
|
+
---
|
|
118
|
+
|
|
119
|
+
## Usage & Examples
|
|
120
|
+
|
|
121
|
+
### 1. Standard Variants
|
|
122
|
+
|
|
123
|
+
Pre-defined styles for common use cases.
|
|
124
|
+
|
|
125
|
+
```html
|
|
126
|
+
<lib-button variant="primary">Primary Action</lib-button>
|
|
127
|
+
<lib-button variant="warning">Warning</lib-button>
|
|
128
|
+
<lib-button variant="secondary">Secondary</lib-button>
|
|
129
|
+
<lib-button variant="outline">Outline</lib-button>
|
|
130
|
+
<lib-button variant="success">Success</lib-button>
|
|
131
|
+
<lib-button variant="danger">Danger</lib-button>
|
|
132
|
+
<lib-button variant="danger-outline">Danger Outline</lib-button>
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
### 2. Flexible Icons
|
|
136
|
+
|
|
137
|
+
The button supports three types of icons: FontAwesome, Material Icons, and Images.
|
|
138
|
+
|
|
139
|
+
```html
|
|
140
|
+
<!-- FontAwesome -->
|
|
141
|
+
<lib-button icon="fa-solid fa-plus">Add Item</lib-button>
|
|
142
|
+
|
|
143
|
+
<!-- Material Icons -->
|
|
144
|
+
<lib-button [icon]="{ type: 'material', value: 'save' }">Save</lib-button>
|
|
145
|
+
|
|
146
|
+
<!-- Image Icons (Path or URL) -->
|
|
147
|
+
<lib-button [icon]="{ type: 'img', value: 'assets/google-icon.png' }"
|
|
148
|
+
>Login with Google</lib-button
|
|
149
|
+
>
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
### 3. Custom Implementation (Configurable)
|
|
153
|
+
|
|
154
|
+
You can customize specific instances using inputs.
|
|
155
|
+
|
|
156
|
+
```html
|
|
157
|
+
<lib-button
|
|
158
|
+
variant="primary"
|
|
159
|
+
width="240px"
|
|
160
|
+
borderRadius="50px"
|
|
161
|
+
backgroundColor="#6200EE"
|
|
162
|
+
>
|
|
163
|
+
Custom Wide Button
|
|
164
|
+
</lib-button>
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
## API Reference
|
|
168
|
+
|
|
169
|
+
### Inputs
|
|
170
|
+
|
|
171
|
+
| Input | Type | Default | Description |
|
|
172
|
+
| ----------------- | ------------------------------------------------------ | ----------- | -------------------------------------------------------- |
|
|
173
|
+
| `variant` | `ButtonVariant` | `'primary'` | Visual style variant. |
|
|
174
|
+
| `type` | `'button' \| 'submit' \| 'reset'` | `'button'` | HTML button type. |
|
|
175
|
+
| `disabled` | `boolean` | `false` | Whether the button is disabled. |
|
|
176
|
+
| `icon` | `boolean \| string \| { type: string, value: string }` | `''` | Icon configuration. Supports FA class strings or object. |
|
|
177
|
+
| `width` | `string` | - | CSS width override. |
|
|
178
|
+
| `height` | `string` | - | CSS height override. |
|
|
179
|
+
| `borderRadius` | `string` | - | CSS border-radius override. |
|
|
180
|
+
| `backgroundColor` | `string` | - | CSS background-color override. |
|
|
181
|
+
| `color` | `string` | - | CSS text color override. |
|
|
182
|
+
| `fontSize` | `string` | - | CSS font-size override. |
|
|
183
|
+
| `fontWeight` | `string` | - | CSS font-weight override. |
|
|
184
|
+
| `border` | `string` | - | CSS border override. |
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
# Cards Module Documentation
|
|
2
|
+
|
|
3
|
+
The `CardsModule` provides reusable, configurable card components with multi-theme support.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
To install the latest version of the `commons-shared-web-ui` library, run the following command:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install commons-shared-web-ui@latest
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Import the `CardsModule` in your application module:
|
|
14
|
+
|
|
15
|
+
```typescript
|
|
16
|
+
import { CardsModule } from "shared-ui";
|
|
17
|
+
|
|
18
|
+
@NgModule({
|
|
19
|
+
imports: [
|
|
20
|
+
CardsModule,
|
|
21
|
+
// ...
|
|
22
|
+
],
|
|
23
|
+
})
|
|
24
|
+
export class AppModule {}
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Styling & Theming
|
|
28
|
+
|
|
29
|
+
The cards rely on global CSS variables. You can override these in your app's `styles.scss` or component styles.
|
|
30
|
+
|
|
31
|
+
### Themes
|
|
32
|
+
|
|
33
|
+
The module supports two built-in themes:
|
|
34
|
+
|
|
35
|
+
- `theme-1`: Compact, native look (Matches strict design).
|
|
36
|
+
- `theme-2`: Spacious, aesthetic look.
|
|
37
|
+
|
|
38
|
+
Pass the theme name to the component input: `[theme]="'theme-2'"`.
|
|
39
|
+
|
|
40
|
+
## Components
|
|
41
|
+
|
|
42
|
+
### 1. Card Type 1 (Text Based)
|
|
43
|
+
|
|
44
|
+
Ideal for displaying financial stats or summary data.
|
|
45
|
+
|
|
46
|
+
**Selector**: `<lib-card-type-1>`
|
|
47
|
+
|
|
48
|
+
**Inputs**:
|
|
49
|
+
|
|
50
|
+
- `config`: `CardType1Config` (Includes `width`, `height`)
|
|
51
|
+
- `theme`: `'theme-1' | 'theme-2'` (Default: `theme-1`)
|
|
52
|
+
|
|
53
|
+
**Output**:
|
|
54
|
+
|
|
55
|
+
- `cardClick`: Emits when card is clicked.
|
|
56
|
+
|
|
57
|
+
**Usage Example**:
|
|
58
|
+
|
|
59
|
+
```html
|
|
60
|
+
<lib-card-type-1
|
|
61
|
+
[config]="grantConfig"
|
|
62
|
+
[theme]="'theme-1'"
|
|
63
|
+
(cardClick)="onCardClick()"
|
|
64
|
+
>
|
|
65
|
+
</lib-card-type-1>
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
```typescript
|
|
69
|
+
import { CardType1Config } from "shared-ui";
|
|
70
|
+
|
|
71
|
+
grantConfig: CardType1Config = {
|
|
72
|
+
label: "TOTAL GRANT AMOUNT",
|
|
73
|
+
value: "₹ 25,00,000",
|
|
74
|
+
subtext: "Across 3 contracts",
|
|
75
|
+
width: "300px",
|
|
76
|
+
height: "150px",
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
receivedConfig: CardType1Config = {
|
|
80
|
+
label: "RECEIVED",
|
|
81
|
+
value: "₹ 18,00,000",
|
|
82
|
+
valueColor: "#00C853", // Custom color override
|
|
83
|
+
subtext: "74% Funded",
|
|
84
|
+
};
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### 2. Card Type 2 (Icon Based)
|
|
88
|
+
|
|
89
|
+
Ideal for displaying metrics with an icon.
|
|
90
|
+
|
|
91
|
+
**Selector**: `<lib-card-type-2>`
|
|
92
|
+
|
|
93
|
+
**Inputs**:
|
|
94
|
+
|
|
95
|
+
- `config`: `CardType2Config` (Includes `width`, `height`)
|
|
96
|
+
- `theme`: `'theme-1' | 'theme-2'`
|
|
97
|
+
|
|
98
|
+
```html
|
|
99
|
+
<lib-card-type-2 [config]="beneficiaryConfig" theme="theme-2">
|
|
100
|
+
</lib-card-type-2>
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
## Responsive Behavior
|
|
104
|
+
|
|
105
|
+
Both card types are designed to be responsive.
|
|
106
|
+
|
|
107
|
+
- The `width` and `height` properties in the `config` object accept any valid CSS unit (px, %, rem, vh, etc.).
|
|
108
|
+
- Even when custom dimensions are provided, cards follow `max-width: 100%` to prevent overflow in smaller containers.
|
|
109
|
+
- If no dimensions are provided, cards default to `100%` width and height, occupying the full area of their parent container.
|
|
110
|
+
|
|
111
|
+
```typescript
|
|
112
|
+
import { CardType2Config } from "shared-ui";
|
|
113
|
+
|
|
114
|
+
beneficiaryConfig: CardType2Config = {
|
|
115
|
+
iconName: "card_membership",
|
|
116
|
+
iconBackgroundColor: "#FFF8E1",
|
|
117
|
+
iconColor: "#FF6F00",
|
|
118
|
+
label: "TOTAL BENEFICIARIES",
|
|
119
|
+
value: "45,000",
|
|
120
|
+
targetText: "Target",
|
|
121
|
+
width: "250px",
|
|
122
|
+
height: "120px",
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
// Example with Image Icon
|
|
126
|
+
beneficiaryConfigWithImage: CardType2Config = {
|
|
127
|
+
iconUrl: "assets/images/custom-icon.png",
|
|
128
|
+
label: "TOTAL BENEFICIARIES",
|
|
129
|
+
value: "45,000",
|
|
130
|
+
};
|
|
131
|
+
```
|