Skip to content

Commit

Permalink
Merge pull request #1810 from evidence-dev/03-28-24-release
Browse files Browse the repository at this point in the history
03 28 24 release
  • Loading branch information
mcrascal authored Mar 28, 2024
2 parents 0147c12 + aa87a03 commit d18823d
Show file tree
Hide file tree
Showing 94 changed files with 3,396 additions and 1,622 deletions.
5 changes: 5 additions & 0 deletions .changeset/cyan-suits-fry.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@evidence-dev/core-components': patch
---

Fix errors caused by formatting null values
5 changes: 5 additions & 0 deletions .changeset/friendly-windows-beg.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@evidence-dev/core-components': minor
---

add `Select all` option to `Dropdown`s, add dropdowns to `DateRange` for easier year selection
5 changes: 5 additions & 0 deletions .changeset/gold-eagles-vanish.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@evidence-dev/core-components': patch
---

Adjust scatter hover to focus on individual point
6 changes: 6 additions & 0 deletions .changeset/great-snails-kiss.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@evidence-dev/component-utilities': patch
'@evidence-dev/core-components': patch
---

Add support for connected charts
5 changes: 5 additions & 0 deletions .changeset/nervous-snakes-flow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@evidence-dev/core-components': patch
---

Add table groups and standalone Delta component
6 changes: 6 additions & 0 deletions .changeset/twelve-bottles-wink.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@evidence-dev/component-utilities': patch
'@evidence-dev/core-components': patch
---

Fix map image download
5 changes: 5 additions & 0 deletions .changeset/violet-scissors-walk.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@evidence-dev/core-components': patch
---

Add options to Evidence layout
5 changes: 5 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,8 @@ jobs:
SQLITE_FILENAME: ':memory:'

DUCKDB_FILENAME: ':memory:'

- name: Test the CLI via test-env for merges to main
if: ${{ github.base_ref == 'main' }}
run: |
pnpm run sources:test-env && pnpm run build:test-env
9 changes: 1 addition & 8 deletions .prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,5 @@
"trailingComma": "none",
"printWidth": 100,
"plugins": ["prettier-plugin-svelte"],
"overrides": [
{
"files": "*.svelte",
"options": {
"parser": "svelte"
}
}
]
"overrides": [{ "files": "*.svelte", "options": { "parser": "svelte" } }]
}
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"fs-extra": "11.2.0",
"git-remote-origin-url": "4.0.0",
"npm-run-all": "^4.1.5",
"prettier": "^3.1.0",
"prettier": "^3.2.5",
"prettier-plugin-svelte": "^3.1.2",
"prismjs": "1.29.0",
"remark-parse": "8.0.2",
Expand Down Expand Up @@ -62,9 +62,9 @@
"serve:docs": "pnpm --filter ./sites/docs serve",
"release": "run-s package:core-components build:tailwind build:evidence build:plugin-connector && pnpm changeset publish",
"release:next": "VERSION=$(git rev-parse --short HEAD) && pnpm -r exec npm pkg set version=0.0.0-\"$VERSION\" && pnpm install --frozen-lockfile && pnpm -r publish --tag next --no-git-checks",
"test": "run-s package:core-components build:tailwind build:evidence && pnpm i --frozen-lockfile && pnpm -r test",
"test": "pnpm -r test",
"test:ui": "pnpm -r test:ui",
"postinstall": "run-s build:plugin-connector build:preprocess build:tailwind build:query-store package:core-components build:evidence && pnpm install --ignore-scripts",
"postinstall": "run-s build:plugin-connector build:preprocess build:tailwind build:query-store package:core-components build:evidence",
"docs": "pnpm --filter ./sites/docs start",
"lint": "prettier --plugin-search-dir . --check . && eslint .",
"format": "prettier --plugin-search-dir . --write .",
Expand Down
8 changes: 7 additions & 1 deletion packages/lib/component-utilities/src/echarts.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { registerTheme, init } from 'echarts';
import { registerTheme, init, connect } from 'echarts';
import { evidenceThemeLight } from './echartsThemes';
import debounce from 'debounce';

Expand Down Expand Up @@ -27,6 +27,12 @@ export default (node, option) => {
renderer: useSvg ? 'svg' : option.renderer ?? 'canvas'
});

