whelk-ui 0.0.3 → 0.0.4

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 (47) hide show
  1. package/README.md +4 -5
  2. package/dist/index.d.ts +50 -0
  3. package/dist/index.html +12 -0
  4. package/dist/whelk-ui.css +1 -0
  5. package/dist/whelk-ui.js +48 -0
  6. package/dist/whelk-ui.umd.cjs +1 -0
  7. package/package.json +47 -9
  8. package/index.html +0 -16
  9. package/playwright.config.ts +0 -79
  10. package/src/App.vue +0 -28
  11. package/src/components/add_object/AddObject.vue +0 -40
  12. package/src/components/button/ButtonComponent.spec.ts +0 -11
  13. package/src/components/button/ButtonComponent.vue +0 -129
  14. package/src/components/card/CardComponent.vue +0 -14
  15. package/src/components/card/card_footer/CardFooter.vue +0 -19
  16. package/src/components/card/card_header/CardHeader.vue +0 -16
  17. package/src/components/check_box/CheckBox.vue +0 -42
  18. package/src/components/datetime/DatetimeComponent.vue +0 -147
  19. package/src/components/drop_down/DropDown.vue +0 -104
  20. package/src/components/drop_down/drop_down_item/DropDownItem.vue +0 -58
  21. package/src/components/form_group/FormGroup.spec.ts +0 -16
  22. package/src/components/form_group/FormGroup.vue +0 -19
  23. package/src/components/number_input/NumberInput.spec.ts +0 -712
  24. package/src/components/number_input/NumberInput.vue +0 -264
  25. package/src/components/password_input/PasswordInput.vue +0 -166
  26. package/src/components/render_error_message/RenderErrorMessage.spec.ts +0 -0
  27. package/src/components/render_error_message/RenderErrorMessage.vue +0 -32
  28. package/src/components/switch/SwitchComponent.vue +0 -152
  29. package/src/components/text_area/TextArea.vue +0 -151
  30. package/src/components/text_input/TextInput.vue +0 -178
  31. package/src/components/tool_tip/ToolTip.vue +0 -96
  32. package/src/main.ts +0 -6
  33. package/src/styles/main.css +0 -1
  34. package/src/styles/partials/_general_variables.css +0 -74
  35. package/src/utils/enums/ObjectStateEnum.ts +0 -13
  36. package/src/utils/enums/ObjectTitleCaseEnums.ts +0 -17
  37. package/src/utils/enums/ObjectTypeEnums.ts +0 -15
  38. package/src/utils/interfaces/DocumentItemInterface.ts +0 -5
  39. package/src/utils/interfaces/DropDownItemsInterface.ts +0 -8
  40. package/src/utils/interfaces/FolderItemInterface.ts +0 -4
  41. package/src/utils/interfaces/MenuItemInterface.ts +0 -10
  42. package/tests/example.spec.ts +0 -18
  43. package/tsconfig.app.json +0 -16
  44. package/tsconfig.json +0 -7
  45. package/tsconfig.node.json +0 -25
  46. package/vite.config.ts +0 -79
  47. /package/{public → dist}/vite.svg +0 -0
