@new-black/lyra 1.29.1-next.1 → 1.29.1-next.2
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/lyra1166.cjs +1 -1
- package/dist/lyra1166.cjs.map +1 -1
- package/dist/lyra1167.js +13 -9
- package/dist/lyra1167.js.map +1 -1
- package/package.json +1 -1
package/dist/lyra1166.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require("./lyra583.cjs"),t=require("./lyra749.cjs");require("./lyra750.cjs");const n=require("./lyra758.cjs");require("./lyra759.cjs");const r=require("./lyra795.cjs");require("./lyra1141.cjs");const i=require("./lyra1158.cjs"),a=require("./lyra1159.cjs"),o=require("./lyra1164.cjs"),s=require("./lyra1165.cjs");let c=require("react"),l=require("react/jsx-runtime");var u=t=>{let{items:n,parentNode:r,setItems:i}=t,{list:u}=a.sortableActiveListStyles(),f=(0,c.useCallback)(e=>{let t=n.map(t=>t.value===e.value?{...t,active:!t.active}:t);i(t)},[n,i]);return(0,l.jsx)(o.SortableContainer,{orientation:`vertical`,items:n,disableRestrictToParent:!0,setItems:e=>{i(e)},parentNode:r,overlay:t=>(0,l.jsx)(d,{label:t.label,endLabel:t?.endLabel,active:t.active,onToggleActive:e.noop,isDragging:!0,isSorting:!0,isOverlay:!0}),children:(0,l.jsx)(`div`,{className:u(),children:n.map(e=>(0,l.jsx)(s.SortableItem,{sortableId:e.value,children:({attributes:t,insertPosition:n,isDragging:r,isSorting:i,listeners:a})=>(0,l.jsx)(d,{attributes:t,active:e.active,onToggleActive:()=>f(e),isDragging:r,isSorting:i,listeners:a,insertPosition:n,label:e.label,endLabel:e?.endLabel})},e.value))})})},d=(0,c.forwardRef)((e,o)=>{let{active:s,attributes:u,endLabel:d,insertPosition:f,isDragging:p,isOverlay:m,label:h,listeners:g,onToggleActive:_}=e,v=i.useIsKeyboardSorting(),y=(0,c.useCallback)(e=>{p?g?.onKeyDown?.(e):e.key===`ArrowDown`?(e.currentTarget?.parentElement?.nextElementSibling?.firstElementChild)?.focus():e.key===`ArrowUp`?(e.currentTarget?.parentElement?.previousElementSibling?.firstElementChild)?.focus():e.key===`x`||e.key===`ArrowRight`||e.key===`ArrowLeft`?_():g?.onKeyDown?.(e)},[p,g,_]),{item:b}=a.sortableActiveListStyles();return v&&m?null:(0,l.jsxs)(`div`,{...u,...g,className:b({clone:m||!1,active:s,isDragging:p,isKeyboardSorting:v,insertPosition:f,className:`justify-between`}),ref:o,onKeyDown:y,children:[(0,l.jsxs)(`div`,{className:`flex gap-1`,children:[(0,l.jsx)(`div`,{className:`w-4`,children:(0,l.jsx)(t.SvgIcon,{name:`drag-handle`,className:`text-tertiary`})}),(0,l.jsx)(r.Checkbox,{isSelected:s,onChange:_,excludeFromTabOrder:!0}),(0,l.jsx)(n.Text,{className:`
|
|
1
|
+
const e=require("./lyra583.cjs"),t=require("./lyra749.cjs");require("./lyra750.cjs");const n=require("./lyra758.cjs");require("./lyra759.cjs");const r=require("./lyra795.cjs");require("./lyra1141.cjs");const i=require("./lyra1158.cjs"),a=require("./lyra1159.cjs"),o=require("./lyra1164.cjs"),s=require("./lyra1165.cjs");let c=require("react"),l=require("react/jsx-runtime");var u=t=>{let{items:n,parentNode:r,setItems:i}=t,{list:u}=a.sortableActiveListStyles(),f=(0,c.useCallback)(e=>{let t=n.map(t=>t.value===e.value?{...t,active:!t.active}:t);i(t)},[n,i]);return(0,l.jsx)(o.SortableContainer,{orientation:`vertical`,items:n,disableRestrictToParent:!0,setItems:e=>{i(e)},parentNode:r,overlay:t=>(0,l.jsx)(d,{label:t.label,endLabel:t?.endLabel,active:t.active,onToggleActive:e.noop,isDragging:!0,isSorting:!0,isOverlay:!0}),children:(0,l.jsx)(`div`,{className:u(),children:n.map(e=>(0,l.jsx)(s.SortableItem,{sortableId:e.value,children:({attributes:t,insertPosition:n,isDragging:r,isSorting:i,listeners:a})=>(0,l.jsx)(d,{attributes:t,active:e.active,onToggleActive:()=>f(e),isDragging:r,isSorting:i,listeners:a,insertPosition:n,label:e.label,endLabel:e?.endLabel})},e.value))})})},d=(0,c.forwardRef)((e,o)=>{let{active:s,attributes:u,endLabel:d,insertPosition:f,isDragging:p,isOverlay:m,label:h,listeners:g,onToggleActive:_}=e,v=i.useIsKeyboardSorting(),y=(0,c.useCallback)(e=>{p?g?.onKeyDown?.(e):e.key===`ArrowDown`?(e.currentTarget?.parentElement?.nextElementSibling?.firstElementChild)?.focus():e.key===`ArrowUp`?(e.currentTarget?.parentElement?.previousElementSibling?.firstElementChild)?.focus():e.key===`x`||e.key===`ArrowRight`||e.key===`ArrowLeft`?_():g?.onKeyDown?.(e)},[p,g,_]),{item:b}=a.sortableActiveListStyles();return v&&m?null:(0,l.jsxs)(`div`,{...u,...g,className:b({clone:m||!1,active:s,isDragging:p,isKeyboardSorting:v,insertPosition:f,className:`justify-between`}),ref:o,onKeyDown:y,children:[(0,l.jsxs)(`div`,{className:`flex min-w-0 gap-1`,children:[(0,l.jsx)(`div`,{className:`w-4 shrink-0`,children:(0,l.jsx)(t.SvgIcon,{name:`drag-handle`,className:`text-tertiary`})}),(0,l.jsx)(r.Checkbox,{isSelected:s,onChange:_,excludeFromTabOrder:!0}),(0,l.jsx)(n.Text,{className:`min-w-0 truncate`,color:s?`primary`:`tertiary`,title:h,children:h})]}),d&&(0,l.jsx)(`div`,{className:`shrink-0`,children:(0,l.jsx)(n.Text,{className:`whitespace-nowrap`,variant:`body-small`,color:s?`secondary`:`tertiary`,children:d})})]})});d.displayName=`ActiveListItem`,exports.SortableActiveList=u;
|
package/dist/lyra1166.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lyra1166.cjs","names":["sortableActiveListStyles","useCallback","SortableContainer","noop","SortableItem","forwardRef","useIsKeyboardSorting","SvgIcon","Checkbox","Text","require_helpers","require_svg_icon","require_text","require_checkbox","require_use_is_keyboard_sorting","require_sortable_styles","require_sortable_container","require_sortable_item","react","react_jsx_runtime","SortableActiveList","props","onToggle","newItems","items","clonedItem","item","setItems","ActiveListItem","list","isKeyboardSorting","onKeyDown","isDragging","listeners","onToggleActive","isOverlay","attributes","active","label","endLabel"],"sources":["../src/components/sortable/sortable-active-list.tsx"],"sourcesContent":["import { forwardRef, KeyboardEvent, useCallback } from \"react\";\n\nimport { noop } from \"../../utils/helpers\";\nimport { Checkbox } from \"../inputs\";\nimport { SvgIcon } from \"../svg-icon\";\nimport { Text } from \"../text\";\n\nimport { useIsKeyboardSorting } from \"./hooks/use-is-keyboard-sorting\";\nimport { sortableActiveListStyles } from \"./sortable.styles\";\nimport { ActiveListItemProps, SortableActiveListProps } from \"./sortable.types\";\nimport { SortableContainer } from \"./sortable-container\";\nimport { SortableItem } from \"./sortable-item\";\n\nexport const SortableActiveList = <\n T extends { value: string; label: string; active: boolean; endLabel?: string },\n>(\n props: SortableActiveListProps<T>,\n) => {\n const { items, parentNode, setItems } = props;\n const { list } = sortableActiveListStyles();\n const onToggle = useCallback(\n (item: T) => {\n const newItems = items.map((clonedItem) => {\n if (clonedItem.value === item.value) {\n return {\n ...clonedItem,\n active: !clonedItem.active,\n };\n }\n return clonedItem;\n });\n setItems(newItems);\n },\n [items, setItems],\n );\n return (\n <SortableContainer\n orientation=\"vertical\"\n items={items}\n disableRestrictToParent\n setItems={(newItems) => {\n setItems(newItems);\n }}\n parentNode={parentNode}\n overlay={(item) => (\n <ActiveListItem\n label={item.label}\n endLabel={item?.endLabel}\n active={item.active}\n onToggleActive={noop}\n isDragging\n isSorting\n isOverlay\n />\n )}\n >\n <div className={list()}>\n {items.map((item) => (\n <SortableItem key={item.value} sortableId={item.value}>\n {({ attributes, insertPosition, isDragging, isSorting, listeners }) => (\n <ActiveListItem\n attributes={attributes}\n active={item.active}\n onToggleActive={() => onToggle(item)}\n isDragging={isDragging}\n isSorting={isSorting}\n listeners={listeners}\n insertPosition={insertPosition}\n label={item.label}\n endLabel={item?.endLabel}\n />\n )}\n </SortableItem>\n ))}\n </div>\n </SortableContainer>\n );\n};\n\nconst ActiveListItem = forwardRef<HTMLDivElement, ActiveListItemProps>((props, ref) => {\n const {\n active,\n attributes,\n endLabel,\n insertPosition,\n isDragging,\n isOverlay,\n label,\n listeners,\n onToggleActive,\n } = props;\n const isKeyboardSorting = useIsKeyboardSorting();\n\n // Keydown listener to handle keyboard navigation on the list items.\n // ArrowDown: Focuses on the next list item.\n // ArrowUp: Focuses on the previous list item.\n // x: Toggles the active state of the list item.\n // ArrowRight: Toggles the active state of the list item.\n // ArrowLeft: Toggles the active state of the list item.\n const onKeyDown = useCallback(\n (e: KeyboardEvent) => {\n if (!isDragging) {\n if (e.key === \"ArrowDown\") {\n const nextElement = e.currentTarget?.parentElement?.nextElementSibling\n ?.firstElementChild as HTMLElement;\n nextElement?.focus();\n } else if (e.key === \"ArrowUp\") {\n const previousElement = e.currentTarget?.parentElement?.previousElementSibling\n ?.firstElementChild as HTMLElement;\n previousElement?.focus();\n } else if (e.key === \"x\" || e.key === \"ArrowRight\" || e.key === \"ArrowLeft\") {\n onToggleActive();\n } else {\n listeners?.onKeyDown?.(e);\n }\n } else {\n listeners?.onKeyDown?.(e);\n }\n },\n [isDragging, listeners, onToggleActive],\n );\n const { item } = sortableActiveListStyles();\n\n if (isKeyboardSorting && isOverlay) return null;\n\n return (\n <div\n {...attributes}\n {...listeners}\n className={item({\n clone: isOverlay || false,\n active,\n isDragging,\n isKeyboardSorting,\n insertPosition,\n className: \"justify-between\",\n })}\n ref={ref}\n onKeyDown={onKeyDown}\n >\n <div className=\"flex gap-1\">\n <div className=\"w-4\">\n <SvgIcon name=\"drag-handle\" className=\"text-tertiary\" />\n </div>\n <Checkbox isSelected={active} onChange={onToggleActive} excludeFromTabOrder />\n <Text className=\"
|
|
1
|
+
{"version":3,"file":"lyra1166.cjs","names":["sortableActiveListStyles","useCallback","SortableContainer","noop","SortableItem","forwardRef","useIsKeyboardSorting","SvgIcon","Checkbox","Text","require_helpers","require_svg_icon","require_text","require_checkbox","require_use_is_keyboard_sorting","require_sortable_styles","require_sortable_container","require_sortable_item","react","react_jsx_runtime","SortableActiveList","props","onToggle","newItems","items","clonedItem","item","setItems","ActiveListItem","list","isKeyboardSorting","onKeyDown","isDragging","listeners","onToggleActive","isOverlay","attributes","active","label","endLabel"],"sources":["../src/components/sortable/sortable-active-list.tsx"],"sourcesContent":["import { forwardRef, KeyboardEvent, useCallback } from \"react\";\n\nimport { noop } from \"../../utils/helpers\";\nimport { Checkbox } from \"../inputs\";\nimport { SvgIcon } from \"../svg-icon\";\nimport { Text } from \"../text\";\n\nimport { useIsKeyboardSorting } from \"./hooks/use-is-keyboard-sorting\";\nimport { sortableActiveListStyles } from \"./sortable.styles\";\nimport { ActiveListItemProps, SortableActiveListProps } from \"./sortable.types\";\nimport { SortableContainer } from \"./sortable-container\";\nimport { SortableItem } from \"./sortable-item\";\n\nexport const SortableActiveList = <\n T extends { value: string; label: string; active: boolean; endLabel?: string },\n>(\n props: SortableActiveListProps<T>,\n) => {\n const { items, parentNode, setItems } = props;\n const { list } = sortableActiveListStyles();\n const onToggle = useCallback(\n (item: T) => {\n const newItems = items.map((clonedItem) => {\n if (clonedItem.value === item.value) {\n return {\n ...clonedItem,\n active: !clonedItem.active,\n };\n }\n return clonedItem;\n });\n setItems(newItems);\n },\n [items, setItems],\n );\n return (\n <SortableContainer\n orientation=\"vertical\"\n items={items}\n disableRestrictToParent\n setItems={(newItems) => {\n setItems(newItems);\n }}\n parentNode={parentNode}\n overlay={(item) => (\n <ActiveListItem\n label={item.label}\n endLabel={item?.endLabel}\n active={item.active}\n onToggleActive={noop}\n isDragging\n isSorting\n isOverlay\n />\n )}\n >\n <div className={list()}>\n {items.map((item) => (\n <SortableItem key={item.value} sortableId={item.value}>\n {({ attributes, insertPosition, isDragging, isSorting, listeners }) => (\n <ActiveListItem\n attributes={attributes}\n active={item.active}\n onToggleActive={() => onToggle(item)}\n isDragging={isDragging}\n isSorting={isSorting}\n listeners={listeners}\n insertPosition={insertPosition}\n label={item.label}\n endLabel={item?.endLabel}\n />\n )}\n </SortableItem>\n ))}\n </div>\n </SortableContainer>\n );\n};\n\nconst ActiveListItem = forwardRef<HTMLDivElement, ActiveListItemProps>((props, ref) => {\n const {\n active,\n attributes,\n endLabel,\n insertPosition,\n isDragging,\n isOverlay,\n label,\n listeners,\n onToggleActive,\n } = props;\n const isKeyboardSorting = useIsKeyboardSorting();\n\n // Keydown listener to handle keyboard navigation on the list items.\n // ArrowDown: Focuses on the next list item.\n // ArrowUp: Focuses on the previous list item.\n // x: Toggles the active state of the list item.\n // ArrowRight: Toggles the active state of the list item.\n // ArrowLeft: Toggles the active state of the list item.\n const onKeyDown = useCallback(\n (e: KeyboardEvent) => {\n if (!isDragging) {\n if (e.key === \"ArrowDown\") {\n const nextElement = e.currentTarget?.parentElement?.nextElementSibling\n ?.firstElementChild as HTMLElement;\n nextElement?.focus();\n } else if (e.key === \"ArrowUp\") {\n const previousElement = e.currentTarget?.parentElement?.previousElementSibling\n ?.firstElementChild as HTMLElement;\n previousElement?.focus();\n } else if (e.key === \"x\" || e.key === \"ArrowRight\" || e.key === \"ArrowLeft\") {\n onToggleActive();\n } else {\n listeners?.onKeyDown?.(e);\n }\n } else {\n listeners?.onKeyDown?.(e);\n }\n },\n [isDragging, listeners, onToggleActive],\n );\n const { item } = sortableActiveListStyles();\n\n if (isKeyboardSorting && isOverlay) return null;\n\n return (\n <div\n {...attributes}\n {...listeners}\n className={item({\n clone: isOverlay || false,\n active,\n isDragging,\n isKeyboardSorting,\n insertPosition,\n className: \"justify-between\",\n })}\n ref={ref}\n onKeyDown={onKeyDown}\n >\n <div className=\"flex min-w-0 gap-1\">\n <div className=\"w-4 shrink-0\">\n <SvgIcon name=\"drag-handle\" className=\"text-tertiary\" />\n </div>\n <Checkbox isSelected={active} onChange={onToggleActive} excludeFromTabOrder />\n <Text className=\"min-w-0 truncate\" color={active ? \"primary\" : \"tertiary\"} title={label}>\n {label}\n </Text>\n </div>\n {endLabel && (\n <div className=\"shrink-0\">\n <Text\n className=\"whitespace-nowrap\"\n variant=\"body-small\"\n color={active ? \"secondary\" : \"tertiary\"}\n >\n {endLabel}\n </Text>\n </div>\n )}\n </div>\n );\n});\n\nActiveListItem.displayName = \"ActiveListItem\";\n"],"mappings":"A,sXAaA,IAAaoB,EAGX,GACG,CACH,GAAM,CAAE,QAAO,aAAY,YAAaC,EAClC,CAAE,QAASrB,EAAAA,yBAAyB,EACpCsB,GAAA,EAAWrB,EAAAA,YAAAA,CACd,GAAY,CACX,IAAMsB,EAAWC,EAAM,IAAK,GACtBC,EAAW,QAAUC,EAAK,MACrB,CACL,GAAGD,EACH,OAAQ,CAACA,EAAW,MACtB,EAEKA,CACR,EACDE,EAASJ,CAAQ,CACnB,EACA,CAACC,EAAOG,CAAQ,CAClB,EACA,OACE,EAAAR,EAAA,IAAA,CAACjB,EAAAA,kBAAD,CACE,YAAY,WACL,QACP,wBAAA,GACA,SAAW,GAAa,CACtByB,EAASJ,CAAQ,CACnB,EACY,aACZ,QAAU,IACR,EAAAJ,EAAA,IAAA,CAACS,EAAD,CACE,MAAOF,EAAK,MACZ,SAAUA,GAAM,SAChB,OAAQA,EAAK,OACb,eAAgBvB,EAAAA,KAChB,WAAA,GACA,UAAA,GACA,UAAA,EACD,CAAA,EAGH,UAAA,EAAAgB,EAAA,IAAA,CAAC,MAAD,CAAK,UAAWU,EAAK,EAClB,SAAAL,EAAM,IAAK,IACV,EAAAL,EAAA,IAAA,CAACf,EAAAA,aAAD,CAA+B,WAAYsB,EAAK,MAC5C,UAAA,CAAE,aAAY,iBAAgB,aAAY,YAAW,gBACrD,EAAAP,EAAA,IAAA,CAACS,EAAD,CACc,aACZ,OAAQF,EAAK,OACb,mBAAsBJ,EAASI,CAAI,EACvB,aACD,YACA,YACK,iBAChB,MAAOA,EAAK,MACZ,SAAUA,GAAM,QACjB,CAAA,CAES,EAdKA,EAAK,KAcV,CACf,CACE,CAAA,CACY,CAAA,CAEvB,EAEME,GAAA,EAAiBvB,EAAA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WACb,UAAA,EAAAA,EAAA,IAAA,CAACV,EAAAA,KAAD,CACE,UAAU,oBACV,QAAQ,aACR,MAAO4B,EAAS,YAAc,WAE7B,SAAAE,CACG,CAAA,CACH,CAAA,CAEJ,C,EAET,CAAC,EAED,EAAe,YAAc,iB"}
|
package/dist/lyra1167.js
CHANGED
|
@@ -77,10 +77,10 @@ var f = (t) => {
|
|
|
77
77
|
ref: o,
|
|
78
78
|
onKeyDown: b,
|
|
79
79
|
children: [/* @__PURE__ */ d("div", {
|
|
80
|
-
className: "flex gap-1",
|
|
80
|
+
className: "flex min-w-0 gap-1",
|
|
81
81
|
children: [
|
|
82
82
|
/* @__PURE__ */ u("div", {
|
|
83
|
-
className: "w-4",
|
|
83
|
+
className: "w-4 shrink-0",
|
|
84
84
|
children: /* @__PURE__ */ u(t, {
|
|
85
85
|
name: "drag-handle",
|
|
86
86
|
className: "text-tertiary"
|
|
@@ -92,17 +92,21 @@ var f = (t) => {
|
|
|
92
92
|
excludeFromTabOrder: !0
|
|
93
93
|
}),
|
|
94
94
|
/* @__PURE__ */ u(n, {
|
|
95
|
-
className: "
|
|
95
|
+
className: "min-w-0 truncate",
|
|
96
96
|
color: s ? "primary" : "tertiary",
|
|
97
|
+
title: g,
|
|
97
98
|
children: g
|
|
98
99
|
})
|
|
99
100
|
]
|
|
100
|
-
}), f && /* @__PURE__ */ u("div", {
|
|
101
|
-
className: "
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
101
|
+
}), f && /* @__PURE__ */ u("div", {
|
|
102
|
+
className: "shrink-0",
|
|
103
|
+
children: /* @__PURE__ */ u(n, {
|
|
104
|
+
className: "whitespace-nowrap",
|
|
105
|
+
variant: "body-small",
|
|
106
|
+
color: s ? "secondary" : "tertiary",
|
|
107
|
+
children: f
|
|
108
|
+
})
|
|
109
|
+
})]
|
|
106
110
|
});
|
|
107
111
|
});
|
|
108
112
|
p.displayName = "ActiveListItem";
|
package/dist/lyra1167.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lyra1167.js","names":["SortableActiveList","props","sortableActiveListStyles","onToggle","useCallback","newItems","items","clonedItem","item","setItems","SortableContainer","ActiveListItem","noop","list","SortableItem","forwardRef","isKeyboardSorting","useIsKeyboardSorting","onKeyDown","isDragging","listeners","onToggleActive","isOverlay","attributes","SvgIcon","Checkbox","active","Text","label","endLabel"],"sources":["../src/components/sortable/sortable-active-list.tsx"],"sourcesContent":["import { forwardRef, KeyboardEvent, useCallback } from \"react\";\n\nimport { noop } from \"../../utils/helpers\";\nimport { Checkbox } from \"../inputs\";\nimport { SvgIcon } from \"../svg-icon\";\nimport { Text } from \"../text\";\n\nimport { useIsKeyboardSorting } from \"./hooks/use-is-keyboard-sorting\";\nimport { sortableActiveListStyles } from \"./sortable.styles\";\nimport { ActiveListItemProps, SortableActiveListProps } from \"./sortable.types\";\nimport { SortableContainer } from \"./sortable-container\";\nimport { SortableItem } from \"./sortable-item\";\n\nexport const SortableActiveList = <\n T extends { value: string; label: string; active: boolean; endLabel?: string },\n>(\n props: SortableActiveListProps<T>,\n) => {\n const { items, parentNode, setItems } = props;\n const { list } = sortableActiveListStyles();\n const onToggle = useCallback(\n (item: T) => {\n const newItems = items.map((clonedItem) => {\n if (clonedItem.value === item.value) {\n return {\n ...clonedItem,\n active: !clonedItem.active,\n };\n }\n return clonedItem;\n });\n setItems(newItems);\n },\n [items, setItems],\n );\n return (\n <SortableContainer\n orientation=\"vertical\"\n items={items}\n disableRestrictToParent\n setItems={(newItems) => {\n setItems(newItems);\n }}\n parentNode={parentNode}\n overlay={(item) => (\n <ActiveListItem\n label={item.label}\n endLabel={item?.endLabel}\n active={item.active}\n onToggleActive={noop}\n isDragging\n isSorting\n isOverlay\n />\n )}\n >\n <div className={list()}>\n {items.map((item) => (\n <SortableItem key={item.value} sortableId={item.value}>\n {({ attributes, insertPosition, isDragging, isSorting, listeners }) => (\n <ActiveListItem\n attributes={attributes}\n active={item.active}\n onToggleActive={() => onToggle(item)}\n isDragging={isDragging}\n isSorting={isSorting}\n listeners={listeners}\n insertPosition={insertPosition}\n label={item.label}\n endLabel={item?.endLabel}\n />\n )}\n </SortableItem>\n ))}\n </div>\n </SortableContainer>\n );\n};\n\nconst ActiveListItem = forwardRef<HTMLDivElement, ActiveListItemProps>((props, ref) => {\n const {\n active,\n attributes,\n endLabel,\n insertPosition,\n isDragging,\n isOverlay,\n label,\n listeners,\n onToggleActive,\n } = props;\n const isKeyboardSorting = useIsKeyboardSorting();\n\n // Keydown listener to handle keyboard navigation on the list items.\n // ArrowDown: Focuses on the next list item.\n // ArrowUp: Focuses on the previous list item.\n // x: Toggles the active state of the list item.\n // ArrowRight: Toggles the active state of the list item.\n // ArrowLeft: Toggles the active state of the list item.\n const onKeyDown = useCallback(\n (e: KeyboardEvent) => {\n if (!isDragging) {\n if (e.key === \"ArrowDown\") {\n const nextElement = e.currentTarget?.parentElement?.nextElementSibling\n ?.firstElementChild as HTMLElement;\n nextElement?.focus();\n } else if (e.key === \"ArrowUp\") {\n const previousElement = e.currentTarget?.parentElement?.previousElementSibling\n ?.firstElementChild as HTMLElement;\n previousElement?.focus();\n } else if (e.key === \"x\" || e.key === \"ArrowRight\" || e.key === \"ArrowLeft\") {\n onToggleActive();\n } else {\n listeners?.onKeyDown?.(e);\n }\n } else {\n listeners?.onKeyDown?.(e);\n }\n },\n [isDragging, listeners, onToggleActive],\n );\n const { item } = sortableActiveListStyles();\n\n if (isKeyboardSorting && isOverlay) return null;\n\n return (\n <div\n {...attributes}\n {...listeners}\n className={item({\n clone: isOverlay || false,\n active,\n isDragging,\n isKeyboardSorting,\n insertPosition,\n className: \"justify-between\",\n })}\n ref={ref}\n onKeyDown={onKeyDown}\n >\n <div className=\"flex gap-1\">\n <div className=\"w-4\">\n <SvgIcon name=\"drag-handle\" className=\"text-tertiary\" />\n </div>\n <Checkbox isSelected={active} onChange={onToggleActive} excludeFromTabOrder />\n <Text className=\"
|
|
1
|
+
{"version":3,"file":"lyra1167.js","names":["SortableActiveList","props","sortableActiveListStyles","onToggle","useCallback","newItems","items","clonedItem","item","setItems","SortableContainer","ActiveListItem","noop","list","SortableItem","forwardRef","isKeyboardSorting","useIsKeyboardSorting","onKeyDown","isDragging","listeners","onToggleActive","isOverlay","attributes","SvgIcon","Checkbox","active","Text","label","endLabel"],"sources":["../src/components/sortable/sortable-active-list.tsx"],"sourcesContent":["import { forwardRef, KeyboardEvent, useCallback } from \"react\";\n\nimport { noop } from \"../../utils/helpers\";\nimport { Checkbox } from \"../inputs\";\nimport { SvgIcon } from \"../svg-icon\";\nimport { Text } from \"../text\";\n\nimport { useIsKeyboardSorting } from \"./hooks/use-is-keyboard-sorting\";\nimport { sortableActiveListStyles } from \"./sortable.styles\";\nimport { ActiveListItemProps, SortableActiveListProps } from \"./sortable.types\";\nimport { SortableContainer } from \"./sortable-container\";\nimport { SortableItem } from \"./sortable-item\";\n\nexport const SortableActiveList = <\n T extends { value: string; label: string; active: boolean; endLabel?: string },\n>(\n props: SortableActiveListProps<T>,\n) => {\n const { items, parentNode, setItems } = props;\n const { list } = sortableActiveListStyles();\n const onToggle = useCallback(\n (item: T) => {\n const newItems = items.map((clonedItem) => {\n if (clonedItem.value === item.value) {\n return {\n ...clonedItem,\n active: !clonedItem.active,\n };\n }\n return clonedItem;\n });\n setItems(newItems);\n },\n [items, setItems],\n );\n return (\n <SortableContainer\n orientation=\"vertical\"\n items={items}\n disableRestrictToParent\n setItems={(newItems) => {\n setItems(newItems);\n }}\n parentNode={parentNode}\n overlay={(item) => (\n <ActiveListItem\n label={item.label}\n endLabel={item?.endLabel}\n active={item.active}\n onToggleActive={noop}\n isDragging\n isSorting\n isOverlay\n />\n )}\n >\n <div className={list()}>\n {items.map((item) => (\n <SortableItem key={item.value} sortableId={item.value}>\n {({ attributes, insertPosition, isDragging, isSorting, listeners }) => (\n <ActiveListItem\n attributes={attributes}\n active={item.active}\n onToggleActive={() => onToggle(item)}\n isDragging={isDragging}\n isSorting={isSorting}\n listeners={listeners}\n insertPosition={insertPosition}\n label={item.label}\n endLabel={item?.endLabel}\n />\n )}\n </SortableItem>\n ))}\n </div>\n </SortableContainer>\n );\n};\n\nconst ActiveListItem = forwardRef<HTMLDivElement, ActiveListItemProps>((props, ref) => {\n const {\n active,\n attributes,\n endLabel,\n insertPosition,\n isDragging,\n isOverlay,\n label,\n listeners,\n onToggleActive,\n } = props;\n const isKeyboardSorting = useIsKeyboardSorting();\n\n // Keydown listener to handle keyboard navigation on the list items.\n // ArrowDown: Focuses on the next list item.\n // ArrowUp: Focuses on the previous list item.\n // x: Toggles the active state of the list item.\n // ArrowRight: Toggles the active state of the list item.\n // ArrowLeft: Toggles the active state of the list item.\n const onKeyDown = useCallback(\n (e: KeyboardEvent) => {\n if (!isDragging) {\n if (e.key === \"ArrowDown\") {\n const nextElement = e.currentTarget?.parentElement?.nextElementSibling\n ?.firstElementChild as HTMLElement;\n nextElement?.focus();\n } else if (e.key === \"ArrowUp\") {\n const previousElement = e.currentTarget?.parentElement?.previousElementSibling\n ?.firstElementChild as HTMLElement;\n previousElement?.focus();\n } else if (e.key === \"x\" || e.key === \"ArrowRight\" || e.key === \"ArrowLeft\") {\n onToggleActive();\n } else {\n listeners?.onKeyDown?.(e);\n }\n } else {\n listeners?.onKeyDown?.(e);\n }\n },\n [isDragging, listeners, onToggleActive],\n );\n const { item } = sortableActiveListStyles();\n\n if (isKeyboardSorting && isOverlay) return null;\n\n return (\n <div\n {...attributes}\n {...listeners}\n className={item({\n clone: isOverlay || false,\n active,\n isDragging,\n isKeyboardSorting,\n insertPosition,\n className: \"justify-between\",\n })}\n ref={ref}\n onKeyDown={onKeyDown}\n >\n <div className=\"flex min-w-0 gap-1\">\n <div className=\"w-4 shrink-0\">\n <SvgIcon name=\"drag-handle\" className=\"text-tertiary\" />\n </div>\n <Checkbox isSelected={active} onChange={onToggleActive} excludeFromTabOrder />\n <Text className=\"min-w-0 truncate\" color={active ? \"primary\" : \"tertiary\"} title={label}>\n {label}\n </Text>\n </div>\n {endLabel && (\n <div className=\"shrink-0\">\n <Text\n className=\"whitespace-nowrap\"\n variant=\"body-small\"\n color={active ? \"secondary\" : \"tertiary\"}\n >\n {endLabel}\n </Text>\n </div>\n )}\n </div>\n );\n});\n\nActiveListItem.displayName = \"ActiveListItem\";\n"],"mappings":";;;;;;;;;;;;;;AAaA,IAAaA,KAGX,MACG;CACH,IAAM,EAAE,UAAO,eAAY,gBAAaC,GAClC,EAAE,YAASC,EAAyB,GACpCC,IAAWC,GACd,MAAY;EACX,IAAMC,IAAWC,EAAM,KAAK,MACtBC,EAAW,UAAUC,EAAK,QACrB;GACL,GAAGD;GACH,QAAQ,CAACA,EAAW;EACtB,IAEKA,CACR;EACD,EAASF,CAAQ;CACnB,GACA,CAACC,GAAOG,CAAQ,CAClB;CACA,OACE,kBAACC,GAAD;EACE,aAAY;EACL;EACP,yBAAA;EACA,WAAW,MAAa;GACtB,EAASL,CAAQ;EACnB;EACY;EACZ,UAAU,MACR,kBAACM,GAAD;GACE,OAAOH,EAAK;GACZ,UAAUA,GAAM;GAChB,QAAQA,EAAK;GACb,gBAAgBI;GAChB,YAAA;GACA,WAAA;GACA,WAAA;EACD,CAAA;EAGH,UAAA,kBAAC,OAAD;GAAK,WAAWC,EAAK;GAClB,UAAAP,EAAM,KAAK,MACV,kBAACQ,GAAD;IAA+B,YAAYN,EAAK;IAC5C,WAAA,EAAE,eAAY,mBAAgB,eAAY,cAAW,mBACrD,kBAACG,GAAD;KACc;KACZ,QAAQH,EAAK;KACb,sBAAsBL,EAASK,CAAI;KACvB;KACD;KACA;KACK;KAChB,OAAOA,EAAK;KACZ,UAAUA,GAAM;IACjB,CAAA;GAES,GAdKA,EAAK,KAcV,CACf;EACE,CAAA;CACY,CAAA;AAEvB,GAEMG,IAAiBI,GAAiD,GAAO,MAAQ;CACrF,IAAM,EACJ,WACA,eACA,aACA,mBACA,eACA,cACA,UACA,cACA,sBACEd,GACEe,IAAoBC,EAAqB,GAQz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