@dataloop-ai/components 0.13.0

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 (294) hide show
  1. package/.eslintrc.js +154 -0
  2. package/.prettierrc.json +7 -0
  3. package/Dockerfile +12 -0
  4. package/LICENSE +201 -0
  5. package/README.md +43 -0
  6. package/favicon.ico +0 -0
  7. package/index.html +13 -0
  8. package/index.ts +1 -0
  9. package/jest.config.js +16 -0
  10. package/jest.setup.js +59 -0
  11. package/models.ts +1 -0
  12. package/package.json +109 -0
  13. package/src/App.vue +201 -0
  14. package/src/assets/globals.scss +253 -0
  15. package/src/assets/globalsKeys.ts +28 -0
  16. package/src/components/DlAccordion/AccordionHeader.vue +148 -0
  17. package/src/components/DlAccordion/DlAccordion.vue +108 -0
  18. package/src/components/DlAccordion/index.ts +2 -0
  19. package/src/components/DlAlert.vue +227 -0
  20. package/src/components/DlAvatar.vue +99 -0
  21. package/src/components/DlBadge.vue +127 -0
  22. package/src/components/DlButton/DlButton.vue +370 -0
  23. package/src/components/DlButton/index.ts +4 -0
  24. package/src/components/DlButton/utils.ts +169 -0
  25. package/src/components/DlButtonGroup.vue +122 -0
  26. package/src/components/DlCheckbox.vue +298 -0
  27. package/src/components/DlChip/DlChip.vue +244 -0
  28. package/src/components/DlChip/index.ts +4 -0
  29. package/src/components/DlChip/utils.ts +100 -0
  30. package/src/components/DlColorPicker/DlAlpha.vue +142 -0
  31. package/src/components/DlColorPicker/DlBox.vue +75 -0
  32. package/src/components/DlColorPicker/DlColorPicker.vue +306 -0
  33. package/src/components/DlColorPicker/DlColors.vue +139 -0
  34. package/src/components/DlColorPicker/DlHue.vue +135 -0
  35. package/src/components/DlColorPicker/DlPreview.vue +61 -0
  36. package/src/components/DlColorPicker/DlSaturation.vue +152 -0
  37. package/src/components/DlColorPicker/constants.ts +16 -0
  38. package/src/components/DlColorPicker/index.ts +20 -0
  39. package/src/components/DlColorPicker/types.ts +11 -0
  40. package/src/components/DlColorPicker/utils.ts +128 -0
  41. package/src/components/DlCounters.vue +173 -0
  42. package/src/components/DlDatePicker/DlCalendar.vue +332 -0
  43. package/src/components/DlDatePicker/DlDatePicker.vue +315 -0
  44. package/src/components/DlDatePicker/DlMonthCalendar.vue +282 -0
  45. package/src/components/DlDatePicker/classes/Calendar.ts +110 -0
  46. package/src/components/DlDatePicker/classes/CalendarDate.ts +12 -0
  47. package/src/components/DlDatePicker/classes/CustomDate.ts +218 -0
  48. package/src/components/DlDatePicker/index.ts +3 -0
  49. package/src/components/DlDatePicker/isInRange.ts +44 -0
  50. package/src/components/DlDatePicker/types.ts +4 -0
  51. package/src/components/DlDatePicker/utils.ts +39 -0
  52. package/src/components/DlDateTimeRange/DlCardSidebar.vue +109 -0
  53. package/src/components/DlDateTimeRange/DlDateInput.vue +105 -0
  54. package/src/components/DlDateTimeRange/DlDateTimeRange.vue +468 -0
  55. package/src/components/DlDateTimeRange/index.ts +3 -0
  56. package/src/components/DlDateTimeRange/types.ts +42 -0
  57. package/src/components/DlDialogBox/DlDialogBox.vue +196 -0
  58. package/src/components/DlDialogBox/DlDialogBoxFooter.vue +22 -0
  59. package/src/components/DlDialogBox/DlDialogBoxHeader.vue +75 -0
  60. package/src/components/DlDialogBox/index.ts +5 -0
  61. package/src/components/DlDropdownButton.vue +463 -0
  62. package/src/components/DlIcon.vue +147 -0
  63. package/src/components/DlInfoErrorMessage.vue +91 -0
  64. package/src/components/DlItem/DlItem.vue +35 -0
  65. package/src/components/DlItem/index.ts +2 -0
  66. package/src/components/DlItemSection.vue +88 -0
  67. package/src/components/DlLink/DlLink.vue +76 -0
  68. package/src/components/DlLink/index.ts +4 -0
  69. package/src/components/DlLink/utils.ts +4 -0
  70. package/src/components/DlList.vue +61 -0
  71. package/src/components/DlListItem/DlListItem.vue +205 -0
  72. package/src/components/DlListItem/index.ts +3 -0
  73. package/src/components/DlListItem/utils.ts +14 -0
  74. package/src/components/DlMenu/DlMenu.vue +438 -0
  75. package/src/components/DlMenu/index.ts +3 -0
  76. package/src/components/DlMenu/utils.ts +138 -0
  77. package/src/components/DlOptionGroup/DlOptionGroup.vue +201 -0
  78. package/src/components/DlOptionGroup/MenuItemWrapper.vue +48 -0
  79. package/src/components/DlOptionGroup/OptionGroup.types.ts +36 -0
  80. package/src/components/DlOptionGroup/SimpleWrapper.vue +28 -0
  81. package/src/components/DlOptionGroup/index.ts +4 -0
  82. package/src/components/DlOptionGroup/utils.ts +40 -0
  83. package/src/components/DlPagination/DlPagination.vue +184 -0
  84. package/src/components/DlPagination/PageNavigation.vue +350 -0
  85. package/src/components/DlPagination/PaginationLegend.vue +41 -0
  86. package/src/components/DlPagination/QuickNavigation.vue +146 -0
  87. package/src/components/DlPagination/RowsSelector.vue +74 -0
  88. package/src/components/DlPagination/index.ts +3 -0
  89. package/src/components/DlPanelContainer/DlPanel.vue +213 -0
  90. package/src/components/DlPanelContainer/DlPanelContainer.vue +527 -0
  91. package/src/components/DlPanelContainer/index.ts +4 -0
  92. package/src/components/DlPopup/DlPopup.vue +478 -0
  93. package/src/components/DlPopup/DraggableUpper.vue +64 -0
  94. package/src/components/DlPopup/PopupHeader.vue +129 -0
  95. package/src/components/DlPopup/index.ts +1 -0
  96. package/src/components/DlProgressBar.vue +159 -0
  97. package/src/components/DlProgressChart.vue +299 -0
  98. package/src/components/DlRadio.vue +218 -0
  99. package/src/components/DlRange/DlRange.vue +439 -0
  100. package/src/components/DlRange/utils.ts +209 -0
  101. package/src/components/DlSearch.vue +155 -0
  102. package/src/components/DlSelect/DlSelect.vue +992 -0
  103. package/src/components/DlSelect/SelectOption.vue +261 -0
  104. package/src/components/DlSelect/index.ts +4 -0
  105. package/src/components/DlSelect/utils.ts +43 -0
  106. package/src/components/DlSkeleton.vue +72 -0
  107. package/src/components/DlSlider/DlSlider.vue +243 -0
  108. package/src/components/DlSlider/components/DlSliderBase.vue +380 -0
  109. package/src/components/DlSlider/components/DlSliderInput.vue +123 -0
  110. package/src/components/DlSlider/components/index.ts +4 -0
  111. package/src/components/DlSlider/index.ts +3 -0
  112. package/src/components/DlSlider/sliderStyles.scss +109 -0
  113. package/src/components/DlSlider/useSlider.ts +277 -0
  114. package/src/components/DlSlider/utils.ts +7 -0
  115. package/src/components/DlSmartSearch/DlJsonEditor.vue +309 -0
  116. package/src/components/DlSmartSearch/DlSmartSearch.vue +333 -0
  117. package/src/components/DlSmartSearch/DlSmartSearchInput.vue +741 -0
  118. package/src/components/DlSmartSearch/DlSuggestionsDropdown.vue +73 -0
  119. package/src/components/DlSmartSearch/highlightSyntax.ts +169 -0
  120. package/src/components/DlSmartSearch/index.ts +4 -0
  121. package/src/components/DlSmartSearch/types.ts +36 -0
  122. package/src/components/DlSmartSearch/utils.ts +45 -0
  123. package/src/components/DlStepper/DlStepper.vue +196 -0
  124. package/src/components/DlStepper/DlStepperContainer.vue +55 -0
  125. package/src/components/DlStepper/DlStepperContent.vue +101 -0
  126. package/src/components/DlStepper/DlStepperFooter.vue +133 -0
  127. package/src/components/DlStepper/DlStepperHeader.vue +49 -0
  128. package/src/components/DlStepper/DlStepperSidebar.vue +167 -0
  129. package/src/components/DlStepper/Step.ts +101 -0
  130. package/src/components/DlStepper/Stepper.ts +107 -0
  131. package/src/components/DlStepper/index.ts +7 -0
  132. package/src/components/DlStepper/interfaces.ts +11 -0
  133. package/src/components/DlSwitch.vue +280 -0
  134. package/src/components/DlTabPanels/DlTabPanel.vue +22 -0
  135. package/src/components/DlTabPanels/DlTabPanels.vue +41 -0
  136. package/src/components/DlTabPanels/index.ts +4 -0
  137. package/src/components/DlTabPanels/utils.ts +19 -0
  138. package/src/components/DlTable/DlTable.vue +1264 -0
  139. package/src/components/DlTable/DlTd.vue +109 -0
  140. package/src/components/DlTable/DlTh.vue +126 -0
  141. package/src/components/DlTable/DlTr.vue +44 -0
  142. package/src/components/DlTable/ResizableManager.ts +233 -0
  143. package/src/components/DlTable/dl-table-styles.scss +466 -0
  144. package/src/components/DlTable/hooks/tableActions.ts +64 -0
  145. package/src/components/DlTable/hooks/tableColumnSelection.ts +112 -0
  146. package/src/components/DlTable/hooks/tableFilter.ts +42 -0
  147. package/src/components/DlTable/hooks/tablePagination.ts +197 -0
  148. package/src/components/DlTable/hooks/tableRowExpand.ts +55 -0
  149. package/src/components/DlTable/hooks/tableRowSelection.ts +106 -0
  150. package/src/components/DlTable/hooks/tableSort.ts +125 -0
  151. package/src/components/DlTable/index.ts +6 -0
  152. package/src/components/DlTable/types.ts +96 -0
  153. package/src/components/DlTabs/DlTab.vue +146 -0
  154. package/src/components/DlTabs/DlTabs.vue +192 -0
  155. package/src/components/DlTabs/TabsWrapper.vue +104 -0
  156. package/src/components/DlTabs/index.ts +4 -0
  157. package/src/components/DlTabs/types.ts +8 -0
  158. package/src/components/DlTextArea.vue +151 -0
  159. package/src/components/DlTextHolder.vue +65 -0
  160. package/src/components/DlTextInput.vue +753 -0
  161. package/src/components/DlThemeProvider.vue +41 -0
  162. package/src/components/DlTimePicker/DlTimeCounter.vue +81 -0
  163. package/src/components/DlTimePicker/DlTimePicker.vue +151 -0
  164. package/src/components/DlTimePicker/DlTimePickerInput.vue +311 -0
  165. package/src/components/DlTimePicker/index.ts +3 -0
  166. package/src/components/DlTimePicker/types.ts +4 -0
  167. package/src/components/DlTooltip.vue +456 -0
  168. package/src/components/DlTrend.vue +97 -0
  169. package/src/components/DlTypography.vue +87 -0
  170. package/src/components/DlVirtualScroll/DlVirtualScroll.vue +290 -0
  171. package/src/components/DlVirtualScroll/index.ts +3 -0
  172. package/src/components/DlVirtualScroll/useVirtualScroll.ts +833 -0
  173. package/src/components/DlWidget/DlWidget.vue +50 -0
  174. package/src/components/DlWidget/DlWidgetGrid.vue +360 -0
  175. package/src/components/DlWidget/index.ts +4 -0
  176. package/src/components/DlWidget/types.ts +6 -0
  177. package/src/components/DlWidget/utils.ts +30 -0
  178. package/src/components/index.ts +118 -0
  179. package/src/demo/DlAccordionDemo.vue +60 -0
  180. package/src/demo/DlAlertDemo.vue +54 -0
  181. package/src/demo/DlAvatarDemo.vue +43 -0
  182. package/src/demo/DlBadgeDemo.vue +65 -0
  183. package/src/demo/DlButtonDemo.vue +266 -0
  184. package/src/demo/DlCheckboxDemo.vue +50 -0
  185. package/src/demo/DlChipDemo.vue +181 -0
  186. package/src/demo/DlColorPickerDemo.vue +43 -0
  187. package/src/demo/DlCounterDemo.vue +53 -0
  188. package/src/demo/DlDateTimeRangeDemo.vue +217 -0
  189. package/src/demo/DlDialogBoxDemo.vue +175 -0
  190. package/src/demo/DlDropdownButtonDemo.vue +260 -0
  191. package/src/demo/DlIconDemo.vue +47 -0
  192. package/src/demo/DlLinkDemo.vue +23 -0
  193. package/src/demo/DlListDemo.vue +177 -0
  194. package/src/demo/DlMenuDemo.vue +524 -0
  195. package/src/demo/DlOptionGroupDemo.vue +79 -0
  196. package/src/demo/DlPaginationDemo.vue +44 -0
  197. package/src/demo/DlPanelContainerDemo.vue +221 -0
  198. package/src/demo/DlPopupDemo.vue +58 -0
  199. package/src/demo/DlProgressBarDemo.vue +22 -0
  200. package/src/demo/DlProgressChartDemo.vue +71 -0
  201. package/src/demo/DlRadioDemo.vue +35 -0
  202. package/src/demo/DlRangeDemo.vue +44 -0
  203. package/src/demo/DlSearchDemo.vue +27 -0
  204. package/src/demo/DlSelectDemo.vue +355 -0
  205. package/src/demo/DlSkeletonDemo.vue +20 -0
  206. package/src/demo/DlSliderDemo.vue +47 -0
  207. package/src/demo/DlStepperDemo/CenteredStepperInDialogBox.vue +260 -0
  208. package/src/demo/DlStepperDemo/SimpleStepper.vue +202 -0
  209. package/src/demo/DlStepperDemo/StepperInDialogBox.vue +261 -0
  210. package/src/demo/DlStepperDemo/index.ts +5 -0
  211. package/src/demo/DlStepperDemo/steps/AssignmentsStep.vue +97 -0
  212. package/src/demo/DlStepperDemo/steps/DataStep.vue +158 -0
  213. package/src/demo/DlStepperDemo/steps/GeneralStep.vue +106 -0
  214. package/src/demo/DlStepperDemo/steps/InstructionStep.vue +176 -0
  215. package/src/demo/DlStepperDemo/steps/QualityStep.vue +65 -0
  216. package/src/demo/DlSwitchDemo.vue +49 -0
  217. package/src/demo/DlTableDemo.vue +475 -0
  218. package/src/demo/DlTabsDemo.vue +67 -0
  219. package/src/demo/DlTdDemo.vue +19 -0
  220. package/src/demo/DlTextAreaDemo.vue +37 -0
  221. package/src/demo/DlTextHolderDemo.vue +42 -0
  222. package/src/demo/DlTextInputDemo.vue +89 -0
  223. package/src/demo/DlThDemo.vue +32 -0
  224. package/src/demo/DlTooltipDemo.vue +60 -0
  225. package/src/demo/DlTrDemo.vue +18 -0
  226. package/src/demo/DlTrendDemo.vue +25 -0
  227. package/src/demo/DlTypographyDemo.vue +93 -0
  228. package/src/demo/DlWidgetDemo.vue +157 -0
  229. package/src/demo/SmartSearchDemo/DlSmartSearchDemo.vue +202 -0
  230. package/src/demo/SmartSearchDemo/schema.ts +44 -0
  231. package/src/demo/index.ts +141 -0
  232. package/src/directives/TouchPan.ts +525 -0
  233. package/src/env.d.ts +8 -0
  234. package/src/hooks/use-anchor.ts +223 -0
  235. package/src/hooks/use-model-toggle.ts +181 -0
  236. package/src/hooks/use-portal.ts +104 -0
  237. package/src/hooks/use-scroll-target.ts +53 -0
  238. package/src/hooks/use-size-observer.ts +24 -0
  239. package/src/hooks/use-suggestions.ts +355 -0
  240. package/src/hooks/use-tick.ts +32 -0
  241. package/src/hooks/use-timeout.ts +20 -0
  242. package/src/hooks/use-transition.ts +32 -0
  243. package/src/hooks/use-window-size.ts +25 -0
  244. package/src/hooks/useForm.ts +12 -0
  245. package/src/index.ts +7 -0
  246. package/src/main.ts +4 -0
  247. package/src/models.ts +4 -0
  248. package/src/types.ts +6 -0
  249. package/src/utils/calcs.ts +18 -0
  250. package/src/utils/click-outside.ts +108 -0
  251. package/src/utils/component-name-parser.ts +1 -0
  252. package/src/utils/css-color-names.ts +150 -0
  253. package/src/utils/dom.ts +55 -0
  254. package/src/utils/draggable-table.ts +416 -0
  255. package/src/utils/escape-key.ts +54 -0
  256. package/src/utils/events.ts +67 -0
  257. package/src/utils/focus-manager.ts +33 -0
  258. package/src/utils/focusout.ts +29 -0
  259. package/src/utils/format.ts +3 -0
  260. package/src/utils/getColor.ts +17 -0
  261. package/src/utils/getLighterGradient.ts +36 -0
  262. package/src/utils/getRootStyles.ts +52 -0
  263. package/src/utils/global-config.ts +6 -0
  264. package/src/utils/global-nodes.ts +42 -0
  265. package/src/utils/includes.ts +3 -0
  266. package/src/utils/index.ts +29 -0
  267. package/src/utils/inject-object-prop.ts +21 -0
  268. package/src/utils/input-sizes.ts +7 -0
  269. package/src/utils/is-ellipsis-active.ts +3 -0
  270. package/src/utils/is-in-viewport.ts +13 -0
  271. package/src/utils/is.ts +15 -0
  272. package/src/utils/key-composition.ts +17 -0
  273. package/src/utils/keyCodes.ts +12 -0
  274. package/src/utils/logger/ConsoleLogger.ts +65 -0
  275. package/src/utils/logger/ILogger.ts +8 -0
  276. package/src/utils/logger/index.ts +8 -0
  277. package/src/utils/nav-keys-constants.ts +1 -0
  278. package/src/utils/portal.ts +55 -0
  279. package/src/utils/position-engine.ts +381 -0
  280. package/src/utils/render.ts +36 -0
  281. package/src/utils/ripple.ts +7 -0
  282. package/src/utils/scroll.ts +73 -0
  283. package/src/utils/selection.ts +15 -0
  284. package/src/utils/sort.ts +7 -0
  285. package/src/utils/splitByQuotes.ts +32 -0
  286. package/src/utils/string.ts +6 -0
  287. package/src/utils/teleport.ts +14 -0
  288. package/src/utils/theme.ts +2 -0
  289. package/src/utils/vm.ts +16 -0
  290. package/storybook.js +8 -0
  291. package/tsconfig.json +44 -0
  292. package/tsconfig.node.json +8 -0
  293. package/types.ts +1 -0
  294. package/vite.config.ts +13 -0
