whelk-ui 0.0.1 → 0.0.3

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 (43) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +32 -2
  3. package/index.html +16 -0
  4. package/package.json +8 -8
  5. package/playwright.config.ts +79 -0
  6. package/src/App.vue +28 -0
  7. package/src/components/add_object/AddObject.vue +40 -0
  8. package/src/components/button/ButtonComponent.spec.ts +11 -0
  9. package/src/components/button/ButtonComponent.vue +103 -87
  10. package/src/components/card/CardComponent.vue +14 -0
  11. package/src/components/card/card_footer/CardFooter.vue +19 -0
  12. package/src/components/card/card_header/CardHeader.vue +16 -0
  13. package/src/components/check_box/CheckBox.vue +42 -0
  14. package/src/components/datetime/DatetimeComponent.vue +147 -0
  15. package/src/components/drop_down/DropDown.vue +104 -0
  16. package/src/components/drop_down/drop_down_item/DropDownItem.vue +58 -0
  17. package/src/components/form_group/FormGroup.spec.ts +16 -0
  18. package/src/components/form_group/FormGroup.vue +19 -0
  19. package/src/components/number_input/NumberInput.spec.ts +712 -0
  20. package/src/components/number_input/NumberInput.vue +264 -0
  21. package/src/components/password_input/PasswordInput.vue +166 -0
  22. package/src/components/render_error_message/RenderErrorMessage.spec.ts +0 -0
  23. package/src/components/render_error_message/RenderErrorMessage.vue +32 -0
  24. package/src/components/switch/SwitchComponent.vue +152 -0
  25. package/src/components/text_area/TextArea.vue +151 -0
  26. package/src/components/text_input/TextInput.vue +178 -0
  27. package/src/components/tool_tip/ToolTip.vue +96 -0
  28. package/src/main.ts +6 -0
  29. package/src/styles/main.css +1 -84
  30. package/src/styles/{variables → partials}/_general_variables.css +4 -14
  31. package/src/utils/enums/ObjectStateEnum.ts +13 -0
  32. package/src/utils/enums/ObjectTitleCaseEnums.ts +17 -0
  33. package/src/utils/enums/ObjectTypeEnums.ts +15 -0
  34. package/src/utils/interfaces/DocumentItemInterface.ts +5 -0
  35. package/src/utils/interfaces/DropDownItemsInterface.ts +8 -0
  36. package/src/utils/interfaces/FolderItemInterface.ts +4 -0
  37. package/src/utils/interfaces/MenuItemInterface.ts +10 -0
  38. package/tests/example.spec.ts +18 -0
  39. package/vite.config.ts +71 -42
  40. package/.vscode/extensions.json +0 -3
  41. package/src/index.ts +0 -3
  42. package/src/styles/_accessibility.css +0 -11
  43. package/src/styles/variables/_media_variables.css +0 -10
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,3 +1,33 @@
1
- # Whelk UI
1
+ Whelk UI
2
+ ========
2
3
 
3
- Coming soon - the VueJS UI Components used in NearBeach
4
+ ***Coming soon - The VueJS UI Components used to build NearBeach***
5
+
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
+ - [] Add Object
17
+ - [x] Buttons
18
+ - [] Checkbox
19
+ - [] Datetime picker
20
+ - [] Date picker
21
+ - [] Email Input
22
+ - [] Form Group
23
+ - [] Multi select
24
+ - [] Password Input
25
+ - [] Select
26
+ - [] Text Input
27
+ - [] Time picker
28
+ - [] Toggle
29
+ - [] Website Input
30
+
31
+ ## Generic
32
+
33
+ - [] 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,32 +1,32 @@
1
1
  {
2
2
  "name": "whelk-ui",
3
3
  "private": false,
4
- "version": "0.0.1",
4
+ "version": "0.0.3",
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:e2e": "playwright test",
11
+ "test:unit": "vitest"
10
12
  },