// If connectGroup supplied, connect chart to other charts matching that connectGroup
if (option.connectGroup) {
chart.group = option.connectGroup;
connect(option.connectGroup);
}

// This function applies overrides to the echarts config generated by our chart components.
// In cases where these affect the spacing of the chart, some jumping/reanimation will be visible when
// the chart is animated. This is because we need to pass the initial options without the overrides to echarts
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ export default (node, option) => {
...option.echartsOptions
});
}
console.log(chart.getOption());
};

// seriesOptions - loop through series and apply same changes to each
Expand Down
8 changes: 7 additions & 1 deletion packages/lib/component-utilities/src/echartsMap.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { init, registerMap } from 'echarts';
import { init, registerMap, connect } from 'echarts';
import usStateMap from './usStateMap.json';

export default (node, option) => {
Expand Down Expand Up @@ -36,6 +36,12 @@ export default (node, option) => {
height: `${node.clientWidth * 0.5 + extraHeight}`
});

// If connectGroup supplied, connect chart to other charts matching that connectGroup
if (option.connectGroup) {
chart.group = option.connectGroup;
connect(option.connectGroup);
}

if (node && node.parentNode) {
// node.parentNode refers to the chart's container
node.style.height = chart.getHeight() + 'px';
Expand Down
9 changes: 1 addition & 8 deletions packages/lib/sdk/.prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,5 @@
"trailingComma": "none",
"printWidth": 100,
"plugins": ["prettier-plugin-svelte"],
"overrides": [
{
"files": "*.svelte",
"options": {
"parser": "svelte"
}
}
]
"overrides": [{ "files": "*.svelte", "options": { "parser": "svelte" } }]
}
2 changes: 1 addition & 1 deletion packages/ui/core-components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@
"postcss": "^8.4.23",
"postcss-load-config": "^4.0.1",
"prettier": "^2.8.0",
"prettier-plugin-svelte": "^2.8.1",
"prettier-plugin-svelte": "^3.1.2",
"publint": "^0.1.9",
"react": "^17.0.1",
"react-dom": "^17.0.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -255,9 +255,20 @@
</VirtualList>
{/if}
</Command.Group>
{#if $selectedValues.length > 0 && multiple}
{#if multiple}
<Command.Separator />
<Command.Item
class="justify-center text-center"
onSelect={() => {
$selectedValues = $items.map((x) => ({ label: x.label, value: x.value }));
selectedValuesToInput();
}}
>
Select all
</Command.Item>
<Command.Separator />
<Command.Item
disabled={$selectedValues.length === 0}
class="justify-center text-center"
onSelect={() => {
$selectedValues = [];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<RangeCalendarPrimitive.NextButton
on:click
class={cn(
buttonVariants({ variant: 'outline' }),
buttonVariants({ variant: 'ghost' }),
'h-7 w-7 bg-transparent p-0 opacity-50 hover:opacity-100',
className
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<RangeCalendarPrimitive.PrevButton
on:click
class={cn(
buttonVariants({ variant: 'outline' }),
buttonVariants({ variant: 'ghost' }),
'h-7 w-7 bg-transparent p-0 opacity-50 hover:opacity-100',
className
)}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,27 +1,84 @@
<script>
import { RangeCalendar as RangeCalendarPrimitive } from 'bits-ui';
import * as RangeCalendar from './index.js';
import * as Select from '../select/index.js';
import { cn } from '$lib/utils.js';
import { DateFormatter, getLocalTimeZone } from '@internationalized/date';
// required to dodge the styling on the shadcn version
import { Select as SelectPrimitive } from 'bits-ui';
/** @type {any | undefined} */
/** @typedef {import("@internationalized/date").DateValue} DateValue */
/** @typedef {import("@internationalized/date").CalendarDate} CalendarDate */
/** @type {import("bits-ui").DateRange | undefined} */
let value = undefined;
/** @type {any | undefined} */
/** @type {DateValue | undefined} */
let placeholder = undefined;
/** @type {{ start: DateValue; end: DateValue; } | undefined} */
let selectedDateRange = undefined;
/** @type {'short' | 'long' | undefined} */
let weekdayFormat = 'short';
/** @type {any | undefined} */
/** @type {DateValue | undefined} */
let startValue = undefined;
/** @type {CalendarDate | undefined} */
let minValue = undefined;
/** @type {CalendarDate | undefined} */
let maxValue = undefined;
/** @type {string | undefined | null} */
let className = undefined;
export { className as class, value, placeholder, weekdayFormat, startValue };
const monthOptions = [
'January',
'February',
'March',
'April',
'May',
'June',
'July',
'August',
'September',
'October',
'November',
'December'
].map((month, i) => ({ value: i + 1, label: month }));
const monthFmt = new DateFormatter('en-US', {
month: 'long'
});
$: yearOptions = Array.from({ length: 100 }, (_, i) => ({
label: String(new Date().getFullYear() - i),
value: new Date().getFullYear() - i
})).filter(({ value }) => !(minValue?.year > value || value > maxValue?.year));
$: defaultYear = placeholder
? { value: placeholder.year, label: String(placeholder.year) }
: undefined;
$: defaultMonth = placeholder
? { value: placeholder.month, label: monthFmt.format(placeholder.toDate(getLocalTimeZone())) }
: undefined;
export {
className as class,
value,
placeholder,
weekdayFormat,
startValue,
selectedDateRange,
minValue,
maxValue
};
</script>
<RangeCalendarPrimitive.Root
bind:value
bind:placeholder
bind:startValue
bind:selectedDateRange
{minValue}
{maxValue}
{weekdayFormat}
class={cn('p-3', className)}
{...$$restProps}
Expand All @@ -31,12 +88,61 @@
>
<RangeCalendar.Header>
<RangeCalendar.PrevButton />
<RangeCalendar.Heading />
<RangeCalendar.Heading
class="flex items-center justify-between font-normal text-gray-700 group"
>
<Select.Root
selected={defaultMonth}
items={monthOptions}
onSelectedChange={(v) => {
if (!v || !placeholder) return;
if (v.value === placeholder?.month) return;
placeholder = placeholder.set({ month: v.value });
}}
>
<SelectPrimitive.Trigger
aria-label="Select month"
class="text-sm pr-1 pl-2 py-1 rounded-tl rounded-bl border-r border-white transition-colors duration-200 group-hover:bg-gray-100 group-hover:border-gray-200 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-gray-400"
>
<Select.Value placeholder="Select month" />
</SelectPrimitive.Trigger>
<Select.Content class="max-h-[200px] overflow-y-auto !w-[118px]">
{#each monthOptions as { value, label }}
<Select.Item {value} {label}>
{label}
</Select.Item>
{/each}
</Select.Content>
</Select.Root>
<Select.Root
selected={defaultYear}
items={yearOptions}
onSelectedChange={(v) => {
if (!v || !placeholder) return;
if (v.value === placeholder?.year) return;
placeholder = placeholder.set({ year: v.value });
}}
>
<SelectPrimitive.Trigger
aria-label="Select year"
class=" pr-2 pl-1 py-1 rounded-tr rounded-br text-sm group-hover:bg-gray-100 transition-colors duration-200 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-gray-400"
>
<Select.Value placeholder="Select year" />
</SelectPrimitive.Trigger>
<Select.Content class="max-h-[200px] overflow-y-auto !w-[79px]">
{#each yearOptions as { value, label }}
<Select.Item {value} {label}>
{label}
</Select.Item>
{/each}
</Select.Content>
</Select.Root>
</RangeCalendar.Heading>
<RangeCalendar.NextButton />
</RangeCalendar.Header>
<RangeCalendar.Months>
{#each months as month}
<RangeCalendar.Grid>
<RangeCalendar.Grid class="mx-auto w-fit">
<RangeCalendar.GridHead>
<RangeCalendar.GridRow class="flex">
{#each weekdays as weekday}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
$: crumbs = buildCrumbs(pathArray);
</script>

<div class="flex items-start mt-8 sm:mt-12 whitespace-nowrap overflow-auto">
<div class="flex items-start mt-0 whitespace-nowrap overflow-auto">
<div class="inline-flex items-center text-sm capitalize gap-1 text-gray-500 mb-2 sm:mb-4">
{#each crumbs as crumb, i}
{#if i > 0}
Expand Down
Loading

0 comments on commit d18823d

Please sign in to comment.