@3dsource/source-ui-native 0.0.1

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 (81) hide show
  1. package/README.md +64 -0
  2. package/eslint.config.js +37 -0
  3. package/ng-package.json +7 -0
  4. package/package.json +9 -0
  5. package/src/lib/components/source-badge/components/source-badge.component.html +20 -0
  6. package/src/lib/components/source-badge/components/source-badge.component.scss +76 -0
  7. package/src/lib/components/source-badge/components/source-badge.component.ts +62 -0
  8. package/src/lib/components/source-badge/constants/index.ts +2 -0
  9. package/src/lib/components/source-badge/constants/sourceBadgeSize.ts +8 -0
  10. package/src/lib/components/source-badge/constants/sourceBadgeType.ts +11 -0
  11. package/src/lib/components/source-badge/index.ts +2 -0
  12. package/src/lib/components/source-banner/components/source-banner.component.html +10 -0
  13. package/src/lib/components/source-banner/components/source-banner.component.scss +75 -0
  14. package/src/lib/components/source-banner/components/source-banner.component.ts +25 -0
  15. package/src/lib/components/source-banner/constants/sourceBannerType.ts +10 -0
  16. package/src/lib/components/source-banner/index.ts +2 -0
  17. package/src/lib/components/source-button/components/source-button.component.html +44 -0
  18. package/src/lib/components/source-button/components/source-button.component.scss +355 -0
  19. package/src/lib/components/source-button/components/source-button.component.ts +220 -0
  20. package/src/lib/components/source-button/constants/index.ts +4 -0
  21. package/src/lib/components/source-button/constants/sourceButtonAppearance.ts +7 -0
  22. package/src/lib/components/source-button/constants/sourceButtonColorScheme.ts +8 -0
  23. package/src/lib/components/source-button/constants/sourceButtonSize.ts +8 -0
  24. package/src/lib/components/source-button/constants/sourceButtonType.ts +8 -0
  25. package/src/lib/components/source-button/index.ts +3 -0
  26. package/src/lib/components/source-button/interfaces/defaultSourceButton.config.ts +24 -0
  27. package/src/lib/components/source-button/interfaces/index.ts +2 -0
  28. package/src/lib/components/source-button/interfaces/sourceButton.interface.ts +26 -0
  29. package/src/lib/components/source-copyright/components/source-copyright.component.html +20 -0
  30. package/src/lib/components/source-copyright/components/source-copyright.component.scss +81 -0
  31. package/src/lib/components/source-copyright/components/source-copyright.component.ts +18 -0
  32. package/src/lib/components/source-copyright/index.ts +1 -0
  33. package/src/lib/components/source-divider/components/source-divider.component.html +5 -0
  34. package/src/lib/components/source-divider/components/source-divider.component.scss +15 -0
  35. package/src/lib/components/source-divider/components/source-divider.component.ts +18 -0
  36. package/src/lib/components/source-divider/index.ts +1 -0
  37. package/src/lib/components/source-hint/components/source-hint.component.html +8 -0
  38. package/src/lib/components/source-hint/components/source-hint.component.scss +31 -0
  39. package/src/lib/components/source-hint/components/source-hint.component.ts +18 -0
  40. package/src/lib/components/source-hint/index.ts +1 -0
  41. package/src/lib/components/source-icon-button/components/source-icon-button.component.html +18 -0
  42. package/src/lib/components/source-icon-button/components/source-icon-button.component.scss +89 -0
  43. package/src/lib/components/source-icon-button/components/source-icon-button.component.ts +87 -0
  44. package/src/lib/components/source-icon-button/constants/index.ts +3 -0
  45. package/src/lib/components/source-icon-button/constants/sourceIconButtonShape.ts +7 -0
  46. package/src/lib/components/source-icon-button/constants/sourceIconButtonSize.ts +10 -0
  47. package/src/lib/components/source-icon-button/constants/sourceIconButtonType.ts +8 -0
  48. package/src/lib/components/source-icon-button/index.ts +2 -0
  49. package/src/lib/components/source-loading/components/source-loading.component.html +40 -0
  50. package/src/lib/components/source-loading/components/source-loading.component.scss +62 -0
  51. package/src/lib/components/source-loading/components/source-loading.component.ts +79 -0
  52. package/src/lib/components/source-loading/constants/sourceLoadingLineCap.ts +7 -0
  53. package/src/lib/components/source-loading/index.ts +1 -0
  54. package/src/lib/components/source-logo-loading/components/source-logo-loading.component.html +23 -0
  55. package/src/lib/components/source-logo-loading/components/source-logo-loading.component.scss +33 -0
  56. package/src/lib/components/source-logo-loading/components/source-logo-loading.component.ts +21 -0
  57. package/src/lib/components/source-logo-loading/index.ts +1 -0
  58. package/src/lib/components/source-slider/components/source-slider.component.html +38 -0
  59. package/src/lib/components/source-slider/components/source-slider.component.scss +132 -0
  60. package/src/lib/components/source-slider/components/source-slider.component.ts +122 -0
  61. package/src/lib/components/source-slider/index.ts +1 -0
  62. package/src/lib/styles/base.scss +68 -0
  63. package/src/lib/styles/elements/_src-button.scss +235 -0
  64. package/src/lib/styles/elements/_src-input.scss +83 -0
  65. package/src/lib/styles/elements/_src-list.scss +82 -0
  66. package/src/lib/styles/elements/_src-select.scss +71 -0
  67. package/src/lib/styles/elements/elements.scss +4 -0
  68. package/src/lib/styles/fonts/Inter-VariableFont_slnt,wght.woff2 +0 -0
  69. package/src/lib/styles/fonts.scss +18 -0
  70. package/src/lib/styles/source.ui.scss +23 -0
  71. package/src/lib/styles/typography.scss +90 -0
  72. package/src/lib/styles/utils.scss +40 -0
  73. package/src/lib/styles/variables/_borders.scss +14 -0
  74. package/src/lib/styles/variables/_colors-aliases.scss +39 -0
  75. package/src/lib/styles/variables/_colors.scss +64 -0
  76. package/src/lib/styles/variables/_shadows.scss +9 -0
  77. package/src/lib/styles/variables/_typography.scss +32 -0
  78. package/src/lib/styles/variables/index.scss +5 -0
  79. package/src/public-api.ts +10 -0
  80. package/tsconfig.lib.json +13 -0
  81. package/tsconfig.lib.prod.json +11 -0