11
13
  "dependencies": {
12
- "lucide-vue-next": "^0.562.0",
13
14
  "vue": "^3.5.24"
14
15
  },
15
16
  "devDependencies": {
16
17
  "@csstools/postcss-global-data": "^3.1.0",
18
+ "@playwright/test": "^1.58.0",
17
19
  "@types/node": "^24.10.1",
18
20
  "@vitejs/plugin-vue": "^6.0.1",
19
- "@vitest/browser-playwright": "^4.0.7",
20
- "@vitest/coverage-v8": "^4.0.8",
21
+ "@vitest/browser-playwright": "^4.0.18",
21
22
  "@vitest/eslint-plugin": "^1.4.0",
22
23
  "@vue/tsconfig": "^0.8.1",
24
+ "petite-vue-i18n": "^11.2.8",
23
25
  "postcss": "^8.5.6",
24
- "postcss-custom-media": "^11.0.6",
25
26
  "postcss-nesting": "^13.0.2",
26
27
  "typescript": "~5.9.3",
27
28
  "vite": "^7.2.4",
28
- "vite-plugin-vue-devtools": "^8.0.3",
29
- "vitest": "^4.0.8",
29
+ "vitest": "^4.0.18",
30
30
  "vitest-browser-vue": "^2.0.1",
31
31
  "vue-tsc": "^3.1.4"
32
32
  }
