Skip to content

Commit

Permalink
docs: enable oruga types and adjsut examples (#123)
Browse files Browse the repository at this point in the history
  • Loading branch information
mlmoravek authored May 24, 2024
1 parent 47d7027 commit 1260ace
Show file tree
Hide file tree
Showing 13 changed files with 50 additions and 36 deletions.
2 changes: 1 addition & 1 deletion src/components/Autocomplete.vue
Original file line number Diff line number Diff line change
Expand Up @@ -499,7 +499,7 @@ function getMoreAsyncData() {
icon="search"
clearable
:data="filteredDataBase"
@select="(option: string) => (selectedBase = option)">
@select="(option: string | number) => (selectedBase = option)">
<template #empty>No results found</template>
</o-autocomplete>
</o-field>
Expand Down
2 changes: 1 addition & 1 deletion src/components/Collapse.vue
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const collapses = ref([
<o-button
variant="primary"
aria-controls="contentIdForA11y1"
label="Click me!" />"
label="Click me!" />
</template>
<div class="card card-body">
<h3>Subtitle</h3>
Expand Down
29 changes: 20 additions & 9 deletions src/components/Datepicker.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,12 @@ const today = new Date();
const thisMonth = today.getMonth();
const thisYear = today.getFullYear();
const events = [
new Date(thisYear, thisMonth, 2),
new Date(thisYear, thisMonth, 6),
{
date: new Date(thisYear, thisMonth, 2),
},
{
date: new Date(thisYear, thisMonth, 6),
},
{
date: new Date(thisYear, thisMonth, 6),
type: "info",
Expand All @@ -23,7 +27,9 @@ const events = [
date: new Date(thisYear, thisMonth, 10),
type: "link",
},
new Date(thisYear, thisMonth, 12),
{
date: new Date(thisYear, thisMonth, 12),
},
{
date: new Date(thisYear, thisMonth, 12),
type: "warning",
Expand All @@ -32,7 +38,9 @@ const events = [
date: new Date(thisYear, thisMonth, 16),
type: "danger",
},
new Date(thisYear, thisMonth, 20),
{
date: new Date(thisYear, thisMonth, 20),
},
{
date: new Date(thisYear, thisMonth, 29),
type: "success",
Expand Down Expand Up @@ -73,7 +81,7 @@ const selectedString = computed(() =>
selected.value ? selected.value.toDateString() : "",
);
const date = ref<Date | null>(new Date());
const date = ref<Date | undefined>(new Date());
const multiple = ref([]);
const range = ref([]);
Expand All @@ -90,8 +98,11 @@ const maxDate = new Date(
const month = ref();
function selectMonth(option: { name: string; value: number }) {
if (!option || !date.value) return;
function selectMonth(name: string) {
if (!name || !date.value) return;
const option = months.find((m) => m.name === name);
if (!option) return;
date.value.setMonth(option.value);
}
Expand Down Expand Up @@ -238,7 +249,7 @@ const datepickerRef = ref();
:data="months"
field="name"
expanded
@select="selectMonth" />
@select="(v) => selectMonth(v as string)" />
<o-button disabled :label="date?.getFullYear().toString()" />
</o-field>
</template>
Expand All @@ -249,7 +260,7 @@ const datepickerRef = ref();
<span>Today</span>
</o-button>

<o-button variant="danger" @click="date = null">
<o-button variant="danger" @click="date = undefined">
<o-icon icon="times" />
<span>Clear</span>
</o-button>
Expand Down
8 changes: 4 additions & 4 deletions src/components/Datetimepicker.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ const enableSeconds = ref(false);
const hourFormat = ref(); // Browser locale
const locale = ref(); // Browser locale
const datetime = ref<Date | null>(new Date());
const datetime = ref<Date | undefined>(new Date());
const minDatetime = ref(null);
const maxDatetime = ref(null);
const minDatetime = ref();
const maxDatetime = ref();
</script>

<template>
Expand Down Expand Up @@ -83,7 +83,7 @@ const maxDatetime = ref(null);
<o-icon icon="calendar" />
<span>Today</span>
</o-button>
<o-button variant="danger" @click="datetime = null">
<o-button variant="danger" @click="datetime = undefined">
<o-icon icon="times" />
<span>Clear</span>
</o-button>
Expand Down
6 changes: 2 additions & 4 deletions src/components/Notification.vue
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,7 @@ function danger() {
<section>
<h3>Add custom buttons</h3>

<o-notification
v-slot="{ closeNotification }"
aria-close-label="Close notification">
<o-notification v-slot="{ close }" aria-close-label="Close notification">
<div class="d-inline-flex">
<span>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce id
Expand All @@ -156,7 +154,7 @@ function danger() {
label="Cancel"
variant="primary"
size="small"
@click="closeNotification" />
@click="close" />
</div>
</o-notification>
</section>
Expand Down
2 changes: 1 addition & 1 deletion src/components/Sidebar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const isFullwidth = ref(false);
const isReduced = ref(false);
const expandOnHover = ref(false);
const teleport = ref(false);
const position = ref("left");
const position = ref<"bottom" | "top" | "right" | "left" | undefined>("left");
const inline = ref(false);
const toggleSidebar = () => {
Expand Down
4 changes: 2 additions & 2 deletions src/components/Steps.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ const prevIcon = ref("chevron-left");
const nextIcon = ref("chevron-right");
const labelPosition = ref("bottom");
const stepsPosition = ref("left");
const position = ref(null);
const size = ref(null);
const position = ref();
const size = ref();
</script>

<template>
Expand Down
4 changes: 2 additions & 2 deletions src/components/Switch.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ const isSwitchedCustom = ref("Yes");
const isRounded = ref(false);
const position = ref("right");
const size = ref("");
const variant = ref(null);
const passive = ref(null);
const variant = ref();
const passive = ref();
</script>

<template>
Expand Down
2 changes: 1 addition & 1 deletion src/components/Table.vue
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ const defaultSortDirection = ref("asc");
const perPage = ref(3);
const checkedRows = ref([]);
const selected = ref(null);
const selected = ref();
</script>

<template>
Expand Down
12 changes: 6 additions & 6 deletions src/components/Taginput.vue
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,6 @@ function getFilteredTags(text: string) {
v-model="tags"
variant="primary"
:data="filteredTags"
autocomplete
:allow-new="allowNew"
:open-on-focus="openOnFocus"
field="user.first_name"
Expand All @@ -424,7 +423,6 @@ function getFilteredTags(text: string) {
disabled
:model-value="['One']"
:data="['One', 'Two', 'Three', 'Four']"
autocomplete
:allow-new="allowNew"
:open-on-focus="openOnFocus"
icon="tag"
Expand All @@ -438,17 +436,19 @@ function getFilteredTags(text: string) {
<h3>Limits</h3>

<o-field label="Limited to 10 characters">
<o-taginput maxlength="10" :model-value="['Oruga', 'Vue', 'CSS']" />
<o-taginput :maxlength="10" :model-value="['Oruga', 'Vue', 'CSS']" />
</o-field>

<o-field label="Limited to 5 tags">
<o-taginput maxitems="5" :model-value="['One', 'Two', 'Three', 'Four']" />
<o-taginput
:maxitems="5"
:model-value="['One', 'Two', 'Three', 'Four']" />
</o-field>

<o-field label="Limited to 10 characters and 5 tags">
<o-taginput
maxlength="10"
maxitems="5"
:maxlength="10"
:maxitems="5"
:model-value="['Red', 'Green', 'Blue', 'White']" />
</o-field>
</section>
Expand Down
4 changes: 2 additions & 2 deletions src/components/Timepicker.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<script setup lang="ts">
import { ref } from "vue";
const time = ref<Date | null>(null);
const time = ref<Date>();
const hourFormat = ref(undefined); // Browser locale
const enableSeconds = ref(false);
const locale = ref(undefined); // Browser locale
Expand Down Expand Up @@ -103,7 +103,7 @@ const hoursGranularity = ref(2);
variant="danger"
icon-left="times"
outlined
@click="time = null" />
@click="time = undefined" />
</o-timepicker>
</o-field>
</section>
Expand Down
2 changes: 1 addition & 1 deletion src/components/Upload.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import { ref } from "vue";
const dropFiles = ref<File[]>([]);
const file = ref<File | null>(null);
const file = ref<File>();
function deleteDropFile(index: number) {
dropFiles.value.splice(index, 1);
Expand Down
9 changes: 7 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,12 @@
"./src/*"
]
},
"types": ["vite/client"]
"types": ["vite/client", "./node_modules/@oruga-ui/oruga-next/volar"]
},
"include": ["src/**/*.ts", "src/**/*.d.ts", "src/**/*.tsx", "src/**/*.vue"]
"include": [
"src/**/*.ts",
"src/**/*.d.ts",
"src/**/*.tsx",
"src/**/*.vue",
]
}

0 comments on commit 1260ace

Please sign in to comment.