Skip to content

Commit

Permalink
Merge pull request #521 from storyblok/develop
Browse files Browse the repository at this point in the history
Release datepicker and new tab menu
  • Loading branch information
lisilinhart committed Mar 13, 2024
2 parents 5ddf1d1 + abc0409 commit eb6e8d9
Show file tree
Hide file tree
Showing 48 changed files with 2,397 additions and 1,652 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
],
"dependencies": {
"@popperjs/core": "^2.11.8",
"@vueuse/core": "^10.7.2",
"click-outside-vue3": "^4.0.1",
"dayjs": "^1.11.10",
"dompurify": "^3.0.6",
Expand Down
5 changes: 4 additions & 1 deletion src/components/Breadcrumbs/SbBreadcrumbs.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

<template v-for="(item, index) in items" v-else :key="item.label">
<SbBreadcrumbItem v-bind="item" />
<SbBreadcrumbSeparator v-if="index + 1 < items.length" />
<SbBreadcrumbSeparator v-if="hasSeperator(index, items.length)" />
</template>

<slot />
Expand Down Expand Up @@ -67,6 +67,9 @@ export default {
toggleDropdown() {
this.showDropdown = !this.showDropdown
},
hasSeperator(index: number, itemsLength: number) {
return index + 1 < itemsLength
},
},
}
</script>
60 changes: 57 additions & 3 deletions src/components/Datepicker/Datepicker.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,23 @@ const meta: Meta<typeof SbDatepicker> = {
type: 'datetime',
disabled: false,
isoDate: false,
timeZone: 'America/Detroit',
tzOffset: '',
timeZone: 'America/Sao_Paulo',
tzTooltip: '',
minDate: '',
maxDate: '',
minuteRange: 1,
disabledPast: false,
hourFormat: '24h',
inlineLabel: '',
showTimezoneInput: true,
disableTimezoneInput: false,
},
argTypes: {
timeZone: {
name: 'timeZone',
description:
'Use this property to bind the user timezone, for example "America/Detroit". The component will calculate the offset automatically',
'Use this property to bind the user timezone, for example "America/Sao_Paulo". The component will calculate the offset automatically',
defaultValue: 'UTC',
table: {
type: { summary: 'String' },
Expand Down Expand Up @@ -137,13 +142,43 @@ const meta: Meta<typeof SbDatepicker> = {
type: 'text',
},
},
hourFormat: {
name: 'hourFormat',
options: ['24h', '12h'],
description:
'Use the property `hour-format` to manipulate the time format shown in the timer select, values ​​can be 24h or 12h',
defaultValue: '24h',
control: {
type: 'select',
},
},
showTimezoneInput: {
name: 'showTimezoneInput',
description:
'With this property you can control whether the time zone input will appear in the time select component',
defaultValue: true,
control: {
type: 'boolean',
},
},
disableTimezoneInput: {
name: 'disableTimezoneInput',
description:
'With this property, the timezone will appear but in disabled mode, the user will only be able to see the timezone, but not change it.',
defaultValue: false,
control: {
type: 'boolean',
},
},
},
render: (args: Args) => ({
components: { SbDatepicker },

setup: () => {
const internalDatetimeValue = ref(
dayjs(args.modelValue).format('YYYY-MM-DD HH:mm'),
Array.isArray(args.modelValue)
? args.modelValue
: dayjs(args.modelValue).format('YYYY-MM-DD HH:mm'),
)
return { args, internalDatetimeValue }
},
Expand All @@ -163,9 +198,11 @@ const meta: Meta<typeof SbDatepicker> = {
export default meta

export const Default: Story = {}

export const TimeType: Story = {
args: {
minuteRange: 5,
hourFormat: '24h',
},

parameters: {
Expand All @@ -176,6 +213,7 @@ export const TimeType: Story = {
},
},
}

export const DateType: Story = {
args: {
type: 'date',
Expand Down Expand Up @@ -260,3 +298,19 @@ export const WithInlineLabel: Story = {
},
},
}

export const DateRange = {
args: {
modelValue: ['2023-12-02', '2023-12-20'],
type: 'daterange',
},

parameters: {
docs: {
description: {
story:
'With the `daterange` prop it is possible to select two different dates and this range value will be output as an array, with the first item being the first date in the range and the second the second date, such as `["2023-12-02", "2023-12-20"]`',
},
},
},
}
Loading

0 comments on commit eb6e8d9

Please sign in to comment.