@onereach/ui-components 4.7.4 → 4.7.5

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.
Files changed (46) hide show
  1. package/dist/bundled/v2/components/OrExpansionPanelV3/OrExpansionPanel.js +25 -33
  2. package/dist/bundled/v2/components/OrExpansionPanelV3/OrExpansionPanel.vue.d.ts +28 -15
  3. package/dist/bundled/v2/components/OrExpansionPanelV3/index.js +3 -1
  4. package/dist/bundled/v2/components/OrExpansionPanelV3/props.d.ts +5 -0
  5. package/dist/bundled/v2/components/OrExpansionPanelV3/props.js +7 -1
  6. package/dist/bundled/v2/components/OrExpansionPanelV3/styles.d.ts +4 -3
  7. package/dist/bundled/v2/components/OrExpansionPanelV3/styles.js +17 -5
  8. package/dist/bundled/v2/components/OrSelectV3/OrSelect.js +1 -1
  9. package/dist/bundled/v2/components/OrSelectV3/index.js +1 -1
  10. package/dist/bundled/v2/components/index.js +1 -1
  11. package/dist/bundled/v2/index.js +2 -2
  12. package/dist/bundled/v3/{OrExpansionPanel.vue_vue_type_script_lang-d4ed6199.js → OrExpansionPanel.vue_vue_type_script_lang-ca9d5307.js} +20 -29
  13. package/dist/bundled/v3/{OrSelect.vue_vue_type_script_lang-ba73f458.js → OrSelect.vue_vue_type_script_lang-85fcf3fa.js} +1 -1
  14. package/dist/bundled/v3/components/OrExpansionPanelV3/OrExpansionPanel.js +7 -5
  15. package/dist/bundled/v3/components/OrExpansionPanelV3/OrExpansionPanel.vue.d.ts +22 -11
  16. package/dist/bundled/v3/components/OrExpansionPanelV3/index.js +4 -2
  17. package/dist/bundled/v3/components/OrExpansionPanelV3/props.d.ts +5 -0
  18. package/dist/bundled/v3/components/OrExpansionPanelV3/props.js +7 -1
  19. package/dist/bundled/v3/components/OrExpansionPanelV3/styles.d.ts +4 -3
  20. package/dist/bundled/v3/components/OrExpansionPanelV3/styles.js +17 -5
  21. package/dist/bundled/v3/components/OrSelectV3/OrSelect.js +4 -4
  22. package/dist/bundled/v3/components/OrSelectV3/index.js +3 -3
  23. package/dist/bundled/v3/components/index.js +3 -3
  24. package/dist/bundled/v3/index.js +4 -4
  25. package/dist/esm/v2/{OrExpansionPanel-d3a2218d.js → OrExpansionPanel-b8411db6.js} +48 -36
  26. package/dist/esm/v2/{OrSelect-1132c7dc.js → OrSelect-7f2d3a94.js} +1 -1
  27. package/dist/esm/v2/components/index.js +2 -2
  28. package/dist/esm/v2/components/or-expansion-panel-v3/OrExpansionPanel.vue.d.ts +28 -15
  29. package/dist/esm/v2/components/or-expansion-panel-v3/index.js +5 -1
  30. package/dist/esm/v2/components/or-expansion-panel-v3/props.d.ts +5 -0
  31. package/dist/esm/v2/components/or-expansion-panel-v3/styles.d.ts +4 -3
  32. package/dist/esm/v2/components/or-select-v3/index.js +3 -3
  33. package/dist/esm/v2/index.js +2 -2
  34. package/dist/esm/v3/{OrExpansionPanel-c016d8fa.js → OrExpansionPanel-df527763.js} +47 -35
  35. package/dist/esm/v3/{OrSelect-9432ac4d.js → OrSelect-c931ed6e.js} +1 -1
  36. package/dist/esm/v3/components/index.js +2 -2
  37. package/dist/esm/v3/components/or-expansion-panel-v3/OrExpansionPanel.vue.d.ts +22 -11
  38. package/dist/esm/v3/components/or-expansion-panel-v3/index.js +5 -1
  39. package/dist/esm/v3/components/or-expansion-panel-v3/props.d.ts +5 -0
  40. package/dist/esm/v3/components/or-expansion-panel-v3/styles.d.ts +4 -3
  41. package/dist/esm/v3/components/or-select-v3/index.js +3 -3
  42. package/dist/esm/v3/index.js +2 -2
  43. package/package.json +2 -2
  44. package/src/components/or-expansion-panel-v3/OrExpansionPanel.vue +28 -35
  45. package/src/components/or-expansion-panel-v3/props.ts +6 -0
  46. package/src/components/or-expansion-panel-v3/styles.ts +25 -3
