@liner-fe/prism 1.13.2 → 1.13.3

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.
@@ -1,17 +1,18 @@
1
1
  import { IconProps } from '../Icon';
2
- import { ReactNode } from 'react';
3
- interface ListRootProps {
2
+ import { LiHTMLAttributes, ReactNode } from 'react';
3
+ interface ListRootProps extends LiHTMLAttributes<HTMLUListElement> {
4
4
  children?: ReactNode;
5
5
  value?: string;
6
6
  onChangeValue?: (value: string) => void;
7
7
  }
8
8
  export interface ItemProps {
9
9
  value: string;
10
+ text: string;
10
11
  disabled?: boolean;
11
12
  icon?: IconProps;
12
13
  onClick?: () => void;
13
14
  }
14
- export declare const List: (({ children, ...props }: ListRootProps) => import("react/jsx-runtime").JSX.Element) & {
15
- Item: ({ value, disabled, icon, onClick }: ItemProps) => import("react/jsx-runtime").JSX.Element;
15
+ export declare const List: (({ children, className, ...props }: ListRootProps) => import("react/jsx-runtime").JSX.Element) & {
16
+ Item: ({ value, text, disabled, icon, onClick }: ItemProps) => import("react/jsx-runtime").JSX.Element;
16
17
  };
17
18
  export {};
package/lib/index.mjs CHANGED
@@ -8086,14 +8086,15 @@ var useCollectionContext = /* @__PURE__ */ __name(() => {
8086
8086
  }, "useCollectionContext");
8087
8087
 
8088
8088
  // src/components/List/index.tsx
8089
+ import clsx16 from "clsx";
8089
8090
  import { jsx as jsx159, jsxs as jsxs109 } from "react/jsx-runtime";
8090
- var ListRoot = /* @__PURE__ */ __name(({ children, ...props }) => {
8091
- return /* @__PURE__ */ jsx159(CollectionProvider, { ...props, children: /* @__PURE__ */ jsx159("ul", { className: style_module_default14.list, children }) });
8091
+ var ListRoot = /* @__PURE__ */ __name(({ children, className, ...props }) => {
8092
+ return /* @__PURE__ */ jsx159(CollectionProvider, { ...props, children: /* @__PURE__ */ jsx159("ul", { className: clsx16(style_module_default14.list, className), children }) });
8092
8093
  }, "ListRoot");
8093
- var Item3 = /* @__PURE__ */ __name(({ value, disabled, icon, onClick }) => {
8094
+ var Item3 = /* @__PURE__ */ __name(({ value, text, disabled, icon, onClick }) => {
8094
8095
  const [isFocused, setIsFocused] = useState5(false);
8095
- const context = useCollectionContext();
8096
- const isSelected = context.value === value;
8096
+ const { value: contextValue, onChangeValue } = useCollectionContext();
8097
+ const isSelected = contextValue === value;
8097
8098
  const iconProps = isSelected ? { name: "check-mark", type: "brand-label-primary", thick: true } : icon ? icon : {};
8098
8099
  return /* @__PURE__ */ jsxs109(
8099
8100
  "li",
@@ -8110,10 +8111,10 @@ var Item3 = /* @__PURE__ */ __name(({ value, disabled, icon, onClick }) => {
8110
8111
  onClick: (e) => {
8111
8112
  e.stopPropagation();
8112
8113
  onClick?.();
8113
- context.onChangeValue?.(value);
8114
+ onChangeValue?.(value);
8114
8115
  },
8115
8116
  children: [
8116
- /* @__PURE__ */ jsx159(Paragraph, { size: 3, type: "normal", weight: "medium", children: value }),
8117
+ /* @__PURE__ */ jsx159(Paragraph, { size: 3, type: "normal", weight: "medium", children: text }),
8117
8118
  (icon || isSelected) && /* @__PURE__ */ jsx159(Icon, { className: style_module_default14.icon, size: "xs", ...iconProps })
8118
8119
  ]
8119
8120
  }