@atom-learning/components 10.0.0 → 10.1.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/dist/components/accordion/Accordion.js +1 -1
- package/dist/components/accordion/AccordionContent.js +1 -1
- package/dist/components/accordion/AccordionItem.js +1 -1
- package/dist/components/accordion/AccordionTrigger.js +2 -2
- package/dist/components/action-icon/ActionIcon.js +2 -2
- package/dist/components/action-icon/ActionIcon.js.map +1 -1
- package/dist/components/alert-dialog/Alert.d.ts +3 -0
- package/dist/components/alert-dialog/Alert.js +7 -0
- package/dist/components/alert-dialog/Alert.js.map +1 -0
- package/dist/components/alert-dialog/alert-context/AlertDialog.js +1 -1
- package/dist/components/badge/BadgeText.js +1 -1
- package/dist/components/badge/BadgeText.js.map +1 -1
- package/dist/components/banner/BannerContainer.js.map +1 -1
- package/dist/components/banner/banner-regular/BannerRegularActions.js +1 -1
- package/dist/components/banner/banner-regular/BannerRegularActions.js.map +1 -1
- package/dist/components/calendar/Calendar.js +4 -4
- package/dist/components/calendar/Calendar.js.map +1 -1
- package/dist/components/carousel/Carousel.js.map +1 -1
- package/dist/components/checkbox-group/CheckboxGroup.d.ts +1 -1
- package/dist/components/checkbox-group/CheckboxGroupAllItem.js +3 -2
- package/dist/components/checkbox-group/CheckboxGroupAllItem.js.map +1 -1
- package/dist/components/checkbox-group/CheckboxGroupChecked.context.js +1 -1
- package/dist/components/checkbox-group/CheckboxGroupChecked.context.js.map +1 -1
- package/dist/components/checkbox-group/CheckboxGroupMounted.context.js +1 -1
- package/dist/components/checkbox-group/CheckboxGroupMounted.context.js.map +1 -1
- package/dist/components/chip/Chip.js +2 -2
- package/dist/components/chip/Chip.js.map +1 -1
- package/dist/components/create-password-field/CreatePasswordField.js +5 -5
- package/dist/components/create-password-field/CreatePasswordField.js.map +1 -1
- package/dist/components/data-table/DataTableBulkActionsFloating.js +1 -1
- package/dist/components/data-table/DataTableHeaderCell.js +9 -9
- package/dist/components/data-table/DataTableHeaderCell.js.map +1 -1
- package/dist/components/data-table/DataTableSelectAllRowsCheckbox.js.map +1 -1
- package/dist/components/data-table/getNewAsyncData.js +1 -1
- package/dist/components/data-table/getNewAsyncData.js.map +1 -1
- package/dist/components/date-input/DateInput.js.map +1 -1
- package/dist/components/file-drop/FileDrop.js +2 -2
- package/dist/components/file-drop/FileDrop.js.map +1 -1
- package/dist/components/file-input/FileInput.js +1 -1
- package/dist/components/form/useFieldError.js +2 -1
- package/dist/components/form/useFieldError.js.map +1 -1
- package/dist/components/index.d.ts +1 -3
- package/dist/components/inline-message/InlineMessage.js +1 -1
- package/dist/components/markdown-content/MarkdownContent.js +5 -5
- package/dist/components/markdown-content/MarkdownContent.js.map +1 -1
- package/dist/components/markdown-content/components/MarkdownEmphasis.d.ts +2 -2
- package/dist/components/markdown-content/components/MarkdownEmphasis.js.map +1 -1
- package/dist/components/markdown-content/components/MarkdownHeading.d.ts +2 -2
- package/dist/components/markdown-content/components/MarkdownHeading.js.map +1 -1
- package/dist/components/markdown-content/components/MarkdownLink.d.ts +2 -2
- package/dist/components/markdown-content/components/MarkdownLink.js.map +1 -1
- package/dist/components/markdown-content/components/MarkdownList.d.ts +2 -2
- package/dist/components/markdown-content/components/MarkdownList.js.map +1 -1
- package/dist/components/markdown-content/components/MarkdownListItem.d.ts +2 -2
- package/dist/components/markdown-content/components/MarkdownListItem.js.map +1 -1
- package/dist/components/markdown-content/components/MarkdownParagraph.d.ts +2 -2
- package/dist/components/markdown-content/components/MarkdownParagraph.js.map +1 -1
- package/dist/components/markdown-content/components/MarkdownStrong.d.ts +2 -2
- package/dist/components/markdown-content/components/MarkdownStrong.js.map +1 -1
- package/dist/components/navigation/NavigationMenu.js +1 -1
- package/dist/components/navigation/NavigationMenu.js.map +1 -1
- package/dist/components/pagination/PaginationItems.js +2 -2
- package/dist/components/pagination/PaginationItems.js.map +1 -1
- package/dist/components/pagination/pagination.helper.js +5 -3
- package/dist/components/pagination/pagination.helper.js.map +1 -1
- package/dist/components/select-menu/SelectMenu.d.ts +16 -9
- package/dist/components/select-menu/SelectMenu.js +6 -4
- package/dist/components/select-menu/SelectMenu.js.map +1 -1
- package/dist/components/select-menu/SelectMenuContent.d.ts +5 -3
- package/dist/components/select-menu/SelectMenuContent.js +24 -65
- package/dist/components/select-menu/SelectMenuContent.js.map +1 -1
- package/dist/components/select-menu/SelectMenuItem.d.ts +5 -3
- package/dist/components/select-menu/SelectMenuItem.js +15 -15
- package/dist/components/select-menu/SelectMenuItem.js.map +1 -1
- package/dist/components/select-menu/SelectMenuLabel.d.ts +2 -2
- package/dist/components/select-menu/SelectMenuLabel.js +2 -2
- package/dist/components/select-menu/SelectMenuLabel.js.map +1 -1
- package/dist/components/select-menu/SelectMenuSeparator.d.ts +2 -2
- package/dist/components/select-menu/SelectMenuSeparator.js +2 -2
- package/dist/components/select-menu/SelectMenuSeparator.js.map +1 -1
- package/dist/components/select-menu/SelectMenuTrigger.d.ts +3 -2
- package/dist/components/select-menu/SelectMenuTrigger.js +12 -12
- package/dist/components/select-menu/SelectMenuTrigger.js.map +1 -1
- package/dist/components/select-menu-field/SelectMenuField.js +5 -5
- package/dist/components/select-menu-field/SelectMenuField.js.map +1 -1
- package/dist/components/slider/Slider.js.map +1 -1
- package/dist/components/slider-field/SliderField.js +2 -1
- package/dist/components/slider-field/SliderField.js.map +1 -1
- package/dist/components/stepper/Stepper.js +1 -1
- package/dist/components/stepper/Stepper.js.map +1 -1
- package/dist/components/stepper/StepperSteps.js +7 -5
- package/dist/components/stepper/StepperSteps.js.map +1 -1
- package/dist/components/table/useStickyColumnsCss.js +1 -1
- package/dist/components/table/useStickyColumnsCss.js.map +1 -1
- package/dist/components/tabs/TabsTriggerList.js +1 -1
- package/dist/docgen.json +1 -1
- package/dist/index.cjs.js +872 -903
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.js +7 -7
- package/dist/styled.js +15 -11
- package/dist/styled.js.map +1 -1
- package/dist/utilities/hooks/useResizeObserver.js +1 -3
- package/dist/utilities/hooks/useResizeObserver.js.map +1 -1
- package/dist/utilities/uri/index.js +2 -1
- package/dist/utilities/uri/index.js.map +1 -1
- package/package.json +25 -11
- package/dist/components/index.js +0 -102
- package/dist/components/index.js.map +0 -1
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { cn } from "../../styled.js";
|
|
1
2
|
import { SelectMenuContext } from "./SelectMenu.context.js";
|
|
2
3
|
import { SelectMenuContent } from "./SelectMenuContent.js";
|
|
3
4
|
import { SelectMenuItem } from "./SelectMenuItem.js";
|
|
@@ -6,9 +7,9 @@ import { SelectMenuSeparator } from "./SelectMenuSeparator.js";
|
|
|
6
7
|
import { SelectMenuTrigger } from "./SelectMenuTrigger.js";
|
|
7
8
|
import * as React$1 from "react";
|
|
8
9
|
import { jsx } from "react/jsx-runtime";
|
|
9
|
-
import * as
|
|
10
|
+
import * as AriaComponents from "react-aria-components";
|
|
10
11
|
//#region src/components/select-menu/SelectMenu.tsx
|
|
11
|
-
var SelectMenuRoot = ({ size = "md", theme = "grey", state, children, ...rest }) => {
|
|
12
|
+
var SelectMenuRoot = ({ size = "md", theme = "grey", state, className, children, ...rest }) => {
|
|
12
13
|
return /* @__PURE__ */ jsx(SelectMenuContext, {
|
|
13
14
|
value: React$1.useMemo(() => ({
|
|
14
15
|
size,
|
|
@@ -19,7 +20,8 @@ var SelectMenuRoot = ({ size = "md", theme = "grey", state, children, ...rest })
|
|
|
19
20
|
theme,
|
|
20
21
|
state
|
|
21
22
|
]),
|
|
22
|
-
children: /* @__PURE__ */ jsx(
|
|
23
|
+
children: /* @__PURE__ */ jsx(AriaComponents.Select, {
|
|
24
|
+
className: cn("w-full", className),
|
|
23
25
|
...rest,
|
|
24
26
|
children
|
|
25
27
|
})
|
|
@@ -29,7 +31,7 @@ var SelectMenu = /* @__PURE__ */ Object.assign(SelectMenuRoot, {
|
|
|
29
31
|
Trigger: SelectMenuTrigger,
|
|
30
32
|
Content: SelectMenuContent,
|
|
31
33
|
Item: SelectMenuItem,
|
|
32
|
-
Group:
|
|
34
|
+
Group: AriaComponents.ListBoxSection,
|
|
33
35
|
Label: SelectMenuLabel,
|
|
34
36
|
Separator: SelectMenuSeparator
|
|
35
37
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectMenu.js","names":[],"sources":["../../../src/components/select-menu/SelectMenu.tsx"],"sourcesContent":["import * as
|
|
1
|
+
{"version":3,"file":"SelectMenu.js","names":[],"sources":["../../../src/components/select-menu/SelectMenu.tsx"],"sourcesContent":["import * as React from 'react'\nimport * as AriaComponents from 'react-aria-components'\n\nimport { cn } from '../../styled'\nimport { SelectMenuContext } from './SelectMenu.context'\nimport { SelectMenuContent } from './SelectMenuContent'\nimport { SelectMenuItem } from './SelectMenuItem'\nimport { SelectMenuLabel } from './SelectMenuLabel'\nimport { SelectMenuSeparator } from './SelectMenuSeparator'\nimport { SelectMenuTrigger } from './SelectMenuTrigger'\n\ntype SelectMenuProps = Omit<\n AriaComponents.SelectProps<object>,\n 'className' | 'style' | 'children'\n> & {\n size?: 'sm' | 'md' | 'lg'\n theme?: 'white' | 'grey'\n state?: 'error'\n className?: string\n children?: React.ReactNode\n}\n\nconst SelectMenuRoot = ({\n size = 'md',\n theme = 'grey',\n state,\n className,\n children,\n ...rest\n}: SelectMenuProps) => {\n const value = React.useMemo(\n () => ({ size, theme, state }),\n [size, theme, state]\n )\n return (\n <SelectMenuContext value={value}>\n {/* w-full so the trigger fills its container even in flex/inline layouts\n (react-aria wraps the trigger in an extra div). Consumers can override\n the width — or anything else — via className, e.g. w-auto / w-64. */}\n <AriaComponents.Select className={cn('w-full', className)} {...rest}>\n {children}\n </AriaComponents.Select>\n </SelectMenuContext>\n )\n}\n\nexport const SelectMenu = /* @__PURE__ */ Object.assign(SelectMenuRoot, {\n Trigger: SelectMenuTrigger,\n Content: SelectMenuContent,\n Item: SelectMenuItem,\n Group: AriaComponents.ListBoxSection,\n Label: SelectMenuLabel,\n Separator: SelectMenuSeparator\n})\n"],"mappings":";;;;;;;;;;;AAsBA,IAAM,kBAAkB,EACtB,OAAO,MACP,QAAQ,QACR,OACA,WACA,UACA,GAAG,WACkB;CAKrB,OACE,oBAAC,mBAAD;EAA0B,OALd,QAAM,eACX;GAAE;GAAM;GAAO;EAAM,IAC5B;GAAC;GAAM;GAAO;EAAK,CAGO;YAIxB,oBAAC,eAAe,QAAhB;GAAuB,WAAW,GAAG,UAAU,SAAS;GAAG,GAAI;GAC5D;EACoB,CAAA;CACN,CAAA;AAEvB;AAEA,IAAa,aAA6B,uBAAO,OAAO,gBAAgB;CACtE,SAAS;CACT,SAAS;CACT,MAAM;CACN,OAAO,eAAe;CACtB,OAAO;CACP,WAAW;AACb,CAAC"}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import * as RadixSelect from '@radix-ui/react-select';
|
|
2
1
|
import * as React from 'react';
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
import * as AriaComponents from 'react-aria-components';
|
|
3
|
+
type SelectMenuContentProps = Omit<React.ComponentPropsWithRef<typeof AriaComponents.Popover>, 'children'> & {
|
|
4
|
+
children?: React.ReactNode;
|
|
5
|
+
};
|
|
6
|
+
export declare const SelectMenuContent: ({ ref, children, offset, ...rest }: SelectMenuContentProps) => React.JSX.Element;
|
|
5
7
|
export {};
|
|
@@ -1,73 +1,32 @@
|
|
|
1
1
|
import { styled } from "../../styled.js";
|
|
2
|
-
import { Icon } from "../icon/Icon.js";
|
|
3
2
|
import "react";
|
|
4
|
-
import { jsx
|
|
5
|
-
import
|
|
6
|
-
import * as RadixSelect from "@radix-ui/react-select";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
import * as AriaComponents from "react-aria-components";
|
|
7
5
|
//#region src/components/select-menu/SelectMenuContent.tsx
|
|
8
|
-
var Content = styled(
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
popper: ["max-h-(--radix-select-content-available-height)", "min-w-(--radix-select-trigger-width)"],
|
|
27
|
-
"item-aligned": []
|
|
28
|
-
} }
|
|
29
|
-
});
|
|
30
|
-
var Viewport = styled(RadixSelect.Viewport, {
|
|
31
|
-
base: ["p-1", "w-full"],
|
|
32
|
-
variants: { position: {
|
|
33
|
-
popper: ["h-(--radix-select-content-available-height)"],
|
|
34
|
-
"item-aligned": []
|
|
35
|
-
} }
|
|
36
|
-
});
|
|
37
|
-
var ScrollUpButton = styled(RadixSelect.ScrollUpButton, { base: [
|
|
38
|
-
"flex",
|
|
39
|
-
"items-center",
|
|
40
|
-
"justify-center",
|
|
41
|
-
"h-6",
|
|
42
|
-
"cursor-default"
|
|
43
|
-
] });
|
|
44
|
-
var ScrollDownButton = styled(RadixSelect.ScrollDownButton, { base: [
|
|
45
|
-
"flex",
|
|
46
|
-
"items-center",
|
|
47
|
-
"justify-center",
|
|
48
|
-
"h-6",
|
|
49
|
-
"cursor-default"
|
|
50
|
-
] });
|
|
51
|
-
var SelectMenuContent = ({ ref, children, position = "popper", sideOffset = 4, ...rest }) => /* @__PURE__ */ jsx(RadixSelect.Portal, { children: /* @__PURE__ */ jsxs(Content, {
|
|
6
|
+
var Content = styled(AriaComponents.Popover, { base: [
|
|
7
|
+
"bg-white",
|
|
8
|
+
"rounded-md",
|
|
9
|
+
"shadow-lg",
|
|
10
|
+
"z-10",
|
|
11
|
+
"overflow-hidden",
|
|
12
|
+
"will-change-transform",
|
|
13
|
+
"min-w-[var(--trigger-width)]",
|
|
14
|
+
"max-w-[min(calc(100vw-(--spacing(4))),--spacing(100))]"
|
|
15
|
+
] }, { enablePolymorphism: false });
|
|
16
|
+
var Viewport = styled(AriaComponents.ListBox, { base: [
|
|
17
|
+
"max-h-[inherit]",
|
|
18
|
+
"w-full",
|
|
19
|
+
"overflow-auto",
|
|
20
|
+
"p-1",
|
|
21
|
+
"outline-none"
|
|
22
|
+
] }, { enablePolymorphism: false });
|
|
23
|
+
var SelectMenuContent = ({ ref, children, offset = 4, ...rest }) => /* @__PURE__ */ jsx(Content, {
|
|
52
24
|
ref,
|
|
53
|
-
|
|
54
|
-
|
|
25
|
+
offset,
|
|
26
|
+
containerPadding: 8,
|
|
55
27
|
...rest,
|
|
56
|
-
children:
|
|
57
|
-
|
|
58
|
-
is: ChevronUp,
|
|
59
|
-
className: "text-grey-700 size-4"
|
|
60
|
-
}) }),
|
|
61
|
-
/* @__PURE__ */ jsx(Viewport, {
|
|
62
|
-
position,
|
|
63
|
-
children
|
|
64
|
-
}),
|
|
65
|
-
/* @__PURE__ */ jsx(ScrollDownButton, { children: /* @__PURE__ */ jsx(Icon, {
|
|
66
|
-
is: ChevronDown,
|
|
67
|
-
className: "text-grey-700 size-4"
|
|
68
|
-
}) })
|
|
69
|
-
]
|
|
70
|
-
}) });
|
|
28
|
+
children: /* @__PURE__ */ jsx(Viewport, { children })
|
|
29
|
+
});
|
|
71
30
|
//#endregion
|
|
72
31
|
export { SelectMenuContent };
|
|
73
32
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectMenuContent.js","names":[],"sources":["../../../src/components/select-menu/SelectMenuContent.tsx"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"SelectMenuContent.js","names":[],"sources":["../../../src/components/select-menu/SelectMenuContent.tsx"],"sourcesContent":["import * as React from 'react'\nimport * as AriaComponents from 'react-aria-components'\n\nimport { styled } from '../../styled'\n\nconst Content = styled(\n AriaComponents.Popover,\n {\n base: [\n 'bg-white',\n 'rounded-md',\n 'shadow-lg',\n 'z-10',\n 'overflow-hidden',\n 'will-change-transform',\n // Floors at the trigger width; caps at min(viewport − 8px per edge, 400px)\n // on the --spacing() scale: --spacing(4)=16px (2×8px), --spacing(100)=400px.\n 'min-w-[var(--trigger-width)]',\n 'max-w-[min(calc(100vw-(--spacing(4))),--spacing(100))]'\n ]\n },\n { enablePolymorphism: false }\n)\n\nconst Viewport = styled(\n AriaComponents.ListBox,\n {\n base: ['max-h-[inherit]', 'w-full', 'overflow-auto', 'p-1', 'outline-none']\n },\n { enablePolymorphism: false }\n)\n\ntype SelectMenuContentProps = Omit<\n React.ComponentPropsWithRef<typeof AriaComponents.Popover>,\n 'children'\n> & {\n children?: React.ReactNode\n}\n\nexport const SelectMenuContent = ({\n ref,\n children,\n offset = 4,\n ...rest\n}: SelectMenuContentProps) => (\n // offset/containerPadding are react-aria positioner props in px (JS numbers,\n // not CSS), so they can't use the --spacing() scale: 4px gap from the trigger,\n // 8px minimum inset from every viewport edge (the 2×8px behind the max-width).\n <Content ref={ref} offset={offset} containerPadding={8} {...rest}>\n <Viewport>{children}</Viewport>\n </Content>\n)\n"],"mappings":";;;;;AAKA,IAAM,UAAU,OACd,eAAe,SACf,EACE,MAAM;CACJ;CACA;CACA;CACA;CACA;CACA;CAGA;CACA;AACF,EACF,GACA,EAAE,oBAAoB,MAAM,CAC9B;AAEA,IAAM,WAAW,OACf,eAAe,SACf,EACE,MAAM;CAAC;CAAmB;CAAU;CAAiB;CAAO;AAAc,EAC5E,GACA,EAAE,oBAAoB,MAAM,CAC9B;AASA,IAAa,qBAAqB,EAChC,KACA,UACA,SAAS,GACT,GAAG,WAKH,oBAAC,SAAD;CAAc;CAAa;CAAQ,kBAAkB;CAAG,GAAI;WAC1D,oBAAC,UAAD,EAAW,SAAmB,CAAA;AACvB,CAAA"}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import * as RadixSelect from '@radix-ui/react-select';
|
|
2
1
|
import * as React from 'react';
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
import * as AriaComponents from 'react-aria-components';
|
|
3
|
+
type SelectMenuItemProps = Omit<AriaComponents.ListBoxItemProps, 'children'> & {
|
|
4
|
+
children?: React.ReactNode;
|
|
5
|
+
};
|
|
6
|
+
export declare const SelectMenuItem: ({ children, textValue, ...rest }: SelectMenuItemProps) => React.JSX.Element;
|
|
5
7
|
export {};
|
|
@@ -2,11 +2,11 @@ import { styled } from "../../styled.js";
|
|
|
2
2
|
import { Icon } from "../icon/Icon.js";
|
|
3
3
|
import { useSelectMenuContext } from "./SelectMenu.context.js";
|
|
4
4
|
import "react";
|
|
5
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
6
6
|
import { Ok } from "@atom-learning/icons";
|
|
7
|
-
import * as
|
|
7
|
+
import * as AriaComponents from "react-aria-components";
|
|
8
8
|
//#region src/components/select-menu/SelectMenuItem.tsx
|
|
9
|
-
var Item = styled(
|
|
9
|
+
var Item = styled(AriaComponents.ListBoxItem, {
|
|
10
10
|
base: [
|
|
11
11
|
"relative",
|
|
12
12
|
"flex",
|
|
@@ -17,11 +17,11 @@ var Item = styled(RadixSelect.Item, {
|
|
|
17
17
|
"cursor-pointer",
|
|
18
18
|
"rounded-sm",
|
|
19
19
|
"outline-none",
|
|
20
|
-
"data-disabled:cursor-not-allowed",
|
|
21
|
-
"data-disabled:opacity-30",
|
|
22
|
-
"data-
|
|
23
|
-
"data-
|
|
24
|
-
"data-
|
|
20
|
+
"data-[disabled]:cursor-not-allowed",
|
|
21
|
+
"data-[disabled]:opacity-30",
|
|
22
|
+
"data-[hovered]:bg-grey-100",
|
|
23
|
+
"data-[focused]:bg-grey-100",
|
|
24
|
+
"data-[focus-visible]:outline-none"
|
|
25
25
|
],
|
|
26
26
|
variants: { size: {
|
|
27
27
|
sm: [
|
|
@@ -41,20 +41,20 @@ var Item = styled(RadixSelect.Item, {
|
|
|
41
41
|
"pr-6"
|
|
42
42
|
]
|
|
43
43
|
} }
|
|
44
|
-
});
|
|
45
|
-
var SelectMenuItem = ({
|
|
44
|
+
}, { enablePolymorphism: false });
|
|
45
|
+
var SelectMenuItem = ({ children, textValue, ...rest }) => {
|
|
46
46
|
const { size } = useSelectMenuContext();
|
|
47
|
-
return /* @__PURE__ */
|
|
48
|
-
ref,
|
|
47
|
+
return /* @__PURE__ */ jsx(Item, {
|
|
49
48
|
size,
|
|
49
|
+
textValue: textValue ?? (typeof children === "string" ? children : void 0),
|
|
50
50
|
...rest,
|
|
51
|
-
children: [/* @__PURE__ */ jsx(
|
|
51
|
+
children: ({ isSelected }) => /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("span", {
|
|
52
52
|
className: "absolute left-2 inline-flex items-center",
|
|
53
|
-
children: /* @__PURE__ */ jsx(Icon, {
|
|
53
|
+
children: isSelected && /* @__PURE__ */ jsx(Icon, {
|
|
54
54
|
is: Ok,
|
|
55
55
|
className: size === "sm" ? "size-3" : "size-4"
|
|
56
56
|
})
|
|
57
|
-
}),
|
|
57
|
+
}), children] })
|
|
58
58
|
});
|
|
59
59
|
};
|
|
60
60
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectMenuItem.js","names":[],"sources":["../../../src/components/select-menu/SelectMenuItem.tsx"],"sourcesContent":["import { Ok } from '@atom-learning/icons'\nimport * as
|
|
1
|
+
{"version":3,"file":"SelectMenuItem.js","names":[],"sources":["../../../src/components/select-menu/SelectMenuItem.tsx"],"sourcesContent":["import { Ok } from '@atom-learning/icons'\nimport * as React from 'react'\nimport * as AriaComponents from 'react-aria-components'\n\nimport { styled } from '../../styled'\nimport { Icon } from '../icon/Icon'\nimport { useSelectMenuContext } from './SelectMenu.context'\n\nconst Item = styled(\n AriaComponents.ListBoxItem,\n {\n base: [\n 'relative',\n 'flex',\n 'items-center',\n 'text-grey-1000',\n 'font-body',\n 'font-normal',\n 'cursor-pointer',\n 'rounded-sm',\n 'outline-none',\n 'data-[disabled]:cursor-not-allowed',\n 'data-[disabled]:opacity-30',\n // react-aria's data-hovered (pointer only, ignores touch) — not `hover:`,\n // whose :hover sticks after a tap on touchscreens (this menu targets\n // webviews). data-focused covers keyboard navigation; together they\n // replicate the old Radix data-highlighted.\n 'data-[hovered]:bg-grey-100',\n 'data-[focused]:bg-grey-100',\n 'data-[focus-visible]:outline-none'\n ],\n variants: {\n size: {\n sm: ['py-1.5', 'pl-7', 'pr-4', 'text-sm'],\n md: ['py-2', 'pl-8', 'pr-6'],\n lg: ['py-2', 'pl-8', 'pr-6']\n }\n }\n },\n { enablePolymorphism: false }\n)\n\ntype SelectMenuItemProps = Omit<AriaComponents.ListBoxItemProps, 'children'> & {\n children?: React.ReactNode\n}\n\nexport const SelectMenuItem = ({\n children,\n textValue,\n ...rest\n}: SelectMenuItemProps) => {\n const { size } = useSelectMenuContext()\n const resolvedTextValue =\n textValue ?? (typeof children === 'string' ? children : undefined)\n\n return (\n <Item size={size} textValue={resolvedTextValue} {...rest}>\n {({ isSelected }) => (\n <>\n <span className=\"absolute left-2 inline-flex items-center\">\n {isSelected && (\n <Icon is={Ok} className={size === 'sm' ? 'size-3' : 'size-4'} />\n )}\n </span>\n {children}\n </>\n )}\n </Item>\n )\n}\n"],"mappings":";;;;;;;;AAQA,IAAM,OAAO,OACX,eAAe,aACf;CACE,MAAM;EACJ;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EAKA;EACA;EACA;CACF;CACA,UAAU,EACR,MAAM;EACJ,IAAI;GAAC;GAAU;GAAQ;GAAQ;EAAS;EACxC,IAAI;GAAC;GAAQ;GAAQ;EAAM;EAC3B,IAAI;GAAC;GAAQ;GAAQ;EAAM;CAC7B,EACF;AACF,GACA,EAAE,oBAAoB,MAAM,CAC9B;AAMA,IAAa,kBAAkB,EAC7B,UACA,WACA,GAAG,WACsB;CACzB,MAAM,EAAE,SAAS,qBAAqB;CAItC,OACE,oBAAC,MAAD;EAAY;EAAM,WAHlB,cAAc,OAAO,aAAa,WAAW,WAAW,KAAA;EAGR,GAAI;aAChD,EAAE,iBACF,qBAAA,UAAA,EAAA,UAAA,CACE,oBAAC,QAAD;GAAM,WAAU;aACb,cACC,oBAAC,MAAD;IAAM,IAAI;IAAI,WAAW,SAAS,OAAO,WAAW;GAAW,CAAA;EAE7D,CAAA,GACL,QACD,EAAA,CAAA;CAEA,CAAA;AAEV"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import * as RadixSelect from '@radix-ui/react-select';
|
|
2
1
|
import * as React from 'react';
|
|
3
|
-
|
|
2
|
+
import * as AriaComponents from 'react-aria-components';
|
|
3
|
+
type SelectMenuLabelProps = React.ComponentProps<typeof AriaComponents.Header>;
|
|
4
4
|
export declare function SelectMenuLabel({ className, ...rest }: SelectMenuLabelProps): React.JSX.Element;
|
|
5
5
|
export declare namespace SelectMenuLabel {
|
|
6
6
|
var displayName: string;
|
|
@@ -2,10 +2,10 @@ import { cn } from "../../styled.js";
|
|
|
2
2
|
import { Text } from "../text/Text.js";
|
|
3
3
|
import "react";
|
|
4
4
|
import { jsx } from "react/jsx-runtime";
|
|
5
|
-
import * as
|
|
5
|
+
import * as AriaComponents from "react-aria-components";
|
|
6
6
|
//#region src/components/select-menu/SelectMenuLabel.tsx
|
|
7
7
|
var SelectMenuLabel = ({ className, ...rest }) => /* @__PURE__ */ jsx(Text, {
|
|
8
|
-
as:
|
|
8
|
+
as: AriaComponents.Header,
|
|
9
9
|
size: "sm",
|
|
10
10
|
className: cn("p-2", "mb-1", "text-text-subtle", className),
|
|
11
11
|
...rest
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectMenuLabel.js","names":[],"sources":["../../../src/components/select-menu/SelectMenuLabel.tsx"],"sourcesContent":["import * as
|
|
1
|
+
{"version":3,"file":"SelectMenuLabel.js","names":[],"sources":["../../../src/components/select-menu/SelectMenuLabel.tsx"],"sourcesContent":["import * as React from 'react'\nimport * as AriaComponents from 'react-aria-components'\n\nimport { cn } from '../../styled'\nimport { Text } from '../text/Text'\n\ntype SelectMenuLabelProps = React.ComponentProps<typeof AriaComponents.Header>\n\nexport const SelectMenuLabel = ({\n className,\n ...rest\n}: SelectMenuLabelProps) => (\n <Text\n as={AriaComponents.Header}\n size=\"sm\"\n className={cn('p-2', 'mb-1', 'text-text-subtle', className)}\n {...rest}\n />\n)\n\nSelectMenuLabel.displayName = 'SelectMenuLabel'\n"],"mappings":";;;;;;AAQA,IAAa,mBAAmB,EAC9B,WACA,GAAG,WAEH,oBAAC,MAAD;CACE,IAAI,eAAe;CACnB,MAAK;CACL,WAAW,GAAG,OAAO,QAAQ,oBAAoB,SAAS;CAC1D,GAAI;AACL,CAAA;AAGH,gBAAgB,cAAc"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
export declare const SelectMenuSeparator: import("../..").StyledComponent<
|
|
1
|
+
import * as AriaComponents from 'react-aria-components';
|
|
2
|
+
export declare const SelectMenuSeparator: import("../..").StyledComponent<(props: AriaComponents.SeparatorProps & React.RefAttributes<HTMLElement>) => React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | null, unknown>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { styled } from "../../styled.js";
|
|
2
|
-
import * as
|
|
2
|
+
import * as AriaComponents from "react-aria-components";
|
|
3
3
|
//#region src/components/select-menu/SelectMenuSeparator.tsx
|
|
4
|
-
var SelectMenuSeparator = styled(
|
|
4
|
+
var SelectMenuSeparator = styled(AriaComponents.Separator, { base: [
|
|
5
5
|
"h-px",
|
|
6
6
|
"bg-grey-200",
|
|
7
7
|
"my-2",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectMenuSeparator.js","names":[],"sources":["../../../src/components/select-menu/SelectMenuSeparator.tsx"],"sourcesContent":["import * as
|
|
1
|
+
{"version":3,"file":"SelectMenuSeparator.js","names":[],"sources":["../../../src/components/select-menu/SelectMenuSeparator.tsx"],"sourcesContent":["import * as AriaComponents from 'react-aria-components'\n\nimport { styled } from '../../styled'\n\nexport const SelectMenuSeparator = styled(\n AriaComponents.Separator,\n {\n base: ['h-px', 'bg-grey-200', 'my-2', 'mx-1']\n },\n { enablePolymorphism: false }\n)\n"],"mappings":";;;AAIA,IAAa,sBAAsB,OACjC,eAAe,WACf,EACE,MAAM;CAAC;CAAQ;CAAe;CAAQ;AAAM,EAC9C,GACA,EAAE,oBAAoB,MAAM,CAC9B"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import * as RadixSelect from '@radix-ui/react-select';
|
|
2
1
|
import * as React from 'react';
|
|
3
|
-
|
|
2
|
+
import * as AriaComponents from 'react-aria-components';
|
|
3
|
+
type SelectMenuTriggerProps = Omit<React.ComponentPropsWithRef<typeof AriaComponents.Button>, 'children' | 'aria-label' | 'aria-labelledby'> & {
|
|
4
4
|
placeholder?: string;
|
|
5
|
+
children?: React.ReactNode;
|
|
5
6
|
};
|
|
6
7
|
export declare const SelectMenuTrigger: ({ ref, placeholder, children, ...rest }: SelectMenuTriggerProps) => React.JSX.Element;
|
|
7
8
|
export {};
|
|
@@ -4,9 +4,9 @@ import { useSelectMenuContext } from "./SelectMenu.context.js";
|
|
|
4
4
|
import "react";
|
|
5
5
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
6
|
import { ChevronDown } from "@atom-learning/icons";
|
|
7
|
-
import * as
|
|
7
|
+
import * as AriaComponents from "react-aria-components";
|
|
8
8
|
//#region src/components/select-menu/SelectMenuTrigger.tsx
|
|
9
|
-
var Trigger = styled(
|
|
9
|
+
var Trigger = styled(AriaComponents.Button, {
|
|
10
10
|
base: [
|
|
11
11
|
"appearance-none",
|
|
12
12
|
"rounded-md",
|
|
@@ -24,11 +24,11 @@ var Trigger = styled(RadixSelect.Trigger, {
|
|
|
24
24
|
"hover:cursor-pointer",
|
|
25
25
|
"disabled:opacity-30",
|
|
26
26
|
"disabled:cursor-not-allowed",
|
|
27
|
-
"focus:outline-2",
|
|
28
|
-
"focus:outline-blue-800",
|
|
29
|
-
"focus:outline-offset-1",
|
|
30
|
-
"focus:outline-solid",
|
|
31
|
-
"focus:z-1"
|
|
27
|
+
"data-[focus-visible]:outline-2",
|
|
28
|
+
"data-[focus-visible]:outline-blue-800",
|
|
29
|
+
"data-[focus-visible]:outline-offset-1",
|
|
30
|
+
"data-[focus-visible]:outline-solid",
|
|
31
|
+
"data-[focus-visible]:z-1"
|
|
32
32
|
],
|
|
33
33
|
variants: {
|
|
34
34
|
size: {
|
|
@@ -55,9 +55,9 @@ var Trigger = styled(RadixSelect.Trigger, {
|
|
|
55
55
|
white: ["bg-white"],
|
|
56
56
|
grey: ["bg-grey-100"]
|
|
57
57
|
},
|
|
58
|
-
state: { error: ["bg-danger-light", "focus:outline-danger"] }
|
|
58
|
+
state: { error: ["bg-danger-light", "data-[focus-visible]:outline-danger"] }
|
|
59
59
|
}
|
|
60
|
-
});
|
|
60
|
+
}, { enablePolymorphism: false });
|
|
61
61
|
var TriggerIcon = styled(Icon, {
|
|
62
62
|
base: [
|
|
63
63
|
"absolute",
|
|
@@ -80,9 +80,9 @@ var SelectMenuTrigger = ({ ref, placeholder, children, ...rest }) => {
|
|
|
80
80
|
theme,
|
|
81
81
|
state,
|
|
82
82
|
...rest,
|
|
83
|
-
children: [/* @__PURE__ */ jsx(
|
|
84
|
-
|
|
85
|
-
children
|
|
83
|
+
children: [/* @__PURE__ */ jsx(AriaComponents.SelectValue, {
|
|
84
|
+
className: "truncate",
|
|
85
|
+
children: ({ isPlaceholder, selectedText }) => isPlaceholder ? placeholder ?? "" : children ?? selectedText
|
|
86
86
|
}), /* @__PURE__ */ jsx(TriggerIcon, {
|
|
87
87
|
is: ChevronDown,
|
|
88
88
|
size
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectMenuTrigger.js","names":[],"sources":["../../../src/components/select-menu/SelectMenuTrigger.tsx"],"sourcesContent":["import { ChevronDown } from '@atom-learning/icons'\nimport * as
|
|
1
|
+
{"version":3,"file":"SelectMenuTrigger.js","names":[],"sources":["../../../src/components/select-menu/SelectMenuTrigger.tsx"],"sourcesContent":["import { ChevronDown } from '@atom-learning/icons'\nimport * as React from 'react'\nimport * as AriaComponents from 'react-aria-components'\n\nimport { styled } from '../../styled'\nimport { Icon } from '../icon/Icon'\nimport { useSelectMenuContext } from './SelectMenu.context'\n\nconst Trigger = styled(\n AriaComponents.Button,\n {\n base: [\n 'appearance-none',\n 'rounded-md',\n 'block',\n 'w-full',\n 'font-body',\n 'font-normal',\n 'leading-[1.4]',\n 'text-grey-1000',\n 'text-left',\n 'relative',\n 'inline-flex',\n 'items-center',\n 'border-none',\n 'hover:cursor-pointer',\n 'disabled:opacity-30',\n 'disabled:cursor-not-allowed',\n 'data-[focus-visible]:outline-2',\n 'data-[focus-visible]:outline-blue-800',\n 'data-[focus-visible]:outline-offset-1',\n 'data-[focus-visible]:outline-solid',\n 'data-[focus-visible]:z-1'\n ],\n variants: {\n size: {\n sm: ['h-8', 'pl-2', 'pr-8', 'text-sm'],\n md: ['h-10', 'pl-3', 'pr-10', 'text-md'],\n lg: ['h-12', 'pl-3', 'pr-10', 'text-md']\n },\n theme: {\n white: ['bg-white'],\n grey: ['bg-grey-100']\n },\n state: {\n error: ['bg-danger-light', 'data-[focus-visible]:outline-danger']\n }\n }\n },\n { enablePolymorphism: false }\n)\n\nconst TriggerIcon = styled(Icon, {\n base: [\n 'absolute',\n 'top-1/2',\n '-translate-y-1/2',\n 'pointer-events-none',\n 'text-grey-700'\n ],\n variants: {\n size: {\n sm: ['right-2', 'size-4'],\n md: ['right-3', 'size-5'],\n lg: ['right-3', 'size-5']\n }\n }\n})\n\n// Label the SelectMenu via aria-label/aria-labelledby on the root <SelectMenu>,\n// not here — react-aria computes the trigger's accessible name from the root\n// Select's label props, so labels placed on the trigger are ignored.\ntype SelectMenuTriggerProps = Omit<\n React.ComponentPropsWithRef<typeof AriaComponents.Button>,\n 'children' | 'aria-label' | 'aria-labelledby'\n> & {\n placeholder?: string\n children?: React.ReactNode\n}\n\nexport const SelectMenuTrigger = ({\n ref,\n placeholder,\n children,\n ...rest\n}: SelectMenuTriggerProps) => {\n const { size, theme, state } = useSelectMenuContext()\n\n return (\n <Trigger ref={ref} size={size} theme={theme} state={state} {...rest}>\n <AriaComponents.SelectValue className=\"truncate\">\n {({ isPlaceholder, selectedText }) =>\n isPlaceholder ? (placeholder ?? '') : (children ?? selectedText)\n }\n </AriaComponents.SelectValue>\n <TriggerIcon is={ChevronDown} size={size} />\n </Trigger>\n )\n}\n"],"mappings":";;;;;;;;AAQA,IAAM,UAAU,OACd,eAAe,QACf;CACE,MAAM;EACJ;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF;CACA,UAAU;EACR,MAAM;GACJ,IAAI;IAAC;IAAO;IAAQ;IAAQ;GAAS;GACrC,IAAI;IAAC;IAAQ;IAAQ;IAAS;GAAS;GACvC,IAAI;IAAC;IAAQ;IAAQ;IAAS;GAAS;EACzC;EACA,OAAO;GACL,OAAO,CAAC,UAAU;GAClB,MAAM,CAAC,aAAa;EACtB;EACA,OAAO,EACL,OAAO,CAAC,mBAAmB,qCAAqC,EAClE;CACF;AACF,GACA,EAAE,oBAAoB,MAAM,CAC9B;AAEA,IAAM,cAAc,OAAO,MAAM;CAC/B,MAAM;EACJ;EACA;EACA;EACA;EACA;CACF;CACA,UAAU,EACR,MAAM;EACJ,IAAI,CAAC,WAAW,QAAQ;EACxB,IAAI,CAAC,WAAW,QAAQ;EACxB,IAAI,CAAC,WAAW,QAAQ;CAC1B,EACF;AACF,CAAC;AAaD,IAAa,qBAAqB,EAChC,KACA,aACA,UACA,GAAG,WACyB;CAC5B,MAAM,EAAE,MAAM,OAAO,UAAU,qBAAqB;CAEpD,OACE,qBAAC,SAAD;EAAc;EAAW;EAAa;EAAc;EAAO,GAAI;YAA/D,CACE,oBAAC,eAAe,aAAhB;GAA4B,WAAU;cAClC,EAAE,eAAe,mBACjB,gBAAiB,eAAe,KAAO,YAAY;EAE3B,CAAA,GAC5B,oBAAC,aAAD;GAAa,IAAI;GAAmB;EAAO,CAAA,CACpC;;AAEb"}
|
|
@@ -27,17 +27,17 @@ var SelectMenuField = ({ className, hideLabel, children, name, label, validation
|
|
|
27
27
|
prompt,
|
|
28
28
|
required: Boolean(validation?.required),
|
|
29
29
|
children: /* @__PURE__ */ jsxs(SelectMenu, {
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
"aria-label": label,
|
|
31
|
+
selectedKey: value === "" ? null : value,
|
|
32
|
+
onSelectionChange: onChange,
|
|
32
33
|
size,
|
|
33
34
|
theme: formTheme,
|
|
34
|
-
disabled,
|
|
35
|
+
isDisabled: disabled,
|
|
35
36
|
...error && { state: "error" },
|
|
36
37
|
...rest,
|
|
37
38
|
children: [/* @__PURE__ */ jsx(SelectMenu.Trigger, {
|
|
38
39
|
ref,
|
|
39
|
-
placeholder
|
|
40
|
-
"aria-label": label
|
|
40
|
+
placeholder
|
|
41
41
|
}), /* @__PURE__ */ jsx(SelectMenu.Content, { children })]
|
|
42
42
|
})
|
|
43
43
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectMenuField.js","names":[],"sources":["../../../src/components/select-menu-field/SelectMenuField.tsx"],"sourcesContent":["import * as React from 'react'\nimport { useController, useFormContext } from 'react-hook-form'\n\nimport {\n type FieldElementWrapperProps,\n FieldWrapper\n} from '../field-wrapper/FieldWrapper'\nimport { useFieldError } from '../form/useFieldError'\nimport { useFormCustomContext } from '../form/useFormCustomContext'\nimport { SelectMenu } from '../select-menu/SelectMenu'\n\ntype SelectMenuFieldProps = React.PropsWithChildren<\n FieldElementWrapperProps & {\n placeholder?: string\n size?: 'sm' | 'md' | 'lg'\n theme?: 'white' | 'grey'\n disabled?: boolean\n className?: string\n }\n>\n\nexport const SelectMenuField = ({\n className,\n hideLabel,\n children,\n name,\n label,\n validation,\n prompt,\n description,\n theme,\n size,\n placeholder,\n disabled,\n ...rest\n}: SelectMenuFieldProps) => {\n const { control } = useFormContext()\n const context = useFormCustomContext()\n const { error } = useFieldError(name)\n const formTheme = context?.theme ?? theme\n\n const {\n field: { ref, onChange, value }\n } = useController({\n name,\n control,\n rules: validation,\n defaultValue: ''\n })\n\n return (\n <FieldWrapper\n className={className}\n description={description}\n error={error}\n fieldId={name}\n hideLabel={hideLabel}\n label={label}\n prompt={prompt}\n required={Boolean(validation?.required)}\n >\n <SelectMenu\n
|
|
1
|
+
{"version":3,"file":"SelectMenuField.js","names":[],"sources":["../../../src/components/select-menu-field/SelectMenuField.tsx"],"sourcesContent":["import * as React from 'react'\nimport { useController, useFormContext } from 'react-hook-form'\n\nimport {\n type FieldElementWrapperProps,\n FieldWrapper\n} from '../field-wrapper/FieldWrapper'\nimport { useFieldError } from '../form/useFieldError'\nimport { useFormCustomContext } from '../form/useFormCustomContext'\nimport { SelectMenu } from '../select-menu/SelectMenu'\n\ntype SelectMenuFieldProps = React.PropsWithChildren<\n FieldElementWrapperProps & {\n placeholder?: string\n size?: 'sm' | 'md' | 'lg'\n theme?: 'white' | 'grey'\n disabled?: boolean\n className?: string\n }\n>\n\nexport const SelectMenuField = ({\n className,\n hideLabel,\n children,\n name,\n label,\n validation,\n prompt,\n description,\n theme,\n size,\n placeholder,\n disabled,\n ...rest\n}: SelectMenuFieldProps) => {\n const { control } = useFormContext()\n const context = useFormCustomContext()\n const { error } = useFieldError(name)\n const formTheme = context?.theme ?? theme\n\n const {\n field: { ref, onChange, value }\n } = useController({\n name,\n control,\n rules: validation,\n defaultValue: ''\n })\n\n return (\n <FieldWrapper\n className={className}\n description={description}\n error={error}\n fieldId={name}\n hideLabel={hideLabel}\n label={label}\n prompt={prompt}\n required={Boolean(validation?.required)}\n >\n <SelectMenu\n aria-label={label}\n selectedKey={value === '' ? null : value}\n onSelectionChange={onChange}\n size={size}\n theme={formTheme}\n isDisabled={disabled}\n {...(error && { state: 'error' })}\n {...rest}\n >\n <SelectMenu.Trigger ref={ref} placeholder={placeholder} />\n <SelectMenu.Content>{children}</SelectMenu.Content>\n </SelectMenu>\n </FieldWrapper>\n )\n}\n\nSelectMenuField.displayName = 'SelectMenuField'\n"],"mappings":";;;;;;;;AAqBA,IAAa,mBAAmB,EAC9B,WACA,WACA,UACA,MACA,OACA,YACA,QACA,aACA,OACA,MACA,aACA,UACA,GAAG,WACuB;CAC1B,MAAM,EAAE,YAAY,eAAe;CACnC,MAAM,UAAU,qBAAqB;CACrC,MAAM,EAAE,UAAU,cAAc,IAAI;CACpC,MAAM,YAAY,SAAS,SAAS;CAEpC,MAAM,EACJ,OAAO,EAAE,KAAK,UAAU,YACtB,cAAc;EAChB;EACA;EACA,OAAO;EACP,cAAc;CAChB,CAAC;CAED,OACE,oBAAC,cAAD;EACa;EACE;EACN;EACP,SAAS;EACE;EACJ;EACC;EACR,UAAU,QAAQ,YAAY,QAAQ;YAEtC,qBAAC,YAAD;GACE,cAAY;GACZ,aAAa,UAAU,KAAK,OAAO;GACnC,mBAAmB;GACb;GACN,OAAO;GACP,YAAY;GACZ,GAAK,SAAS,EAAE,OAAO,QAAQ;GAC/B,GAAI;aARN,CAUE,oBAAC,WAAW,SAAZ;IAAyB;IAAkB;GAAc,CAAA,GACzD,oBAAC,WAAW,SAAZ,EAAqB,SAA6B,CAAA,CACxC;;CACA,CAAA;AAElB;AAEA,gBAAgB,cAAc"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Slider.js","names":[],"sources":["../../../src/components/slider/Slider.tsx"],"sourcesContent":["import { Range, Root, Thumb, Track } from '@radix-ui/react-slider'\nimport * as React from 'react'\n\nimport { styled } from '../../styled'\nimport { CSSWrapper } from '../../utilities/css-wrapper/CSSWrapper'\nimport { SliderSteps } from './SliderSteps'\nimport { SliderValue } from './SliderValue'\n\nconst StyledTrack = styled(Track, {\n base: [\n 'rounded-full',\n 'grow',\n 'relative',\n 'data-[orientation=horizontal]:h-1',\n 'data-[orientation=vertical]:w-1'\n ],\n variants: {\n theme: {\n light: ['bg-white'],\n tonal: ['bg-grey-600']\n }\n }\n})\n\nconst StyledSlider = styled(Root, {\n base: [\n 'items-center',\n 'flex',\n 'relative',\n 'touch-none',\n 'select-none',\n 'cursor-pointer',\n 'data-[orientation=horizontal]:h-4',\n 'data-[orientation=vertical]:flex-col',\n 'data-[orientation=vertical]:w-4',\n 'disabled:cursor-not-allowed',\n 'disabled:opacity-30'\n ]\n})\n\nconst StyledRange = styled(Range, {\n base: [\n 'bg-primary-800',\n 'rounded-full',\n 'h-full',\n 'absolute',\n 'disabled:cursor-not-allowed',\n 'disabled:opacity-30'\n ]\n})\n\nconst StyledThumb = styled(Thumb, {\n base: [\n 'bg-primary-900',\n 'rounded-full',\n 'block',\n 'size-4',\n 'hover:bg-primary-1000',\n 'focus:outline-2',\n 'focus:outline-offset-2',\n 'focus:outline-primary-900',\n 'focus:outline-solid',\n 'disabled:cursor-not-allowed',\n 'disabled:opacity-30'\n ]\n})\n\nexport type SliderProps = React.ComponentProps<typeof StyledSlider> &\n Pick<React.ComponentProps<typeof StyledTrack>, 'theme'>\n\nconst SliderComponent = ({\n ref,\n value,\n defaultValue,\n min = 0,\n max = 100,\n theme = 'tonal',\n className,\n children,\n ...rest\n}: SliderProps) => {\n const values = value || defaultValue\n return (\n <CSSWrapper className={className}>\n <StyledSlider\n defaultValue={defaultValue}\n value={value}\n min={min}\n max={max}\n ref={ref}\n {...rest}\n >\n <StyledTrack theme={theme}>\n <StyledRange />\n </StyledTrack>\n {values?.length &&\n values.map((_, i) => <StyledThumb key={`thumb${i}`} />)}\n </StyledSlider>\n {children}\n </CSSWrapper>\n )\n}\n\nexport const Slider = /* @__PURE__ */ Object.assign(SliderComponent, {\n Value: SliderValue,\n Steps: SliderSteps\n})\n"],"mappings":";;;;;;;;AAQA,IAAM,cAAc,OAAO,OAAO;CAChC,MAAM;EACJ;EACA;EACA;EACA;EACA;CACF;CACA,UAAU,EACR,OAAO;EACL,OAAO,CAAC,UAAU;EAClB,OAAO,CAAC,aAAa;CACvB,EACF;AACF,CAAC;AAED,IAAM,eAAe,OAAO,MAAM,EAChC,MAAM;CACJ;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF,EACF,CAAC;AAED,IAAM,cAAc,OAAO,OAAO,EAChC,MAAM;CACJ;CACA;CACA;CACA;CACA;CACA;AACF,EACF,CAAC;AAED,IAAM,cAAc,OAAO,OAAO,EAChC,MAAM;CACJ;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF,EACF,CAAC;AAKD,IAAM,mBAAmB,EACvB,KACA,OACA,cACA,MAAM,GACN,MAAM,KACN,QAAQ,SACR,WACA,UACA,GAAG,WACc;CACjB,MAAM,SAAS,SAAS;CACxB,OACE,qBAAC,YAAD;EAAuB;YAAvB,CACE,qBAAC,cAAD;GACgB;GACP;GACF;GACA;GACA;GACL,GAAI;aANN,CAQE,oBAAC,aAAD;IAAoB;cAClB,oBAAC,aAAD,CAAc,CAAA;GACH,CAAA,GACZ,QAAQ,
|
|
1
|
+
{"version":3,"file":"Slider.js","names":[],"sources":["../../../src/components/slider/Slider.tsx"],"sourcesContent":["import { Range, Root, Thumb, Track } from '@radix-ui/react-slider'\nimport * as React from 'react'\n\nimport { styled } from '../../styled'\nimport { CSSWrapper } from '../../utilities/css-wrapper/CSSWrapper'\nimport { SliderSteps } from './SliderSteps'\nimport { SliderValue } from './SliderValue'\n\nconst StyledTrack = styled(Track, {\n base: [\n 'rounded-full',\n 'grow',\n 'relative',\n 'data-[orientation=horizontal]:h-1',\n 'data-[orientation=vertical]:w-1'\n ],\n variants: {\n theme: {\n light: ['bg-white'],\n tonal: ['bg-grey-600']\n }\n }\n})\n\nconst StyledSlider = styled(Root, {\n base: [\n 'items-center',\n 'flex',\n 'relative',\n 'touch-none',\n 'select-none',\n 'cursor-pointer',\n 'data-[orientation=horizontal]:h-4',\n 'data-[orientation=vertical]:flex-col',\n 'data-[orientation=vertical]:w-4',\n 'disabled:cursor-not-allowed',\n 'disabled:opacity-30'\n ]\n})\n\nconst StyledRange = styled(Range, {\n base: [\n 'bg-primary-800',\n 'rounded-full',\n 'h-full',\n 'absolute',\n 'disabled:cursor-not-allowed',\n 'disabled:opacity-30'\n ]\n})\n\nconst StyledThumb = styled(Thumb, {\n base: [\n 'bg-primary-900',\n 'rounded-full',\n 'block',\n 'size-4',\n 'hover:bg-primary-1000',\n 'focus:outline-2',\n 'focus:outline-offset-2',\n 'focus:outline-primary-900',\n 'focus:outline-solid',\n 'disabled:cursor-not-allowed',\n 'disabled:opacity-30'\n ]\n})\n\nexport type SliderProps = React.ComponentProps<typeof StyledSlider> &\n Pick<React.ComponentProps<typeof StyledTrack>, 'theme'>\n\nconst SliderComponent = ({\n ref,\n value,\n defaultValue,\n min = 0,\n max = 100,\n theme = 'tonal',\n className,\n children,\n ...rest\n}: SliderProps) => {\n const values = value || defaultValue\n return (\n <CSSWrapper className={className}>\n <StyledSlider\n defaultValue={defaultValue}\n value={value}\n min={min}\n max={max}\n ref={ref}\n {...rest}\n >\n <StyledTrack theme={theme}>\n <StyledRange />\n </StyledTrack>\n {values?.length &&\n // Thumbs are positional and can share a value, so the index is their\n // stable identity.\n // eslint-disable-next-line react/no-array-index-key\n values.map((_, i) => <StyledThumb key={`thumb${i}`} />)}\n </StyledSlider>\n {children}\n </CSSWrapper>\n )\n}\n\nexport const Slider = /* @__PURE__ */ Object.assign(SliderComponent, {\n Value: SliderValue,\n Steps: SliderSteps\n})\n"],"mappings":";;;;;;;;AAQA,IAAM,cAAc,OAAO,OAAO;CAChC,MAAM;EACJ;EACA;EACA;EACA;EACA;CACF;CACA,UAAU,EACR,OAAO;EACL,OAAO,CAAC,UAAU;EAClB,OAAO,CAAC,aAAa;CACvB,EACF;AACF,CAAC;AAED,IAAM,eAAe,OAAO,MAAM,EAChC,MAAM;CACJ;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF,EACF,CAAC;AAED,IAAM,cAAc,OAAO,OAAO,EAChC,MAAM;CACJ;CACA;CACA;CACA;CACA;CACA;AACF,EACF,CAAC;AAED,IAAM,cAAc,OAAO,OAAO,EAChC,MAAM;CACJ;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF,EACF,CAAC;AAKD,IAAM,mBAAmB,EACvB,KACA,OACA,cACA,MAAM,GACN,MAAM,KACN,QAAQ,SACR,WACA,UACA,GAAG,WACc;CACjB,MAAM,SAAS,SAAS;CACxB,OACE,qBAAC,YAAD;EAAuB;YAAvB,CACE,qBAAC,cAAD;GACgB;GACP;GACF;GACA;GACA;GACL,GAAI;aANN,CAQE,oBAAC,aAAD;IAAoB;cAClB,oBAAC,aAAD,CAAc,CAAA;GACH,CAAA,GACZ,QAAQ,UAIP,OAAO,KAAK,GAAG,MAAM,oBAAC,aAAD,CAAgC,GAAd,QAAQ,GAAM,CAAC,CAC5C;MACb,QACS;;AAEhB;AAEA,IAAa,SAAyB,uBAAO,OAAO,iBAAiB;CACnE,OAAO;CACP,OAAO;AACT,CAAC"}
|
|
@@ -4,7 +4,8 @@ import * as React$1 from "react";
|
|
|
4
4
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
5
|
import { useController, useFormContext } from "react-hook-form";
|
|
6
6
|
//#region src/components/slider-field/SliderField.tsx
|
|
7
|
-
var
|
|
7
|
+
var DEFAULT_STEPS = [];
|
|
8
|
+
var SliderField = ({ className, hideLabel, label, name, defaultValue, value, validation, outputLabel, min = 0, max = 100, steps = DEFAULT_STEPS, ...rest }) => {
|
|
8
9
|
const { control, setValue } = useFormContext();
|
|
9
10
|
const { field: { ref, onChange, value: innerValue, name: innerName } } = useController({
|
|
10
11
|
name,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SliderField.js","names":[],"sources":["../../../src/components/slider-field/SliderField.tsx"],"sourcesContent":["import * as React from 'react'\nimport { useController, useFormContext } from 'react-hook-form'\n\nimport {\n type FieldElementWrapperProps,\n FieldWrapper\n} from '../field-wrapper/FieldWrapper'\nimport { Slider, type SliderProps } from '../slider/Slider'\nimport type { SliderStepsType } from '../slider/SliderSteps'\nimport type { SliderValueType } from '../slider/SliderValue'\n\ntype SliderFieldProps = SliderProps &\n SliderStepsType &\n SliderValueType &\n FieldElementWrapperProps\n\nexport const SliderField = ({\n className,\n hideLabel,\n label,\n name,\n defaultValue,\n value,\n validation,\n outputLabel,\n min = 0,\n max = 100,\n steps =
|
|
1
|
+
{"version":3,"file":"SliderField.js","names":[],"sources":["../../../src/components/slider-field/SliderField.tsx"],"sourcesContent":["import * as React from 'react'\nimport { useController, useFormContext } from 'react-hook-form'\n\nimport {\n type FieldElementWrapperProps,\n FieldWrapper\n} from '../field-wrapper/FieldWrapper'\nimport { Slider, type SliderProps } from '../slider/Slider'\nimport type { SliderStepsType } from '../slider/SliderSteps'\nimport type { SliderValueType } from '../slider/SliderValue'\n\ntype SliderFieldProps = SliderProps &\n SliderStepsType &\n SliderValueType &\n FieldElementWrapperProps\n\n// Stable identity so the default doesn't hand `Slider.Steps` a fresh array every\n// render (which would redraw children that compare props).\nconst DEFAULT_STEPS: SliderFieldProps['steps'] = []\n\nexport const SliderField = ({\n className,\n hideLabel,\n label,\n name,\n defaultValue,\n value,\n validation,\n outputLabel,\n min = 0,\n max = 100,\n steps = DEFAULT_STEPS,\n ...rest\n}: SliderFieldProps) => {\n const { control, setValue } = useFormContext()\n const {\n field: { ref, onChange, value: innerValue, name: innerName }\n } = useController({\n name,\n control,\n rules: validation,\n defaultValue\n })\n\n // Serialized so an inline `value` array with a fresh identity per render\n // doesn't re-fire the sync effect.\n const serializedValue = JSON.stringify(value)\n React.useEffect(() => {\n // Sync an externally-controlled `value` into react-hook-form without\n // marking the field dirty/touched — this isn't user input. An empty\n // array is a valid value (clearing) and must sync too.\n if (typeof value !== 'undefined')\n setValue(name, value, { shouldDirty: false })\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [serializedValue, name, setValue])\n\n return (\n <FieldWrapper\n className={className}\n fieldId={name}\n label={label}\n hideLabel={hideLabel}\n >\n <Slider\n ref={ref}\n name={innerName}\n onValueChange={onChange}\n value={innerValue}\n min={min}\n max={max}\n {...rest}\n >\n <Slider.Steps min={min} max={max} steps={steps} />\n\n <Slider.Value value={innerValue} outputLabel={outputLabel} />\n </Slider>\n </FieldWrapper>\n )\n}\n\nSliderField.displayName = 'SliderField'\n"],"mappings":";;;;;;AAkBA,IAAM,gBAA2C,CAAC;AAElD,IAAa,eAAe,EAC1B,WACA,WACA,OACA,MACA,cACA,OACA,YACA,aACA,MAAM,GACN,MAAM,KACN,QAAQ,eACR,GAAG,WACmB;CACtB,MAAM,EAAE,SAAS,aAAa,eAAe;CAC7C,MAAM,EACJ,OAAO,EAAE,KAAK,UAAU,OAAO,YAAY,MAAM,gBAC/C,cAAc;EAChB;EACA;EACA,OAAO;EACP;CACF,CAAC;CAID,MAAM,kBAAkB,KAAK,UAAU,KAAK;CAC5C,QAAM,gBAAgB;EAIpB,IAAI,OAAO,UAAU,aACnB,SAAS,MAAM,OAAO,EAAE,aAAa,MAAM,CAAC;CAEhD,GAAG;EAAC;EAAiB;EAAM;CAAQ,CAAC;CAEpC,OACE,oBAAC,cAAD;EACa;EACX,SAAS;EACF;EACI;YAEX,qBAAC,QAAD;GACO;GACL,MAAM;GACN,eAAe;GACf,OAAO;GACF;GACA;GACL,GAAI;aAPN,CASE,oBAAC,OAAO,OAAR;IAAmB;IAAU;IAAY;GAAQ,CAAA,GAEjD,oBAAC,OAAO,OAAR;IAAc,OAAO;IAAyB;GAAc,CAAA,CACtD;;CACI,CAAA;AAElB;AAEA,YAAY,cAAc"}
|
|
@@ -5,7 +5,7 @@ import { StepperStepForward } from "./StepperStepForward.js";
|
|
|
5
5
|
import { StepperSteps } from "./StepperSteps.js";
|
|
6
6
|
import "react";
|
|
7
7
|
import { jsx } from "react/jsx-runtime";
|
|
8
|
-
import invariant from "invariant";
|
|
8
|
+
import invariant from "tiny-invariant";
|
|
9
9
|
//#region src/components/stepper/Stepper.tsx
|
|
10
10
|
var StepperComponent = ({ children, stepCount, allowSkip, onComplete, onStepChange, direction = "horizontal", steps, hideLabels = false, showCompletedIcons = false, className }) => {
|
|
11
11
|
invariant(!(stepCount && steps), "`Stepper` should only be given one of `stepCount` or `steps`. When both are provided, `steps` will be used and `stepCount` will be ignored.");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Stepper.js","names":[],"sources":["../../../src/components/stepper/Stepper.tsx"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"Stepper.js","names":[],"sources":["../../../src/components/stepper/Stepper.tsx"],"sourcesContent":["import * as React from 'react'\nimport invariant from 'tiny-invariant'\n\nimport { cn } from '../../styled'\nimport { StepperProvider } from './Stepper.context'\nimport { StepperStepBack } from './StepperStepBack'\nimport { StepperStepForward } from './StepperStepForward'\nimport { StepperSteps } from './StepperSteps'\nimport type { StepperProps } from './types'\n\nconst StepperComponent = ({\n children,\n stepCount,\n allowSkip,\n onComplete,\n onStepChange,\n direction = 'horizontal',\n steps,\n hideLabels = false,\n showCompletedIcons = false,\n className\n}: React.PropsWithChildren<StepperProps>) => {\n invariant(\n !(stepCount && steps),\n '`Stepper` should only be given one of `stepCount` or `steps`. When both are provided, `steps` will be used and `stepCount` will be ignored.'\n )\n\n const count = steps?.length || stepCount || 0\n\n return (\n <StepperProvider\n stepCount={count}\n allowSkip={allowSkip}\n onComplete={onComplete}\n onStepChange={stepCount ? onStepChange : undefined}\n direction={direction}\n steps={steps || Array(count).fill('')}\n hideLabels={hideLabels}\n showCompletedIcons={showCompletedIcons}\n >\n <div aria-label=\"progress\" className={cn('w-full', className)}>\n {children}\n </div>\n </StepperProvider>\n )\n}\n\nexport const Stepper = /* @__PURE__ */ Object.assign(StepperComponent, {\n StepBack: StepperStepBack,\n StepForward: StepperStepForward,\n Steps: StepperSteps\n})\n\nStepperComponent.displayName = 'Stepper'\n"],"mappings":";;;;;;;;;AAUA,IAAM,oBAAoB,EACxB,UACA,WACA,WACA,YACA,cACA,YAAY,cACZ,OACA,aAAa,OACb,qBAAqB,OACrB,gBAC2C;CAC3C,UACE,EAAE,aAAa,QACf,6IACF;CAEA,MAAM,QAAQ,OAAO,UAAU,aAAa;CAE5C,OACE,oBAAC,iBAAD;EACE,WAAW;EACA;EACC;EACZ,cAAc,YAAY,eAAe,KAAA;EAC9B;EACX,OAAO,SAAS,MAAM,KAAK,CAAC,CAAC,KAAK,EAAE;EACxB;EACQ;YAEpB,oBAAC,OAAD;GAAK,cAAW;GAAW,WAAW,GAAG,UAAU,SAAS;GACzD;EACE,CAAA;CACU,CAAA;AAErB;AAEA,IAAa,UAA0B,uBAAO,OAAO,kBAAkB;CACrE,UAAU;CACV,aAAa;CACb,OAAO;AACT,CAAC;AAED,iBAAiB,cAAc"}
|
|
@@ -18,14 +18,16 @@ var StepperStepsContainer = styled("div", {
|
|
|
18
18
|
});
|
|
19
19
|
var StepperSteps = ({ className }) => {
|
|
20
20
|
const { steps, goToStep, activeStep, viewedSteps, allowSkip, direction, hideLabels, completedSteps, showCompletedIcons } = useStepper();
|
|
21
|
+
const viewedStepsSet = new Set(viewedSteps);
|
|
22
|
+
const completedStepsSet = new Set(completedSteps);
|
|
21
23
|
const getBulletStatus = (index) => {
|
|
22
24
|
const activeBullet = steps[index];
|
|
23
25
|
if (activeBullet.status) return activeBullet.status;
|
|
24
26
|
if (completedSteps.length === steps.length) return Status.SUCCESS;
|
|
25
|
-
if (activeStep === index &&
|
|
27
|
+
if (activeStep === index && completedStepsSet.has(activeStep)) return Status.REVIEWED;
|
|
26
28
|
if (activeStep === index) return Status.ACTIVE;
|
|
27
|
-
if (
|
|
28
|
-
if (
|
|
29
|
+
if (completedStepsSet.has(index)) return Status.COMPLETED;
|
|
30
|
+
if (viewedStepsSet.has(index)) return Status.VIEWED;
|
|
29
31
|
return Status.DEFAULT;
|
|
30
32
|
};
|
|
31
33
|
const getSeparatorStatus = (index) => {
|
|
@@ -51,12 +53,12 @@ var StepperSteps = ({ className }) => {
|
|
|
51
53
|
canInteract: allowSkip,
|
|
52
54
|
children: [/* @__PURE__ */ jsx(StepperStepBullet, {
|
|
53
55
|
as: allowSkip ? "button" : "div",
|
|
54
|
-
onClick: () => allowSkip &&
|
|
56
|
+
onClick: () => allowSkip && viewedStepsSet.has(index) ? goToStep?.(index) : void 0,
|
|
55
57
|
status: bulletStatus,
|
|
56
58
|
"aria-current": index === activeStep ? "step" : void 0,
|
|
57
59
|
"aria-label": !step.label ? `step ${index + 1}` : "",
|
|
58
60
|
"aria-labelledby": step.label ? `step-${index}` : void 0,
|
|
59
|
-
className: allowSkip &&
|
|
61
|
+
className: allowSkip && viewedStepsSet.has(index) ? "cursor-pointer" : "cursor-auto",
|
|
60
62
|
children: step.status === Status.SUCCESS || showCompletedIcons && bulletStatus === Status.COMPLETED ? /* @__PURE__ */ jsx(Icon, { is: Ok }) : index + 1
|
|
61
63
|
}), step.label && !hideLabels && /* @__PURE__ */ jsx(StepperStepLabel, {
|
|
62
64
|
as: "span",
|