@davidbirchall/core 1.0.6 → 1.0.8

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/.storybook/main.ts +18 -0
  2. package/.storybook/preview.ts +14 -0
  3. package/package.json +1 -4
  4. package/src/components/Badge/Badge.stories.ts +147 -0
  5. package/src/components/Badge/Badge.test.ts +57 -0
  6. package/src/components/Badge/Badge.vue +79 -0
  7. package/src/components/Button/Button.stories.ts +80 -0
  8. package/src/components/Button/Button.test.ts +145 -0
  9. package/src/components/Button/Button.vue +108 -0
  10. package/src/components/Button/types.ts +4 -0
  11. package/src/components/Calendar/Calendar.stories.ts +261 -0
  12. package/src/components/Calendar/Calendar.test.ts +119 -0
  13. package/src/components/Calendar/Calendar.vue +528 -0
  14. package/src/components/Calendar/types.ts +20 -0
  15. package/src/components/Card/Card.stories.ts +88 -0
  16. package/src/components/Card/Card.test.ts +173 -0
  17. package/src/components/Card/Card.vue +59 -0
  18. package/{dist/Card/types.d.ts → src/components/Card/types.ts} +1 -1
  19. package/src/components/Checkbox/Checkbox.stories.ts +126 -0
  20. package/src/components/Checkbox/Checkbox.test.ts +155 -0
  21. package/src/components/Checkbox/Checkbox.vue +121 -0
  22. package/src/components/Checkbox/types.ts +7 -0
  23. package/src/components/DataTable/DataTable.stories.ts +156 -0
  24. package/src/components/DataTable/DataTable.test.ts +185 -0
  25. package/src/components/DataTable/DataTable.vue +177 -0
  26. package/src/components/DataTable/types.ts +12 -0
  27. package/src/components/DatePicker/DatePicker.stories.ts +172 -0
  28. package/src/components/DatePicker/DatePicker.test.ts +87 -0
  29. package/src/components/DatePicker/DatePicker.vue +302 -0
  30. package/src/components/Dropdown/Dropdown.stories.ts +231 -0
  31. package/src/components/Dropdown/Dropdown.vue +314 -0
  32. package/src/components/Dropdown/types.ts +14 -0
  33. package/src/components/EmptyState/EmptyState.stories.ts +189 -0
  34. package/src/components/EmptyState/EmptyState.vue +215 -0
  35. package/src/components/EmptyState/types.ts +8 -0
  36. package/src/components/ErrorSummary/ErrorSummary.vue +78 -0
  37. package/src/components/ErrorSummary/types.ts +4 -0
  38. package/src/components/FormGroup/FormGroup.stories.ts +264 -0
  39. package/src/components/FormGroup/FormGroup.test.ts +63 -0
  40. package/src/components/FormGroup/FormGroup.vue +58 -0
  41. package/src/components/Heading/Heading.stories.ts +121 -0
  42. package/src/components/Heading/Heading.test.ts +184 -0
  43. package/src/components/Heading/Heading.vue +95 -0
  44. package/src/components/Heading/types.ts +6 -0
  45. package/src/components/Input/Input.stories.ts +172 -0
  46. package/src/components/Input/Input.test.ts +213 -0
  47. package/src/components/Input/Input.vue +121 -0
  48. package/src/components/Input/types.ts +11 -0
  49. package/src/components/Modal/Modal.stories.ts +341 -0
  50. package/src/components/Modal/Modal.test.ts +99 -0
  51. package/src/components/Modal/Modal.vue +278 -0
  52. package/src/components/ProgressBar/ProgressBar.stories.ts +313 -0
  53. package/src/components/ProgressBar/ProgressBar.test.ts +98 -0
  54. package/src/components/ProgressBar/ProgressBar.vue +117 -0
  55. package/src/components/Select/Select.stories.ts +177 -0
  56. package/src/components/Select/Select.test.ts +225 -0
  57. package/src/components/Select/Select.vue +147 -0
  58. package/src/components/Select/types.ts +16 -0
  59. package/src/components/StatCard/StatCard.stories.ts +274 -0
  60. package/src/components/StatCard/StatCard.vue +226 -0
  61. package/src/components/StatCard/types.ts +12 -0
  62. package/src/components/Tag/Tag.stories.ts +78 -0
  63. package/src/components/Tag/Tag.test.ts +50 -0
  64. package/src/components/Tag/Tag.vue +71 -0
  65. package/src/components/Tag/types.ts +4 -0
  66. package/src/components/TextArea/TextArea.stories.ts +171 -0
  67. package/src/components/TextArea/TextArea.test.ts +202 -0
  68. package/src/components/TextArea/TextArea.vue +122 -0
  69. package/src/components/TextArea/types.ts +11 -0
  70. package/src/components/index.ts +5 -0
  71. package/src/test/setup.ts +1 -0
  72. package/src/vite-env.d.ts +6 -0
  73. package/tsconfig.json +29 -0
  74. package/vite.config.ts +33 -0
  75. package/vitest.config.ts +28 -0
  76. package/dist/Button/types.d.ts +0 -4
  77. package/dist/Calendar/types.d.ts +0 -22
  78. package/dist/Checkbox/types.d.ts +0 -7
  79. package/dist/DataTable/types.d.ts +0 -11
  80. package/dist/Dropdown/types.d.ts +0 -13
  81. package/dist/EmptyState/types.d.ts +0 -8
  82. package/dist/ErrorSummary/types.d.ts +0 -4
  83. package/dist/Heading/types.d.ts +0 -6
  84. package/dist/Input/types.d.ts +0 -11
  85. package/dist/Select/types.d.ts +0 -15
  86. package/dist/StatCard/types.d.ts +0 -12
  87. package/dist/Tag/types.d.ts +0 -4
  88. package/dist/TextArea/types.d.ts +0 -11
  89. package/dist/core.css +0 -1
  90. package/dist/core.js +0 -24
  91. package/dist/core.js.map +0 -1
  92. package/dist/core.umd.cjs +0 -2
  93. package/dist/core.umd.cjs.map +0 -1
  94. package/dist/index.d.ts +0 -2
  95. package/dist/package.json +0 -27
