otimus-library 0.2.48 → 0.2.49

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 (201) hide show
  1. package/esm2022/lib/components/oc-accordion/oc-accordion.component.mjs +48 -0
  2. package/esm2022/lib/components/oc-accordion-item/oc-accordion-item.component.mjs +35 -0
  3. package/esm2022/lib/components/oc-autocomplete/oc-autocomplete.component.mjs +275 -0
  4. package/esm2022/lib/components/oc-badge/oc-badge.component.mjs +30 -0
  5. package/esm2022/lib/components/oc-checkbox/oc-checkbox.component.mjs +133 -0
  6. package/esm2022/lib/components/oc-chip/oc-chip.component.mjs +45 -0
  7. package/esm2022/lib/components/oc-filter/oc-filter.component.mjs +39 -0
  8. package/esm2022/lib/components/oc-input/oc-input.component.mjs +97 -0
  9. package/esm2022/lib/components/oc-key-value/oc-key-value.component.mjs +29 -0
  10. package/esm2022/lib/components/oc-log/oc-log.component.mjs +22 -0
  11. package/esm2022/lib/components/oc-menu/oc-menu.component.mjs +81 -0
  12. package/esm2022/lib/components/oc-modal/oc-modal.component.mjs +85 -0
  13. package/esm2022/lib/components/oc-modal-footer/oc-modal-footer.component.mjs +23 -0
  14. package/esm2022/lib/components/oc-not-found/oc-not-found.component.mjs +11 -0
  15. package/esm2022/lib/components/oc-pagination/oc-pagination.component.mjs +49 -0
  16. package/esm2022/lib/components/oc-profile/oc-profile.component.mjs +38 -0
  17. package/esm2022/lib/components/oc-step/oc-step.component.mjs +49 -0
  18. package/esm2022/lib/components/oc-stepper/oc-stepper.component.mjs +90 -0
  19. package/esm2022/lib/components/oc-tab/oc-tab.component.mjs +20 -0
  20. package/esm2022/lib/components/oc-tabs/oc-tabs.component.mjs +42 -0
  21. package/esm2022/lib/components/oc-toast/oc-toast.component.mjs +17 -0
  22. package/esm2022/lib/components/oc-toggle/oc-toggle.component.mjs +34 -0
  23. package/esm2022/lib/directives/oc-tooltip/oc-tooltip.directive.mjs +117 -0
  24. package/esm2022/lib/interfaces/oc-autocomplete.mjs +2 -0
  25. package/esm2022/lib/interfaces/oc-menu.mjs +2 -0
  26. package/esm2022/lib/interfaces/oc-style-theme.mjs +2 -0
  27. package/esm2022/lib/interfaces/oc-toast.mjs +2 -0
  28. package/esm2022/lib/otimus-library.component.mjs +19 -0
  29. package/esm2022/lib/otimus-library.service.mjs +14 -0
  30. package/esm2022/lib/services/internationalization.service.mjs +68 -0
  31. package/esm2022/lib/services/oc-toast.service.mjs +81 -0
  32. package/esm2022/lib/services/style-theme.service.mjs +21 -0
  33. package/esm2022/otimus-library.mjs +5 -0
  34. package/esm2022/public-api.mjs +30 -0
  35. package/fesm2022/otimus-library.mjs +1513 -0
  36. package/fesm2022/otimus-library.mjs.map +1 -0
  37. package/index.d.ts +5 -0
  38. package/lib/components/oc-accordion/oc-accordion.component.d.ts +18 -0
  39. package/lib/components/oc-accordion-item/oc-accordion-item.component.d.ts +12 -0
  40. package/lib/components/oc-autocomplete/oc-autocomplete.component.d.ts +68 -0
  41. package/lib/components/oc-badge/oc-badge.component.d.ts +11 -0
  42. package/lib/components/oc-checkbox/oc-checkbox.component.d.ts +35 -0
  43. package/lib/components/oc-chip/oc-chip.component.d.ts +14 -0
  44. package/lib/components/oc-filter/oc-filter.component.d.ts +17 -0
  45. package/lib/components/oc-input/oc-input.component.d.ts +31 -0
  46. package/lib/components/oc-key-value/oc-key-value.component.d.ts +14 -0
  47. package/lib/components/oc-log/oc-log.component.d.ts +7 -0
  48. package/lib/components/oc-menu/oc-menu.component.d.ts +20 -0
  49. package/lib/components/oc-modal/oc-modal.component.d.ts +30 -0
  50. package/lib/components/oc-modal-footer/oc-modal-footer.component.d.ts +8 -0
  51. package/lib/components/oc-not-found/oc-not-found.component.d.ts +5 -0
  52. package/lib/components/oc-pagination/oc-pagination.component.d.ts +14 -0
  53. package/lib/components/oc-profile/oc-profile.component.d.ts +12 -0
  54. package/lib/components/oc-step/oc-step.component.d.ts +22 -0
  55. package/lib/components/oc-stepper/oc-stepper.component.d.ts +24 -0
  56. package/lib/components/oc-tab/oc-tab.component.d.ts +8 -0
  57. package/lib/components/oc-tabs/oc-tabs.component.d.ts +18 -0
  58. package/lib/components/oc-toast/oc-toast.component.d.ts +8 -0
  59. package/lib/components/oc-toggle/oc-toggle.component.d.ts +12 -0
  60. package/lib/directives/oc-tooltip/oc-tooltip.directive.d.ts +20 -0
  61. package/lib/interfaces/oc-autocomplete.d.ts +5 -0
  62. package/lib/interfaces/oc-menu.d.ts +9 -0
  63. package/lib/interfaces/oc-style-theme.d.ts +2 -0
  64. package/lib/interfaces/oc-toast.d.ts +8 -0
  65. package/lib/otimus-library.component.d.ts +5 -0
  66. package/lib/otimus-library.service.d.ts +6 -0
  67. package/lib/services/internationalization.service.d.ts +17 -0
  68. package/lib/services/oc-toast.service.d.ts +14 -0
  69. package/lib/services/style-theme.service.d.ts +8 -0
  70. package/package.json +13 -4
  71. package/public-api.d.ts +26 -0
  72. package/ng-package.json +0 -12
  73. package/src/assets/images/loading.svg +0 -0
  74. package/src/assets/images/not-found-bg.jpg +0 -0
  75. package/src/lib/components/oc-accordion/oc-accordion.component.html +0 -3
  76. package/src/lib/components/oc-accordion/oc-accordion.component.scss +0 -4
  77. package/src/lib/components/oc-accordion/oc-accordion.component.ts +0 -44
  78. package/src/lib/components/oc-accordion-item/oc-accordion-item.component.html +0 -19
  79. package/src/lib/components/oc-accordion-item/oc-accordion-item.component.scss +0 -86
  80. package/src/lib/components/oc-accordion-item/oc-accordion-item.component.ts +0 -27
  81. package/src/lib/components/oc-accordion-item/styles/oc-accordion-item.shui-component.scss +0 -41
  82. package/src/lib/components/oc-autocomplete/oc-autocomplete.component.html +0 -66
  83. package/src/lib/components/oc-autocomplete/oc-autocomplete.component.scss +0 -157
  84. package/src/lib/components/oc-autocomplete/oc-autocomplete.component.ts +0 -277
  85. package/src/lib/components/oc-badge/oc-badge.component.html +0 -7
  86. package/src/lib/components/oc-badge/oc-badge.component.scss +0 -125
  87. package/src/lib/components/oc-badge/oc-badge.component.ts +0 -22
  88. package/src/lib/components/oc-checkbox/oc-checkbox.component.html +0 -30
  89. package/src/lib/components/oc-checkbox/oc-checkbox.component.scss +0 -103
  90. package/src/lib/components/oc-checkbox/oc-checkbox.component.ts +0 -132
  91. package/src/lib/components/oc-checkbox/styles/oc-checkbox.shui-component.scss +0 -21
  92. package/src/lib/components/oc-chip/oc-chip.component.html +0 -20
  93. package/src/lib/components/oc-chip/oc-chip.component.scss +0 -102
  94. package/src/lib/components/oc-chip/oc-chip.component.ts +0 -32
  95. package/src/lib/components/oc-filter/oc-filter.component.html +0 -22
  96. package/src/lib/components/oc-filter/oc-filter.component.scss +0 -78
  97. package/src/lib/components/oc-filter/oc-filter.component.spec.ts +0 -23
  98. package/src/lib/components/oc-filter/oc-filter.component.ts +0 -30
  99. package/src/lib/components/oc-input/oc-input.component.html +0 -21
  100. package/src/lib/components/oc-input/oc-input.component.scss +0 -3
  101. package/src/lib/components/oc-input/oc-input.component.ts +0 -100
  102. package/src/lib/components/oc-key-value/oc-key-value.component.html +0 -12
  103. package/src/lib/components/oc-key-value/oc-key-value.component.scss +0 -26
  104. package/src/lib/components/oc-key-value/oc-key-value.component.ts +0 -23
  105. package/src/lib/components/oc-key-value/styles/oc-key-value.shui-component.scss +0 -26
  106. package/src/lib/components/oc-log/oc-log.component.html +0 -18
  107. package/src/lib/components/oc-log/oc-log.component.scss +0 -61
  108. package/src/lib/components/oc-log/oc-log.component.ts +0 -15
  109. package/src/lib/components/oc-menu/oc-menu.component.html +0 -31
  110. package/src/lib/components/oc-menu/oc-menu.component.scss +0 -101
  111. package/src/lib/components/oc-menu/oc-menu.component.ts +0 -84
  112. package/src/lib/components/oc-modal/oc-modal.component.html +0 -54
  113. package/src/lib/components/oc-modal/oc-modal.component.scss +0 -204
  114. package/src/lib/components/oc-modal/oc-modal.component.ts +0 -82
  115. package/src/lib/components/oc-modal/styles/oc-modal.shui-component.scss +0 -3
  116. package/src/lib/components/oc-modal-footer/oc-modal-footer.component.html +0 -11
  117. package/src/lib/components/oc-modal-footer/oc-modal-footer.component.scss +0 -27
  118. package/src/lib/components/oc-modal-footer/oc-modal-footer.component.ts +0 -15
  119. package/src/lib/components/oc-not-found/oc-not-found.component.html +0 -14
  120. package/src/lib/components/oc-not-found/oc-not-found.component.scss +0 -153
  121. package/src/lib/components/oc-not-found/oc-not-found.component.spec.ts +0 -23
  122. package/src/lib/components/oc-not-found/oc-not-found.component.ts +0 -12
  123. package/src/lib/components/oc-pagination/oc-pagination.component.html +0 -32
  124. package/src/lib/components/oc-pagination/oc-pagination.component.scss +0 -80
  125. package/src/lib/components/oc-pagination/oc-pagination.component.ts +0 -46
  126. package/src/lib/components/oc-profile/oc-profile.component.html +0 -17
  127. package/src/lib/components/oc-profile/oc-profile.component.scss +0 -80
  128. package/src/lib/components/oc-profile/oc-profile.component.ts +0 -38
  129. package/src/lib/components/oc-step/oc-step.component.html +0 -32
  130. package/src/lib/components/oc-step/oc-step.component.scss +0 -106
  131. package/src/lib/components/oc-step/oc-step.component.ts +0 -39
  132. package/src/lib/components/oc-step/styles/oc-step.shui-component.scss +0 -52
  133. package/src/lib/components/oc-stepper/oc-stepper.component.html +0 -3
  134. package/src/lib/components/oc-stepper/oc-stepper.component.scss +0 -9
  135. package/src/lib/components/oc-stepper/oc-stepper.component.ts +0 -86
  136. package/src/lib/components/oc-tab/oc-tab.component.html +0 -3
  137. package/src/lib/components/oc-tab/oc-tab.component.scss +0 -0
  138. package/src/lib/components/oc-tab/oc-tab.component.ts +0 -15
  139. package/src/lib/components/oc-table/oc-table.component.html +0 -62
  140. package/src/lib/components/oc-table/oc-table.component.scss +0 -2
  141. package/src/lib/components/oc-table/oc-table.component.ts +0 -51
  142. package/src/lib/components/oc-tabs/oc-tabs.component.html +0 -13
  143. package/src/lib/components/oc-tabs/oc-tabs.component.scss +0 -47
  144. package/src/lib/components/oc-tabs/oc-tabs.component.ts +0 -46
  145. package/src/lib/components/oc-tabs/styles/oc-tabs.shui-component.scss +0 -25
  146. package/src/lib/components/oc-toast/oc-toast.component.html +0 -46
  147. package/src/lib/components/oc-toast/oc-toast.component.scss +0 -133
  148. package/src/lib/components/oc-toast/oc-toast.component.ts +0 -15
  149. package/src/lib/components/oc-toggle/oc-toggle.component.html +0 -4
  150. package/src/lib/components/oc-toggle/oc-toggle.component.scss +0 -73
  151. package/src/lib/components/oc-toggle/oc-toggle.component.spec.ts +0 -23
  152. package/src/lib/components/oc-toggle/oc-toggle.component.ts +0 -32
  153. package/src/lib/directives/oc-tooltip/oc-tooltip.directive.ts +0 -108
  154. package/src/lib/interfaces/internal/languages.ts +0 -16
  155. package/src/lib/interfaces/oc-autocomplete.ts +0 -6
  156. package/src/lib/interfaces/oc-menu.ts +0 -10
  157. package/src/lib/interfaces/oc-style-theme.ts +0 -3
  158. package/src/lib/interfaces/oc-table.ts +0 -12
  159. package/src/lib/interfaces/oc-toast.ts +0 -8
  160. package/src/lib/otimus-library.component.ts +0 -16
  161. package/src/lib/otimus-library.service.ts +0 -9
  162. package/src/lib/services/internationalization.service.ts +0 -73
  163. package/src/lib/services/oc-toast.service.ts +0 -107
  164. package/src/lib/services/style-theme.service.ts +0 -19
  165. package/src/public-api.ts +0 -30
  166. package/tsconfig.lib.json +0 -14
  167. package/tsconfig.lib.prod.json +0 -10
  168. package/tsconfig.spec.json +0 -14
  169. /package/{src/assets → assets}/fonts/siemens/SH-Bree-Headline-Oblique.woff +0 -0
  170. /package/{src/assets → assets}/fonts/siemens/SH-Bree-Headline-Oblique.woff2 +0 -0
  171. /package/{src/assets → assets}/fonts/siemens/SH-Bree-Headline-Regular.woff +0 -0
  172. /package/{src/assets → assets}/fonts/siemens/SH-Bree-Headline-Regular.woff2 +0 -0
  173. /package/{src/assets → assets}/fonts/siemens/SiemensSans-Black.woff +0 -0
  174. /package/{src/assets → assets}/fonts/siemens/SiemensSans-Black.woff2 +0 -0
  175. /package/{src/assets → assets}/fonts/siemens/SiemensSans-BlackItalic.woff +0 -0
  176. /package/{src/assets → assets}/fonts/siemens/SiemensSans-BlackItalic.woff2 +0 -0
  177. /package/{src/assets → assets}/fonts/siemens/SiemensSans-Bold.woff +0 -0
  178. /package/{src/assets → assets}/fonts/siemens/SiemensSans-Bold.woff2 +0 -0
  179. /package/{src/assets → assets}/fonts/siemens/SiemensSans-BoldItalic.woff +0 -0
  180. /package/{src/assets → assets}/fonts/siemens/SiemensSans-BoldItalic.woff2 +0 -0
  181. /package/{src/assets → assets}/fonts/siemens/SiemensSans-Italic.woff +0 -0
  182. /package/{src/assets → assets}/fonts/siemens/SiemensSans-Italic.woff2 +0 -0
  183. /package/{src/assets → assets}/fonts/siemens/SiemensSans-Roman.woff +0 -0
  184. /package/{src/assets → assets}/fonts/siemens/SiemensSans-Roman.woff2 +0 -0
  185. /package/{src/styles → styles}/colors.scss +0 -0
  186. /package/{src/styles → styles}/components/buttons/buttons.scss +0 -0
  187. /package/{src/styles → styles}/components/buttons/buttons.shui.scss +0 -0
  188. /package/{src/styles → styles}/components/index.scss +0 -0
  189. /package/{src/styles → styles}/components/inputs/inputs.scss +0 -0
  190. /package/{src/styles → styles}/components/inputs/inputs.shui.scss +0 -0
  191. /package/{src/styles → styles}/components/table/table.scss +0 -0
  192. /package/{src/styles → styles}/components/table/table.shui.scss +0 -0
  193. /package/{src/styles → styles}/components/tooltip.scss +0 -0
  194. /package/{src/styles → styles}/grid.scss +0 -0
  195. /package/{src/styles → styles}/patterns/shui/colors.shui.scss +0 -0
  196. /package/{src/styles → styles}/patterns/shui/fonts.shui.scss +0 -0
  197. /package/{src/styles → styles}/patterns/shui/index.shui.scss +0 -0
  198. /package/{src/styles → styles}/patterns/shui/variables.shui.scss +0 -0
  199. /package/{src/styles → styles}/states.scss +0 -0
  200. /package/{src/styles → styles}/styles.scss +0 -0
  201. /package/{src/styles → styles}/variables.scss +0 -0
