commons-shared-web-ui 0.0.39 → 0.0.40

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 (29) hide show
  1. package/fesm2022/commons-shared-web-ui.mjs +1522 -1332
  2. package/fesm2022/commons-shared-web-ui.mjs.map +1 -1
  3. package/index.d.ts +56 -4
  4. package/package.json +1 -1
  5. package/src/lib/modules/alert/alert.theme.scss +84 -84
  6. package/src/lib/modules/button/button.theme.scss +120 -120
  7. package/src/lib/modules/configurable-form/configurable-form.theme.scss +77 -77
  8. package/src/lib/modules/confirmation-modal/confirmation-modal.theme.scss +86 -86
  9. package/src/lib/modules/filter/filter.theme.scss +91 -91
  10. package/src/lib/modules/filter-sidebar/filter-sidebar.theme.scss +37 -37
  11. package/src/lib/modules/filter-table-selector/filter-table-selector.theme.scss +36 -36
  12. package/src/lib/modules/form-builder/form-builder.theme.scss +212 -212
  13. package/src/lib/modules/form-components/components/checkbox/_theme.scss +62 -62
  14. package/src/lib/modules/form-components/components/datepicker/_theme.scss +81 -81
  15. package/src/lib/modules/form-components/components/dropdown/_theme.scss +90 -90
  16. package/src/lib/modules/form-components/components/input/_theme.scss +76 -76
  17. package/src/lib/modules/form-components/components/radio/_theme.scss +60 -60
  18. package/src/lib/modules/form-components/components/search/_theme.scss +72 -72
  19. package/src/lib/modules/form-components/components/toggle/_theme.scss +44 -44
  20. package/src/lib/modules/form-components/form-components.theme.scss +24 -24
  21. package/src/lib/modules/nav/nav.theme.scss +86 -86
  22. package/src/lib/modules/pagination/pagination.theme.scss +66 -66
  23. package/src/lib/modules/side-nav/side-nav.theme.scss +111 -111
  24. package/src/lib/modules/smart-form/smart-form.theme.scss +889 -889
  25. package/src/lib/modules/smart-table/smart-table.theme.scss +335 -323
  26. package/src/lib/modules/snackbar/snackbar.theme.scss +93 -93
  27. package/src/lib/modules/summary-card/summary-card.theme.scss +175 -175
  28. package/src/lib/styles/global.scss +151 -134
  29. package/src/lib/styles/utilities.scss +250 -250
package/index.d.ts CHANGED
@@ -9,7 +9,7 @@ import { HttpClient, HttpHeaders } from '@angular/common/http';
9
9
  import * as i3$2 from '@angular/router';
10
10
  import { Router, ActivatedRoute } from '@angular/router';
11
11
  import { BehaviorSubject, Subject, Observable } from 'rxjs';
12
- import { DomSanitizer, SafeResourceUrl } from '@angular/platform-browser';
12
+ import { DomSanitizer, SafeResourceUrl, SafeHtml } from '@angular/platform-browser';
13
13
  import * as i1 from '@angular/material/card';
14
14
  import * as i3 from '@angular/material/checkbox';
15
15
  import * as i4 from '@angular/material/divider';
@@ -3182,6 +3182,18 @@ interface TableOption {
3182
3182
  label: string;
3183
3183
  value: any;
3184
3184
  }