@@ -0,0 +1,5 @@
1
+ import Badge from './Badge/Badge.vue'
2
+
3
+ export {
4
+ Badge
5
+ }
@@ -0,0 +1 @@
1
+ // import '@testing-library/jest-dom/vitest'
@@ -0,0 +1,6 @@
1
+ /* eslint-disable */
2
+ declare module '*.vue' {
3
+ import type { DefineComponent } from 'vue'
4
+ const component: DefineComponent<{}, {}, any>
5
+ export default component
6
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,29 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2020",
4
+ "module": "ESNext",
5
+ "lib": ["ES2020", "DOM", "DOM.Iterable"],
6
+ "jsx": "preserve",
7
+ "moduleResolution": "bundler",
8
+ "resolveJsonModule": true,
9
+ "allowImportingTsExtensions": true,
10
+ "strict": true,
11
+ "noUnusedLocals": true,
12
+ "noUnusedParameters": true,
13
+ "noFallthroughCasesInSwitch": true,
14
+ "skipLibCheck": true,
15
+ "esModuleInterop": true,
16
+ "declaration": true,
17
+ "declarationDir": "./dist",
18
+ "emitDeclarationOnly": true,
19
+ "outDir": "./dist"
20
+ },
21
+ "include": ["src/**/*.ts", "src/**/*.tsx", "src/**/*.vue"],
22
+ "exclude": [
23
+ "node_modules",
24
+ "dist",
25
+ "**/*.stories.ts",
26
+ "**/*.test.ts",
27
+ "src/test"
28
+ ]
29
+ }
package/vite.config.ts ADDED
@@ -0,0 +1,33 @@
1
+ import { defineConfig } from 'vite'
2
+ import vue from '@vitejs/plugin-vue'
3
+ import { resolve } from 'path'
4
+
5
+ export default defineConfig({
6
+ plugins: [vue()],
7
+ build: {
8
+ lib: {
9
+ entry: resolve(__dirname, 'src/components/index.ts'),
10
+ name: 'VueComponentLibrary',
11
+ // fileName: (format) => `index.${format === 'es' ? 'js' : 'cjs'}`
12
+ formats: ['es', 'umd']
13
+ },
14
+ rollupOptions: {
15
+ external: ['vue'],
16
+ input: 'src/components/index.ts',
17
+ output: {
18
+ sourcemap: true,
19
+ globals: {
20
+ vue: 'Vue'
21
+ },
22
+ assetFileNames: (assetInfo) => {
23
+ // Use the first name in the names array
24
+ const assetName = assetInfo.names?.[0] ?? ''
25
+ if (assetName.endsWith('.css')) {
26
+ return 'core.css'
27
+ }
28
+ return assetName || '[name].[ext]'
29
+ }
30
+ },
31
+ }
32
+ }
33
+ })
@@ -0,0 +1,28 @@
1
+ import { defineConfig } from 'vitest/config'
2
+ import vue from '@vitejs/plugin-vue'
3
+ import { resolve } from 'path'
4
+
5
+ export default defineConfig({
6
+ plugins: [vue()],
7
+ test: {
8
+ globals: true,
9
+ environment: 'happy-dom',
10
+ setupFiles: ['./src/test/setup.ts'],
11
+ coverage: {
12
+ provider: 'v8',
13
+ reporter: ['text', 'json', 'html'],
14
+ exclude: [
15
+ 'node_modules/',
16
+ 'dist/',
17
+ '**/*.stories.ts',
18
+ '**/*.d.ts',
19
+ '.storybook/'
20
+ ]
21
+ }
22
+ },
23
+ resolve: {
24
+ alias: {
25
+ '@': resolve(__dirname, 'src')
26
+ }
27
+ }
28
+ })
@@ -1,4 +0,0 @@
1
- export interface ButtonProps {
2
- variant?: 'primary' | 'secondary' | 'danger';
3
- disabled?: boolean;
4
- }
@@ -1,22 +0,0 @@
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,7 +0,0 @@
1
- export interface CheckboxProps {
2
- modelValue?: boolean;
3
- label?: string;
4
- disabled?: boolean;
5
- required?: boolean;
6
- error?: string;
7
- }
@@ -1,11 +0,0 @@
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
- }
@@ -1,13 +0,0 @@
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
- }
@@ -1,8 +0,0 @@
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
- }
@@ -1,4 +0,0 @@
1
- export type ErrorSummaryItem = {
2
- id: string;
3
- message: string;
4
- };
@@ -1,6 +0,0 @@
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
- }
@@ -1,11 +0,0 @@
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
- }
@@ -1,15 +0,0 @@
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
- }
@@ -1,12 +0,0 @@
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
- }
@@ -1,4 +0,0 @@
1
- export interface TagProps {
2
- variant?: 'default' | 'primary' | 'success' | 'warning' | 'danger' | 'info';
3
- size?: 'small' | 'medium' | 'large';
4
- }
@@ -1,11 +0,0 @@
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 DELETED
@@ -1 +0,0 @@
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 DELETED
@@ -1,24 +0,0 @@
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
package/dist/core.js.map DELETED
@@ -1 +0,0 @@
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;;;;;;"}
package/dist/core.umd.cjs DELETED
@@ -1,2 +0,0 @@
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
@@ -1 +0,0 @@
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"}
package/dist/index.d.ts DELETED
@@ -1,2 +0,0 @@
1
- import Badge from './Badge/Badge.vue';
2
- export { Badge };
package/dist/package.json DELETED
@@ -1,27 +0,0 @@
1
- {
2
- "name": "@davidbirchall/core",
3
- "version": "1.0.6",
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
- }