@liner-fe/prism 1.13.25 → 1.13.26

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.
@@ -0,0 +1 @@
1
+ export declare const ampLogEventFunc: import("recoil").RecoilState<((title: string, properties?: any, callback?: undefined) => Promise<undefined>) | null>;
@@ -37,7 +37,9 @@ export interface TextButtonProps extends CommonButtonProps, VariantProps<typeof
37
37
  asChild?: boolean;
38
38
  level?: TextLevelType;
39
39
  }
40
- export type ButtonProps = DefaultButtonProps<FillType> | TextButtonProps;
40
+ export type ButtonProps = (DefaultButtonProps<FillType> | TextButtonProps) & {
41
+ elementName?: string;
42
+ };
41
43
  export declare const DefaultButton: import("react").ForwardRefExoticComponent<DefaultButtonProps<boolean> & import("react").RefAttributes<HTMLButtonElement>>;
42
44
  export declare const TextButton: import("react").ForwardRefExoticComponent<TextButtonProps & import("react").RefAttributes<HTMLButtonElement>>;
43
45
  export declare const Button: import("react").ForwardRefExoticComponent<ButtonProps & import("react").RefAttributes<HTMLButtonElement>>;
package/lib/index.d.ts CHANGED
@@ -15,3 +15,4 @@ export * from './components/Select';
15
15
  export * from './components/List';
16
16
  export * from './types/color';
17
17
  export * from './type/index';
18
+ export * from './PrismProvider';
package/lib/index.mjs CHANGED
@@ -6946,6 +6946,16 @@ var Icon = /* @__PURE__ */ __name((props) => {
6946
6946
  );
6947
6947
  }, "Icon");
6948
6948
 
6949
+ // src/components/Button/index.tsx
6950
+ import { useRecoilValue } from "recoil";
6951
+
6952
+ // src/PrismProvider.tsx
6953
+ import { atom } from "recoil";
6954
+ var ampLogEventFunc = atom({
6955
+ key: "ampLogEventFunc",
6956
+ default: null
6957
+ });
6958
+
6949
6959
  // src/components/Button/index.tsx
6950
6960
  import { jsx as jsx144, jsxs as jsxs103 } from "react/jsx-runtime";
6951
6961
  var buttonIconSizeMap = {
@@ -7064,18 +7074,47 @@ var TextButton = forwardRef(
7064
7074
  }
7065
7075
  );
7066
7076
  var Button = forwardRef((props, ref) => {
7067
- switch (props.as) {
7077
+ const ampLogEvent = useRecoilValue(ampLogEventFunc);
7078
+ const { elementName, ...rest } = props;
7079
+ switch (rest.as) {
7068
7080
  case "default":
7069
7081
  case void 0:
7070
- return /* @__PURE__ */ jsx144(DefaultButton, { ...props, ref });
7082
+ return /* @__PURE__ */ jsx144(
7083
+ DefaultButton,
7084
+ {
7085
+ ...rest,
7086
+ onClick: (e) => {
7087
+ if (ampLogEvent) {
7088
+ ampLogEvent(`click_${elementName}_button`, {
7089
+ button_text: rest.children?.toString(),
7090
+ ...rest.leftIcon?.name || rest.rightIcon?.name ? { button_icon: rest.leftIcon?.name || rest.rightIcon?.name } : {}
7091
+ });
7092
+ }
7093
+ props.onClick?.(e);
7094
+ },
7095
+ ref
7096
+ }
7097
+ );
7071
7098
  case "text":
7072
- return /* @__PURE__ */ jsx144(TextButton, { ...props, ref });
7099
+ return /* @__PURE__ */ jsx144(
7100
+ TextButton,
7101
+ {
7102
+ ...rest,
7103
+ onClick: (e) => {
7104
+ if (ampLogEvent) {
7105
+ ampLogEvent(`click_${elementName}_button`, { button_text: rest.children?.toString() });
7106
+ }
7107
+ props.onClick?.(e);
7108
+ },
7109
+ ref
7110
+ }
7111
+ );
7073
7112
  }
7074
7113
  });
7075
7114
 
7076
7115
  // src/components/Toast/hooks/useToast.ts
7077
- import { atom, useSetRecoilState } from "recoil";
7078
- var toastAtom = atom({
7116
+ import { atom as atom2, useSetRecoilState } from "recoil";
7117
+ var toastAtom = atom2({
7079
7118
  default: { list: [] },
7080
7119
  key: "toastAtoms"
7081
7120
  });
@@ -7183,7 +7222,7 @@ var Paragraph = forwardRef2(
7183
7222
  );
7184
7223
 
7185
7224
  // src/components/Toast/index.tsx
7186
- import { useRecoilValue, useSetRecoilState as useSetRecoilState2 } from "recoil";
7225
+ import { useRecoilValue as useRecoilValue2, useSetRecoilState as useSetRecoilState2 } from "recoil";
7187
7226
  import Lottie from "lottie-web";
7188
7227
 
7189
7228
  // src/lottie/loading.json
@@ -7663,7 +7702,7 @@ var loading_default = {
7663
7702
  import { jsx as jsx146, jsxs as jsxs104 } from "react/jsx-runtime";
7664
7703
  import { createElement } from "react";
7665
7704
  var Toaster = /* @__PURE__ */ __name(() => {
7666
- const { list } = useRecoilValue(toastAtom);
7705
+ const { list } = useRecoilValue2(toastAtom);
7667
7706
  return /* @__PURE__ */ jsxs104(Provider, { children: [
7668
7707
  list.map((props) => /* @__PURE__ */ createElement(SingleToast, { ...props, key: props.toastId })),
7669
7708
  /* @__PURE__ */ jsx146(Viewport, { className: style_module_default3.ToastViewport })
@@ -8759,6 +8798,7 @@ export {
8759
8798
  Toaster,
8760
8799
  Tooltip,
8761
8800
  Typography,
8801
+ ampLogEventFunc,
8762
8802
  arrayToStyleObject,
8763
8803
  colorKeys,
8764
8804
  getIconComponent,