diff --git a/.yarn/cache/caniuse-lite-npm-1.0.30001434-9c6ea57daf-7c9d2641e8.zip b/.yarn/cache/caniuse-lite-npm-1.0.30001434-9c6ea57daf-7c9d2641e8.zip deleted file mode 100644 index daa4e7488..000000000 Binary files a/.yarn/cache/caniuse-lite-npm-1.0.30001434-9c6ea57daf-7c9d2641e8.zip and /dev/null differ diff --git a/.yarn/cache/caniuse-lite-npm-1.0.30001445-535a3ade2b-f98ca67829.zip b/.yarn/cache/caniuse-lite-npm-1.0.30001445-535a3ade2b-f98ca67829.zip deleted file mode 100644 index 52a99f342..000000000 Binary files a/.yarn/cache/caniuse-lite-npm-1.0.30001445-535a3ade2b-f98ca67829.zip and /dev/null differ diff --git a/.yarn/cache/caniuse-lite-npm-1.0.30001489-94fce279d5-94585a351f.zip b/.yarn/cache/caniuse-lite-npm-1.0.30001489-94fce279d5-94585a351f.zip new file mode 100644 index 000000000..f19a66fe9 Binary files /dev/null and b/.yarn/cache/caniuse-lite-npm-1.0.30001489-94fce279d5-94585a351f.zip differ diff --git a/src/components/CvDropdown/CvDropdown.stories.mdx b/src/components/CvDropdown/CvDropdown.stories.mdx new file mode 100644 index 000000000..17d86c3ee --- /dev/null +++ b/src/components/CvDropdown/CvDropdown.stories.mdx @@ -0,0 +1,342 @@ +import { Canvas, Meta, Story } from '@storybook/addon-docs'; +import { sbCompPrefix } from '../../global/storybook-utils'; +import CvDropdown from './CvDropdown.vue'; +import CvDropdownItem from './CvDropdownItem.vue' +import { action } from '@storybook/addon-actions'; +import { ref } from "vue"; +const myValue = ref('baby-yoda'); + + + +export const Template = args => ({ + // Components used in your story `template` are defined in the `components` object + components: { + CvDropdown,CvDropdownItem + }, + // The story's `args` need to be mapped into the template through the `setup()` method + setup() { + return { + ...args, + props: args.props, + light: args.light, + placeholder: args.placeholder, + value: args.value, + label: args.label, + up: args.up, + inline: args.inline, + helperText: args.helperText, + hideSelected: args.hideSelected, + warnText: args.warnText, + invalidMessage: args.invalidMessage, + disabled: args.disabled, + size: args.size, + items: args.items, + onChange: action('change'), + myValue: myValue, + slotInvalidText: args.slotInvalidText, + slotWarningText: args.slotWarningText, + slotHelperText: args.slotHelperText + }; + }, + template: args.template, +}); +const defaultTemplate = ` +
+ + Din Djarin + Bo-Katan Kryze + Din Grogu + The Armorer + Greef Karga + +
+`; +const slotsTemplate = ` +
+ + + + + Din Djarin + Bo-Katan Kryze + Din Grogu + The Armorer + Greef Karga + +
+`; +const itemsTemplate = ` +
+ + +
+`; +const vmodelTemplate = ` +
+ + Din Djarin + Bo-Katan Kryze + Din Grogu + The Armorer + Greef Karga + +
V-Model value: {{ myValue }}
+ +
+`; + + + +# CvDropdown +Notes: +- You can place a Dropdown inline with other content by using the inline variant +Migration notes: + +- The `v-model` is different in Vue 3 than Vue 2. You can still specify the `v-model=something` to control the visibility but + if you specify it like this you will see a deprecation message in the log. Please use `v-model:value=something` instead. +- Add the `size` option to match Carbon React +- Add the `warnText` option to match Carbon React + + + + {Template.bind({})} + + + + # Use slots with helper, invalid, and warning text + + + + {Template.bind({})} + + + + +# Use an array of strings as the dropdown options +- Notes: this version does not seem very useful. Please comment in the slack channel if you are using this. +Curious to know how it might be currently used. + + + + {Template.bind({})} + + + +# Use with v-model + + + + {Template.bind({})} + + diff --git a/src/components/CvDropdown/CvDropdown.vue b/src/components/CvDropdown/CvDropdown.vue new file mode 100644 index 000000000..566da2ab8 --- /dev/null +++ b/src/components/CvDropdown/CvDropdown.vue @@ -0,0 +1,413 @@ + + + + + diff --git a/src/components/CvDropdown/CvDropdownItem.vue b/src/components/CvDropdown/CvDropdownItem.vue new file mode 100644 index 000000000..940e67edd --- /dev/null +++ b/src/components/CvDropdown/CvDropdownItem.vue @@ -0,0 +1,86 @@ + + + + + diff --git a/src/components/CvDropdown/CvDropdownSkeleton.vue b/src/components/CvDropdown/CvDropdownSkeleton.vue new file mode 100644 index 000000000..f191b1c57 --- /dev/null +++ b/src/components/CvDropdown/CvDropdownSkeleton.vue @@ -0,0 +1,17 @@ + + + diff --git a/src/components/CvDropdown/index.js b/src/components/CvDropdown/index.js new file mode 100644 index 000000000..2cccfcfb6 --- /dev/null +++ b/src/components/CvDropdown/index.js @@ -0,0 +1,5 @@ +import CvDropdown from './CvDropdown.vue'; +import CvDropdownItem from './CvDropdownItem.vue'; +import CvDropdownSkeleton from './CvDropdownSkeleton.vue'; + +export { CvDropdown, CvDropdownItem, CvDropdownSkeleton }; diff --git a/yarn.lock b/yarn.lock index e8a7bad33..51be6252a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -8868,17 +8868,10 @@ __metadata: languageName: node linkType: hard -"caniuse-lite@npm:^1.0.0, caniuse-lite@npm:^1.0.30001332": - version: 1.0.30001434 - resolution: "caniuse-lite@npm:1.0.30001434" - checksum: 7c9d2641e8e8f3ddf9af14c4ce47266a9d8fd1fc0243626049ff1b2eca4bf02938ff440813cc3feae3fa8d851ec8d1b9718044340c8d09bb4372d92d4f6b519c - languageName: node - linkType: hard - -"caniuse-lite@npm:^1.0.30001109, caniuse-lite@npm:^1.0.30001400": - version: 1.0.30001445 - resolution: "caniuse-lite@npm:1.0.30001445" - checksum: f98ca67829c3c52af5af0a62b8510432b2ad9594437d24ad460a6eb1a23d93e7a31631b1f550fbbe482ad05c467aa00da710a41699eb13d1f246d7db4147ab79 +"caniuse-lite@npm:^1.0.0, caniuse-lite@npm:^1.0.30001109, caniuse-lite@npm:^1.0.30001332, caniuse-lite@npm:^1.0.30001400": + version: 1.0.30001489 + resolution: "caniuse-lite@npm:1.0.30001489" + checksum: 94585a351fd7661b855c83eace474db0ee5a617159b46f2eff1f6fe4b85d7a205418471fdec8cf5cd647a7f79958706d5e664c0bbf3c7c09118b35db9bb95a1b languageName: node linkType: hard