@@ -0,0 +1,79 @@
1
+ import { defineConfig, devices } from '@playwright/test';
2
+
3
+ /**
4
+ * Read environment variables from file.
5
+ * https://github.com/motdotla/dotenv
6
+ */
7
+ // import dotenv from 'dotenv';
8
+ // import path from 'path';
9
+ // dotenv.config({ path: path.resolve(__dirname, '.env') });
10
+
11
+ /**
12
+ * See https://playwright.dev/docs/test-configuration.
13
+ */
14
+ export default defineConfig({
15
+ testDir: './tests',
16
+ /* Run tests in files in parallel */
17
+ fullyParallel: true,
18
+ /* Fail the build on CI if you accidentally left test.only in the source code. */
19
+ forbidOnly: !!process.env.CI,
20
+ /* Retry on CI only */
21
+ retries: process.env.CI ? 2 : 0,
22
+ /* Opt out of parallel tests on CI. */
23
+ workers: process.env.CI ? 1 : undefined,
24
+ /* Reporter to use. See https://playwright.dev/docs/test-reporters */
25
+ reporter: 'html',
26
+ /* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
27
+ use: {
28
+ /* Base URL to use in actions like `await page.goto('')`. */
29
+ // baseURL: 'http://localhost:3000',
30
+
31
+ /* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
32
+ trace: 'on-first-retry',
33
+ },
34
+
35
+ /* Configure projects for major browsers */
36
+ projects: [
37
+ {
38
+ name: 'chromium',
39
+ use: { ...devices['Desktop Chrome'] },
40
+ },
41
+
42
+ {
43
+ name: 'firefox',
44
+ use: { ...devices['Desktop Firefox'] },
45
+ },
46
+
47
+ {
48
+ name: 'webkit',
49
+ use: { ...devices['Desktop Safari'] },
50
+ },
51
+
52
+ /* Test against mobile viewports. */
53
+ // {
54
+ // name: 'Mobile Chrome',
55
+ // use: { ...devices['Pixel 5'] },
56
+ // },
57
+ // {
58
+ // name: 'Mobile Safari',
59
+ // use: { ...devices['iPhone 12'] },
60
+ // },
61
+
62
+ /* Test against branded browsers. */
63
+ // {
64
+ // name: 'Microsoft Edge',
65
+ // use: { ...devices['Desktop Edge'], channel: 'msedge' },
66
+ // },
67
+ // {
68
+ // name: 'Google Chrome',
69
+ // use: { ...devices['Desktop Chrome'], channel: 'chrome' },
70
+ // },
71
+ ],
72
+
73
+ /* Run your local dev server before starting the tests */
74
+ // webServer: {
75
+ // command: 'npm run start',
76
+ // url: 'http://localhost:3000',
77
+ // reuseExistingServer: !process.env.CI,
78
+ // },
79
+ });
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,40 @@
1
+ <script setup lang="ts">
2
+ import {ObjectTitleCaseEnums} from "../../utils/enums/ObjectTitleCaseEnums.ts";
3
+
4
+ // DEFINE PROPS
5
+ const props = defineProps({
6
+ objectType: {
7
+ type: String,
8
+ required: true,
9
+ validator: function (value: string): boolean {
10
+ const enumValues: string[] = Object.values(ObjectTitleCaseEnums);
11
+ return enumValues.includes(value);
12
+ },
13
+ },
14
+ });
15
+
16
+ </script>
17
+
18
+ <template>
19
+ <button
20
+ class="add-object"
21
+ type="button"
22
+ >
23
+ + {{objectType}}
24
+ </button>
25
+ </template>
26
+
27
+ <style scoped>
28
+ .add-object {
29
+ width: 100%;
30
+ border-style: dashed;
31
+ border-width: var(--border-width);
32
+ border-radius: var(--border-radius);
33
+ padding: 0.5rem 0.75rem;
34
+ font-weight: lighter;
35
+ font-size: 1rem;
36
+ }
37
+
38
+
39
+
40
+ </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>
@@ -0,0 +1,14 @@
1
+ <script setup lang="ts"></script>
2
+
3
+ <template>
4
+ <div class="card">
5
+ <slot></slot>
6
+ </div>
7
+ </template>
8
+
9
+ <style scoped>
10
+ .card {
11
+ border-radius: var(--border-radius);
12
+ background-color: var(--bg-light);
13
+ }
14
+ </style>
@@ -0,0 +1,19 @@
1
+ <script setup lang="ts"></script>
2
+
3
+ <template>
4
+ <div class="card-footer">
5
+ <slot></slot>
6
+ </div>
7
+ </template>
8
+
9
+ <style scoped>
10
+ .card-footer {
11
+ padding: 0 0 0.75rem 0;
12
+
13
+ @media (--large-screen) {
14
+ margin: 1rem -2rem -1rem -2rem;
15
+ padding: 1rem 2rem;
16
+ border-radius: 0 0 var(--border-radius) var(--border-radius);
17
+ }
18
+ }
19
+ </style>
@@ -0,0 +1,16 @@
1
+ <script setup lang="ts"></script>
2
+ <template>
3
+ <div class="card-header">
4
+ <slot />
5
+ </div>
6
+ </template>
7
+
8
+ <style scoped>
9
+ .card-header {
10
+ border-radius: 0;
11
+
12
+ @media (--large-screen) {
13
+ border-radius: var(--border-radius) var(--border-radius) 0 0;
14
+ }
15
+ }
16
+ </style>
@@ -0,0 +1,42 @@
1
+ <script setup lang="ts">
2
+ import { computed } from 'vue';
3
+
4
+ // Model
5
+ const model = defineModel();
6
+
7
+ // Setup Props
8
+ const props = defineProps({
9
+ id: {
10
+ type: String,
11
+ required: true,
12
+ },
13
+ label: {
14
+ type: String,
15
+ required: true,
16
+ },
17
+ });
18
+
19
+ // Computed
20
+ const checkboxId = computed(() => {
21
+ return `checkbox-${props.id}`;
22
+ });
23
+ </script>
24
+
25
+ <template>
26
+ <div class="checkbox-component">
27
+ <input :id="checkboxId" :name="label" v-model="model" type="checkbox" />
28
+ <label :for="checkboxId">{{ props.label }}</label>
29
+ </div>
30
+ </template>
31
+
32
+ <style scoped>
33
+ .checkbox-component {
34
+ label {
35
+ padding: 0.5rem;
36
+ }
37
+
38
+ input {
39
+ padding: 0.5rem;
40
+ }
41
+ }
42
+ </style>