@datawheel/data-explorer 1.1.11 → 1.1.13

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 (2) hide show
  1. package/dist/main.mjs +50 -30
  2. package/package.json +1 -1
package/dist/main.mjs CHANGED
@@ -1,5 +1,5 @@
1
- import { keyframes, createStyles, Select, Center, Text, rem, Input, Box, Stack, Group, Button, SimpleGrid, Flex, ScrollArea, LoadingOverlay, Table, MultiSelect, NumberInput, Menu, ActionIcon, UnstyledButton, Loader, Container, Title, useMantineTheme, TextInput, CopyButton, Alert, MantineProvider, Modal, Space, useComponentDefaultProps, Paper, Anchor, Skeleton, Accordion, Tooltip, Tabs, Switch, ThemeIcon, CloseButton, packSx, Divider, Drawer, Checkbox, Popover } from '@mantine/core';
2
- import { useClipboard, useDebouncedState, useFullscreen, useMediaQuery, useDisclosure } from '@mantine/hooks';
1
+ import { keyframes, createStyles, Select, Center, Text, rem, Input, Box, Stack, Group, Button, SimpleGrid, Flex, ScrollArea, LoadingOverlay, Table, MultiSelect, NumberInput, Menu, ActionIcon, UnstyledButton, Loader, Container, Title, useMantineTheme, TextInput, CopyButton, Alert, MantineProvider, Modal, Space, useComponentDefaultProps, Paper, Anchor, Skeleton, Accordion, Tooltip, Tabs, Switch, ThemeIcon, CloseButton, Divider, Drawer, Checkbox, packSx, Popover } from '@mantine/core';
2
+ import { useClipboard, useDebouncedState, useMediaQuery, useFullscreen, useDisclosure } from '@mantine/hooks';
3
3
  import { IconWorld, IconExternalLink, IconClipboard, IconSettings, IconMathGreater, IconMathLower, IconArrowsLeftRight, IconWorldWww, IconClipboardCheck, IconAlertCircle, IconAlertTriangle, IconCopy, IconDownload, IconDotsVertical, IconBox, IconArrowRight, IconArrowLeft, IconBrandGithub, IconCheck, IconShare, IconLanguage, IconTrash, IconInfoCircleFilled, IconX, IconChevronLeft, IconChevronRight, IconSearch, IconArrowsMinimize, IconArrowsMaximize, IconCircleOff, IconArrowsSort, IconSortDescendingNumbers, IconSortDescendingLetters, IconSortAscendingNumbers, IconSortAscendingLetters, IconPlus, IconStack3, IconFilterOff, IconFilter, IconAdjustments, IconClock, IconHelpCircle, IconPhotoDown, IconVectorTriangle } from '@tabler/icons-react';
4
4
  import * as React13 from 'react';
5
5
  import React13__default, { createContext, forwardRef, useMemo, useCallback, useContext, useRef, useEffect, useState, Suspense, Component, useLayoutEffect } from 'react';
