Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
# vueish
Vue UI Library

Install:
- add `style="position: relative"` to the body tag
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<title>Vite App</title>
</head>
<body>
<div id="app" class="h-full">
<div id="app" class="h-full relative">
</div>
<script type="module" src="/src/demo.ts"></script>
</body>
Expand Down
4,050 changes: 2,776 additions & 1,274 deletions package-lock.json

Large diffs are not rendered by default.

5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"@vitejs/plugin-vue": "^1.0.4",
"@vue/compiler-sfc": "^3.0.5",
"@vue/eslint-config-typescript": "^7.0.0",
"@vue/test-utils": "^2.0.0-beta.14",
"@vue/test-utils": "^2.0.0-rc.2",
"@vuedx/typecheck": "^0.6.3",
"@vuedx/typescript-plugin-vue": "^0.6.3",
"autoprefixer": "^10.2.3",
Expand All @@ -56,5 +56,8 @@
"vue-loader": "^16.1.2",
"vue-router": "^4.0.3",
"vue-template-compiler": "^2.6.12"
},
"dependencies": {
"vue3-click-away": "^1.1.0"
}
}
1 change: 1 addition & 0 deletions src/components/panel/UIPanel.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<template>
<section :id="id"
class="ui-panel rounded shadow-md bg-default relative transition-all"
:aria-expanded="open"
:class="{ 'hover:shadow-lg': !open }">
<UIFadeTransition>
<UILinearLoader v-if="loading" class="absolute rounded-t" />
Expand Down
8 changes: 5 additions & 3 deletions src/components/radio/UIRadio.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -192,16 +192,18 @@ describe('UIRadioGroup', () => {
}
});

const radioGroup = wrapper.findComponent(UIRadioGroup);
const input = wrapper.find('input[type="radio"]');

await input.trigger('click');
expect(wrapper.emitted()).toHaveProperty('update:modelValue');
expect(wrapper.emitted()['update:modelValue'][0]).toStrictEqual(['foo']);
expect(radioGroup.emitted('update:modelValue')).not.toBeUndefined();
expect(radioGroup.emitted('update:modelValue')![0]).toStrictEqual(['foo']);
});

it('should throw an error if there are missing UIRadio components', () => {
disableConsoleWarn();
expect(() => mount(UIRadioGroup)).toThrow('UIRadioGroup requires at least 2 UIRadio components present');
expect(() => mount(UIRadioGroup))
.toThrow('UIRadioGroup requires at least 2 UIRadio components in the default slot.');
enableConsoleWarn();
});
});
3 changes: 2 additions & 1 deletion src/components/radio/UIRadioGroup.vue
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ export default defineComponent({
setup(props, ctx) {
const slot = ref<HTMLDivElement>();
const watchStopHandlers: ReturnType<typeof watch>[] = [];

const updateInputs = () => {
watchStopHandlers.forEach(stop => stop());
watchStopHandlers.length = 0;
Expand All @@ -48,7 +49,7 @@ export default defineComponent({

// Validate they exist
if (!inputs || inputs.length < 2) {
throw Error('UIRadioGroup requires at least 2 UIRadio components present.');
throw Error('UIRadioGroup requires at least 2 UIRadio components in the default slot.');
}

const setChecked = (input: HTMLInputElement) => input.checked = props.modelValue === input.value;
Expand Down
2 changes: 1 addition & 1 deletion src/components/range-slider/UIRangeSlider.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ describe('UIRangeSlider', () => {
});

await wrapper.find('input').setValue(75);
expect(wrapper.emitted('update:modelValue')[0]).toStrictEqual(['75']);
expect(wrapper.emitted('update:modelValue')![0]).toStrictEqual(['75']);
await wrapper.setProps({ disabled: true });
await wrapper.find('input').setValue(0);
expect(wrapper.emitted('update:modelValue')).toHaveLength(1);
Expand Down
58 changes: 58 additions & 0 deletions src/components/select/Demo.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
<template>
<UISelect v-model="selected"
:options="options"
placeholder="Please select..." />

<UISelect v-model="multiSelected"
multi
class="my-12"
no-clear
:options="options"
placeholder="Please select..." />

<UISelect v-model="multiSelected"
multi
disabled
:options="options"
placeholder="Please select..." />
</template>

<script lang="ts">
import { defineComponent, ref } from 'vue';
import UISelect from '@components/select/UISelect.vue';

const options = [
{
id: 1,
name: 'Bruce Banner'
},
{
id: 2,
name: 'Bruce Wayne'
},
{
id: 3,
name: 'Bruce Lee'
},
{
id: 4,
name: 'Brucie Bonus'
}
];

export default defineComponent({
// eslint-disable-next-line vue/no-reserved-component-names
name: 'Select',
components: { UISelect },
setup() {
const selected = ref(null);
const multiSelected = ref(null);

return {
selected,
multiSelected,
options
};
}
});
</script>
Loading