@onereach/ui-components 2.62.7-beta.1920.0 → 2.62.7-beta.1922.0

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 (99) hide show
  1. package/dist/v2/OrSegmentedControls-cd8b1cd3.js +230 -0
  2. package/dist/v2/components/index.d.ts +1 -0
  3. package/dist/v2/components/or-segmented-controls-v3/OrSegmentedControls.stories3.d.ts +12 -0
  4. package/dist/v2/components/or-segmented-controls-v3/OrSegmentedControls.vue.d.ts +77 -0
  5. package/dist/v2/components/or-segmented-controls-v3/components/or-segmented-controls-item/OrSegmentedControlsItem.vue.d.ts +47 -0
  6. package/dist/v2/components/or-segmented-controls-v3/components/or-segmented-controls-item/styles.d.ts +3 -0
  7. package/dist/v2/components/or-segmented-controls-v3/index.d.ts +3 -0
  8. package/dist/v2/components/or-segmented-controls-v3/props.d.ts +4 -0
  9. package/dist/v2/components/or-segmented-controls-v3/styles.d.ts +3 -0
  10. package/dist/v2/components/or-segmented-controls-v3/types.d.ts +4 -0
  11. package/dist/v2/index.js +1 -0
  12. package/dist/v2/index2.js +1 -0
  13. package/dist/v2/index63.js +2 -16
  14. package/dist/v2/index64.js +15 -24
  15. package/dist/v2/index65.js +26 -4
  16. package/dist/v2/index66.js +2 -1
  17. package/dist/v2/index67.js +3 -4
  18. package/dist/v2/index68.js +3 -4
  19. package/dist/v2/index69.js +3 -10
  20. package/dist/v2/index70.js +3 -6
  21. package/dist/v2/index71.js +13 -2
  22. package/dist/v2/index72.js +4 -6
  23. package/dist/v2/index73.js +6 -4
  24. package/dist/v2/index74.js +2 -1
  25. package/dist/v2/index75.js +3 -3
  26. package/dist/v2/index76.js +3 -4
  27. package/dist/v2/index77.js +4 -15
  28. package/dist/v2/index78.js +14 -11
  29. package/dist/v2/index79.js +11 -13
  30. package/dist/v2/index80.js +14 -2
  31. package/dist/v2/index81.js +2 -2
  32. package/dist/v2/index82.js +2 -3
  33. package/dist/v2/index83.js +1 -6
  34. package/dist/v2/index84.js +7 -20
  35. package/dist/v2/index85.js +12 -9
  36. package/dist/v2/index86.js +18 -1
  37. package/dist/v2/index87.js +2 -18
  38. package/dist/v2/index88.js +18 -2
  39. package/dist/v2/index89.js +2 -10
  40. package/dist/v2/index90.js +9 -11
  41. package/dist/v2/index91.js +12 -1
  42. package/dist/v2/index92.js +1 -6
  43. package/dist/v2/index93.js +5 -1
  44. package/dist/v2/index94.js +3 -0
  45. package/dist/v3/OrSegmentedControls-e4522910.js +183 -0
  46. package/dist/v3/components/index.d.ts +1 -0
  47. package/dist/v3/components/or-segmented-controls-v3/OrSegmentedControls.stories3.d.ts +12 -0
  48. package/dist/v3/components/or-segmented-controls-v3/OrSegmentedControls.vue.d.ts +77 -0
  49. package/dist/v3/components/or-segmented-controls-v3/components/or-segmented-controls-item/OrSegmentedControlsItem.vue.d.ts +47 -0
  50. package/dist/v3/components/or-segmented-controls-v3/components/or-segmented-controls-item/styles.d.ts +3 -0
  51. package/dist/v3/components/or-segmented-controls-v3/index.d.ts +3 -0
  52. package/dist/v3/components/or-segmented-controls-v3/props.d.ts +4 -0
  53. package/dist/v3/components/or-segmented-controls-v3/styles.d.ts +3 -0
  54. package/dist/v3/components/or-segmented-controls-v3/types.d.ts +4 -0
  55. package/dist/v3/index.js +1 -0
  56. package/dist/v3/index2.js +1 -0
  57. package/dist/v3/index63.js +2 -15
  58. package/dist/v3/index64.js +13 -22
  59. package/dist/v3/index65.js +24 -3
  60. package/dist/v3/index66.js +2 -1
  61. package/dist/v3/index67.js +3 -4
  62. package/dist/v3/index68.js +3 -4
  63. package/dist/v3/index69.js +3 -9
  64. package/dist/v3/index70.js +3 -4
  65. package/dist/v3/index71.js +10 -2
  66. package/dist/v3/index72.js +3 -5
  67. package/dist/v3/index73.js +5 -3
  68. package/dist/v3/index74.js +2 -1
  69. package/dist/v3/index75.js +3 -3
  70. package/dist/v3/index76.js +3 -4
  71. package/dist/v3/index77.js +4 -14
  72. package/dist/v3/index78.js +13 -10
  73. package/dist/v3/index79.js +10 -12
  74. package/dist/v3/index80.js +13 -1
  75. package/dist/v3/index81.js +1 -1
  76. package/dist/v3/index82.js +1 -3
  77. package/dist/v3/index83.js +1 -6
  78. package/dist/v3/index84.js +6 -16
  79. package/dist/v3/index85.js +12 -9
  80. package/dist/v3/index86.js +15 -1
  81. package/dist/v3/index87.js +2 -17
  82. package/dist/v3/index88.js +17 -2
  83. package/dist/v3/index89.js +2 -8
  84. package/dist/v3/index90.js +6 -9
  85. package/dist/v3/index91.js +11 -1
  86. package/dist/v3/index92.js +1 -6
  87. package/dist/v3/index93.js +5 -1
  88. package/dist/v3/index94.js +3 -0
  89. package/package.json +2 -2
  90. package/src/components/index.ts +1 -0
  91. package/src/components/or-segmented-controls-v3/OrSegmentedControls.docs.mdx +7 -0
  92. package/src/components/or-segmented-controls-v3/OrSegmentedControls.stories3.ts +118 -0
  93. package/src/components/or-segmented-controls-v3/OrSegmentedControls.vue +109 -0
  94. package/src/components/or-segmented-controls-v3/components/or-segmented-controls-item/OrSegmentedControlsItem.vue +63 -0
  95. package/src/components/or-segmented-controls-v3/components/or-segmented-controls-item/styles.ts +50 -0
  96. package/src/components/or-segmented-controls-v3/index.ts +3 -0
  97. package/src/components/or-segmented-controls-v3/props.ts +4 -0
  98. package/src/components/or-segmented-controls-v3/styles.ts +24 -0
  99. package/src/components/or-segmented-controls-v3/types.ts +4 -0
