@citizenplane/pimp 9.7.7 → 9.7.9

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.7.7",
3
+ "version": "9.7.9",
4
4
  "scripts": {
5
5
  "dev": "storybook dev -p 8080",
6
6
  "build-storybook": "storybook build --output-dir ./docs",
@@ -6,21 +6,21 @@
6
6
  <auto-complete
7
7
  ref="multiselect"
8
8
  v-model="selectModel"
9
- :append-to="appendTo"
9
+ :append-to
10
10
  auto-option-focus
11
11
  :data-key="trackBy"
12
- :disabled="disabled"
12
+ :disabled
13
13
  :force-selection
14
- :input-class="inputClass"
14
+ :input-class
15
15
  :invalid="isInvalid"
16
- :multiple="multiple"
17
- :name="name"
18
- :option-disabled="optionDisabled"
19
- :option-label="optionLabel"
20
- :placeholder="placeholder"
16
+ :multiple
17
+ :name
18
+ :option-disabled
19
+ :option-label
20
+ :placeholder
21
21
  :pt="passThroughConfig"
22
22
  :suggestions="options"
23
- :typeahead="typeahead"
23
+ :typeahead
24
24
  @click="handleClick"
25
25
  @complete="handleSearch"
26
26
  @hide="handleOverlayHidden"
@@ -115,6 +115,7 @@ interface Props {
115
115
  options?: unknown[]
116
116
  placeholder?: string
117
117
  required?: boolean
118
+ size?: 'sm' | 'md'
118
119
  trackBy?: string
119
120
  withoutTypeahead?: boolean
120
121
  }
@@ -131,6 +132,7 @@ const props = withDefaults(defineProps<Props>(), {
131
132
  modelValue: null,
132
133
  optionDisabled: 'disabled',
133
134
  options: () => [],
135
+ size: 'md',
134
136
  })
135
137
 
136
138
  const emit = defineEmits<Emits>()
@@ -154,7 +156,7 @@ const inputClass = computed(() => ({
154
156
  }))
155
157
 
156
158
  const passThroughConfig = computed(() => ({
157
- root: { class: `cpMultiselect__select` },
159
+ root: { class: `cpMultiselect__select cpMultiselect__select--${props.size}` },
158
160
  inputmultiple: { class: 'cpMultiselect__tags' },
159
161
  dropdown: { class: 'cpMultiselect__toggle' },
160
162
  inputchip: { class: 'cpMultiselect__inputWrapper' },
@@ -302,6 +304,10 @@ onMounted(() => overrideAlignOverlay())
302
304
  border-radius: fn.px-to-rem(8);
303
305
  gap: sp.$space;
304
306
 
307
+ &--sm {
308
+ padding: sp.$space-sm sp.$space-md;
309
+ }
310
+
305
311
  &:has(input:hover):not(:has(input:disabled)) {
306
312
  outline: fn.px-to-rem(1) solid colors.$primary-color;
307
313
  }
@@ -376,6 +382,7 @@ onMounted(() => overrideAlignOverlay())
376
382
  font-size: fn.px-to-rem(14);
377
383
  line-height: fn.px-to-rem(24);
378
384
  background-color: transparent;
385
+ width: 100%;
379
386
 
380
387
  &:disabled {
381
388
  color: colors.$gray-500;
@@ -48,6 +48,7 @@ import { Sizes } from '@/constants'
48
48
  import { capitalizeFirstLetter } from '@/helpers'
49
49
 
50
50
  interface Props {
51
+ autofocus?: boolean
51
52
  disabled?: boolean
52
53
  errorMessage?: string
53
54
  help?: string
@@ -68,6 +69,7 @@ const props = withDefaults(defineProps<Props>(), {
68
69
  help: '',
69
70
  disabled: false,
70
71
  isInvalid: false,
72
+ autofocus: false,
71
73
  required: false,
72
74
  tooltip: '',
73
75
  name: '',
@@ -114,7 +116,7 @@ const dropdownOptions = computed(() => ({
114
116
  }))
115
117
 
116
118
  const inputOptions = computed(() => ({
117
- autofocus: true,
119
+ autofocus: props.autofocus,
118
120
  placeholder: props.placeholder,
119
121
  name: props.name,
120
122
  type: 'tel',
@@ -95,6 +95,11 @@ const meta = {
95
95
  control: 'text',
96
96
  description: 'Property to track the selected option',
97
97
  },
98
+ size: {
99
+ control: 'select',
100
+ options: ['sm', 'md'],
101
+ description: 'Size of the multiselect',
102
+ },
98
103
  },
99
104
  } satisfies Meta<typeof CpMultiselect>
100
105
 
@@ -139,7 +144,7 @@ export const Single: Story = {
139
144
  return { args, selectedSupplier, dynamicOptions, handleSearch, isLoading }
140
145
  },
141
146
  template: `
142
- <div style="padding: 20px;">
147
+ <div style="padding: 20px;width: 25rem;">
143
148
  <CpMultiselect v-model="selectedSupplier" v-bind="args" :options="dynamicOptions" :is-loading="isLoading" @search="handleSearch">
144
149
  <template #prefix>
145
150
  <cp-partner-badge type="supplier" size="sm" />