@citizenplane/pimp 14.1.2 → 14.1.4

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": "14.1.2",
3
+ "version": "14.1.4",
4
4
  "scripts": {
5
5
  "dev": "storybook dev -p 8080",
6
6
  "build-storybook": "storybook build --output-dir ./docs",
@@ -235,9 +235,12 @@ const handleClick = () => (isToggled.value = !isToggled.value)
235
235
  display: flex;
236
236
  }
237
237
 
238
+ &__actions {
239
+ padding: fn.px-to-rem(7) var(--cp-spacing-md) fn.px-to-rem(7) 15%;
240
+ }
241
+
238
242
  &__actions--hasTrailingSlot {
239
243
  align-items: flex-start;
240
- top: fn.px-to-rem(8);
241
244
  }
242
245
  }
243
246
  }
@@ -13,13 +13,12 @@
13
13
  <div class="cpSelect__container">
14
14
  <select
15
15
  :id="selectReferenceId"
16
+ v-model="selectModel"
16
17
  :autocomplete="autocomplete"
17
18
  class="cpSelect__inner"
18
19
  :disabled="disabled"
19
20
  :name="name"
20
21
  :required="required"
21
- :value="modelValue"
22
- @input="handleChange"
23
22
  >
24
23
  <option :disabled="hideDefaultValue" value="">{{ defaultValue }}</option>
25
24
  <option v-for="(option, index) in options" :key="index" :value="option.value">{{ option.label }}</option>
@@ -45,10 +44,6 @@ import CpTransitionExpand from '@/components/CpTransitionExpand.vue'
45
44
  import type { Sizes } from '@/constants'
46
45
  import { capitalizeFirstLetter } from '@/helpers'
47
46
 
48
- interface Emits {
49
- (e: 'update:modelValue', value: string): void
50
- }
51
-
52
47
  interface SelectOption {
53
48
  label: string
54
49
  value: string | number
@@ -63,7 +58,6 @@ interface Props {
63
58
  hideDefaultValue?: boolean
64
59
  isInvalid?: boolean
65
60
  label?: string
66
- modelValue?: string | number
67
61
  name?: string
68
62
  options: SelectOption[]
69
63
  required?: boolean
@@ -73,7 +67,6 @@ interface Props {
73
67
 
74
68
  const props = withDefaults(defineProps<Props>(), {
75
69
  label: '',
76
- modelValue: '',
77
70
  hideDefaultValue: false,
78
71
  defaultValue: 'Select an option',
79
72
  name: undefined,
@@ -87,16 +80,13 @@ const props = withDefaults(defineProps<Props>(), {
87
80
  tooltip: '',
88
81
  })
89
82
 
90
- const emit = defineEmits<Emits>()
83
+ const selectModel = defineModel<string | number>()
91
84
 
92
85
  const selectReferenceId = useId()
93
-
94
86
  const helpMessageId = useId()
95
87
  const errorMessageId = useId()
96
88
 
97
- const capitalizedLabel = computed(() => {
98
- return capitalizeFirstLetter(props.label)
99
- })
89
+ const capitalizedLabel = computed(() => capitalizeFirstLetter(props.label))
100
90
 
101
91
  const dynamicClasses = computed(() => {
102
92
  return [
@@ -110,11 +100,6 @@ const dynamicClasses = computed(() => {
110
100
 
111
101
  const displayHelp = computed(() => props.help?.length && !displayErrorMessage.value)
112
102
  const displayErrorMessage = computed(() => props.isInvalid && props.errorMessage.length)
113
-
114
- const handleChange = (e: Event): void => {
115
- const target = e.target as HTMLSelectElement
116
- emit('update:modelValue', target.value)
117
- }
118
103
  </script>
119
104
 
120
105
  <style lang="scss">
@@ -96,7 +96,7 @@ export const Default: Story = {
96
96
  render: (args) => ({
97
97
  components: { CpSelect },
98
98
  setup() {
99
- const value = ref('')
99
+ const value = ref('3')
100
100
  return { args, value }
101
101
  },
102
102
  template: `