@carbon/vue 3.0.8-alpha.0 → 3.0.9-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.
Files changed (26) hide show
  1. package/dist/carbon-vue-3.common.js +412 -40
  2. package/dist/carbon-vue-3.common.js.map +1 -1
  3. package/dist/carbon-vue-3.umd.js +412 -40
  4. package/dist/carbon-vue-3.umd.js.map +1 -1
  5. package/dist/carbon-vue-3.umd.min.js +4 -4
  6. package/dist/carbon-vue-3.umd.min.js.map +1 -1
  7. package/package.json +2 -2
  8. package/src/components/CvNotification/CvToastNotification.stories.js +71 -1
  9. package/src/components/CvNotification/CvToastNotification.vue +6 -4
  10. package/src/components/CvOverflowMenu/CvOverflowMenu.stories.mdx +68 -12
  11. package/src/components/CvOverflowMenu/CvOverflowMenu.vue +39 -45
  12. package/src/components/CvOverflowMenu/CvOverflowMenuItem.vue +6 -11
  13. package/src/components/CvOverflowMenu/index.js +2 -1
  14. package/src/components/CvStructuredList/CvStructuredList.stories.js +141 -0
  15. package/src/components/CvStructuredList/CvStructuredList.vue +44 -0
  16. package/src/components/CvStructuredList/CvStructuredListData.vue +19 -0
  17. package/src/components/CvStructuredList/CvStructuredListHeading.vue +11 -0
  18. package/src/components/CvStructuredList/CvStructuredListItem.vue +47 -0
  19. package/src/components/CvStructuredList/CvStructuredListItemSelectable.vue +56 -0
  20. package/src/components/CvStructuredList/CvStructuredListItemStandard.vue +11 -0
  21. package/src/components/CvStructuredList/__tests__/__snapshots__/CvStructuredList.spec.js.snap +73 -0
  22. package/src/components/CvStructuredList/__tests__/__snapshots__/CvStructuredListData.spec.js.snap +5 -0
  23. package/src/components/CvStructuredList/__tests__/__snapshots__/CvStructuredListHeading.spec.js.snap +9 -0
  24. package/src/components/CvStructuredList/__tests__/__snapshots__/CvStructuredListItem.spec.js.snap +7 -0
  25. package/src/components/CvStructuredList/index.js +12 -0
  26. package/src/use/useRadio.js +0 -1