@@ -1,7 +1,2 @@
1
- export { u as useClassAttribute } from './useClassAttribute-47fdb016.js';
2
- export { u as useElevation } from './useElevation-0e973238.js';
3
- export { u as useOverflow } from './useOverflow-ac506c65.js';
4
- export { u as useResponsive } from './useResponsive-a02e95b7.js';
5
- export { u as useToggle } from './useToggle-29e4d7c7.js';
1
+ export { D as DropdownClose, a as DropdownOpen } from './dropdown-open-0d314aa4.js';
6
2
  import 'vue-demi';
7
- import '@vueuse/core';
@@ -1,3 +1,7 @@
1
+ export { u as useClassAttribute } from './useClassAttribute-47fdb016.js';
2
+ export { u as useElevation } from './useElevation-0e973238.js';
3
+ export { u as useOverflow } from './useOverflow-ac506c65.js';
1
4
  export { u as useResponsive } from './useResponsive-a02e95b7.js';
2
- import '@vueuse/core';
5
+ export { u as useToggle } from './useToggle-29e4d7c7.js';
3
6
  import 'vue-demi';
7
+ import '@vueuse/core';
@@ -0,0 +1,3 @@
1
+ export { u as useResponsive } from './useResponsive-a02e95b7.js';
2
+ import '@vueuse/core';
3
+ import 'vue-demi';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onereach/ui-components",
3
- "version": "2.62.7-beta.1920.0",
3
+ "version": "2.62.7-beta.1922.0",
4
4
  "description": "Vue components library for v2/3",
5
5
  "sideEffects": false,
6
6
  "main": "./dist/auto/index.js",
