otimus-library 0.2.46 → 0.2.48

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 (202) hide show
  1. package/README.md +26 -26
  2. package/ng-package.json +12 -0
  3. package/package.json +4 -13
  4. package/src/assets/images/loading.svg +0 -0
  5. package/src/assets/images/not-found-bg.jpg +0 -0
  6. package/src/lib/components/oc-accordion/oc-accordion.component.html +3 -0
  7. package/src/lib/components/oc-accordion/oc-accordion.component.scss +4 -0
  8. package/src/lib/components/oc-accordion/oc-accordion.component.ts +44 -0
  9. package/src/lib/components/oc-accordion-item/oc-accordion-item.component.html +19 -0
  10. package/src/lib/components/oc-accordion-item/oc-accordion-item.component.scss +86 -0
  11. package/src/lib/components/oc-accordion-item/oc-accordion-item.component.ts +27 -0
  12. package/src/lib/components/oc-accordion-item/styles/oc-accordion-item.shui-component.scss +41 -0
  13. package/src/lib/components/oc-autocomplete/oc-autocomplete.component.html +66 -0
  14. package/src/lib/components/oc-autocomplete/oc-autocomplete.component.scss +157 -0
  15. package/src/lib/components/oc-autocomplete/oc-autocomplete.component.ts +277 -0
  16. package/src/lib/components/oc-badge/oc-badge.component.html +7 -0
  17. package/src/lib/components/oc-badge/oc-badge.component.scss +125 -0
  18. package/src/lib/components/oc-badge/oc-badge.component.ts +22 -0
  19. package/src/lib/components/oc-checkbox/oc-checkbox.component.html +30 -0
  20. package/src/lib/components/oc-checkbox/oc-checkbox.component.scss +103 -0
  21. package/src/lib/components/oc-checkbox/oc-checkbox.component.ts +132 -0
  22. package/src/lib/components/oc-checkbox/styles/oc-checkbox.shui-component.scss +21 -0
  23. package/src/lib/components/oc-chip/oc-chip.component.html +20 -0
  24. package/src/lib/components/oc-chip/oc-chip.component.scss +102 -0
  25. package/src/lib/components/oc-chip/oc-chip.component.ts +32 -0
  26. package/src/lib/components/oc-filter/oc-filter.component.html +22 -0
  27. package/src/lib/components/oc-filter/oc-filter.component.scss +78 -0
  28. package/src/lib/components/oc-filter/oc-filter.component.spec.ts +23 -0
  29. package/src/lib/components/oc-filter/oc-filter.component.ts +30 -0
  30. package/src/lib/components/oc-input/oc-input.component.html +21 -0
  31. package/src/lib/components/oc-input/oc-input.component.scss +3 -0
  32. package/src/lib/components/oc-input/oc-input.component.ts +100 -0
  33. package/src/lib/components/oc-key-value/oc-key-value.component.html +12 -0
  34. package/src/lib/components/oc-key-value/oc-key-value.component.scss +26 -0
  35. package/src/lib/components/oc-key-value/oc-key-value.component.ts +23 -0
  36. package/src/lib/components/oc-key-value/styles/oc-key-value.shui-component.scss +26 -0
  37. package/src/lib/components/oc-log/oc-log.component.html +18 -0
  38. package/src/lib/components/oc-log/oc-log.component.scss +61 -0
  39. package/src/lib/components/oc-log/oc-log.component.ts +15 -0
  40. package/src/lib/components/oc-menu/oc-menu.component.html +31 -0
  41. package/src/lib/components/oc-menu/oc-menu.component.scss +101 -0
  42. package/src/lib/components/oc-menu/oc-menu.component.ts +84 -0
  43. package/src/lib/components/oc-modal/oc-modal.component.html +54 -0
  44. package/src/lib/components/oc-modal/oc-modal.component.scss +204 -0
  45. package/src/lib/components/oc-modal/oc-modal.component.ts +82 -0
  46. package/src/lib/components/oc-modal/styles/oc-modal.shui-component.scss +3 -0
  47. package/src/lib/components/oc-modal-footer/oc-modal-footer.component.html +11 -0
  48. package/src/lib/components/oc-modal-footer/oc-modal-footer.component.scss +27 -0
  49. package/src/lib/components/oc-modal-footer/oc-modal-footer.component.ts +15 -0
  50. package/src/lib/components/oc-not-found/oc-not-found.component.html +14 -0
  51. package/src/lib/components/oc-not-found/oc-not-found.component.scss +153 -0
  52. package/src/lib/components/oc-not-found/oc-not-found.component.spec.ts +23 -0
  53. package/src/lib/components/oc-not-found/oc-not-found.component.ts +12 -0
  54. package/src/lib/components/oc-pagination/oc-pagination.component.html +32 -0
  55. package/src/lib/components/oc-pagination/oc-pagination.component.scss +80 -0
  56. package/src/lib/components/oc-pagination/oc-pagination.component.ts +46 -0
  57. package/src/lib/components/oc-profile/oc-profile.component.html +17 -0
  58. package/src/lib/components/oc-profile/oc-profile.component.scss +80 -0
  59. package/src/lib/components/oc-profile/oc-profile.component.ts +38 -0
  60. package/src/lib/components/oc-step/oc-step.component.html +32 -0
  61. package/src/lib/components/oc-step/oc-step.component.scss +106 -0
  62. package/src/lib/components/oc-step/oc-step.component.ts +39 -0
  63. package/src/lib/components/oc-step/styles/oc-step.shui-component.scss +52 -0
  64. package/src/lib/components/oc-stepper/oc-stepper.component.html +3 -0
  65. package/src/lib/components/oc-stepper/oc-stepper.component.scss +9 -0
  66. package/src/lib/components/oc-stepper/oc-stepper.component.ts +86 -0
  67. package/src/lib/components/oc-tab/oc-tab.component.html +3 -0
  68. package/src/lib/components/oc-tab/oc-tab.component.scss +0 -0
  69. package/src/lib/components/oc-tab/oc-tab.component.ts +15 -0
  70. package/src/lib/components/oc-table/oc-table.component.html +62 -0
  71. package/src/lib/components/oc-table/oc-table.component.scss +2 -0
  72. package/src/lib/components/oc-table/oc-table.component.ts +51 -0
  73. package/src/lib/components/oc-tabs/oc-tabs.component.html +13 -0
  74. package/src/lib/components/oc-tabs/oc-tabs.component.scss +47 -0
  75. package/src/lib/components/oc-tabs/oc-tabs.component.ts +46 -0
  76. package/src/lib/components/oc-tabs/styles/oc-tabs.shui-component.scss +25 -0
  77. package/src/lib/components/oc-toast/oc-toast.component.html +46 -0
  78. package/src/lib/components/oc-toast/oc-toast.component.scss +133 -0
  79. package/src/lib/components/oc-toast/oc-toast.component.ts +15 -0
  80. package/src/lib/components/oc-toggle/oc-toggle.component.html +4 -0
  81. package/src/lib/components/oc-toggle/oc-toggle.component.scss +73 -0
  82. package/src/lib/components/oc-toggle/oc-toggle.component.spec.ts +23 -0
  83. package/src/lib/components/oc-toggle/oc-toggle.component.ts +32 -0
  84. package/src/lib/directives/oc-tooltip/oc-tooltip.directive.ts +108 -0
  85. package/src/lib/interfaces/internal/languages.ts +16 -0
  86. package/src/lib/interfaces/oc-autocomplete.ts +6 -0
  87. package/src/lib/interfaces/oc-menu.ts +10 -0
  88. package/src/lib/interfaces/oc-style-theme.ts +3 -0
  89. package/src/lib/interfaces/oc-table.ts +12 -0
  90. package/src/lib/interfaces/oc-toast.ts +8 -0
  91. package/src/lib/otimus-library.component.ts +16 -0
  92. package/src/lib/otimus-library.service.ts +9 -0
  93. package/src/lib/services/internationalization.service.ts +73 -0
  94. package/src/lib/services/oc-toast.service.ts +107 -0
  95. package/src/lib/services/style-theme.service.ts +19 -0
  96. package/src/public-api.ts +30 -0
  97. package/{styles → src/styles}/colors.scss +70 -70
  98. package/{styles → src/styles}/components/buttons/buttons.scss +225 -225
  99. package/{styles → src/styles}/components/buttons/buttons.shui.scss +61 -61
  100. package/{styles → src/styles}/components/index.scss +2 -2
  101. package/{styles → src/styles}/components/inputs/inputs.scss +248 -248
  102. package/{styles → src/styles}/components/inputs/inputs.shui.scss +212 -212
  103. package/{styles → src/styles}/components/table/table.scss +69 -69
  104. package/{styles → src/styles}/components/table/table.shui.scss +50 -50
  105. package/{styles → src/styles}/components/tooltip.scss +26 -26
  106. package/{styles → src/styles}/grid.scss +1122 -1122
  107. package/{styles → src/styles}/patterns/shui/colors.shui.scss +154 -154
  108. package/{styles → src/styles}/patterns/shui/fonts.shui.scss +65 -65
  109. package/{styles → src/styles}/patterns/shui/index.shui.scss +24 -24
  110. package/{styles → src/styles}/patterns/shui/variables.shui.scss +22 -22
  111. package/{styles → src/styles}/states.scss +5 -5
  112. package/{styles → src/styles}/styles.scss +46 -46
  113. package/{styles → src/styles}/variables.scss +47 -47
  114. package/tsconfig.lib.json +14 -0
  115. package/tsconfig.lib.prod.json +10 -0
  116. package/tsconfig.spec.json +14 -0
  117. package/esm2022/lib/components/oc-accordion/oc-accordion.component.mjs +0 -48
  118. package/esm2022/lib/components/oc-accordion-item/oc-accordion-item.component.mjs +0 -35
  119. package/esm2022/lib/components/oc-autocomplete/oc-autocomplete.component.mjs +0 -275
  120. package/esm2022/lib/components/oc-badge/oc-badge.component.mjs +0 -30
  121. package/esm2022/lib/components/oc-checkbox/oc-checkbox.component.mjs +0 -133
  122. package/esm2022/lib/components/oc-chip/oc-chip.component.mjs +0 -45
  123. package/esm2022/lib/components/oc-filter/oc-filter.component.mjs +0 -39
  124. package/esm2022/lib/components/oc-input/oc-input.component.mjs +0 -97
  125. package/esm2022/lib/components/oc-key-value/oc-key-value.component.mjs +0 -29
  126. package/esm2022/lib/components/oc-log/oc-log.component.mjs +0 -22
  127. package/esm2022/lib/components/oc-menu/oc-menu.component.mjs +0 -81
  128. package/esm2022/lib/components/oc-modal/oc-modal.component.mjs +0 -85
  129. package/esm2022/lib/components/oc-modal-footer/oc-modal-footer.component.mjs +0 -23
  130. package/esm2022/lib/components/oc-not-found/oc-not-found.component.mjs +0 -11
  131. package/esm2022/lib/components/oc-pagination/oc-pagination.component.mjs +0 -49
  132. package/esm2022/lib/components/oc-profile/oc-profile.component.mjs +0 -38
  133. package/esm2022/lib/components/oc-step/oc-step.component.mjs +0 -49
  134. package/esm2022/lib/components/oc-stepper/oc-stepper.component.mjs +0 -90
  135. package/esm2022/lib/components/oc-tab/oc-tab.component.mjs +0 -20
  136. package/esm2022/lib/components/oc-tabs/oc-tabs.component.mjs +0 -42
  137. package/esm2022/lib/components/oc-toast/oc-toast.component.mjs +0 -17
  138. package/esm2022/lib/components/oc-toggle/oc-toggle.component.mjs +0 -34
  139. package/esm2022/lib/directives/oc-tooltip/oc-tooltip.directive.mjs +0 -117
  140. package/esm2022/lib/interfaces/oc-autocomplete.mjs +0 -2
  141. package/esm2022/lib/interfaces/oc-menu.mjs +0 -2
  142. package/esm2022/lib/interfaces/oc-style-theme.mjs +0 -2
  143. package/esm2022/lib/interfaces/oc-toast.mjs +0 -2
  144. package/esm2022/lib/otimus-library.component.mjs +0 -19
  145. package/esm2022/lib/otimus-library.service.mjs +0 -14
  146. package/esm2022/lib/services/internationalization.service.mjs +0 -68
  147. package/esm2022/lib/services/oc-toast.service.mjs +0 -81
  148. package/esm2022/lib/services/style-theme.service.mjs +0 -21
  149. package/esm2022/otimus-library.mjs +0 -5
  150. package/esm2022/public-api.mjs +0 -30
  151. package/fesm2022/otimus-library.mjs +0 -1513
  152. package/fesm2022/otimus-library.mjs.map +0 -1
  153. package/index.d.ts +0 -5
  154. package/lib/components/oc-accordion/oc-accordion.component.d.ts +0 -18
  155. package/lib/components/oc-accordion-item/oc-accordion-item.component.d.ts +0 -12
  156. package/lib/components/oc-autocomplete/oc-autocomplete.component.d.ts +0 -68
  157. package/lib/components/oc-badge/oc-badge.component.d.ts +0 -11
  158. package/lib/components/oc-checkbox/oc-checkbox.component.d.ts +0 -35
  159. package/lib/components/oc-chip/oc-chip.component.d.ts +0 -14
  160. package/lib/components/oc-filter/oc-filter.component.d.ts +0 -17
  161. package/lib/components/oc-input/oc-input.component.d.ts +0 -31
  162. package/lib/components/oc-key-value/oc-key-value.component.d.ts +0 -14
  163. package/lib/components/oc-log/oc-log.component.d.ts +0 -7
  164. package/lib/components/oc-menu/oc-menu.component.d.ts +0 -20
  165. package/lib/components/oc-modal/oc-modal.component.d.ts +0 -30
  166. package/lib/components/oc-modal-footer/oc-modal-footer.component.d.ts +0 -8
  167. package/lib/components/oc-not-found/oc-not-found.component.d.ts +0 -5
  168. package/lib/components/oc-pagination/oc-pagination.component.d.ts +0 -14
  169. package/lib/components/oc-profile/oc-profile.component.d.ts +0 -12
  170. package/lib/components/oc-step/oc-step.component.d.ts +0 -22
  171. package/lib/components/oc-stepper/oc-stepper.component.d.ts +0 -24
  172. package/lib/components/oc-tab/oc-tab.component.d.ts +0 -8
  173. package/lib/components/oc-tabs/oc-tabs.component.d.ts +0 -18
  174. package/lib/components/oc-toast/oc-toast.component.d.ts +0 -8
  175. package/lib/components/oc-toggle/oc-toggle.component.d.ts +0 -12
  176. package/lib/directives/oc-tooltip/oc-tooltip.directive.d.ts +0 -20
  177. package/lib/interfaces/oc-autocomplete.d.ts +0 -5
  178. package/lib/interfaces/oc-menu.d.ts +0 -9
  179. package/lib/interfaces/oc-style-theme.d.ts +0 -2
  180. package/lib/interfaces/oc-toast.d.ts +0 -8
  181. package/lib/otimus-library.component.d.ts +0 -5
  182. package/lib/otimus-library.service.d.ts +0 -6
  183. package/lib/services/internationalization.service.d.ts +0 -17
  184. package/lib/services/oc-toast.service.d.ts +0 -14
  185. package/lib/services/style-theme.service.d.ts +0 -8
  186. package/public-api.d.ts +0 -26
  187. /package/{assets → src/assets}/fonts/siemens/SH-Bree-Headline-Oblique.woff +0 -0
  188. /package/{assets → src/assets}/fonts/siemens/SH-Bree-Headline-Oblique.woff2 +0 -0
  189. /package/{assets → src/assets}/fonts/siemens/SH-Bree-Headline-Regular.woff +0 -0
  190. /package/{assets → src/assets}/fonts/siemens/SH-Bree-Headline-Regular.woff2 +0 -0
  191. /package/{assets → src/assets}/fonts/siemens/SiemensSans-Black.woff +0 -0
  192. /package/{assets → src/assets}/fonts/siemens/SiemensSans-Black.woff2 +0 -0
  193. /package/{assets → src/assets}/fonts/siemens/SiemensSans-BlackItalic.woff +0 -0
  194. /package/{assets → src/assets}/fonts/siemens/SiemensSans-BlackItalic.woff2 +0 -0
  195. /package/{assets → src/assets}/fonts/siemens/SiemensSans-Bold.woff +0 -0
  196. /package/{assets → src/assets}/fonts/siemens/SiemensSans-Bold.woff2 +0 -0
  197. /package/{assets → src/assets}/fonts/siemens/SiemensSans-BoldItalic.woff +0 -0
  198. /package/{assets → src/assets}/fonts/siemens/SiemensSans-BoldItalic.woff2 +0 -0
  199. /package/{assets → src/assets}/fonts/siemens/SiemensSans-Italic.woff +0 -0
  200. /package/{assets → src/assets}/fonts/siemens/SiemensSans-Italic.woff2 +0 -0
  201. /package/{assets → src/assets}/fonts/siemens/SiemensSans-Roman.woff +0 -0
  202. /package/{assets → src/assets}/fonts/siemens/SiemensSans-Roman.woff2 +0 -0