@@ -0,0 +1,56 @@
1
+ <template>
2
+ <label
3
+ :for="cvId"
4
+ :aria-label="label"
5
+ :class="[
6
+ `cv-structured-list-item--selectable ${carbonPrefix}--structured-list-row`,
7
+ { ' ${carbonPrefix}--structured-list-row--selected': isChecked },
8
+ ]"
9
+ tabindex="0"
10
+ >
11
+ <slot></slot>
12
+ <input
13
+ v-bind="$attrs"
14
+ tabindex="-1"
15
+ :id="cvId"
16
+ :class="`${carbonPrefix}--structured-list-input`"
17
+ :checked="isChecked"
18
+ :value="value"
19
+ type="radio"
20
+ @change="onChange"
21
+ />
22
+ <div :class="`${carbonPrefix}--structured-list-td`">
23
+ <CheckmarkFilled16 :class="`${carbonPrefix}--structured-list-svg`" />
24
+ </div>
25
+ </label>
26
+ </template>
27
+
28
+ <script setup>
29
+ import { carbonPrefix } from '../../global/settings';
30
+ import { useCvId, propsCvId, useRadio } from '../../use';
31
+ import CheckmarkFilled16 from '@carbon/icons-vue/es/checkmark--filled/16';
32
+
33
+ defineOptions({
34
+ inheritAttrs: false,
35
+ });
36
+
37
+ const props = defineProps({
38
+ label: {
39
+ type: String,
40
+ default: undefined,
41
+ },
42
+ modelValue: {
43
+ type: String,
44
+ default: undefined,
45
+ },
46
+ value: {
47
+ type: String,
48
+ default: undefined,
49
+ },
50
+ ...propsCvId,
51
+ });
52
+
53
+ const cvId = useCvId(props);
54
+ const emit = defineEmits(['update:modelValue', 'change']);
55
+ const { isChecked, onChange } = useRadio(props, emit);
56
+ </script>
@@ -0,0 +1,11 @@
1
+ <template>
2
+ <div
3
+ :class="`cv-structured-list-item--standard ${carbonPrefix}--structured-list-row`"
4
+ >
5
+ <slot></slot>
6
+ </div>
7
+ </template>
8
+
9
+ <script setup>
10
+ import { carbonPrefix } from '../../global/settings';
11
+ </script>
@@ -0,0 +1,73 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`CvStructuredList should render \`headings\` slot correctly 1`] = `
4
+ <div class="bx--structured-list bx--structured-list--selection bx--structured-list--condensed" data-structured-list="true" defaultid="test-1">
5
+ <div class="bx--structured-list-thead">
6
+ <div class="bx--structured-list-row bx--structured-list-row--header-row">
7
+ <div class="headings-slot-test">Headings slot test</div>
8
+ <div class="bx--structured-list-th"></div>
9
+ </div>
10
+ </div>
11
+ <div class="bx--structured-list-tbody"></div>
12
+ </div>
13
+ `;
14
+
15
+ exports[`CvStructuredList should render \`items\` slot correctly 1`] = `
16
+ <div class="bx--structured-list bx--structured-list--selection bx--structured-list--condensed" data-structured-list="true" defaultid="test-1">
17
+ <div class="bx--structured-list-thead">
18
+ <div class="bx--structured-list-row bx--structured-list-row--header-row">
19
+ <div class="bx--structured-list-th"></div>
20
+ </div>
21
+ </div>
22
+ <div class="bx--structured-list-tbody">
23
+ <ul class="items-slot-test">
24
+ <li>Test 1.1</li>
25
+ <li>Test 1.2</li>
26
+ </ul>
27
+ </div>
28
+ </div>
29
+ `;
30
+
31
+ exports[`CvStructuredList should render correctly when condensed 1`] = `
32
+ <div class="bx--structured-list bx--structured-list--condensed" data-structured-list="false" defaultid="test-1">
33
+ <div class="bx--structured-list-thead">
34
+ <div class="bx--structured-list-row bx--structured-list-row--header-row">
35
+ <!--v-if-->
36
+ </div>
37
+ </div>
38
+ <div class="bx--structured-list-tbody"></div>
39
+ </div>
40
+ `;
41
+
42
+ exports[`CvStructuredList should render correctly when not selectable and not condensed 1`] = `
43
+ <div class="bx--structured-list" data-structured-list="false" defaultid="test-1">
44
+ <div class="bx--structured-list-thead">
45
+ <div class="bx--structured-list-row bx--structured-list-row--header-row">
46
+ <!--v-if-->
47
+ </div>
48
+ </div>
49
+ <div class="bx--structured-list-tbody"></div>
50
+ </div>
51
+ `;
52
+
53
+ exports[`CvStructuredList should render correctly when selectable 1`] = `
54
+ <div class="bx--structured-list bx--structured-list--selection" data-structured-list="true" defaultid="test-1">
55
+ <div class="bx--structured-list-thead">
56
+ <div class="bx--structured-list-row bx--structured-list-row--header-row">
57
+ <div class="bx--structured-list-th"></div>
58
+ </div>
59
+ </div>
60
+ <div class="bx--structured-list-tbody"></div>
61
+ </div>
62
+ `;
63
+
64
+ exports[`CvStructuredList should render correctly when selectable and condensed 1`] = `
65
+ <div class="bx--structured-list bx--structured-list--selection bx--structured-list--condensed" data-structured-list="true" defaultid="test-1">
66
+ <div class="bx--structured-list-thead">
67
+ <div class="bx--structured-list-row bx--structured-list-row--header-row">
68
+ <div class="bx--structured-list-th"></div>
69
+ </div>
70
+ </div>
71
+ <div class="bx--structured-list-tbody"></div>
72
+ </div>
73
+ `;
@@ -0,0 +1,5 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`CvStructuredListData should render correctly when not wrapping text 1`] = `<div class="cv-structured-list-data bx--structured-list-td bx--structured-list-content--nowrap" id="test-3"></div>`;
4
+
5
+ exports[`CvStructuredListData should render correctly when wrapping text 1`] = `<div class="cv-structured-list-data bx--structured-list-td" id="test-3"></div>`;
@@ -0,0 +1,9 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`CvStructuredListHeading should render correctly 1`] = `<div class="cv-structured-list-heading bx--structured-list-th"></div>`;
4
+
5
+ exports[`CvStructuredListHeading should render with slot correctly 1`] = `
6
+ <div class="cv-structured-list-heading bx--structured-list-th">
7
+ <div class="headings-slot-default-test">Headings slot default test</div>
8
+ </div>
9
+ `;
@@ -0,0 +1,7 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`CvStructuredListItem should render correctly when \`value\` is default 1`] = `<cv-structured-list-item-standard-stub id="test-2" class="cv-structured-list-item" modelvalue="test"></cv-structured-list-item-standard-stub>`;
4
+
5
+ exports[`CvStructuredListItem should render correctly when \`value\` is set 1`] = `<cv-structured-list-item-standard-stub id="test-2" class="cv-structured-list-item" modelvalue="test" value="strictured list item value test"></cv-structured-list-item-standard-stub>`;
6
+
7
+ exports[`CvStructuredListItem should render correctly when slot is specified 1`] = `<cv-structured-list-item-standard-stub id="test-2" class="cv-structured-list-item" modelvalue="test"></cv-structured-list-item-standard-stub>`;
@@ -0,0 +1,12 @@
1
+ import CvStructuredListData from './CvStructuredListData.vue';
2
+ import CvStructuredListHeading from './CvStructuredListHeading.vue';
3
+ import CvStructuredListItem from './CvStructuredListItem.vue';
4
+ import CvStructuredList from './CvStructuredList.vue';
5
+ export {
6
+ CvStructuredList,
7
+ CvStructuredListItem,
8
+ CvStructuredListHeading,
9
+ CvStructuredListData,
10
+ };
11
+
12
+ export default CvStructuredList;
@@ -13,7 +13,6 @@ export const useRadio = (props, emit) => {
13
13
 
14
14
  const onChange = () => {
15
15
  onRadioItemChange(props.value); // emit to parent
16
-
17
16
  emit('update:modelValue', props.value); // emit for v-model
18
17
  emit('change', props.value);
19
18
  };