@liner-fe/prism 2.1.56 → 2.1.57

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/lib/index.d.ts CHANGED
@@ -7,6 +7,8 @@ import * as react_jsx_runtime from 'react/jsx-runtime';
7
7
  import { ToastProps } from '@radix-ui/react-toast';
8
8
  import * as _artsy_fresnel_dist_Media from '@artsy/fresnel/dist/Media';
9
9
  import { Popover as Popover$1, Tooltip as Tooltip$1, Checkbox as Checkbox$1, RadioGroup, Slider as Slider$1, Select as Select$1, Label as Label$1 } from 'radix-ui';
10
+ import { ImageProps } from 'next/image';
11
+ import { Property } from 'csstype';
10
12
 
11
13
  interface IconComponentProps {
12
14
  className?: string;
@@ -519,4 +521,27 @@ interface LoadingProps {
519
521
  }
520
522
  declare const Loading: ({ size, level }: LoadingProps) => react_jsx_runtime.JSX.Element;
521
523
 
522
- export { type BasicColorType, type BreakPointsKey, Button, type ButtonIconProps, type ButtonProps, type ButtonSizeType, Caption, Checkbox, type CommonButtonProps, DefaultButton, type DefaultButtonProps, Display, type FillFalseLevelType, type FillLevelType, type FillType, Heading, type ICaptionProps, type IDisplayProps, type IHeadingProps, type IPropsAccent, type IPropsAnswer, type IPropsNormal, type IPropsPost, type ITitleProps, Icon, IconButton, type IconButtonLevelType, type IconButtonProps, type IconColorType, type IconComponent, type IconComponentProps, type IconKey, type IconMapType, type IconProps, type IconSizeKey, type IconSizeType, type ItemProps, Label, List, Loading, Media, MediaContextProvider, Paragraph, type ParagraphProps, Popover, type PopoverContentProps, Radio, Select, type SelectItemProps, type SelectProps, Slider, TextButton, type TextButtonProps, Textfield, type TextfieldButtonProps, type TextfieldLabelType, type TextfieldProps, Title, Toaster, Tooltip, Typography, arrayToStyleObject, colorKeys, getIconComponent, iconKeyOptions, iconMap, isEmptyObject, objectToArray, rootMediaStyle, useToast };
524
+ type LightIllustType = "decoration-airplane-1_1" | "decoration-bulb-1_1" | "decoration-car-1_1" | "decoration-coffee-1_1" | "decoration-english-1_1" | "decoration-flag-1_1" | "decoration-hourglass-1_1" | "decoration-money-1_1" | "decoration-palm-1_1" | "decoration-rocket-1_1" | "decoration-shake_hands-1_1" | "decoration-star_01-1_1" | "decoration-star_02-1_1" | "decoration-star_03-1_1" | "decoration-star_04-1_1" | "decoration-star_05-1_1" | "decoration-star_06-1_1" | "decoration-star_07-1_1" | "decoration-star_08-1_1" | "decoration-star_09-1_1" | "decoration-star_10-1_1" | "decoration-star_11-1_1" | "decoration-tennis-1_1" | "object-bomb-1_1" | "object-book_pencil-4_3" | "object-brain-1_1" | "object-clap-1_1" | "object-documents_02-1_1" | "object-empty_box-1_1" | "object-empty_box-4_3" | "object-feather_pen-1_1" | "object-folder_01-1_1" | "object-folder_02-1_1" | "object-free_ticket-1_1" | "object-gift-1_1" | "object-give_gift-1_1" | "object-graduation_cap_pencil-4_3" | "object-lock-4_3" | "object-magnifying_glass-1_1" | "object-magnifying_glass-4_3" | "object-megaphone-1_1" | "object-paper-1_1" | "object-pencil_paper-16_9" | "object-puzzle-4_3" | "object-smoke-16_9" | "object-university_01-1_1" | "object-university_02-1_1" | "object_documents_01-1_1" | "object_find_man-1_1" | "person-ai_writing-1_1" | "person-bye-4_3" | "person-cheerup-16_9" | "person-cheerup-4_3" | "person-holding_a_book-1_1" | "person-introduce-1_1" | "person-introduce-pro-1_1" | "person-make_profile-1_1" | "person-raining-1_1" | "person-searching-16_9" | "person-searching_01-1_1" | "person-searching_01-4_3" | "person-searching_02-1_1" | "person-space_in_work-4_3" | "person-standing_with_a_star-16_9" | "person-time_out_01-1_1" | "person-time_out_02-1_1" | "person-time_out_03-1_1" | "person-time_out_04-1_1" | "person-time_out_05-1_1" | "person-understand-1_1" | "person-working_01-4_3" | "person-working_02-4_3" | "person-worried-1_1" | "person-worried_01-4_3" | "person-worried_02-4_3" | "person-worried_03-4_3" | "person-worried_04-4_3" | "person-writing_01-1_1" | "person-writing_02-1_1";
525
+ type DarkIllustType = "decoration-airplane-1_1" | "decoration-bulb-1_1" | "decoration-car-1_1" | "decoration-flag-1_1" | "decoration-hourglass-1_1" | "decoration-rocket-1_1" | "decoration-star_01-1_1" | "decoration-star_02-1_1" | "decoration-star_03-1_1" | "decoration-star_04-1_1" | "decoration-star_05-1_1" | "decoration-star_06-1_1" | "decoration-star_07-1_1" | "decoration-star_08-1_1" | "decoration-star_09-1_1" | "decoration-star_10-1_1" | "decoration-star_11-1_1" | "object-bomb-1_1" | "object-brain-1_1" | "object-clap-1_1" | "object-documents_02-1_1" | "object-empty_box-1_1" | "object-empty_box-4_3" | "object-folder_01-1_1" | "object-folder_02-1_1" | "object-free_ticket-1_1" | "object-gift-1_1" | "object-give_gift-1_1" | "object-graduation_cap_pencil-4_3" | "object-lock-4_3" | "object-magnifying_glass-1_1" | "object-magnifying_glass-4_3" | "object-megaphone-1_1" | "object-paper-1_1" | "object-pencil_paper-16_9" | "object-puzzle-4_3" | "object-smoke-16_9" | "object_documents_01-1_1" | "object_find_man-1_1" | "person-bye-4_3" | "person-holding_a_book-1_1" | "person-introduce-1_1" | "person-introduce-pro-1_1" | "person-make_profile-1_1" | "person-raining-1_1" | "person-searching-16_9" | "person-searching_01-1_1" | "person-searching_01-4_3" | "person-searching_02-1_1" | "person-space_in_work-4_3" | "person-standing_with_a_star-16_9" | "person-time_out_01-1_1" | "person-time_out_02-1_1" | "person-time_out_03-1_1" | "person-time_out_04-1_1" | "person-time_out_05-1_1" | "person-working_01-4_3" | "person-worried-1_1" | "person-worried_01-4_3" | "person-worried_02-4_3" | "person-worried_03-4_3" | "person-worried_04-4_3" | "person-writing_01-1_1";
526
+ type IllustType = DarkIllustType | LightIllustType;
527
+
528
+ interface Source<T extends false | true = true> {
529
+ name: IllustType;
530
+ inverse?: T;
531
+ }
532
+ interface IProps extends Omit<ImageProps, 'alt' | 'width' | 'height' | 'fill' | 'src'> {
533
+ width: number;
534
+ src: {
535
+ light: Source<false>;
536
+ dark?: Source;
537
+ };
538
+ margin?: Property.Margin<string>;
539
+ }
540
+ declare const Illust: (props: IProps) => react_jsx_runtime.JSX.Element;
541
+
542
+ declare const prefetchIllust: ({ name, isDark }: {
543
+ name: IllustType;
544
+ isDark?: boolean;
545
+ }) => Promise<Response>;
546
+
547
+ export { type BasicColorType, type BreakPointsKey, Button, type ButtonIconProps, type ButtonProps, type ButtonSizeType, Caption, Checkbox, type CommonButtonProps, DefaultButton, type DefaultButtonProps, Display, type FillFalseLevelType, type FillLevelType, type FillType, Heading, type ICaptionProps, type IDisplayProps, type IHeadingProps, type IPropsAccent, type IPropsAnswer, type IPropsNormal, type IPropsPost, type ITitleProps, Icon, IconButton, type IconButtonLevelType, type IconButtonProps, type IconColorType, type IconComponent, type IconComponentProps, type IconKey, type IconMapType, type IconProps, type IconSizeKey, type IconSizeType, Illust, type ItemProps, Label, List, Loading, Media, MediaContextProvider, Paragraph, type ParagraphProps, Popover, type PopoverContentProps, Radio, Select, type SelectItemProps, type SelectProps, Slider, type Source, TextButton, type TextButtonProps, Textfield, type TextfieldButtonProps, type TextfieldLabelType, type TextfieldProps, Title, Toaster, Tooltip, Typography, arrayToStyleObject, colorKeys, getIconComponent, iconKeyOptions, iconMap, isEmptyObject, objectToArray, prefetchIllust, rootMediaStyle, useToast };
package/lib/index.js CHANGED
@@ -11686,6 +11686,89 @@ var Item = /* @__PURE__ */ __name(({ value, text, disabled, icon, onClick }) =>
11686
11686
  );
11687
11687
  }, "Item");
