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
2 changes: 1 addition & 1 deletion src/components/NeCombobox.vue
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
label: string
description?: string
icon?: IconDefinition
rawObj?: any

Check warning on line 32 in src/components/NeCombobox.vue

View workflow job for this annotation

GitHub Actions / Eslint

Unexpected any. Specify a different type
disabled?: boolean
}

Expand All @@ -44,7 +44,7 @@
maxOptionsShown?: number
multiple?: boolean
disabled?: boolean
showOptionsType: boolean
showOptionsType?: boolean
optional?: boolean
selectedLabel: string
showSelectedLabel?: boolean
Expand Down Expand Up @@ -79,7 +79,7 @@
})

const query = ref('')
const selected = ref(props.multiple ? [] : null) as any

Check warning on line 82 in src/components/NeCombobox.vue

View workflow job for this annotation

GitHub Actions / Eslint

Unexpected any. Specify a different type
const showOptions = ref(false)
const comboboxRef = ref<HTMLDivElement | null>(null)
const userInputOptions = ref<NeComboboxOption[]>([])
Expand Down
6 changes: 3 additions & 3 deletions src/components/NeFileInput.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ import NeProgressBar from './NeProgressBar.vue'
interface FileInputProps {
modelValue?: File | File[] | null
label?: string
invalidMessage: string
invalidMessage?: string
dropzoneLabel: string
progress: number
showProgress: boolean
progress?: number
showProgress?: boolean
accept?: string | undefined
}

Expand Down
6 changes: 3 additions & 3 deletions src/components/NeModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ import NeButton, { type ButtonKind } from './NeButton.vue'
import NeRoundedIcon from './NeRoundedIcon.vue'
import type { PropType } from 'vue'

type ModalKind = 'neutral' | 'info' | 'warning' | 'error' | 'success'
type PrimaryButtonKind = 'primary' | 'danger'
type ModalSize = 'md' | 'lg' | 'xl' | 'xxl'
export type ModalKind = 'neutral' | 'info' | 'warning' | 'error' | 'success'
export type PrimaryButtonKind = 'primary' | 'danger'
export type ModalSize = 'md' | 'lg' | 'xl' | 'xxl'