@@ -1,66 +0,0 @@
1
- <div [ngClass]="{
2
- 'oc-input-box': !ocSemanticLike && ocStyle === 'otimus',
3
- small: ocSize === 'small',
4
- large: ocSize === 'large',
5
- error: !!ocError,
6
- prefix: hasPrefix,
7
- suffix: hasSuffix || ocHasDeleteButton,
8
- shui: ocStyle === 'shui',
9
- 'shui-input-box': ocStyle === 'shui',
10
- }">
11
- <ng-content></ng-content>
12
- <input [placeholder]="ocPlaceholder" #input (click)="toggleOptions(); ocClick.emit()" type="text"
13
- (input)="filterData(ocValue)" [(ngModel)]="ocValue" (ngModelChange)="ocValue = $event; ocValueChange.emit($event)"
14
- [ngClass]="{
15
- 'semantic-input': ocSemanticLike || ocStyle === 'semantic',
16
- }" [tabindex]="ocTabIndex" />
17
- @if (!ocSemanticLike && ocStyle !== 'semantic') {
18
- <label>
19
- <span [innerHTML]="ocPlaceholder"></span>
20
- @if (ocRequired) {
21
- <span class="oc color error">*</span>
22
- }
23
- </label>
24
- }
25
- <small *ngIf="ocError" class="error-msg">{{ ocError }}</small>
26
- <ng-content select="ocPrefix"></ng-content>
27
- @if (ocHasDeleteButton) {
28
- <button class="oc-has-close-button oc suffix" (click)="clearValue()">
29
- <span class="material-symbols-outlined">backspace</span>
30
- </button>
31
- }
32
- <ng-content select="ocSuffix"></ng-content>
33
-
34
- <div class="oc-options-div">
35
- @if (isOptionsShown && !ocLoading) {
36
- <ul #options class="oc-options" [ngStyle]="{
37
- 'max-height': ocOptionsMaxHeight,
38
- width: ocOptionsWidth,
39
- }">
40
- @if (!filteredData.length) {
41
- <li class="no-options">
42
- {{ ocNoAvailableOptionsText || 'Nenhum resultado disponível' }}
43
- </li>
44
- } @else {
45
- @for (data of filteredData; track data.value; let i = $index) {
46
- @if (!ocMaxResults || i < ocMaxResults) { <li>
47
- <button type="button" (click)="selectValue(data.value)">
48
- {{ data.name }}
49
- </button>
50
- </li>
51
- }
52
- }
53
- @if (ocMaxResults && filteredData.length > ocMaxResults) {
54
- <li class="no-options">
55
- {{ ocTypeForMoreResultsText || 'Digite para ver mais resultados' }}
56
- </li>
57
- }
58
- }
59
- </ul>
60
- } @else if (isOptionsShown && ocLoading) {
61
- <div class="oc-options loader">
62
- <span class="material-symbols-outlined loading"> progress_activity </span>
63
- </div>
64
- }
65
- </div>
66
- </div>
@@ -1,157 +0,0 @@
1
- @use '../../../styles/variables.scss';
2
- @import '../../../styles/components/inputs/inputs.scss';
3
-
4
- .oc-input-box {
5
- position: relative;
6
- }
7
-
8
- .oc-options-div {
9
- position: absolute;
10
- width: 100%;
11
- }
12
-
13
- .oc-has-close-button-input {
14
- padding-right: 60px; /* Espaço para o botão */
15
- }
16
-
17
- .oc-has-close-button {
18
- display: flex;
19
- justify-content: center;
20
- align-items: center;
21
-
22
- position: absolute;
23
- right: 0.5rem !important;
24
- top: 8%;
25
- height: 84%;
26
- width: 2.2rem;
27
-
28
- border: 2px solid transparent;
29
- border-radius: 0.5rem;
30
- background-color: transparent;
31
-
32
- padding: 0 !important;
33
-
34
- transition:
35
- border-color 0.2s ease,
36
- box-shadow 0.2s ease;
37
-
38
- &:hover {
39
- border: 2px solid variables.$color-gray-3;
40
- box-shadow: 0px 4px 8.7px 0px rgba(0, 0, 0, 0.13);
41
- cursor: pointer;
42
- }
43
- span {
44
- padding: 0 !important;
45
- margin: 0.3rem;
46
- }
47
- }
48
-
49
- .oc-options {
50
- display: flex;
51
- flex-direction: column;
52
- list-style: none;
53
-
54
- max-height: 40vh;
55
-
56
- background-color: variables.$color-gray-6;
57
- border: 2px solid variables.$color-white;
58
- box-shadow: 0px 4px 8.7px 0px rgba(0, 0, 0, 0.13);
59
-
60
- padding: 0;
61
- margin-block-start: 0;
62
-
63
- border-radius: 0.5rem;
64
- overflow: hidden;
65
-
66
- width: 100%;
67
- position: absolute;
68
- top: 50%;
69
-
70
- overflow-y: auto;
71
- z-index: 15;
72
-
73
- > li {
74
- padding: 0;
75
- margin: 0;
76
-
77
- button {
78
- width: 100%;
79
- text-align: left;
80
- padding: 0.6rem;
81
-
82
- border: none;
83
- background-color: variables.$color-gray-6;
84
-
85
- cursor: pointer;
86
- &:hover {
87
- filter: brightness(0.9);
88
- }
89
- }
90
- }
91
- }
92
-
93
- .no-options {
94
- padding: 0.6rem !important;
95
- color: variables.$color-gray-3;
96
- }
97
-
98
- .oc-options.loader {
99
- display: flex;
100
- align-items: center;
101
- justify-content: center;
102
- span {
103
- width: 24px;
104
- margin: 3rem;
105
-
106
- color: variables.$color-brand-p-1;
107
- }
108
- }
109
-
110
- .loading {
111
- animation: spinLoad 0.5s linear infinite;
112
- }
113
-
114
- .semantic-input {
115
- display: inline-block;
116
- width: 100%;
117
- padding: 10px 12px;
118
- font-size: 14px;
119
- line-height: 1.5;
120
- color: #333;
121
- background-color: #fff;
122
- border: 1px solid #ccc;
123
- border-radius: 4px;
124
- box-shadow: 0 1px 2px rgba(34, 36, 38, 0.15);
125
- transition:
126
- border-color 0.2s ease,
127
- box-shadow 0.2s ease;
128
- }
129
-
130
- /* Estilo ao passar o mouse */
131
- .semantic-input:hover {
132
- border-color: #b3b3b3;
133
- }
134
-
135
- /* Estilo ao focar */
136
- .semantic-input:focus {
137
- border-color: #85b7d9;
138
- box-shadow: 0 0 0 2px rgba(34, 36, 38, 0.15);
139
- outline: none;
140
- }
141
-
142
- /* Estilo para inputs desabilitados */
143
- .semantic-input:disabled {
144
- background-color: #f9f9f9;
145
- color: #b3b3b3;
146
- border-color: #ddd;
147
- cursor: not-allowed;
148
- }
149
-
150
- @keyframes spinLoad {
151
- from {
152
- transform: rotate(0);
153
- }
154
- to {
155
- transform: rotate(360deg);
156
- }
157
- }
@@ -1,277 +0,0 @@
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
- }
@@ -1,7 +0,0 @@
1
- <div>
2
- <div class="oc-badge" [ngClass]="classList">
3
- <ng-content>
4
-
5
- </ng-content>
6
- </div>
7
- </div>
@@ -1,125 +0,0 @@
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
- }
@@ -1,22 +0,0 @@
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
- }
@@ -1,30 +0,0 @@
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>