@@ -29,7 +29,7 @@
29
29
  "@codemirror/lang-json": "6.0.0",
30
30
  "@codemirror/lang-markdown": "6.0.1",
31
31
  "@floating-ui/dom": "0.3.1",
32
- "@onereach/styles": "^2.30.1-beta.1920.0",
32
+ "@onereach/styles": "^2.30.0",
33
33
  "@splidejs/splide": "4.0.6",
34
34
  "@types/lodash": "4.14.173",
35
35
  "@types/sortablejs": "1.10.7",
@@ -58,6 +58,7 @@ export * from './or-radio';
58
58
  export * from './or-radio-group';
59
59
  export * from './or-radio-v3';
60
60
  export * from './or-search-v3';
61
+ export * from './or-segmented-controls-v3';
61
62
  export * from './or-select';
62
63
  export * from './or-select-v3';
63
64
  export * from './or-sidebar';
@@ -0,0 +1,7 @@
1
+ import { DocsPage } from '@storybook/addon-docs';
2
+
3
+ ```ts
4
+ import { OrSegmentedControlsV3 as OrSegmentedControls } from '@onereach/ui-components';
5
+ ```
6
+
7
+ <DocsPage />
@@ -0,0 +1,118 @@
1
+ import { action } from '@storybook/addon-actions';
2
+ import { Meta, StoryFn } from '@storybook/vue3';
3
+ import { ref, watch } from 'vue-demi';
4
+ import OrSegmentedControlsDocs from './OrSegmentedControls.docs.mdx';
5
+ import OrSegmentedControls from './OrSegmentedControls.vue';
6
+ import { SegmentedControlsSize } from './props';
7
+ import { SegmentedControlsOption } from './types';
8
+
9
+ export default {
10
+ title: 'Components/Forms/Segmented Controls',
11
+ component: OrSegmentedControls,
12
+
13
+ argTypes: {
14
+ // Props
15
+ options: {
16
+ control: { type: 'object' },
17
+ },
18
+
19
+ modelValue: {
20
+ control: { type: 'text' },
21
+ },
22
+
23
+ value: { // TODO: Remove Vue 2 fallback
24
+ control: { type: 'object' },
25
+ },
26
+
27
+ size: {
28
+ control: { type: 'select' },
29
+ options: Object.values(SegmentedControlsSize),
30
+ },
31
+
32
+ disabled: {
33
+ control: { type: 'boolean' },
34
+ },
35
+
36
+ // Events
37
+ 'update:modelValue': {
38
+ table: { disable: true },
39
+ },
40
+
41
+ input: {
42
+ table: { disable: true },
43
+ },
44
+
45
+ focus: {
46
+ table: { disable: true },
47
+ },
48
+
49
+ blur: {
50
+ table: { disable: true },
51
+ },
52
+ },
53
+
54
+ parameters: {
55
+ layout: 'centered',
56
+
57
+ docs: {
58
+ page: OrSegmentedControlsDocs,
59
+ },
60
+
61
+ design: {
62
+ type: 'figma',
63
+ url: 'https://www.figma.com/file/o7DdkaznUW2PtX4wiSuhhQ/Core?node-id=410%3A2097&t=7N93DAotOYMOX2kx-1',
64
+ },
65
+ },
66
+ } as Meta<typeof OrSegmentedControls>;
67
+
68
+ const Template: StoryFn<typeof OrSegmentedControls> = (args) => ({
69
+ components: {
70
+ OrSegmentedControls,
71
+ },
72
+
73
+ setup() {
74
+ // State
75
+ const model = ref<string>();
76
+
77
+ // Effects
78
+ watch(model, (value) => {
79
+ console.debug(value);
80
+ });
81
+
82
+ return {
83
+ args,
84
+ model,
85
+ onUpdateModelValue: action('update:modelValue'),
86
+ onInput: action('input'),
87
+ onFocus: action('focus'),
88
+ onBlur: action('blur'),
89
+ };
90
+ },
91
+
92
+ template: `
93
+ <OrSegmentedControls
94
+ v-model="model"
95
+ v-bind="args"
96
+ @update:modelValue="onUpdateModelValue"
97
+ @input="onInput"
98
+ @focus="onFocus"
99
+ @blur="onBlur"
100
+ />
101
+ `,
102
+ });
103
+
104
+ export const Base = Template.bind({});
105
+
106
+ Base.args = {
107
+ // Props
108
+ options: Array.from<string, SegmentedControlsOption>([
109
+ 'Alfa',
110
+ 'Bravo',
111
+ 'Charlie',
112
+ 'Delta',
113
+ 'Echo',
114
+ ], (item) => ({
115
+ value: item.toLowerCase(),
116
+ label: item,
117
+ })),
118
+ };
@@ -0,0 +1,109 @@
1
+ <template>
2
+ <div
3
+ ref="root"
4
+ v-bind="$attrs"
5
+ :class="rootStyles"
6
+ >
7
+ <OrSegmentedControlsItem
8
+ v-for="option in options"
9
+ :key="option.value"
10
+ :size="size"
11
+ :selected="option.value === proxyModelValue"
12
+ :disabled="disabled"
13
+ @click="proxyModelValue = option.value"
14
+ >
15
+ {{ option.label }}
16
+ </OrSegmentedControlsItem>
17
+ </div>
18
+ </template>
19
+
20
+ <script lang="ts">
21
+ import { computed, defineComponent, PropType, ref } from 'vue-demi';
22
+ import { useClassAttribute } from '../../hooks';
23
+ import OrSegmentedControlsItem from './components/or-segmented-controls-item/OrSegmentedControlsItem.vue';
24
+ import { SegmentedControlsSize } from './props';
25
+ import { SegmentedControlsRoot, SegmentedControlsRootSizes } from './styles';
26
+ import { SegmentedControlsOption } from './types';
27
+
28
+ export default defineComponent({
29
+ name: 'OrSegmentedControls',
30
+
31
+ components: {
32
+ OrSegmentedControlsItem,
33
+ },
34
+
35
+ inheritAttrs: false,
36
+
37
+ props: {
38
+ options: {
39
+ type: Array as PropType<SegmentedControlsOption[]>,
40
+ default: [] as SegmentedControlsOption[],
41
+ },
42
+
43
+ modelValue: {
44
+ type: String,
45
+ default: undefined,
46
+ },
47
+
48
+ value: { // TODO: Remove Vue 2 fallback
49
+ type: String,
50
+ default: undefined,
51
+ },
52
+
53
+ size: {
54
+ type: String as PropType<SegmentedControlsSize>,
55
+ default: SegmentedControlsSize.M,
56
+ },
57
+
58
+ disabled: {
59
+ type: Boolean,
60
+ default: false,
61
+ },
62
+ },
63
+
64
+ emits: [
65
+ 'update:modelValue',
66
+
67
+ 'input',
68
+ 'focus',
69
+ 'blur',
70
+ ],
71
+
72
+ expose: [
73
+ 'root',
74
+ ],
75
+
76
+ setup(props, context) {
77
+ // Refs
78
+ const root = ref<HTMLElement>();
79
+
80
+ // Styles
81
+ const classAttribute = useClassAttribute();
82
+
83
+ const rootStyles = computed(() => [
84
+ 'or-segmented-controls',
85
+ ...SegmentedControlsRoot,
86
+ ...SegmentedControlsRootSizes[props.size],
87
+ classAttribute.value,
88
+ ]);
89
+
90
+ // State
91
+ const proxyModelValue = computed({
92
+ get: () => {
93
+ return props.modelValue ?? props.value; // TODO: Remove Vue 2 fallback
94
+ },
95
+
96
+ set: (value) => {
97
+ context.emit('input', value);
98
+ context.emit('update:modelValue', value);
99
+ },
100
+ });
101
+
102
+ return {
103
+ root,
104
+ rootStyles,
105
+ proxyModelValue,
106
+ };
107
+ },
108
+ });
109
+ </script>
@@ -0,0 +1,63 @@
1
+ <template>
2
+ <div
3
+ ref="root"
4
+ v-bind="$attrs"
5
+ :class="rootStyles"
6
+ :selected="selected ? '' : null"
7
+ :disabled="disabled ? '' : null"
8
+ >
9
+ <div :class="['truncate']">
10
+ <slot />
11
+ </div>
12
+ </div>
13
+ </template>
14
+
15
+ <script lang="ts">
16
+ import { computed, defineComponent, PropType, ref } from 'vue-demi';
17
+ import { useClassAttribute } from '../../../../hooks';
18
+ import { SegmentedControlsSize } from '../../props';
19
+ import { SegmentedControlsItemRoot, SegmentedControlsItemRootSizes } from './styles';
20
+
21
+ export default defineComponent({
22
+ name: 'OrSegmentedControlsItem',
23
+
24
+ inheritAttrs: false,
25
+
26
+ props: {
27
+ size: {
28
+ type: String as PropType<SegmentedControlsSize>,
29
+ required: true,
30
+ },
31
+
32
+ selected: {
33
+ type: Boolean,
34
+ default: false,
35
+ },
36
+
37
+ disabled: {
38
+ type: Boolean,
39
+ default: false,
40
+ },
41
+ },
42
+
43
+ setup(props) {
44
+ // Refs
45
+ const root = ref<HTMLElement>();
46
+
47
+ // Styles
48
+ const classAttribute = useClassAttribute();
49
+
50
+ const rootStyles = computed(() => [
51
+ 'or-segmented-controls-item',
52
+ ...SegmentedControlsItemRoot,
53
+ ...SegmentedControlsItemRootSizes[props.size],
54
+ classAttribute.value,
55
+ ]);
56
+
57
+ return {
58
+ root,
59
+ rootStyles,
60
+ };
61
+ },
62
+ });
63
+ </script>
@@ -0,0 +1,50 @@
1
+ import { SegmentedControlsSize } from '../../props';
2
+
3
+ export const SegmentedControlsItemRoot: string[] = [
4
+ // Layout
5
+ 'flex',
6
+ 'items-center',
7
+ 'justify-center',
8
+
9
+ // Shape
10
+ 'rounded-md',
11
+
12
+ // Interactivity
13
+ 'interactivity-auto',
14
+
15
+ // Theme
16
+ 'theme-foreground-default',
17
+ 'dark:theme-foreground-default-dark',
18
+
19
+ // Theme (selected)
20
+ 'selected:theme-background-default',
21
+ 'dark:selected:theme-background-default-dark',
22
+
23
+ // Theme (selected, enabled)
24
+ 'selected:enabled:shadow-card',
25
+ 'dark:selected:enabled:shadow-card-dark',
26
+ ];
27
+
28
+ export const SegmentedControlsItemRootSizes: Record<SegmentedControlsSize, string[]> = {
29
+ 'm': [
30
+ // Box
31
+ 'h-[44px] md:h-[36px]',
32
+
33
+ // Spacing
34
+ 'px-sm+ md:px-sm+',
35
+
36
+ // Typography
37
+ 'typography-body-2-regular',
38
+ ],
39
+
40
+ 's': [
41
+ // Box
42
+ 'h-[36px] md:h-[32px]',
43
+
44
+ // Spacing
45
+ 'px-sm+ md:px-sm',
46
+
47
+ // Typography
48
+ 'typography-caption-regular',
49
+ ],
50
+ };
@@ -0,0 +1,3 @@
1
+ export { default as OrSegmentedControlsV3 } from './OrSegmentedControls.vue';
2
+ export * from './props';
3
+ export * from './types';
@@ -0,0 +1,4 @@
1
+ export enum SegmentedControlsSize {
2
+ M = 'm',
3
+ S = 's',
4
+ }
@@ -0,0 +1,24 @@
1
+ import { SegmentedControlsSize } from './props';
2
+
3
+ export const SegmentedControlsRoot: string[] = [
4
+ // Layout
5
+ 'grid',
6
+ 'grid-flow-col',
7
+ 'auto-cols-fr',
8
+
9
+ // Shape
10
+ 'rounded-md',
11
+
12
+ // Spacing
13
+ 'px-[2px]',
14
+ 'py-[2px]',
15
+
16
+ // Theme
17
+ 'theme-background-surface-variant',
18
+ 'dark:theme-background-surface-variant-dark',
19
+ ];
20
+
21
+ export const SegmentedControlsRootSizes: Record<SegmentedControlsSize, string[]> = {
22
+ 'm': [],
23
+ 's': [],
24
+ };
@@ -0,0 +1,4 @@
1
+ export interface SegmentedControlsOption {
2
+ value: string;
3
+ label: string;
4
+ }