@yamada-ui/react
Version:
React UI components of the Yamada, by the Yamada, for the Yamada built with React and Emotion
1 lines • 4.17 kB
Source Map (JSON)
{"version":3,"file":"saturation-slider.cjs","names":["createSlotComponent","saturationSliderStyle","useSaturationSlider","styled"],"sources":["../../../../src/components/saturation-slider/saturation-slider.tsx"],"sourcesContent":["\"use client\"\n\nimport type { HTMLStyledProps, ThemeProps } from \"../../core\"\nimport type { Merge } from \"../../utils\"\nimport type { SaturationSliderStyle } from \"./saturation-slider.style\"\nimport type {\n UseSaturationSliderProps,\n UseSaturationSliderReturn,\n} from \"./use-saturation-slider\"\nimport { useMemo } from \"react\"\nimport { createSlotComponent, styled } from \"../../core\"\nimport { saturationSliderStyle } from \"./saturation-slider.style\"\nimport { useSaturationSlider } from \"./use-saturation-slider\"\n\ninterface ComponentContext\n extends Pick<UseSaturationSliderReturn, \"getThumbProps\" | \"getTrackProps\"> {}\n\nexport interface SaturationSliderRootProps\n extends Merge<HTMLStyledProps, UseSaturationSliderProps>,\n ThemeProps<SaturationSliderStyle> {\n /**\n * Props for the input element.\n */\n inputProps?: HTMLStyledProps<\"input\">\n /**\n * Props for the thumb element.\n */\n thumbProps?: SaturationSliderThumbProps\n /**\n * Props for the track element.\n */\n trackProps?: SaturationSliderTrackProps\n}\n\nconst {\n ComponentContext,\n PropsContext: SaturationSliderPropsContext,\n useComponentContext,\n usePropsContext: useSaturationSliderPropsContext,\n withContext,\n withProvider,\n} = createSlotComponent<\n SaturationSliderRootProps,\n SaturationSliderStyle,\n ComponentContext\n>(\"saturation-slider\", saturationSliderStyle)\n\nexport { SaturationSliderPropsContext, useSaturationSliderPropsContext }\n\n/**\n * `SaturationSlider` is a component used to allow the user to select a color saturation.\n *\n * @see https://yamada-ui.com/docs/components/saturation-slider\n */\nexport const SaturationSliderRoot = withProvider<\n \"input\",\n SaturationSliderRootProps\n>(({ children, inputProps, thumbProps, trackProps, ...rest }) => {\n const { getInputProps, getRootProps, getThumbProps, getTrackProps } =\n useSaturationSlider(rest)\n const computedChildren = useMemo(() => {\n if (children) return children\n\n return (\n <SaturationSliderTrack {...trackProps}>\n <SaturationSliderThumb {...thumbProps} />\n </SaturationSliderTrack>\n )\n }, [children, thumbProps, trackProps])\n const context = useMemo(\n () => ({ getThumbProps, getTrackProps }),\n [getThumbProps, getTrackProps],\n )\n\n return (\n <ComponentContext value={context}>\n <styled.div {...getRootProps()}>\n <styled.input {...getInputProps(inputProps)} />\n {computedChildren}\n </styled.div>\n </ComponentContext>\n )\n}, \"root\")()\n\nexport interface SaturationSliderTrackProps extends HTMLStyledProps {}\n\nexport const SaturationSliderTrack = withContext<\n \"div\",\n SaturationSliderTrackProps\n>(\"div\", \"track\")(undefined, (props) => {\n const { getTrackProps } = useComponentContext()\n\n return getTrackProps(props)\n})\n\nexport interface SaturationSliderThumbProps extends HTMLStyledProps {}\n\nexport const SaturationSliderThumb = withContext<\n \"div\",\n SaturationSliderThumbProps\n>(\"div\", \"thumb\")(undefined, (props) => {\n const { getThumbProps } = useComponentContext()\n\n return getThumbProps(props)\n})\n"],"mappings":";;;;;;;;;;;;;;AAkCA,MAAM,EACJ,kBACA,cAAc,8BACd,qBACA,iBAAiB,iCACjB,aACA,iBACEA,6CAIF,qBAAqBC,sDAAsB;;;;;;AAS7C,MAAa,uBAAuB,cAGjC,EAAE,UAAU,YAAY,YAAY,WAAY,GAAG,WAAW;CAC/D,MAAM,EAAE,eAAe,cAAc,eAAe,kBAClDC,kDAAoB,KAAK;CAC3B,MAAM,4CAAiC;AACrC,MAAI,SAAU,QAAO;AAErB,SACE,2CAAC;GAAsB,GAAI;aACzB,2CAAC,yBAAsB,GAAI,aAAc;IACnB;IAEzB;EAAC;EAAU;EAAY;EAAW,CAAC;AAMtC,QACE,2CAAC;EAAiB,iCALX;GAAE;GAAe;GAAe,GACvC,CAAC,eAAe,cAAc,CAC/B;YAIG,4CAACC,uBAAO;GAAI,GAAI,cAAc;cAC5B,2CAACA,uBAAO,SAAM,GAAI,cAAc,WAAW,GAAI,EAC9C;IACU;GACI;GAEpB,OAAO,EAAE;AAIZ,MAAa,wBAAwB,YAGnC,OAAO,QAAQ,CAAC,SAAY,UAAU;CACtC,MAAM,EAAE,kBAAkB,qBAAqB;AAE/C,QAAO,cAAc,MAAM;EAC3B;AAIF,MAAa,wBAAwB,YAGnC,OAAO,QAAQ,CAAC,SAAY,UAAU;CACtC,MAAM,EAAE,kBAAkB,qBAAqB;AAE/C,QAAO,cAAc,MAAM;EAC3B"}