@@ -0,0 +1,355 @@
1
+ // source-button.component.scss
2
+ button.src-button {
3
+ --srcButtonBgColor: var(--src-color-bg-default);
4
+ --srcButtonBgHoverColor: var(--src-color-bg-default-hover);
5
+ --srcButtonBorderRadius: var(--src-br-small, 4px);
6
+ --srcButtonBoxShadow:
7
+ 0px 0px 0px 1px var(--src-color-border-strong, #abb2be) inset,
8
+ 0px 1px 0px 0px rgba(0, 0, 0, 0.05);
9
+ --srcButtonFontColor: var(--src-color-text-default);
10
+ --srcButtonFontSize: var(--src-fs-base);
11
+ --srcButtonFontWeight: var(--src-fw-medium, 500);
12
+ --srcButtonLineHeight: var(--src-lh-base);
13
+ --srcButtonPaddings: 8px 16px;
14
+ --srcButtonTextTransform: default;
15
+ --srcButtonWidth: auto;
16
+ display: flex;
17
+ justify-content: center;
18
+ align-items: center;
19
+ width: var(--srcButtonWidth);
20
+ padding: var(--srcButtonPaddings);
21
+ font-weight: var(--srcButtonFontWeight);
22
+ font-size: var(--srcButtonFontSize);
23
+ font-style: normal;
24
+ line-height: var(--srcButtonLineHeight);
25
+ text-align: center;
26
+ color: var(--srcButtonFontColor);
27
+ text-transform: var(--srcButtonTextTransform);
28
+ letter-spacing: 0;
29
+ white-space: nowrap;
30
+ background-color: var(--srcButtonBgColor);
31
+ border: none;
32
+ border-radius: var(--srcButtonBorderRadius);
33
+ box-shadow: var(--srcButtonBoxShadow);
34
+ cursor: pointer;
35
+
36
+ & > div,
37
+ & > span {
38
+ display: flex;
39
+ justify-content: center;
40
+ align-items: center;
41
+ width: auto;
42
+ }
43
+
44
+ &:active,
45
+ &--pressed {
46
+ background-color: var(--srcButtonBgHoverColor);
47
+ }
48
+
49
+ @media (pointer: fine) {
50
+ &:hover,
51
+ &:focus-visible {
52
+ background-color: var(--srcButtonBgHoverColor);
53
+ }
54
+ }
55
+
56
+ &:disabled,
57
+ &[disabled],
58
+ &.disabled {
59
+ cursor: default;
60
+ pointer-events: none;
61
+ }
62
+
63
+ // size
64
+ &--slim {
65
+ --srcButtonPaddings: 6px 12px;
66
+
67
+ &.src-button--icon-prefix {
68
+ --srcButtonPaddings: 6px 12px 6px 8px;
69
+ }
70
+ }
71
+
72
+ &--medium {
73
+ --srcButtonPaddings: 8px 16px;
74
+
75
+ &.src-button--icon-prefix {
76
+ --srcButtonPaddings: 8px 16px 8px 12px;
77
+ }
78
+ }
79
+
80
+ &--large {
81
+ --srcButtonPaddings: 12px 24px;
82
+
83
+ &.src-button--icon-prefix {
84
+ --srcButtonPaddings: 12px 24px 12px 20px;
85
+ }
86
+ }
87
+
88
+ &--primary {
89
+ --srcButtonBgColor: var(--src-color-bg-primary);
90
+ --srcButtonBgHoverColor: var(--src-color-bg-primary-hover);
91
+ --srcButtonBoxShadow:
92
+ 0px 1px 0px 0px rgba(0, 0, 0, 0.08),
93
+ 0px -1px 0px 0px rgba(0, 0, 0, 0.2) inset;
94
+ --srcButtonFontColor: var(--src-color-text-inverse);
95
+
96
+ &:disabled,
97
+ &[disabled] {
98
+ --srcButtonBgColor: var(--src-color-bg-primary-disabled);
99
+ --srcButtonBoxShadow: none;
100
+ --srcButtonFontColor: var(--src-color-text-default-disabled);
101
+ }
102
+ }
103
+
104
+ &--secondary {
105
+ --srcButtonFontColor: var(--src-color-text-default);
106
+
107
+ &:disabled,
108
+ &[disabled] {
109
+ --srcButtonBgColor: var(--src-color-bg-default-disabled);
110
+ --srcButtonBoxShadow: none;
111
+ --srcButtonFontColor: var(--src-color-text-default-disabled);
112
+ }
113
+ }
114
+
115
+ &--destructive {
116
+ --srcButtonBgColor: var(--src-color-bg-critical);
117
+ --srcButtonBgHoverColor: var(--src-color-bg-critical-strong);
118
+ --srcButtonBoxShadow:
119
+ 0px 1px 0px 0px rgba(0, 0, 0, 0.08),
120
+ 0px -1px 0px 0px rgba(0, 0, 0, 0.2) inset;
121
+ --srcButtonFontColor: var(--src-color-text-inverse);
122
+
123
+ &:disabled,
124
+ &[disabled] {
125
+ --srcButtonBgColor: var(--src-color-bg-primary-disabled);
126
+ --srcButtonBoxShadow: none;
127
+ --srcButtonFontColor: var(--src-color-text-default-disabled);
128
+ }
129
+ }
130
+
131
+ &--plain {
132
+ padding: 0;
133
+ --srcButtonBgColor: transparent;
134
+ --srcButtonBgHoverColor: transparent;
135
+ --srcButtonBoxShadow: none;
136
+
137
+ &:active,
138
+ &.src-button--pressed {
139
+ text-decoration: underline;
140
+ }
141
+
142
+ @media (pointer: fine) {
143
+ &:hover,
144
+ &:focus {
145
+ text-decoration: underline;
146
+ }
147
+ }
148
+ &:disabled,
149
+ &[disabled] {
150
+ --srcButtonFontColor: var(--src-color-text-default-disabled);
151
+ }
152
+
153
+ //colorScheme
154
+ &.src-button--primary {
155
+ --srcButtonFontColor: var(--src-color-text-primary);
156
+
157
+ &:active,
158
+ &--pressed {
159
+ --srcButtonFontColor: var(--src-color-text-primary);
160
+ }
161
+
162
+ @media (pointer: fine) {
163
+ &:hover,
164
+ &:focus {
165
+ --srcButtonFontColor: var(--src-color-text-primary);
166
+ }
167
+ }
168
+ }
169
+
170
+ &.src-button--destructive {
171
+ --srcButtonFontColor: var(--src-color-text-critical);
172
+
173
+ &:active,
174
+ &--pressed {
175
+ --srcButtonFontColor: var(--src-color-text-critical);
176
+ }
177
+
178
+ @media (pointer: fine) {
179
+ &:hover,
180
+ &:focus {
181
+ --srcButtonFontColor: var(--src-color-text-critical);
182
+ }
183
+ }
184
+ }
185
+
186
+ &.src-button--secondary {
187
+ --srcButtonFontColor: var(--src-color-text-default);
188
+ }
189
+
190
+ &.src-button--primary,
191
+ &.src-button--destructive,
192
+ &.src-button--secondary {
193
+ &:disabled,
194
+ &[disabled] {
195
+ --srcButtonBgColor: transparent;
196
+ --srcButtonFontColor: var(--src-color-text-default-disabled);
197
+ }
198
+ }
199
+ }
200
+
201
+ // full-width
202
+ &--full-width {
203
+ --srcButtonWidth: 100%;
204
+ }
205
+
206
+ &--disclosure {
207
+ position: relative;
208
+ --srcButtonDisclosureIconColor: var(--src-color-icon-default);
209
+
210
+ span {
211
+ display: flex;
212
+ align-items: center;
213
+ }
214
+
215
+ &:disabled,
216
+ &[disabled] {
217
+ --srcButtonDisclosureIconColor: var(--src-color-icon-default-disabled);
218
+ }
219
+
220
+ .disclosure-icon {
221
+ display: flex;
222
+ justify-content: center;
223
+ align-items: center;
224
+ flex-shrink: 0;
225
+ width: 20px;
226
+ height: 20px;
227
+ padding: 6px;
228
+ color: var(--srcButtonDisclosureIconColor);
229
+ }
230
+
231
+ &.src-button--plain {
232
+ &.src-button--primary {
233
+ --srcButtonDisclosureIconColor: var(--src-color-icon-primary);
234
+ }
235
+
236
+ &.src-button--destructive {
237
+ --srcButtonDisclosureIconColor: var(--src-color-icon-critical);
238
+ }
239
+ &.src-button--primary,
240
+ &.src-button--destructive {
241
+ &:disabled,
242
+ &[disabled] {
243
+ --srcButtonDisclosureIconColor: var(
244
+ --src-color-icon-default-disabled
245
+ );
246
+ }
247
+ }
248
+ }
249
+
250
+ &.src-button--primary,
251
+ &.src-button--destructive {
252
+ --srcButtonDisclosureIconColor: var(--src-color-text-inverse);
253
+
254
+ &:disabled,
255
+ &[disabled] {
256
+ --srcButtonDisclosureIconColor: var(--src-color-text-inverse);
257
+ }
258
+ }
259
+
260
+ &.src-button--secondary {
261
+ --srcButtonDisclosureIconColor: var(--src-color-icon-default);
262
+
263
+ &:disabled,
264
+ &[disabled] {
265
+ --srcButtonDisclosureIconColor: var(--src-color-icon-default-disabled);
266
+ }
267
+ }
268
+ }
269
+
270
+ &--icon-prefix {
271
+ --srcButtonPrefixIconColor: var(--src-color-icon-default);
272
+
273
+ .src-button__icon {
274
+ display: inline-flex;
275
+ margin-right: 4px;
276
+ flex-shrink: 0;
277
+ vertical-align: middle;
278
+ color: var(--srcButtonPrefixIconColor);
279
+ }
280
+
281
+ &.src-button--plain {
282
+ &.src-button--primary {
283
+ --srcButtonPrefixIconColor: var(--src-color-icon-primary);
284
+
285
+ &:disabled,
286
+ &[disabled] {
287
+ --srcButtonPrefixIconColor: var(--src-color-icon-default-disabled);
288
+ }
289
+ }
290
+ &.src-button--destructive {
291
+ --srcButtonPrefixIconColor: var(--src-color-icon-critical);
292
+
293
+ &:disabled,
294
+ &[disabled] {
295
+ --srcButtonPrefixIconColor: var(--src-color-icon-default-disabled);
296
+ }
297
+ }
298
+ }
299
+
300
+ &.src-button--primary,
301
+ &.src-button--destructive {
302
+ --srcButtonPrefixIconColor: var(--src-color-text-inverse);
303
+
304
+ &:disabled,
305
+ &[disabled] {
306
+ --srcButtonPrefixIconColor: var(--src-color-icon-default-disabled);
307
+ }
308
+ }
309
+
310
+ &.src-button--secondary {
311
+ --srcButtonPrefixIconColor: var(--src-color-icon-default);
312
+
313
+ &:disabled,
314
+ &[disabled] {
315
+ --srcButtonPrefixIconColor: var(--src-color-icon-default-disabled);
316
+ }
317
+ }
318
+ }
319
+
320
+ &--icon-button {
321
+ --srcButtonIconColor: var(--src-color-icon-default);
322
+
323
+ .src-button__icon {
324
+ flex-shrink: 0;
325
+ color: var(--srcButtonIconColor);
326
+ }
327
+
328
+ &.src-button--primary,
329
+ &.src-button--destructive {
330
+ --srcButtonIconColor: var(--src-color-text-inverse);
331
+ }
332
+
333
+ &.src-button--secondary {
334
+ --srcButtonIconColor: var(--src-color-icon-default);
335
+ }
336
+
337
+ &.src-button--slim {
338
+ --srcButtonPaddings: 6px;
339
+ }
340
+
341
+ &.src-button--medium {
342
+ --srcButtonPaddings: 8px;
343
+ }
344
+
345
+ &.src-button--large {
346
+ --srcButtonPaddings: 12px;
347
+ }
348
+ }
349
+
350
+ &--loading {
351
+ src-loading {
352
+ position: absolute;
353
+ }
354
+ }
355
+ }
@@ -0,0 +1,220 @@
1
+ import {
2
+ ChangeDetectionStrategy,
3
+ Component,
4
+ EventEmitter,
5
+ Input,
6
+ Output,
7
+ input,
8
+ ViewEncapsulation,
9
+ } from '@angular/core';
10
+ import type { SourceButton } from '../interfaces';
11
+ import { defaultSourceButtonConfig } from '../interfaces';
12
+ import {
13
+ SourceButtonAppearance,
14
+ SourceButtonAppearanceValues,
15
+ SourceButtonColorScheme,
16
+ SourceButtonColorSchemeValues,
17
+ SourceButtonSize,
18
+ SourceButtonSizeValues,
19
+ SourceButtonType,
20
+ SourceButtonTypeValues,
21
+ } from '../constants';
22
+ import { NgClass } from '@angular/common';
23
+ import { SourceLoadingComponent } from '../../source-loading';
24
+
25
+ @Component({
26
+ selector: 'src-button',
27
+ templateUrl: './source-button.component.html',
28
+ styleUrls: ['./source-button.component.scss'],
29
+ imports: [NgClass, SourceLoadingComponent],
30
+ encapsulation: ViewEncapsulation.None,
31
+ changeDetection: ChangeDetectionStrategy.OnPush,
32
+ })
33
+ export class SourceButtonComponent {
34
+ /**
35
+ * Type of button
36
+ */
37
+ @Input() type?: SourceButtonTypeValues = SourceButtonType.BUTTON;
38
+ /**
39
+ * Is this the principal call to action on the page?
40
+ */
41
+ @Input() appearance?: SourceButtonAppearanceValues =
42
+ SourceButtonAppearance.DEFAULT;
43
+ /**
44
+ * Is this the principal call to action on the page?
45
+ */
46
+ @Input() colorScheme?: SourceButtonColorSchemeValues =
47
+ SourceButtonColorScheme.SECONDARY;
48
+ /**
49
+ * How big it should be?
50
+ */
51
+ @Input() size?: SourceButtonSizeValues = SourceButtonSize.MEDIUM;
52
+ /**
53
+ * Add a custom class if you need harder customization.
54
+ */
55
+ @Input() customClass?: string | string[];
56
+ /**
57
+ * Is this button a trigger for some kind of menu?
58
+ */
59
+ @Input() hasDisclosure? = false;
60
+ /**
61
+ * Is this button should fill all available width of the container?
62
+ */
63
+ @Input() isFullWidth? = false;
64
+ /**
65
+ * Is this button having icon before label?
66
+ */
67
+ @Input() iconPrefix? = false;
68
+ /**
69
+ * Square button with only icon inside
70
+ */
71
+ @Input() iconButton? = false;
72
+ /**
73
+ * Use it only if you use iconPrefix or iconButton
74
+ */
75
+ @Input() icon?: string;
76
+ /**
77
+ * Pressed state for button
78
+ */
79
+ @Input() isPressed? = false;
80
+ /**
81
+ * Standard disabled state for button
82
+ */
83
+ @Input() isDisabled? = false;
84
+ /**
85
+ * Set true if your button has a show loading process after pressing
86
+ */
87
+ @Input() isLoading = false;
88
+ /**
89
+ * The form element to associate the button with (its form owner). The value of this attribute must be the id of a form in the same document. (If this attribute is not set, the button is associated with its ancestor form element, if any.)
90
+ * This attribute lets you associate button elements with forms anywhere in the document, not just inside a form. It can also override an ancestor form element.
91
+ *
92
+ */
93
+ @Input() formID?: string;
94
+
95
+ /** Even though it's not recommended, you can set the buttons' configuration using one input. A valid use-case for it is settings for buttons in src-modal. */
96
+ @Input() srcButtonConfig?: SourceButton;
97
+ /**
98
+ * Test ID for the component. Provide descriptive uniq id in kebab-case.
99
+ */
100
+ testID = input('', { alias: 'data-testid' });
101
+
102
+ /**
103
+ * Optional click handler
104
+ */
105
+ @Output()
106
+ onClick = new EventEmitter<Event>();
107
+ /**
108
+ * Optional submit handler
109
+ */
110
+ @Output()
111
+ onSubmit = new EventEmitter<Event>();
112
+ compiledClassesList: string[] = [];
113
+ defaultConfig = defaultSourceButtonConfig;
114
+
115
+ get classes(): string[] {
116
+ // Reset the compiledClassesList
117
+ this.compiledClassesList = [];
118
+ const config: Partial<SourceButton> = {
119
+ type: this.type,
120
+ appearance: this.appearance,
121
+ colorScheme: this.colorScheme,
122
+ size: this.size,
123
+ customClass: this.customClass,
124
+ hasDisclosure: this.hasDisclosure,
125
+ isFullWidth: this.isFullWidth,
126
+ icon: this.icon,
127
+ iconPrefix: this.iconPrefix,
128
+ iconButton: this.iconButton,
129
+ isPressed: this.isPressed,
130
+ isDisabled: this.isDisabled,
131
+ isLoading: this.isLoading,
132
+ testID: this.testID(),
133
+ };
134
+
135
+ // Find a new overridden config object depending on the presence of srcButtonConfig
136
+ let updatedConfig;
137
+
138
+ if (this.srcButtonConfig) {
139
+ updatedConfig = this.getUpdatedConfig(this.srcButtonConfig);
140
+ } else {
141
+ updatedConfig = this.getUpdatedConfig(config);
142
+ }
143
+
144
+ if (updatedConfig.type) {
145
+ this.type = updatedConfig.type;
146
+ }
147
+ if (updatedConfig.formID) {
148
+ this.formID = updatedConfig.formID;
149
+ }
150
+ if (updatedConfig.icon) {
151
+ this.icon = updatedConfig.icon;
152
+ }
153
+ if (updatedConfig.appearance) {
154
+ this.compiledClassesList.push(`src-button--${updatedConfig.appearance}`);
155
+ }
156
+ if (updatedConfig.colorScheme) {
157
+ this.compiledClassesList.push(`src-button--${updatedConfig.colorScheme}`);
158
+ }
159
+ if (updatedConfig.size) {
160
+ this.compiledClassesList.push(`src-button--${updatedConfig.size}`);
161
+ }
162
+ if (updatedConfig.hasDisclosure) {
163
+ this.compiledClassesList.push(`src-button--disclosure`);
164
+ }
165
+ if (updatedConfig.isPressed) {
166
+ this.compiledClassesList.push(`src-button--pressed`);
167
+ }
168
+ if (updatedConfig.isFullWidth) {
169
+ this.compiledClassesList.push(`src-button--full-width`);
170
+ }
171
+ if (updatedConfig.iconPrefix) {
172
+ this.compiledClassesList.push(`src-button--icon-prefix`);
173
+ }
174
+ if (updatedConfig.iconButton) {
175
+ this.compiledClassesList.push(`src-button--icon-button`);
176
+ }
177
+ if (updatedConfig.isLoading) {
178
+ this.compiledClassesList.push(`src-button--loading`);
179
+ }
180
+ if (updatedConfig.customClass) {
181
+ if (Array.isArray(updatedConfig.customClass)) {
182
+ updatedConfig.customClass.forEach((customClass) => {
183
+ this.compiledClassesList.push(customClass);
184
+ });
185
+ } else {
186
+ this.compiledClassesList.push(updatedConfig.customClass);
187
+ }
188
+ }
189
+
190
+ return this.compiledClassesList;
191
+ }
192
+
193
+ getUpdatedConfig(config: Partial<SourceButton>): SourceButton {
194
+ return {
195
+ type: config.type || this.defaultConfig.type,
196
+ appearance: config.appearance || this.defaultConfig.appearance,
197
+ colorScheme: config.colorScheme || this.defaultConfig.colorScheme,
198
+ size: config.size || this.defaultConfig.size,
199
+ customClass: config.customClass || this.defaultConfig.customClass,
200
+ hasDisclosure: config.hasDisclosure || this.defaultConfig.hasDisclosure,
201
+ isFullWidth: config.isFullWidth || this.defaultConfig.isFullWidth,
202
+ icon: config.icon || this.defaultConfig.icon,
203
+ iconPrefix: config.iconPrefix || this.defaultConfig.iconPrefix,
204
+ iconButton: config.iconButton || this.defaultConfig.iconButton,
205
+ isPressed: config.isPressed || this.defaultConfig.isPressed,
206
+ isDisabled: config.isDisabled || this.defaultConfig.isDisabled,
207
+ isLoading: config.isLoading || this.defaultConfig.isLoading,
208
+ formID: config.formID || this.defaultConfig.formID,
209
+ testID: config.testID || this.defaultConfig.testID,
210
+ };
211
+ }
212
+
213
+ handleClick(event: Event) {
214
+ this.onClick.emit(event);
215
+ }
216
+
217
+ handleSubmit(event: Event) {
218
+ this.onSubmit.emit(event);
219
+ }
220
+ }
@@ -0,0 +1,4 @@
1
+ export * from './sourceButtonColorScheme';
2
+ export * from './sourceButtonSize';
3
+ export * from './sourceButtonType';
4
+ export * from './sourceButtonAppearance';
@@ -0,0 +1,7 @@
1
+ export const SourceButtonAppearance = {
2
+ PLAIN: 'plain',
3
+ DEFAULT: 'default',
4
+ } as const;
5
+
6
+ export type SourceButtonAppearanceValues =
7
+ (typeof SourceButtonAppearance)[keyof typeof SourceButtonAppearance];
@@ -0,0 +1,8 @@
1
+ export const SourceButtonColorScheme = {
2
+ PRIMARY: 'primary',
3
+ SECONDARY: 'secondary',
4
+ DESTRUCTIVE: 'destructive',
5
+ } as const;
6
+
7
+ export type SourceButtonColorSchemeValues =
8
+ (typeof SourceButtonColorScheme)[keyof typeof SourceButtonColorScheme];
@@ -0,0 +1,8 @@
1
+ export const SourceButtonSize = {
2
+ SLIM: 'slim',
3
+ SMALL: 'slim',
4
+ MEDIUM: 'medium',
5
+ LARGE: 'large',
6
+ } as const;
7
+ export type SourceButtonSizeValues =
8
+ (typeof SourceButtonSize)[keyof typeof SourceButtonSize];
@@ -0,0 +1,8 @@
1
+ export const SourceButtonType = {
2
+ BUTTON: 'button',
3
+ SUBMIT: 'submit',
4
+ RESET: 'reset',
5
+ } as const;
6
+
7
+ export type SourceButtonTypeValues =
8
+ (typeof SourceButtonType)[keyof typeof SourceButtonType];
@@ -0,0 +1,3 @@
1
+ export * from './components/source-button.component';
2
+ export * from './constants';
3
+ export * from './interfaces';
@@ -0,0 +1,24 @@
1
+ import {
2
+ SourceButtonColorScheme,
3
+ SourceButtonSize,
4
+ SourceButtonType,
5
+ } from '../constants';
6
+ import type { SourceButton } from './sourceButton.interface';
7
+
8
+ export const defaultSourceButtonConfig: SourceButton = {
9
+ type: SourceButtonType.BUTTON,
10
+ appearance: 'default',
11
+ colorScheme: SourceButtonColorScheme.SECONDARY,
12
+ size: SourceButtonSize.MEDIUM,
13
+ customClass: '',
14
+ hasDisclosure: false,
15
+ isFullWidth: false,
16
+ icon: undefined,
17
+ iconPrefix: false,
18
+ iconButton: false,
19
+ isPressed: false,
20
+ isDisabled: false,
21
+ isLoading: false,
22
+ formID: undefined,
23
+ testID: undefined,
24
+ };
@@ -0,0 +1,2 @@
1
+ export * from './sourceButton.interface';
2
+ export * from './defaultSourceButton.config';
@@ -0,0 +1,26 @@
1
+ import {
2
+ SourceButtonAppearanceValues,
3
+ SourceButtonColorSchemeValues,
4
+ SourceButtonSizeValues,
5
+ SourceButtonTypeValues,
6
+ } from '../constants';
7
+
8
+ export interface SourceButton {
9
+ type: SourceButtonTypeValues;
10
+ appearance: SourceButtonAppearanceValues;
11
+ colorScheme: SourceButtonColorSchemeValues;
12
+ size: SourceButtonSizeValues;
13
+ customClass: string | string[];
14
+ hasDisclosure: boolean;
15
+ isFullWidth: boolean;
16
+ iconPrefix: boolean;
17
+ iconButton: boolean;
18
+ icon?: string;
19
+ isPressed: boolean;
20
+ isDisabled: boolean;
21
+ isLoading: boolean;
22
+ formID?: string;
23
+ testID?: string;
24
+
25
+ [key: string]: unknown;
26
+ }
@@ -0,0 +1,20 @@
1
+ <div class="src-copyright" [class.src-copyright--collapsible]="isCollapsible()">
2
+ <a href="https://www.3dsource.com/" target="_blank" class="src-link">
3
+ <svg
4
+ class="src-link__icon"
5
+ fill="none"
6
+ height="18"
7
+ viewBox="0 0 17 18"
8
+ width="17"
9
+ xmlns="http://www.w3.org/2000/svg"
10
+ >
11
+ <path
12
+ fill="#016EF8"
13
+ fill-rule="evenodd"
14
+ d="M13 13v1.1a61.8 61.8 0 0 1 .2 1.3l2-1.2c.7-.3 1-.9 1-1.6V10c0-.4-.2-.8-.6-1l-4.4-2.5a9414.7 9414.7 0 0 0-2.8-1.7l-.6-.3c-.2-.1-.3-.3-.3-.5 0-.3.2-.4.4-.5l.6.1 3.7 2.2a4320 4320 0 0 1 4 2V5.3c0-.7-.3-1.1-.9-1.5L9.3.3C8.5 0 7.7 0 7 .3L5.7 1l-1.2.7-.2.4v3.3c0 .5.2 1 .7 1.2l4 2.3 3.2 1.8c.6.3.8.8.8 1.4v1ZM3.2 5V4A164.6 164.6 0 0 1 3 2.6l-1.2.7-1 .5c-.5.4-.8.9-.8 1.6V8c0 .4.2.8.6 1l1 .6.5.3 6.2 3.5c.1.1.3.2.3.4.1.2 0 .4-.1.6-.2.2-.4.2-.7 0l-1.8-1-.5-.3-3.3-1.9-2-1C0 10 0 10 0 10.1a914.3 914.3 0 0 1 0 2.4c0 .7.3 1.3 1 1.6L3.8 16l3 1.7c.8.5 1.6.5 2.4 0l1.1-.6 1.3-.7.2-.3v-3.5c0-.5-.2-.8-.6-1a1118.4 1118.4 0 0 1-4-2.4L3.8 7.2c-.4-.2-.7-.7-.7-1.2V5Z"
15
+ clip-rule="evenodd"
16
+ />
17
+ </svg>
18
+ <span class="src-link__text">{{ linkText() }}</span>
19
+ </a>
20
+ </div>