@@ -1,4 +1,4 @@
1
- export { s as OrSelectV3 } from '../../OrSelect-9432ac4d.js';
1
+ export { s as OrSelectV3 } from '../../OrSelect-c931ed6e.js';
2
2
  export { I as SelectSize } from '../../OrInputBox-32814878.js';
3
3
  import 'vue-demi';
4
4
  import '../../dropdown-open-e1f90e0a.js';
@@ -12,7 +12,8 @@ import '../../OrLabel-4da56db0.js';
12
12
  import 'vue';
13
13
  import '../../style-inject.es-4c6f2515.js';
14
14
  import '../../OrError-c01d0c29.js';
15
- import '../../OrExpansionPanel-c016d8fa.js';
15
+ import '../../OrExpansionPanel-df527763.js';
16
+ import '../../usePopoverState-8a95a300.js';
16
17
  import '../../OrIcon-62793572.js';
17
18
  import '../../OrHint-06ab89d7.js';
18
19
  import '../../OrInput-a303f924.js';
@@ -20,7 +21,6 @@ import '../../useResponsive-a02e95b7.js';
20
21
  import '../../useValidationAttributes-d1abbe34.js';
21
22
  import '../../OrIconButton-0aaadc68.js';
22
23
  import '../../OrTooltip-3025564a.js';
23
- import '../../usePopoverState-8a95a300.js';
24
24
  import '../../OrPopover-337df396.js';
25
25
  import '@floating-ui/dom';
26
26
  import '../../useElevation-a50ec347.js';
@@ -31,7 +31,7 @@ export { E as EmptyStateSize, s as OrEmptyStateV3 } from './OrEmptyState-5349a1f
31
31
  export { s as OrError } from './OrError-f90296db.js';
32
32
  export { s as OrErrorTagV3 } from './OrErrorTag-ade9192b.js';
33
33
  export { s as OrErrorV3 } from './OrError-c01d0c29.js';
34
- export { a as ExpansionPanelColor, E as ExpansionPanelVariant, s as OrExpansionPanelV3 } from './OrExpansionPanel-c016d8fa.js';
34
+ export { b as ExpansionPanelBackgroundColor, a as ExpansionPanelColor, E as ExpansionPanelVariant, s as OrExpansionPanelV3 } from './OrExpansionPanel-df527763.js';
35
35
  export { F as FabColor, s as OrFabV3 } from './OrFab-83cd7ed7.js';
36
36
  export { s as OrFloating, a as OrFloatingHideStrategy, O as OrFloatingPlacements } from './OrFloating-1a9ccfe9.js';
37
37
  export { F as FormGroupDirection, s as OrFormGroupV3 } from './OrFormGroup-9f581536.js';
@@ -76,7 +76,7 @@ export { s as OrSearch } from './OrSearch-d0c8aca7.js';
76
76
  export { s as OrSearchV3 } from './OrSearch-c5ecb005.js';
77
77
  export { s as OrSegmentedControlV3, S as SegmentedControlSize } from './OrSegmentedControl-359fbf3a.js';
78
78
  export { s as OrSelect } from './OrSelect-60205145.js';
79
- export { s as OrSelectV3 } from './OrSelect-9432ac4d.js';
79
+ export { s as OrSelectV3 } from './OrSelect-c931ed6e.js';
80
80
  export { s as OrSidebar, O as OrSidebarSide } from './OrSidebar-aaf73310.js';
81
81
  export { s as OrSidebarV3 } from './OrSidebar-7f5795da.js';