@@ -0,0 +1,277 @@
1
+ import { CommonModule } from '@angular/common'
2
+ import {
3
+ AfterContentChecked,
4
+ AfterViewInit,
5
+ ChangeDetectionStrategy,
6
+ ChangeDetectorRef,
7
+ Component,
8
+ ContentChild,
9
+ ElementRef,
10
+ EventEmitter,
11
+ HostBinding,
12
+ Input,
13
+ OnChanges,
14
+ OnInit,
15
+ Output,
16
+ Renderer2,
17
+ SimpleChanges,
18
+ ViewChild,
19
+ } from '@angular/core'
20
+ import { OcAutoCompleteType } from '../../interfaces/oc-autocomplete'
21
+ import { FormsModule } from '@angular/forms'
22
+ import { InternationalizationService } from '../../services/internationalization.service'
23
+ import { OcStyleThemeType } from '../../interfaces/oc-style-theme'
24
+ import { StyleThemeService } from '../../services/style-theme.service'
25
+
26
+ @Component({
27
+ selector: 'oc-autocomplete',
28
+ standalone: true,
29
+ imports: [CommonModule, FormsModule],
30
+ providers: [InternationalizationService],
31
+ host: {
32
+ '[style.width]': 'computedWidth',
33
+ '[style.min-width]': 'computedMinWidth',
34
+ '[style.max-width]': 'computedMaxWidth',
35
+ },
36
+ templateUrl: './oc-autocomplete.component.html',
37
+ styleUrl: './oc-autocomplete.component.scss',
38
+ changeDetection: ChangeDetectionStrategy.Default,
39
+ })
40
+ export class OcAutocompleteComponent
41
+ implements AfterViewInit, OnChanges, AfterContentChecked, OnInit
42
+ {
43
+ constructor(
44
+ private renderer: Renderer2,
45
+ private el: ElementRef,
46
+ private translateService: InternationalizationService,
47
+ private styleThemeService: StyleThemeService,
48
+ private cdr: ChangeDetectorRef
49
+ ) {}
50
+
51
+ @ViewChild('input') input!: ElementRef
52
+ @ViewChild('options') options!: ElementRef
53
+ @ViewChild('outerDiv') outerDiv!: ElementRef<HTMLDivElement>
54
+
55
+ @ContentChild('ocPrefix') ocPrefix: any
56
+ @ContentChild('ocSuffix') ocSuffix: any
57
+ @Input() ocPlaceholder?: string
58
+ @Input() ocError?: string
59
+ @Input() ocSize: 'small' | 'large' | 'medium' = 'medium'
60
+ @Input() ocData: OcAutoCompleteType[] = []
61
+ @Input() ocValue: any = ''
62
+ @Input() ocClearOnChange: boolean = false
63
+ @Input() ocWidth?: string
64
+ @Input() ocMinWidth?: string
65
+ @Input() ocMaxWidth?: string
66
+ @Input() ocOptionsMaxHeight?: string
67
+ @Input() ocOptionsWidth?: string
68
+ @Input() ocRequired: boolean = false
69
+ @Input() ocMaxResults?: number
70
+ @Input() ocAllowNotListedValue: boolean = false
71
+ @Input() ocNoAvailableOptionsText?: string
72
+ @Input() ocTypeForMoreResultsText?: string
73
+ @Input() ocLoading: boolean = false
74
+ @Input() ocSemanticLike: boolean = false // deprecated. Prefer using ocStyleTheme instead
75
+ @Input() ocStyle: OcStyleThemeType = 'otimus'
76
+ @Input() ocTabIndex?: number
77
+
78
+ @Input() ocHasDeleteButton?: boolean = false
79
+
80
+ @Output() ocValueChange = new EventEmitter<string>()
81
+ @Output() ocChange = new EventEmitter<string | null>()
82
+ @Output() ocOptionNotFound = new EventEmitter()
83
+ @Output() ocClick = new EventEmitter()
84
+
85
+ hasSuffix: boolean = false
86
+ hasPrefix: boolean = false
87
+
88
+ isOptionsShown: boolean = false
89
+ filteredData: OcAutoCompleteType[] = []
90
+ selectedValue: OcAutoCompleteType = {
91
+ name: '',
92
+ value: null,
93
+ }
94
+
95
+ @HostBinding('style.width')
96
+ get computedWidth() {
97
+ return this.ocWidth ? this.ocWidth : null
98
+ }
99
+
100
+ @HostBinding('style.min-width')
101
+ get computedMinWidth() {
102
+ return this.ocMinWidth || '0'
103
+ }
104
+
105
+ @HostBinding('style.max-width')
106
+ get computedMaxWidth() {
107
+ return this.ocMaxWidth || '100%'
108
+ }
109
+
110
+ ngOnChanges(changes: SimpleChanges): void {
111
+ if (this.ocPrefix) {
112
+ this.hasPrefix = true
113
+ }
114
+ if (this.ocSuffix) {
115
+ this.hasSuffix = true
116
+ }
117
+ this.formatOcValueType()
118
+ this.loadOptions()
119
+
120
+ this.cdr.detectChanges()
121
+ }
122
+
123
+ ngOnInit(): void {
124
+ if (this.ocValue === undefined) {
125
+ this.ocValue = null
126
+ }
127
+ }
128
+
129
+ ngAfterViewInit(): void {
130
+ this.ocStyle = this.styleThemeService.getStyleTheme() || this.ocStyle
131
+ if (this.ocPrefix) {
132
+ this.hasPrefix = true
133
+ }
134
+ if (this.ocSuffix) {
135
+ this.hasSuffix = true
136
+ }
137
+ this.formatOcValueType()
138
+ this.loadOptions()
139
+ this.translateService.getTranslationsByLanguage()
140
+ this.cdr.detectChanges()
141
+ }
142
+
143
+ ngAfterContentChecked(): void {
144
+ if (this.ocPrefix) {
145
+ this.hasPrefix = true
146
+ }
147
+ if (this.ocSuffix) {
148
+ this.hasSuffix = true
149
+ }
150
+ }
151
+
152
+ formatOcValueType() {
153
+ if (this.ocValue) {
154
+ return `${this.ocValue}`
155
+ }
156
+ return null
157
+ }
158
+
159
+ getTranslation(code: number | string) {
160
+ return this.translateService.getTranslation(code)
161
+ }
162
+
163
+ loadOptions() {
164
+ this.formatOcValueType()
165
+ setTimeout(() => {
166
+ this.filteredData = this.ocData
167
+ const inputBox = this.el.nativeElement
168
+
169
+ const found = this.ocData.find((el) => el.value == this.ocValue)
170
+ if (found) {
171
+ this.selectedValue = found
172
+ this.ocValue = found.name
173
+ }
174
+
175
+ if (inputBox) {
176
+ const inputElement = inputBox.querySelector('input')
177
+
178
+ if (inputElement && !this.ocSemanticLike && ['otimus', 'shui'].includes(this.ocStyle)) {
179
+ this.renderer.setAttribute(inputElement, 'placeholder', '')
180
+ this.renderer.setAttribute(inputElement, 'required', this.ocRequired.toString())
181
+ }
182
+ }
183
+ }, 50)
184
+ }
185
+
186
+ closeOnClickOut() {
187
+ this.renderer.listen('window', 'click', (e: Event) => {
188
+ if (this.input && this.options) {
189
+ if (e.target !== this.input.nativeElement && e.target !== this.options.nativeElement) {
190
+ this.isOptionsShown = false
191
+ }
192
+ }
193
+ this.findByTyping()
194
+ })
195
+ }
196
+
197
+ findByTyping(): void {
198
+ if (!this.ocValue || !this.ocValue?.toString().trim().length) {
199
+ this.ocChange.emit(null)
200
+ this.ocOptionNotFound.emit()
201
+ }
202
+ const foundValue = this.ocData.find(
203
+ (data) =>
204
+ data.name.toString().toLowerCase() === this.ocValue?.toString().toLowerCase() ||
205
+ data.value.toString().toLowerCase() === this.ocValue?.toString().toLowerCase()
206
+ )
207
+
208
+ if (!foundValue) {
209
+ this.selectedValue = {
210
+ name: '',
211
+ value: null,
212
+ }
213
+ if (!this.ocAllowNotListedValue) {
214
+ this.ocValue = ''
215
+ }
216
+ this.filteredData = this.ocData
217
+ return
218
+ }
219
+ this.selectedValue = foundValue
220
+ }
221
+
222
+ filterData(name: string): void {
223
+ this.isOptionsShown = true
224
+ this.filteredData = this.ocData.filter((data) => {
225
+ return this.getFormattedName(data.name)?.includes(this.getFormattedName(name))
226
+ })
227
+ }
228
+
229
+ getFormattedName(str: string): string {
230
+ return str
231
+ ?.toLowerCase()
232
+ .normalize('NFD')
233
+ .replace(/[\u0300-\u036f]/g, '') // Remove marcas diacríticas
234
+ }
235
+
236
+ toggleOptions() {
237
+ this.closeOnClickOut()
238
+ this.isOptionsShown = !this.isOptionsShown
239
+ }
240
+
241
+ selectValue(value: any) {
242
+ const foundValue = this.ocData.find((data) => data.value == value)
243
+
244
+ if (!foundValue) {
245
+ this.selectedValue = {
246
+ name: '',
247
+ value: null,
248
+ }
249
+
250
+ this.cdr.detectChanges()
251
+ return
252
+ }
253
+
254
+ this.selectedValue = foundValue
255
+ if (this.ocClearOnChange) {
256
+ this.ocValue = ''
257
+ this.filteredData = this.ocData
258
+ } else {
259
+ this.ocValue = foundValue.name
260
+ }
261
+
262
+ this.isOptionsShown = false
263
+
264
+ this.ocChange.emit(this.selectedValue.value)
265
+
266
+ this.cdr.detectChanges()
267
+ }
268
+
269
+ clearValue() {
270
+ this.selectedValue = {
271
+ name: '',
272
+ value: null,
273
+ }
274
+ this.ocValue = ''
275
+ this.filteredData = this.ocData
276
+ }
277
+ }
@@ -0,0 +1,7 @@
1
+ <div>
2
+ <div class="oc-badge" [ngClass]="classList">
3
+ <ng-content>
4
+
5
+ </ng-content>
6
+ </div>
7
+ </div>
@@ -0,0 +1,125 @@
1
+ @use '../../../styles/variables.scss';
2
+
3
+
4
+ .oc-badge{
5
+ border-radius: 50%;
6
+
7
+ display: flex;
8
+ justify-content: center;
9
+ align-items: center;
10
+
11
+ color: variables.$color-gray-6;
12
+
13
+ > * {
14
+ color: variables.$color-gray-6;
15
+ font-weight: 600;
16
+ }
17
+ }
18
+
19
+ //Badge BG's
20
+ .notification{
21
+ background-color: variables.$color-error;
22
+ }
23
+
24
+ .brand-g{
25
+ background-color: variables.$color-brand-g-1;
26
+ }
27
+
28
+ .brand-p {
29
+ background-color: variables.$color-brand-p-1;
30
+ }
31
+
32
+ .success {
33
+ background-color: variables.$color-success;
34
+ }
35
+
36
+ .warning {
37
+ background-color: variables.$color-warning;
38
+ }
39
+
40
+
41
+ //Badge Sizes
42
+ .small{
43
+ width: 22px;
44
+ height: 22px;
45
+
46
+ font-size: 1rem;
47
+ }
48
+
49
+ .medium {
50
+ width: 28px;
51
+ height: 28px;
52
+
53
+ font-size: 1.25rem;
54
+ }
55
+
56
+ .large {
57
+ width: 34px;
58
+ height: 34px;
59
+ font-size: 1.5rem;
60
+ }
61
+
62
+ //Wave Effect
63
+ .waved{
64
+ position: relative;
65
+ z-index: 2;
66
+
67
+ &::before, &::after{
68
+ z-index: -1;
69
+
70
+ content: '';
71
+ position: absolute;
72
+ top: 0;
73
+
74
+ border-radius: 50%;
75
+ width: 100%;
76
+ height: 100%;
77
+
78
+ animation: wave infinite 2s;
79
+ }
80
+
81
+ &::after{
82
+ animation-delay: 600ms;
83
+ }
84
+ }
85
+
86
+ .waved.notification{
87
+ &::before, &::after{
88
+ background-color: variables.$color-error;
89
+ }
90
+ }
91
+
92
+ .waved.brand-g{
93
+ &::before, &::after{
94
+ background-color: variables.$color-brand-g-1;
95
+ }
96
+ }
97
+
98
+ .waved.brand-p{
99
+ &::before, &::after {
100
+ background-color: variables.$color-brand-p-1;
101
+ }
102
+ }
103
+
104
+ .waved.success{
105
+ &::before, &::after{
106
+ background-color: variables.$color-success;
107
+ }
108
+ }
109
+
110
+ .waved.warning{
111
+ &::before, &::after {
112
+ background-color: variables.$color-warning;
113
+ }
114
+ }
115
+
116
+
117
+ @keyframes wave{
118
+ from{
119
+ transform: scale(0);
120
+ }
121
+ to{
122
+ opacity: 0;
123
+ transform: scale(2);
124
+ }
125
+ }
@@ -0,0 +1,22 @@
1
+ import { CommonModule } from '@angular/common';
2
+ import { Component, Input, OnInit } from '@angular/core';
3
+
4
+ @Component({
5
+ selector: 'oc-badge',
6
+ standalone: true,
7
+ imports: [CommonModule],
8
+ templateUrl: './oc-badge.component.html',
9
+ styleUrl: './oc-badge.component.scss'
10
+ })
11
+ export class OcBadgeComponent implements OnInit {
12
+ @Input() ocSize: 'small' | 'medium' | 'large' = 'small'
13
+ @Input() ocColor: 'notification' | 'brand-g' | 'brand-p' | 'success' | 'warning' = 'notification'
14
+ @Input() ocWaved: boolean = false
15
+
16
+ classList: string[] = []
17
+
18
+ ngOnInit(): void {
19
+ this.classList.push(this.ocSize, this.ocColor)
20
+ if(this.ocWaved) this.classList.push('waved')
21
+ }
22
+ }
@@ -0,0 +1,30 @@
1
+ <button class="oc-checkbox-content cbx" type="button" (click)="toggleChecked();
2
+ onDoubleClick()" [ngClass]="{
3
+ shui: ocStyle === 'shui'
4
+ }" [tabIndex]="ocTabIndex">
5
+
6
+ <div class="oc-checkbox cbx" [ngClass]="{
7
+ 'checked': ocChecked,
8
+ 'tiny': ocSize === 'tiny',
9
+ purple: ocColor === 'purple',
10
+ 'gray-border': ocBorderColor === 'gray'
11
+ }">
12
+
13
+ <span class="check-icon material-symbols-outlined">check_small</span>
14
+ </div>
15
+
16
+ @if(ocLabel) {
17
+ <span class="oc-checkbox-label cbx">
18
+ {{ocLabel}}
19
+ </span>
20
+ }
21
+
22
+ <ng-content>
23
+ </ng-content>
24
+
25
+ @if(formControl) {
26
+ <input [formControl]="formControl" [name]="ocName" [checked]="ocChecked" type="checkbox" hidden>
27
+ } @else {
28
+ <input [name]="ocName" [checked]="ocChecked" type="checkbox" hidden>
29
+ }
30
+ </button>
@@ -0,0 +1,103 @@
1
+ @use '../../../styles/variables.scss';
2
+
3
+ .oc-checkbox-content{
4
+ display: flex;
5
+ align-items: center;
6
+
7
+ padding: 0;
8
+ margin: 0;
9
+ border: none;
10
+ background-color: transparent;
11
+
12
+ gap: .3rem;
13
+
14
+ .oc-checkbox-label{
15
+ background-color: transparent;
16
+ border: none;
17
+
18
+ color: variables.$color-gray-3;
19
+ font-weight: 500;
20
+ text-align: left;
21
+ }
22
+ }
23
+
24
+ .oc-checkbox{
25
+ min-width: 1rem;
26
+ min-width: 1rem;
27
+
28
+ width: 1.2rem;
29
+ height: 1.2rem;
30
+
31
+ border-radius: .3rem;
32
+ background-color: variables.$color-gray-5;
33
+ border: 2px solid variables.$color-white;
34
+
35
+ display: flex;
36
+ align-items: center;
37
+ justify-content: center;
38
+
39
+ transition: .15s ease;
40
+ cursor: pointer;
41
+ &:hover{
42
+ filter: brightness(0.95);
43
+ }
44
+
45
+ overflow: hidden;
46
+
47
+ .check-icon{
48
+
49
+ font-weight: 700;
50
+
51
+ color: variables.$color-gray-6;
52
+ opacity: 0;
53
+
54
+ pointer-events: none;
55
+
56
+ margin: 0;
57
+ font-size: 1.15rem;
58
+
59
+ transition: .2s ease;
60
+
61
+ transform: translateY(15px) scale(0.5);
62
+ }
63
+ }
64
+
65
+ .oc-checkbox.gray-border{
66
+ border: 2px solid variables.$color-gray-4;
67
+ }
68
+
69
+ .oc-checkbox.tiny{
70
+ width: 1rem;
71
+ height: 1rem;
72
+
73
+ border: 1px solid variables.$color-white;
74
+ &.gray{
75
+ border: 1px solid variables.$color-gray-4;
76
+ }
77
+ }
78
+
79
+ .checked {
80
+ background-color: variables.$color-brand-g-1;
81
+ box-shadow: 0px 2px 10px 0px rgba(0, 221, 163, 0.17);
82
+
83
+ .check-icon{
84
+ transform: translateY(0) scale(1);
85
+
86
+ opacity: 1;
87
+
88
+ color: variables.$color-gray-6;
89
+ }
90
+ border: none !important;
91
+ }
92
+
93
+ .checked.purple{
94
+ background-color: variables.$color-brand-p-1;
95
+ box-shadow: 0px 2px 10px 0px rgba(85, 5, 162, 0.2);
96
+ }
97
+
98
+ .label{
99
+ width: 18.4px !important;
100
+ height: 18.4px !important;
101
+ }
102
+
103
+ @import './styles/oc-checkbox.shui-component.scss';
@@ -0,0 +1,132 @@
1
+ import { CommonModule } from '@angular/common'
2
+ import {
3
+ AfterViewInit,
4
+ ChangeDetectionStrategy,
5
+ ChangeDetectorRef,
6
+ Component,
7
+ EventEmitter,
8
+ forwardRef,
9
+ Input,
10
+ Output,
11
+ } from '@angular/core'
12
+ import {
13
+ ControlValueAccessor,
14
+ FormControl,
15
+ FormsModule,
16
+ NG_VALUE_ACCESSOR,
17
+ ReactiveFormsModule,
18
+ } from '@angular/forms'
19
+ import { StyleThemeService } from '../../services/style-theme.service'
20
+ import { OcStyleThemeType } from '../../interfaces/oc-style-theme'
21
+
22
+ @Component({
23
+ selector: 'oc-checkbox',
24
+ standalone: true,
25
+ imports: [CommonModule, FormsModule, ReactiveFormsModule],
26
+ templateUrl: './oc-checkbox.component.html',
27
+ styleUrl: './oc-checkbox.component.scss',
28
+ providers: [
29
+ {
30
+ provide: NG_VALUE_ACCESSOR,
31
+ useExisting: forwardRef(() => OcCheckboxComponent),
32
+ multi: true,
33
+ },
34
+ ],
35
+ changeDetection: ChangeDetectionStrategy.Default,
36
+ })
37
+ export class OcCheckboxComponent implements ControlValueAccessor, AfterViewInit {
38
+ checkBoxId: string = `oc-${Math.random()}`
39
+
40
+ constructor(
41
+ private styleThemeService: StyleThemeService,
42
+ private cdr: ChangeDetectorRef
43
+ ) {}
44
+
45
+ @Output() ocChange = new EventEmitter<boolean>()
46
+
47
+ @Input() ocChecked: boolean = false
48
+ @Input() ocSize: 'tiny' | 'small' = 'small'
49
+ @Input() ocLabel?: string = ''
50
+ @Input() ocName?: string = ''
51
+ @Input() ocColor: 'purple' | 'green' = 'green'
52
+ @Input() ocBorderColor: 'white' | 'gray' = 'white'
53
+ @Input() ocStyle: OcStyleThemeType = 'otimus'
54
+ @Output() ocDoubleClick = new EventEmitter<boolean>()
55
+ @Input() formControl?: FormControl
56
+ @Input() ocTabIndex?: number
57
+ @Input() disableDoubleClickCheck = true
58
+
59
+ private onChange?: (value: boolean) => void
60
+ private onTouched = (): void => {}
61
+
62
+ ngAfterViewInit(): void {
63
+ this.ocStyle = this.styleThemeService.getStyleTheme() || this.ocStyle
64
+ this.cdr.markForCheck()
65
+ this.cdr.detectChanges()
66
+ }
67
+
68
+ writeValue(value: boolean): void {
69
+ this.ocChecked = value
70
+ this.cdr.markForCheck()
71
+ this.cdr.detectChanges()
72
+ }
73
+
74
+ registerOnChange(fn: (value: boolean) => void): void {
75
+ this.onChange = fn
76
+ this.cdr.markForCheck()
77
+ this.cdr.detectChanges()
78
+ }
79
+
80
+ registerOnTouched(fn: () => void): void {
81
+ this.onTouched = fn
82
+ this.cdr.markForCheck()
83
+ this.cdr.detectChanges()
84
+ }
85
+
86
+ private doubleClickCounter = 0
87
+ private timeoutId: ReturnType<typeof setTimeout> | null = null
88
+ protected onDoubleClick(): void {
89
+ if (this.disableDoubleClickCheck) {
90
+ return
91
+ }
92
+ if (this.timeoutId) {
93
+ clearTimeout(this.timeoutId)
94
+ this.timeoutId = null
95
+ }
96
+
97
+ if (this.doubleClickCounter === 0) {
98
+ this.doubleClickCounter = 1
99
+ this.timeoutId = setTimeout(() => {
100
+ this.doubleClickCounter = 0
101
+ this.cdr.markForCheck()
102
+ setInterval(() => this.cdr.detectChanges(), 100)
103
+ }, 500)
104
+ } else {
105
+ this.doubleClickCounter = 0
106
+ if (this.ocDoubleClick && this.ocChecked) {
107
+ this.ocDoubleClick.emit(this.ocChecked)
108
+ }
109
+ }
110
+ this.cdr.markForCheck()
111
+ this.cdr.detectChanges()
112
+ }
113
+ toggleChecked(): void {
114
+ if (this.doubleClickCounter === 1) {
115
+ this.cdr.markForCheck()
116
+ this.cdr.detectChanges()
117
+ return
118
+ }
119
+ this.ocChecked = !this.ocChecked
120
+ if (this.onChange) {
121
+ this.onChange(this.ocChecked)
122
+ }
123
+ this.onTouched()
124
+ this.ocChange.emit(this.ocChecked)
125
+
126
+ if (this.formControl) {
127
+ this.formControl.setValue(this.ocChecked)
128
+ }
129
+ this.cdr.markForCheck()
130
+ this.cdr.detectChanges()
131
+ }
132
+ }
@@ -0,0 +1,21 @@
1
+ @use '../../../../styles/variables.scss';
2
+
3
+ .oc-checkbox-content.shui {
4
+ .oc-checkbox, .purple {
5
+ border-radius: 0.15rem;
6
+ background-color: variables.$color-shui-base-2;
7
+
8
+ &.gray-border {
9
+ border: 2px solid variables.$color-shui-ui-0;
10
+ background-color: transparent;
11
+ }
12
+
13
+ &.checked {
14
+ background-color: variables.$color-shui-ui-0;
15
+ }
16
+ }
17
+
18
+ span.cbx {
19
+ color: rgba(variables.$color-shui-ui-1, 0.75);
20
+ }
21
+ }