diff --git a/lib/modal/use-dialog.ts b/lib/modal/use-dialog.ts index 92b5422..2e7828e 100644 --- a/lib/modal/use-dialog.ts +++ b/lib/modal/use-dialog.ts @@ -3,10 +3,8 @@ import { useDispose } from 'zeed' import { mountComponentAsApp } from '../basic/app-helper' import OuiDialog from './oui-dialog.vue' -// const log = Logger('ui:dialog', globalThis.debugUI ?? false) - /** Environment for JS dialog replacements */ -export function useDialog(component: Component = OuiDialog) { +export function useDialog(component: T = OuiDialog) { let cancel: any async function showDialog(props: any) { diff --git a/package.json b/package.json index 8eb8fd8..9307fb5 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "oui-kit", "type": "module", - "version": "0.11.1", + "version": "0.11.2", "author": { "name": "Dirk Holtwick", "email": "dirk.holtwick@gmail.com", diff --git a/src/app-form.styl b/src/app-form.styl index 39716cf..31422ff 100644 --- a/src/app-form.styl +++ b/src/app-form.styl @@ -14,5 +14,5 @@ oui-preset-layout(); } .oui-form { - oui-form-all(); + oui-form-defaults(); } diff --git a/stylus/preset/form.styl b/stylus/preset/form.styl index 373dc14..bc2e1bf 100644 --- a/stylus/preset/form.styl +++ b/stylus/preset/form.styl @@ -1,4 +1,4 @@ -oui-form-all() { +oui-form-defaults() { input[type=text], textarea { oui-input-text(); } @@ -30,6 +30,33 @@ oui-form-all() { select { oui-select(); } + + label { + display: block; + } + + label:has(input:not([type=checkbox]):not([type=radio])), label:has(select), label:has(textarea) { + input, select, textarea { + display: block !important; + margin-top: 4 !important; + max-width: 100%; + } + + input, textarea { + width: 100%; + min-width: 100%; + } + } + + form { + use: stack-y; + gap: 16; + + section { + use: stack-x; + gap: 6; + } + } } oui-form() { diff --git a/stylus/story.styl b/stylus/story.styl index 32aa633..5366518 100644 --- a/stylus/story.styl +++ b/stylus/story.styl @@ -16,4 +16,5 @@ html { scroll-behavior: smooth; } -oui-layout(); \ No newline at end of file +oui-layout(); +oui-form-defaults(); diff --git a/stylus/ui/form.story.styl b/stylus/ui/form.story.styl deleted file mode 100644 index 8b4d3de..0000000 --- a/stylus/ui/form.story.styl +++ /dev/null @@ -1,32 +0,0 @@ -@require "../story"; - -oui-preset-layout(); - -._form { - font-family: var(--font) !important; - - &_section { - margin-block: 16; - gap: 8; - } - - label:has(input:not([type=checkbox]):not([type=radio])), label:has(select), label:has(textarea) { - display: block; - font-size: 12; - color: var(--s2-fg); - - input, select, textarea { - margin-top: 4; - display: block !important; - width: 100%; - } - } -} - -.oui { - oui-form(); -} - -.oui-form { - oui-form-all(); -} diff --git a/stylus/ui/form.story.vue b/stylus/ui/form.story.vue index 18635e8..2a0da0e 100644 --- a/stylus/ui/form.story.vue +++ b/stylus/ui/form.story.vue @@ -1,47 +1,67 @@ -# Forms +# oui-form + +Themed input elements. + +## oui-form-defaults() + +Sets all elements to themed by default. You can still limit the scope e.g. by doing so: + +```stylus +.oui-form { + oui-form-defaults() +} +``` + +Additionally `form` will create a spaced vertical stack and `section` will create a horizontal stack with spacing, useful for button groups.