@atom-learning/components 6.0.0-beta.38 → 6.0.0-beta.39
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/badge/Badge.js +1 -1
- package/dist/components/badge/Badge.js.map +1 -1
- package/dist/components/data-table/DataTable.d.ts +2 -2
- package/dist/components/field-wrapper/InlineFieldWrapper.js +1 -1
- package/dist/components/field-wrapper/InlineFieldWrapper.js.map +1 -1
- package/dist/components/table/Table.d.ts +1 -1
- package/dist/components/table/TableHeader.d.ts +1 -1
- package/dist/components/table/TableStickyColumnsContainer.js +1 -1
- package/dist/components/table/TableStickyColumnsContainer.js.map +1 -1
- package/dist/index.cjs.js +1 -1
- package/dist/index.cjs.js.map +1 -1
- package/package.json +1 -1
- package/src/index.css +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import*as e from"react";import{Flex as
|
|
1
|
+
import*as e from"react";import{Flex as v}from"../flex/Flex.js";import{Icon as w}from"../icon/Icon.js";import{styled as k}from"../../styled.js";import{useCallbackRefState as y}from"../../utilities/hooks/useCallbackRef.js";import{colorSchemes as C,badgeSemanticNames as E}from"./Badge.colorscheme.config.js";import{BadgeContext as B,BadgeProvider as O}from"./Badge.context.js";import{BadgeIcon as n}from"./BadgeIcon.js";import{BadgeText as m}from"./BadgeText.js";import{OptionalTooltipWrapper as z}from"../../utilities/optional-tooltip-wrapper/OptionalTooltipWrapper.js";const j=k(v,{base:["justify-center","items-center","rounded-sm","min-w-0","border","border-white","font-body","*:not-last:mr-1"],variants:{emphasis:{white:["text-(--text-on-white)","bg-white"],subtle:["text-(--text-subtle)","bg-(--background-subtle)"],bold:["text-(--text-bold)","bg-(--background-bold)"]},size:{xs:["px-1","py-0"],sm:["px-1","py-0.5"],md:["px-2","py-1"]},isClickable:{true:["cursor-pointer"]},highlighted:{true:[]}},compoundVariants:[{isClickable:!0,emphasis:"white",class:["hover:text-(--text-on-white)","hover:bg-[color-mix(in_srgb,(--text-on-white),transparent_92%)]"]},{isClickable:!0,emphasis:"subtle",class:["hover:bg-(--background-subtle-hover)","hover:text-(--text-subtle-hover)"]},{isClickable:!0,emphasis:"bold",class:["hover:bg-(--background-bold-hover)","hover:text-(--text-bold)"]},{emphasis:"white",highlighted:!0,class:["text-(--text-on-white)","bg-[color-mix(in_srgb,(--text-on-white),transparent_92%)]"]},{emphasis:"subtle",highlighted:!0,class:["text-(--text-subtle-hover)","(--bg-background-subtle-hover)"]},{emphasis:"bold",highlighted:!0,class:["text-(--text-bold)","bg-(--background-bold-hover)"]}]},{enabledResponsiveVariants:!0}),I=e.forwardRef(({theme:o="info",emphasis:s="subtle",children:r,style:i,...l},h)=>{const{size:c,overflow:d,isOverflowing:p}=e.useContext(B),[a,g]=y();e.useImperativeHandle(h,()=>a);const u=a==null?void 0:a.textContent,x=E.includes(o),f=Object.keys(l).includes("onClick")||Object.keys(l).includes("href");return e.createElement(z,{hasTooltip:d==="ellipsis"&&p,label:u},e.createElement(j,{role:"status",emphasis:s,size:c,style:{...C[o],...i},...l,ref:g,isClickable:f&&!x},e.Children.map(r,t=>typeof t=="string"||typeof t=="number"?e.createElement(m,null,t):e.isValidElement(t)&&t.type===w?e.createElement(n,{...t.props}):t)))}),b=e.forwardRef(({size:o="sm",overflow:s="wrap",...r},i)=>e.createElement(O,{size:o,overflow:s},e.createElement(I,{...r,ref:i}))),R=Object.assign(b,{Icon:n,Text:m});b.displayName="Badge";export{R as Badge};
|
|
2
2
|
//# sourceMappingURL=Badge.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Badge.js","sources":["../../../src/components/badge/Badge.tsx"],"sourcesContent":["import * as React from 'react'\n\nimport { Flex } from '~/components/flex'\nimport { Icon } from '~/components/icon'\nimport { styled
|
|
1
|
+
{"version":3,"file":"Badge.js","sources":["../../../src/components/badge/Badge.tsx"],"sourcesContent":["import * as React from 'react'\n\nimport { Flex } from '~/components/flex'\nimport { Icon } from '~/components/icon'\nimport { styled } from '~/styled'\nimport { useCallbackRefState } from '~/utilities/hooks/useCallbackRef'\nimport { OptionalTooltipWrapper } from '~/utilities/optional-tooltip-wrapper'\n\nimport {\n colorSchemes as badgeColorSchemes,\n badgeSemanticNames\n} from './Badge.colorscheme.config'\nimport { BadgeContext, BadgeProvider } from './Badge.context'\nimport { BadgeIcon } from './BadgeIcon'\nimport { BadgeText } from './BadgeText'\n\nconst StyledBadge = styled(\n Flex,\n {\n base: [\n 'justify-center',\n 'items-center',\n 'rounded-sm',\n 'min-w-0',\n 'border',\n 'border-white',\n 'font-body',\n '*:not-last:mr-1'\n ],\n variants: {\n emphasis: {\n white: ['text-(--text-on-white)', 'bg-white'],\n subtle: ['text-(--text-subtle)', 'bg-(--background-subtle)'],\n bold: ['text-(--text-bold)', 'bg-(--background-bold)']\n },\n size: {\n xs: ['px-1', 'py-0'],\n sm: ['px-1', 'py-0.5'],\n md: ['px-2', 'py-1']\n },\n isClickable: {\n true: ['cursor-pointer']\n },\n highlighted: {\n true: []\n }\n },\n compoundVariants: [\n {\n isClickable: true,\n emphasis: 'white',\n class: [\n 'hover:text-(--text-on-white)',\n 'hover:bg-[color-mix(in_srgb,(--text-on-white),transparent_92%)]'\n ]\n },\n {\n isClickable: true,\n emphasis: 'subtle',\n class: [\n 'hover:bg-(--background-subtle-hover)',\n 'hover:text-(--text-subtle-hover)'\n ]\n },\n {\n isClickable: true,\n emphasis: 'bold',\n class: [\n 'hover:bg-(--background-bold-hover)',\n 'hover:text-(--text-bold)'\n ]\n },\n {\n emphasis: 'white',\n highlighted: true,\n class: [\n 'text-(--text-on-white)',\n 'bg-[color-mix(in_srgb,(--text-on-white),transparent_92%)]'\n ]\n },\n {\n emphasis: 'subtle',\n highlighted: true,\n class: ['text-(--text-subtle-hover)', '(--bg-background-subtle-hover)']\n },\n {\n emphasis: 'bold',\n highlighted: true,\n class: ['text-(--text-bold)', 'bg-(--background-bold-hover)']\n }\n ]\n },\n { enabledResponsiveVariants: true }\n)\n\nexport type TBadgeProps = React.ComponentProps<typeof StyledBadge> & {\n theme?: keyof typeof badgeColorSchemes\n overflow?: React.ComponentProps<typeof BadgeText>['overflow']\n}\n\ntype TBadgeInnerProps = Omit<TBadgeProps, 'size' | 'overflow'>\n\nconst BadgeInner = React.forwardRef<HTMLDivElement, TBadgeInnerProps>(\n ({ theme = 'info', emphasis = 'subtle', children, style, ...rest }, ref) => {\n const { size, overflow, isOverflowing } = React.useContext(BadgeContext)\n const [badgeElRef, setBadgeElRef] = useCallbackRefState()\n React.useImperativeHandle(ref, () => badgeElRef as HTMLDivElement)\n\n const label = badgeElRef?.textContent\n\n const isInfoOnly = badgeSemanticNames.includes(theme)\n\n const isClickable =\n Object.keys(rest).includes('onClick') ||\n Object.keys(rest).includes('href')\n\n return (\n <OptionalTooltipWrapper\n hasTooltip={overflow === 'ellipsis' && isOverflowing}\n label={label}\n >\n <StyledBadge\n role=\"status\"\n emphasis={emphasis}\n size={size}\n style={{\n ...badgeColorSchemes[theme],\n ...style\n }}\n {...rest}\n ref={setBadgeElRef}\n isClickable={isClickable && !isInfoOnly}\n >\n {React.Children.map(children, (child) => {\n if (typeof child === 'string' || typeof child === 'number') {\n return <BadgeText>{child}</BadgeText>\n }\n if (React.isValidElement(child) && child.type === Icon) {\n return <BadgeIcon {...child.props} />\n }\n return child\n })}\n </StyledBadge>\n </OptionalTooltipWrapper>\n )\n }\n)\n\nconst BadgeComponent = React.forwardRef<HTMLDivElement, TBadgeProps>(\n ({ size = 'sm', overflow = 'wrap', ...rest }, ref) => {\n return (\n <BadgeProvider size={size} overflow={overflow}>\n <BadgeInner {...rest} ref={ref} />\n </BadgeProvider>\n )\n }\n)\n\nexport const Badge = Object.assign(BadgeComponent, {\n Icon: BadgeIcon,\n Text: BadgeText\n})\n\nBadgeComponent.displayName = 'Badge'\n"],"names":["StyledBadge","styled","Flex","BadgeInner","React","theme","emphasis","children","style","rest","ref","size","overflow","isOverflowing","BadgeContext","badgeElRef","setBadgeElRef","useCallbackRefState","label","isInfoOnly","badgeSemanticNames","isClickable","OptionalTooltipWrapper","badgeColorSchemes","child","BadgeText","Icon","BadgeIcon","BadgeComponent","BadgeProvider","Badge"],"mappings":"yjBAgBA,MAAMA,EAAcC,EAClBC,EACA,CACE,KAAM,CACJ,iBACA,eACA,aACA,UACA,SACA,eACA,YACA,iBACF,EACA,SAAU,CACR,SAAU,CACR,MAAO,CAAC,yBAA0B,UAAU,EAC5C,OAAQ,CAAC,uBAAwB,0BAA0B,EAC3D,KAAM,CAAC,qBAAsB,wBAAwB,CACvD,EACA,KAAM,CACJ,GAAI,CAAC,OAAQ,MAAM,EACnB,GAAI,CAAC,OAAQ,QAAQ,EACrB,GAAI,CAAC,OAAQ,MAAM,CACrB,EACA,YAAa,CACX,KAAM,CAAC,gBAAgB,CACzB,EACA,YAAa,CACX,KAAM,CACR,CAAA,CACF,EACA,iBAAkB,CAChB,CACE,YAAa,GACb,SAAU,QACV,MAAO,CACL,+BACA,iEACF,CACF,EACA,CACE,YAAa,GACb,SAAU,SACV,MAAO,CACL,uCACA,kCACF,CACF,EACA,CACE,YAAa,GACb,SAAU,OACV,MAAO,CACL,qCACA,0BACF,CACF,EACA,CACE,SAAU,QACV,YAAa,GACb,MAAO,CACL,yBACA,2DACF,CACF,EACA,CACE,SAAU,SACV,YAAa,GACb,MAAO,CAAC,6BAA8B,gCAAgC,CACxE,EACA,CACE,SAAU,OACV,YAAa,GACb,MAAO,CAAC,qBAAsB,8BAA8B,CAC9D,CACF,CACF,EACA,CAAE,0BAA2B,EAAK,CACpC,EASMC,EAAaC,EAAM,WACvB,CAAC,CAAE,MAAAC,EAAQ,OAAQ,SAAAC,EAAW,SAAU,SAAAC,EAAU,MAAAC,EAAO,GAAGC,CAAK,EAAGC,IAAQ,CAC1E,KAAM,CAAE,KAAAC,EAAM,SAAAC,EAAU,cAAAC,CAAc,EAAIT,EAAM,WAAWU,CAAY,EACjE,CAACC,EAAYC,CAAa,EAAIC,IACpCb,EAAM,oBAAoBM,EAAK,IAAMK,CAA4B,EAEjE,MAAMG,EAAQH,GAAA,KAAA,OAAAA,EAAY,YAEpBI,EAAaC,EAAmB,SAASf,CAAK,EAE9CgB,EACJ,OAAO,KAAKZ,CAAI,EAAE,SAAS,SAAS,GACpC,OAAO,KAAKA,CAAI,EAAE,SAAS,MAAM,EAEnC,OACEL,EAAA,cAACkB,EAAA,CACC,WAAYV,IAAa,YAAcC,EACvC,MAAOK,CAAAA,EAEPd,EAAA,cAACJ,EAAA,CACC,KAAK,SACL,SAAUM,EACV,KAAMK,EACN,MAAO,CACL,GAAGY,EAAkBlB,CAAK,EAC1B,GAAGG,CACL,EACC,GAAGC,EACJ,IAAKO,EACL,YAAaK,GAAe,CAACF,CAAAA,EAE5Bf,EAAM,SAAS,IAAIG,EAAWiB,GACzB,OAAOA,GAAU,UAAY,OAAOA,GAAU,SACzCpB,EAAA,cAACqB,EAAA,KAAWD,CAAM,EAEvBpB,EAAM,eAAeoB,CAAK,GAAKA,EAAM,OAASE,EACzCtB,EAAA,cAACuB,EAAA,CAAW,GAAGH,EAAM,MAAO,EAE9BA,CACR,CACH,CACF,CAEJ,CACF,EAEMI,EAAiBxB,EAAM,WAC3B,CAAC,CAAE,KAAAO,EAAO,KAAM,SAAAC,EAAW,OAAQ,GAAGH,CAAK,EAAGC,IAE1CN,EAAA,cAACyB,EAAA,CAAc,KAAMlB,EAAM,SAAUC,GACnCR,EAAA,cAACD,EAAA,CAAY,GAAGM,EAAM,IAAKC,CAAAA,CAAK,CAClC,CAGN,EAEaoB,EAAQ,OAAO,OAAOF,EAAgB,CACjD,KAAMD,EACN,KAAMF,CACR,CAAC,EAEDG,EAAe,YAAc"}
|
|
@@ -57,7 +57,7 @@ export declare const DataTable: (({ columns, data: dataProp, getAsyncData, defau
|
|
|
57
57
|
}, "ref"> & import("react").RefAttributes<HTMLTableElement>, "children" | "numberOfStickyColumns"> & Partial<Pick<Omit<Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLTableSectionElement>, HTMLTableSectionElement>, "ref"> & {
|
|
58
58
|
ref?: ((instance: HTMLTableSectionElement | null) => void) | import("react").RefObject<HTMLTableSectionElement> | null | undefined;
|
|
59
59
|
}, "theme" | "isSticky"> & {
|
|
60
|
-
theme?: "primary" | "white" | "primaryDark" | "
|
|
60
|
+
theme?: "primary" | "white" | "primaryDark" | "light" | "primaryLight" | undefined;
|
|
61
61
|
isSticky?: boolean | undefined;
|
|
62
62
|
} & {
|
|
63
63
|
as?: import("react").ElementType;
|
|
@@ -111,7 +111,7 @@ export declare const DataTable: (({ columns, data: dataProp, getAsyncData, defau
|
|
|
111
111
|
Head: ({ sortable, theme, isSticky, stickyOffset, showTotalInFirstColumn, totalSuffix, style, className, ...props }: Omit<Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLTableSectionElement>, HTMLTableSectionElement>, "ref"> & {
|
|
112
112
|
ref?: ((instance: HTMLTableSectionElement | null) => void) | import("react").RefObject<HTMLTableSectionElement> | null | undefined;
|
|
113
113
|
}, "theme" | "isSticky"> & {
|
|
114
|
-
theme?: "primary" | "white" | "primaryDark" | "
|
|
114
|
+
theme?: "primary" | "white" | "primaryDark" | "light" | "primaryLight" | undefined;
|
|
115
115
|
isSticky?: boolean | undefined;
|
|
116
116
|
} & {
|
|
117
117
|
as?: import("react").ElementType;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import
|
|
1
|
+
import o from"clsx";import*as r from"react";import{Checkbox as v}from"../checkbox/Checkbox.js";import{InlineMessage as u}from"../inline-message/InlineMessage.js";import{Label as f}from"../label/Label.js";import{RadioButton as N}from"../radio-button/RadioButton.js";import"../radio-button/RadioButtonGroup.js";import{Description as y}from"./FieldDescription.js";const a=({align:n="start",children:p,className:s,description:l,direction:i="row",error:t,label:c,required:d})=>r.createElement("div",{className:s},r.createElement(f,{align:n,direction:i,required:d,type:"inline"},r.Children.map(p,e=>{var m;return r.createElement("div",{className:o(i==="reverse"&&"ml-3",i==="row"&&"mr-3",((e==null?void 0:e.type)===v||(e==null?void 0:e.type)===N)&&((m=e==null?void 0:e.props)==null?void 0:m.size)!=="lg"&&"translate-y-1")},e)}),c),t&&r.createElement(u,{className:"mt-2"},t),l&&r.createElement(y,{className:o("mt-2",i==="reverse"&&"mr-7",i==="row"&&"ml-7")},l));a.displayName="InlineFieldWrapper";export{a as InlineFieldWrapper};
|
|
2
2
|
//# sourceMappingURL=InlineFieldWrapper.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InlineFieldWrapper.js","sources":["../../../src/components/field-wrapper/InlineFieldWrapper.tsx"],"sourcesContent":["import clsx from 'clsx'\nimport * as React from 'react'\n\nimport { Checkbox } from '~/components/checkbox'\nimport { InlineMessage } from '~/components/inline-message'\nimport { Label } from '~/components/label'\nimport { RadioButton } from '~/components/radio-button'\n\nimport { Description } from './FieldDescription'\n\ntype InlineFieldWrapperProps = {\n className?: string\n error?: string\n label: string\n required?: boolean\n align?: 'start' | 'center'\n direction?: 'row' | 'reverse'\n description?: string\n}\n\nexport const InlineFieldWrapper = ({\n align = 'start',\n children,\n className,\n description,\n direction = 'row',\n error,\n label,\n required\n}: React.PropsWithChildren<InlineFieldWrapperProps>) => (\n <div className={className}>\n <Label\n align={align}\n direction={direction}\n required={required}\n type=\"inline\"\n >\n {React.Children.map(children, (child: any) => (\n <div\n className={clsx(\n direction === 'reverse' && 'ml-3',\n direction === 'row' && 'mr-3',\n (child?.type === Checkbox || child?.type === RadioButton)
|
|
1
|
+
{"version":3,"file":"InlineFieldWrapper.js","sources":["../../../src/components/field-wrapper/InlineFieldWrapper.tsx"],"sourcesContent":["import clsx from 'clsx'\nimport * as React from 'react'\n\nimport { Checkbox } from '~/components/checkbox'\nimport { InlineMessage } from '~/components/inline-message'\nimport { Label } from '~/components/label'\nimport { RadioButton } from '~/components/radio-button'\n\nimport { Description } from './FieldDescription'\n\ntype InlineFieldWrapperProps = {\n className?: string\n error?: string\n label: string\n required?: boolean\n align?: 'start' | 'center'\n direction?: 'row' | 'reverse'\n description?: string\n}\n\nexport const InlineFieldWrapper = ({\n align = 'start',\n children,\n className,\n description,\n direction = 'row',\n error,\n label,\n required\n}: React.PropsWithChildren<InlineFieldWrapperProps>) => (\n <div className={className}>\n <Label\n align={align}\n direction={direction}\n required={required}\n type=\"inline\"\n >\n {React.Children.map(children, (child: any) => (\n <div\n className={clsx(\n direction === 'reverse' && 'ml-3',\n direction === 'row' && 'mr-3',\n (child?.type === Checkbox || child?.type === RadioButton) &&\n child?.props?.size !== 'lg' &&\n 'translate-y-1'\n )}\n >\n {child}\n </div>\n ))}\n {label}\n </Label>\n {error && <InlineMessage className=\"mt-2\">{error}</InlineMessage>}\n {description && (\n <Description\n className={clsx(\n 'mt-2',\n direction === 'reverse' && 'mr-7',\n direction === 'row' && 'ml-7'\n )}\n >\n {description}\n </Description>\n )}\n </div>\n)\n\nInlineFieldWrapper.displayName = 'InlineFieldWrapper'\n"],"names":["InlineFieldWrapper","align","children","className","description","direction","error","label","required","React","Label","child","_a","clsx","Checkbox","RadioButton","InlineMessage","Description"],"mappings":"yWAoBO,MAAMA,EAAqB,CAAC,CACjC,MAAAC,EAAQ,QACR,SAAAC,EACA,UAAAC,EACA,YAAAC,EACA,UAAAC,EAAY,MACZ,MAAAC,EACA,MAAAC,EACA,SAAAC,CACF,IACEC,EAAA,cAAC,MAAA,CAAI,UAAWN,CAAAA,EACdM,EAAA,cAACC,EAAA,CACC,MAAOT,EACP,UAAWI,EACX,SAAUG,EACV,KAAK,QAEJC,EAAAA,EAAM,SAAS,IAAIP,EAAWS,GAAY,CArCjD,IAAAC,EAsCQ,OAAAH,EAAA,cAAC,MACC,CAAA,UAAWI,EACTR,IAAc,WAAa,OAC3BA,IAAc,OAAS,SACtBM,GAAA,KAAA,OAAAA,EAAO,QAASG,IAAYH,GAAA,KAAAA,OAAAA,EAAO,QAASI,MAC3CH,EAAAD,GAAA,KAAA,OAAAA,EAAO,QAAP,KAAAC,OAAAA,EAAc,QAAS,MACvB,eACJ,CAECD,EAAAA,CACH,CACD,CAAA,EACAJ,CACH,EACCD,GAASG,EAAA,cAACO,EAAA,CAAc,UAAU,MAAA,EAAQV,CAAM,EAChDF,GACCK,EAAA,cAACQ,EAAA,CACC,UAAWJ,EACT,OACAR,IAAc,WAAa,OAC3BA,IAAc,OAAS,MACzB,CAECD,EAAAA,CACH,CAEJ,EAGFJ,EAAmB,YAAc"}
|
|
@@ -43,7 +43,7 @@ export declare const Table: React.ForwardRefExoticComponent<Omit<TableProps, "re
|
|
|
43
43
|
({ theme, isSticky, ...rest }: Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLTableSectionElement>, HTMLTableSectionElement>, "ref"> & {
|
|
44
44
|
ref?: ((instance: HTMLTableSectionElement | null) => void) | React.RefObject<HTMLTableSectionElement> | null | undefined;
|
|
45
45
|
}, "theme" | "isSticky"> & {
|
|
46
|
-
theme?: "primary" | "white" | "primaryDark" | "
|
|
46
|
+
theme?: "primary" | "white" | "primaryDark" | "light" | "primaryLight" | undefined;
|
|
47
47
|
isSticky?: boolean | undefined;
|
|
48
48
|
} & {
|
|
49
49
|
as?: React.ElementType;
|
|
@@ -9,7 +9,7 @@ export declare const TABLE_HEADER_THEMES: {
|
|
|
9
9
|
declare const StyledTableHeader: React.ForwardRefExoticComponent<Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLTableSectionElement>, HTMLTableSectionElement>, "ref"> & {
|
|
10
10
|
ref?: ((instance: HTMLTableSectionElement | null) => void) | React.RefObject<HTMLTableSectionElement> | null | undefined;
|
|
11
11
|
}, "theme" | "isSticky"> & {
|
|
12
|
-
theme?: "primary" | "white" | "primaryDark" | "
|
|
12
|
+
theme?: "primary" | "white" | "primaryDark" | "light" | "primaryLight" | undefined;
|
|
13
13
|
isSticky?: boolean | undefined;
|
|
14
14
|
} & {
|
|
15
15
|
as?: React.ElementType;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import c from"clsx";import e from"react";import{useStickyColumnsStyle as i}from"./useStickyColumnsCss.js";const
|
|
1
|
+
import c from"clsx";import e from"react";import{useStickyColumnsStyle as i}from"./useStickyColumnsCss.js";const r=({children:h,numberOfStickyColumns:t=0,className:n,...l})=>{const[_,f]=e.useState(!1),p=e.useRef(null),{columnsStyle:s}=i({numberOfStickyColumns:t,wrapperRef:p});return e.createElement("div",{onScroll:y=>{const o=y.currentTarget.scrollLeft>0;o!==_&&f(o)},role:"scrollbar",ref:p,style:s,className:c("overflow-auto","max-w-full","relative","overscroll-x-contain","[&_td,&_th]:bg-inherit",n,t===1&&["[&_td,&_th]:nth-of-type-[1]:sticky","[&_td,&_th]:nth-of-type-[1]:left-(--sticky-offset-left-1)","[&_td,&_th]:nth-of-type-[1]:w-(--sticky-column-width-1)","[&_td,&_th]:nth-of-type-[1]:z-2"],t===2&&["[&_td,&_th]:nth-of-type-[2]:sticky","[&_td,&_th]:nth-of-type-[2]:left-(--sticky-offset-left-2)","[&_td,&_th]:nth-of-type-[2]:w-(--sticky-column-width-2)","[&_td,&_th]:nth-of-type-[2]:z-2"],t===3&&["[&_td,&_th]:nth-of-type-[3]:sticky","[&_td,&_th]:nth-of-type-[3]:left-(--sticky-offset-left-3)","[&_td,&_th]:nth-of-type-[3]:w-(--sticky-column-width-3)","[&_td,&_th]:nth-of-type-[3]:z-2"],t===4&&["[&_td,&_th]:nth-of-type-[4]:sticky","[&_td,&_th]:nth-of-type-[4]:left-(--sticky-offset-left-4)","[&_td,&_th]:nth-of-type-[4]:w-(--sticky-column-width-4)","[&_td,&_th]:nth-of-type-[4]:z-2"],t===1&&_&&["[&_td,&_th]:nth-of-type-[1]:shadow-[var(--color-alpha-200)_-2px_-3px_9px_1px]","[&_td,&_th]:nth-of-type-[1]:[clip-path:inset(0px_-10px_0px_0px)]"],t===2&&_&&["[&_td,&_th]:nth-of-type-[2]:shadow-[var(--color-alpha-200)_-2px_-3px_9px_1px]","[&_td,&_th]:nth-of-type-[2]:[clip-path:inset(0px_-10px_0px_0px)]"],t===3&&_&&["[&_td,&_th]:nth-of-type-[3]:shadow-[var(--color-alpha-200)_-2px_-3px_9px_1px]","[&_td,&_th]:nth-of-type-[3]:[clip-path:inset(0px_-10px_0px_0px)]"],t===4&&_&&["[&_td,&_th]:nth-of-type-[4]:shadow-[var(--color-alpha-200)_-2px_-3px_9px_1px]","[&_td,&_th]:nth-of-type-[4]:[clip-path:inset(0px_-10px_0px_0px)]"]),...l},h)};export{r as TableStickyColumnsContainer};
|
|
2
2
|
//# sourceMappingURL=TableStickyColumnsContainer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TableStickyColumnsContainer.js","sources":["../../../src/components/table/TableStickyColumnsContainer.tsx"],"sourcesContent":["import clsx from 'clsx'\nimport React from 'react'\n\nimport { useStickyColumnsStyle } from './useStickyColumnsCss'\n\nexport const TableStickyColumnsContainer = ({\n children,\n numberOfStickyColumns = 0,\n className,\n ...restProps\n}: React.PropsWithChildren<{\n numberOfStickyColumns?: number\n className?: string\n}>) => {\n const [hasScroll, setHasScroll] = React.useState<boolean>(false)\n const wrapperRef = React.useRef(null)\n const { columnsStyle } = useStickyColumnsStyle({\n numberOfStickyColumns,\n wrapperRef\n })\n\n const handleScroll = (event: React.UIEvent<HTMLDivElement>) => {\n const newHasScroll = event.currentTarget.scrollLeft > 0\n if (newHasScroll !== hasScroll) {\n setHasScroll(newHasScroll)\n }\n }\n\n return (\n <div\n onScroll={handleScroll}\n // eslint-disable-next-line jsx-a11y/role-has-required-aria-props\n role=\"scrollbar\"\n ref={wrapperRef}\n style={columnsStyle}\n className={clsx(\n 'overflow-auto',\n 'max-w-full',\n 'relative',\n 'overscroll-x-contain',\n '[&_td,&_th]:bg-inherit',\n className,\n numberOfStickyColumns === 1 && [\n '[&_td,&_th]:nth-of-type-[1]:sticky',\n '[&_td,&_th]:nth-of-type-[1]:left-(--sticky-offset-left-1)',\n '[&_td,&_th]:nth-of-type-[1]:
|
|
1
|
+
{"version":3,"file":"TableStickyColumnsContainer.js","sources":["../../../src/components/table/TableStickyColumnsContainer.tsx"],"sourcesContent":["import clsx from 'clsx'\nimport React from 'react'\n\nimport { useStickyColumnsStyle } from './useStickyColumnsCss'\n\nexport const TableStickyColumnsContainer = ({\n children,\n numberOfStickyColumns = 0,\n className,\n ...restProps\n}: React.PropsWithChildren<{\n numberOfStickyColumns?: number\n className?: string\n}>) => {\n const [hasScroll, setHasScroll] = React.useState<boolean>(false)\n const wrapperRef = React.useRef(null)\n const { columnsStyle } = useStickyColumnsStyle({\n numberOfStickyColumns,\n wrapperRef\n })\n\n const handleScroll = (event: React.UIEvent<HTMLDivElement>) => {\n const newHasScroll = event.currentTarget.scrollLeft > 0\n if (newHasScroll !== hasScroll) {\n setHasScroll(newHasScroll)\n }\n }\n\n return (\n <div\n onScroll={handleScroll}\n // eslint-disable-next-line jsx-a11y/role-has-required-aria-props\n role=\"scrollbar\"\n ref={wrapperRef}\n style={columnsStyle}\n className={clsx(\n 'overflow-auto',\n 'max-w-full',\n 'relative',\n 'overscroll-x-contain',\n '[&_td,&_th]:bg-inherit',\n className,\n numberOfStickyColumns === 1 && [\n '[&_td,&_th]:nth-of-type-[1]:sticky',\n '[&_td,&_th]:nth-of-type-[1]:left-(--sticky-offset-left-1)',\n '[&_td,&_th]:nth-of-type-[1]:w-(--sticky-column-width-1)',\n '[&_td,&_th]:nth-of-type-[1]:z-2'\n ],\n numberOfStickyColumns === 2 && [\n '[&_td,&_th]:nth-of-type-[2]:sticky',\n '[&_td,&_th]:nth-of-type-[2]:left-(--sticky-offset-left-2)',\n '[&_td,&_th]:nth-of-type-[2]:w-(--sticky-column-width-2)',\n '[&_td,&_th]:nth-of-type-[2]:z-2'\n ],\n numberOfStickyColumns === 3 && [\n '[&_td,&_th]:nth-of-type-[3]:sticky',\n '[&_td,&_th]:nth-of-type-[3]:left-(--sticky-offset-left-3)',\n '[&_td,&_th]:nth-of-type-[3]:w-(--sticky-column-width-3)',\n '[&_td,&_th]:nth-of-type-[3]:z-2'\n ],\n numberOfStickyColumns === 4 && [\n '[&_td,&_th]:nth-of-type-[4]:sticky',\n '[&_td,&_th]:nth-of-type-[4]:left-(--sticky-offset-left-4)',\n '[&_td,&_th]:nth-of-type-[4]:w-(--sticky-column-width-4)',\n '[&_td,&_th]:nth-of-type-[4]:z-2'\n ],\n numberOfStickyColumns === 1 &&\n hasScroll && [\n '[&_td,&_th]:nth-of-type-[1]:shadow-[var(--color-alpha-200)_-2px_-3px_9px_1px]',\n '[&_td,&_th]:nth-of-type-[1]:[clip-path:inset(0px_-10px_0px_0px)]'\n ],\n numberOfStickyColumns === 2 &&\n hasScroll && [\n '[&_td,&_th]:nth-of-type-[2]:shadow-[var(--color-alpha-200)_-2px_-3px_9px_1px]',\n '[&_td,&_th]:nth-of-type-[2]:[clip-path:inset(0px_-10px_0px_0px)]'\n ],\n numberOfStickyColumns === 3 &&\n hasScroll && [\n '[&_td,&_th]:nth-of-type-[3]:shadow-[var(--color-alpha-200)_-2px_-3px_9px_1px]',\n '[&_td,&_th]:nth-of-type-[3]:[clip-path:inset(0px_-10px_0px_0px)]'\n ],\n numberOfStickyColumns === 4 &&\n hasScroll && [\n '[&_td,&_th]:nth-of-type-[4]:shadow-[var(--color-alpha-200)_-2px_-3px_9px_1px]',\n '[&_td,&_th]:nth-of-type-[4]:[clip-path:inset(0px_-10px_0px_0px)]'\n ]\n )}\n {...restProps}\n >\n {children}\n </div>\n )\n}\n"],"names":["TableStickyColumnsContainer","children","numberOfStickyColumns","className","restProps","hasScroll","setHasScroll","React","wrapperRef","columnsStyle","useStickyColumnsStyle","event","newHasScroll","clsx"],"mappings":"0GAKa,MAAAA,EAA8B,CAAC,CAC1C,SAAAC,EACA,sBAAAC,EAAwB,EACxB,UAAAC,EACA,GAAGC,CACL,IAGO,CACL,KAAM,CAACC,EAAWC,CAAY,EAAIC,EAAM,SAAkB,EAAK,EACzDC,EAAaD,EAAM,OAAO,IAAI,EAC9B,CAAE,aAAAE,CAAa,EAAIC,EAAsB,CAC7C,sBAAAR,EACA,WAAAM,CACF,CAAC,EASD,OACED,EAAA,cAAC,MAAA,CACC,SATkBI,GAAyC,CAC7D,MAAMC,EAAeD,EAAM,cAAc,WAAa,EAClDC,IAAiBP,GACnBC,EAAaM,CAAY,CAE7B,EAMI,KAAK,YACL,IAAKJ,EACL,MAAOC,EACP,UAAWI,EACT,gBACA,aACA,WACA,uBACA,yBACAV,EACAD,IAA0B,GAAK,CAC7B,qCACA,4DACA,0DACA,iCACF,EACAA,IAA0B,GAAK,CAC7B,qCACA,4DACA,0DACA,iCACF,EACAA,IAA0B,GAAK,CAC7B,qCACA,4DACA,0DACA,iCACF,EACAA,IAA0B,GAAK,CAC7B,qCACA,4DACA,0DACA,iCACF,EACAA,IAA0B,GACxBG,GAAa,CACX,gFACA,kEACF,EACFH,IAA0B,GACxBG,GAAa,CACX,gFACA,kEACF,EACFH,IAA0B,GACxBG,GAAa,CACX,gFACA,kEACF,EACFH,IAA0B,GACxBG,GAAa,CACX,gFACA,kEACF,CACJ,EACC,GAAGD,CAAAA,EAEHH,CACH,CAEJ"}
|