@hug/hospitality 0.0.4-alpha.1 → 0.0.4-alpha.13

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hug/hospitality",
3
- "version": "0.0.4-alpha.1",
3
+ "version": "0.0.4-alpha.13",
4
4
  "description": "Hospitality Design System",
5
5
  "homepage": "https://github.com/dsi-hug/hospitality",
6
6
  "license": "GPL-3.0-only",
@@ -22,7 +22,16 @@
22
22
  "types": "./src/tokens/index.d.ts",
23
23
  "default": "./src/tokens/tokens.css"
24
24
  },
25
- "./package.json": "./package.json"
25
+ "./material/theme": "./src/material/theme/theme.scss",
26
+ "./package.json": "./package.json",
27
+ "./core/directives/components-styling": "./src/core/directives/components-styling.directive.ts",
28
+ "./components/form-field": "./src/components/form-field/form-field.scss",
29
+ "./components/form-field/provider": {
30
+ "types": "./src/components/form-field/form-field.provider.d.ts",
31
+ "default": "./src/components/form-field/form-field.provider.mjs"
32
+ },
33
+ "./components/dialog": "./src/components/dialog/dialog.scss",
34
+ "./components/button": "./src/components/button/button.scss"
26
35
  },
27
36
  "files": [
28
37
  "README.md",
@@ -44,7 +53,10 @@
44
53
  "@commitlint/config-conventional": "^19.8.0",
45
54
  "@hug/eslint-config": "^20.3.3",
46
55
  "husky": "^9.1.7",
47
- "lint-staged": "^15.5.0"
56
+ "lint-staged": "^16.2.7"
57
+ },
58
+ "peerDependencies": {
59
+ "@angular/material": "19.x.x"
48
60
  },
