@citizenplane/pimp 9.6.1 → 9.6.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@citizenplane/pimp",
3
- "version": "9.6.1",
3
+ "version": "9.6.3",
4
4
  "scripts": {
5
5
  "dev": "storybook dev -p 8080",
6
6
  "build-storybook": "storybook build --output-dir ./docs",
@@ -99,7 +99,7 @@ const attrs = useAttrs()
99
99
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
100
100
  const { ['class']: value, id, ...restAttributes } = attrs
101
101
 
102
- const inputIdentifier = ref(id || useId())
102
+ const inputIdentifier = ref<string>((id as string | undefined) || useId())
103
103
 
104
104
  const helpMessageId = useId()
105
105
  const errorMessageId = useId()
@@ -120,7 +120,7 @@ const inputModel = defineModel<string | number | boolean>({
120
120
  })
121
121
 
122
122
  const isDOMElementValid = ref(true)
123
- const cpInputContainer = ref()
123
+ const cpInputContainer = ref<HTMLDivElement | null>(null)
124
124
 
125
125
  const isDisabled = computed(() => checkAttribute('disabled'))
126
126
  const isRequired = computed(() => checkAttribute('required'))
@@ -147,7 +147,9 @@ const hasAfterIconSlot = computed(() => !!slots['trailing-icon'])
147
147
  const hasAfterIcon = computed(() => hasAfterIconSlot.value || props.isSearch)
148
148
  const displayAfterIcon = computed(() => hasAfterIcon.value && !props.isSearch)
149
149
 
150
- const DOMElement = computed(() => cpInputContainer.value.children.namedItem(inputIdentifier.value))
150
+ const DOMElement = computed(
151
+ () => cpInputContainer.value?.children.namedItem(inputIdentifier.value) as HTMLInputElement | null,
152
+ )
151
153
 
152
154
  const displayErrorMessage = computed(() => isInputInvalid.value && props.errorMessage.length)
153
155
  const isClearButtonVisible = computed(() => props.isSearch && inputModel.value.toString().length && !isDisabled.value)
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <v-tooltip :aria-id="ariaId" class="cpTooltip" :distance :container="false">
2
+ <v-tooltip :aria-id="ariaId" class="cpTooltip" :container="false" :disabled :distance>
3
3
  <slot />
4
4
  <template #popper>
5
5
  <span v-if="content">
@@ -16,6 +16,7 @@ import { useId } from 'vue'
16
16
 
17
17
  interface Props {
18
18
  content?: string
19
+ disabled?: boolean
19
20
  distance?: number
20
21
  }
21
22
 
@@ -100,3 +100,22 @@ export const WithHTMLContent: Story = {
100
100
  `,
101
101
  }),
102
102
  }
103
+
104
+ export const Disabled: Story = {
105
+ args: {
106
+ disabled: true,
107
+ },
108
+ render: (args) => ({
109
+ components: { CpTooltip },
110
+ setup() {
111
+ return { args }
112
+ },
113
+ template: `
114
+ <div style="padding: 100px; text-align: center;">
115
+ <CpTooltip v-bind="args" content="You should not see me">
116
+ <div type="button">Disabled</div>
117
+ </CpTooltip>
118
+ </div>
119
+ `,
120
+ }),
121
+ }