@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.
- package/LICENSE +21 -0
- package/buildTokens.js +59 -0
- package/components/DpButton/DpButton.stories.mdx +136 -0
- package/components/DpButton/DpButton.vue +118 -0
- package/components/DpDetails/DpDetails.stories.mdx +55 -0
- package/components/DpDetails/DpDetails.vue +58 -0
- package/components/DpIcon/DpIcon.stories.mdx +396 -0
- package/components/DpIcon/DpIcon.vue +51 -0
- package/components/DpIcon/util/iconVariables.js +148 -0
- package/components/DpInput/DpInput.stories.mdx +127 -0
- package/components/DpInput/DpInput.vue +284 -0
- package/components/DpLabel/DpLabel.stories.mdx +103 -0
- package/components/DpLabel/DpLabel.vue +112 -0
- package/components/DpLoading/DpLoading.stories.mdx +63 -0
- package/components/DpLoading/DpLoading.vue +63 -0
- package/components/core/DpAccordion.vue +108 -0
- package/components/core/DpAnonymizeText.vue +136 -0
- package/components/core/DpAutocomplete.vue +133 -0
- package/components/core/DpBulkEditHeader.vue +53 -0
- package/components/core/DpButtonIcon.vue +47 -0
- package/components/core/DpButtonRow.vue +155 -0
- package/components/core/DpCard.vue +54 -0
- package/components/core/DpChangeStateAtDate.vue +223 -0
- package/components/core/DpCheckboxGroup.vue +93 -0
- package/components/core/DpContextualHelp.vue +54 -0
- package/components/core/DpCopyPasteButton.vue +47 -0
- package/components/core/DpDashboardTaskCard.vue +123 -0
- package/components/core/DpDataTable/DataTableSearch.js +44 -0
- package/components/core/DpDataTable/DpColumnSelector.vue +133 -0
- package/components/core/DpDataTable/DpDataTable.vue +647 -0
- package/components/core/DpDataTable/DpDataTableExtended.vue +377 -0
- package/components/core/DpDataTable/DpResizeHandle.vue +37 -0
- package/components/core/DpDataTable/DpSelectPageItemCount.vue +70 -0
- package/components/core/DpDataTable/DpTableHeader.vue +197 -0
- package/components/core/DpDataTable/DpTableRow.vue +355 -0
- package/components/core/DpDataTable/DpWrapTrigger.vue +48 -0
- package/components/core/DpDataTable/lib/ResizableColumns.js +83 -0
- package/components/core/DpEditableList.vue +161 -0
- package/components/core/DpEditor/DpBoilerPlate.vue +140 -0
- package/components/core/DpEditor/DpBoilerPlateModal.vue +166 -0
- package/components/core/DpEditor/DpEditor.vue +1281 -0
- package/components/core/DpEditor/DpLinkModal.vue +117 -0
- package/components/core/DpEditor/DpRecommendationModal/DpInsertableRecommendation.vue +137 -0
- package/components/core/DpEditor/DpRecommendationModal.vue +283 -0
- package/components/core/DpEditor/DpResizableImage.vue +121 -0
- package/components/core/DpEditor/DpUploadModal.vue +121 -0
- package/components/core/DpEditor/libs/Decoration.js +66 -0
- package/components/core/DpEditor/libs/SegmentRangeChangePlugin.js +35 -0
- package/components/core/DpEditor/libs/editorAnonymize.js +66 -0
- package/components/core/DpEditor/libs/editorBuildSuggestion.js +269 -0
- package/components/core/DpEditor/libs/editorCustomDelete.js +32 -0
- package/components/core/DpEditor/libs/editorCustomImage.js +100 -0
- package/components/core/DpEditor/libs/editorCustomInsert.js +32 -0
- package/components/core/DpEditor/libs/editorCustomLink.js +46 -0
- package/components/core/DpEditor/libs/editorCustomMark.js +32 -0
- package/components/core/DpEditor/libs/editorInsertAtCursorPos.js +41 -0
- package/components/core/DpEditor/libs/editorObscure.js +60 -0
- package/components/core/DpEditor/libs/editorUnAnonymize.js +56 -0
- package/components/core/DpEditor/libs/handleWordPaste.js +360 -0
- package/components/core/DpEditor/libs/preventDrop.js +31 -0
- package/components/core/DpEditor/libs/preventKeyboardInput.js +27 -0
- package/components/core/DpEditor/libs/preventPaste.js +28 -0
- package/components/core/DpFlyout.vue +119 -0
- package/components/core/DpInlineNotification.vue +116 -0
- package/components/core/DpModal.vue +208 -0
- package/components/core/DpObscure.vue +29 -0
- package/components/core/DpPager.vue +139 -0
- package/components/core/DpProgressBar.vue +67 -0
- package/components/core/DpRegisterFlyout.vue +58 -0
- package/components/core/DpResettableInput.vue +140 -0
- package/components/core/DpSkeletonBox.vue +32 -0
- package/components/core/DpSlidebar.vue +86 -0
- package/components/core/DpSlidingPagination.vue +45 -0
- package/components/core/DpSplitButton.vue +77 -0
- package/components/core/DpSwitcher.vue +62 -0
- package/components/core/DpTableCardList/DpTableCard.vue +61 -0
- package/components/core/DpTableCardList/DpTableCardListHeader.vue +83 -0
- package/components/core/DpTabs/DpTab.vue +52 -0
- package/components/core/DpTabs/DpTabs.vue +165 -0
- package/components/core/DpTextWrapper.vue +65 -0
- package/components/core/DpToggleForm.vue +72 -0
- package/components/core/DpTooltipIcon.vue +52 -0
- package/components/core/DpTransitionExpand.vue +87 -0
- package/components/core/DpTreeList/DpTreeList.vue +334 -0
- package/components/core/DpTreeList/DpTreeListCheckbox.vue +79 -0
- package/components/core/DpTreeList/DpTreeListNode.vue +348 -0
- package/components/core/DpTreeList/DpTreeListToggle.vue +71 -0
- package/components/core/DpTreeList/utils/constants.js +14 -0
- package/components/core/DpUpload/DpUpload.vue +223 -0
- package/components/core/DpUpload/DpUploadFiles.vue +269 -0
- package/components/core/DpUpload/DpUploadedFile.vue +80 -0
- package/components/core/DpUpload/DpUploadedFileList.vue +56 -0
- package/components/core/DpUpload/utils/GetFileIdsByHash.js +42 -0
- package/components/core/DpUpload/utils/UppyTranslations.js +31 -0
- package/components/core/DpVideoPlayer.vue +115 -0
- package/components/core/HeightLimit.vue +121 -0
- package/components/core/MultistepNav.vue +89 -0
- package/components/core/form/DpCheckbox.vue +108 -0
- package/components/core/form/DpDateRangePicker.vue +186 -0
- package/components/core/form/DpDatepicker.vue +160 -0
- package/components/core/form/DpDatetimePicker.vue +194 -0
- package/components/core/form/DpFormRow.vue +79 -0
- package/components/core/form/DpMultiselect.vue +164 -0
- package/components/core/form/DpRadio.vue +128 -0
- package/components/core/form/DpSearchField.vue +110 -0
- package/components/core/form/DpSelect.vue +149 -0
- package/components/core/form/DpTextArea.vue +152 -0
- package/components/core/form/DpTimePicker.vue +374 -0
- package/components/core/form/DpToggle.vue +78 -0
- package/components/core/index.js +132 -0
- package/components/core/notify/DpNotifyContainer.vue +122 -0
- package/components/core/notify/DpNotifyMessage.vue +95 -0
- package/components/core/shared/DpStickyElement.vue +95 -0
- package/components/index.js +24 -0
- package/components/shared/translations.js +15 -0
- package/directives/CleanHtml/CleanHtml.js +50 -0
- package/directives/CleanHtml/CleanHtml.stories.mdx +64 -0
- package/directives/Tooltip/Tooltip.js +40 -0
- package/directives/Tooltip/Tooltip.stories.mdx +42 -0
- package/directives/index.js +17 -0
- package/lib/index.js +14 -0
- package/lib/prefixClass.js +47 -0
- package/mixins/index.js +14 -0
- package/mixins/prefixClassMixin.js +22 -0
- package/package.json +52 -0
- package/shared/props.js +86 -0
- package/style/index.css +7 -0
- package/tailwind.config.js +24 -0
- package/tokens/color.json +358 -0
- package/tokens/color.stories.mdx +45 -0
- package/tokens/fontSize.json +100 -0
- package/tokens/space.json +33 -0
- package/utils/lengthHint.js +69 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2010-present DEMOS E-Partizipation GmbH
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/buildTokens.js
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
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
|
+
const glob = require('glob')
|
|
11
|
+
const StyleDictionary = require('style-dictionary')
|
|
12
|
+
|
|
13
|
+
const prefix = 'dp-'
|
|
14
|
+
|
|
15
|
+
const tokensPath = 'tokens/*.json'
|
|
16
|
+
const files = glob
|
|
17
|
+
.sync(tokensPath)
|
|
18
|
+
.map(filePath => filePath
|
|
19
|
+
.replace('tokens/', '')
|
|
20
|
+
.replace('.json', ''))
|
|
21
|
+
|
|
22
|
+
StyleDictionary.registerTransform({
|
|
23
|
+
name: 'name/scss',
|
|
24
|
+
type: 'name',
|
|
25
|
+
transformer: (token) => {
|
|
26
|
+
// "palette" within colors should not be part of the variable name
|
|
27
|
+
if (token.path[0] === 'color' && token.path[1] === 'palette') {
|
|
28
|
+
token.path.splice(1, 1)
|
|
29
|
+
}
|
|
30
|
+
return prefix + token.path.join('-')
|
|
31
|
+
}
|
|
32
|
+
})
|
|
33
|
+
|
|
34
|
+
StyleDictionary.registerTransformGroup({
|
|
35
|
+
name: 'custom/scss',
|
|
36
|
+
transforms: StyleDictionary.transformGroup.scss.concat(['name/scss'])
|
|
37
|
+
})
|
|
38
|
+
|
|
39
|
+
const StyleDictionaryExtended = StyleDictionary.extend({
|
|
40
|
+
source: [tokensPath],
|
|
41
|
+
platforms: {
|
|
42
|
+
scss: {
|
|
43
|
+
transformGroup: 'custom/scss',
|
|
44
|
+
buildPath: 'tokens/',
|
|
45
|
+
files: files.map((filePath) => {
|
|
46
|
+
return {
|
|
47
|
+
destination: `scss/_${filePath}.scss`,
|
|
48
|
+
format: 'scss/variables',
|
|
49
|
+
filter: (token) => token.filePath.includes(filePath),
|
|
50
|
+
options: {
|
|
51
|
+
outputReferences: true
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
})
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
})
|
|
58
|
+
|
|
59
|
+
StyleDictionaryExtended.buildAllPlatforms()
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import { Canvas, Meta, Story } from '@storybook/addon-docs'
|
|
2
|
+
import { action } from '@storybook/addon-actions'
|
|
3
|
+
|
|
4
|
+
import DpButton from './DpButton'
|
|
5
|
+
|
|
6
|
+
<Meta
|
|
7
|
+
argTypes={{
|
|
8
|
+
color: {
|
|
9
|
+
options: ['primary', 'secondary', 'warning'],
|
|
10
|
+
control: { type: 'select' }
|
|
11
|
+
},
|
|
12
|
+
default: {
|
|
13
|
+
control: {
|
|
14
|
+
type: 'text',
|
|
15
|
+
},
|
|
16
|
+
table: {
|
|
17
|
+
category: 'Slots',
|
|
18
|
+
type: {
|
|
19
|
+
summary: 'html',
|
|
20
|
+
},
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
variant: {
|
|
24
|
+
options: ['', 'outline'],
|
|
25
|
+
control: { type: 'select' }
|
|
26
|
+
}
|
|
27
|
+
}}
|
|
28
|
+
title="Components/Button"
|
|
29
|
+
component={DpButton} />
|
|
30
|
+
|
|
31
|
+
# Button
|
|
32
|
+
|
|
33
|
+
The `DpButton` component renders a primary button element that has a visual `busy` state which prevents the user
|
|
34
|
+
from clicking twice and informs her something is happening behind the scenes.
|
|
35
|
+
|
|
36
|
+
export const Template = (args, { argTypes }) => ({
|
|
37
|
+
props: Object.keys(argTypes),
|
|
38
|
+
components: { DpButton },
|
|
39
|
+
template: `<dp-button v-bind="propsWithoutDefaultSlot" @click="action">${typeof args.default !== 'undefined' ? args.default : ''}</dp-button>`,
|
|
40
|
+
methods: {
|
|
41
|
+
action: action('click')
|
|
42
|
+
},
|
|
43
|
+
computed: {
|
|
44
|
+
propsWithoutDefaultSlot() {
|
|
45
|
+
const all = this.$props
|
|
46
|
+
delete all['default']
|
|
47
|
+
return all
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
## Colors
|
|
53
|
+
|
|
54
|
+
### Primary
|
|
55
|
+
<Canvas>
|
|
56
|
+
<Story
|
|
57
|
+
name="Primary"
|
|
58
|
+
args={{
|
|
59
|
+
text: 'Save'
|
|
60
|
+
}}>
|
|
61
|
+
{Template.bind({})}
|
|
62
|
+
</Story>
|
|
63
|
+
</Canvas>
|
|
64
|
+
|
|
65
|
+
### Secondary
|
|
66
|
+
<Canvas>
|
|
67
|
+
<Story
|
|
68
|
+
name="Secondary"
|
|
69
|
+
args={{
|
|
70
|
+
color: 'secondary',
|
|
71
|
+
text: 'Cancel'
|
|
72
|
+
}}>
|
|
73
|
+
{Template.bind({})}
|
|
74
|
+
</Story>
|
|
75
|
+
</Canvas>
|
|
76
|
+
|
|
77
|
+
### Warning
|
|
78
|
+
<Canvas>
|
|
79
|
+
<Story
|
|
80
|
+
name="Warning"
|
|
81
|
+
args={{
|
|
82
|
+
color: 'warning',
|
|
83
|
+
text: 'Delete'
|
|
84
|
+
}}>
|
|
85
|
+
{Template.bind({})}
|
|
86
|
+
</Story>
|
|
87
|
+
</Canvas>
|
|
88
|
+
|
|
89
|
+
## Variants
|
|
90
|
+
|
|
91
|
+
### Outline
|
|
92
|
+
<Canvas>
|
|
93
|
+
<Story
|
|
94
|
+
name="Outline"
|
|
95
|
+
args={{
|
|
96
|
+
variant: 'outline',
|
|
97
|
+
text: 'Save'
|
|
98
|
+
}}>
|
|
99
|
+
{Template.bind({})}
|
|
100
|
+
</Story>
|
|
101
|
+
</Canvas>
|
|
102
|
+
|
|
103
|
+
## Render a link element
|
|
104
|
+
<Canvas>
|
|
105
|
+
<Story
|
|
106
|
+
name="Link element"
|
|
107
|
+
args={{
|
|
108
|
+
href: 'https://example.com',
|
|
109
|
+
text: 'Go somewhere'
|
|
110
|
+
}}>
|
|
111
|
+
{Template.bind({})}
|
|
112
|
+
</Story>
|
|
113
|
+
</Canvas>
|
|
114
|
+
|
|
115
|
+
## Use the 'busy' prop to visualize system status
|
|
116
|
+
<Canvas>
|
|
117
|
+
<Story
|
|
118
|
+
name="Busy state"
|
|
119
|
+
args={{
|
|
120
|
+
busy: true,
|
|
121
|
+
text: 'Saving item...'
|
|
122
|
+
}}>
|
|
123
|
+
{Template.bind({})}
|
|
124
|
+
</Story>
|
|
125
|
+
</Canvas>
|
|
126
|
+
|
|
127
|
+
## Use the default slot to render additional content
|
|
128
|
+
<Canvas>
|
|
129
|
+
<Story
|
|
130
|
+
name="With default slot"
|
|
131
|
+
args={{
|
|
132
|
+
default: `<i class="fa fa-pencil" aria-hidden="true" /> Edit item`
|
|
133
|
+
}}>
|
|
134
|
+
{Template.bind({})}
|
|
135
|
+
</Story>
|
|
136
|
+
</Canvas>
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
<license>
|
|
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
|
+
</license>
|
|
9
|
+
|
|
10
|
+
<template>
|
|
11
|
+
<component
|
|
12
|
+
:is="element"
|
|
13
|
+
:type="isButtonElement && type"
|
|
14
|
+
:href="!isButtonElement && sanitizedHref"
|
|
15
|
+
:class="classes"
|
|
16
|
+
:aria-hidden="busy"
|
|
17
|
+
v-on="$listeners">
|
|
18
|
+
<!-- @slot By default, the slot displays the button text. Use to render additional markup, e.g. an icon. -->
|
|
19
|
+
<slot>
|
|
20
|
+
<span v-text="text" />
|
|
21
|
+
</slot>
|
|
22
|
+
</component>
|
|
23
|
+
</template>
|
|
24
|
+
|
|
25
|
+
<script>
|
|
26
|
+
import { sanitizeUrl } from '@braintree/sanitize-url'
|
|
27
|
+
|
|
28
|
+
export default {
|
|
29
|
+
name: 'DpButton',
|
|
30
|
+
|
|
31
|
+
props: {
|
|
32
|
+
/**
|
|
33
|
+
* When waiting for an axios response, the visual state of the button can be changed via the `busy` property.
|
|
34
|
+
*/
|
|
35
|
+
busy: {
|
|
36
|
+
required: false,
|
|
37
|
+
type: Boolean,
|
|
38
|
+
default: false
|
|
39
|
+
},
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Define the color of the button. Possible values are `primary, secondary, warning`.
|
|
43
|
+
*/
|
|
44
|
+
color: {
|
|
45
|
+
required: false,
|
|
46
|
+
type: String,
|
|
47
|
+
default: 'primary'
|
|
48
|
+
},
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* When passing a href, a link is rendered instead of a button element.
|
|
52
|
+
* The value of its `href` attribute is sanitized, defaulting to `'about:blank'` for unsafe values.
|
|
53
|
+
*/
|
|
54
|
+
href: {
|
|
55
|
+
required: false,
|
|
56
|
+
type: String,
|
|
57
|
+
default: '#'
|
|
58
|
+
},
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* The text content of the button element. Can be omitted if the text content is passed via the default slot.
|
|
62
|
+
*/
|
|
63
|
+
text: {
|
|
64
|
+
required: false,
|
|
65
|
+
type: String,
|
|
66
|
+
default: 'save'
|
|
67
|
+
},
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* The type attribute can be set to a value of `submit` manually, if the button is used to post a form.
|
|
71
|
+
*/
|
|
72
|
+
type: {
|
|
73
|
+
required: false,
|
|
74
|
+
type: String,
|
|
75
|
+
default: 'button',
|
|
76
|
+
validator: (prop) => ['button', 'submit'].includes(prop)
|
|
77
|
+
},
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Variants of the button include `outline` (`text` to be implemented).
|
|
81
|
+
* When not specified, the default style (white on colored background) is applied.
|
|
82
|
+
*/
|
|
83
|
+
variant: {
|
|
84
|
+
required: false,
|
|
85
|
+
type: String,
|
|
86
|
+
default: ''
|
|
87
|
+
}
|
|
88
|
+
},
|
|
89
|
+
|
|
90
|
+
computed: {
|
|
91
|
+
classes () {
|
|
92
|
+
/*
|
|
93
|
+
* @see
|
|
94
|
+
* - https://vuejs.org/v2/guide/class-and-style.html#Array-Syntax
|
|
95
|
+
* - https://stackoverflow.com/a/2933472
|
|
96
|
+
*/
|
|
97
|
+
return [
|
|
98
|
+
'btn',
|
|
99
|
+
this.busy && 'is-busy pointer-events-none',
|
|
100
|
+
['primary', 'secondary', 'warning'].includes(this.color) && `btn--${this.color}`,
|
|
101
|
+
['outline'].includes(this.variant) && `btn--${this.variant}`
|
|
102
|
+
]
|
|
103
|
+
},
|
|
104
|
+
|
|
105
|
+
element () {
|
|
106
|
+
return this.isButtonElement ? 'button' : 'a'
|
|
107
|
+
},
|
|
108
|
+
|
|
109
|
+
isButtonElement () {
|
|
110
|
+
return this.href === '#'
|
|
111
|
+
},
|
|
112
|
+
|
|
113
|
+
sanitizedHref () {
|
|
114
|
+
return sanitizeUrl(this.href)
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
</script>
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { Canvas, Meta, Story } from '@storybook/addon-docs'
|
|
2
|
+
|
|
3
|
+
import DpDetails from './DpDetails'
|
|
4
|
+
|
|
5
|
+
<Meta
|
|
6
|
+
argTypes={{
|
|
7
|
+
default: {
|
|
8
|
+
control: {
|
|
9
|
+
type: 'text',
|
|
10
|
+
},
|
|
11
|
+
table: {
|
|
12
|
+
category: 'Slots',
|
|
13
|
+
type: {
|
|
14
|
+
summary: 'html',
|
|
15
|
+
},
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
}}
|
|
19
|
+
title="Components/Details"
|
|
20
|
+
component={DpDetails} />
|
|
21
|
+
|
|
22
|
+
# Details
|
|
23
|
+
|
|
24
|
+
The `DpDetails` component is used to reveal detailed information only when users need it. Other than the accordion or
|
|
25
|
+
expandable table, it is not used to display tabular data or multiple items of the same type and structure - it rather
|
|
26
|
+
represents a single chunk of information that is shortened to ease scanning of the content it is part of.
|
|
27
|
+
|
|
28
|
+
export const Template = (args, { argTypes }) => ({
|
|
29
|
+
props: Object.keys(argTypes),
|
|
30
|
+
components: { DpDetails },
|
|
31
|
+
template: `<dp-details v-bind="propsWithoutDefaultSlot" v-on="$props">${typeof args.default !== 'undefined' ? args.default : ''}</dp-details>`,
|
|
32
|
+
computed: {
|
|
33
|
+
propsWithoutDefaultSlot() {
|
|
34
|
+
const all = this.$props
|
|
35
|
+
delete all['default']
|
|
36
|
+
return all
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
## Colors
|
|
42
|
+
|
|
43
|
+
### Primary
|
|
44
|
+
<Canvas>
|
|
45
|
+
<Story
|
|
46
|
+
name="Default usage"
|
|
47
|
+
args={{
|
|
48
|
+
default: `Content to be revealed onClick of the summary. Here, content of any length can be placed. However
|
|
49
|
+
this does not mean that content have to be as long as possible, especially if no real value is added by lengthening
|
|
50
|
+
sentences that otherwise would not even have to be read.`,
|
|
51
|
+
summary: 'The summary tells users what to find in the details'
|
|
52
|
+
}}>
|
|
53
|
+
{Template.bind({})}
|
|
54
|
+
</Story>
|
|
55
|
+
</Canvas>
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
<license>
|
|
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
|
+
</license>
|
|
9
|
+
|
|
10
|
+
<template>
|
|
11
|
+
<details
|
|
12
|
+
class="o-details space-stack-xs"
|
|
13
|
+
role="group">
|
|
14
|
+
<summary
|
|
15
|
+
:aria-expanded="isOpen"
|
|
16
|
+
class="o-details__trigger o-link--default cursor--pointer display--inline-block"
|
|
17
|
+
role="button"
|
|
18
|
+
@click="isOpen = !isOpen">
|
|
19
|
+
<i
|
|
20
|
+
class="fa width-s text--center"
|
|
21
|
+
:class="{'fa-caret-down': isOpen, 'fa-caret-right': !isOpen}"
|
|
22
|
+
aria-hidden="true" />
|
|
23
|
+
<strong v-cleanhtml="summary" />
|
|
24
|
+
</summary>
|
|
25
|
+
<div>
|
|
26
|
+
<slot />
|
|
27
|
+
</div>
|
|
28
|
+
</details>
|
|
29
|
+
</template>
|
|
30
|
+
|
|
31
|
+
<script>
|
|
32
|
+
import { CleanHtml } from '../../directives'
|
|
33
|
+
|
|
34
|
+
export default {
|
|
35
|
+
name: 'DpDetails',
|
|
36
|
+
|
|
37
|
+
directives: {
|
|
38
|
+
cleanhtml: CleanHtml
|
|
39
|
+
},
|
|
40
|
+
|
|
41
|
+
props: {
|
|
42
|
+
/**
|
|
43
|
+
* The short summary of the content, which is also used as a trigger.
|
|
44
|
+
*/
|
|
45
|
+
summary: {
|
|
46
|
+
type: String,
|
|
47
|
+
required: false,
|
|
48
|
+
default: ''
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
|
|
52
|
+
data () {
|
|
53
|
+
return {
|
|
54
|
+
isOpen: false
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
</script>
|