From fbdf551bacf2865df99f32cc0c34b54a60029a57 Mon Sep 17 00:00:00 2001 From: Cagatay Civici Date: Tue, 4 Mar 2025 14:17:02 +0300 Subject: [PATCH] Add base button and demos --- apps/volt/assets/styles/tailwind.css | 7 +- apps/volt/doc/button/BadgeDoc.vue | 12 +- apps/volt/doc/button/ButtonGroupDoc.vue | 16 ++- apps/volt/doc/button/DisabledDoc.vue | 6 +- apps/volt/doc/button/HeadlessDoc.vue | 20 ++- apps/volt/doc/button/IconOnlyDoc.vue | 139 +++++++++++++++++- apps/volt/doc/button/IconsDoc.vue | 26 +++- apps/volt/doc/button/ImportDoc.vue | 33 ++--- apps/volt/doc/button/LinkDoc.vue | 20 ++- apps/volt/doc/button/LoadingDoc.vue | 25 +++- apps/volt/doc/button/OutlinedDoc.vue | 24 +++- apps/volt/doc/button/RaisedDoc.vue | 24 +++- apps/volt/doc/button/RaisedTextDoc.vue | 24 +++- apps/volt/doc/button/RoundedDoc.vue | 24 +++- apps/volt/doc/button/SeverityDoc.vue | 24 +++- apps/volt/doc/button/SizesDoc.vue | 14 +- apps/volt/doc/button/TemplateDoc.vue | 28 +++- apps/volt/doc/button/TextDoc.vue | 24 +++- apps/volt/pages/button/index.vue | 182 ++++++++++++------------ apps/volt/volt/button/index.vue | 20 ++- apps/volt/volt/buttongroup/index.vue | 23 +++ packages/primevue/src/button/Button.vue | 33 ++++- 22 files changed, 559 insertions(+), 189 deletions(-) create mode 100644 apps/volt/volt/buttongroup/index.vue diff --git a/apps/volt/assets/styles/tailwind.css b/apps/volt/assets/styles/tailwind.css index f803d4670..c9e31c457 100644 --- a/apps/volt/assets/styles/tailwind.css +++ b/apps/volt/assets/styles/tailwind.css @@ -33,4 +33,9 @@ @custom-variant p-removable (&[data-p~="removable"]); @custom-variant p-circle (&[data-p~="circle"]); @custom-variant p-determinate (&[data-p~="determinate"]); -@custom-variant p-indeterminate (&[data-p~="indeterminate"]); \ No newline at end of file +@custom-variant p-indeterminate (&[data-p~="indeterminate"]); +@custom-variant p-icon-only (&[data-p~="icon-only"]); +@custom-variant p-rounded (&[data-p~="rounded"]); +@custom-variant p-raised (&[data-p~="raised"]); +@custom-variant p-outlined (&[data-p~="outlined"]); +@custom-variant p-text (&[data-p~="text"]); \ No newline at end of file diff --git a/apps/volt/doc/button/BadgeDoc.vue b/apps/volt/doc/button/BadgeDoc.vue index 4a7ea0d70..13ae6c9d3 100644 --- a/apps/volt/doc/button/BadgeDoc.vue +++ b/apps/volt/doc/button/BadgeDoc.vue @@ -1,9 +1,10 @@ @@ -14,8 +15,9 @@ import { ref } from 'vue'; const code = ref(` diff --git a/apps/volt/doc/button/ButtonGroupDoc.vue b/apps/volt/doc/button/ButtonGroupDoc.vue index 4a7ea0d70..eed11ca37 100644 --- a/apps/volt/doc/button/ButtonGroupDoc.vue +++ b/apps/volt/doc/button/ButtonGroupDoc.vue @@ -1,26 +1,36 @@ diff --git a/apps/volt/doc/button/DisabledDoc.vue b/apps/volt/doc/button/DisabledDoc.vue index 4a7ea0d70..73909c733 100644 --- a/apps/volt/doc/button/DisabledDoc.vue +++ b/apps/volt/doc/button/DisabledDoc.vue @@ -1,9 +1,9 @@ @@ -15,7 +15,7 @@ import { ref } from 'vue'; const code = ref(` diff --git a/apps/volt/doc/button/HeadlessDoc.vue b/apps/volt/doc/button/HeadlessDoc.vue index 4a7ea0d70..ac0d00070 100644 --- a/apps/volt/doc/button/HeadlessDoc.vue +++ b/apps/volt/doc/button/HeadlessDoc.vue @@ -1,9 +1,16 @@ @@ -15,7 +22,14 @@ import { ref } from 'vue'; const code = ref(` diff --git a/apps/volt/doc/button/IconOnlyDoc.vue b/apps/volt/doc/button/IconOnlyDoc.vue index 4a7ea0d70..c5f58efb7 100644 --- a/apps/volt/doc/button/IconOnlyDoc.vue +++ b/apps/volt/doc/button/IconOnlyDoc.vue @@ -1,26 +1,155 @@ diff --git a/apps/volt/doc/button/IconsDoc.vue b/apps/volt/doc/button/IconsDoc.vue index 4a7ea0d70..82ec9d1a9 100644 --- a/apps/volt/doc/button/IconsDoc.vue +++ b/apps/volt/doc/button/IconsDoc.vue @@ -1,9 +1,17 @@ @@ -14,8 +22,16 @@ import { ref } from 'vue'; const code = ref(` diff --git a/apps/volt/doc/button/ImportDoc.vue b/apps/volt/doc/button/ImportDoc.vue index 4a7ea0d70..afeb349e3 100644 --- a/apps/volt/doc/button/ImportDoc.vue +++ b/apps/volt/doc/button/ImportDoc.vue @@ -1,26 +1,15 @@ - diff --git a/apps/volt/doc/button/LinkDoc.vue b/apps/volt/doc/button/LinkDoc.vue index 4a7ea0d70..67c47a1ca 100644 --- a/apps/volt/doc/button/LinkDoc.vue +++ b/apps/volt/doc/button/LinkDoc.vue @@ -1,9 +1,14 @@ @@ -14,8 +19,13 @@ import { ref } from 'vue'; const code = ref(` diff --git a/apps/volt/doc/button/LoadingDoc.vue b/apps/volt/doc/button/LoadingDoc.vue index 4a7ea0d70..8d776655b 100644 --- a/apps/volt/doc/button/LoadingDoc.vue +++ b/apps/volt/doc/button/LoadingDoc.vue @@ -1,9 +1,9 @@ @@ -12,15 +12,34 @@ import Button from '@/volt/button'; import { ref } from 'vue'; +const loading = ref(false); + +const load = () => { + loading.value = true; + setTimeout(() => { + loading.value = false; + }, 2000); +}; + const code = ref(` diff --git a/apps/volt/doc/button/OutlinedDoc.vue b/apps/volt/doc/button/OutlinedDoc.vue index 4a7ea0d70..0f342b17f 100644 --- a/apps/volt/doc/button/OutlinedDoc.vue +++ b/apps/volt/doc/button/OutlinedDoc.vue @@ -1,9 +1,16 @@ @@ -14,8 +21,15 @@ import { ref } from 'vue'; const code = ref(` diff --git a/apps/volt/doc/button/RaisedDoc.vue b/apps/volt/doc/button/RaisedDoc.vue index 4a7ea0d70..a3902a0d2 100644 --- a/apps/volt/doc/button/RaisedDoc.vue +++ b/apps/volt/doc/button/RaisedDoc.vue @@ -1,9 +1,16 @@ @@ -14,8 +21,15 @@ import { ref } from 'vue'; const code = ref(` diff --git a/apps/volt/doc/button/RaisedTextDoc.vue b/apps/volt/doc/button/RaisedTextDoc.vue index 4a7ea0d70..b37cb14bf 100644 --- a/apps/volt/doc/button/RaisedTextDoc.vue +++ b/apps/volt/doc/button/RaisedTextDoc.vue @@ -1,9 +1,16 @@ @@ -14,8 +21,15 @@ import { ref } from 'vue'; const code = ref(` diff --git a/apps/volt/doc/button/RoundedDoc.vue b/apps/volt/doc/button/RoundedDoc.vue index 4a7ea0d70..f2ce0140f 100644 --- a/apps/volt/doc/button/RoundedDoc.vue +++ b/apps/volt/doc/button/RoundedDoc.vue @@ -1,9 +1,16 @@ @@ -14,8 +21,15 @@ import { ref } from 'vue'; const code = ref(` diff --git a/apps/volt/doc/button/SeverityDoc.vue b/apps/volt/doc/button/SeverityDoc.vue index 4a7ea0d70..03abca029 100644 --- a/apps/volt/doc/button/SeverityDoc.vue +++ b/apps/volt/doc/button/SeverityDoc.vue @@ -1,9 +1,16 @@ @@ -14,8 +21,15 @@ import { ref } from 'vue'; const code = ref(` diff --git a/apps/volt/doc/button/SizesDoc.vue b/apps/volt/doc/button/SizesDoc.vue index 4a7ea0d70..660276244 100644 --- a/apps/volt/doc/button/SizesDoc.vue +++ b/apps/volt/doc/button/SizesDoc.vue @@ -1,9 +1,11 @@ @@ -14,8 +16,10 @@ import { ref } from 'vue'; const code = ref(` diff --git a/apps/volt/doc/button/TemplateDoc.vue b/apps/volt/doc/button/TemplateDoc.vue index 4a7ea0d70..7d4cfd876 100644 --- a/apps/volt/doc/button/TemplateDoc.vue +++ b/apps/volt/doc/button/TemplateDoc.vue @@ -1,9 +1,20 @@ @@ -15,7 +26,18 @@ import { ref } from 'vue'; const code = ref(` diff --git a/apps/volt/doc/button/TextDoc.vue b/apps/volt/doc/button/TextDoc.vue index 4a7ea0d70..199ef565a 100644 --- a/apps/volt/doc/button/TextDoc.vue +++ b/apps/volt/doc/button/TextDoc.vue @@ -1,9 +1,16 @@ @@ -14,8 +21,15 @@ import { ref } from 'vue'; const code = ref(` diff --git a/apps/volt/pages/button/index.vue b/apps/volt/pages/button/index.vue index fd8c9eee3..9c8b6b00f 100644 --- a/apps/volt/pages/button/index.vue +++ b/apps/volt/pages/button/index.vue @@ -25,97 +25,95 @@ import TextDoc from '@/doc/button/TextDoc.vue'; import { ref } from 'vue'; const docs = ref([ - [ - { - id: 'import', - label: 'Import', - component: ImportDoc - }, - { - id: 'basic', - label: 'Basic', - component: BasicDoc - }, - { - id: 'icons', - label: 'Icons', - component: IconsDoc - }, - { - id: 'loading', - label: 'Loading', - component: LoadingDoc - }, - { - id: 'link', - label: 'Link', - component: LinkDoc - }, - { - id: 'severity', - label: 'Severity', - component: SeverityDoc - }, - { - id: 'disabled', - label: 'Disabled', - component: DisabledDoc - }, - { - id: 'raised', - label: 'Raised', - component: RaisedDoc - }, - { - id: 'rounded', - label: 'Rounded', - component: RoundedDoc - }, - { - id: 'text', - label: 'Text', - component: TextDoc - }, - { - id: 'raisedtext', - label: 'Raised Text', - component: RaisedTextDoc - }, - { - id: 'outlined', - label: 'Outlined', - component: OutlinedDoc - }, - { - id: 'icononly', - label: 'Icon Only', - component: IconOnlyDoc - }, - { - id: 'badge', - label: 'Badge', - component: BadgeDoc - }, - { - id: 'buttongroup', - label: 'Button Group', - component: ButtonGroupDoc - }, - { - id: 'sizes', - label: 'Sizes', - component: SizesDoc - }, - { - id: 'template', - label: 'Template', - component: TemplateDoc - }, - { - id: 'headless', - label: 'Headless', - component: HeadlessDoc - } - ] + { + id: 'import', + label: 'Import', + component: ImportDoc + }, + { + id: 'basic', + label: 'Basic', + component: BasicDoc + }, + { + id: 'icons', + label: 'Icons', + component: IconsDoc + }, + { + id: 'loading', + label: 'Loading', + component: LoadingDoc + }, + { + id: 'link', + label: 'Link', + component: LinkDoc + }, + { + id: 'severity', + label: 'Severity', + component: SeverityDoc + }, + { + id: 'disabled', + label: 'Disabled', + component: DisabledDoc + }, + { + id: 'raised', + label: 'Raised', + component: RaisedDoc + }, + { + id: 'rounded', + label: 'Rounded', + component: RoundedDoc + }, + { + id: 'text', + label: 'Text', + component: TextDoc + }, + { + id: 'raisedtext', + label: 'Raised Text', + component: RaisedTextDoc + }, + { + id: 'outlined', + label: 'Outlined', + component: OutlinedDoc + }, + { + id: 'icononly', + label: 'Icon Only', + component: IconOnlyDoc + }, + { + id: 'badge', + label: 'Badge', + component: BadgeDoc + }, + { + id: 'buttongroup', + label: 'Button Group', + component: ButtonGroupDoc + }, + { + id: 'sizes', + label: 'Sizes', + component: SizesDoc + }, + { + id: 'template', + label: 'Template', + component: TemplateDoc + }, + { + id: 'headless', + label: 'Headless', + component: HeadlessDoc + } ]); diff --git a/apps/volt/volt/button/index.vue b/apps/volt/volt/button/index.vue index 7c2a40364..014890d14 100644 --- a/apps/volt/volt/button/index.vue +++ b/apps/volt/volt/button/index.vue @@ -18,6 +18,24 @@ import { ref } from 'vue'; import { ptViewMerge } from '../utils'; const theme = ref({ - root: `` + root: `inline-flex cursor-pointer select-none items-center justify-center overflow-hidden relative + px-3 py-2 gap-2 rounded-md disabled:pointer-events-none transition-colors duration-200 + bg-primary enabled:hover:bg-primary-emphasis enabled:active:bg-primary-emphasis-alt text-primary-contrast + border border-primary enabled:hover:border-primary-emphasis enabled:active:border-primary-emphasis-alt + focus-visible:outline focus-visible:outline-1 focus-visible:outline-offset-2 focus-visible:outline-primary + p-vertical:flex-col p-fluid:w-full p-fluid:p-icon-only:w-10 + p-icon-only:w-10 p-icon-only:px-0 p-icon-only:gap-0 + p-icon-only:p-rounded:rounded-full p-icon-only:p-rounded:h-10 + p-small:text-sm p-small:px-[0.625rem] p-small:py-[0.375rem] + p-large:text-[1.125rem] p-large:px-[0.875rem] p-large:py-[0.625rem] + p-raised:shadow-sm p-rounded:rounded-[2rem] + `, + loadingIcon: ``, + icon: `p-right:order-1 p-bottom:order-2`, + label: `font-medium p-icon-only:invisible p-icon-only:w-0 + p-small:text-sm p-large:text-[1.125rem]`, + pcBadge: { + root: `min-w-4 h-4 leading-4` + } }); diff --git a/apps/volt/volt/buttongroup/index.vue b/apps/volt/volt/buttongroup/index.vue new file mode 100644 index 000000000..4e47789b9 --- /dev/null +++ b/apps/volt/volt/buttongroup/index.vue @@ -0,0 +1,23 @@ + + + diff --git a/packages/primevue/src/button/Button.vue b/packages/primevue/src/button/Button.vue index d0a4828e6..19ce18ae4 100755 --- a/packages/primevue/src/button/Button.vue +++ b/packages/primevue/src/button/Button.vue @@ -1,14 +1,14 @@