defineProps({
visible: {
Expand Down
25 changes: 14 additions & 11 deletions src/components/NeRadioSelection.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,26 @@
SPDX-License-Identifier: GPL-3.0-or-later
-->

<script lang="ts" setup>
import { computed, type PropType, type Ref, ref, watch } from 'vue'
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome'
import { type IconDefinition } from '@fortawesome/fontawesome-svg-core'
import { faCircleCheck } from '@fortawesome/free-solid-svg-icons'
import NeFormItemLabel from './NeFormItemLabel.vue'
import { v4 as uuidv4 } from 'uuid'

export type RadioCardSize = 'md' | 'lg' | 'xl'
<script lang="ts">
import type { IconDefinition } from '@fortawesome/fontawesome-svg-core'

type RadioOption = {
export type RadioOption = {
id: string
label: string
description?: string
icon?: IconDefinition
disabled?: boolean
}
</script>

<script lang="ts" setup generic="T extends RadioOption">
import { computed, type PropType, type Ref, ref, watch } from 'vue'
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome'
import { faCircleCheck } from '@fortawesome/free-solid-svg-icons'
import NeFormItemLabel from './NeFormItemLabel.vue'
import { v4 as uuidv4 } from 'uuid'

export type RadioCardSize = 'md' | 'lg' | 'xl'

const props = defineProps({
modelValue: {
Expand All @@ -41,7 +44,7 @@
},
options: {
required: true,
type: Array<RadioOption>
type: Array<T>
},
card: {
type: Boolean,
Expand Down Expand Up @@ -76,7 +79,7 @@
focus
})

const value: Ref<any> = ref(props.modelValue ?? '')

Check warning on line 82 in src/components/NeRadioSelection.vue

View workflow job for this annotation

GitHub Actions / Eslint

Unexpected any. Specify a different type

const inputRef = ref()

Expand Down
55 changes: 21 additions & 34 deletions src/components/NeTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,54 +3,41 @@
SPDX-License-Identifier: GPL-3.0-or-later
-->
<script lang="ts" setup>
import { computed, provide, type PropType } from 'vue'
import { computed, provide } from 'vue'
import NeTableSkeleton from './NeTableSkeleton.vue'

export type Breakpoint = 'sm' | 'md' | 'lg' | 'xl' | '2xl'

const props = defineProps({
ariaLabel: {
type: String,
required: true
},
cardBreakpoint: {
type: String as PropType<Breakpoint>,
default: 'md'
},
loading: {
type: Boolean,
default: false
},
skeletonRows: {
type: Number,
default: 8
},
skeletonColumns: {
type: Number,
default: 4
},
sortKey: {
type: String,
default: ''
},
sortDescending: {
type: Boolean,
default: false
}
})
const {
ariaLabel,
cardBreakpoint = 'md',
loading = false,
skeletonRows = 8,
skeletonColumns = 4,
sortKey = '',
sortDescending = false
} = defineProps<{
ariaLabel?: string
cardBreakpoint?: Breakpoint
loading?: boolean
skeletonRows?: number
skeletonColumns?: number
sortKey?: string
sortDescending?: boolean
}>()

// provide props to children components
provide(
'cardBreakpoint',
computed(() => props.cardBreakpoint)
computed(() => cardBreakpoint)
)
provide(
'sortKey',
computed(() => props.sortKey)
computed(() => sortKey)
)
provide(
'sortDescending',
computed(() => props.sortDescending)
computed(() => sortDescending)
)

const tableCardStyle: Record<Breakpoint, string> = {
Expand Down
7 changes: 6 additions & 1 deletion src/components/NeTableHeadCell.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ import { computed, inject, toValue } from 'vue'
import { faSort, faSortUp, faSortDown } from '@fortawesome/free-solid-svg-icons'
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome'

export type SortEvent = {
key: string
descending: boolean
}

const props = defineProps({
columnKey: {
type: String,
Expand All @@ -19,7 +24,7 @@ const props = defineProps({
})

const emit = defineEmits<{
sort: [{ key: string; descending: boolean }]
sort: [SortEvent]
}>()

// inject from NeTable.vue
Expand Down
5 changes: 1 addition & 4 deletions src/composables/useSort.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,7 @@ export function useSort<T>(
items: MaybeRefOrGetter<T[]>,
sortKey: MaybeRefOrGetter<keyof T>,
descending: MaybeRefOrGetter<boolean> = false,
sortFunctions: Record<keyof T, (a: T, b: T) => number> = {} as Record<
keyof T,
(a: T, b: T) => number
>
sortFunctions: Partial<Record<keyof T, (a: T, b: T) => number>> = {}
) {
const sortedItems = ref<T[]>([])

Expand Down
3 changes: 3 additions & 0 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ export type { NeNotification } from './components/NeToastNotification.vue'
export type { NeListboxOption } from './components/NeListbox.vue'
export type { NeDropdownItem } from './components/NeDropdown.vue'
export type { FilterOption, FilterKind } from './components/NeDropdownFilter.vue'
export type { RadioOption } from './components/NeRadioSelection.vue'
export type { SortEvent } from './components/NeTableHeadCell.vue'
export type { ModalKind, PrimaryButtonKind, ModalSize } from './components/NeModal.vue'

// library functions export
export {
Expand Down
3 changes: 3 additions & 0 deletions src/styles/theme.css
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@
--color-primary-900: var(--color-cyan-900);
--color-primary-950: var(--color-cyan-950);

/* breakpoints */
--breakpoint-3xl: 112rem;

/* animations */
--animate-spin-fast: spin 0.5s linear infinite;
--animate-spin-relaxed: spin 1.5s linear infinite;
Expand Down
Loading