@demos-europe/demosplan-ui 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (133) hide show
  1. package/LICENSE +21 -0
  2. package/buildTokens.js +59 -0
  3. package/components/DpButton/DpButton.stories.mdx +136 -0
  4. package/components/DpButton/DpButton.vue +118 -0
  5. package/components/DpDetails/DpDetails.stories.mdx +55 -0
  6. package/components/DpDetails/DpDetails.vue +58 -0
  7. package/components/DpIcon/DpIcon.stories.mdx +396 -0
  8. package/components/DpIcon/DpIcon.vue +51 -0
  9. package/components/DpIcon/util/iconVariables.js +148 -0
  10. package/components/DpInput/DpInput.stories.mdx +127 -0
  11. package/components/DpInput/DpInput.vue +284 -0
  12. package/components/DpLabel/DpLabel.stories.mdx +103 -0
  13. package/components/DpLabel/DpLabel.vue +112 -0
  14. package/components/DpLoading/DpLoading.stories.mdx +63 -0
  15. package/components/DpLoading/DpLoading.vue +63 -0
  16. package/components/core/DpAccordion.vue +108 -0
  17. package/components/core/DpAnonymizeText.vue +136 -0
  18. package/components/core/DpAutocomplete.vue +133 -0
  19. package/components/core/DpBulkEditHeader.vue +53 -0
  20. package/components/core/DpButtonIcon.vue +47 -0
  21. package/components/core/DpButtonRow.vue +155 -0
  22. package/components/core/DpCard.vue +54 -0
  23. package/components/core/DpChangeStateAtDate.vue +223 -0
  24. package/components/core/DpCheckboxGroup.vue +93 -0
  25. package/components/core/DpContextualHelp.vue +54 -0
  26. package/components/core/DpCopyPasteButton.vue +47 -0
  27. package/components/core/DpDashboardTaskCard.vue +123 -0
  28. package/components/core/DpDataTable/DataTableSearch.js +44 -0
  29. package/components/core/DpDataTable/DpColumnSelector.vue +133 -0
  30. package/components/core/DpDataTable/DpDataTable.vue +647 -0
  31. package/components/core/DpDataTable/DpDataTableExtended.vue +377 -0
  32. package/components/core/DpDataTable/DpResizeHandle.vue +37 -0
  33. package/components/core/DpDataTable/DpSelectPageItemCount.vue +70 -0
  34. package/components/core/DpDataTable/DpTableHeader.vue +197 -0
  35. package/components/core/DpDataTable/DpTableRow.vue +355 -0
  36. package/components/core/DpDataTable/DpWrapTrigger.vue +48 -0
  37. package/components/core/DpDataTable/lib/ResizableColumns.js +83 -0
  38. package/components/core/DpEditableList.vue +161 -0
  39. package/components/core/DpEditor/DpBoilerPlate.vue +140 -0
  40. package/components/core/DpEditor/DpBoilerPlateModal.vue +166 -0
  41. package/components/core/DpEditor/DpEditor.vue +1281 -0
  42. package/components/core/DpEditor/DpLinkModal.vue +117 -0
  43. package/components/core/DpEditor/DpRecommendationModal/DpInsertableRecommendation.vue +137 -0
  44. package/components/core/DpEditor/DpRecommendationModal.vue +283 -0
  45. package/components/core/DpEditor/DpResizableImage.vue +121 -0
  46. package/components/core/DpEditor/DpUploadModal.vue +121 -0
  47. package/components/core/DpEditor/libs/Decoration.js +66 -0
  48. package/components/core/DpEditor/libs/SegmentRangeChangePlugin.js +35 -0
  49. package/components/core/DpEditor/libs/editorAnonymize.js +66 -0
  50. package/components/core/DpEditor/libs/editorBuildSuggestion.js +269 -0
  51. package/components/core/DpEditor/libs/editorCustomDelete.js +32 -0
  52. package/components/core/DpEditor/libs/editorCustomImage.js +100 -0
  53. package/components/core/DpEditor/libs/editorCustomInsert.js +32 -0
  54. package/components/core/DpEditor/libs/editorCustomLink.js +46 -0
  55. package/components/core/DpEditor/libs/editorCustomMark.js +32 -0
  56. package/components/core/DpEditor/libs/editorInsertAtCursorPos.js +41 -0
  57. package/components/core/DpEditor/libs/editorObscure.js +60 -0
  58. package/components/core/DpEditor/libs/editorUnAnonymize.js +56 -0
  59. package/components/core/DpEditor/libs/handleWordPaste.js +360 -0
  60. package/components/core/DpEditor/libs/preventDrop.js +31 -0
  61. package/components/core/DpEditor/libs/preventKeyboardInput.js +27 -0
  62. package/components/core/DpEditor/libs/preventPaste.js +28 -0
  63. package/components/core/DpFlyout.vue +119 -0
  64. package/components/core/DpInlineNotification.vue +116 -0
  65. package/components/core/DpModal.vue +208 -0
  66. package/components/core/DpObscure.vue +29 -0
  67. package/components/core/DpPager.vue +139 -0
  68. package/components/core/DpProgressBar.vue +67 -0
  69. package/components/core/DpRegisterFlyout.vue +58 -0
  70. package/components/core/DpResettableInput.vue +140 -0
  71. package/components/core/DpSkeletonBox.vue +32 -0
  72. package/components/core/DpSlidebar.vue +86 -0
  73. package/components/core/DpSlidingPagination.vue +45 -0
  74. package/components/core/DpSplitButton.vue +77 -0
  75. package/components/core/DpSwitcher.vue +62 -0
  76. package/components/core/DpTableCardList/DpTableCard.vue +61 -0
  77. package/components/core/DpTableCardList/DpTableCardListHeader.vue +83 -0
  78. package/components/core/DpTabs/DpTab.vue +52 -0
  79. package/components/core/DpTabs/DpTabs.vue +165 -0
  80. package/components/core/DpTextWrapper.vue +65 -0
  81. package/components/core/DpToggleForm.vue +72 -0
  82. package/components/core/DpTooltipIcon.vue +52 -0
  83. package/components/core/DpTransitionExpand.vue +87 -0
  84. package/components/core/DpTreeList/DpTreeList.vue +334 -0
  85. package/components/core/DpTreeList/DpTreeListCheckbox.vue +79 -0
  86. package/components/core/DpTreeList/DpTreeListNode.vue +348 -0
  87. package/components/core/DpTreeList/DpTreeListToggle.vue +71 -0
  88. package/components/core/DpTreeList/utils/constants.js +14 -0
  89. package/components/core/DpUpload/DpUpload.vue +223 -0
  90. package/components/core/DpUpload/DpUploadFiles.vue +269 -0
  91. package/components/core/DpUpload/DpUploadedFile.vue +80 -0
  92. package/components/core/DpUpload/DpUploadedFileList.vue +56 -0
  93. package/components/core/DpUpload/utils/GetFileIdsByHash.js +42 -0
  94. package/components/core/DpUpload/utils/UppyTranslations.js +31 -0
  95. package/components/core/DpVideoPlayer.vue +115 -0
  96. package/components/core/HeightLimit.vue +121 -0
  97. package/components/core/MultistepNav.vue +89 -0
  98. package/components/core/form/DpCheckbox.vue +108 -0
  99. package/components/core/form/DpDateRangePicker.vue +186 -0
  100. package/components/core/form/DpDatepicker.vue +160 -0
  101. package/components/core/form/DpDatetimePicker.vue +194 -0
  102. package/components/core/form/DpFormRow.vue +79 -0
  103. package/components/core/form/DpMultiselect.vue +164 -0
  104. package/components/core/form/DpRadio.vue +128 -0
  105. package/components/core/form/DpSearchField.vue +110 -0
  106. package/components/core/form/DpSelect.vue +149 -0
  107. package/components/core/form/DpTextArea.vue +152 -0
  108. package/components/core/form/DpTimePicker.vue +374 -0
  109. package/components/core/form/DpToggle.vue +78 -0
  110. package/components/core/index.js +132 -0
  111. package/components/core/notify/DpNotifyContainer.vue +122 -0
  112. package/components/core/notify/DpNotifyMessage.vue +95 -0
  113. package/components/core/shared/DpStickyElement.vue +95 -0
  114. package/components/index.js +24 -0
  115. package/components/shared/translations.js +15 -0
  116. package/directives/CleanHtml/CleanHtml.js +50 -0
  117. package/directives/CleanHtml/CleanHtml.stories.mdx +64 -0
  118. package/directives/Tooltip/Tooltip.js +40 -0
  119. package/directives/Tooltip/Tooltip.stories.mdx +42 -0
  120. package/directives/index.js +17 -0
  121. package/lib/index.js +14 -0
  122. package/lib/prefixClass.js +47 -0
  123. package/mixins/index.js +14 -0
  124. package/mixins/prefixClassMixin.js +22 -0
  125. package/package.json +52 -0
  126. package/shared/props.js +86 -0
  127. package/style/index.css +7 -0
  128. package/tailwind.config.js +24 -0
  129. package/tokens/color.json +358 -0
  130. package/tokens/color.stories.mdx +45 -0
  131. package/tokens/fontSize.json +100 -0
  132. package/tokens/space.json +33 -0
  133. package/utils/lengthHint.js +69 -0
