Skip to content

Commit

Permalink
fix: address pr feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
portikM committed Dec 12, 2024
1 parent f36bb06 commit 1f78cae
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 8 deletions.
3 changes: 2 additions & 1 deletion src/components/KCheckbox/KCheckbox.vue
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,8 @@ const emit = defineEmits<{
const slots = useSlots()
const attrs = useAttrs()
const inputId = attrs.id ? String(attrs.id) : useId()
const defaultId = useId()
const inputId = computed((): string => attrs.id ? String(attrs.id) : defaultId)
const hasLabel = computed((): boolean => !!(props.label || slots.default))
const isDisabled = computed((): boolean => attrs?.disabled !== undefined && String(attrs?.disabled) !== 'false')
Expand Down
3 changes: 2 additions & 1 deletion src/components/KFileUpload/KFileUpload.vue
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,8 @@ const emit = defineEmits<{
const { stripRequiredLabel } = useUtilities()
const fileInputId = attrs.id ? String(attrs.id) : useId()
const defaultId = useId()
const fileInputId = computed((): string => attrs.id ? String(attrs.id) : defaultId)
const modifiedAttrs = computed(() => {
const $attrs = { ...attrs }
Expand Down
3 changes: 2 additions & 1 deletion src/components/KInput/KInput.vue
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,8 @@ const slots = useSlots()
const attrs = useAttrs()
const isRequired = computed((): boolean => attrs?.required !== undefined && String(attrs?.required) !== 'false')
const inputId = attrs.id ? String(attrs.id) : useId()
const defaultId = useId()
const inputId = computed((): string => attrs.id ? String(attrs.id) : defaultId)
const helpTextId = useId()
const strippedLabel = computed((): string => stripRequiredLabel(props.label, isRequired.value))
const hasLabelTooltip = computed((): boolean => !!(props.labelAttributes?.info || slots['label-tooltip']))
Expand Down
3 changes: 2 additions & 1 deletion src/components/KInputSwitch/KInputSwitch.vue
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,8 @@ const attrs = useAttrs()
const switchInputElement = ref<HTMLInputElement | null>(null)
const inputId = attrs.id ? String(attrs.id) : useId()
const defaultId = useId()
const inputId = computed((): string => attrs.id ? String(attrs.id) : defaultId)
/**
* Strips falsy `disabled` attribute, so it does not fall onto native <a> elements.
Expand Down
3 changes: 2 additions & 1 deletion src/components/KMultiselect/KMultiselect.vue
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,8 @@ const defaultKPopAttributes = {
const key = ref(0)
const stagingKey = ref(0)
const multiselectWrapperId = attrs.id ? String(attrs.id) : useId() // unique id for the KLabel `for` attribute
const defaultId = useId()
const multiselectWrapperId = computed((): string => attrs.id ? String(attrs.id) : defaultId) // unique id for the KLabel `for` attribute
const multiselectKey = useId()
const multiselectElement = ref<HTMLDivElement | null>(null)
Expand Down
3 changes: 2 additions & 1 deletion src/components/KRadio/KRadio.vue
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,8 @@ const props = defineProps({
const slots = useSlots()
const attrs = useAttrs()
const inputId = attrs.id ? String(attrs.id) : useId()
const defaultId = useId()
const inputId = computed((): string => attrs.id ? String(attrs.id) : defaultId)
const isDisabled = computed((): boolean => attrs?.disabled !== undefined && String(attrs?.disabled) !== 'false')
const hasLabel = computed((): boolean => !!(props.label || slots.default))
// for regular radio we only show description if there is a label or default slot
Expand Down
3 changes: 2 additions & 1 deletion src/components/KSelect/KSelect.vue
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,8 @@ const emit = defineEmits<{
const attrs = useAttrs()
const slots = useSlots()
const selectInputId = attrs.id ? String(attrs.id) : useId()
const defaultId = useId()
const selectInputId = computed((): string => attrs.id ? String(attrs.id) : defaultId)
const isDropdownOpen = ref<boolean>(false)
Expand Down
3 changes: 2 additions & 1 deletion src/components/KTextArea/KTextArea.vue
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,8 @@ const value = computed({
},
})
const textAreaId = attrs.id ? String(attrs.id) : useId()
const defaultId = useId()
const textAreaId = computed((): string => attrs.id ? String(attrs.id) : defaultId)
const modifiedAttrs = computed((): Record<string, any> => {
const $attrs = { ...attrs }
Expand Down

0 comments on commit 1f78cae

Please sign in to comment.