11688
11688
  var List = Object.assign(ListRoot, { Item });
11689
+
11690
+ // src/constants/illust/size.ts
11691
+ var ratio = { "16:9": { width: 1344, height: 756 }, "4:3": { width: 1008, height: 756 } };
11692
+ var illustSize = {
11693
+ "object-pencil_paper-16_9": ratio["16:9"],
11694
+ "object-smoke-16_9": ratio["16:9"],
11695
+ "person-standing_with_a_star-16_9": ratio["16:9"],
11696
+ "person-searching-16_9": ratio["16:9"],
11697
+ "person-cheerup-16_9": ratio["16:9"],
11698
+ "object-graduation_cap_pencil-4_3": ratio["4:3"],
11699
+ "object-book_pencil-4_3": ratio["4:3"],
11700
+ "object-puzzle-4_3": ratio["4:3"],
11701
+ "object-magnifying_glass-4_3": ratio["4:3"],
11702
+ "object-lock-4_3": ratio["4:3"],
11703
+ "object-empty_box-4_3": ratio["4:3"],
11704
+ "person-working_01-4_3": ratio["4:3"],
11705
+ "person-searching_01-4_3": ratio["4:3"],
11706
+ "person-worried_01-4_3": ratio["4:3"],
11707
+ "person-worried_02-4_3": ratio["4:3"],
11708
+ "person-worried_03-4_3": ratio["4:3"],
11709
+ "person-worried_04-4_3": ratio["4:3"],
11710
+ "person-working_02-4_3": ratio["4:3"],
11711
+ "person-bye-4_3": ratio["4:3"],
11712
+ "person-space_in_work-4_3": ratio["4:3"],
11713
+ "person-cheerup-4_3": ratio["4:3"]
11714
+ };
11715
+
11716
+ // src/components/Illust/index.tsx
11717
+ import Image from "next/image";
11718
+
11719
+ // src/constants/illust/path.ts
11720
+ var ILLUST = "/illust";
11721
+ var DARK_MODE_ILLUST_PREFIX = `${ILLUST}/dark/`;
11722
+ var LIGHT_MODE_ILLUST_PREFIX = `${ILLUST}/light/`;
11723
+
11724
+ // src/hooks/useIllust.ts
11725
+ import { useDarkTheme } from "@liner-fe/design-token";
11726
+ var useIllust = /* @__PURE__ */ __name(({ darkSrc, src }) => {
11727
+ const { isDarkMode } = useDarkTheme();
11728
+ const sourcePrefix = (() => {
11729
+ if (isDarkMode) {
11730
+ if (darkSrc?.inverse) {
11731
+ return LIGHT_MODE_ILLUST_PREFIX;
11732
+ }
11733
+ return DARK_MODE_ILLUST_PREFIX;
11734
+ }
11735
+ if (src.inverse === false) {
11736
+ return DARK_MODE_ILLUST_PREFIX;
11737
+ }
11738
+ return LIGHT_MODE_ILLUST_PREFIX;
11739
+ })();
11740
+ const currentSourceByColorTheme = isDarkMode ? darkSrc?.name || src.name : src.name;
11741
+ return { sourcePrefix, currentSourceByColorTheme, isDarkMode };
11742
+ }, "useIllust");
11743
+
11744
+ // src/components/Illust/index.tsx
11745
+ import { jsx as jsx195 } from "react/jsx-runtime";
11746
+ var Illust = /* @__PURE__ */ __name((props) => {
11747
+ const { src, width, margin } = props;
11748
+ const { sourcePrefix, currentSourceByColorTheme } = useIllust({
11749
+ darkSrc: src.dark,
11750
+ src: src.light
11751
+ });
11752
+ const aspectRatio = illustSize[currentSourceByColorTheme] ? illustSize[currentSourceByColorTheme].width / illustSize[currentSourceByColorTheme].height : void 0;
11753
+ const css = {
11754
+ width,
11755
+ margin
11756
+ };
11757
+ const source = `${sourcePrefix}${currentSourceByColorTheme}.webp`;
11758
+ return /* @__PURE__ */ jsx195("div", { style: css, children: /* @__PURE__ */ jsx195(
11759
+ Image,
11760
+ {
11761
+ alt: currentSourceByColorTheme,
11762
+ ...props,
11763
+ src: source,
11764
+ width,
11765
+ height: aspectRatio ? width / aspectRatio : width
11766
+ }
11767
+ ) });
11768
+ }, "Illust");
11769
+
11770
+ // src/utils/illust.ts
11771
+ var prefetchIllust = /* @__PURE__ */ __name(async ({ name, isDark = false }) => await fetch(`${ILLUST}${isDark ? "/dark/" : "/light/"}${name}.webp`), "prefetchIllust");
11689
11772
  export {
11690
11773
  Button,
11691
11774
  Caption,
@@ -11695,6 +11778,7 @@ export {
11695
11778
  Heading,
11696
11779
  Icon,
11697
11780
  IconButton,
11781
+ Illust,
11698
11782
  Label,
11699
11783
  List,
11700
11784
  Loading,
@@ -11718,6 +11802,7 @@ export {
11718
11802
  iconMap,
11719
11803
  isEmptyObject,
11720
11804
  objectToArray,
11805
+ prefetchIllust,
11721
11806
  rootMediaStyle,
11722
11807
  useToast
11723
11808
  };