@@ -0,0 +1,40 @@
1
+ /**
2
+ * (c) 2010-present DEMOS E-Partizipation GmbH.
3
+ *
4
+ * This file is part of the package @demos-europe/demosplan-ui,
5
+ * for more information see the license file.
6
+ *
7
+ * All rights reserved
8
+ */
9
+
10
+ import { VPopover, VTooltip } from 'v-tooltip'
11
+
12
+ /*
13
+ * Merge custom config into default options for tooltip config.
14
+ * The non-vue tooltip lib also uses tooltip.js, both have to be in sync.
15
+ */
16
+ const tooltipConfig = {
17
+ defaultHtml: true,
18
+ defaultBoundariesElement: 'scrollParent',
19
+ defaultDelay: {
20
+ show: 300,
21
+ hide: 100
22
+ },
23
+ defaultTemplate: '<div class="tooltip" role="tooltip"><div class="tooltip__arrow"></div><div class="tooltip__inner"></div></div>',
24
+ popover: {
25
+ defaultPlacement: 'top',
26
+ defaultBaseClass: 'tooltip',
27
+ defaultInnerClass: 'tooltip__inner',
28
+ defaultArrowClass: 'tooltip__arrow',
29
+ defaultDelay: {
30
+ show: 300,
31
+ hide: 100
32
+ },
33
+ defaultTrigger: 'hover'
34
+ }
35
+ }
36
+ VTooltip.options = { ...VTooltip.options, ...tooltipConfig }
37
+ VPopover.options = { ...VPopover.options, ...tooltipConfig }
38
+ const Tooltip = VTooltip
39
+
40
+ export { VPopover, Tooltip }
@@ -0,0 +1,42 @@
1
+ import { Meta } from '@storybook/addon-docs'
2
+
3
+ <Meta
4
+ title="Directives/Tooltip"
5
+ parameters={{
6
+ viewMode: 'docs',
7
+ previewTabs: {
8
+ canvas: {
9
+ hidden: true
10
+ }
11
+ },
12
+ }} />
13
+
14
+ # Tooltip
15
+
16
+ This directive adds a tooltip to the element it is used on.
17
+
18
+ ## Simple usage
19
+
20
+ ```html
21
+ <template>
22
+ <div>
23
+ <i
24
+ class="fa fa-question-circle float--right u-mt-0_125"
25
+ v-tooltip="`some text to display in a tooltip`" />
26
+ </div>
27
+ </template>
28
+ <script>
29
+ import { Tooltip } from 'demosplan-ui/directives'
30
+
31
+ export default {
32
+ name: 'MyComponent',
33
+
34
+ directives: {
35
+ tooltip: Tooltip
36
+ },
37
+
38
+ //...
39
+ }
40
+
41
+ </script>
42
+ ```
@@ -0,0 +1,17 @@
1
+ /**
2
+ * (c) 2010-present DEMOS E-Partizipation GmbH.
3
+ *
4
+ * This file is part of the package @demos-europe/demosplan-ui,
5
+ * for more information see the license file.
6
+ *
7
+ * All rights reserved
8
+ */
9
+
10
+ import { Tooltip, VPopover } from './Tooltip/Tooltip'
11
+ import { CleanHtml } from './CleanHtml/CleanHtml'
12
+
13
+ export {
14
+ CleanHtml,
15
+ Tooltip,
16
+ VPopover
17
+ }
package/lib/index.js ADDED
@@ -0,0 +1,14 @@
1
+ /**
2
+ * (c) 2010-present DEMOS E-Partizipation GmbH.
3
+ *
4
+ * This file is part of the package @demos-europe/demosplan-ui,
5
+ * for more information see the license file.
6
+ *
7
+ * All rights reserved
8
+ */
9
+
10
+ import prefixClass from './prefixClass'
11
+
12
+ export {
13
+ prefixClass
14
+ }
@@ -0,0 +1,47 @@
1
+ /**
2
+ * (c) 2010-present DEMOS E-Partizipation GmbH.
3
+ *
4
+ * This file is part of the package @demos-europe/demosplan-ui,
5
+ * for more information see the license file.
6
+ *
7
+ * All rights reserved
8
+ */
9
+
10
+ /**
11
+ * Prefix css classes with a parameter given from the project settings
12
+ *
13
+ * @param {String} classList or querySelector
14
+ *
15
+ * @return {String} prefixed classList
16
+ */
17
+ export default function prefixClass (classList = '') {
18
+ let prefix = ''
19
+ if (typeof dplan !== 'undefined' && dplan.settings && dplan.settings.publicCSSClassPrefix) {
20
+ prefix = dplan.settings.publicCSSClassPrefix
21
+ }
22
+
23
+ let prefixed = ''
24
+
25
+ // Don't try to do something if the result should not change
26
+ if (prefix === '') {
27
+ return classList
28
+ }
29
+
30
+ // Throw error if the type is wrong
31
+ if (typeof classList !== 'string') {
32
+ throw new Error('classList is an' + typeof classList + '. should be String.', classList)
33
+ }
34
+
35
+ /*
36
+ * Assuming that a querySelector is passed when classList contains a dot, only the class selector parts are prefixed.
37
+ * In the unlikely case that classes contain dots as part of their names, they will not be prefixed.
38
+ */
39
+ const checkClassList = /[.#[]/gi
40
+ if (checkClassList.test(classList)) {
41
+ prefixed = classList.replace(/(\.)(\S+)/gi, (cl, m1, m2) => `.${prefix}${m2}`)
42
+ } else {
43
+ prefixed = classList.replace(/(\S+)/gi, cl => `${prefix}${cl}`)
44
+ }
45
+
46
+ return prefixed
47
+ }
@@ -0,0 +1,14 @@
1
+ /**
2
+ * (c) 2010-present DEMOS E-Partizipation GmbH.
3
+ *
4
+ * This file is part of the package @demos-europe/demosplan-ui,
5
+ * for more information see the license file.
6
+ *
7
+ * All rights reserved
8
+ */
9
+
10
+ import prefixClassMixin from './prefixClassMixin'
11
+
12
+ export {
13
+ prefixClassMixin
14
+ }
@@ -0,0 +1,22 @@
1
+ /**
2
+ * (c) 2010-present DEMOS E-Partizipation GmbH.
3
+ *
4
+ * This file is part of the package @demos-europe/demosplan-ui,
5
+ * for more information see the license file.
6
+ *
7
+ * All rights reserved
8
+ */
9
+
10
+ /**
11
+ * This mixin can be to provide the prefixClass method and a prop to control when to prefix and when not.
12
+ *
13
+ */
14
+ import prefixClass from '../lib/prefixClass'
15
+
16
+ export default {
17
+ methods: {
18
+ prefixClass (classList) {
19
+ return prefixClass(classList)
20
+ }
21
+ }
22
+ }
package/package.json ADDED
@@ -0,0 +1,52 @@
1
+ {
2
+ "name": "@demos-europe/demosplan-ui",
3
+ "version": "0.0.1",
4
+ "license": "MIT",
5
+ "private": false,
6
+ "description": "Vue components, Vue directives, Design Token and Scss files to build interfaces for demosPlan.",
7
+ "dependencies": {
8
+ "@braintree/sanitize-url": "^6.0.1",
9
+ "@uppy/core": "^3.0.1",
10
+ "@uppy/drag-drop": "^3.0.0",
11
+ "@uppy/progress-bar": "^3.0.0",
12
+ "@uppy/tus": "^3.0.1",
13
+ "a11y-datepicker": " ^0.9.0",
14
+ "dayjs": "^1.11.5",
15
+ "dompurify": "^2.4.0",
16
+ "ismobilejs": "^1.1.1",
17
+ "lscache": "^1.3.2",
18
+ "plyr": "^3.7.2",
19
+ "style-dictionary": "^3.7.1",
20
+ "tailwindcss": "^3.2.1",
21
+ "tippy.js": "^6.3.7",
22
+ "tiptap": "^1.32.2",
23
+ "tiptap-commands": "^1.17.0",
24
+ "tiptap-extensions": "^1.35.2",
25
+ "uuid": "^9.0.0",
26
+ "v-tooltip": "2.1.3",
27
+ "vue-click-outside": "^1.1.0",
28
+ "vue-multiselect": "^2.1.6",
29
+ "vue-omnibox": "^0.3.7",
30
+ "vue-sliding-pagination": "^1.3.2",
31
+ "vuedraggable": "^2.24.3",
32
+ "vuex": "^3.6.2"
33
+ },
34
+ "devDependencies": {
35
+ "@babel/core": "^7.19.3",
36
+ "@storybook/addon-actions": "6.5.13",
37
+ "@storybook/addon-docs": "6.5.13",
38
+ "@storybook/addon-essentials": "6.5.12",
39
+ "@storybook/addon-links": "6.5.12",
40
+ "@storybook/vue": "6.5.12",
41
+ "babel-loader": "^8.2.5",
42
+ "js-beautify": "^1.14.7",
43
+ "vue-loader": "^15.9.8"
44
+ },
45
+ "scripts": {
46
+ "build-css": "tailwindcss -i ./style/index.css -o ./style/style.css",
47
+ "build-storybook": "build-storybook",
48
+ "build-tokens": "node buildTokens.js",
49
+ "preinstall": "yarn build-tokens",
50
+ "storybook": "start-storybook -p 6006"
51
+ }
52
+ }
@@ -0,0 +1,86 @@
1
+ /**
2
+ * (c) 2010-present DEMOS E-Partizipation GmbH.
3
+ *
4
+ * This file is part of the package @demos-europe/demosplan-ui,
5
+ * for more information see the license file.
6
+ *
7
+ * All rights reserved
8
+ */
9
+
10
+ /**
11
+ * Props that are shared between multiple Vue form components.
12
+ *
13
+ * The prop `maxlength` is implemented as a factory function with no params - actually it could also be
14
+ * a simple object. However, since we tend to copy and paste, and to path a way for future expansion
15
+ * of this pattern, it should be mentioned that crafting dynamic prop definitions is possible like so:
16
+ *
17
+ * ```
18
+ * // In this file...
19
+ * const myProp = (param = defaultValue) => {
20
+ * // ...define prop
21
+ * }
22
+ * // In the component...
23
+ * import { myProp } from 'demosplan-ui/shared/props'
24
+ * props: {
25
+ * myProp: myProp('otherValue'),
26
+ * }
27
+ * ```
28
+ */
29
+
30
+ /**
31
+ * Can be used e.g for maxLength to Limit the maximum allowed number of characters to the given amount.
32
+ * If set, it renders a hint with a counter of the characters yet available.
33
+ *
34
+ * The type may be Boolean just to allow for the falsy default (making it possible to pass it down
35
+ * to the actual textarea element without further transformation), or String (but containing an integer),
36
+ * to not be forced to transform it to int in every template with `:maxlength="'<Number>'"`.
37
+ */
38
+ const length = () => {
39
+ return {
40
+ type: [Boolean, String],
41
+ required: false,
42
+ default: false,
43
+ validator: (string) => {
44
+ /*
45
+ * The `string !== true` check actually tests for the empty string being passed
46
+ * to the property, which internally is converted to the boolean "true". That way,
47
+ * using the `maxlength` attr without assigning a value to it throws an error.
48
+ * On the other hand it should not be possible to pass values that can't be
49
+ * converted into a whole number.
50
+ */
51
+ return string !== true && Number(string) % 1 === 0
52
+ }
53
+ }
54
+ }
55
+
56
+ /**
57
+ * Allows passing of additional attributes into the inner form element. Only chosen elements
58
+ * are allowed for each element type, failing if at least one attribute is not allowed within the array.
59
+ *
60
+ * Attributes are specified like `:attributes="['attrName1=attrValue1', 'attrName2=attrValue2']"`.
61
+ *
62
+ * @param {String} element Type of element
63
+ */
64
+ const attributes = element => {
65
+ const allowed = {
66
+ textarea: ['cols', 'rows']
67
+ }
68
+ return {
69
+ type: Array,
70
+ required: false,
71
+ default: () => [],
72
+ validator: applied => {
73
+ const allowedApplied = applied.filter(attr => {
74
+ const attrArr = attr.split('=')
75
+ return allowed[element].includes(attrArr[0]) && attrArr.length === 2
76
+ })
77
+ if (applied.length === 0 || allowedApplied.length === applied.length) {
78
+ return true
79
+ } else {
80
+ console.error(`A Vue form component of type "${element}" is used with the "attributes" prop containing a disallowed attr.`)
81
+ }
82
+ }
83
+ }
84
+ }
85
+
86
+ export { attributes, length }
@@ -0,0 +1,7 @@
1
+ /**
2
+ * @noinspection
3
+ * PHPStorm complains about unset css vars in rendered css. This is irritating and can be suppressed.
4
+ */
5
+ @tailwind base;
6
+ @tailwind components;
7
+ @tailwind utilities;
@@ -0,0 +1,24 @@
1
+ /**
2
+ * (c) 2010-present DEMOS E-Partizipation GmbH.
3
+ *
4
+ * This file is part of the package @demos-europe/demosplan-ui,
5
+ * for more information see the license file.
6
+ *
7
+ * All rights reserved
8
+ */
9
+
10
+ module.exports = {
11
+ content: ['./components/**/*.{js,vue}', './directives/**/*.js'],
12
+ corePlugins: {
13
+ preflight: false // Enable later when removing demosplan base styles. See https://tailwindcss.com/docs/preflight
14
+ },
15
+ plugins: [],
16
+ safelist: [
17
+ {
18
+ pattern: /./// Disable purging https://github.com/tailwindlabs/tailwindcss/discussions/6557#discussioncomment-1838214
19
+ }
20
+ ],
21
+ theme: {
22
+ extend: {}
23
+ }
24
+ }