49
61
  "commitlint": {
50
62
  "extends": [
@@ -0,0 +1,237 @@
1
+ @use "@angular/material" as mat;
2
+
3
+ button {
4
+ gap: 0.5rem;
5
+
6
+ @include mat.button-overrides(
7
+ (
8
+ filled-horizontal-padding: 1rem,
9
+ outlined-horizontal-padding: 1rem,
10
+ protected-horizontal-padding: 1rem,
11
+ text-horizontal-padding: 1rem,
12
+ text-with-icon-horizontal-padding: 1rem,
13
+ outlined-label-text-color: var(--mat-sys-on-surface-variant),
14
+ outlined-outline-color: var(--mat-sys-outline-variant),
15
+ outlined-disabled-outline-color: var(--mat-sys-outline-variant),
16
+ outlined-state-layer-color:
17
+ color-mix(in srgb, var(--mat-sys-on-surface) 38%, transparent),
18
+ outlined-ripple-color:
19
+ color-mix(in srgb, var(--mat-sys-on-surface) 10%, transparent),
20
+ )
21
+ );
22
+
23
+ &[mat-button],
24
+ &[mat-stroked-button],
25
+ &[mat-flat-button] {
26
+ > mat-icon.mat-icon {
27
+ margin: 0;
28
+ font-size: 1.25rem;
29
+ height: 1.25rem;
30
+ width: 1.25rem;
31
+ }
32
+
33
+ &:disabled {
34
+ background-color: color-mix(
35
+ in srgb,
36
+ var(--mat-sys-on-surface) 12%,
37
+ transparent
38
+ );
39
+ }
40
+ }
41
+
42
+ &[hy-size="small"] {
43
+ gap: 0.5rem;
44
+
45
+ @include mat.button-density(-1);
46
+ @include mat.button-overrides(
47
+ (
48
+ filled-horizontal-padding: 0.75rem,
49
+ outlined-horizontal-padding: 0.75rem,
50
+ protected-horizontal-padding: 0.75rem,
51
+ text-horizontal-padding: 0.75rem,
52
+ text-with-icon-horizontal-padding: 0.75rem,
53
+ )
54
+ );
55
+ @include mat.icon-button-overrides(
56
+ (
57
+ state-layer-size: 2rem,
58
+ )
59
+ );
60
+
61
+ &[mat-icon-button] {
62
+ > mat-icon.mat-icon {
63
+ margin: 0;
64
+ font-size: 1.25rem;
65
+ height: 1.25rem;
66
+ width: 1.25rem;
67
+ }
68
+ }
69
+ }
70
+
71
+ &[hy-size="x-large"] {
72
+ @include mat.button-overrides(
73
+ (
74
+ filled-container-height: 3.5rem,
75
+ outlined-container-height: 3.5rem,
76
+ protected-container-height: 3.5rem,
77
+ text-container-height: 3.5rem,
78
+
79
+ filled-horizontal-padding: 1.5rem,
80
+ outlined-horizontal-padding: 1.5rem,
81
+ protected-horizontal-padding: 1.5rem,
82
+ text-horizontal-padding: 1.5rem,
83
+ text-with-icon-horizontal-padding: 1.5rem,
84
+
85
+ filled-label-text-font: var(--mat-sys-title-medium-font),
86
+ outlined-label-text-font: var(--mat-sys-title-medium-font),
87
+ protected-label-text-font: var(--mat-sys-title-medium-font),
88
+ text-label-text-font: var(--mat-sys-title-medium-font),
89
+ filled-label-text-size: var(--mat-sys-title-medium-size),
90
+ outlined-label-text-size: var(--mat-sys-title-medium-size),
91
+ protected-label-text-size: var(--mat-sys-title-medium-size),
92
+ text-label-text-size: var(--mat-sys-title-medium-size),
93
+ filled-label-text-tracking: var(--mat-sys-title-medium-tracking),
94
+ outlined-label-text-tracking:
95
+ var(--mat-sys-title-medium-tracking),
96
+ protected-label-text-tracking:
97
+ var(--mat-sys-title-medium-tracking),
98
+ text-label-text-tracking: var(--mat-sys-title-medium-tracking),
99
+ filled-label-text-weight: var(--mat-sys-title-medium-weight),
100
+ outlined-label-text-weight: var(--mat-sys-title-medium-weight),
101
+ protected-label-text-weight: var(--mat-sys-title-medium-weight),
102
+ text-label-text-weight: var(--mat-sys-title-medium-weight),
103
+ )
104
+ );
105
+
106
+ @include mat.icon-button-overrides(
107
+ (
108
+ state-layer-size: 3.5rem,
109
+ )
110
+ );
111
+
112
+ &[mat-button],
113
+ &[mat-stroked-button],
114
+ &[mat-flat-button] {
115
+ > mat-icon.mat-icon {
116
+ font-size: 1.5rem;
117
+ height: 1.5rem;
118
+ width: 1.5rem;
119
+ }
120
+ }
121
+ }
122
+
123
+ &[hy-appearance="tonal"],
124
+ &[hy-appearance="filled"],
125
+ &[hy-appearance="warning-filled"] {
126
+ &:disabled {
127
+ background-color: color-mix(
128
+ in srgb,
129
+ var(--mat-sys-on-surface) 10%,
130
+ transparent
131
+ );
132
+ }
133
+ }
134
+
135
+ &[hy-appearance="tonal"] {
136
+ @include mat.button-overrides(
137
+ (
138
+ filled-container-color: var(--mat-sys-secondary-container),
139
+ filled-label-text-color: var(--mat-sys-on-secondary-container),
140
+ filled-state-layer-color: var(--mat-sys-on-secondary-container),
141
+ filled-ripple-color:
142
+ color-mix(
143
+ in srgb,
144
+ var(--mat-sys-on-secondary-container) 10%,
145
+ transparent
146
+ ),
147
+ )
148
+ );
149
+
150
+ @include mat.icon-button-overrides(
151
+ (
152
+ icon-color: var(--mat-sys-on-secondary-container),
153
+ state-layer-color: var(--mat-sys-on-secondary-container),
154
+ ripple-color:
155
+ color-mix(
156
+ in srgb,
157
+ var(--mat-sys-on-secondary-container) 10%,
158
+ transparent
159
+ ),
160
+ )
161
+ );
162
+
163
+ &[mat-icon-button]:enabled {
164
+ background-color: var(--mat-sys-secondary-container);
165
+ }
166
+ }
167
+
168
+ &[hy-appearance="filled"] {
169
+ background-color: var(--mat-sys-primary);
170
+
171
+ @include mat.icon-button-overrides(
172
+ (
173
+ icon-color: var(--mat-sys-on-primary),
174
+ state-layer-color: var(--mat-sys-on-primary),
175
+ ripple-color:
176
+ color-mix(
177
+ in srgb,
178
+ var(--mat-sys-on-primary) 10%,
179
+ transparent
180
+ ),
181
+ )
182
+ );
183
+ }
184
+
185
+ &[hy-appearance="warning-filled"] {
186
+ @include mat.button-overrides(
187
+ (
188
+ filled-container-color: var(--mat-sys-warning),
189
+ filled-label-text-color: var(--mat-sys-on-warning),
190
+ filled-state-layer-color: var(--mat-sys-on-warning),
191
+ filled-ripple-color:
192
+ color-mix(
193
+ in srgb,
194
+ var(--mat-sys-on-warning) 10%,
195
+ transparent
196
+ ),
197
+ )
198
+ );
199
+
200
+ @include mat.icon-button-overrides(
201
+ (
202
+ icon-color: var(--mat-sys-on-warning),
203
+ state-layer-color: var(--mat-sys-on-warning),
204
+ ripple-color:
205
+ color-mix(
206
+ in srgb,
207
+ var(--mat-sys-on-warning) 10%,
208
+ transparent
209
+ ),
210
+ )
211
+ );
212
+
213
+ &[mat-icon-button]:enabled {
214
+ background-color: var(--mat-sys-warning);
215
+ }
216
+ }
217
+
218
+ &[hy-appearance="warning-text"] {
219
+ @include mat.button-overrides(
220
+ (
221
+ text-label-text-color: var(--mat-sys-warning),
222
+ text-state-layer-color: var(--mat-sys-warning),
223
+ text-ripple-color:
224
+ color-mix(in srgb, var(--mat-sys-warning) 10%, transparent),
225
+ )
226
+ );
227
+
228
+ @include mat.icon-button-overrides(
229
+ (
230
+ icon-color: var(--mat-sys-warning),
231
+ state-layer-color: var(--mat-sys-warning),
232
+ ripple-color:
233
+ color-mix(in srgb, var(--mat-sys-warning) 10%, transparent),
234
+ )
235
+ );
236
+ }
237
+ }
@@ -0,0 +1,29 @@
1
+ @use "@angular/material" as mat;
2
+
3
+ mat-dialog-container {
4
+ @include mat.dialog-overrides(
5
+ (
6
+ actions-padding: 1.5rem,
7
+ headline-padding: 0.25rem 1.5rem 1rem,
8
+ )
9
+ );
10
+ }
11
+
12
+ .warning-dialog {
13
+ mat-dialog-container {
14
+ @include mat.dialog-overrides(
15
+ (
16
+ subhead-color: var(--mat-sys-warning),
17
+ headline-padding: 1.5rem 1.5rem 1rem,
18
+ )
19
+ );
20
+ }
21
+
22
+ [mat-dialog-title]:before {
23
+ content: "warning";
24
+ font-family: "Material Symbols Outlined Variable";
25
+ display: inline;
26
+ padding-right: 10px;
27
+ vertical-align: bottom;
28
+ }
29
+ }
@@ -0,0 +1,3 @@
1
+ import { Provider } from '@angular/core';
2
+
3
+ export declare function provideHyFormField(): Provider;
@@ -0,0 +1,6 @@
1
+ import { MAT_FORM_FIELD_DEFAULT_OPTIONS } from '@angular/material/form-field';
2
+
3
+ export const provideHyFormField = () => ({
4
+ provide: MAT_FORM_FIELD_DEFAULT_OPTIONS,
5
+ useValue: { appearance: 'outline' }
6
+ });
@@ -0,0 +1,97 @@
1
+ @use "@angular/material" as mat;
2
+
3
+ mat-form-field {
4
+ @include mat.form-field-density(-2);
5
+ @include mat.form-field-overrides(
6
+ (
7
+ outlined-focus-label-text-color: var(--mat-sys-primary),
8
+ outlined-focus-outline-color: var(--mat-sys-primary),
9
+ outlined-focus-outline-width: 3px,
10
+ outlined-error-label-text-color: var(--mat-sys-error),
11
+ outlined-error-focus-label-text-color: var(--mat-sys-error),
12
+ outlined-error-outline-color: var(--mat-sys-error),
13
+ outlined-error-caret-color: var(--mat-sys-error),
14
+ outlined-input-text-placeholder-color:
15
+ var(--mat-sys-on-surface-variant),
16
+ )
17
+ );
18
+
19
+ .mat-mdc-floating-label {
20
+ top: 50%;
21
+ }
22
+
23
+ &:has(textarea) {
24
+ &[hy-size="small"] {
25
+ .mat-mdc-form-field-icon-suffix {
26
+ padding: 0.5rem 0;
27
+
28
+ mat-icon {
29
+ padding-top: 0.125rem;
30
+ }
31
+ }
32
+ }
33
+
34
+ &[hy-size="large"] {
35
+ .mat-mdc-form-field-icon-suffix {
36
+ padding: 1rem 0;
37
+ }
38
+ }
39
+
40
+ .mat-mdc-form-field-icon-suffix {
41
+ height: -webkit-fill-available;
42
+ display: flex;
43
+ align-items: flex-start;
44
+ justify-content: center;
45
+ padding-bottom: 0.75rem;
46
+ padding-top: 0.75rem;
47
+ margin-left: 0.25rem;
48
+ }
49
+ }
50
+
51
+ &[hy-size="small"] {
52
+ @include mat.form-field-density(-4);
53
+
54
+ .mat-mdc-form-field-icon-suffix,
55
+ .mat-mdc-form-field-icon-prefix {
56
+ button {
57
+ margin: 0 0.5rem;
58
+ }
59
+
60
+ mat-icon {
61
+ font-size: 1.25rem;
62
+ width: 1.25rem;
63
+ height: 1.25rem;
64
+ }
65
+ }
66
+ }
67
+
68
+ &[hy-size="large"] {
69
+ @include mat.form-field-density(0);
70
+ }
71
+
72
+ &.mat-form-field-disabled {
73
+ mat-hint {
74
+ color: color-mix(
75
+ in srgb,
76
+ var(--mat-sys-on-surface-variant) 38%,
77
+ transparent
78
+ );
79
+ }
80
+ }
81
+
82
+ > .mat-mdc-text-field-wrapper {
83
+ background-color: var(--mat-sys-surface-container-lowest);
84
+ }
85
+
86
+ .mat-mdc-form-field-icon-suffix,
87
+ .mat-mdc-form-field-icon-prefix {
88
+ width: 3rem;
89
+ button {
90
+ margin: 0 0.25rem;
91
+ }
92
+ }
93
+
94
+ mat-hint {
95
+ color: var(--mat-sys-on-surface-variant);
96
+ }
97
+ }
@@ -0,0 +1,20 @@
1
+ /* eslint-disable @typescript-eslint/naming-convention */
2
+ import { Directive, input } from '@angular/core';
3
+
4
+ export type HySizeType = 'x-small' | 'small' | 'medium' | 'large' | 'x-large';
5
+
6
+ @Directive({
7
+ selector: `
8
+ [hy-size],
9
+ [hy-appearance]
10
+ `,
11
+ standalone: true,
12
+ host: {
13
+ '[attr.hy-size]': 'hySize()',
14
+ '[attr.hy-appearance]': 'hyAppearance()'
15
+ }
16
+ })
17
+ export class ComponentsStylingDirective {
18
+ public hySize = input<HySizeType | null>(null, { alias: 'hy-size' });
19
+ public hyAppearance = input<string | null>(null, { alias: 'hy-appearance' });
20
+ }
@@ -0,0 +1,69 @@
1
+ @use "@angular/material" as mat;
2
+ @use "../../utils/map" as map;
3
+
4
+ $override-colors: (
5
+ primary: var(--hy-color-primary),
6
+ on-primary: var(--hy-color-on-primary),
7
+ primary-container: var(--hy-color-primary-container),
8
+ on-primary-container: var(--hy-color-on-primary-container),
9
+ primary-fixed: var(--hy-color-primary-fixed),
10
+ primary-fixed-dim: var(--hy-color-primary-fixed-dim),
11
+ on-primary-fixed: var(--hy-color-primary-fixed),
12
+ on-primary-fixed-variant: var(--hy-color-primary-fixed-variant),
13
+ secondary: var(--hy-color-secondary),
14
+ on-secondary: var(--hy-color-on-secondary),
15
+ secondary-container: var(--hy-color-secondary-container),
16
+ on-secondary-conmtainer: var(--hy-color-on-secondary-container),
17
+ secondary-fixed: var(--hy-color-secondary-fixed),
18
+ secondary-fixed-dim: var(--hy-color-secondary-fixed-dim),
19
+ on-secondary-fixed: var(--hy-color-secondary-fixed),
20
+ on-secondary-fixed-variant: var(--hy-color-secondary-fixed-variant),
21
+ tertiary: var(--hy-color-tertiary),
22
+ on-tertiary: var(--hy-color-on-tertiary),
23
+ tertiary-container: var(--hy-color-tertiary-container),
24
+ on-tertiary-conmtainer: var(--hy-color-on-tertiary-container),
25
+ tertiary-fixed: var(--hy-color-tertiary-fixed),
26
+ tertiary-fixed-dim: var(--hy-color-tertiary-fixed-dim),
27
+ on-tertiary-fixed: var(--hy-color-tertiary-fixed),
28
+ on-tertiary-fixed-variant: var(--hy-color-tertiary-fixed-variant),
29
+ error: var(--hy-color-error),
30
+ on-error: var(--hy-color-on-error),
31
+ error-container: var(--hy-color-error-container),
32
+ on-error-conmtainer: var(--hy-color-on-error-container),
33
+ surface: var(--hy-color-surface),
34
+ surface-dim: var(--hy-color-surface-dim),
35
+ surface-bright: var(--hy-color-surface-bright),
36
+ surface-container-lowest: var(--hy-color-surface-container-lowest),
37
+ surface-container-low: var(--hy-color-surface-container-low),
38
+ surface-container: var(--hy-color-surface-container),
39
+ surface-container-high: var(--hy-color-surface-container-high),
40
+ surface-container-highest: var(--hy-color-surface-container-highest),
41
+ on-surface: var(--hy-color-on-surface),
42
+ on-surface-variant: var(--hy-color-on-surface-variant),
43
+ ouline: var(--hy-color-outline),
44
+ ouline-variant: var(--hy-color-outline-variant),
45
+ inverse-surface: var(--hy-color-inverse-surface),
46
+ inverse-on-surface: var(--hy-color-inverse-on-surface),
47
+ inverse-primary: var(--hy-color-inverse-primary),
48
+ background: var(--hy-color-background),
49
+ on-background: var(--hy-color-on-background),
50
+ scrim: var(--hy-color-scrim),
51
+ shadow: var(--hy-color-shadow),
52
+ );
53
+
54
+ $override-typography: ();
55
+
56
+ $override-density: ();
57
+
58
+ $overrides: map.merge-all($override-colors, $override-typography);
59
+
60
+ @mixin theme {
61
+ @include mat.theme(
62
+ (
63
+ color: (),
64
+ typography: Roboto,
65
+ density: 0,
66
+ ),
67
+ $overrides
68
+ );
69
+ }