@davidbirchall/core 1.0.8 → 1.0.9

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 (95) hide show
  1. package/dist/Button/types.d.ts +4 -0
  2. package/dist/Calendar/types.d.ts +22 -0
  3. package/{src/components/Card/types.ts → dist/Card/types.d.ts} +1 -1
  4. package/dist/Checkbox/types.d.ts +7 -0
  5. package/dist/DataTable/types.d.ts +11 -0
  6. package/dist/Dropdown/types.d.ts +13 -0
  7. package/dist/EmptyState/types.d.ts +8 -0
  8. package/dist/ErrorSummary/types.d.ts +4 -0
  9. package/dist/Heading/types.d.ts +6 -0
  10. package/dist/Input/types.d.ts +11 -0
  11. package/dist/Select/types.d.ts +15 -0
  12. package/dist/StatCard/types.d.ts +12 -0
  13. package/dist/Tag/types.d.ts +4 -0
  14. package/dist/TextArea/types.d.ts +11 -0
  15. package/dist/core.css +1 -0
  16. package/dist/core.js +24 -0
  17. package/dist/core.js.map +1 -0
  18. package/dist/core.umd.cjs +2 -0
  19. package/dist/core.umd.cjs.map +1 -0
  20. package/dist/index.d.ts +2 -0
  21. package/dist/package.json +27 -0
  22. package/package.json +4 -1
  23. package/.storybook/main.ts +0 -18
  24. package/.storybook/preview.ts +0 -14
  25. package/src/components/Badge/Badge.stories.ts +0 -147
  26. package/src/components/Badge/Badge.test.ts +0 -57
  27. package/src/components/Badge/Badge.vue +0 -79
  28. package/src/components/Button/Button.stories.ts +0 -80
  29. package/src/components/Button/Button.test.ts +0 -145
  30. package/src/components/Button/Button.vue +0 -108
  31. package/src/components/Button/types.ts +0 -4
  32. package/src/components/Calendar/Calendar.stories.ts +0 -261
  33. package/src/components/Calendar/Calendar.test.ts +0 -119
  34. package/src/components/Calendar/Calendar.vue +0 -528
  35. package/src/components/Calendar/types.ts +0 -20
  36. package/src/components/Card/Card.stories.ts +0 -88
  37. package/src/components/Card/Card.test.ts +0 -173
  38. package/src/components/Card/Card.vue +0 -59
  39. package/src/components/Checkbox/Checkbox.stories.ts +0 -126
  40. package/src/components/Checkbox/Checkbox.test.ts +0 -155
  41. package/src/components/Checkbox/Checkbox.vue +0 -121
  42. package/src/components/Checkbox/types.ts +0 -7
  43. package/src/components/DataTable/DataTable.stories.ts +0 -156
  44. package/src/components/DataTable/DataTable.test.ts +0 -185
  45. package/src/components/DataTable/DataTable.vue +0 -177
  46. package/src/components/DataTable/types.ts +0 -12
  47. package/src/components/DatePicker/DatePicker.stories.ts +0 -172
  48. package/src/components/DatePicker/DatePicker.test.ts +0 -87
  49. package/src/components/DatePicker/DatePicker.vue +0 -302
  50. package/src/components/Dropdown/Dropdown.stories.ts +0 -231
  51. package/src/components/Dropdown/Dropdown.vue +0 -314
  52. package/src/components/Dropdown/types.ts +0 -14
  53. package/src/components/EmptyState/EmptyState.stories.ts +0 -189
  54. package/src/components/EmptyState/EmptyState.vue +0 -215
  55. package/src/components/EmptyState/types.ts +0 -8
  56. package/src/components/ErrorSummary/ErrorSummary.vue +0 -78
  57. package/src/components/ErrorSummary/types.ts +0 -4
  58. package/src/components/FormGroup/FormGroup.stories.ts +0 -264
  59. package/src/components/FormGroup/FormGroup.test.ts +0 -63
  60. package/src/components/FormGroup/FormGroup.vue +0 -58
  61. package/src/components/Heading/Heading.stories.ts +0 -121
  62. package/src/components/Heading/Heading.test.ts +0 -184
  63. package/src/components/Heading/Heading.vue +0 -95
  64. package/src/components/Heading/types.ts +0 -6
  65. package/src/components/Input/Input.stories.ts +0 -172
  66. package/src/components/Input/Input.test.ts +0 -213
  67. package/src/components/Input/Input.vue +0 -121
  68. package/src/components/Input/types.ts +0 -11
  69. package/src/components/Modal/Modal.stories.ts +0 -341
  70. package/src/components/Modal/Modal.test.ts +0 -99
  71. package/src/components/Modal/Modal.vue +0 -278
  72. package/src/components/ProgressBar/ProgressBar.stories.ts +0 -313
  73. package/src/components/ProgressBar/ProgressBar.test.ts +0 -98
  74. package/src/components/ProgressBar/ProgressBar.vue +0 -117
  75. package/src/components/Select/Select.stories.ts +0 -177
  76. package/src/components/Select/Select.test.ts +0 -225
  77. package/src/components/Select/Select.vue +0 -147
  78. package/src/components/Select/types.ts +0 -16
  79. package/src/components/StatCard/StatCard.stories.ts +0 -274
  80. package/src/components/StatCard/StatCard.vue +0 -226
  81. package/src/components/StatCard/types.ts +0 -12
  82. package/src/components/Tag/Tag.stories.ts +0 -78
  83. package/src/components/Tag/Tag.test.ts +0 -50
  84. package/src/components/Tag/Tag.vue +0 -71
  85. package/src/components/Tag/types.ts +0 -4
  86. package/src/components/TextArea/TextArea.stories.ts +0 -171
  87. package/src/components/TextArea/TextArea.test.ts +0 -202
  88. package/src/components/TextArea/TextArea.vue +0 -122
  89. package/src/components/TextArea/types.ts +0 -11
  90. package/src/components/index.ts +0 -5
  91. package/src/test/setup.ts +0 -1
  92. package/src/vite-env.d.ts +0 -6
  93. package/tsconfig.json +0 -29
  94. package/vite.config.ts +0 -33
  95. package/vitest.config.ts +0 -28
