@citizenplane/pimp 17.0.2 → 17.0.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": "17.0.2",
3
+ "version": "17.0.4",
4
4
  "scripts": {
5
5
  "dev": "storybook dev -p 8081",
6
6
  "build-storybook": "storybook build --output-dir ./docs",
@@ -18,22 +18,18 @@
18
18
  <script setup lang="ts">
19
19
  import { computed, useSlots } from 'vue'
20
20
 
21
- import type { Colors, Sizes } from '@/constants'
22
21
  import { capitalizeFirstLetter } from '@/helpers'
23
22
 
24
- type BadgeSizes = Extract<Sizes, '2xs' | 'xs' | 'sm' | 'md'>
25
- type BadgeVariants = 'outline' | 'soft' | 'solid'
26
-
27
23
  interface Props {
28
- color?: Colors
24
+ color?: 'neutral' | 'accent' | 'error' | 'warning' | 'success' | 'blue' | 'pink' | 'magenta' | 'yellow' | 'white'
29
25
  disabled?: boolean
30
26
  isClearable?: boolean
31
27
  isSquare?: boolean
32
28
  label?: string
33
29
  leadingIcon?: string
34
- size?: BadgeSizes
30
+ size?: '2xs' | 'xs' | 'sm' | 'md'
35
31
  trailingIcon?: string
36
- variant?: BadgeVariants
32
+ variant?: 'outline' | 'soft' | 'solid'
37
33
  }
38
34
 
39
35
  const props = withDefaults(defineProps<Props>(), {
@@ -5,20 +5,16 @@
5
5
  </template>
6
6
 
7
7
  <script setup lang="ts">
8
- import { HeadingLevels } from '@/constants'
9
-
10
- type HeadingSize = 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900
11
-
12
8
  /**
13
9
  * @deprecated `CpHeading` is deprecated. Use CpText instead.
14
10
  */
15
11
  interface Props {
16
- headingLevel?: HeadingLevels
17
- size?: HeadingSize
12
+ headingLevel?: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6'
13
+ size?: 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900
18
14
  }
19
15
 
20
16
  withDefaults(defineProps<Props>(), {
21
- headingLevel: HeadingLevels.H1,
17
+ headingLevel: 'h1',
22
18
  size: 500,
23
19
  })
24
20
 
@@ -130,7 +130,7 @@ interface Props {
130
130
  name?: string
131
131
  onSearch?: (query: string) => void
132
132
  optionDisabled?: string | ((option: unknown) => boolean)
133
- optionLabel?: string
133
+ optionLabel?: string | ((option: unknown) => string)
134
134
  options?: unknown[]
135
135
  placeholder?: string
136
136
  required?: boolean
@@ -236,7 +236,10 @@ const dynamicOptions = computed(() => {
236
236
  if (hasRegisteredOnSearch.value) return props.options
237
237
 
238
238
  return props.options.filter((option: unknown) => {
239
- const optionLabel = typeof option === 'object' ? (option as Record<string, unknown>)[props.optionLabel] : option
239
+ const optionLabel =
240
+ typeof option === 'object' && typeof props.optionLabel === 'string'
241
+ ? (option as Record<string, unknown>)[props.optionLabel]
242
+ : option
240
243
  return (optionLabel as string).toLowerCase().includes(searchQuery.value.toLowerCase())
241
244
  })
242
245
  })
@@ -1,7 +1,6 @@
1
1
  export type { Colors } from './colors/Colors'
2
2
  export { Position } from './Position'
3
3
  export type { ToggleColors } from './colors/ToggleColors'
4
- export { HeadingLevels } from './Heading'
5
4
  export { PAGINATION_FORMATS, RESERVED_KEYS, VISIBLE_ROWS_MAX } from './CpTableConfig'
6
5
  export type { Sizes } from './Sizes'
7
6
 
@@ -2,10 +2,9 @@ import type { Args, Meta, StoryObj } from '@storybook/vue3-vite'
2
2
 
3
3
  import CpHeading from '@/components/CpHeading.vue'
4
4
 
5
- import { HeadingLevels } from '@/constants'
6
5
  import { docLabelStyle } from '@/stories/documentationStyles'
7
6
 
8
- const headingLevels = Object.values(HeadingLevels)
7
+ const headingLevels = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'] as const
9
8
  const headingSizes = [100, 200, 300, 400, 500, 600, 700, 800, 900] as const
10
9
 
11
10
  const headingRowStyle = 'display: grid; grid-template-columns: 90px 1fr; gap: 16px; align-items: center;'
@@ -44,7 +43,7 @@ type Story = StoryObj<typeof meta>
44
43
  */
45
44
  export const Default: Story = {
46
45
  args: {
47
- headingLevel: HeadingLevels.H1,
46
+ headingLevel: 'h1',
48
47
  size: 500,
49
48
  },
50
49
  render: (args: Args) => ({
@@ -1,9 +0,0 @@
1
- export declare enum HeadingLevels {
2
- H1 = "h1",
3
- H2 = "h2",
4
- H3 = "h3",
5
- H4 = "h4",
6
- H5 = "h5",
7
- H6 = "h6"
8
- }
9
- //# sourceMappingURL=Heading.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Heading.d.ts","sourceRoot":"","sources":["../../src/constants/Heading.ts"],"names":[],"mappings":"AAAA,oBAAY,aAAa;IACvB,EAAE,OAAO;IACT,EAAE,OAAO;IACT,EAAE,OAAO;IACT,EAAE,OAAO;IACT,EAAE,OAAO;IACT,EAAE,OAAO;CACV"}
@@ -1,8 +0,0 @@
1
- export enum HeadingLevels {
2
- H1 = 'h1',
3
- H2 = 'h2',
4
- H3 = 'h3',
5
- H4 = 'h4',
6
- H5 = 'h5',
7
- H6 = 'h6',
8
- }