@carbon/vue 3.0.4-alpha.0 → 3.0.6-alpha.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.
- package/README.md +16 -0
- package/dist/carbon-vue-3.common.js +11782 -2709
- package/dist/carbon-vue-3.common.js.map +1 -1
- package/dist/carbon-vue-3.css +1 -0
- package/dist/carbon-vue-3.umd.js +11782 -2709
- package/dist/carbon-vue-3.umd.js.map +1 -1
- package/dist/carbon-vue-3.umd.min.js +30 -2
- package/dist/carbon-vue-3.umd.min.js.map +1 -1
- package/package.json +3 -2
- package/src/components/CvCheckbox/CvCheckbox.vue +0 -2
- package/src/components/CvDatePicker/CvDatePicker-notes.md +86 -0
- package/src/components/CvDatePicker/CvDatePicker.stories.js +241 -0
- package/src/components/CvDatePicker/CvDatePicker.vue +402 -0
- package/src/components/CvDatePicker/CvDatePickerSkeleton.vue +106 -0
- package/src/components/CvDatePicker/index.js +4 -0
- package/src/components/CvDatePicker/plugins/appendToPlugin.js +64 -0
- package/src/components/CvDatePicker/plugins/fixEventsPlugin.js +79 -0
- package/src/components/CvDatePicker/plugins/monthSelectPlugin.js +86 -0
- package/src/components/CvDatePicker/plugins/rangePlugin.js +47 -0
- package/src/components/CvForm/CvForm.stories.mdx +193 -0
- package/src/components/CvForm/CvForm.vue +9 -0
- package/src/components/CvForm/CvFormGroup.vue +27 -0
- package/src/components/CvForm/CvFormItem.vue +9 -0
- package/src/components/CvForm/index.js +5 -0
- package/src/components/CvModal/CvModal.stories.mdx +234 -0
- package/src/components/CvModal/CvModal.vue +403 -0
- package/src/components/CvModal/index.js +3 -0
- package/src/components/CvTextArea/CvTextArea.stories.js +174 -0
- package/src/components/CvTextArea/CvTextArea.vue +107 -0
- package/src/components/CvTextArea/index.js +4 -0
- package/src/components/CvTextInput/CvTextInput.stories.js +245 -0
- package/src/components/CvTextInput/CvTextInput.vue +217 -0
- package/src/components/CvTextInput/const.js +2 -0
- package/src/components/CvTextInput/index.js +4 -0
- package/src/components/CvTile/CvTile.stories.mdx +156 -0
- package/src/components/CvTile/CvTile.vue +67 -0
- package/src/components/CvTile/CvTileClickable.vue +23 -0
- package/src/components/CvTile/CvTileExpandable.vue +103 -0
- package/src/components/CvTile/CvTileSelectable.vue +52 -0
- package/src/components/CvTile/CvTileStandard.vue +7 -0
- package/src/components/CvTile/index.js +4 -0
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<component
|
|
3
|
+
:is="tagType"
|
|
4
|
+
ref="target"
|
|
5
|
+
data-tile="clickable"
|
|
6
|
+
:class="`cv-tile-clickable ${carbonPrefix}--tile--clickable`"
|
|
7
|
+
v-bind="{ ...$attrs, ...linkProps }"
|
|
8
|
+
tabindex="0"
|
|
9
|
+
>
|
|
10
|
+
<slot></slot>
|
|
11
|
+
</component>
|
|
12
|
+
</template>
|
|
13
|
+
|
|
14
|
+
<script setup>
|
|
15
|
+
import { carbonPrefix } from '../../global/settings';
|
|
16
|
+
import { props as propsLink, useLinkProps, useTagType } from '../../use/cvLink';
|
|
17
|
+
|
|
18
|
+
const props = defineProps({
|
|
19
|
+
...propsLink,
|
|
20
|
+
});
|
|
21
|
+
const tagType = useTagType(props);
|
|
22
|
+
const linkProps = useLinkProps(props);
|
|
23
|
+
</script>
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<button
|
|
3
|
+
type="button"
|
|
4
|
+
:style="data.styleObject"
|
|
5
|
+
@click="toggle"
|
|
6
|
+
:class="[
|
|
7
|
+
`cv-tile-expandable ${carbonPrefix}--tile--expandable`,
|
|
8
|
+
{ [`${carbonPrefix}--tile--is-expanded`]: data.internalExpanded },
|
|
9
|
+
]"
|
|
10
|
+
ref="el"
|
|
11
|
+
>
|
|
12
|
+
<div :class="`${carbonPrefix}--tile-content`">
|
|
13
|
+
<span
|
|
14
|
+
data-tile-atf
|
|
15
|
+
:class="`${carbonPrefix}--tile-content__above-the-fold`"
|
|
16
|
+
ref="aboveFold"
|
|
17
|
+
>
|
|
18
|
+
<slot>
|
|
19
|
+
<!-- Above the fold content here -->
|
|
20
|
+
</slot>
|
|
21
|
+
</span>
|
|
22
|
+
<div :class="`${carbonPrefix}--tile__chevron`">
|
|
23
|
+
<span>{{ chevronLabel }}</span>
|
|
24
|
+
<ChevronDown16 />
|
|
25
|
+
</div>
|
|
26
|
+
<span
|
|
27
|
+
:class="`${carbonPrefix}--tile-content__below-the-fold`"
|
|
28
|
+
ref="belowFold"
|
|
29
|
+
v-show="data.internalExpanded || data.initialized"
|
|
30
|
+
>
|
|
31
|
+
<slot name="below">
|
|
32
|
+
<!-- Rest of the content here -->
|
|
33
|
+
</slot>
|
|
34
|
+
</span>
|
|
35
|
+
</div>
|
|
36
|
+
</button>
|
|
37
|
+
</template>
|
|
38
|
+
|
|
39
|
+
<script setup>
|
|
40
|
+
import { carbonPrefix } from '../../global/settings';
|
|
41
|
+
import ChevronDown16 from '@carbon/icons-vue/es/chevron--down/16';
|
|
42
|
+
import { computed, nextTick, reactive, ref, watch } from 'vue';
|
|
43
|
+
|
|
44
|
+
const props = defineProps({
|
|
45
|
+
expanded: Boolean,
|
|
46
|
+
tileCollapsedLabel: String,
|
|
47
|
+
tileExpandedLabel: String,
|
|
48
|
+
});
|
|
49
|
+
const data = reactive({
|
|
50
|
+
styleObject: {
|
|
51
|
+
maxHeight: 'initial',
|
|
52
|
+
},
|
|
53
|
+
initialized: false,
|
|
54
|
+
internalExpanded: props.expanded,
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
watch(
|
|
58
|
+
() => props.expanded,
|
|
59
|
+
val => {
|
|
60
|
+
if (val !== data.internalExpanded) {
|
|
61
|
+
toggle(val);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
);
|
|
65
|
+
|
|
66
|
+
const chevronLabel = computed(() => {
|
|
67
|
+
return data.internalExpanded
|
|
68
|
+
? props.tileExpandedLabel
|
|
69
|
+
: props.tileCollapsedLabel;
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
const el = ref(null);
|
|
73
|
+
const belowFold = ref(null);
|
|
74
|
+
function toggle(force) {
|
|
75
|
+
let currentHeight = el?.value.getBoundingClientRect().height;
|
|
76
|
+
if (!data.initialized) {
|
|
77
|
+
data.styleObject.maxHeight = `${currentHeight}px`;
|
|
78
|
+
data.initialized = true;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
nextTick(() => {
|
|
82
|
+
const forceType = typeof force;
|
|
83
|
+
data.internalExpanded =
|
|
84
|
+
forceType === 'boolean' ? force : !data.internalExpanded;
|
|
85
|
+
|
|
86
|
+
const belowFoldHeight = belowFold?.value.getBoundingClientRect().height;
|
|
87
|
+
|
|
88
|
+
if (data.internalExpanded) {
|
|
89
|
+
currentHeight += belowFoldHeight;
|
|
90
|
+
} else {
|
|
91
|
+
currentHeight -= belowFoldHeight;
|
|
92
|
+
}
|
|
93
|
+
data.styleObject.maxHeight = `${currentHeight}px`;
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
const emit = defineEmits(['expanded']);
|
|
97
|
+
watch(
|
|
98
|
+
() => data.internalExpanded,
|
|
99
|
+
val => {
|
|
100
|
+
emit('expanded', val);
|
|
101
|
+
}
|
|
102
|
+
);
|
|
103
|
+
</script>
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<label
|
|
3
|
+
:for="uid"
|
|
4
|
+
:aria-label="ariaLabel"
|
|
5
|
+
:class="[
|
|
6
|
+
`cv-tile-selectable ${carbonPrefix}--tile--selectable`,
|
|
7
|
+
{ [`${carbonPrefix}--tile--is-selected`]: isChecked },
|
|
8
|
+
]"
|
|
9
|
+
data-tile="selectable"
|
|
10
|
+
tabindex="0"
|
|
11
|
+
:data-contained-checkbox-state="isChecked"
|
|
12
|
+
>
|
|
13
|
+
<input
|
|
14
|
+
tabindex="-1"
|
|
15
|
+
data-tile-input
|
|
16
|
+
:id="uid"
|
|
17
|
+
type="checkbox"
|
|
18
|
+
:checked="isChecked === true"
|
|
19
|
+
:aria-checked="`${isChecked}`"
|
|
20
|
+
:class="`${carbonPrefix}--tile-input`"
|
|
21
|
+
v-bind="$attrs"
|
|
22
|
+
@change="onChange"
|
|
23
|
+
/>
|
|
24
|
+
<div :class="`${carbonPrefix}--tile__checkmark`">
|
|
25
|
+
<CheckmarkFilled16 />
|
|
26
|
+
</div>
|
|
27
|
+
<div :class="`${carbonPrefix}--tile-content`">
|
|
28
|
+
<slot>
|
|
29
|
+
<!-- Tile content here -->
|
|
30
|
+
</slot>
|
|
31
|
+
</div>
|
|
32
|
+
</label>
|
|
33
|
+
</template>
|
|
34
|
+
|
|
35
|
+
<script setup>
|
|
36
|
+
import { carbonPrefix } from '../../global/settings';
|
|
37
|
+
import { props as propsCvCheck, useCheck } from '../../use/cvCheck';
|
|
38
|
+
import { props as propsCvId, useCvId } from '../../use/cvId';
|
|
39
|
+
import CheckmarkFilled16 from '@carbon/icons-vue/es/checkmark--filled/16';
|
|
40
|
+
import { toRefs } from 'vue';
|
|
41
|
+
|
|
42
|
+
const props = defineProps({
|
|
43
|
+
ariaLabel: { type: String, default: 'tile' },
|
|
44
|
+
...propsCvCheck,
|
|
45
|
+
...propsCvId,
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
const uid = useCvId(props, true);
|
|
49
|
+
|
|
50
|
+
const emit = defineEmits(['update:modelValue', 'change']);
|
|
51
|
+
const { onChange, isChecked } = useCheck(toRefs(props), emit);
|
|
52
|
+
</script>
|