@@ -0,0 +1,4 @@
1
+ export interface ButtonProps {
2
+ variant?: 'primary' | 'secondary' | 'danger';
3
+ disabled?: boolean;
4
+ }
@@ -0,0 +1,22 @@
1
+ export interface CalendarProps {
2
+ modelValue?: string | string[] | {
3
+ start: string;
4
+ end: string;
5
+ };
6
+ mode?: 'single' | 'multiple' | 'range';
7
+ minDate?: string;
8
+ maxDate?: string;
9
+ disabledDates?: string[];
10
+ locale?: string;
11
+ firstDayOfWeek?: 0 | 1 | 2 | 3 | 4 | 5 | 6;
12
+ initialDate?: string;
13
+ }
14
+ export interface CalendarDay {
15
+ date: Date;
16
+ dateString: string;
17
+ isCurrentMonth: boolean;
18
+ isToday: boolean;
19
+ isSelected: boolean;
20
+ isDisabled: boolean;
21
+ isInRange: boolean;
22
+ }
@@ -1,3 +1,3 @@
1
1
  export interface CardProps {
2
- hoverable?: boolean
2
+ hoverable?: boolean;
3
3
  }
@@ -0,0 +1,7 @@
1
+ export interface CheckboxProps {
2
+ modelValue?: boolean;
3
+ label?: string;
4
+ disabled?: boolean;
5
+ required?: boolean;
6
+ error?: string;
7
+ }
@@ -0,0 +1,11 @@
1
+ export interface DataTableColumn {
2
+ key: string;
3
+ label: string;
4
+ sortable?: boolean;
5
+ }
6
+ export interface DataTableProps {
7
+ columns: DataTableColumn[];
8
+ data: Record<string, any>[];
9
+ hoverable?: boolean;
10
+ emptyText?: string;
11
+ }
@@ -0,0 +1,13 @@
1
+ export interface DropdownItem {
2
+ label: string;
3
+ value: string;
4
+ icon?: string;
5
+ disabled?: boolean;
6
+ divider?: boolean;
7
+ }
8
+ export interface DropdownProps {
9
+ items?: DropdownItem[];
10
+ placement?: 'bottom-left' | 'bottom-right' | 'top-left' | 'top-right';
11
+ closeOnClick?: boolean;
12
+ disabled?: boolean;
13
+ }
@@ -0,0 +1,8 @@
1
+ export interface EmptyStateProps {
2
+ title?: string;
3
+ description?: string;
4
+ icon?: string;
5
+ actionText?: string;
6
+ actionVariant?: 'primary' | 'secondary';
7
+ size?: 'small' | 'medium' | 'large';
8
+ }
@@ -0,0 +1,4 @@
1
+ export type ErrorSummaryItem = {
2
+ id: string;
3
+ message: string;
4
+ };
@@ -0,0 +1,6 @@
1
+ export interface HeadingProps {
2
+ tag?: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
3
+ size?: '1' | '2' | '3' | '4' | '5' | '6';
4
+ weight?: 'light' | 'normal' | 'medium' | 'semibold' | 'bold';
5
+ align?: 'left' | 'center' | 'right';
6
+ }
@@ -0,0 +1,11 @@
1
+ export interface InputProps {
2
+ modelValue?: string | number;
3
+ id?: string;
4
+ label?: string;
5
+ type?: 'text' | 'email' | 'password' | 'number' | 'tel' | 'url' | 'time';
6
+ placeholder?: string;
7
+ disabled?: boolean;
8
+ required?: boolean;
9
+ error?: string;
10
+ hint?: string;
11
+ }
@@ -0,0 +1,15 @@
1
+ export interface SelectOption {
2
+ value: string | number;
3
+ label: string;
4
+ }
5
+ export interface SelectProps {
6
+ modelValue?: string | number;
7
+ id?: string;
8
+ label?: string;
9
+ options?: SelectOption[];
10
+ placeholder?: string;
11
+ disabled?: boolean;
12
+ required?: boolean;
13
+ error?: string;
14
+ hint?: string;
15
+ }
@@ -0,0 +1,12 @@
1
+ export interface StatCardProps {
2
+ title: string;
3
+ value: string | number;
4
+ variant?: 'default' | 'success' | 'warning' | 'danger';
5
+ prefix?: string;
6
+ suffix?: string;
7
+ editable?: boolean;
8
+ trend?: {
9
+ value: number;
10
+ direction: 'up' | 'down';
11
+ };
12
+ }
@@ -0,0 +1,4 @@
1
+ export interface TagProps {
2
+ variant?: 'default' | 'primary' | 'success' | 'warning' | 'danger' | 'info';
3
+ size?: 'small' | 'medium' | 'large';
4
+ }
@@ -0,0 +1,11 @@
1
+ export interface TextAreaProps {
2
+ modelValue?: string;
3
+ id?: string;
4
+ label?: string;
5
+ placeholder?: string;
6
+ disabled?: boolean;
7
+ required?: boolean;
8
+ rows?: number;
9
+ error?: string;
10
+ hint?: string;
11
+ }
package/dist/core.css ADDED
@@ -0,0 +1 @@
1
+ .badge[data-v-f310f0d4]{display:inline-flex;align-items:center;justify-content:center;font-weight:500;border-radius:.375rem;white-space:nowrap;transition:all .2s}.badge--small[data-v-f310f0d4]{padding:.125rem .5rem;font-size:.75rem;line-height:1.25}.badge--medium[data-v-f310f0d4]{padding:.25rem .75rem;font-size:.875rem;line-height:1.25}.badge--large[data-v-f310f0d4]{padding:.375rem 1rem;font-size:.9375rem;line-height:1.5}.badge--primary[data-v-f310f0d4]{background:linear-gradient(135deg,#667eea,#764ba2);color:#fff}.badge--secondary[data-v-f310f0d4]{background:#f3f4f6;color:#374151}.badge--success[data-v-f310f0d4]{background:#dcfce7;color:#166534}.badge--warning[data-v-f310f0d4]{background:#fef3c7;color:#92400e}.badge--danger[data-v-f310f0d4]{background:#fee2e2;color:#991b1b}.badge--info[data-v-f310f0d4]{background:#dbeafe;color:#1e40af}
package/dist/core.js ADDED
@@ -0,0 +1,24 @@
1
+ import { defineComponent as n, openBlock as s, createElementBlock as c, normalizeClass as d, renderSlot as l } from "vue";
2
+ const i = /* @__PURE__ */ n({
3
+ __name: "Badge",
4
+ props: {
5
+ variant: { default: "primary" },
6
+ size: { default: "medium" }
7
+ },
8
+ setup(e) {
9
+ return (t, a) => (s(), c("span", {
10
+ class: d(["badge", `badge--${e.variant}`, `badge--${e.size}`])
11
+ }, [
12
+ l(t.$slots, "default", {}, void 0, !0)
13
+ ], 2));
14
+ }
15
+ }), f = (e, t) => {
16
+ const a = e.__vccOpts || e;
17
+ for (const [o, r] of t)
18
+ a[o] = r;
19
+ return a;
20
+ }, p = /* @__PURE__ */ f(i, [["__scopeId", "data-v-f310f0d4"]]);
21
+ export {
22
+ p as Badge
23
+ };
24
+ //# sourceMappingURL=core.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"core.js","sources":["../src/components/Badge/Badge.vue?vue&type=script&setup=true&lang.ts"],"sourcesContent":["import { defineComponent as _defineComponent } from 'vue'\nimport { renderSlot as _renderSlot, normalizeClass as _normalizeClass, openBlock as _openBlock, createElementBlock as _createElementBlock } from \"vue\"\n\ninterface Props {\n variant?: 'primary' | 'secondary' | 'success' | 'warning' | 'danger' | 'info'\n size?: 'small' | 'medium' | 'large'\n}\n\n\nexport default /*@__PURE__*/_defineComponent({\n __name: 'Badge',\n props: {\n variant: { default: 'primary' },\n size: { default: 'medium' }\n },\n setup(__props: any) {\n\n\n\nreturn (_ctx: any,_cache: any) => {\n return (_openBlock(), _createElementBlock(\"span\", {\n class: _normalizeClass(['badge', `badge--${__props.variant}`, `badge--${__props.size}`])\n }, [\n _renderSlot(_ctx.$slots, \"default\", {}, undefined, true)\n ], 2))\n}\n}\n\n})"],"names":["_sfc_main","_defineComponent","__props","_ctx","_cache","_openBlock","_createElementBlock","_normalizeClass","_renderSlot"],"mappings":";AASA,MAAAA,IAA4BC,gBAAAA,EAAiB;AAAA,EAC3C,QAAQ;AAAA,EACR,OAAO;AAAA,IACL,SAAS,EAAE,SAAS,UAAA;AAAA,IACpB,MAAM,EAAE,SAAS,SAAA;AAAA,EAAS;AAAA,EAE5B,MAAMC,GAAc;AAItB,WAAO,CAACC,GAAUC,OACRC,EAAA,GAAcC,EAAoB,QAAQ;AAAA,MAChD,OAAOC,EAAgB,CAAC,SAAS,UAAUL,EAAQ,OAAO,IAAI,UAAUA,EAAQ,IAAI,EAAE,CAAC;AAAA,IAAA,GACtF;AAAA,MACDM,EAAYL,EAAK,QAAQ,WAAW,CAAA,GAAI,QAAW,EAAI;AAAA,IAAA,GACtD,CAAC;AAAA,EAEN;AAEA,CAAC;;;;;;"}
@@ -0,0 +1,2 @@
1
+ (function(t,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(t=typeof globalThis<"u"?globalThis:t||self,e(t.VueComponentLibrary={},t.Vue))})(this,(function(t,e){"use strict";const s=((n,o)=>{const a=n.__vccOpts||n;for(const[d,i]of o)a[d]=i;return a})(e.defineComponent({__name:"Badge",props:{variant:{default:"primary"},size:{default:"medium"}},setup(n){return(o,a)=>(e.openBlock(),e.createElementBlock("span",{class:e.normalizeClass(["badge",`badge--${n.variant}`,`badge--${n.size}`])},[e.renderSlot(o.$slots,"default",{},void 0,!0)],2))}}),[["__scopeId","data-v-f310f0d4"]]);t.Badge=s,Object.defineProperty(t,Symbol.toStringTag,{value:"Module"})}));
2
+ //# sourceMappingURL=core.umd.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"core.umd.cjs","sources":["../src/components/Badge/Badge.vue?vue&type=script&setup=true&lang.ts"],"sourcesContent":["import { defineComponent as _defineComponent } from 'vue'\nimport { renderSlot as _renderSlot, normalizeClass as _normalizeClass, openBlock as _openBlock, createElementBlock as _createElementBlock } from \"vue\"\n\ninterface Props {\n variant?: 'primary' | 'secondary' | 'success' | 'warning' | 'danger' | 'info'\n size?: 'small' | 'medium' | 'large'\n}\n\n\nexport default /*@__PURE__*/_defineComponent({\n __name: 'Badge',\n props: {\n variant: { default: 'primary' },\n size: { default: 'medium' }\n },\n setup(__props: any) {\n\n\n\nreturn (_ctx: any,_cache: any) => {\n return (_openBlock(), _createElementBlock(\"span\", {\n class: _normalizeClass(['badge', `badge--${__props.variant}`, `badge--${__props.size}`])\n }, [\n _renderSlot(_ctx.$slots, \"default\", {}, undefined, true)\n ], 2))\n}\n}\n\n})"],"names":["_defineComponent","__props","_ctx","_cache","_openBlock","_createElementBlock","_normalizeClass","_renderSlot"],"mappings":"sVAS4BA,kBAAiB,CAC3C,OAAQ,QACR,MAAO,CACL,QAAS,CAAE,QAAS,SAAA,EACpB,KAAM,CAAE,QAAS,QAAA,CAAS,EAE5B,MAAMC,EAAc,CAItB,MAAO,CAACC,EAAUC,KACRC,EAAAA,UAAA,EAAcC,EAAAA,mBAAoB,OAAQ,CAChD,MAAOC,EAAAA,eAAgB,CAAC,QAAS,UAAUL,EAAQ,OAAO,GAAI,UAAUA,EAAQ,IAAI,EAAE,CAAC,CAAA,EACtF,CACDM,EAAAA,WAAYL,EAAK,OAAQ,UAAW,CAAA,EAAI,OAAW,EAAI,CAAA,EACtD,CAAC,EAEN,CAEA,CAAC"}
@@ -0,0 +1,2 @@
1
+ import Badge from './Badge/Badge.vue';
2
+ export { Badge };
@@ -0,0 +1,27 @@
1
+ {
2
+ "name": "@davidbirchall/core",
3
+ "version": "1.0.9",
4
+ "description": "Vue 3 component library with TypeScript",
5
+ "type": "module",
6
+ "main": "./dist/index.cjs",
7
+ "module": "./dist/index.js",
8
+ "types": "./dist/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "types": "./dist/index.d.ts",
12
+ "import": "./dist/index.js",
13
+ "require": "./dist/index.cjs"
14
+ },
15
+ "./core.css": "./dist/core.css"
16
+ },
17
+ "keywords": [
18
+ "vue",
19
+ "components",
20
+ "typescript"
21
+ ],
22
+ "author": "David Birchall",
23
+ "license": "MIT",
24
+ "peerDependencies": {
25
+ "vue": "^3.4.0"
26
+ }
27
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@davidbirchall/core",
3
- "version": "1.0.8",
3
+ "version": "1.0.9",
4
4
  "description": "Vue 3 component library with TypeScript",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -17,6 +17,9 @@
17
17
  },