@@ -1,151 +0,0 @@
1
- <script setup lang="ts">
2
- import FormGroup from '../form_group/FormGroup.vue';
3
- import { computed, ref } from 'vue';
4
- import RenderErrorMessage from '../render_error_message/RenderErrorMessage.vue';
5
- import ToolTip from '../tool_tip/ToolTip.vue';
6
-
7
- // Define Emits
8
- const emit = defineEmits(['isValid']);
9
-
10
- // Define Props
11
- const props = defineProps({
12
- isRequired: {
13
- type: Boolean,
14
- default: false,
15
- },
16
- label: {
17
- type: String,
18
- required: true,
19
- },
20
- minLength: {
21
- type: Number,
22
- default: 0,
23
- required: false,
24
- validator: (val) => !Number.isNaN(val),
25
- },
26
- maxLength: {
27
- type: Number,
28
- default: 0,
29
- required: false,
30
- validator: (val) => !Number.isNaN(val),
31
- },
32
- placeholderText: {
33
- type: String,
34
- required: false,
35
- default: '',
36
- },
37
- tooltipMessage: {
38
- type: String,
39
- required: false,
40
- default: '',
41
- },
42
- tooltipTitle: {
43
- type: String,
44
- required: false,
45
- default: '',
46
- },
47
- });
48
-
49
- // Define Models
50
- const model = defineModel('model', {
51
- type: String,
52
- required: false,
53
- default: '',
54
- });
55
-
56
- // Define ref
57
- const hasError = ref(false);
58
- const errorMessage = ref('');
59
-
60
- // Computed
61
- const getId = computed(() => {
62
- // Return an id made up of input- + title
63
- return 'input-' + props.label?.toLowerCase()?.replace(' ', '-');
64
- });
65
-
66
- function checkValidation() {
67
- // Fall back to defaults
68
- hasError.value = false;
69
- errorMessage.value = '';
70
-
71
- // Get the length of the model and if NaN fallback to 0
72
- let modelLength: number = Number(model?.value?.toString().length);
73
- modelLength = isNaN(modelLength) ? 0 : modelLength;
74
-
75
- // Check the first "required" condition
76
- if (props.isRequired && modelLength === 0) {
77
- hasError.value = true;
78
- errorMessage.value = 'This field is required';
79
- }
80
-
81
- // Check the minimum "required" condition
82
- if (props.minLength > 0 && modelLength < props.minLength) {
83
- hasError.value = true;
84
- errorMessage.value = `This field has a minimum length ${modelLength} / ${props.minLength}`;
85
- }
86
-
87
- // Check the maximum "required" condition
88
- if (props.maxLength > 0 && modelLength > props.maxLength) {
89
- hasError.value = true;
90
- errorMessage.value = `This field has a maximum length ${modelLength} / ${props.maxLength}`;
91
- }
92
-
93
- // Set the defined ref and tell parent
94
- emit('isValid', !hasError.value);
95
- }
96
- </script>
97
-
98
- <template>
99
- <FormGroup>
100
- <label :for="getId">
101
- <ToolTip
102
- v-if="props.tooltipMessage !== ''"
103
- :title="tooltipTitle"
104
- :message="tooltipMessage"
105
- :id="getId"
106
- />
107
- {{ label
108
- }}<span v-if="isRequired" aria-description="Field is required"
109
- >*</span
110
- >
111
- </label>
112
- <textarea
113
- rows="10"
114
- :id="getId"
115
- type="text"
116
- :name="props.label"
117
- :placeholder="props.placeholderText"
118
- v-model="model"
119
- v-on:keyup="checkValidation"
120
- v-on:focusout="checkValidation"
121
- />
122
- <RenderErrorMessage :error-message="errorMessage" />
123
- </FormGroup>
124
- </template>
125
-
126
- <style scoped>
127
- label {
128
- margin-bottom: 6px;
129
- }
130
-
131
- span {
132
- color: var(--text-red);
133
- }
134
-
135
- textarea {
136
- border-style: var(--border-style);
137
- border-width: var(--border-width);
138
- border-radius: var(--border-radius);
139
- border-color: var(--border);
140
- box-sizing: border-box;
141
- -moz-box-sizing: border-box;
142
- -webkit-box-sizing: border-box;
143
-
144
- &:focus {
145
- border-color: var(--secondary);
146
- border-width: 2px;
147
- outline: none;
148
- padding: calc(0.5rem - 1px);
149
- }
150
- }
151
- </style>
@@ -1,178 +0,0 @@
1
- <script setup lang="ts">
2
- import FormGroup from '../form_group/FormGroup.vue';
3
- import {computed, ref} from 'vue';
4
- import RenderErrorMessage from '../render_error_message/RenderErrorMessage.vue';
5
- import ToolTip from '../tool_tip/ToolTip.vue';
6
-
7
- // Define Emits
8
- const emit = defineEmits(['isValid']);
9
-
10
- // Define Props
11
- const props = defineProps({
12
- isRequired: {
13
- type: Boolean,
14
- default: false,
15
- },
16
- label: {
17
- type: String,
18
- required: true,
19
- },
20
- minLength: {
21
- type: Number,
22
- default: 0,
23
- required: false,
24
- validator: (val) => !Number.isNaN(val),
25
- },
26
- maxLength: {
27
- type: Number,
28
- default: 0,
29
- required: false,
30
- validator: (val) => !Number.isNaN(val),
31
- },
32
- placeholderText: {
33
- type: String,
34
- required: false,
35
- default: '',
36
- },
37
- tooltipMessage: {
38
- type: String,
39
- required: false,
40
- default: '',
41
- },
42
- tooltipTitle: {
43
- type: String,
44
- required: false,
45
- default: '',
46
- },
47
- });
48
-
49
- // Define Models
50
- const model = defineModel({ required: true });
51
-
52
- // Define ref
53
- const hasError = ref(false);
54
- const errorMessage = ref('');
55
-
56
- // Computed
57
- const getId = computed(() => {
58
- // Return an id made up of input- + title
59
- return 'input-' + props.label?.toLowerCase()?.replace(' ', '-');
60
- });
61
-
62
- function checkValidation() {
63
- // Fall back to defaults
64
- hasError.value = false;
65
- errorMessage.value = '';
66
-
67
- // Get the length of the model and if NaN fallback to 0
68
- let modelLength: number = Number(model?.value?.toString().length);
69
- modelLength = isNaN(modelLength) ? 0 : modelLength;
70
-
71
- // Check the first "required" condition
72
- if (props.isRequired && modelLength === 0) {
73
- hasError.value = true;
74
- errorMessage.value = 'This field is required';
75
- }
76
-
77
- // Check the minimum "required" condition
78
- if (props.minLength > 0 && modelLength < props.minLength) {
79
- hasError.value = true;
80
- errorMessage.value = `This field has a minimum length ${modelLength} / ${props.minLength}`;
81
- }
82
-
83
- // Check the maximum "required" condition
84
- if (props.maxLength > 0 && modelLength > props.maxLength) {
85
- hasError.value = true;
86
- errorMessage.value = `This field has a maximum length ${modelLength} / ${props.maxLength}`;
87
- }
88
-
89
- // Set the defined ref and tell parent
90
- emit('isValid', !hasError.value);
91
- }
92
- </script>
93
-
94
- <template>
95
- <FormGroup class="text-input">
96
- <label :for="getId">
97
- <ToolTip
98
- v-if="props.tooltipMessage !== ''"
99
- :title="tooltipTitle"
100
- :message="tooltipMessage"
101
- :id="getId"
102
- />
103
- {{
104
- label
105
- }}<span v-if="isRequired" aria-description="Field is required"
106
- >*</span
107
- >
108
- </label>
109
- <input
110
- :id="getId"
111
- type="text"
112
- :name="props.label"
113
- :placeholder="props.placeholderText"
114
- v-model="model"
115
- v-on:keyup="checkValidation"
116
- v-on:focusout="checkValidation"
117
- />
118
- <RenderErrorMessage :error-message="errorMessage"/>
119
- </FormGroup>
120
- </template>
121
-
122
- <style scoped>
123
- .text-input {
124
-
125
- > label {
126
- margin-bottom: 6px;
127
- }
128
-
129
- > span {
130
- color: var(--text-red);
131
- }
132
-
133
- > input {
134
- border-style: var(--border-style);
135
- border-width: var(--border-width);
136
- border-radius: var(--border-radius);
137
- border-color: var(--border);
138
- box-sizing: border-box;
139
- -moz-box-sizing: border-box;
140
- -webkit-box-sizing: border-box;
141
-
142
- &:focus {
143
- border-color: var(--secondary);
144
- border-width: 2px;
145
- outline: none;
146
- padding: calc(0.5rem - 1px);
147
- }
148
- }
149
-
150
- &.compact {
151
- > label {
152
- font-size: 1rem;
153
- line-height: 1.25rem;
154
- margin-bottom: 2px;
155
-
156
- @media (--large-screen) {
157
- font-size: 0.75rem;
158
- line-height: 1rem;
159
- }
160
- }
161
-
162
- > input {
163
- font-size: 1.25rem;
164
- line-height: 1.5rem;
165
- padding: 0.25rem;
166
-
167
- &:focus {
168
- padding: calc(0.25rem - 1px);
169
- }
170
-
171
- @media (--large-screen) {
172
- font-size: 1rem;
173
- line-height: 1.25rem;
174
- }
175
- }
176
- }
177
- }
178
- </style>
@@ -1,96 +0,0 @@
1
- <script setup lang="ts">
2
- import { computed, ref } from 'vue';
3
-
4
- // Props
5
- const props = defineProps({
6
- id: {
7
- type: String,
8
- required: true,
9
- },
10
- message: {
11
- type: String,
12
- required: true,
13
- },
14
- title: {
15
- type: String,
16
- default: '',
17
- },
18
- });
19
-
20
- // Computed
21
- const tooltipId = computed(() => {
22
- return `tooltip-${props.id}`;
23
- });
24
-
25
- // Ref
26
- const tooltipClass = ref('tooltip');
27
- </script>
28
-
29
- <template>
30
- <div :id="tooltipId" :class="tooltipClass" role="tooltip">
31
- <p
32
- v-if="
33
- props.title !== '' &&
34
- props.title !== null &&
35
- props.title !== undefined
36
- "
37
- class="tooltip-title"
38
- >
39
- {{ props.title }}
40
- </p>
41
- <p class="tooltip-message">{{ props.message }}</p>
42
- </div>
43
-
44
- <span
45
- :data-tooltip-target="tooltipId"
46
- type="tooltip"
47
- @mouseenter="tooltipClass = 'tooltip show'"
48
- @mouseleave="tooltipClass = 'tooltip'"
49
- @focus="tooltipClass = 'tooltip show'"
50
- @blur="tooltipClass = 'tooltip'"
51
- @keydown.esc="tooltipClass = 'tooltip'"
52
- >
53
- <Info />
54
- </span>
55
- </template>
56
-
57
- <style scoped>
58
- .tooltip {
59
- display: none;
60
- position: absolute;
61
- z-index: 10;
62
- padding: 0.75rem 0.25rem;
63
- background-color: var(--bg-dark);
64
- border-color: var(--border-muted);
65
- border-width: var(--border-width);
66
- border-style: var(--border-style);
67
- border-radius: var(--border-radius);
68
- transform: translateY(-100%) translateY(-0.5rem);
69
- max-width: 75vw;
70
-
71
- &.show {
72
- display: inline-block;
73
- }
74
-
75
- > .tooltip-title {
76
- margin: 0 0 0.125rem 0;
77
- color: var(--text-red);
78
- }
79
-
80
- > .tooltip-message {
81
- font-weight: lighter;
82
- margin: 0;
83
- color: var(--text-muted);
84
- }
85
-
86
- @media (--large-screen) {
87
- max-width: 50vw;
88
- }
89
- }
90
-
91
- svg {
92
- width: 1rem;
93
- height: 1rem;
94
- color: var(--text-muted);
95
- }
96
- </style>
package/src/main.ts DELETED
@@ -1,6 +0,0 @@
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 +0,0 @@
1
- @import "./partials/_general_variables.css";
@@ -1,74 +0,0 @@
1
- :root {
2
- /* Border Variables */
3
- --border-radius: 5px;
4
- --border-style: solid;
5
- --border-width: 1px;
6
-
7
- /* Set all the colour variables here */
8
- --bg-dark: hsl(26 53% 89%);
9
- --bg: hsl(26 100% 94%);
10
- --bg-light: hsl(26 100% 100%);
11
- --text: hsl(16 100% 4%);
12
- --text-red: hsl(8, 93%, 43%);
13
- --text-muted: hsl(26 35% 27%);
14
- --highlight: hsl(26 100% 99%);
15
- --border: hsl(26 21% 49%);
16
- --border-muted: hsl(26 27% 61%);
17
- --primary: hsl(27 65% 66%);
18
- --primary-hover: hsl(27 65% 76%);
19
- --secondary: hsl(204 74% 68%);
20
- --secondary-hover: hsl(204 74% 78%);
21
- --danger: hsl(9 26% 64%);
22
- --danger-hover: hsl(9 26% 74%);
23
- --warning: hsl(52 19% 57%);
24
- --warning-hover: hsl(52 19% 67%);
25
- --success: hsl(146 17% 59%);
26
- --success-hover: hsl(146 17% 69%);
27
- --info: hsl(217 28% 65%);
28
- --info-hover: hsl(217 28% 75%); /* Set all the object colours here */
29
- --document-links: hsl(203.53, 40.8%, 24.51%);
30
- --document-links-hover: hsl(203.53, 40.8%, 75.51%);
31
- --customer-background: hsl(203.53, 40.8%, 75.49%);
32
- --customer-text: hsl(203.53, 40.8%, 24.51%);
33
- --kanban-board-background: hsl(78.26, 88.46%, 89.8%);
34
- --kanban-board-text: hsl(78.26, 88.46%, 10.2%);
35
- --kanban-card-background: hsl(74.12, 35.56%, 53.14%);
36
- --kanban-card-text: hsl(74.12, 35.56%, 10.86%);
37
- --organisation-background: hsl(52.05, 85.57%, 61.96%);
38
- --organisation-text: hsl(52.05, 85.57%, 8.04%);
39
- --request-for-change-background: hsl(67.61, 100%, 72.16%);
40
- --request-for-change-text: hsl(67.61, 100%, 7.84%);
41
- --requirement-background: hsl(200.31, 94.2%, 86.47%);
42
- --requirement-text: hsl(200.31, 94.2%, 10.53%);
43
- --requirement-item-background: hsl(322.8, 29.76%, 67.06%);
44
- --requirement-item-text: hsl(322.8, 29.76%, 8.94%);
45
- --project-background: hsl(333.62, 49.57%, 45.88%);
46
- --project-text: hsl(333.62, 49.57%, 8.12%);
47
- --task-background: hsl(224, 10.2%, 71.82%);
48
- --task-text: hsl(224, 10.2%, 7.18%);
49
- }
50
-
51
- .dark {
52
- --bg-dark: hsl(16 100% 2%);
53
- --bg: hsl(22 76% 4%);
54
- --bg-light: hsl(26 50% 8%);
55
- --text: hsl(26 100% 94%);
56
- --text-red: hsl(8,
57
- 93%, 23%);
58
- --text-muted: hsl(26 34% 68%);
59
- --highlight: hsl(26 26% 38%);
60
- --border: hsl(26 35% 27%);
61
- --border-muted: hsl(27 56% 16%);
62
- --primary: hsl(32 100% 20%);
63
- --primary-hover: hsl(32 100% 10%);
64
- --secondary: hsl(198 100% 20%);
65
- --secondary-hover: hsl(198 100% 10%);
66
- --danger: hsl(9 21% 41%);
67
- --danger-hover: hsl(9 21% 31%);
68
- --warning: hsl(52 23% 34%);
69
- --warning-hover: hsl(52 23% 24%);
70
- --success: hsl(147 19% 36%);
71
- --success-hover: hsl(147 19% 26%);
72
- --info: hsl(217 22% 41%);
73
- --info-hover: hsl(217 22% 31%);
74
- }
@@ -1,13 +0,0 @@
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 };
@@ -1,17 +0,0 @@
1
- const ObjectTitleCaseEnums = {
2
- customer: "Customer",
3
- group: "Group",
4
- kanban_board: 'Kanban Board',
5
- kanban_card: "Kanban Card",
6
- organisation: "Organisation",
7
- request_for_change: "Request For Change",
8
- requirement: "Requirement",
9
- requirement_item: "Requirement Item",
10
- project: "Project",
11
- task: "Task",
12
- user: "User",
13
- }
14
-
15
- type ObjectTitleCaseEnums = (typeof ObjectTitleCaseEnums[keyof typeof ObjectTitleCaseEnums])
16
-
17
- export { ObjectTitleCaseEnums };
@@ -1,15 +0,0 @@
1
- const ObjectTypeEnums = {
2
- customer: "customer",
3
- kanban_board: 'kanban_board',
4
- kanban_card: "kanban_card",
5
- organisation: "organisation",
6
- request_for_change: "request_for_change",
7
- requirement: "requirement",
8
- requirement_item: "requirement_item",
9
- project: "project",
10
- task: "task",
11
- }
12
-
13
- type ObjectTypeEnums = (typeof ObjectTypeEnums)[keyof typeof ObjectTypeEnums]
14
-
15
- export { ObjectTypeEnums }
@@ -1,5 +0,0 @@
1
- export interface DocumentItemInterface {
2
- documentKey: string;
3
- filename: string;
4
- type: string;
5
- }
@@ -1,8 +0,0 @@
1
- import type {Component} from "vue";
2
-
3
- export interface DropDownItemsInterface {
4
- ariaLabel: string;
5
- icon: Component;
6
- label: string;
7
- trigger: string;
8
- }
@@ -1,4 +0,0 @@
1
- export interface FolderItemInterface {
2
- folderId: number;
3
- folderName: string;
4
- }
@@ -1,10 +0,0 @@
1
- import type {Component} from "vue";
2
-
3
- export interface MenuItemInterface {
4
- ariaLabel: string;
5
- destination: string;
6
- icon: Component;
7
- route: string;
8
- routeNew: string;
9
- title: string;
10
- }
@@ -1,18 +0,0 @@
1
- import { test, expect } from '@playwright/test';
2
-
3
- test('has title', async ({ page }) => {
4
- await page.goto('https://playwright.dev/');
5
-
6
- // Expect a title "to contain" a substring.
7
- await expect(page).toHaveTitle(/Playwright/);
8
- });
9
-
10
- test('get started link', async ({ page }) => {
11
- await page.goto('https://playwright.dev/');
12
-
13
- // Click the get started link.
14
- await page.getByRole('link', { name: 'Get started' }).click();
15
-
16
- // Expects page to have a heading with the name of Installation.
17
- await expect(page.getByRole('heading', { name: 'Installation' })).toBeVisible();
18
- });
package/tsconfig.app.json DELETED
@@ -1,16 +0,0 @@
1
- {
2
- "extends": "@vue/tsconfig/tsconfig.dom.json",
3
- "compilerOptions": {
4
- "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
5
- "types": ["vite/client"],
6
-
7
- /* Linting */
8
- "strict": true,
9
- "noUnusedLocals": true,
10
- "noUnusedParameters": true,
11
- "erasableSyntaxOnly": true,
12
- "noFallthroughCasesInSwitch": true,
13
- "noUncheckedSideEffectImports": true
14
- },
15
- "include": ["src/**/*.ts", "src/**/*.tsx", "src/**/*.vue"]
16
- }
package/tsconfig.json DELETED
@@ -1,7 +0,0 @@
1
- {
2
- "files": [],
3
- "references": [
4
- { "path": "./tsconfig.app.json" },
5
- { "path": "./tsconfig.node.json" }
6
- ]
7
- }
@@ -1,25 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo",
4
- "target": "ES2023",
5
- "lib": ["ES2023"],
6
- "module": "ESNext",
7
- "types": ["node"],
8
- "skipLibCheck": true,
9
-
10
- /* Bundler mode */
11
- "moduleResolution": "bundler",
12
- "allowImportingTsExtensions": true,
13
- // "verbatimModuleSyntax": true,
14
- "noEmit": true,
15
-
16
- /* Linting */
17
- "strict": true,
18
- "noUnusedLocals": true,
19
- "noUnusedParameters": true,
20
- "erasableSyntaxOnly": true,
21
- "noFallthroughCasesInSwitch": true,
22
- "noUncheckedSideEffectImports": true
23
- },
24
- "include": ["vite.config.ts"]
25
- }