@@ -2356,6 +2356,7 @@ function TableFooter(props) {
2356
2356
  Box,
2357
2357
  {
2358
2358
  w: "100%",
2359
+ id: "dex-table-footer-container",
2359
2360
  sx: (t2) => ({
2360
2361
  flex: "0 0 70px",
2361
2362
  maxWidth: "100vw",
@@ -2945,7 +2946,9 @@ function useTable({
2945
2946
  const { idFormatters } = useidFormatters();
2946
2947
  const { sortKey, sortDir } = useSelector$1(selectSortingParams);
2947
2948
  const theme = useMantineTheme();
2948
- const isSmallerThanMd = useMediaQuery(`(max-width: ${theme.breakpoints.md})`);
2949
+ const isSmallerThanMd = useMediaQuery(
2950
+ `(max-width: ${theme.breakpoints.md}${/(?:px|em|rem|vh|vw|%)$/.test(theme.breakpoints.xs) ? "" : "px"})`
2951
+ );
2949
2952
  const columns = useMemo(() => {
2950
2953
  const indexColumn = {
2951
2954
  id: "#",
@@ -2993,7 +2996,9 @@ function useTable({
2993
2996
  },
2994
2997
  Header: ({ column: column2 }) => {
2995
2998
  const isSorted = isColumnSorted(entity.name, sortKey);
2996
- const isMobile = useMediaQuery(`(max-width: ${theme.breakpoints.sm})`);
2999
+ const isMobile = useMediaQuery(
3000
+ `(max-width: ${theme.breakpoints.sm}${/(?:px|em|rem|vh|vw|%)$/.test(theme.breakpoints.xs) ? "" : "px"})`
3001
+ );
2997
3002
  const actionSort = /* @__PURE__ */ React13__default.createElement(
2998
3003
  ActionIcon,
2999
3004
  {
@@ -3477,7 +3482,9 @@ var AddColumnsDrawer = () => {
3477
3482
  const updateUrl = useUpdateUrl();
3478
3483
  const { translate: t } = useTranslation();
3479
3484
  const theme = useMantineTheme();
3480
- const smallerThanMd = useMediaQuery(`(max-width: ${theme.breakpoints.md})`);
3485
+ const smallerThanMd = useMediaQuery(
3486
+ `(max-width: ${theme.breakpoints.md}${/(?:px|em|rem|vh|vw|%)$/.test(theme.breakpoints.xs) ? "" : "px"})`
3487
+ );
3481
3488
  return /* @__PURE__ */ React13__default.createElement(React13__default.Fragment, null, /* @__PURE__ */ React13__default.createElement(
3482
3489
  Drawer,
3483
3490
  {
@@ -4018,7 +4025,9 @@ function ExplorerTabs({ panels, onChange, value }) {
4018
4025
  const { translate: t } = useTranslation();
4019
4026
  const [menuOpened, setMenuOpened] = useState(false);
4020
4027
  const theme = useMantineTheme();
4021
- const isMobile = useMediaQuery(`(max-width: ${theme.breakpoints.xs})`);
4028
+ const isMobile = useMediaQuery(
4029
+ `(max-width: ${theme.breakpoints.xs}${/(?:px|em|rem|vh|vw|%)$/.test(theme.breakpoints.xs) ? "" : "px"})`
4030
+ );
4022
4031
  const visiblePanels = isMobile ? panels.slice(0, 2) : panels;
4023
4032
  const menuPanels = isMobile ? panels.slice(2) : [];
4024
4033
  const handleMenuItemClick = (panelKey) => {
@@ -4546,7 +4555,16 @@ function useCubeSearch(graph, input, locale) {
4546
4555
  var [useSideBar, Provider] = createContext4("SideBar");
4547
4556
  function SideBarProvider(props) {
4548
4557
  const [input, setInput] = useDebouncedState("", 150, { leading: true });
4549
- const [expanded, setExpanded] = useState(true);
4558
+ const theme = useMantineTheme();
4559
+ const isSmallScreen = useMediaQuery(
4560
+ `(max-width: ${theme.breakpoints.md}${/(?:px|em|rem|vh|vw|%)$/.test(theme.breakpoints.md) ? "" : "px"})`,
4561
+ true
4562
+ // Default to 'true' when undefined (assuming small screen to be safe)
4563
+ );
4564
+ const [expanded, setExpanded] = useState(false);
4565
+ useEffect(() => {
4566
+ setExpanded(!isSmallScreen);
4567
+ }, [isSmallScreen]);
4550
4568
  const graph = useBuildGraph(props.locale);
4551
4569
  const { results, map } = useCubeSearch(graph, input, props.locale);
4552
4570
  return /* @__PURE__ */ React13__default.createElement(
@@ -4587,7 +4605,9 @@ function SideBar(props) {
4587
4605
  const { expanded, input, setExpanded, setInput } = useSideBar();
4588
4606
  const { translate: t } = useTranslation();
4589
4607
  const theme = useMantineTheme();
4590
- const smallerThanMd = useMediaQuery(`(max-width: ${theme.breakpoints.md})`);
4608
+ const smallerThanMd = useMediaQuery(
4609
+ `(max-width: ${theme.breakpoints.md}${/(?:px|em|rem|vh|vw|%)$/.test(theme.breakpoints.xs) ? "" : "px"})`
4610
+ );
4591
4611
  return /* @__PURE__ */ React13__default.createElement(React13__default.Fragment, null, /* @__PURE__ */ React13__default.createElement(
4592
4612
  Box,
4593
4613
  {
@@ -4611,6 +4631,10 @@ function SideBar(props) {
4611
4631
  paddingTop: expanded ? t2.spacing.md : 0,
4612
4632
  paddingBottom: expanded ? t2.spacing.md : 0,
4613
4633
  borderRadius: expanded ? 0 : "100%"
4634
+ },
4635
+ [t2.fn.smallerThan("sm")]: {
4636
+ width: expanded ? "100vw" : 0,
4637
+ maxWidth: expanded ? "100vw" : 0
4614
4638
  }
4615
4639
  })
4616
4640
  },
@@ -4620,12 +4644,16 @@ function SideBar(props) {
4620
4644
  position: "apart",
4621
4645
  align: "center",
4622
4646
  noWrap: true,
4623
- sx: {
4647
+ sx: (t2) => ({
4624
4648
  overflow: "hidden",
4625
4649
  whiteSpace: "nowrap",
4626
4650
  transition: "width 0.2s cubic-bezier(0.4, 0, 0.2, 1), margin-left 0.2s cubic-bezier(0.4, 0, 0.2, 1)",
4627
- width: expanded ? 300 : 0
4628
- }
4651
+ width: expanded ? 300 : 0,
4652
+ [t2.fn.smallerThan("sm")]: {
4653
+ width: expanded ? "100vw" : 0,
4654
+ maxWidth: expanded ? "100vw" : 0
4655
+ }
4656
+ })
4629
4657
  },
4630
4658
  /* @__PURE__ */ React13__default.createElement(Text, { sx: (t2) => ({ color: t2.colorScheme === "dark" ? t2.white : t2.black }), ml: "sm" }, t("params.label_dataset")),
4631
4659
  /* @__PURE__ */ React13__default.createElement(
@@ -4671,12 +4699,16 @@ function SideBarItem(props) {
4671
4699
  return /* @__PURE__ */ React13__default.createElement(
4672
4700
  Box,
4673
4701
  {
4674
- sx: {
4702
+ sx: (t) => ({
4675
4703
  overflow: "hidden",
4676
4704
  whiteSpace: "nowrap",
4677
4705
  width: expanded ? 300 : 0,
4678
- transition: "width 0.2s cubic-bezier(0.4, 0, 0.2, 1)"
4679
- }
4706
+ transition: "width 0.2s cubic-bezier(0.4, 0, 0.2, 1)",
4707
+ [t.fn.smallerThan("sm")]: {
4708
+ width: expanded ? "100vw" : 0,
4709
+ maxWidth: expanded ? "100vw" : 0
4710
+ }
4711
+ })
4680
4712
  },
4681
4713
  props.children
4682
4714
  );
@@ -4724,22 +4756,10 @@ function CubeSearchInput(props) {
4724
4756
  }
4725
4757
 
4726
4758
  // src/components/ExplorerResults.tsx
4727
- function SideBarControlBtn2({ actionIconProps = {} }) {
4759
+ function SideBarControlBtn2() {
4728
4760
  const { expanded, setExpanded } = useSideBar();
4729
- const sx = (t) => ({
4730
- alignSelf: "center",
4731
- color: t.colorScheme === "dark" ? t.white : t.colors.gray[7]
4732
- });
4733
- return /* @__PURE__ */ React13__default.createElement(Group, { spacing: "xs", display: { base: "flex", md: "none" }, align: "center" }, /* @__PURE__ */ React13__default.createElement(
4734
- ActionIcon,
4735
- {
4736
- onClick: () => setExpanded(!expanded),
4737
- variant: "subtle",
4738
- ...actionIconProps,
4739
- sx: [sx, ...packSx(actionIconProps.sx)]
4740
- },
4741
- /* @__PURE__ */ React13__default.createElement(DataSetSVG, null)
4742
- ), /* @__PURE__ */ React13__default.createElement(Text, { size: "sm" }, "Select Dataset"));
4761
+ const { translate: t } = useTranslation();
4762
+ return /* @__PURE__ */ React13__default.createElement(UnstyledButton, { display: { base: "block", md: "none" }, onClick: () => setExpanded(!expanded) }, /* @__PURE__ */ React13__default.createElement(Group, { align: "center", spacing: "xs", noWrap: true }, /* @__PURE__ */ React13__default.createElement(ThemeIcon, { variant: "subtle" }, /* @__PURE__ */ React13__default.createElement(DataSetSVG, null)), /* @__PURE__ */ React13__default.createElement(Text, { size: "sm" }, t("params.label_dataset"))));
4743
4763
  }
4744
4764
  var useStyles2 = createStyles(() => ({
4745
4765
  container: {
@@ -5196,7 +5216,7 @@ function SubtopicAccordion({
5196
5216
  onChange: setValue,
5197
5217
  key: `subtopic-${parent}`,
5198
5218
  chevronPosition: "left",
5199
- w: 300,
5219
+ w: { base: "100vw", sm: 300 },
5200
5220
  ml: 0,
5201
5221
  styles: (t) => ({
5202
5222
  control: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@datawheel/data-explorer",
3
- "version": "1.1.11",
3
+ "version": "1.1.13",
4
4
  "main": "./dist/main.mjs",
5
5
  "types": "./dist/main.d.mts",
6
6
  "files": [