@uibit/form 0.1.0
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 +21 -0
- package/README.md +26 -0
- package/custom-elements.json +407 -0
- package/dist/form.d.ts +55 -0
- package/dist/form.d.ts.map +1 -0
- package/dist/form.js +449 -0
- package/dist/form.js.map +1 -0
- package/dist/frameworks/angular/index.ts +45 -0
- package/dist/frameworks/astro/index.d.ts +10 -0
- package/dist/frameworks/nuxt/index.ts +7 -0
- package/dist/frameworks/preact/index.d.ts +17 -0
- package/dist/frameworks/qwik/index.tsx +10 -0
- package/dist/frameworks/react/index.d.ts +21 -0
- package/dist/frameworks/solid/index.d.ts +18 -0
- package/dist/frameworks/stencil/index.d.ts +16 -0
- package/dist/frameworks/svelte/index.svelte +63 -0
- package/dist/frameworks/vue/index.ts +26 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -0
- package/dist/styles.d.ts +2 -0
- package/dist/styles.d.ts.map +1 -0
- package/dist/styles.js +131 -0
- package/dist/styles.js.map +1 -0
- package/dist/types.d.ts +7 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/package.json +91 -0
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import '@uibit/form';
|
|
3
|
+
import type { Form as HTMLElementClass } from '@uibit/form';
|
|
4
|
+
|
|
5
|
+
let {
|
|
6
|
+
warnUnsaved = undefined,
|
|
7
|
+
step = undefined,
|
|
8
|
+
stepsCount = undefined,
|
|
9
|
+
dirty = undefined,
|
|
10
|
+
status = undefined,
|
|
11
|
+
success = undefined,
|
|
12
|
+
error = undefined,
|
|
13
|
+
children
|
|
14
|
+
} = $props<{
|
|
15
|
+
children?: any;
|
|
16
|
+
warnUnsaved?: boolean;
|
|
17
|
+
step?: number;
|
|
18
|
+
stepsCount?: number;
|
|
19
|
+
dirty?: boolean;
|
|
20
|
+
status?: 'idle' | 'pending' | 'success' | 'error';
|
|
21
|
+
success?: import('svelte').Snippet;
|
|
22
|
+
error?: import('svelte').Snippet;
|
|
23
|
+
}>();
|
|
24
|
+
|
|
25
|
+
let elementRef: HTMLElementClass | null = $state(null);
|
|
26
|
+
|
|
27
|
+
$effect(() => {
|
|
28
|
+
if (elementRef && warnUnsaved !== undefined) {
|
|
29
|
+
elementRef.warnUnsaved = warnUnsaved;
|
|
30
|
+
}
|
|
31
|
+
if (elementRef && step !== undefined) {
|
|
32
|
+
elementRef.step = step;
|
|
33
|
+
}
|
|
34
|
+
if (elementRef && stepsCount !== undefined) {
|
|
35
|
+
elementRef.stepsCount = stepsCount;
|
|
36
|
+
}
|
|
37
|
+
if (elementRef && dirty !== undefined) {
|
|
38
|
+
elementRef.dirty = dirty;
|
|
39
|
+
}
|
|
40
|
+
if (elementRef && status !== undefined) {
|
|
41
|
+
elementRef.status = status;
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
</script>
|
|
46
|
+
|
|
47
|
+
<uibit-form bind:this={elementRef} {...$$restProps}>
|
|
48
|
+
{#if success}
|
|
49
|
+
<div slot="success">
|
|
50
|
+
{@render success()}
|
|
51
|
+
</div>
|
|
52
|
+
{/if}
|
|
53
|
+
{#if error}
|
|
54
|
+
<div slot="error">
|
|
55
|
+
{@render error()}
|
|
56
|
+
</div>
|
|
57
|
+
{/if}
|
|
58
|
+
{#if children}
|
|
59
|
+
{@render children()}
|
|
60
|
+
{:else}
|
|
61
|
+
<slot />
|
|
62
|
+
{/if}
|
|
63
|
+
</uibit-form>
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { defineComponent, h } from 'vue';
|
|
2
|
+
import type { Form as HTMLElementClass } from '@uibit/form';
|
|
3
|
+
import '@uibit/form';
|
|
4
|
+
|
|
5
|
+
export const Form = defineComponent({
|
|
6
|
+
name: 'Form',
|
|
7
|
+
props: {
|
|
8
|
+
warnUnsaved: { type: [String, Number, Boolean, Array, Object] as any },
|
|
9
|
+
step: { type: [String, Number, Boolean, Array, Object] as any },
|
|
10
|
+
stepsCount: { type: [String, Number, Boolean, Array, Object] as any },
|
|
11
|
+
dirty: { type: [String, Number, Boolean, Array, Object] as any },
|
|
12
|
+
status: { type: [String, Number, Boolean, Array, Object] as any }
|
|
13
|
+
},
|
|
14
|
+
emits: [],
|
|
15
|
+
setup(props, { slots, emit }) {
|
|
16
|
+
return () => {
|
|
17
|
+
const eventListeners: Record<string, any> = {};
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
return h('uibit-form', {
|
|
21
|
+
...props,
|
|
22
|
+
...eventListeners
|
|
23
|
+
}, slots.default?.());
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
});
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC"}
|
package/dist/styles.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../src/styles.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,MAAM,yBAgIlB,CAAC"}
|
package/dist/styles.js
ADDED
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import { css } from 'lit';
|
|
2
|
+
export const styles = css `
|
|
3
|
+
:host {
|
|
4
|
+
display: block;
|
|
5
|
+
position: relative;
|
|
6
|
+
font-size: var(--uibit-component-font-size, var(--uibit-font-size-base, 1rem));
|
|
7
|
+
font-weight: var(--uibit-component-font-weight, var(--uibit-font-weight-normal, 400));
|
|
8
|
+
line-height: var(--uibit-component-line-height, var(--uibit-line-height-relaxed, 1.625));
|
|
9
|
+
--uibit-form-wizard-margin: var(--uibit-form-wizard-margin-val, 2rem);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/* Premium Minimalist Stepper Header (Split Layout) */
|
|
13
|
+
.wizard-header {
|
|
14
|
+
margin-bottom: var(--uibit-form-wizard-margin, 2rem);
|
|
15
|
+
display: flex;
|
|
16
|
+
justify-content: space-between;
|
|
17
|
+
align-items: center;
|
|
18
|
+
width: 100%;
|
|
19
|
+
height: 1.5rem;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.wizard-meta {
|
|
23
|
+
display: flex;
|
|
24
|
+
align-items: center;
|
|
25
|
+
gap: 0.75rem;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.wizard-controls {
|
|
29
|
+
display: flex;
|
|
30
|
+
align-items: center;
|
|
31
|
+
gap: 0.25rem;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.wizard-back-btn,
|
|
35
|
+
.wizard-next-btn {
|
|
36
|
+
display: inline-flex;
|
|
37
|
+
align-items: center;
|
|
38
|
+
justify-content: center;
|
|
39
|
+
background: transparent;
|
|
40
|
+
border: none;
|
|
41
|
+
padding: 0.25rem;
|
|
42
|
+
cursor: pointer;
|
|
43
|
+
color: #6b7280;
|
|
44
|
+
border-radius: 999rem;
|
|
45
|
+
transition: color 150ms ease, background-color 150ms ease, transform 150ms ease, opacity 150ms ease;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.wizard-back-btn:hover,
|
|
49
|
+
.wizard-next-btn:hover {
|
|
50
|
+
color: #111827;
|
|
51
|
+
background-color: #f3f4f6;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.wizard-back-btn:active,
|
|
55
|
+
.wizard-next-btn:active {
|
|
56
|
+
transform: scale(0.95);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.wizard-back-btn:focus-visible,
|
|
60
|
+
.wizard-next-btn:focus-visible {
|
|
61
|
+
outline: 0.125rem solid #000000;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.wizard-step-info {
|
|
65
|
+
font-size: var(--uibit-font-size-xs, 0.75rem);
|
|
66
|
+
font-weight: 500;
|
|
67
|
+
color: #9ca3af;
|
|
68
|
+
display: inline-flex;
|
|
69
|
+
align-items: center;
|
|
70
|
+
gap: 0.25rem;
|
|
71
|
+
user-select: none;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.wizard-step-num {
|
|
75
|
+
color: #111827;
|
|
76
|
+
font-weight: 600;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.wizard-step-sep {
|
|
80
|
+
opacity: 0.5;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.wizard-step-total {
|
|
84
|
+
opacity: 0.8;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
::slotted([slot^="step-title-"]),
|
|
88
|
+
.wizard-step-title {
|
|
89
|
+
font-family: var(--uibit-font-family, Inter, sans-serif);
|
|
90
|
+
font-size: var(--uibit-font-size-sm, 0.875rem);
|
|
91
|
+
font-weight: 650;
|
|
92
|
+
color: #111827;
|
|
93
|
+
letter-spacing: -0.01em;
|
|
94
|
+
user-select: none;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/* Stabilized layout hidden state */
|
|
98
|
+
.disabled-control {
|
|
99
|
+
opacity: 0;
|
|
100
|
+
pointer-events: none;
|
|
101
|
+
visibility: hidden;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/* Premium inline error banner */
|
|
105
|
+
.error-banner {
|
|
106
|
+
padding: 1rem 0;
|
|
107
|
+
font-size: var(--uibit-font-size-sm, 0.875rem);
|
|
108
|
+
color: #111827;
|
|
109
|
+
margin-bottom: 0.5rem;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/* State content wrappers */
|
|
113
|
+
.state-content {
|
|
114
|
+
display: none;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
:host([status="pending"]) .state-content[data-state="pending"] {
|
|
118
|
+
display: block;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
:host([status="success"]) .state-content[data-state="success"] {
|
|
122
|
+
display: block;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/* Correctly hide the slotted form element on success and pending states */
|
|
126
|
+
:host([status="success"]) ::slotted(form),
|
|
127
|
+
:host([status="pending"]) ::slotted(form) {
|
|
128
|
+
display: none !important;
|
|
129
|
+
}
|
|
130
|
+
`;
|
|
131
|
+
//# sourceMappingURL=styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"styles.js","sourceRoot":"","sources":["../src/styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgIxB,CAAC"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAEnC,OAAO,CAAC,MAAM,CAAC;IACf,UAAU,qBAAqB;QAC3B,YAAY,EAAE,IAAI,CAAC;KACtB;CACA"}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
|
package/package.json
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@uibit/form",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "A composable, declarative wrapper around native HTML form elements with validation, submit lifecycle states, and wizard navigation support.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"import": "./dist/index.js"
|
|
12
|
+
},
|
|
13
|
+
"./custom-elements.json": "./custom-elements.json",
|
|
14
|
+
"./react": "./dist/frameworks/react/index.d.ts",
|
|
15
|
+
"./vue": "./dist/frameworks/vue/index.ts",
|
|
16
|
+
"./svelte": "./dist/frameworks/svelte/index.svelte",
|
|
17
|
+
"./angular": "./dist/frameworks/angular/index.ts",
|
|
18
|
+
"./solid": "./dist/frameworks/solid/index.d.ts",
|
|
19
|
+
"./astro": "./dist/frameworks/astro/index.astro",
|
|
20
|
+
"./qwik": "./dist/frameworks/qwik/index.tsx",
|
|
21
|
+
"./nuxt": "./dist/frameworks/nuxt/index.ts",
|
|
22
|
+
"./preact": "./dist/frameworks/preact/index.d.ts",
|
|
23
|
+
"./stencil": "./dist/frameworks/stencil/index.d.ts"
|
|
24
|
+
},
|
|
25
|
+
"files": [
|
|
26
|
+
"dist",
|
|
27
|
+
"package.json",
|
|
28
|
+
"README.md",
|
|
29
|
+
"LICENSE",
|
|
30
|
+
"custom-elements.json"
|
|
31
|
+
],
|
|
32
|
+
"keywords": [
|
|
33
|
+
"form",
|
|
34
|
+
"wizard",
|
|
35
|
+
"validation",
|
|
36
|
+
"web-component",
|
|
37
|
+
"lit"
|
|
38
|
+
],
|
|
39
|
+
"author": "Jonathan Rawlings",
|
|
40
|
+
"license": "MIT",
|
|
41
|
+
"dependencies": {
|
|
42
|
+
"lucide": "^1.24.0",
|
|
43
|
+
"@uibit/core": "0.1.0"
|
|
44
|
+
},
|
|
45
|
+
"devDependencies": {
|
|
46
|
+
"@types/node": "^20.19.43",
|
|
47
|
+
"lit": "^3.3.3",
|
|
48
|
+
"typescript": "7.0.2",
|
|
49
|
+
"@uibit/codegen": "0.1.0"
|
|
50
|
+
},
|
|
51
|
+
"peerDependencies": {
|
|
52
|
+
"lit": "^3.0.0",
|
|
53
|
+
"react": ">=18",
|
|
54
|
+
"vue": ">=3",
|
|
55
|
+
"svelte": ">=4 || ^5",
|
|
56
|
+
"@angular/core": ">=14"
|
|
57
|
+
},
|
|
58
|
+
"peerDependenciesMeta": {
|
|
59
|
+
"react": {
|
|
60
|
+
"optional": true
|
|
61
|
+
},
|
|
62
|
+
"vue": {
|
|
63
|
+
"optional": true
|
|
64
|
+
},
|
|
65
|
+
"svelte": {
|
|
66
|
+
"optional": true
|
|
67
|
+
},
|
|
68
|
+
"@angular/core": {
|
|
69
|
+
"optional": true
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
"customElements": "custom-elements.json",
|
|
73
|
+
"uibit": {
|
|
74
|
+
"id": "form",
|
|
75
|
+
"title": "Form",
|
|
76
|
+
"category": "Forms",
|
|
77
|
+
"tagName": "uibit-form"
|
|
78
|
+
},
|
|
79
|
+
"repository": {
|
|
80
|
+
"type": "git",
|
|
81
|
+
"url": "https://github.com/Rawlings/uibit",
|
|
82
|
+
"directory": "packages/components/form"
|
|
83
|
+
},
|
|
84
|
+
"scripts": {
|
|
85
|
+
"build": "cem analyze --globs 'src/**/*.ts' --litelement && uibit-codegen --package . && tsc",
|
|
86
|
+
"dev": "concurrently \"cem analyze --globs 'src/**/*.ts' --litelement --watch\" \"tsc --watch\"",
|
|
87
|
+
"analyze": "cem analyze --globs 'src/**/*.ts' --litelement",
|
|
88
|
+
"typecheck": "tsc --noEmit",
|
|
89
|
+
"test": "vitest run -c ../../../vitest.config.ts --passWithNoTests"
|
|
90
|
+
}
|
|
91
|
+
}
|