82
82
  export { O as OrSidebarPlacement } from './OrSidebarCollapseButton-5fb7a6a1.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onereach/ui-components",
3
- "version": "4.7.4",
3
+ "version": "4.7.5",
4
4
  "description": "Vue components library for v2/3",
5
5
  "sideEffects": false,
6
6
  "main": "./dist/auto/index.js",
@@ -155,5 +155,5 @@
155
155
  },
156
156
  "./package.json": "./package.json"
157
157
  },
158
- "gitHead": "a3b5b4e9e2efb120428562a9dbc907d128cb037c"
158
+ "gitHead": "7f847df360021cf81d62c83583de7acea0964a1b"
159
159
  }
@@ -9,13 +9,14 @@
9
9
  :class="headerStyles"
10
10
  :tabindex="!disabled ? 0 : null"
11
11
  :disabled="disabled ? '' : null"
12
- @click.stop="expanded ? close(): open()"
12
+ @click.stop="toggle()"
13
13
  >
14
14
  <OrIcon
15
- :class="[expanded ? 'rotate-0' : 'rotate-[-90deg]']"
15
+ :class="[state === 'open' ? 'rotate-0' : 'rotate-[-90deg]']"
16
16
  :icon="'expand_more'"
17
17
  :variant="'filled-bold'"
18
18
  />
19
+
19
20
  <span class="truncate">
20
21
  {{ label }}
21
22
  </span>
@@ -26,17 +27,18 @@
26
27
  </div>
27
28
  </div>
28
29
 
29
- <div v-show="expanded">
30
+ <div v-show="state === 'open'">
30
31
  <slot />
31
32
  </div>
32
33
  </div>
33
34
  </template>
34
35
 
35
36
  <script lang="ts">
36
- import { computed, defineComponent, PropType, ref, watch } from 'vue-demi';
37
+ import { computed, defineComponent, PropType, ref, toRef } from 'vue-demi';
38
+ import { usePopoverState } from '../../hooks';
37
39
  import { OrIconV3 as OrIcon } from '../or-icon-v3';
38
- import { ExpansionPanelColor, ExpansionPanelVariant } from './props';
39
- import { ExpansionPanelAddon, ExpansionPanelHeader, ExpansionPanelHeaderColors, ExpansionPanelRoot, ExpansionPanelRootVariants } from './styles';
40
+ import { ExpansionPanelBackgroundColor, ExpansionPanelColor, ExpansionPanelVariant } from './props';
41
+ import { ExpansionPanel, ExpansionPanelAddon, ExpansionPanelBackgroundColors, ExpansionPanelHeader, ExpansionPanelHeaderColors, ExpansionPanelVariants } from './styles';
40
42
 
