@cfasim-ui/docs 0.5.0 → 0.6.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.
- package/charts/BarChart/BarChart.md +3 -0
- package/charts/BarChart/BarChart.vue +342 -317
- package/charts/ChartMenu/ChartMenu.vue +75 -5
- package/charts/ChoroplethMap/ChoroplethMap.md +5 -0
- package/charts/ChoroplethMap/ChoroplethMap.vue +193 -88
- package/charts/LineChart/LineChart.md +21 -4
- package/charts/LineChart/LineChart.vue +398 -367
- package/charts/_shared/chartProps.ts +10 -0
- package/charts/_shared/useChartFoundation.ts +15 -0
- package/charts/_shared/useChartFullscreen.ts +66 -9
- package/charts/_shared/useChartMenu.ts +13 -6
- package/charts/_shared/useChartTooltip.ts +57 -4
- package/charts/index.ts +0 -2
- package/components/ButtonGroup/ButtonGroup.md +64 -0
- package/components/ButtonGroup/ButtonGroup.vue +91 -0
- package/components/MultiSelect/MultiSelect.md +143 -0
- package/components/MultiSelect/MultiSelect.vue +338 -0
- package/components/ParamEditor/ParamEditor.md +19 -0
- package/components/ParamEditor/ParamEditor.vue +4 -0
- package/components/ParamEditor/ParamEditorImpl.vue +3 -3
- package/components/ToggleGroup/ToggleGroup.md +163 -0
- package/components/ToggleGroup/ToggleGroup.vue +143 -0
- package/components/index.ts +5 -0
- package/index.json +47 -1
- package/package.json +1 -1
- package/charts/_shared/fullscreen.css +0 -51
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { ToggleGroupItem, ToggleGroupRoot, useId } from "reka-ui";
|
|
3
|
+
import { computed } from "vue";
|
|
4
|
+
import Hint from "../Hint/Hint.vue";
|
|
5
|
+
|
|
6
|
+
export interface ToggleGroupOption {
|
|
7
|
+
value: string;
|
|
8
|
+
label: string;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
// `string` in single mode, `string[]` in multiple mode.
|
|
13
|
+
const model = defineModel<string | string[]>();
|
|
14
|
+
|
|
15
|
+
const props = withDefaults(
|
|
16
|
+
defineProps<{
|
|
17
|
+
options: ToggleGroupOption[];
|
|
18
|
+
multiple?: boolean;
|
|
19
|
+
label?: string;
|
|
20
|
+
hideLabel?: boolean;
|
|
21
|
+
ariaLabel?: string;
|
|
22
|
+
hint?: string;
|
|
23
|
+
disabled?: boolean;
|
|
24
|
+
orientation?: "horizontal" | "vertical";
|
|
25
|
+
}>(),
|
|
26
|
+
{ orientation: "horizontal" },
|
|
27
|
+
);
|
|
28
|
+
|
|
29
|
+
const id = useId();
|
|
30
|
+
const type = computed<"single" | "multiple">(() =>
|
|
31
|
+
props.multiple ? "multiple" : "single",
|
|
32
|
+
);
|
|
33
|
+
</script>
|
|
34
|
+
|
|
35
|
+
<template>
|
|
36
|
+
<div class="toggle-group-field">
|
|
37
|
+
<label
|
|
38
|
+
v-if="label"
|
|
39
|
+
:id="`${id}-label`"
|
|
40
|
+
class="toggle-group-label"
|
|
41
|
+
:class="{ 'visually-hidden': hideLabel }"
|
|
42
|
+
>
|
|
43
|
+
{{ label }}
|
|
44
|
+
<Hint v-if="hint && !hideLabel" :text="hint" />
|
|
45
|
+
</label>
|
|
46
|
+
<ToggleGroupRoot
|
|
47
|
+
v-model="model"
|
|
48
|
+
:type="type"
|
|
49
|
+
:disabled="disabled"
|
|
50
|
+
:orientation="orientation"
|
|
51
|
+
:class="['toggle-group', `toggle-group--${orientation}`]"
|
|
52
|
+
:aria-labelledby="label ? `${id}-label` : undefined"
|
|
53
|
+
:aria-label="!label ? ariaLabel : undefined"
|
|
54
|
+
>
|
|
55
|
+
<ToggleGroupItem
|
|
56
|
+
v-for="opt in options"
|
|
57
|
+
:key="opt.value"
|
|
58
|
+
:value="opt.value"
|
|
59
|
+
:disabled="opt.disabled"
|
|
60
|
+
class="toggle-group-item"
|
|
61
|
+
>
|
|
62
|
+
{{ opt.label }}
|
|
63
|
+
</ToggleGroupItem>
|
|
64
|
+
</ToggleGroupRoot>
|
|
65
|
+
</div>
|
|
66
|
+
</template>
|
|
67
|
+
|
|
68
|
+
<style scoped>
|
|
69
|
+
.toggle-group-field {
|
|
70
|
+
display: flex;
|
|
71
|
+
flex-direction: column;
|
|
72
|
+
gap: 0.25em;
|
|
73
|
+
align-items: flex-start;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.toggle-group-label {
|
|
77
|
+
display: flex;
|
|
78
|
+
align-items: center;
|
|
79
|
+
gap: 0.25em;
|
|
80
|
+
font-size: var(--font-size-sm);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.toggle-group {
|
|
84
|
+
display: inline-flex;
|
|
85
|
+
/* 1px gaps reveal the group background as dividers between items. */
|
|
86
|
+
gap: 1px;
|
|
87
|
+
background: var(--color-border);
|
|
88
|
+
border: 1px solid var(--color-border);
|
|
89
|
+
border-radius: 0.375em;
|
|
90
|
+
/* Clip items to the rounded outer corners. Focus uses an inset outline
|
|
91
|
+
* (below) so it isn't clipped away. */
|
|
92
|
+
overflow: hidden;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
.toggle-group--vertical {
|
|
96
|
+
flex-direction: column;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.toggle-group-item {
|
|
100
|
+
appearance: none;
|
|
101
|
+
display: inline-flex;
|
|
102
|
+
align-items: center;
|
|
103
|
+
justify-content: center;
|
|
104
|
+
min-height: 2.5em;
|
|
105
|
+
padding: 0 1em;
|
|
106
|
+
margin: 0;
|
|
107
|
+
border: none;
|
|
108
|
+
background: var(--color-bg-0);
|
|
109
|
+
color: var(--color-text);
|
|
110
|
+
font: inherit;
|
|
111
|
+
font-size: var(--font-size-sm);
|
|
112
|
+
font-weight: 500;
|
|
113
|
+
white-space: nowrap;
|
|
114
|
+
cursor: pointer;
|
|
115
|
+
transition:
|
|
116
|
+
background var(--transition-fast),
|
|
117
|
+
color var(--transition-fast);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
.toggle-group-item:hover:not([data-disabled]) {
|
|
121
|
+
background: var(--color-bg-2);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
.toggle-group-item[data-state="on"] {
|
|
125
|
+
background: var(--color-primary);
|
|
126
|
+
color: var(--color-text-on-primary);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
.toggle-group-item[data-state="on"]:hover:not([data-disabled]) {
|
|
130
|
+
background: var(--color-primary-hover);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
.toggle-group-item:focus-visible {
|
|
134
|
+
outline: 2px solid var(--color-primary);
|
|
135
|
+
outline-offset: -2px;
|
|
136
|
+
z-index: 1;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
.toggle-group-item[data-disabled] {
|
|
140
|
+
opacity: 0.5;
|
|
141
|
+
cursor: not-allowed;
|
|
142
|
+
}
|
|
143
|
+
</style>
|
package/components/index.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export { default as Box } from "./Box/Box.vue";
|
|
2
2
|
export type { BoxVariant } from "./Box/Box.vue";
|
|
3
3
|
export { default as Button } from "./Button/Button.vue";
|
|
4
|
+
export { default as ButtonGroup } from "./ButtonGroup/ButtonGroup.vue";
|
|
4
5
|
export { default as Container } from "./Container/Container.vue";
|
|
5
6
|
export type { ContainerGap } from "./Container/Container.vue";
|
|
6
7
|
export { default as Expander } from "./Expander/Expander.vue";
|
|
@@ -12,6 +13,8 @@ export type { IconSize } from "./Icon/Icon.vue";
|
|
|
12
13
|
export { registerIcons, hasIcon } from "./Icon/registry";
|
|
13
14
|
export type { IconRegistration, IconVariants } from "./Icon/registry";
|
|
14
15
|
export { default as LightDarkToggle } from "./LightDarkToggle/LightDarkToggle.vue";
|
|
16
|
+
export { default as MultiSelect } from "./MultiSelect/MultiSelect.vue";
|
|
17
|
+
export type { MultiSelectOption } from "./MultiSelect/MultiSelect.vue";
|
|
15
18
|
export { default as NumberInput } from "./NumberInput/NumberInput.vue";
|
|
16
19
|
export type { NumberRange } from "./NumberInput/NumberInput.vue";
|
|
17
20
|
export { default as ParamEditor } from "./ParamEditor/ParamEditor.vue";
|
|
@@ -26,3 +29,5 @@ export type { Tab } from "./SidebarLayout/SidebarLayout.vue";
|
|
|
26
29
|
export { default as Spinner } from "./Spinner/Spinner.vue";
|
|
27
30
|
export { default as TextInput } from "./TextInput/TextInput.vue";
|
|
28
31
|
export { default as Toggle } from "./Toggle/Toggle.vue";
|
|
32
|
+
export { default as ToggleGroup } from "./ToggleGroup/ToggleGroup.vue";
|
|
33
|
+
export type { ToggleGroupOption } from "./ToggleGroup/ToggleGroup.vue";
|
package/index.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.
|
|
2
|
+
"version": "0.6.0",
|
|
3
3
|
"package": "@cfasim-ui/docs",
|
|
4
4
|
"content": {
|
|
5
5
|
"components": [
|
|
@@ -23,6 +23,20 @@
|
|
|
23
23
|
"secondary"
|
|
24
24
|
]
|
|
25
25
|
},
|
|
26
|
+
{
|
|
27
|
+
"name": "ButtonGroup",
|
|
28
|
+
"slug": "button-group",
|
|
29
|
+
"docs": "components/ButtonGroup/ButtonGroup.md",
|
|
30
|
+
"source": "components/ButtonGroup/ButtonGroup.vue",
|
|
31
|
+
"keywords": [
|
|
32
|
+
"button group",
|
|
33
|
+
"buttons",
|
|
34
|
+
"group",
|
|
35
|
+
"toolbar",
|
|
36
|
+
"segmented",
|
|
37
|
+
"joined"
|
|
38
|
+
]
|
|
39
|
+
},
|
|
26
40
|
{
|
|
27
41
|
"name": "Container",
|
|
28
42
|
"slug": "container",
|
|
@@ -76,6 +90,23 @@
|
|
|
76
90
|
"source": "components/Icon/Icon.vue",
|
|
77
91
|
"keywords": []
|
|
78
92
|
},
|
|
93
|
+
{
|
|
94
|
+
"name": "MultiSelect",
|
|
95
|
+
"slug": "multi-select",
|
|
96
|
+
"docs": "components/MultiSelect/MultiSelect.md",
|
|
97
|
+
"source": "components/MultiSelect/MultiSelect.vue",
|
|
98
|
+
"keywords": [
|
|
99
|
+
"multiselect",
|
|
100
|
+
"multi-select",
|
|
101
|
+
"autocomplete",
|
|
102
|
+
"combobox",
|
|
103
|
+
"tags",
|
|
104
|
+
"chips",
|
|
105
|
+
"filter",
|
|
106
|
+
"search",
|
|
107
|
+
"typeahead"
|
|
108
|
+
]
|
|
109
|
+
},
|
|
79
110
|
{
|
|
80
111
|
"name": "NumberInput",
|
|
81
112
|
"slug": "number-input",
|
|
@@ -134,6 +165,21 @@
|
|
|
134
165
|
"docs": "components/Toggle/Toggle.md",
|
|
135
166
|
"source": "components/Toggle/Toggle.vue",
|
|
136
167
|
"keywords": []
|
|
168
|
+
},
|
|
169
|
+
{
|
|
170
|
+
"name": "ToggleGroup",
|
|
171
|
+
"slug": "toggle-group",
|
|
172
|
+
"docs": "components/ToggleGroup/ToggleGroup.md",
|
|
173
|
+
"source": "components/ToggleGroup/ToggleGroup.vue",
|
|
174
|
+
"keywords": [
|
|
175
|
+
"toggle group",
|
|
176
|
+
"segmented control",
|
|
177
|
+
"single select",
|
|
178
|
+
"multi select",
|
|
179
|
+
"button group",
|
|
180
|
+
"radio",
|
|
181
|
+
"pressed"
|
|
182
|
+
]
|
|
137
183
|
}
|
|
138
184
|
],
|
|
139
185
|
"charts": [
|
package/package.json
CHANGED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
/* Shared chart styles for the Expand / fullscreen menu item.
|
|
2
|
-
Bundled into @cfasim-ui/charts/style.css via index.ts so it ships
|
|
3
|
-
once for the whole package instead of repeating in every chart SFC. */
|
|
4
|
-
|
|
5
|
-
.line-chart-wrapper:hover .chart-menu-button,
|
|
6
|
-
.bar-chart-wrapper:hover .chart-menu-button,
|
|
7
|
-
.choropleth-wrapper:hover .chart-menu-button,
|
|
8
|
-
.line-chart-wrapper:focus-within .chart-menu-button,
|
|
9
|
-
.bar-chart-wrapper:focus-within .chart-menu-button,
|
|
10
|
-
.choropleth-wrapper:focus-within .chart-menu-button,
|
|
11
|
-
.line-chart-wrapper.is-fullscreen .chart-menu-button,
|
|
12
|
-
.bar-chart-wrapper.is-fullscreen .chart-menu-button,
|
|
13
|
-
.choropleth-wrapper.is-fullscreen .chart-menu-button {
|
|
14
|
-
opacity: 1;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
.line-chart-wrapper.is-fullscreen,
|
|
18
|
-
.bar-chart-wrapper.is-fullscreen,
|
|
19
|
-
.choropleth-wrapper.is-fullscreen {
|
|
20
|
-
position: fixed;
|
|
21
|
-
inset: 0;
|
|
22
|
-
z-index: var(--cfasim-z-fullscreen, 1000);
|
|
23
|
-
background: var(--color-bg-0, #fff);
|
|
24
|
-
color: var(--color-text, inherit);
|
|
25
|
-
padding: 2em;
|
|
26
|
-
box-sizing: border-box;
|
|
27
|
-
display: flex;
|
|
28
|
-
flex-direction: column;
|
|
29
|
-
justify-content: center;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
/* ChoroplethMap doesn't go through useChartFoundation, so its SVG keeps
|
|
33
|
-
its prop-driven width/height. Stretch it to fill the expanded box. */
|
|
34
|
-
.choropleth-wrapper.is-fullscreen svg {
|
|
35
|
-
flex: 1 1 auto;
|
|
36
|
-
min-height: 0;
|
|
37
|
-
height: 100%;
|
|
38
|
-
width: 100%;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
.chart-sr-only {
|
|
42
|
-
position: absolute;
|
|
43
|
-
width: 1px;
|
|
44
|
-
height: 1px;
|
|
45
|
-
padding: 0;
|
|
46
|
-
margin: -1px;
|
|
47
|
-
overflow: hidden;
|
|
48
|
-
clip: rect(0, 0, 0, 0);
|
|
49
|
-
white-space: nowrap;
|
|
50
|
-
border: 0;
|
|
51
|
-
}
|