18
18
  "./core.css": "./dist/core.css"
19
19
  },
20
+ "files": [
21
+ "dist"
22
+ ],
20
23
  "scripts": {
21
24
  "dev": "vite build --watch",
22
25
  "build": "vite build && tsc --emitDeclarationOnly",
@@ -1,18 +0,0 @@
1
- import type { StorybookConfig } from '@storybook/vue3-vite'
2
-
3
- const config: StorybookConfig = {
4
- stories: ['../src/**/*.stories.@(js|jsx|mjs|ts|tsx)'],
5
- addons: [
6
- '@storybook/addon-essentials',
7
- '@storybook/addon-links'
8
- ],
9
- framework: {
10
- name: '@storybook/vue3-vite',
11
- options: {}
12
- },
13
- docs: {
14
- autodocs: 'tag'
15
- }
16
- }
17
-
18
- export default config
@@ -1,14 +0,0 @@
1
- import type { Preview } from '@storybook/vue3'
2
-
3
- const preview: Preview = {
4
- parameters: {
5
- controls: {
6
- matchers: {
7
- color: /(background|color)$/i,
8
- date: /Date$/i
9
- }
10
- }
11
- }
12
- }
13
-
14
- export default preview
@@ -1,147 +0,0 @@
1
- import type { Meta, StoryObj } from '@storybook/vue3'
2
- import Badge from './Badge.vue'
3
-
4
- const meta = {
5
- title: 'Components/Badge',
6
- component: Badge,
7
- tags: ['autodocs'],
8
- argTypes: {
9
- variant: {
10
- control: 'select',
11
- options: ['primary', 'secondary', 'success', 'warning', 'danger', 'info'],
12
- description: 'Badge color variant'
13
- },
14
- size: {
15
- control: 'select',
16
- options: ['small', 'medium', 'large'],
17
- description: 'Badge size'
18
- }
19
- },
20
- args: {
21
- variant: 'primary',
22
- size: 'medium'
23
- }
24
- } satisfies Meta<typeof Badge>
25
-
26
- export default meta
27
- type Story = StoryObj<typeof meta>
28
-
29
- export const Primary: Story = {
30
- args: {
31
- variant: 'primary'
32
- },
33
- render: (args: any) => ({
34
- components: { Badge },
35
- setup() {
36
- return { args }
37
- },
38
- template: '<Badge v-bind="args">Primary</Badge>'
39
- })
40
- }
41
-
42
- export const Success: Story = {
43
- args: {
44
- variant: 'success'
45
- },
46
- render: (args: any) => ({
47
- components: { Badge },
48
- setup() {
49
- return { args }
50
- },
51
- template: '<Badge v-bind="args">Success</Badge>'
52
- })
53
- }
54
-
55
- export const Warning: Story = {
56
- args: {
57
- variant: 'warning'
58
- },
59
- render: (args: any) => ({
60
- components: { Badge },
61
- setup() {
62
- return { args }
63
- },
64
- template: '<Badge v-bind="args">Warning</Badge>'
65
- })
66
- }
67
-
68
- export const Danger: Story = {
69
- args: {
70
- variant: 'danger'
71
- },
72
- render: (args: any) => ({
73
- components: { Badge },
74
- setup() {
75
- return { args }
76
- },
77
- template: '<Badge v-bind="args">Danger</Badge>'
78
- })
79
- }
80
-
81
- export const Info: Story = {
82
- args: {
83
- variant: 'info'
84
- },
85
- render: (args: any) => ({
86
- components: { Badge },
87
- setup() {
88
- return { args }
89
- },
90
- template: '<Badge v-bind="args">Info</Badge>'
91
- })
92
- }
93
-
94
- export const Small: Story = {
95
- args: {
96
- size: 'small'
97
- },
98
- render: (args: any) => ({
99
- components: { Badge },
100
- setup() {
101
- return { args }
102
- },
103
- template: '<Badge v-bind="args">Small Badge</Badge>'
104
- })
105
- }
106
-
107
- export const Large: Story = {
108
- args: {
109
- size: 'large'
110
- },
111
- render: (args: any) => ({
112
- components: { Badge },
113
- setup() {
114
- return { args }
115
- },
116
- template: '<Badge v-bind="args">Large Badge</Badge>'
117
- })
118
- }
119
-
120
- export const AllVariants: Story = {
121
- render: () => ({
122
- components: { Badge },
123
- template: `
124
- <div style="display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center;">
125
- <Badge variant="primary">Primary</Badge>
126
- <Badge variant="secondary">Secondary</Badge>
127
- <Badge variant="success">Success</Badge>
128
- <Badge variant="warning">Warning</Badge>
129
- <Badge variant="danger">Danger</Badge>
130
- <Badge variant="info">Info</Badge>
131
- </div>
132
- `
133
- })
134
- }
135
-
136
- export const AllSizes: Story = {
137
- render: () => ({
138
- components: { Badge },
139
- template: `
140
- <div style="display: flex; gap: 0.5rem; align-items: center;">
141
- <Badge size="small">Small</Badge>
142
- <Badge size="medium">Medium</Badge>
143
- <Badge size="large">Large</Badge>
144
- </div>
145
- `
146
- })
147
- }
@@ -1,57 +0,0 @@
1
- import { describe, it, expect } from 'vitest'
2
- import { mount } from '@vue/test-utils'
3
- import Badge from './Badge.vue'
4
-
5
- describe('Badge', () => {
6
- it('renders slot content', () => {
7
- const wrapper = mount(Badge, {
8
- slots: {
9
- default: 'New'
10
- }
11
- })
12
- expect(wrapper.text()).toBe('New')
13
- })
14
-
15
- it('applies primary variant by default', () => {
16
- const wrapper = mount(Badge)
17
- expect(wrapper.classes()).toContain('badge--primary')
18
- })
19
-
20
- it('applies correct variant class', () => {
21
- const variants = ['primary', 'secondary', 'success', 'warning', 'danger', 'info'] as const
22
-
23
- variants.forEach(variant => {
24
- const wrapper = mount(Badge, {
25
- props: { variant }
26
- })
27
- expect(wrapper.classes()).toContain(`badge--${variant}`)
28
- })
29
- })
30
-
31
- it('applies medium size by default', () => {
32
- const wrapper = mount(Badge)
33
- expect(wrapper.classes()).toContain('badge--medium')
34
- })
35
-
36
- it('applies correct size class', () => {
37
- const sizes = ['small', 'medium', 'large'] as const
38
-
39
- sizes.forEach(size => {
40
- const wrapper = mount(Badge, {
41
- props: { size }
42
- })
43
- expect(wrapper.classes()).toContain(`badge--${size}`)
44
- })
45
- })
46
-
47
- it('combines variant and size classes', () => {
48
- const wrapper = mount(Badge, {
49
- props: {
50
- variant: 'success',
51
- size: 'large'
52
- }
53
- })
54
- expect(wrapper.classes()).toContain('badge--success')
55
- expect(wrapper.classes()).toContain('badge--large')
56
- })
57
- })
@@ -1,79 +0,0 @@
1
- <template>
2
- <span :class="['badge', `badge--${variant}`, `badge--${size}`]">
3
- <slot />
4
- </span>
5
- </template>
6
-
7
- <script setup lang="ts">
8
- interface Props {
9
- variant?: 'primary' | 'secondary' | 'success' | 'warning' | 'danger' | 'info'
10
- size?: 'small' | 'medium' | 'large'
11
- }
12
-
13
- withDefaults(defineProps<Props>(), {
14
- variant: 'primary',
15
- size: 'medium'
16
- })
17
- </script>
18
-
19
- <style scoped>
20
- .badge {
21
- display: inline-flex;
22
- align-items: center;
23
- justify-content: center;
24
- font-weight: 500;
25
- border-radius: 0.375rem;
26
- white-space: nowrap;
27
- transition: all 0.2s;
28
- }
29
-
30
- /* Sizes */
31
- .badge--small {
32
- padding: 0.125rem 0.5rem;
33
- font-size: 0.75rem;
34
- line-height: 1.25;
35
- }
36
-
37
- .badge--medium {
38
- padding: 0.25rem 0.75rem;
39
- font-size: 0.875rem;
40
- line-height: 1.25;
41
- }
42
-
43
- .badge--large {
44
- padding: 0.375rem 1rem;
45
- font-size: 0.9375rem;
46
- line-height: 1.5;
47
- }
48
-
49
- /* Variants */
50
- .badge--primary {
51
- background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
52
- color: white;
53
- }
54
-
55
- .badge--secondary {
56
- background: #f3f4f6;
57
- color: #374151;
58
- }
59
-
60
- .badge--success {
61
- background: #dcfce7;
62
- color: #166534;
63
- }
64
-
65
- .badge--warning {
66
- background: #fef3c7;
67
- color: #92400e;
68
- }
69
-
70
- .badge--danger {
71
- background: #fee2e2;
72
- color: #991b1b;
73
- }
74
-
75
- .badge--info {
76
- background: #dbeafe;
77
- color: #1e40af;
78
- }
79
- </style>
@@ -1,80 +0,0 @@
1
- import type { Meta, StoryObj } from '@storybook/vue3'
2
- import Button from './Button.vue'
3
-
4
- const meta = {
5
- title: 'Components/Button',
6
- component: Button,
7
- tags: ['autodocs'],
8
- argTypes: {
9
- variant: {
10
- control: 'select',
11
- options: ['primary', 'secondary', 'danger'],
12
- description: 'Button variant style'
13
- },
14
- disabled: {
15
- control: 'boolean',
16
- description: 'Disabled state'
17
- },
18
- onClick: { action: 'clicked' }
19
- },
20
- args: {
21
- variant: 'primary',
22
- disabled: false
23
- }
24
- } satisfies Meta<typeof Button>
25
-
26
- export default meta
27
- type Story = StoryObj<typeof meta>
28
-
29
- export const Primary: Story = {
30
- args: {
31
- variant: 'primary'
32
- },
33
- render: (args: any) => ({
34
- components: { Button },
35
- setup() {
36
- return { args }
37
- },
38
- template: '<Button v-bind="args">Click me</Button>'
39
- })
40
- }
41
-
42
- export const Secondary: Story = {
43
- args: {
44
- variant: 'secondary'
45
- },
46
- render: (args: any) => ({
47
- components: { Button },
48
- setup() {
49
- return { args }
50
- },
51
- template: '<Button v-bind="args">Click me</Button>'
52
- })
53
- }
54
-
55
- export const Danger: Story = {
56
- args: {
57
- variant: 'danger'
58
- },
59
- render: (args: any) => ({
60
- components: { Button },
61
- setup() {
62
- return { args }
63
- },
64
- template: '<Button v-bind="args">Delete</Button>'
65
- })
66
- }
67
-
68
- export const Disabled: Story = {
69
- args: {
70
- variant: 'primary',
71
- disabled: true
72
- },
73
- render: (args: any) => ({
74
- components: { Button },
75
- setup() {
76
- return { args }
77
- },
78
- template: '<Button v-bind="args">Disabled</Button>'
79
- })
80
- }