3185
+ interface TableColumnSubField {
3186
+ key: string;
3187
+ label?: string;
3188
+ dataType: 'text' | 'number' | 'email' | 'select' | 'date';
3189
+ placeholder?: string;
3190
+ editable?: boolean;
3191
+ options?: TableOption[];
3192
+ editConfig?: {
3193
+ disabled?: boolean;
3194
+ defaultValue?: any;
3195
+ };
3196
+ }
3185
3197
  interface TableColumn {
3186
3198
  key: string;
3187
3199
  label: string;
@@ -3201,6 +3213,11 @@ interface TableColumn {
3201
3213
  dateFormat?: string;
3202
3214
  clickAction?: 'route' | 'callback';
3203
3215
  clickRoute?: string;
3216
+ subFields?: TableColumnSubField[];
3217
+ editConfig?: {
3218
+ disabled?: boolean;
3219
+ defaultValue?: any;
3220
+ };
3204
3221
  }
3205
3222
  interface TableFilter {
3206
3223
  key: string;
@@ -3308,6 +3325,7 @@ interface TableConfig {
3308
3325
  stickyColumnCount?: number;
3309
3326
  token?: string;
3310
3327
  tokenHeader?: string;
3328
+ editingRowClass?: string;
3311
3329
  }
3312
3330
  interface SearchConfig {
3313
3331
  enabled: boolean;
@@ -3321,6 +3339,13 @@ interface TableLabels {
3321
3339
  noDataMessage?: string;
3322
3340
  itemsPerPageLabel?: string;
3323
3341
  defaultConfirmationMessage?: string;
3342
+ saveLabel?: string;
3343
+ cancelLabel?: string;
3344
+ addLabel?: string;
3345
+ /** Variant for the Add button (new row). Defaults to 'danger'. */
3346
+ addButtonVariant?: 'primary' | 'secondary' | 'outline' | 'danger' | 'warning' | 'success' | 'danger-outline';
3347
+ /** Variant for the Save button (edit row). Defaults to 'primary'. */
3348
+ saveButtonVariant?: 'primary' | 'secondary' | 'outline' | 'danger' | 'warning' | 'success' | 'danger-outline';
3324
3349
  }
3325
3350
  /**
3326
3351
  * Emitted by the SmartTableComponent when operating in external-data mode
@@ -3338,6 +3363,10 @@ interface TableDataChangeEvent {
3338
3363
  [key: string]: any;
3339
3364
  };
3340
3365
  }
3366
+ interface TableRowSaveEvent {
3367
+ row: any;
3368
+ isNew: boolean;
3369
+ }
3341
3370
 
3342
3371
  /**
3343
3372
  * Maps a SmartForm field name to its corresponding API query-param key.
@@ -3579,10 +3608,13 @@ declare class SmartTableComponent implements OnInit, OnChanges, AfterViewInit, O
3579
3608
  pageChange: EventEmitter<TableDataChangeEvent>;
3580
3609
  /** Emitted in external-data mode when the user types in the search box. */
3581
3610
  searchChange: EventEmitter<TableDataChangeEvent>;
3611
+ /** Emitted when an inline-edited or inline-added row is saved. */
3612
+ rowSave: EventEmitter<TableRowSaveEvent>;
3582
3613
  data: any[];
3583
3614
  totalItems: number;
3584
3615
  currentPage: number;
3585
3616
  loading: boolean;
3617
+ originalRowsCache: Map<any, any>;
3586
3618
  activeSort: {
3587
3619
  key: string;
3588
3620
  direction: 'ASC' | 'DESC';
@@ -3682,8 +3714,28 @@ declare class SmartTableComponent implements OnInit, OnChanges, AfterViewInit, O
3682
3714
  private getHeaders;
3683
3715
  toggleDropdown(id: string, event: Event, items: any[], row: any): void;
3684
3716
  closeDropdown(): void;
3717
+ onCancelRow(row: any, index: number): void;
3718
+ onSaveRow(row: any): void;
3719
+ /** Convert any parseable date value to a native Date object for mat-datepicker binding. */
3720
+ private toDateObject;
3721
+ /** Pre-process all date columns on a row before entering edit mode. */
3722
+ private prepareDateFieldsForEdit;
3723
+ /** Normalize Date objects back to ISO strings before sending payloads. */
3724
+ private normalizeDateFieldsForSave;
3685
3725
  static ɵfac: i0.ɵɵFactoryDeclaration<SmartTableComponent, never>;
3686
- static ɵcmp: i0.ɵɵComponentDeclaration<SmartTableComponent, "lib-smart-table", never, { "config": { "alias": "config"; "required": false; }; "tableData": { "alias": "tableData"; "required": false; }; "totalItemsCount": { "alias": "totalItemsCount"; "required": false; }; "selectedRows": { "alias": "selectedRows"; "required": false; }; }, { "action": "action"; "topAction": "topAction"; "filterChange": "filterChange"; "rowSelect": "rowSelect"; "columnClick": "columnClick"; "sortChange": "sortChange"; "pageChange": "pageChange"; "searchChange": "searchChange"; }, never, never, false, never>;
3726
+ static ɵcmp: i0.ɵɵComponentDeclaration<SmartTableComponent, "lib-smart-table", never, { "config": { "alias": "config"; "required": false; }; "tableData": { "alias": "tableData"; "required": false; }; "totalItemsCount": { "alias": "totalItemsCount"; "required": false; }; "selectedRows": { "alias": "selectedRows"; "required": false; }; }, { "action": "action"; "topAction": "topAction"; "filterChange": "filterChange"; "rowSelect": "rowSelect"; "columnClick": "columnClick"; "sortChange": "sortChange"; "pageChange": "pageChange"; "searchChange": "searchChange"; "rowSave": "rowSave"; }, never, never, false, never>;
3727
+ }
3728
+
3729
+ /**
3730
+ * Sanitizes and bypasses Angular's DomSanitizer security for HTML content.
3731
+ * Prevents execution of unsafe scripts/attributes while allowing safe rendering of formatting tags in [innerHTML].
3732
+ */
3733
+ declare class SafeHtmlPipe implements PipeTransform {
3734
+ private sanitizer;
3735
+ constructor(sanitizer: DomSanitizer);
3736
+ transform(value: string): SafeHtml | null;
3737
+ static ɵfac: i0.ɵɵFactoryDeclaration<SafeHtmlPipe, never>;
3738
+ static ɵpipe: i0.ɵɵPipeDeclaration<SafeHtmlPipe, "safeHtml", false>;
3687
3739
  }
3688
3740
 
3689
3741
  interface PaginationLabels {
@@ -3725,7 +3777,7 @@ declare class PaginationModule {
3725
3777
 
3726
3778
  declare class SmartTableModule {
3727
3779
  static ɵfac: i0.ɵɵFactoryDeclaration<SmartTableModule, never>;
3728
- static ɵmod: i0.ɵɵNgModuleDeclaration<SmartTableModule, [typeof SmartTableComponent], [typeof i2$1.CommonModule, typeof i3$1.FormsModule, typeof PaginationModule, typeof ButtonModule, typeof MaterialModule, typeof ConfirmationModalModule], [typeof SmartTableComponent]>;
3780
+ static ɵmod: i0.ɵɵNgModuleDeclaration<SmartTableModule, [typeof SmartTableComponent, typeof SafeHtmlPipe], [typeof i2$1.CommonModule, typeof i3$1.FormsModule, typeof PaginationModule, typeof ButtonModule, typeof MaterialModule, typeof ConfirmationModalModule], [typeof SmartTableComponent]>;
3729
3781
  static ɵinj: i0.ɵɵInjectorDeclaration<SmartTableModule>;
3730
3782
  }
3731
3783
 
@@ -3914,4 +3966,4 @@ declare class SnackbarModule {
3914
3966
  }
3915
3967
 
3916
3968
  export { AlertComponent, AlertModule, ButtonComponent, ButtonDropdownComponent, ButtonDropdownModule, ButtonModule, CheckboxComponent, ConfigurableFormComponent, configurableForm_examples_d as ConfigurableFormExamples, ConfigurableFormModule, ConfirmationModalComponent, ConfirmationModalModule, DEFAULT_ITEMS_PER_PAGE, DEFAULT_PAGE_SIZE_OPTIONS, DEFAULT_SIDE_NAV_TOOLTIP_POSITION, DatepickerComponent, DropdownComponent, ExpressionService, FieldConfiguratorComponent, FieldSelectionComponent, FilterComponent, FilterModule, FilterSidebarComponent, FilterSidebarModule, FilterTableSelectorComponent, FilterTableSelectorModule, FormBuilderModule, FormComponentsModule, InputComponent, MaterialModule, NAV_ORIENTATION_DEFAULT, NAV_VARIANT_DEFAULT, NavComponent, NavModule, PAGINATION_THEME_DARK, PAGINATION_THEME_DEFAULT, PaginationComponent, PaginationModule, RadioComponent, SearchComponent, SharedUiModule, SideNavComponent, SideNavModule, SmartFormComponent, SmartFormController, smartForm_examples_d as SmartFormExamples, SmartFormModule, SmartTableComponent, SmartTableModule, SnackbarComponent, SnackbarModule, SnackbarService, StringUtils, SummaryCardComponent, SummaryCardModule, ToggleComponent, ValidationUtils, appendBaseUrlRecursively, clearLocalStorage, clearSessionStorage, getLocalStorageItem, getSessionStorageItem, removeLocalStorageItem, removeSessionStorageItem, setLocalStorageItem, setSessionStorageItem, translateConfig };
3917
- export type { AlertLabels, AlertVariant, AttachmentConfig, ButtonLabels, ButtonVariant, CheckboxConfig, CheckboxLabels, CheckboxOption, ConfirmationModalConfig, DateConfig, DatePickerConfig, DatepickerLabels, DropdownAction, DropdownConfig, DropdownLabels, DropdownOption, EmailConfig, FieldConfig, FieldType, FilterChangeEvent, FilterConfig, FilterItem, FilterItemType, FilterOutput, FilterPanelConfig, FilterParamMap, FilterSearchConfig, FilterSidebarChangeEvent, FilterSidebarConfig, FilterSidebarOutput, FilterTableConfig, FilterTableSelectorConfig, FormConfig, FormField, FormOption, FormSchema, FormSection, GeneratedConfig, IconInput, InputConfig, InputLabels, InputType, JsonFieldConfig, JsonFormConfig, KeyType, LengthConstraint, LocationConfig, NavItem, NavStyleConfig, NestedStringConfig, NumberConfig, OptionConfig, OptionDTO, OptionItem, PaginationConfig, PaginationLabels, PhoneConfig, QueryParamsConfig, RadioConfig, RadioLabels, RadioOption, RangeConfig, RatingConfig, SearchConfig, SearchLabels, SectionConfig, SelectionConfig, SideNavItem, SideNavSection, SideNavStyleConfig, SnackbarConfig, SnackbarVariant, StepperConfig, SubmitConfig, SummaryCardConfig, SummaryCardLabels, SummaryCardMeta, TableAction, TableActionItem, TableColumn, TableConfig, TableDataChangeEvent, TableFilter, TableFilterChangeEvent, TableFilterColumn, TableFilterConfig, TableFilterItem, TableFilterLabels, TableFilterOutput, TableLabels, TableOption, TableTheme, TextConfig, ToggleConfig, ToggleLabels, UIConfig, UISubType, UIType, UploadedFile, ValidationResult, ValidationRules };
3969
+ export type { AlertLabels, AlertVariant, AttachmentConfig, ButtonLabels, ButtonVariant, CheckboxConfig, CheckboxLabels, CheckboxOption, ConfirmationModalConfig, DateConfig, DatePickerConfig, DatepickerLabels, DropdownAction, DropdownConfig, DropdownLabels, DropdownOption, EmailConfig, FieldConfig, FieldType, FilterChangeEvent, FilterConfig, FilterItem, FilterItemType, FilterOutput, FilterPanelConfig, FilterParamMap, FilterSearchConfig, FilterSidebarChangeEvent, FilterSidebarConfig, FilterSidebarOutput, FilterTableConfig, FilterTableSelectorConfig, FormConfig, FormField, FormOption, FormSchema, FormSection, GeneratedConfig, IconInput, InputConfig, InputLabels, InputType, JsonFieldConfig, JsonFormConfig, KeyType, LengthConstraint, LocationConfig, NavItem, NavStyleConfig, NestedStringConfig, NumberConfig, OptionConfig, OptionDTO, OptionItem, PaginationConfig, PaginationLabels, PhoneConfig, QueryParamsConfig, RadioConfig, RadioLabels, RadioOption, RangeConfig, RatingConfig, SearchConfig, SearchLabels, SectionConfig, SelectionConfig, SideNavItem, SideNavSection, SideNavStyleConfig, SnackbarConfig, SnackbarVariant, StepperConfig, SubmitConfig, SummaryCardConfig, SummaryCardLabels, SummaryCardMeta, TableAction, TableActionItem, TableColumn, TableColumnSubField, TableConfig, TableDataChangeEvent, TableFilter, TableFilterChangeEvent, TableFilterColumn, TableFilterConfig, TableFilterItem, TableFilterLabels, TableFilterOutput, TableLabels, TableOption, TableRowSaveEvent, TableTheme, TextConfig, ToggleConfig, ToggleLabels, UIConfig, UISubType, UIType, UploadedFile, ValidationResult, ValidationRules };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "commons-shared-web-ui",
3
- "version": "0.0.39",
3
+ "version": "0.0.40",
4
4
  "peerDependencies": {
5
5
  "@angular/animations": "20.3.15",
6
6
  "@angular/cdk": "20.2.14",
@@ -1,85 +1,85 @@
1
- @use 'sass:map';
2
-
3
- $default-alert-config: (
4
- font-family: ('Roboto', sans-serif),
5
-
6
- // Structure (Default values in rem, assuming 16px root)
7
- padding: 1rem 2rem,
8
- // 16px 32px
9
- radius: 0.75rem,
10
- // 12px
11
- gap: 1rem,
12
- // 16px
13
-
14
- // Icon
15
- icon-size: 1.25rem,
16
- // 20px
17
- icon-margin-top: 0.125rem,
18
- // 2px
19
-
20
- // Text
21
- title-size: 1rem,
22
- // 16px
23
- title-line-height: 1.5rem,
24
- // 24px
25
- message-size: 0.875rem,
26
- // 14px
27
-
28
- // Info
29
- info-bg: #F1F3F4,
30
- info-color: #3C4043,
31
-
32
- // Warning
33
- warning-bg: #F9C80E1F,
34
- warning-color: #3C4043,
35
- // Default text color for warning usually dark
36
- warning-title-color: #3C4043,
37
- // Making title dark for better contrast with light yellow bg
38
- warning-shadow: none,
39
- // Removing shadow as per clean flat design, or keeping if specified. User said "warning-shadow" variant exists.
40
-
41
- // Success
42
- success-bg: #E6F4EA,
43
- // Light green similar to Info/Error pattern
44
- success-color: #16A34A,
45
-
46
- // Error
47
- error-bg: #FCE8E6,
48
- // Light red
49
- error-color: #D93025
50
- );
51
-
52
- @mixin alert-theme($user-config: ()) {
53
- $config: map.merge($default-alert-config, $user-config);
54
-
55
- --cc-alert-font-family: #{map.get($config, font-family)};
56
-
57
- // Structure
58
- --cc-alert-padding: #{map.get($config, padding)};
59
- --cc-alert-radius: #{map.get($config, radius)};
60
- --cc-alert-gap: #{map.get($config, gap)};
61
-
62
- // Icon
63
- --cc-alert-icon-size: #{map.get($config, icon-size)};
64
- --cc-alert-icon-margin-top: #{map.get($config, icon-margin-top)};
65
-
66
- // Text
67
- --cc-alert-title-size: #{map.get($config, title-size)};
68
- --cc-alert-title-line-height: #{map.get($config, title-line-height)};
69
- --cc-alert-message-size: #{map.get($config, message-size)};
70
-
71
- // Colors
72
- --cc-alert-info-bg: #{map.get($config, info-bg)};
73
- --cc-alert-info-color: #{map.get($config, info-color)};
74
-
75
- --cc-alert-warning-bg: #{map.get($config, warning-bg)};
76
- --cc-alert-warning-color: #{map.get($config, warning-color)};
77
- --cc-alert-warning-title-color: #{map.get($config, warning-title-color)};
78
- --cc-alert-warning-shadow: #{map.get($config, warning-shadow)};
79
- --cc-alert-success-bg: #{map.get($config, success-bg)};
80
- --cc-alert-success-color: #{map.get($config, success-color)};
81
-
82
- --cc-alert-error-bg: #{map.get($config, error-bg)};
83
- --cc-alert-error-color: #{map.get($config, error-color)};
84
- --cc-alert-warning-shadow: 0 0.25rem 0.25rem rgba(0, 0, 0, 0.25); // 0px 4px 4px
1
+ @use 'sass:map';
2
+
3
+ $default-alert-config: (
4
+ font-family: ('Roboto', sans-serif),
5
+
6
+ // Structure (Default values in rem, assuming 16px root)
7
+ padding: 1rem 2rem,
8
+ // 16px 32px
9
+ radius: 0.75rem,
10
+ // 12px
11
+ gap: 1rem,
12
+ // 16px
13
+
14
+ // Icon
15
+ icon-size: 1.25rem,
16
+ // 20px
17
+ icon-margin-top: 0.125rem,
18
+ // 2px
19
+
20
+ // Text
21
+ title-size: 1rem,
22
+ // 16px
23
+ title-line-height: 1.5rem,
24
+ // 24px
25
+ message-size: 0.875rem,
26
+ // 14px
27
+
28
+ // Info
29
+ info-bg: #F1F3F4,
30
+ info-color: #3C4043,
31
+
32
+ // Warning
33
+ warning-bg: #F9C80E1F,
34
+ warning-color: #3C4043,
35
+ // Default text color for warning usually dark
36
+ warning-title-color: #3C4043,
37
+ // Making title dark for better contrast with light yellow bg
38
+ warning-shadow: none,
39
+ // Removing shadow as per clean flat design, or keeping if specified. User said "warning-shadow" variant exists.
40
+
41
+ // Success
42
+ success-bg: #E6F4EA,
43
+ // Light green similar to Info/Error pattern
44
+ success-color: #16A34A,
45
+
46
+ // Error
47
+ error-bg: #FCE8E6,
48
+ // Light red
49
+ error-color: #D93025
50
+ );
51
+
52
+ @mixin alert-theme($user-config: ()) {
53
+ $config: map.merge($default-alert-config, $user-config);
54
+
55
+ --cc-alert-font-family: #{map.get($config, font-family)};
56
+
57
+ // Structure
58
+ --cc-alert-padding: #{map.get($config, padding)};
59
+ --cc-alert-radius: #{map.get($config, radius)};
60
+ --cc-alert-gap: #{map.get($config, gap)};
61
+
62
+ // Icon
63
+ --cc-alert-icon-size: #{map.get($config, icon-size)};
64
+ --cc-alert-icon-margin-top: #{map.get($config, icon-margin-top)};
65
+
66
+ // Text
67
+ --cc-alert-title-size: #{map.get($config, title-size)};
68
+ --cc-alert-title-line-height: #{map.get($config, title-line-height)};
69
+ --cc-alert-message-size: #{map.get($config, message-size)};
70
+
71
+ // Colors
72
+ --cc-alert-info-bg: #{map.get($config, info-bg)};
73
+ --cc-alert-info-color: #{map.get($config, info-color)};
74
+
75
+ --cc-alert-warning-bg: #{map.get($config, warning-bg)};
76
+ --cc-alert-warning-color: #{map.get($config, warning-color)};
77
+ --cc-alert-warning-title-color: #{map.get($config, warning-title-color)};
78
+ --cc-alert-warning-shadow: #{map.get($config, warning-shadow)};
79
+ --cc-alert-success-bg: #{map.get($config, success-bg)};
80
+ --cc-alert-success-color: #{map.get($config, success-color)};
81
+
82
+ --cc-alert-error-bg: #{map.get($config, error-bg)};
83
+ --cc-alert-error-color: #{map.get($config, error-color)};
84
+ --cc-alert-warning-shadow: 0 0.25rem 0.25rem rgba(0, 0, 0, 0.25); // 0px 4px 4px
85
85
  }
@@ -1,121 +1,121 @@
1
- @use 'sass:map';
2
-
3
- // Default Button Configuration
4
- $default-button-config: (
5
- // Common
6
- font-family: ('Roboto', sans-serif),
7
- font-weight: 500,
8
- font-size: 1rem,
9
- // 16px
10
- padding: 0.5rem 1rem,
11
- // 8px 16px
12
-
13
- // Primary (Dark)
14
- primary-bg: #262125,
15
- primary-color: #FFFFFF,
16
- primary-radius: 0.5rem,
17
- // 8px
18
- primary-border: none,
19
-
20
- // Warning (Yellow)
21
- warning-bg: #F9C80E,
22
- warning-color: #000000,
23
- warning-radius: 0.25rem,
24
- // 4px
25
- warning-border: none,
26
-
27
- // Outline (Grey Outline)
28
- outline-bg: transparent,
29
- outline-color: #000000,
30
- outline-radius: 0.25rem,
31
- // 4px
32
- outline-border: 0.0625rem solid #BDC1C6,
33
- // 1px solid
34
-
35
- // Secondary (Light Grey)
36
- secondary-bg: #E8EAED,
37
- secondary-color: #000000,
38
- secondary-radius: 0.25rem,
39
- // 4px
40
- secondary-border: none,
41
-
42
- // Success (Green)
43
- success-bg: #16A34A,
44
- success-color: #FFFFFF,
45
- success-radius: 0.5rem,
46
- // 8px
47
- success-border: none,
48
-
49
- // Danger (Red)
50
- danger-bg: #E63E30,
51
- danger-color: #FFFFFF,
52
- danger-radius: 0.25rem,
53
- // 4px
54
- danger-border: none,
55
-
56
- // Danger Outline (Red Outline)
57
- danger-outline-bg: transparent,
58
- danger-outline-color: #E63E30,
59
- danger-outline-radius: 0.5rem,
60
- // 8px
61
- danger-outline-border: 0.0625rem solid #E63E30,
62
- // 1px solid
63
-
64
- // Disabled State
65
- disabled-opacity: 0.6,
66
- disabled-cursor: not-allowed
67
- );
68
-
69
- @mixin button-theme($user-config: ()) {
70
- $config: map.merge($default-button-config, $user-config);
71
-
72
- // Common
73
- --cc-btn-font-family: #{map.get($config, font-family)};
74
- --cc-btn-font-weight: #{map.get($config, font-weight)};
75
- --cc-btn-font-size: #{map.get($config, font-size)};
76
- --cc-btn-padding: #{map.get($config, padding)};
77
- --cc-btn-disabled-opacity: #{map.get($config, disabled-opacity)};
78
- --cc-btn-disabled-cursor: #{map.get($config, disabled-cursor)};
79
-
80
- // Primary
81
- --cc-btn-primary-bg: #{map.get($config, primary-bg)};
82
- --cc-btn-primary-color: #{map.get($config, primary-color)};
83
- --cc-btn-primary-radius: #{map.get($config, primary-radius)};
84
- --cc-btn-primary-border: #{map.get($config, primary-border)};
85
-
86
- // Warning
87
- --cc-btn-warning-bg: #{map.get($config, warning-bg)};
88
- --cc-btn-warning-color: #{map.get($config, warning-color)};
89
- --cc-btn-warning-radius: #{map.get($config, warning-radius)};
90
- --cc-btn-warning-border: #{map.get($config, warning-border)};
91
-
92
- // Outline
93
- --cc-btn-outline-bg: #{map.get($config, outline-bg)};
94
- --cc-btn-outline-color: #{map.get($config, outline-color)};
95
- --cc-btn-outline-radius: #{map.get($config, outline-radius)};
96
- --cc-btn-outline-border: #{map.get($config, outline-border)};
97
-
98
- // Secondary
99
- --cc-btn-secondary-bg: #{map.get($config, secondary-bg)};
100
- --cc-btn-secondary-color: #{map.get($config, secondary-color)};
101
- --cc-btn-secondary-radius: #{map.get($config, secondary-radius)};
102
- --cc-btn-secondary-border: #{map.get($config, secondary-border)};
103
-
104
- // Success
105
- --cc-btn-success-bg: #{map.get($config, success-bg)};
106
- --cc-btn-success-color: #{map.get($config, success-color)};
107
- --cc-btn-success-radius: #{map.get($config, success-radius)};
108
- --cc-btn-success-border: #{map.get($config, success-border)};
109
-
110
- // Danger
111
- --cc-btn-danger-bg: #{map.get($config, danger-bg)};
112
- --cc-btn-danger-color: #{map.get($config, danger-color)};
113
- --cc-btn-danger-radius: #{map.get($config, danger-radius)};
114
- --cc-btn-danger-border: #{map.get($config, danger-border)};
115
-
116
- // Danger Outline
117
- --cc-btn-danger-outline-bg: #{map.get($config, danger-outline-bg)};
118
- --cc-btn-danger-outline-color: #{map.get($config, danger-outline-color)};
119
- --cc-btn-danger-outline-radius: #{map.get($config, danger-outline-radius)};
120
- --cc-btn-danger-outline-border: #{map.get($config, danger-outline-border)};
1
+ @use 'sass:map';
2
+
3
+ // Default Button Configuration
4
+ $default-button-config: (
5
+ // Common
6
+ font-family: ('Roboto', sans-serif),
7
+ font-weight: 500,
8
+ font-size: 1rem,
9
+ // 16px
10
+ padding: 0.5rem 1rem,
11
+ // 8px 16px
12
+
13
+ // Primary (Dark)
14
+ primary-bg: #262125,
15
+ primary-color: #FFFFFF,
16
+ primary-radius: 0.5rem,
17
+ // 8px
18
+ primary-border: none,
19
+
20
+ // Warning (Yellow)
21
+ warning-bg: #F9C80E,
22
+ warning-color: #000000,
23
+ warning-radius: 0.25rem,
24
+ // 4px
25
+ warning-border: none,
26
+
27
+ // Outline (Grey Outline)
28
+ outline-bg: transparent,
29
+ outline-color: #000000,
30
+ outline-radius: 0.25rem,
31
+ // 4px
32
+ outline-border: 0.0625rem solid #BDC1C6,
33
+ // 1px solid
34
+
35
+ // Secondary (Light Grey)
36
+ secondary-bg: #E8EAED,
37
+ secondary-color: #000000,
38
+ secondary-radius: 0.25rem,
39
+ // 4px
40
+ secondary-border: none,
41
+
42
+ // Success (Green)
43
+ success-bg: #16A34A,
44
+ success-color: #FFFFFF,
45
+ success-radius: 0.5rem,
46
+ // 8px
47
+ success-border: none,
48
+
49
+ // Danger (Red)
50
+ danger-bg: #E63E30,
51
+ danger-color: #FFFFFF,
52
+ danger-radius: 0.25rem,
53
+ // 4px
54
+ danger-border: none,
55
+
56
+ // Danger Outline (Red Outline)
57
+ danger-outline-bg: transparent,
58
+ danger-outline-color: #E63E30,
59
+ danger-outline-radius: 0.5rem,
60
+ // 8px
61
+ danger-outline-border: 0.0625rem solid #E63E30,
62
+ // 1px solid
63
+
64
+ // Disabled State
65
+ disabled-opacity: 0.6,
66
+ disabled-cursor: not-allowed
67
+ );
68
+
69
+ @mixin button-theme($user-config: ()) {
70
+ $config: map.merge($default-button-config, $user-config);
71
+
72
+ // Common
73
+ --cc-btn-font-family: #{map.get($config, font-family)};
74
+ --cc-btn-font-weight: #{map.get($config, font-weight)};
75
+ --cc-btn-font-size: #{map.get($config, font-size)};
76
+ --cc-btn-padding: #{map.get($config, padding)};
77
+ --cc-btn-disabled-opacity: #{map.get($config, disabled-opacity)};
78
+ --cc-btn-disabled-cursor: #{map.get($config, disabled-cursor)};
79
+
80
+ // Primary
81
+ --cc-btn-primary-bg: #{map.get($config, primary-bg)};
82
+ --cc-btn-primary-color: #{map.get($config, primary-color)};
83
+ --cc-btn-primary-radius: #{map.get($config, primary-radius)};
84
+ --cc-btn-primary-border: #{map.get($config, primary-border)};
85
+
86
+ // Warning
87
+ --cc-btn-warning-bg: #{map.get($config, warning-bg)};
88
+ --cc-btn-warning-color: #{map.get($config, warning-color)};
89
+ --cc-btn-warning-radius: #{map.get($config, warning-radius)};
90
+ --cc-btn-warning-border: #{map.get($config, warning-border)};
91
+
92
+ // Outline
93
+ --cc-btn-outline-bg: #{map.get($config, outline-bg)};
94
+ --cc-btn-outline-color: #{map.get($config, outline-color)};
95
+ --cc-btn-outline-radius: #{map.get($config, outline-radius)};
96
+ --cc-btn-outline-border: #{map.get($config, outline-border)};
97
+
98
+ // Secondary
99
+ --cc-btn-secondary-bg: #{map.get($config, secondary-bg)};
100
+ --cc-btn-secondary-color: #{map.get($config, secondary-color)};
101
+ --cc-btn-secondary-radius: #{map.get($config, secondary-radius)};
102
+ --cc-btn-secondary-border: #{map.get($config, secondary-border)};
103
+
104
+ // Success
105
+ --cc-btn-success-bg: #{map.get($config, success-bg)};
106
+ --cc-btn-success-color: #{map.get($config, success-color)};
107
+ --cc-btn-success-radius: #{map.get($config, success-radius)};
108
+ --cc-btn-success-border: #{map.get($config, success-border)};
109
+
110
+ // Danger
111
+ --cc-btn-danger-bg: #{map.get($config, danger-bg)};
112
+ --cc-btn-danger-color: #{map.get($config, danger-color)};
113
+ --cc-btn-danger-radius: #{map.get($config, danger-radius)};
114
+ --cc-btn-danger-border: #{map.get($config, danger-border)};
115
+
116
+ // Danger Outline
117
+ --cc-btn-danger-outline-bg: #{map.get($config, danger-outline-bg)};
118
+ --cc-btn-danger-outline-color: #{map.get($config, danger-outline-color)};
119
+ --cc-btn-danger-outline-radius: #{map.get($config, danger-outline-radius)};
120
+ --cc-btn-danger-outline-border: #{map.get($config, danger-outline-border)};
121
121
  }