whelk-ui 0.0.0 → 0.0.2

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.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 NearBeach
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,5 +1,31 @@
1
- # Vue 3 + TypeScript + Vite
1
+ Whelk UI
2
+ ========
2
3
 
3
- This template should help get you started developing with Vue 3 and TypeScript in Vite. The template uses Vue 3 `<script setup>` SFCs, check out the [script setup docs](https://v3.vuejs.org/api/sfc-script-setup.html#sfc-script-setup) to learn more.
4
+ ***Coming soon - The VueJS UI Components used to build NearBeach***
4
5
 
5
- Learn more about the recommended Project Setup and IDE Support in the [Vue Docs TypeScript Guide](https://vuejs.org/guide/typescript/overview.html#project-setup).
6
+ **Author:** *Robotichead*
7
+
8
+ ---
9
+
10
+ # Component Completion
11
+
12
+ You can follow the completion status on [NearBeach's 0.32 Component Reconstruction kanban board](https://prod.nearbeach.app/public/kanban_board/14/dfa1f175-faa2-4dd1-a2f3-f2c8c507bee4/)
13
+
14
+ ## Forms
15
+
16
+ - [] Checkbox
17
+ - [] Datetime picker
18
+ - [] Date picker
19
+ - [] Email Input
20
+ - [] Form Group
21
+ - [] Multi select
22
+ - [] Password Input
23
+ - [] Select
24
+ - [] Text Input
25
+ - [] Time picker
26
+ - [] Toggle
27
+ - [] Website Input
28
+
29
+ ## Generic
30
+
31
+ - [] Tooltip
package/index.html ADDED
@@ -0,0 +1,16 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <link rel="icon" href="https://cdn.nearbeach.org/0.31.102/NearBeach/NearBeach_Small.png">
6
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
7
+ <title>Whelk UI</title>
8
+ <link rel="preconnect" href="https://fonts.googleapis.com">
9
+ <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
10
+ <link href="https://fonts.googleapis.com/css2?family=Open+Sans:wght@500&display=swap" rel="stylesheet">
11
+ </head>
12
+ <body style="margin:0;padding:0;">
13
+ <div id="app"></div>
14
+ <script type="module" src="/src/main.ts"></script>
15
+ </body>
16
+ </html>
package/package.json CHANGED
@@ -1,15 +1,15 @@
1
1
  {
2
2
  "name": "whelk-ui",
3
3
  "private": false,
4
- "version": "0.0.0",
4
+ "version": "0.0.2",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "dev": "vite",
8
8
  "build": "vue-tsc -b && vite build",
9
- "preview": "vite preview"
9
+ "preview": "vite preview",
10
+ "test:unit": "vitest"
10
11
  },
11
12
  "dependencies": {
12
- "lucide-vue-next": "^0.562.0",
13
13
  "vue": "^3.5.24"
14
14
  },
15
15
  "devDependencies": {
@@ -20,13 +20,12 @@
20
20
  "@vitest/coverage-v8": "^4.0.8",
21
21
  "@vitest/eslint-plugin": "^1.4.0",
22
22
  "@vue/tsconfig": "^0.8.1",
23
+ "petite-vue-i18n": "^11.2.8",
23
24
  "postcss": "^8.5.6",
24
- "postcss-custom-media": "^11.0.6",
25
25
  "postcss-nesting": "^13.0.2",
26
26
  "typescript": "~5.9.3",
27
27
  "vite": "^7.2.4",
28
- "vite-plugin-vue-devtools": "^8.0.3",
29
- "vitest": "^4.0.8",
28
+ "vitest": "^4.0.18",
30
29
  "vitest-browser-vue": "^2.0.1",
31
30
  "vue-tsc": "^3.1.4"
32
31
  }
package/src/App.vue ADDED
@@ -0,0 +1,28 @@
1
+ <script setup lang="ts">
2
+
3
+ import ButtonComponent from "./components/button/ButtonComponent.vue";
4
+ import {ObjectStateEnum} from "./utils/enums/ObjectStateEnum.ts";
5
+ </script>
6
+
7
+ <template>
8
+ <main id="main" aria-labelledby="main-title" role="main">
9
+ <ButtonComponent class="primary">Button Text</ButtonComponent>
10
+ <ButtonComponent class="secondary">Button Text</ButtonComponent>
11
+ <ButtonComponent :object-state="ObjectStateEnum.LoggingIn"
12
+ class="secondary">Button Text</ButtonComponent>
13
+ </main>
14
+ </template>
15
+
16
+ <style scoped>
17
+ main {
18
+ display: flex;
19
+ flex-direction: column;
20
+ justify-content: center;
21
+ align-items: center;
22
+ width: 100vw;
23
+ height: 100dvh;
24
+ background-color: oklch(40.5% 0.101 131.063);
25
+
26
+ }
27
+
28
+ </style>
@@ -0,0 +1,11 @@
1
+ // src/components/button/ButtonComponent.spec.ts
2
+ import {describe, test, expect } from "vitest";
3
+ import ButtonComponent from "./ButtonComponent.vue";
4
+
5
+ describe("ButtonComponent", () => {
6
+ test("mount component", async () => {
7
+ // App exists
8
+ expect(ButtonComponent).toBeTruthy();
9
+ });
10
+ });
11
+
@@ -1,20 +1,36 @@
1
1
  <script setup lang="ts">
2
+ import {ObjectStateEnum} from '../../utils/enums/ObjectStateEnum.ts';
3
+
4
+ defineProps({
5
+ objectState: {
6
+ type: String,
7
+ default: ObjectStateEnum.NoAction,
8
+ required: false,
9
+ validator: function (value: string): boolean {
10
+ const enumValues: string[] = Object.values(ObjectStateEnum);
11
+ return enumValues.includes(value);
12
+ },
13
+ },
14
+ });
2
15
  </script>
3
16
 
4
17
  <template>
5
- <button>
6
- Hello World
7
- </button>
18
+ <button :disabled="objectState !== ObjectStateEnum.NoAction">
19
+ <slot v-if="objectState === ObjectStateEnum.NoAction" />
20
+ <span v-if="objectState !== ObjectStateEnum.NoAction">
21
+ {{objectState}}
22
+ </span>
23
+ </button>
8
24
  </template>
9
25
 
10
26
  <style scoped>
11
27
  button {
12
- padding: 0.5rem 1rem;
13
- border: var(--border);
14
- border-radius: var(--border-radius);
15
- border-width: var(--border-width);
16
- border-style: var(--border-style);
17
- color: var(--text);
28
+ padding: 0.5rem 1rem;
29
+ border: var(--border);
30
+ border-radius: var(--border-radius);
31
+ border-width: var(--border-width);
32
+ border-style: var(--border-style);
33
+ color: var(--text);
18
34
 
19
35
  &.compact {
20
36
  padding: 0.25rem 0.125rem;
@@ -28,86 +44,86 @@ button {
28
44
  line-height: 0.75rem;
29
45
  }
30
46
 
31
- &.primary {
32
- background-color: var(--primary);
33
- border-color: var(--primary);
34
-
35
- &:hover {
36
- &:enabled {
37
- background-color: var(--primary-hover);
38
- }
39
- }
40
- }
41
-
42
- &.secondary {
43
- background-color: var(--secondary);
44
- border-color: var(--secondary);
45
-
46
- &:hover {
47
- &:enabled {
48
- background-color: var(--secondary-hover);
49
- }
50
- }
51
- }
52
-
53
- &.danger {
54
- background-color: var(--danger);
55
- border-color: var(--danger);
56
-
57
- &:hover {
58
- &:enabled {
59
- background-color: var(--danger-hover);
60
- }
61
- }
62
- }
63
-
64
- &.warning {
65
- background-color: var(--warning);
66
- border-color: var(--warning);
67
-
68
- &:hover {
69
- &:enabled {
70
- background-color: var(--warning-hover);
71
- }
72
- }
73
- }
74
-
75
- &.success {
76
- background-color: var(--success);
77
- border-color: var(--success);
78
-
79
- &:hover {
80
- &:enabled {
81
- background-color: var(--success-hover);
82
- }
83
- }
84
- }
85
-
86
- &.info {
87
- background-color: var(--info);
88
- border-color: var(--info);
89
-
90
- &:hover {
91
- &:enabled {
92
- background-color: var(--info-hover);
93
- }
94
- }
95
- }
96
-
97
- &.loading {
98
- animation: loading-animation 1s infinite linear;
99
- }
47
+ &.primary {
48
+ background-color: var(--primary);
49
+ border-color: var(--primary);
50
+
51
+ &:hover {
52
+ &:enabled {
53
+ background-color: var(--primary-hover);
54
+ }
55
+ }
56
+ }
57
+
58
+ &.secondary {
59
+ background-color: var(--secondary);
60
+ border-color: var(--secondary);
61
+
62
+ &:hover {
63
+ &:enabled {
64
+ background-color: var(--secondary-hover);
65
+ }
66
+ }
67
+ }
68
+
69
+ &.danger {
70
+ background-color: var(--danger);
71
+ border-color: var(--danger);
72
+
73
+ &:hover {
74
+ &:enabled {
75
+ background-color: var(--danger-hover);
76
+ }
77
+ }
78
+ }
79
+
80
+ &.warning {
81
+ background-color: var(--warning);
82
+ border-color: var(--warning);
83
+
84
+ &:hover {
85
+ &:enabled {
86
+ background-color: var(--warning-hover);
87
+ }
88
+ }
89
+ }
90
+
91
+ &.success {
92
+ background-color: var(--success);
93
+ border-color: var(--success);
94
+
95
+ &:hover {
96
+ &:enabled {
97
+ background-color: var(--success-hover);
98
+ }
99
+ }
100
+ }
101
+
102
+ &.info {
103
+ background-color: var(--info);
104
+ border-color: var(--info);
105
+
106
+ &:hover {
107
+ &:enabled {
108
+ background-color: var(--info-hover);
109
+ }
110
+ }
111
+ }
112
+
113
+ &.loading {
114
+ animation: loading-animation 1s infinite linear;
115
+ }
100
116
  }
101
117
 
102
118
  @keyframes loading-animation {
103
- 0% {
104
- color: var(--text);
105
- }
106
- 50% {
107
- color: var(--text-muted);
108
- }
109
- 100% {
110
- color: var(--text);
111
- }
119
+ 0% {
120
+ color: var(--text);
121
+ }
122
+ 50% {
123
+ color: var(--text-muted);
124
+ }
125
+ 100% {
126
+ color: var(--text);
127
+ }
112
128
  }
113
129
  </style>
package/src/main.ts ADDED
@@ -0,0 +1,6 @@
1
+ import { createApp } from "vue";
2
+ import "./styles/main.css";
3
+ import App from "./App.vue";
4
+
5
+ const app = createApp(App);
6
+ app.mount("#app");
@@ -1,84 +1 @@
1
- @import "_accessibility.css";
2
- @import "@/styles/variables/_general_variables.css";
3
-
4
- @font-face {
5
- font-family: "Roboto";
6
- src: url("@/assets/fonts/Roboto-Regular.ttf") format("truetype");
7
- font-weight: 400;
8
- font-style: normal;
9
- }
10
-
11
- @font-face {
12
- font-family: "Roboto";
13
- src: url("@/assets/fonts/Roboto-Thin.ttf") format("truetype");
14
- font-weight: 100;
15
- font-style: normal;
16
- }
17
-
18
- @font-face {
19
- font-family: "CalSans";
20
- src: url("@/assets/fonts/CalSans-Regular.ttf") format("truetype");
21
- font-style: normal;
22
- }
23
-
24
- h1, h2, h3, h4, h5, h6 {
25
- margin: 0;
26
- font-family: "CalSans",
27
- sans-serif;
28
- font-weight: normal;
29
- font-style: normal;
30
- color: var(--text-red);
31
- }
32
-
33
- h1 {
34
- font-size: 2rem;
35
- line-height: 2.125rem;
36
- font-weight: bold;
37
- @media (--large-screen) {
38
- font-size: 3rem;
39
- line-height: 3.25rem;
40
- }
41
- }
42
-
43
- h2 {
44
- font-size: 1.5rem;
45
- line-height: 1.625rem;
46
- font-weight: bold;
47
- @media (--large-screen) {
48
- font-size: 2rem;
49
- line-height: 2.25rem;
50
- }
51
- }
52
-
53
- p, label, button {
54
- font-size: 1.25rem;
55
- font-family: "Roboto", sans-serif;
56
- line-height: 1.5rem;
57
- color: var(--text);
58
- margin-bottom: 0;
59
- @meida (--large-screen) {
60
- font-size: 1rem;
61
- line-height: 1.25rem;
62
- }
63
- }
64
-
65
- input, textarea {
66
- font-family: "Roboto", sans-serif;
67
- font-size: 1.5rem;
68
- line-height: 1.75rem;
69
- padding: 0.5rem;
70
- }
71
-
72
- .sub-text {
73
- font-family: "Roboto", sans-serif;
74
- font-weight: 100;
75
- margin: 0.5rem 0 3rem 0;
76
- }
77
-
78
- .mt-0 {
79
- margin-top: 0 !important;
80
- }
81
-
82
- .mb-0 {
83
- margin-bottom: 0 !important;
84
- }
1
+ @import "./partials/_general_variables.css";
@@ -1,20 +1,10 @@
1
- :root { /* Set all the grid size here */
2
- --xx-small-grid-width: 320px;
3
- --x-small-grid-width: 400px;
4
- --small-grid-width: 640px;
5
- --medium-grid-width: 768px;
6
- --large-grid-width: 1024px;
7
- --x-large-grid-width: 1280px;
8
- --xx-large-grid-width: 1536px; /* Set all variables in here for globals */
9
- /*--xx-small-card-width: 320px;*/ /*--x-small-card-width: 400px;*/
10
- /*--small-card-width: 640px;*/ /*--medium-card-width: 768px;*/
11
- /*--large-card-width: 1024px;*/ /*--x-large-card-width: 1280px;*/
12
- /*--xx-large-card-width: 1536px;*/ /* Set all the border variables here */
1
+ :root {
2
+ /* Border Variables */
13
3
  --border-radius: 5px;
14
4
  --border-style: solid;
15
5
  --border-width: 1px;
16
- /* Set all the
17
- colour variables here */
6
+
7
+ /* Set all the colour variables here */
18
8
  --bg-dark: hsl(26 53% 89%);
19
9
  --bg: hsl(26 100% 94%);
20
10
  --bg-light: hsl(26 100% 100%);
@@ -0,0 +1,13 @@
1
+ const ObjectStateEnum = {
2
+ Disable: "DISABLE",
3
+ Error: "ERROR",
4
+ Loading: "LOADING",
5
+ LoggingIn: "LOGGING_IN",
6
+ LoggingOut: "LOGGING_OUT",
7
+ NoAction: "NO_ACTION",
8
+ Saving: "SAVING",
9
+ } as const;
10
+
11
+ type ObjectStateEnum = (typeof ObjectStateEnum)[keyof typeof ObjectStateEnum];
12
+
13
+ export { ObjectStateEnum };
package/vite.config.ts CHANGED
@@ -1,50 +1,40 @@
1
- import { fileURLToPath, URL } from 'node:url'
2
- import { defineConfig } from 'vite'
1
+ import {defineConfig} from 'vite'
3
2
  import vue from '@vitejs/plugin-vue'
4
- import vueDevTools from 'vite-plugin-vue-devtools'
5
- import postcssCustomMedia from 'postcss-custom-media'
6
3
  import postcssNesting from 'postcss-nesting'
7
- import postcssGlobalData from '@csstools/postcss-global-data'
8
- import { resolve } from 'path'
4
+ import {resolve} from 'path'
9
5
 
10
6
 
11
7
  // https://vite.dev/config/
12
8
  export default defineConfig({
13
- build: {
14
- lib: {
15
- entry: resolve(__dirname, 'src/index.ts'),
16
- name: 'whelk-ui',
17
- fileName: 'whelk-ui',
18
- },
19
- rollupOptions: {
20
- external: ['vue'],
21
- output: {
22
- globals: {
23
- vue: 'Vue',
24
- },
25
- },
26
- },
27
- },
28
- css: {
29
- postcss: {
30
- plugins: [
31
- postcssNesting,
32
- postcssGlobalData({
33
- files: [
34
- './src/styles/variables/_media_variables.css',
35
- ]
36
- }),
37
- postcssCustomMedia,
38
- ]
39
- }
40
- },
41
- plugins: [
42
- vue(),
43
- vueDevTools(),
44
- ],
45
- resolve: {
46
- alias: {
47
- '@': fileURLToPath(new URL('./src', import.meta.url)),
48
- },
49
- },
9
+ build: {
10
+ cssCodeSplit: true,
11
+ lib: {
12
+ entry: {
13
+ button: resolve(__dirname, 'src/components/button/ButtonComponent.vue'),
14
+ style: resolve(__dirname, 'src/styles/main.css'),
15
+ },
16
+ name: 'whelk-ui',
17
+ formats: ['es', 'cjs']
18
+ },
19
+ rollupOptions: {
20
+ external: ['vue'],
21
+ output: {
22
+ globals: {
23
+ vue: 'Vue',
24
+ },
25
+ preserveModules: true,
26
+ preserveModulesRoot: 'src'
27
+ },
28
+ },
29
+ },
30
+ css: {
31
+ postcss: {
32
+ plugins: [
33
+ postcssNesting,
34
+ ]
35
+ }
36
+ },
37
+ plugins: [
38
+ vue(),
39
+ ],
50
40
  })
@@ -1,3 +0,0 @@
1
- {
2
- "recommendations": ["Vue.volar"]
3
- }
package/src/index.ts DELETED
@@ -1,3 +0,0 @@
1
- import ButtonComponent from './components/button/ButtonComponent.vue';
2
-
3
- export { ButtonComponent };
@@ -1,11 +0,0 @@
1
- .hidden-visually {
2
- position: absolute;
3
- overflow: hidden;
4
- white-space: nowrap;
5
- margin: 0;
6
- padding: 0;
7
- height: 1px;
8
- width: 1px;
9
- clip: rect(0 0 0 0);
10
- clip-path: inset(100%);
11
- }
@@ -1,10 +0,0 @@
1
- /* Mobile phone screens will have a screen size smaller than 640 * Small screens
2
- will have a screen size of 640px or larger * Medium screen will have a screen
3
- size of 768px or larger * etc. * * Small screens are considered mobile phones *
4
- Medium screens are considered tables * Large screens are considered laptops *
5
- etc. */
6
- @custom-media --small-screen (min-width: 640px);
7
- @custom-media --medium-screen (min-width: 768px);
8
- @custom-media --large-screen (min-width: 1024px);
9
- @custom-media --x-large-screen (min-width: 1280px);
10
- @custom-media --2x-large-screen (min-width: 1536px);