@@ -0,0 +1,67 @@
1
+ export const listenOpts: Record<string, any> = {
2
+ hasPassive: false,
3
+ passiveCapture: true,
4
+ notPassiveCapture: true,
5
+ passive: false
6
+ }
7
+
8
+ export function stopAndPrevent(e: Event) {
9
+ if (e.cancelable) {
10
+ e.preventDefault()
11
+ }
12
+ e.stopPropagation()
13
+ }
14
+
15
+ export function leftClick(e: MouseEvent) {
16
+ return e.button === 0
17
+ }
18
+
19
+ export function position(e: any) {
20
+ if (e.touches && e.touches[0]) {
21
+ e = e.touches[0]
22
+ } else if (e.changedTouches && e.changedTouches[0]) {
23
+ e = e.changedTouches[0]
24
+ } else if (e.targetTouches && e.targetTouches[0]) {
25
+ e = e.targetTouches[0]
26
+ }
27
+
28
+ return {
29
+ top: e.clientY,
30
+ left: e.clientX
31
+ }
32
+ }
33
+
34
+ export function stop(e: Event) {
35
+ e.stopPropagation()
36
+ }
37
+
38
+ export function prevent(e: Event) {
39
+ if (e.cancelable === false) return
40
+
41
+ e.preventDefault()
42
+ }
43
+
44
+ export function addEvt(
45
+ ctx: Record<string, any>,
46
+ targetName: string,
47
+ events: any[][]
48
+ ) {
49
+ const name = `__dl_${targetName}_evt`
50
+
51
+ ctx[name] = ctx[name] !== void 0 ? ctx[name].concat(events) : events
52
+
53
+ events.forEach((evt: any[]) => {
54
+ evt[0].addEventListener(evt[1], ctx[evt[2]], listenOpts[evt[3]])
55
+ })
56
+ }
57
+
58
+ export function cleanEvt(ctx: Record<string, any>, targetName: string) {
59
+ const name = `__dl_${targetName}_evt`
60
+
61
+ if (ctx[name] !== void 0) {
62
+ ctx[name].forEach((evt: any[]) => {
63
+ evt[0].removeEventListener(evt[1], ctx[evt[2]], listenOpts[evt[3]])
64
+ })
65
+ ctx[name] = void 0
66
+ }
67
+ }
@@ -0,0 +1,33 @@
1
+ let queue: Function[] = []
2
+ let waitFlags: Object[] = []
3
+
4
+ function clearFlag(flag: Object) {
5
+ waitFlags = waitFlags.filter((entry) => entry !== flag)
6
+ }
7
+
8
+ export function addFocusWaitFlag(flag: Object) {
9
+ clearFlag(flag)
10
+ waitFlags.push(flag)
11
+ }
12
+
13
+ export function removeFocusWaitFlag(flag: Object) {
14
+ clearFlag(flag)
15
+
16
+ if (waitFlags.length === 0 && queue.length > 0) {
17
+ // only call last focus handler (can't focus multiple things at once)
18
+ queue[queue.length - 1]()
19
+ queue = []
20
+ }
21
+ }
22
+
23
+ export function addFocusFn(fn: Function) {
24
+ if (waitFlags.length === 0) {
25
+ fn()
26
+ } else {
27
+ queue.push(fn)
28
+ }
29
+ }
30
+
31
+ export function removeFocusFn(fn: Function) {
32
+ queue = queue.filter((entry) => entry !== fn)
33
+ }
@@ -0,0 +1,29 @@
1
+ import { isMobileOrTablet } from '.'
2
+
3
+ const handlers: Function[] = []
4
+
5
+ function trigger(e: Event) {
6
+ handlers[handlers.length - 1](e)
7
+ }
8
+
9
+ export function addFocusout(fn: Function) {
10
+ const isMobile = isMobileOrTablet()
11
+ if (!isMobile) {
12
+ handlers.push(fn)
13
+
14
+ if (handlers.length === 1) {
15
+ document.body.addEventListener('focusin', trigger)
16
+ }
17
+ }
18
+ }
19
+
20
+ export function removeFocusout(fn: Function) {
21
+ const index = handlers.indexOf(fn)
22
+ if (index > -1) {
23
+ handlers.splice(index, 1)
24
+
25
+ if (handlers.length === 0) {
26
+ document.body.removeEventListener('focusin', trigger)
27
+ }
28
+ }
29
+ }
@@ -0,0 +1,3 @@
1
+ export function between(v: any, min: number, max: number): number {
2
+ return max <= min ? min : Math.min(max, Math.max(min, v))
3
+ }
@@ -0,0 +1,17 @@
1
+ import { colorNames } from './css-color-names'
2
+ const CSS_COLOR_NAMES = [...Object.keys(colorNames)]
3
+
4
+ const regex =
5
+ /(?:#|0x)(?:[A-Fa-f0-9]{3}|[A-Fa-f0-9]{6})\b|(?:rgb|hsl)a?\([^\)]*\)/
6
+
7
+ const getColor = (color: string, fallback?: string) => {
8
+ if (regex.test(color) || CSS_COLOR_NAMES.includes(color?.toLowerCase())) {
9
+ return color
10
+ }
11
+
12
+ if (!color) return `var(--${fallback || 'dl-color-darker'})`
13
+
14
+ return `var(--${color}, var(--${fallback || 'dl-color-darker'}))`
15
+ }
16
+
17
+ export { getColor }
@@ -0,0 +1,36 @@
1
+ import { colorNames } from './css-color-names'
2
+ import { getRootStyles } from './getRootStyles'
3
+ const MAGNITUDE = 100
4
+
5
+ const allColorNames = {
6
+ ...colorNames,
7
+ ...getRootStyles()
8
+ }
9
+
10
+ const getLighterGradient = (color: string, magnitude = MAGNITUDE) => {
11
+ color = color.replace('dl', '--dl')
12
+ let newColor =
13
+ color in allColorNames
14
+ ? allColorNames[color as keyof typeof allColorNames]
15
+ : color
16
+ newColor = newColor.replace(`#`, ``).trim()
17
+
18
+ if (newColor.length === 6) {
19
+ const decimalColor = parseInt(newColor, 16)
20
+
21
+ let r = (decimalColor >> 16) + magnitude
22
+ if (r > 255) r = 255
23
+ if (r < 0) r = 0
24
+ let g = (decimalColor & 0x0000ff) + magnitude
25
+ if (g > 255) g = 255
26
+ if (g < 0) g = 0
27
+ let b = ((decimalColor >> 8) & 0x00ff) + magnitude
28
+ if (b > 255) b = 255
29
+ if (b < 0) b = 0
30
+ return `#${(g | (b << 8) | (r << 16)).toString(16)}`
31
+ } else {
32
+ return newColor
33
+ }
34
+ }
35
+
36
+ export { getLighterGradient }
@@ -0,0 +1,52 @@
1
+ function getAllCSSVariableNames(styleSheets = document.styleSheets) {
2
+ const cssVars = []
3
+ for (let i = 0; i < styleSheets.length; i++) {
4
+ try {
5
+ for (let j = 0; j < styleSheets[i].cssRules.length; j++) {
6
+ try {
7
+ for (
8
+ let k = 0;
9
+ k <
10
+ (styleSheets[i].cssRules[j] as CSSStyleRule).style
11
+ .length;
12
+ k++
13
+ ) {
14
+ const name = (
15
+ styleSheets[i].cssRules[j] as CSSStyleRule
16
+ ).style[k]
17
+ if (
18
+ name.startsWith('--') &&
19
+ cssVars.indexOf(name) == -1
20
+ ) {
21
+ cssVars.push(name)
22
+ }
23
+ }
24
+ } catch (error) {}
25
+ }
26
+ } catch (error) {}
27
+ }
28
+ return cssVars
29
+ }
30
+
31
+ function getElementCSSVariables(
32
+ allCSSVars: any,
33
+ element = document.body,
34
+ pseudo?: any
35
+ ) {
36
+ const elStyles = window.getComputedStyle(element, pseudo)
37
+ const cssVars = {}
38
+ for (let i = 0; i < allCSSVars.length; i++) {
39
+ const key = allCSSVars[i]
40
+ const value = elStyles.getPropertyValue(key)
41
+ if (value) {
42
+ //@ts-ignore
43
+ cssVars[key] = value
44
+ }
45
+ }
46
+ return cssVars
47
+ }
48
+
49
+ export function getRootStyles() {
50
+ const cssVars = getAllCSSVariableNames()
51
+ return getElementCSSVariables(cssVars, document.documentElement)
52
+ }
@@ -0,0 +1,6 @@
1
+ export const globalConfig: Record<string, any> = {}
2
+ export let globalConfigIsFrozen = false
3
+
4
+ export function freezeGlobalConfig() {
5
+ globalConfigIsFrozen = true
6
+ }
@@ -0,0 +1,42 @@
1
+ import { globalConfig } from './global-config'
2
+
3
+ const globalNodes: HTMLElement[] = []
4
+ let target = document.body
5
+
6
+ export function createGlobalNode(id: string | null = null) {
7
+ const el: HTMLElement = document.createElement('div')
8
+ el.setAttribute('data-test-id', 'portal')
9
+
10
+ if (id) {
11
+ el.id = id
12
+ }
13
+
14
+ if (globalConfig.globalNodes !== void 0) {
15
+ const cls = globalConfig.globalNodes.class
16
+ if (cls !== void 0) {
17
+ el.className = cls
18
+ }
19
+ }
20
+
21
+ target.appendChild(el)
22
+ globalNodes.push(el)
23
+
24
+ return el
25
+ }
26
+
27
+ export function removeGlobalNode(el: HTMLElement) {
28
+ globalNodes.splice(globalNodes.indexOf(el), 1)
29
+ el.remove()
30
+ }
31
+
32
+ export function changeGlobalNodesTarget(el: HTMLElement) {
33
+ if (el !== target) {
34
+ target = el
35
+
36
+ globalNodes.forEach((el) => {
37
+ if (el.contains(target) === false) {
38
+ target.appendChild(el)
39
+ }
40
+ })
41
+ }
42
+ }
@@ -0,0 +1,3 @@
1
+ export function includes<T extends U, U>(coll: readonly T[], el: U): el is T {
2
+ return coll.includes(el as T)
3
+ }
@@ -0,0 +1,29 @@
1
+ export * from './logger'
2
+ export * from './calcs'
3
+ export * from './events'
4
+ export * from './getColor'
5
+ export * from './includes'
6
+ export * from './keyCodes'
7
+ export * from './ripple'
8
+ export * from './selection'
9
+ export * from './theme'
10
+ export * from './format'
11
+ export * from './render'
12
+ export * from './component-name-parser'
13
+
14
+ export const isMobileOrTablet = () => {
15
+ let check = false
16
+ ;(function (a) {
17
+ if (
18
+ /(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i.test(
19
+ a
20
+ ) ||
21
+ /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(
22
+ a.substr(0, 4)
23
+ )
24
+ )
25
+ check = true
26
+ // @ts-ignore
27
+ })(navigator.userAgent || navigator.vendor || window.opera)
28
+ return check
29
+ }
@@ -0,0 +1,21 @@
1
+ export function injectProp(
2
+ target: Record<string, any>,
3
+ propName: string,
4
+ get: () => any,
5
+ set?: (val: any, evt?: any) => void
6
+ ) {
7
+ Object.defineProperty(target, propName, {
8
+ get,
9
+ set,
10
+ enumerable: true
11
+ })
12
+ }
13
+
14
+ export function injectMultipleProps(
15
+ target: Record<string, any>,
16
+ props: Record<string, any>
17
+ ) {
18
+ for (const key in props) {
19
+ injectProp(target, key, props[key])
20
+ }
21
+ }
@@ -0,0 +1,7 @@
1
+ export const InputSizes = {
2
+ l: 'l',
3
+ m: 'm',
4
+ s: 's'
5
+ } as const
6
+
7
+ export type TInputSizes = typeof InputSizes[keyof typeof InputSizes]
@@ -0,0 +1,3 @@
1
+ export const isEllipsisActive = (e: Element) => {
2
+ return (e as HTMLElement).offsetWidth < e.scrollWidth
3
+ }
@@ -0,0 +1,13 @@
1
+ const isInViewport = (element: Element) => {
2
+ const rect = element.getBoundingClientRect()
3
+ return (
4
+ rect.top >= 0 &&
5
+ rect.left >= 0 &&
6
+ rect.bottom <=
7
+ (window.innerHeight || document.documentElement.clientHeight) &&
8
+ rect.right <=
9
+ (window.innerWidth || document.documentElement.clientWidth)
10
+ )
11
+ }
12
+
13
+ export { isInViewport }
@@ -0,0 +1,15 @@
1
+ export function isObject(v: any) {
2
+ return v !== null && typeof v === 'object' && Array.isArray(v) !== true
3
+ }
4
+
5
+ export function isDate(v: any) {
6
+ return Object.prototype.toString.call(v) === '[object Date]'
7
+ }
8
+
9
+ export function isRegexp(v: any) {
10
+ return Object.prototype.toString.call(v) === '[object RegExp]'
11
+ }
12
+
13
+ export function isNumber(v: any) {
14
+ return typeof v === 'number' && isFinite(v)
15
+ }
@@ -0,0 +1,17 @@
1
+ let lastKeyCompositionStatus = false
2
+
3
+ export function shouldIgnoreKey(evt: KeyboardEvent) {
4
+ return (
5
+ lastKeyCompositionStatus ||
6
+ evt !== Object(evt) ||
7
+ evt.isComposing === true
8
+ )
9
+ }
10
+
11
+ export function isKeyCode(evt: KeyboardEvent, keyCodes: number) {
12
+ return shouldIgnoreKey(evt) ? false : [keyCodes].includes(evt.keyCode)
13
+ }
14
+
15
+ export function onKeyDownComposition(evt: KeyboardEvent) {
16
+ lastKeyCompositionStatus = evt.isComposing === true
17
+ }
@@ -0,0 +1,12 @@
1
+ export const KEY_CODE = {
2
+ PGDOWN: 34,
3
+ LEFT: 37,
4
+ DOWN: 40,
5
+ PGUP: 33,
6
+ RIGHT: 39,
7
+ UP: 38
8
+ } as const
9
+
10
+ export type KEY_CODE = typeof KEY_CODE[keyof typeof KEY_CODE]
11
+
12
+ export const keyCodes = Object.values(KEY_CODE)
@@ -0,0 +1,65 @@
1
+ import { isVue2 } from 'vue-demi'
2
+ import { ILogger } from './ILogger'
3
+
4
+ export enum logLevels {
5
+ NON = 'non',
6
+ ERROR = 'error',
7
+ WARN = 'warn',
8
+ INFO = 'info',
9
+ DEBUG = 'debug'
10
+ }
11
+ export class ConsoleLogger extends ILogger {
12
+ public static LOG_LEVEL: logLevels = logLevels.DEBUG
13
+
14
+ private _shouldLogLevel(logLevel: logLevels): boolean {
15
+ const logLevelOrder = [
16
+ logLevels.NON,
17
+ logLevels.ERROR,
18
+ logLevels.WARN,
19
+ logLevels.INFO,
20
+ logLevels.DEBUG
21
+ ]
22
+ return (
23
+ logLevelOrder.indexOf(logLevel) <=
24
+ logLevelOrder.indexOf(ConsoleLogger.LOG_LEVEL)
25
+ )
26
+ }
27
+
28
+ constructor(loggerName: string) {
29
+ super(loggerName)
30
+ }
31
+ private _timestamp() {
32
+ return new Date().toISOString()
33
+ }
34
+ private _logMessage(level: string, message: string, metadata: any) {
35
+ message = `[${this._timestamp()}] [${this._name}] - ${message}`
36
+ if (metadata) {
37
+ // @ts-ignore
38
+ console[level](message, metadata)
39
+ } else {
40
+ // @ts-ignore
41
+ console[level](message)
42
+ }
43
+ }
44
+
45
+ public debug(message: string, metadata?: any) {
46
+ if (this._shouldLogLevel(logLevels.DEBUG)) {
47
+ this._logMessage('debug', message, metadata)
48
+ }
49
+ }
50
+ public info(message: string, metadata?: any) {
51
+ if (this._shouldLogLevel(logLevels.INFO)) {
52
+ this._logMessage('log', message, metadata)
53
+ }
54
+ }
55
+ public warn(message: string, metadata?: any) {
56
+ if (this._shouldLogLevel(logLevels.WARN)) {
57
+ this._logMessage('warn', message, metadata)
58
+ }
59
+ }
60
+ public error(message: string, metadata?: any) {
61
+ if (this._shouldLogLevel(logLevels.ERROR)) {
62
+ this._logMessage('error', message, metadata)
63
+ }
64
+ }
65
+ }
@@ -0,0 +1,8 @@
1
+ export abstract class ILogger {
2
+ protected constructor(protected _name: string) {}
3
+
4
+ public abstract debug(message: string, ...metadata: any[]): void
5
+ public abstract info(message: string, ...metadata: any[]): void
6
+ public abstract warn(message: string, ...metadata: any[]): void
7
+ public abstract error(message: string, ...metadata: any[]): void
8
+ }
@@ -0,0 +1,8 @@
1
+ import { ILogger } from './ILogger'
2
+ import { ConsoleLogger } from './ConsoleLogger'
3
+ import { isVue2 } from 'vue-demi'
4
+
5
+ export { ILogger }
6
+
7
+ export const loggerFactory = (loggerName: string): ILogger =>
8
+ new ConsoleLogger(loggerName)
@@ -0,0 +1 @@
1
+ export const admissibleKeys = ['Backspace', 'Delete', 'ArrowDown', 'ArrowUp']
@@ -0,0 +1,55 @@
1
+ import { getParentVm } from './vm'
2
+
3
+ export const portalList: any = []
4
+
5
+ export function getPortalVm(el: HTMLElement) {
6
+ return portalList.find(
7
+ (vm: any) =>
8
+ vm.__dlPortalInnerRef.value !== null &&
9
+ vm.__dlPortalInnerRef.value.contains(el)
10
+ )
11
+ }
12
+
13
+ export function closePortalMenus(vm: any, evt: Event) {
14
+ do {
15
+ if (vm.$options.name === 'DlMenu') {
16
+ vm.hide(evt)
17
+
18
+ // is this a point of separation?
19
+ if (vm.$props.separateClosePopup === true) {
20
+ return getParentVm(vm)
21
+ }
22
+ } else if (vm.__dlPortalInnerRef !== void 0) {
23
+ // treat it as point of separation if parent is DlPopupProxy
24
+ // (so mobile matches desktop behavior)
25
+ // and hide it too
26
+ const parent = getParentVm(vm)
27
+
28
+ if (parent !== void 0 && parent.$options.name === 'DlPopupProxy') {
29
+ vm.hide(evt)
30
+ return parent
31
+ } else {
32
+ return vm
33
+ }
34
+ }
35
+
36
+ vm = getParentVm(vm)
37
+ } while (vm !== void 0 && vm !== null)
38
+ }
39
+
40
+ export function closePortals(vm: any, evt: Event, depth: number) {
41
+ while (depth !== 0 && vm !== void 0 && vm !== null) {
42
+ if (vm.__dlPortalInnerRef !== void 0) {
43
+ depth--
44
+
45
+ if (vm.$options.name === 'DlMenu') {
46
+ vm = closePortalMenus(vm, evt)
47
+ continue
48
+ }
49
+
50
+ vm.hide(evt)
51
+ }
52
+
53
+ vm = getParentVm(vm)
54
+ }
55
+ }