41
43
  export default defineComponent({
42
44
  name: 'OrExpansionPanel',
@@ -52,20 +54,25 @@ export default defineComponent({
52
54
  },
53
55
 
54
56
  isOpen: {
55
- type: Boolean as PropType<boolean>,
57
+ type: Boolean,
56
58
  default: false,
57
59
  },
58
60
 
59
61
  variant: {
60
- type: String as PropType<ExpansionPanelVariant>,
62
+ type: String as PropType<`${ExpansionPanelVariant}`>,
61
63
  default: ExpansionPanelVariant.Default,
62
64
  },
63
65
 
64
66
  color: {
65
- type: String as PropType<ExpansionPanelColor>,
67
+ type: String as PropType<`${ExpansionPanelColor}`>,
66
68
  default: ExpansionPanelColor.Default,
67
69
  },
68
70
 
71
+ backgroundColor: {
72
+ type: String as PropType<`${ExpansionPanelBackgroundColor}`>,
73
+ default: ExpansionPanelBackgroundColor.Primary,
74
+ },
75
+
69
76
  disabled: {
70
77
  type: Boolean,
71
78
  default: false,
@@ -73,14 +80,20 @@ export default defineComponent({
73
80
  },
74
81
 
75
82
  emits: [
83
+ 'update:state',
84
+
76
85
  'open',
77
86
  'close',
78
87
  ],
79
88
 
80
89
  expose: [
81
90
  'root',
91
+
92
+ 'state',
93
+
82
94
  'open',
83
95
  'close',
96
+ 'toggle',
84
97
  ],
85
98
 
86
99
  setup(props, context) {
@@ -90,8 +103,9 @@ export default defineComponent({
90
103
  // Styles
91
104
  const rootStyles = computed(() => [
92
105
  'or-expansion-panel-v3',
93
- ...ExpansionPanelRoot,
94
- ...ExpansionPanelRootVariants[props.variant],
106
+ ...ExpansionPanel,
107
+ ...ExpansionPanelVariants[props.variant],
108
+ ...ExpansionPanelBackgroundColors[`${props.backgroundColor}-${props.variant}`],
95
109
  ]);
96
110
 
97
111
  const headerStyles = computed(() => [
@@ -104,38 +118,17 @@ export default defineComponent({
104
118
  ]);
105
119
 
106
120
  // State
107
- const expanded = ref(false);
108
-
109
- // Events
110
- watch(expanded, (value) => {
111
- context.emit(value ? 'open' : 'close');
112
- });
113
-
114
- watch(() => props.isOpen, (newIsOpen) => {
115
- if (newIsOpen) {
116
- open();
117
- } else {
118
- close();
119
- }
120
- }, { immediate: true });
121
-
122
- // Methods
123
- function open(): void {
124
- expanded.value = true;
125
- }
126
-
127
- function close(): void {
128
- expanded.value = false;
129
- }
121
+ const { state, open, close, toggle } = usePopoverState(toRef(props, 'isOpen'), context);
130
122
 
131
123
  return {
132
124
  root,
133
125
  rootStyles,
134
126
  headerStyles,
135
127
  addonStyles,
136
- expanded,
128
+ state,
137
129
  open,
138
130
  close,
131
+ toggle,
139
132
  };
140
133
  },
141
134
  });
@@ -7,3 +7,9 @@ export enum ExpansionPanelColor {
7
7
  Default = 'default',
8
8
  Danger = 'danger',
9
9
  }
10
+
11
+ export enum ExpansionPanelBackgroundColor {
12
+ Primary = 'primary',
13
+ Secondary = 'secondary',
14
+ Inherit = 'inherit',
15
+ }
@@ -1,11 +1,11 @@
1
- import { ExpansionPanelColor, ExpansionPanelVariant } from './props';
1
+ import { ExpansionPanelBackgroundColor, ExpansionPanelColor, ExpansionPanelVariant } from './props';
2
2
 
3
- export const ExpansionPanelRoot: string[] = [
3
+ export const ExpansionPanel: string[] = [
4
4
  // Layout
5
5
  'layout-column',
6
6
  ];
7
7
 
8
- export const ExpansionPanelRootVariants: Record<ExpansionPanelVariant, string[]> = {
8
+ export const ExpansionPanelVariants: Record<ExpansionPanelVariant, string[]> = {
9
9
  'default': [
10
10
  // Spacing
11
11
  'gap-sm',
@@ -20,11 +20,33 @@ export const ExpansionPanelRootVariants: Record<ExpansionPanelVariant, string[]>
20
20
  'py-md',
21
21
 
22
22
  'gap-md',
23
+ ],
24
+ };
25
+
26
+ export const ExpansionPanelBackgroundColors: Record<`${ExpansionPanelBackgroundColor}-${ExpansionPanelVariant}`, string[]> = {
27
+ 'primary-default': [],
23
28
 
29
+ 'primary-card': [
24
30
  // Theme
25
31
  'theme-background-surface-1',
26
32
  'dark:theme-background-surface-1-dark',
27
33
  ],
34
+
35
+ 'secondary-default': [],
36
+
37
+ 'secondary-card': [
38
+ // Theme
39
+ 'theme-background-surface-3',
40
+ 'dark:theme-background-surface-3-dark',
41
+ ],
42
+
43
+ 'inherit-default': [],
44
+
45
+ 'inherit-card': [
46
+ // Theme
47
+ 'theme-background-inherit',
48
+ 'dark:theme-background-inherit',
49
+ ],
28
50
  };
29
51
 
30
52
  export const ExpansionPanelHeader: string[] = [