From ff9be0142d3f760cce12c0a278401f01d247f21c Mon Sep 17 00:00:00 2001 From: Haytham Salama Date: Sun, 6 Aug 2023 11:10:21 +0300 Subject: [PATCH 01/33] feat(Breadcrumb): new component --- .../examples/BreadcrumbExampleBasic.vue | 4 ++ docs/content/5.navigation/5.breadcrumb.md | 31 +++++++++++++ .../components/navigation/Breadcrumb.vue | 41 +++++++++++++++++ src/runtime/types/breadcrumb.d.ts | 3 ++ src/runtime/ui.config.ts | 44 +++++++++++++++++++ 5 files changed, 123 insertions(+) create mode 100644 docs/components/content/examples/BreadcrumbExampleBasic.vue create mode 100644 docs/content/5.navigation/5.breadcrumb.md create mode 100644 src/runtime/components/navigation/Breadcrumb.vue create mode 100644 src/runtime/types/breadcrumb.d.ts diff --git a/docs/components/content/examples/BreadcrumbExampleBasic.vue b/docs/components/content/examples/BreadcrumbExampleBasic.vue new file mode 100644 index 0000000000..a102332065 --- /dev/null +++ b/docs/components/content/examples/BreadcrumbExampleBasic.vue @@ -0,0 +1,4 @@ + + diff --git a/docs/content/5.navigation/5.breadcrumb.md b/docs/content/5.navigation/5.breadcrumb.md new file mode 100644 index 0000000000..599aeeef18 --- /dev/null +++ b/docs/content/5.navigation/5.breadcrumb.md @@ -0,0 +1,31 @@ +--- +description: A Navigational that showing user's path in website's hierarchical structure. +navigation: + badge: Edge +--- + +## Usage + +Pass an array to the `items` prop of the Tabs component. Each item can have the following properties: + +::component-example +#default +:breadcrumb-example-basic + +#code +```vue + +``` +:: + +:: + +## Props + +:component-props + +## Preset + +:component-preset diff --git a/src/runtime/components/navigation/Breadcrumb.vue b/src/runtime/components/navigation/Breadcrumb.vue new file mode 100644 index 0000000000..fb18fbabe5 --- /dev/null +++ b/src/runtime/components/navigation/Breadcrumb.vue @@ -0,0 +1,41 @@ + + + diff --git a/src/runtime/types/breadcrumb.d.ts b/src/runtime/types/breadcrumb.d.ts new file mode 100644 index 0000000000..237f8aa55f --- /dev/null +++ b/src/runtime/types/breadcrumb.d.ts @@ -0,0 +1,3 @@ +export interface BreadcrumbItem { + +} diff --git a/src/runtime/ui.config.ts b/src/runtime/ui.config.ts index 57d11a23d6..81cd2ebad2 100644 --- a/src/runtime/ui.config.ts +++ b/src/runtime/ui.config.ts @@ -878,6 +878,11 @@ export const tabs = { } } +const breadcrumb = { + wrapper: '', + container: '' +} + // Overlays export const modal = { @@ -1071,3 +1076,42 @@ export const notifications = { width: 'w-full sm:w-96', container: 'px-4 sm:px-6 py-6 space-y-3 overflow-y-auto' } + +export default { + ui: { + table, + avatar, + avatarGroup, + badge, + button, + buttonGroup, + dropdown, + kbd, + accordion, + alert, + input, + formGroup, + textarea, + select, + selectMenu, + checkbox, + radio, + toggle, + range, + card, + container, + skeleton, + verticalNavigation, + commandPalette, + pagination, + tabs, + breadcrumb, + modal, + slideover, + popover, + tooltip, + contextMenu, + notification, + notifications + } +} From 59c48881327c88475c8194d56c18dd1f33ffc39e Mon Sep 17 00:00:00 2001 From: Haytham Salama Date: Wed, 9 Aug 2023 00:29:53 +0300 Subject: [PATCH 02/33] up --- .../examples/BreadcrumbExampleBasic.vue | 21 +++++++- docs/content/5.navigation/5.breadcrumb.md | 9 ---- .../components/navigation/Breadcrumb.vue | 53 +++++++++++++++++-- src/runtime/types/breadcrumb.d.ts | 6 ++- src/runtime/ui.config.ts | 32 ++++++++++- 5 files changed, 105 insertions(+), 16 deletions(-) diff --git a/docs/components/content/examples/BreadcrumbExampleBasic.vue b/docs/components/content/examples/BreadcrumbExampleBasic.vue index a102332065..61d39ea4cc 100644 --- a/docs/components/content/examples/BreadcrumbExampleBasic.vue +++ b/docs/components/content/examples/BreadcrumbExampleBasic.vue @@ -1,4 +1,23 @@ + diff --git a/docs/content/5.navigation/5.breadcrumb.md b/docs/content/5.navigation/5.breadcrumb.md index 599aeeef18..a6dcf51d1b 100644 --- a/docs/content/5.navigation/5.breadcrumb.md +++ b/docs/content/5.navigation/5.breadcrumb.md @@ -11,15 +11,6 @@ Pass an array to the `items` prop of the Tabs component. Each item can have the ::component-example #default :breadcrumb-example-basic - -#code -```vue - -``` -:: - :: ## Props diff --git a/src/runtime/components/navigation/Breadcrumb.vue b/src/runtime/components/navigation/Breadcrumb.vue index fb18fbabe5..32b4c6f8bb 100644 --- a/src/runtime/components/navigation/Breadcrumb.vue +++ b/src/runtime/components/navigation/Breadcrumb.vue @@ -1,11 +1,35 @@ + + +``` :: +## Size + +Use the `size` prop to change the size of the Breadcrumb. + +::component-card +--- +baseProps: + items: + - text: Documentation + icon: i-heroicons-information-circle + to: /getting-started + - text: Installation + icon: i-heroicons-arrow-down-tray + to: /getting-started/installation + - text: Breadcrumb + icon: i-heroicons-link + to: /navigation/breadcrumb +props: + size: 'sm' +--- +:: + +## Divider + +Use the `divider` and `icon` prop to change the divider of the Breadcrumb. + +### Divider + +::component-card +--- +baseProps: + items: + - text: Documentation + icon: i-heroicons-information-circle + to: /getting-started + - text: Installation + icon: i-heroicons-arrow-down-tray + to: /getting-started/installation + - text: Breadcrumb + icon: i-heroicons-link + to: /navigation/breadcrumb +props: + divider: '/' +--- +:: + +### Icon + +::component-card +--- +baseProps: + items: + - text: Documentation + icon: i-heroicons-information-circle + to: /getting-started + - text: Installation + icon: i-heroicons-arrow-down-tray + to: /getting-started/installation + - text: Breadcrumb + icon: i-heroicons-link + to: /navigation/breadcrumb +excludedProps: + - icon +props: + icon: 'i-heroicons-chevron-right' +--- +:: + +## Tag + +Use the `tag` prop to change the root of HTML element tag of the Breadcrumb. and the `item-tag` prop to change the HTML element tag of the item. + + ## Props :component-props diff --git a/src/runtime/components/navigation/Breadcrumb.vue b/src/runtime/components/navigation/Breadcrumb.vue index 32b4c6f8bb..cc6771f8f4 100644 --- a/src/runtime/components/navigation/Breadcrumb.vue +++ b/src/runtime/components/navigation/Breadcrumb.vue @@ -1,7 +1,14 @@ @@ -57,7 +64,7 @@ export default defineComponent({ }, tag: { type: String, - default: 'ul' + default: 'ol' }, icon: { type: String, @@ -65,7 +72,7 @@ export default defineComponent({ }, divider: { type: String, - default: '/' + default: '' }, ui: { type: Object as PropType>, From 0a1990438794493af21a1021eeb5138272d98799 Mon Sep 17 00:00:00 2001 From: Haytham Salama Date: Fri, 11 Aug 2023 21:27:23 +0300 Subject: [PATCH 05/33] up --- .../examples/BreadcrumbExampleBasic.vue | 2 +- .../examples/BreadcrumbExampleDividerSlot.vue | 23 +++ .../examples/BreadcrumbExampleLeadingSlot.vue | 24 +++ .../examples/BreadcrumbExampleSlot.vue | 23 +++ docs/content/5.navigation/5.breadcrumb.md | 151 +++++++++++++++--- .../components/navigation/Breadcrumb.vue | 48 +++--- src/runtime/ui.config.ts | 10 +- 7 files changed, 231 insertions(+), 50 deletions(-) create mode 100644 docs/components/content/examples/BreadcrumbExampleDividerSlot.vue create mode 100644 docs/components/content/examples/BreadcrumbExampleLeadingSlot.vue create mode 100644 docs/components/content/examples/BreadcrumbExampleSlot.vue diff --git a/docs/components/content/examples/BreadcrumbExampleBasic.vue b/docs/components/content/examples/BreadcrumbExampleBasic.vue index 896a4f2294..61cfc10d98 100644 --- a/docs/components/content/examples/BreadcrumbExampleBasic.vue +++ b/docs/components/content/examples/BreadcrumbExampleBasic.vue @@ -1,7 +1,7 @@ + + diff --git a/docs/components/content/examples/BreadcrumbExampleLeadingSlot.vue b/docs/components/content/examples/BreadcrumbExampleLeadingSlot.vue new file mode 100644 index 0000000000..d95ee491e4 --- /dev/null +++ b/docs/components/content/examples/BreadcrumbExampleLeadingSlot.vue @@ -0,0 +1,24 @@ + + + diff --git a/docs/components/content/examples/BreadcrumbExampleSlot.vue b/docs/components/content/examples/BreadcrumbExampleSlot.vue new file mode 100644 index 0000000000..1ffe2d3a7e --- /dev/null +++ b/docs/components/content/examples/BreadcrumbExampleSlot.vue @@ -0,0 +1,23 @@ + + + diff --git a/docs/content/5.navigation/5.breadcrumb.md b/docs/content/5.navigation/5.breadcrumb.md index 073a098b0b..72538c751b 100644 --- a/docs/content/5.navigation/5.breadcrumb.md +++ b/docs/content/5.navigation/5.breadcrumb.md @@ -55,11 +55,11 @@ Use the `size` prop to change the size of the Breadcrumb. baseProps: items: - text: Documentation - icon: i-heroicons-information-circle + icon: i-heroicons-home + to: /getting-started + - text: Navigation + icon: i-heroicons-bars-3 to: /getting-started - - text: Installation - icon: i-heroicons-arrow-down-tray - to: /getting-started/installation - text: Breadcrumb icon: i-heroicons-link to: /navigation/breadcrumb @@ -70,25 +70,28 @@ props: ## Divider -Use the `divider` and `icon` prop to change the divider of the Breadcrumb. +Use the `divider` prop to customize the `icon` or `text` divider of the Breadcrumb, or change them globally in `ui.breadcrumb.default.divider` + +You can also set it to `null` to hide the divider. Additionally, you have the option to use the [`divider`](/navigation/breadcrumb#divider-1) slot to customize the divider of the Breadcrumb. -### Divider +### Text ::component-card --- baseProps: items: - text: Documentation - icon: i-heroicons-information-circle + icon: i-heroicons-home + to: /getting-started + - text: Navigation to: /getting-started - - text: Installation - icon: i-heroicons-arrow-down-tray - to: /getting-started/installation - text: Breadcrumb - icon: i-heroicons-link to: /navigation/breadcrumb +excludedProps: + divider props: - divider: '/' + divider: + text: '/' --- :: @@ -99,25 +102,133 @@ props: baseProps: items: - text: Documentation - icon: i-heroicons-information-circle + icon: i-heroicons-home + to: /getting-started + - text: Navigation to: /getting-started - - text: Installation - icon: i-heroicons-arrow-down-tray - to: /getting-started/installation - text: Breadcrumb - icon: i-heroicons-link to: /navigation/breadcrumb excludedProps: - - icon + divider props: - icon: 'i-heroicons-chevron-right' + divider: + icon: i-heroicons-arrow-right --- :: ## Tag -Use the `tag` prop to change the root of HTML element tag of the Breadcrumb. and the `item-tag` prop to change the HTML element tag of the item. +Use `tag` prop to modify the root HTML element tag of the Breadcrumb. Additionally, the `tag` is passed to the items within the Breadcrumb. +::component-card +--- +excludedProps: + tag + items +props: + tag: 'nav' + items: + - text: Documentation + icon: i-heroicons-home + tag: 'div' + to: /getting-started + - text: Navigation + tag: 'div' + to: /getting-started + - text: Breadcrumb + tag: 'div' + to: /navigation/breadcrumb +--- +:: + +## Slots +### `default` + +Use the `default` slot to customize the default of the Breadcrumb. + +::component-example +#default +:breadcrumb-example-slot + +#code +```vue + + + +``` +:: + +### `leading` + +Use the `leading` slot to add content before the Breadcrumb. +::component-example +#default +:breadcrumb-example-leading-slot + +#code +```vue + + + +``` +:: + +### `divider` + +Use the `divider` slot to customize the divider of the Breadcrumb. + +::component-example +#default +:breadcrumb-example-divider-slot + +#code +```vue + + + +``` +:: ## Props diff --git a/src/runtime/components/navigation/Breadcrumb.vue b/src/runtime/components/navigation/Breadcrumb.vue index cc6771f8f4..37e8662a0f 100644 --- a/src/runtime/components/navigation/Breadcrumb.vue +++ b/src/runtime/components/navigation/Breadcrumb.vue @@ -1,32 +1,32 @@ @@ -66,13 +66,9 @@ export default defineComponent({ type: String, default: 'ol' }, - icon: { - type: String, - default: () => appConfig.ui.breadcrumb.default.icon - }, divider: { - type: String, - default: '' + type: Object as PropType<{ icon: string, text: string }>, + default: () => appConfig.ui.breadcrumb.default.divider }, ui: { type: Object as PropType>, diff --git a/src/runtime/ui.config.ts b/src/runtime/ui.config.ts index 0b967fe11f..1cbf390696 100644 --- a/src/runtime/ui.config.ts +++ b/src/runtime/ui.config.ts @@ -899,14 +899,18 @@ const breadcrumb = { xl: 'h-6 w-6' } }, - active: 'text-primary-500 dark:text-primary-400 font-semibold', - inactive: 'text-gray-700 hover:text-gray-900 dark:text-gray-400 dark:hover:text-gray-300', item: { base: 'flex items-center', + link: 'flex items-center gap-x-1 disabled:cursor-not-allowed disabled:opacity-75', + active: 'text-primary-500 dark:text-primary-400 font-semibold', + inactive: 'text-gray-700 hover:text-gray-900 dark:text-gray-400 dark:hover:text-gray-300', divider: 'ms-1 flex' }, default: { - icon: 'i-heroicons-chevron-right', + divider: { + icon: 'i-heroicons-chevron-right', + text: '' + }, size: 'md' } } From 2219f831f4df294753f4b30a0806395308ed52e2 Mon Sep 17 00:00:00 2001 From: Haytham Salama Date: Fri, 11 Aug 2023 21:57:15 +0300 Subject: [PATCH 06/33] refactor: change to `item-tag` --- docs/content/5.navigation/5.breadcrumb.md | 28 +++++++++---------- .../components/navigation/Breadcrumb.vue | 6 +++- src/runtime/types/breadcrumb.d.ts | 1 - 3 files changed, 19 insertions(+), 16 deletions(-) diff --git a/docs/content/5.navigation/5.breadcrumb.md b/docs/content/5.navigation/5.breadcrumb.md index 72538c751b..cfc8c570a9 100644 --- a/docs/content/5.navigation/5.breadcrumb.md +++ b/docs/content/5.navigation/5.breadcrumb.md @@ -87,11 +87,11 @@ baseProps: to: /getting-started - text: Breadcrumb to: /navigation/breadcrumb -excludedProps: - divider props: - divider: + divider: text: '/' +excludedProps: + - divider --- :: @@ -108,40 +108,40 @@ baseProps: to: /getting-started - text: Breadcrumb to: /navigation/breadcrumb -excludedProps: - divider props: divider: icon: i-heroicons-arrow-right +excludedProps: + - divider --- :: ## Tag -Use `tag` prop to modify the root HTML element tag of the Breadcrumb. Additionally, the `tag` is passed to the items within the Breadcrumb. +Use `tag` prop to modify the root HTML element tag of the Breadcrumb. Additionally, the `item-tag` prop to modify the items of the Breadcrumb. ::component-card --- -excludedProps: - tag - items -props: - tag: 'nav' +baseProps: items: - text: Documentation icon: i-heroicons-home - tag: 'div' to: /getting-started - text: Navigation - tag: 'div' to: /getting-started - text: Breadcrumb - tag: 'div' to: /navigation/breadcrumb +props: + tag: 'nav' + item-tag: 'div' +excludedProps: + - tag + - item-tag --- :: ## Slots + ### `default` Use the `default` slot to customize the default of the Breadcrumb. diff --git a/src/runtime/components/navigation/Breadcrumb.vue b/src/runtime/components/navigation/Breadcrumb.vue index 37e8662a0f..356a202313 100644 --- a/src/runtime/components/navigation/Breadcrumb.vue +++ b/src/runtime/components/navigation/Breadcrumb.vue @@ -1,7 +1,7 @@