@makeswift/runtime 0.7.3 → 0.7.4

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.
@@ -208,7 +208,7 @@ const Container = React.forwardRef(function Container2(_g, ref) {
208
208
  switch (variant2) {
209
209
  case "filled":
210
210
  return {
211
- fontFamily: numberFont2,
211
+ fontFamily: `"${numberFont2}"`,
212
212
  color: next.colorToString(numberColor2),
213
213
  background: next.colorToString(blockColor2)
214
214
  };
@@ -216,7 +216,7 @@ const Container = React.forwardRef(function Container2(_g, ref) {
216
216
  return {
217
217
  position: "relative",
218
218
  color: next.colorToString(numberColor2),
219
- fontFamily: numberFont2,
219
+ fontFamily: `"${numberFont2}"`,
220
220
  "> span": {
221
221
  position: "relative",
222
222
  zIndex: 1
@@ -246,7 +246,7 @@ const Container = React.forwardRef(function Container2(_g, ref) {
246
246
  };
247
247
  case "outline":
248
248
  return {
249
- fontFamily: numberFont2,
249
+ fontFamily: `"${numberFont2}"`,
250
250
  color: next.colorToString(numberColor2),
251
251
  background: "transparent",
252
252
  border: `2px solid ${next.colorToString(blockColor2)}`
@@ -254,7 +254,7 @@ const Container = React.forwardRef(function Container2(_g, ref) {
254
254
  case "outline-split":
255
255
  return {
256
256
  position: "relative",
257
- fontFamily: numberFont2,
257
+ fontFamily: `"${numberFont2}"`,
258
258
  color: next.colorToString(numberColor2),
259
259
  border: `2px solid ${next.colorToString(blockColor2)}`,
260
260
  "> span": {
@@ -274,7 +274,7 @@ const Container = React.forwardRef(function Container2(_g, ref) {
274
274
  };
275
275
  default:
276
276
  return {
277
- fontFamily: numberFont2,
277
+ fontFamily: `"${numberFont2}"`,
278
278
  background: "transparent",
279
279
  color: next.colorToString(numberColor2),
280
280
  paddingTop: 0,
@@ -291,7 +291,7 @@ const Container = React.forwardRef(function Container2(_g, ref) {
291
291
  },
292
292
  alpha: 1
293
293
  }, labelFont2 = "sans-serif"]) => ({
294
- fontFamily: labelFont2,
294
+ fontFamily: `"${labelFont2}"`,
295
295
  color: next.colorToString(labelColor2)
296
296
  }))
297
297
  }), className)
@@ -1 +1 @@
1
- {"version":3,"file":"Countdown.cjs.js","sources":["../src/components/builtin/Countdown/Countdown.tsx"],"sourcesContent":["import { cx } from '@emotion/css'\nimport { ComponentPropsWithoutRef, ForwardedRef, forwardRef, Ref, useEffect, useState } from 'react'\nimport {\n DateValue,\n ElementIDValue,\n FontValue,\n GapXValue,\n ResponsiveIconRadioGroupValue,\n ResponsiveValue,\n TextInputValue,\n} from '../../../prop-controllers/descriptors'\nimport { ResponsiveColor } from '../../../runtimes/react/controls'\nimport { useStyle } from '../../../runtimes/react/use-style'\nimport { colorToString } from '../../utils/colorToString'\nimport { responsiveStyle } from '../../utils/responsive-style'\nimport { ColorValue as Color } from '../../utils/types'\n\ntype Props = {\n id?: ElementIDValue\n date?: DateValue\n variant?: ResponsiveIconRadioGroupValue<\n 'filled' | 'filled-split' | 'outline' | 'outline-split' | 'clear'\n >\n shape?: ResponsiveIconRadioGroupValue<'pill' | 'rounded' | 'square'>\n size?: ResponsiveIconRadioGroupValue<'small' | 'medium' | 'large'>\n gap?: GapXValue\n numberFont?: FontValue\n numberColor?: ResponsiveColor | null\n blockColor?: ResponsiveColor | null\n labelFont?: FontValue\n labelColor?: ResponsiveColor | null\n width?: string\n margin?: string\n daysLabel?: TextInputValue\n hoursLabel?: TextInputValue\n minutesLabel?: TextInputValue\n secondsLabel?: TextInputValue\n}\n\nconst BLOCK_CLASS_NAME = 'block'\n\ntype BlockProps = ComponentPropsWithoutRef<'div'>\n\nfunction Block({ className, ...restOfProps }: BlockProps) {\n return (\n <div\n {...restOfProps}\n className={cx(\n BLOCK_CLASS_NAME,\n useStyle({ display: 'block', padding: '0.5em', fontSize: '1em' }),\n className,\n )}\n />\n )\n}\n\nconst LABEL_CLASS_NAME = 'label'\n\ntype LabelProps = ComponentPropsWithoutRef<'div'>\n\nfunction Label({ className, ...restOfProps }: LabelProps) {\n return (\n <div\n {...restOfProps}\n className={cx(LABEL_CLASS_NAME, useStyle({ marginTop: '0.25em' }), className)}\n />\n )\n}\n\nconst SEGMENT_CLASS_NAME = 'segment'\n\ntype SegmentProps = ComponentPropsWithoutRef<'div'>\n\nfunction Segment({ className, ...restOfProps }: SegmentProps) {\n return (\n <div\n {...restOfProps}\n className={cx(SEGMENT_CLASS_NAME, useStyle({ flex: 1, textAlign: 'center' }), className)}\n />\n )\n}\n\ntype ContainerBaseProps = {\n width?: string\n margin?: string\n variant: Props['variant']\n size: Props['size']\n shape: Props['shape']\n gap: Props['gap']\n labelColor?: ResponsiveValue<Color> | null\n numberFont?: ResponsiveValue<string>\n numberColor?: ResponsiveValue<Color> | null\n blockColor?: ResponsiveValue<Color> | null\n labelFont?: ResponsiveValue<string>\n}\n\ntype ContainerProps = ContainerBaseProps &\n Omit<ComponentPropsWithoutRef<'div'>, keyof ContainerBaseProps>\n\nconst Container = forwardRef(function Container(\n {\n className,\n width,\n margin,\n variant,\n size,\n shape,\n gap,\n labelColor,\n numberFont,\n numberColor,\n blockColor,\n labelFont,\n ...restOfProps\n }: ContainerProps,\n ref: ForwardedRef<HTMLDivElement>,\n) {\n return (\n <div\n {...restOfProps}\n ref={ref}\n className={cx(\n useStyle({ display: 'flex' }),\n width,\n margin,\n useStyle(\n responsiveStyle([size] as const, ([size = 'medium']) => {\n switch (size) {\n case 'small':\n return { fontSize: 18, [`.${LABEL_CLASS_NAME}`]: { fontSize: 14 } }\n\n case 'large':\n return { fontSize: 32, [`.${LABEL_CLASS_NAME}`]: { fontSize: 18 } }\n\n default:\n return { fontSize: 24, [`.${LABEL_CLASS_NAME}`]: { fontSize: 16 } }\n }\n }),\n ),\n useStyle({\n [`.${SEGMENT_CLASS_NAME}`]: responsiveStyle([gap] as const, ([gap]) => ({\n margin: `0 ${gap == null ? 0 : `${gap.value / 2}${gap.unit}`}`,\n\n '&:first-child': {\n marginLeft: 0,\n },\n\n '&:last-child': {\n marginRight: 0,\n },\n })),\n }),\n useStyle({\n [`.${BLOCK_CLASS_NAME}`]: responsiveStyle([shape] as const, ([shape = 'rounded']) => {\n switch (shape) {\n case 'pill':\n return { borderRadius: 500 }\n\n case 'rounded':\n return { borderRadius: 6 }\n\n default:\n return { borderRadius: 0 }\n }\n }),\n }),\n useStyle({\n [`.${BLOCK_CLASS_NAME}`]: responsiveStyle(\n [variant, blockColor, numberColor, numberFont] as const,\n ([\n variant = 'filled',\n blockColor = { swatch: { hue: 0, saturation: 0, lightness: 0 }, alpha: 1 },\n numberColor = { swatch: { hue: 0, saturation: 0, lightness: 100 }, alpha: 1 },\n numberFont = 'sans-serif',\n ]) => {\n switch (variant) {\n case 'filled':\n return {\n fontFamily: numberFont,\n color: colorToString(numberColor),\n background: colorToString(blockColor),\n }\n\n case 'filled-split':\n return {\n position: 'relative',\n color: colorToString(numberColor),\n fontFamily: numberFont,\n\n '> span': {\n position: 'relative',\n zIndex: 1,\n },\n\n '::before': {\n content: '\"\"',\n position: 'absolute',\n top: 0,\n left: 0,\n right: 0,\n bottom: 'calc(50% + 1px)',\n borderTopLeftRadius: 'inherit',\n borderTopRightRadius: 'inherit',\n background: colorToString(blockColor),\n },\n\n '::after': {\n content: '\"\"',\n position: 'absolute',\n left: 0,\n right: 0,\n top: 'calc(50% + 1px)',\n bottom: 0,\n borderBottomLeftRadius: 'inherit',\n borderBottomRightRadius: 'inherit',\n background: colorToString(blockColor),\n },\n }\n\n case 'outline':\n return {\n fontFamily: numberFont,\n color: colorToString(numberColor),\n background: 'transparent',\n border: `2px solid ${colorToString(blockColor)}`,\n }\n\n case 'outline-split':\n return {\n position: 'relative',\n fontFamily: numberFont,\n color: colorToString(numberColor),\n border: `2px solid ${colorToString(blockColor)}`,\n\n '> span': {\n position: 'relative',\n zIndex: 1,\n },\n\n '::before': {\n content: '\"\"',\n position: 'absolute',\n top: '50%',\n left: 0,\n right: 0,\n height: 2,\n marginTop: -1,\n background: colorToString(blockColor),\n },\n }\n\n default:\n return {\n fontFamily: numberFont,\n background: 'transparent',\n color: colorToString(numberColor),\n paddingTop: 0,\n paddingBottom: 0,\n }\n }\n },\n ),\n }),\n useStyle({\n [`.${LABEL_CLASS_NAME}`]: responsiveStyle(\n [labelColor, labelFont] as const,\n ([\n labelColor = { swatch: { hue: 0, saturation: 0, lightness: 0 }, alpha: 1 },\n labelFont = 'sans-serif',\n ]) => ({\n fontFamily: labelFont,\n color: colorToString(labelColor),\n }),\n ),\n }),\n className,\n )}\n />\n )\n})\n\nconst getRemaining = (date: Props['date'] | null | undefined) => {\n if (date == null) return { days: '0', hours: '0', minutes: '0', seconds: '0' }\n\n const timeDiff = new Date(date).getTime() - Date.now()\n\n if (timeDiff <= 0) return { days: 0, hours: 0, minutes: 0, seconds: 0 }\n\n let delta = Math.abs(timeDiff) / 1000\n\n const days = Math.floor(delta / 86400)\n delta -= days * 86400\n\n const hours = Math.floor(delta / 3600) % 24\n delta -= hours * 3600\n\n const minutes = Math.floor(delta / 60) % 60\n delta -= minutes * 60\n\n const seconds = parseInt(String(delta % 60), 10)\n\n return {\n days: days.toString(),\n hours: hours.toString(),\n minutes: minutes.toString(),\n seconds: seconds.toString(),\n }\n}\n\nconst Countdown = forwardRef(function Countdown(\n {\n id,\n margin,\n width,\n date,\n variant,\n size,\n shape,\n gap,\n labelColor,\n labelFont,\n numberColor,\n numberFont,\n blockColor,\n daysLabel,\n hoursLabel,\n minutesLabel,\n secondsLabel,\n }: Props,\n ref: Ref<HTMLDivElement>,\n) {\n const [{ days, hours, minutes, seconds }, setRemaining] = useState(getRemaining(null))\n\n useEffect(() => {\n setRemaining(getRemaining(date))\n\n const intervalId = setInterval(() => {\n setRemaining(getRemaining(date))\n }, 1000)\n\n return () => clearInterval(intervalId)\n }, [date])\n\n return (\n <Container\n ref={ref}\n id={id}\n width={width}\n margin={margin}\n variant={variant}\n size={size}\n shape={shape}\n labelColor={labelColor}\n labelFont={labelFont}\n numberColor={numberColor}\n numberFont={numberFont}\n blockColor={blockColor}\n gap={gap}\n >\n <Segment>\n <Block>\n <span>{days}</span>\n </Block>\n <Label>{daysLabel == null ? 'Days' : daysLabel}</Label>\n </Segment>\n <Segment>\n <Block>\n <span>{hours}</span>\n </Block>\n <Label>{hoursLabel == null ? 'Hours' : hoursLabel}</Label>\n </Segment>\n <Segment>\n <Block>\n <span>{minutes}</span>\n </Block>\n <Label>{minutesLabel == null ? 'Minutes' : minutesLabel}</Label>\n </Segment>\n <Segment>\n <Block>\n <span>{seconds}</span>\n </Block>\n <Label>{secondsLabel == null ? 'Seconds' : secondsLabel}</Label>\n </Segment>\n </Container>\n )\n})\n\nexport default Countdown\n"],"names":["BLOCK_CLASS_NAME","className","restOfProps","cx","useStyle","display","padding","fontSize","LABEL_CLASS_NAME","marginTop","SEGMENT_CLASS_NAME","flex","textAlign","Container","forwardRef","ref","width","margin","variant","size","shape","gap","labelColor","numberFont","numberColor","blockColor","labelFont","responsiveStyle","value","unit","marginLeft","marginRight","borderRadius","swatch","hue","saturation","lightness","alpha","fontFamily","color","colorToString","background","position","zIndex","content","top","left","right","bottom","borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius","border","height","paddingTop","paddingBottom","getRemaining","date","days","hours","minutes","seconds","timeDiff","Date","getTime","now","delta","Math","abs","floor","parseInt","String","toString","Countdown","id","daysLabel","hoursLabel","minutesLabel","secondsLabel","setRemaining","useState","useEffect","intervalId","setInterval","clearInterval","_jsxs","_jsx"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuCA,MAAMA,mBAAmB;AAIzB,eAAe,IAA2C;AAA3C,eAAEC;AAAAA;AAAAA,MAAF,IAAgBC,wBAAhB,IAAgBA;AAAAA,IAAdD;AAAAA;AACf,gFAEQC;IACJ,WAAWC,IAAAA,GACTH,kBACAI,cAAS;AAAA,MAAEC,SAAS;AAAA,MAASC,SAAS;AAAA,MAASC,UAAU;AAAA,IAAjD,CAAA,GACRN,SAHW;AAAA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ources":["../src/components/builtin/Countdown/Countdown.tsx"],"sourcesContent":["import { cx } from '@emotion/css'\nimport { ComponentPropsWithoutRef, ForwardedRef, forwardRef, Ref, useEffect, useState } from 'react'\nimport {\n DateValue,\n ElementIDValue,\n FontValue,\n GapXValue,\n ResponsiveIconRadioGroupValue,\n ResponsiveValue,\n TextInputValue,\n} from '../../../prop-controllers/descriptors'\nimport { ResponsiveColor } from '../../../runtimes/react/controls'\nimport { useStyle } from '../../../runtimes/react/use-style'\nimport { colorToString } from '../../utils/colorToString'\nimport { responsiveStyle } from '../../utils/responsive-style'\nimport { ColorValue as Color } from '../../utils/types'\n\ntype Props = {\n id?: ElementIDValue\n date?: DateValue\n variant?: ResponsiveIconRadioGroupValue<\n 'filled' | 'filled-split' | 'outline' | 'outline-split' | 'clear'\n >\n shape?: ResponsiveIconRadioGroupValue<'pill' | 'rounded' | 'square'>\n size?: ResponsiveIconRadioGroupValue<'small' | 'medium' | 'large'>\n gap?: GapXValue\n numberFont?: FontValue\n numberColor?: ResponsiveColor | null\n blockColor?: ResponsiveColor | null\n labelFont?: FontValue\n labelColor?: ResponsiveColor | null\n width?: string\n margin?: string\n daysLabel?: TextInputValue\n hoursLabel?: TextInputValue\n minutesLabel?: TextInputValue\n secondsLabel?: TextInputValue\n}\n\nconst BLOCK_CLASS_NAME = 'block'\n\ntype BlockProps = ComponentPropsWithoutRef<'div'>\n\nfunction Block({ className, ...restOfProps }: BlockProps) {\n return (\n <div\n {...restOfProps}\n className={cx(\n BLOCK_CLASS_NAME,\n useStyle({ display: 'block', padding: '0.5em', fontSize: '1em' }),\n className,\n )}\n />\n )\n}\n\nconst LABEL_CLASS_NAME = 'label'\n\ntype LabelProps = ComponentPropsWithoutRef<'div'>\n\nfunction Label({ className, ...restOfProps }: LabelProps) {\n return (\n <div\n {...restOfProps}\n className={cx(LABEL_CLASS_NAME, useStyle({ marginTop: '0.25em' }), className)}\n />\n )\n}\n\nconst SEGMENT_CLASS_NAME = 'segment'\n\ntype SegmentProps = ComponentPropsWithoutRef<'div'>\n\nfunction Segment({ className, ...restOfProps }: SegmentProps) {\n return (\n <div\n {...restOfProps}\n className={cx(SEGMENT_CLASS_NAME, useStyle({ flex: 1, textAlign: 'center' }), className)}\n />\n )\n}\n\ntype ContainerBaseProps = {\n width?: string\n margin?: string\n variant: Props['variant']\n size: Props['size']\n shape: Props['shape']\n gap: Props['gap']\n labelColor?: ResponsiveValue<Color> | null\n numberFont?: ResponsiveValue<string>\n numberColor?: ResponsiveValue<Color> | null\n blockColor?: ResponsiveValue<Color> | null\n labelFont?: ResponsiveValue<string>\n}\n\ntype ContainerProps = ContainerBaseProps &\n Omit<ComponentPropsWithoutRef<'div'>, keyof ContainerBaseProps>\n\nconst Container = forwardRef(function Container(\n {\n className,\n width,\n margin,\n variant,\n size,\n shape,\n gap,\n labelColor,\n numberFont,\n numberColor,\n blockColor,\n labelFont,\n ...restOfProps\n }: ContainerProps,\n ref: ForwardedRef<HTMLDivElement>,\n) {\n return (\n <div\n {...restOfProps}\n ref={ref}\n className={cx(\n useStyle({ display: 'flex' }),\n width,\n margin,\n useStyle(\n responsiveStyle([size] as const, ([size = 'medium']) => {\n switch (size) {\n case 'small':\n return { fontSize: 18, [`.${LABEL_CLASS_NAME}`]: { fontSize: 14 } }\n\n case 'large':\n return { fontSize: 32, [`.${LABEL_CLASS_NAME}`]: { fontSize: 18 } }\n\n default:\n return { fontSize: 24, [`.${LABEL_CLASS_NAME}`]: { fontSize: 16 } }\n }\n }),\n ),\n useStyle({\n [`.${SEGMENT_CLASS_NAME}`]: responsiveStyle([gap] as const, ([gap]) => ({\n margin: `0 ${gap == null ? 0 : `${gap.value / 2}${gap.unit}`}`,\n\n '&:first-child': {\n marginLeft: 0,\n },\n\n '&:last-child': {\n marginRight: 0,\n },\n })),\n }),\n useStyle({\n [`.${BLOCK_CLASS_NAME}`]: responsiveStyle([shape] as const, ([shape = 'rounded']) => {\n switch (shape) {\n case 'pill':\n return { borderRadius: 500 }\n\n case 'rounded':\n return { borderRadius: 6 }\n\n default:\n return { borderRadius: 0 }\n }\n }),\n }),\n useStyle({\n [`.${BLOCK_CLASS_NAME}`]: responsiveStyle(\n [variant, blockColor, numberColor, numberFont] as const,\n ([\n variant = 'filled',\n blockColor = { swatch: { hue: 0, saturation: 0, lightness: 0 }, alpha: 1 },\n numberColor = { swatch: { hue: 0, saturation: 0, lightness: 100 }, alpha: 1 },\n numberFont = 'sans-serif',\n ]) => {\n switch (variant) {\n case 'filled':\n return {\n fontFamily: `\"${numberFont}\"`,\n color: colorToString(numberColor),\n background: colorToString(blockColor),\n }\n\n case 'filled-split':\n return {\n position: 'relative',\n color: colorToString(numberColor),\n fontFamily: `\"${numberFont}\"`,\n\n '> span': {\n position: 'relative',\n zIndex: 1,\n },\n\n '::before': {\n content: '\"\"',\n position: 'absolute',\n top: 0,\n left: 0,\n right: 0,\n bottom: 'calc(50% + 1px)',\n borderTopLeftRadius: 'inherit',\n borderTopRightRadius: 'inherit',\n background: colorToString(blockColor),\n },\n\n '::after': {\n content: '\"\"',\n position: 'absolute',\n left: 0,\n right: 0,\n top: 'calc(50% + 1px)',\n bottom: 0,\n borderBottomLeftRadius: 'inherit',\n borderBottomRightRadius: 'inherit',\n background: colorToString(blockColor),\n },\n }\n\n case 'outline':\n return {\n fontFamily: `\"${numberFont}\"`,\n color: colorToString(numberColor),\n background: 'transparent',\n border: `2px solid ${colorToString(blockColor)}`,\n }\n\n case 'outline-split':\n return {\n position: 'relative',\n fontFamily: `\"${numberFont}\"`,\n color: colorToString(numberColor),\n border: `2px solid ${colorToString(blockColor)}`,\n\n '> span': {\n position: 'relative',\n zIndex: 1,\n },\n\n '::before': {\n content: '\"\"',\n position: 'absolute',\n top: '50%',\n left: 0,\n right: 0,\n height: 2,\n marginTop: -1,\n background: colorToString(blockColor),\n },\n }\n\n default:\n return {\n fontFamily: `\"${numberFont}\"`,\n background: 'transparent',\n color: colorToString(numberColor),\n paddingTop: 0,\n paddingBottom: 0,\n }\n }\n },\n ),\n }),\n useStyle({\n [`.${LABEL_CLASS_NAME}`]: responsiveStyle(\n [labelColor, labelFont] as const,\n ([\n labelColor = { swatch: { hue: 0, saturation: 0, lightness: 0 }, alpha: 1 },\n labelFont = 'sans-serif',\n ]) => ({\n fontFamily: `\"${labelFont}\"`,\n color: colorToString(labelColor),\n }),\n ),\n }),\n className,\n )}\n />\n )\n})\n\nconst getRemaining = (date: Props['date'] | null | undefined) => {\n if (date == null) return { days: '0', hours: '0', minutes: '0', seconds: '0' }\n\n const timeDiff = new Date(date).getTime() - Date.now()\n\n if (timeDiff <= 0) return { days: 0, hours: 0, minutes: 0, seconds: 0 }\n\n let delta = Math.abs(timeDiff) / 1000\n\n const days = Math.floor(delta / 86400)\n delta -= days * 86400\n\n const hours = Math.floor(delta / 3600) % 24\n delta -= hours * 3600\n\n const minutes = Math.floor(delta / 60) % 60\n delta -= minutes * 60\n\n const seconds = parseInt(String(delta % 60), 10)\n\n return {\n days: days.toString(),\n hours: hours.toString(),\n minutes: minutes.toString(),\n seconds: seconds.toString(),\n }\n}\n\nconst Countdown = forwardRef(function Countdown(\n {\n id,\n margin,\n width,\n date,\n variant,\n size,\n shape,\n gap,\n labelColor,\n labelFont,\n numberColor,\n numberFont,\n blockColor,\n daysLabel,\n hoursLabel,\n minutesLabel,\n secondsLabel,\n }: Props,\n ref: Ref<HTMLDivElement>,\n) {\n const [{ days, hours, minutes, seconds }, setRemaining] = useState(getRemaining(null))\n\n useEffect(() => {\n setRemaining(getRemaining(date))\n\n const intervalId = setInterval(() => {\n setRemaining(getRemaining(date))\n }, 1000)\n\n return () => clearInterval(intervalId)\n }, [date])\n\n return (\n <Container\n ref={ref}\n id={id}\n width={width}\n margin={margin}\n variant={variant}\n size={size}\n shape={shape}\n labelColor={labelColor}\n labelFont={labelFont}\n numberColor={numberColor}\n numberFont={numberFont}\n blockColor={blockColor}\n gap={gap}\n >\n <Segment>\n <Block>\n <span>{days}</span>\n </Block>\n <Label>{daysLabel == null ? 'Days' : daysLabel}</Label>\n </Segment>\n <Segment>\n <Block>\n <span>{hours}</span>\n </Block>\n <Label>{hoursLabel == null ? 'Hours' : hoursLabel}</Label>\n </Segment>\n <Segment>\n <Block>\n <span>{minutes}</span>\n </Block>\n <Label>{minutesLabel == null ? 'Minutes' : minutesLabel}</Label>\n </Segment>\n <Segment>\n <Block>\n <span>{seconds}</span>\n </Block>\n <Label>{secondsLabel == null ? 'Seconds' : secondsLabel}</Label>\n </Segment>\n </Container>\n )\n})\n\nexport default Countdown\n"],"names":["BLOCK_CLASS_NAME","className","restOfProps","cx","useStyle","display","padding","fontSize","LABEL_CLASS_NAME","marginTop","SEGMENT_CLASS_NAME","flex","textAlign","Container","forwardRef","ref","width","margin","variant","size","shape","gap","labelColor","numberFont","numberColor","blockColor","labelFont","responsiveStyle","value","unit","marginLeft","marginRight","borderRadius","swatch","hue","saturation","lightness","alpha","fontFamily","color","colorToString","background","position","zIndex","content","top","left","right","bottom","borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius","border","height","paddingTop","paddingBottom","getRemaining","date","days","hours","minutes","seconds","timeDiff","Date","getTime","now","delta","Math","abs","floor","parseInt","String","toString","Countdown","id","daysLabel","hoursLabel","minutesLabel","secondsLabel","setRemaining","useState","useEffect","intervalId","setInterval","clearInterval","_jsxs","_jsx"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuCA,MAAMA,mBAAmB;AAIzB,eAAe,IAA2C;AAA3C,eAAEC;AAAAA;AAAAA,MAAF,IAAgBC,wBAAhB,IAAgBA;AAAAA,IAAdD;AAAAA;AACf,gFAEQC;IACJ,WAAWC,IAAAA,GACTH,kBACAI,cAAS;AAAA,MAAEC,SAAS;AAAA,MAASC,SAAS;AAAA,MAASC,UAAU;AAAA,IAAjD,CAAA,GACRN,SAHW;AAAA,EAAA,EAHjB;AAUD;AAED,MAAMO,mBAAmB;AAIzB,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_g, ref) {
206
206
  switch (variant2) {
207
207
  case "filled":
208
208
  return {
209
- fontFamily: numberFont2,
209
+ fontFamily: `"${numberFont2}"`,
210
210
  color: colorToString(numberColor2),
211
211
  background: colorToString(blockColor2)
212
212
  };
@@ -214,7 +214,7 @@ const Container = forwardRef(function Container2(_g, ref) {
214
214
  return {
215
215
  position: "relative",
216
216
  color: colorToString(numberColor2),
217
- fontFamily: numberFont2,
217
+ fontFamily: `"${numberFont2}"`,
218
218
  "> span": {
219
219
  position: "relative",
220
220
  zIndex: 1
@@ -244,7 +244,7 @@ const Container = forwardRef(function Container2(_g, ref) {
244
244
  };
245
245
  case "outline":
246
246
  return {
247
- fontFamily: numberFont2,
247
+ fontFamily: `"${numberFont2}"`,
248
248
  color: colorToString(numberColor2),
249
249
  background: "transparent",
250
250
  border: `2px solid ${colorToString(blockColor2)}`
@@ -252,7 +252,7 @@ const Container = forwardRef(function Container2(_g, ref) {
252
252
  case "outline-split":
253
253
  return {
254
254
  position: "relative",
255
- fontFamily: numberFont2,
255
+ fontFamily: `"${numberFont2}"`,
256
256
  color: colorToString(numberColor2),
257
257
  border: `2px solid ${colorToString(blockColor2)}`,
258
258
  "> span": {
@@ -272,7 +272,7 @@ const Container = forwardRef(function Container2(_g, ref) {
272
272
  };
273
273
  default:
274
274
  return {
275
- fontFamily: numberFont2,
275
+ fontFamily: `"${numberFont2}"`,
276
276
  background: "transparent",
277
277
  color: colorToString(numberColor2),
278
278
  paddingTop: 0,
@@ -289,7 +289,7 @@ const Container = forwardRef(function Container2(_g, ref) {
289
289
  },
290
290
  alpha: 1
291
291
  }, labelFont2 = "sans-serif"]) => ({
292
- fontFamily: labelFont2,
292
+ fontFamily: `"${labelFont2}"`,
293
293
  color: colorToString(labelColor2)
294
294
  }))
295
295
  }), className)
@@ -1 +1 @@
1
- {"version":3,"file":"Countdown.es.js","sources":["../src/components/builtin/Countdown/Countdown.tsx"],"sourcesContent":["import { cx } from '@emotion/css'\nimport { ComponentPropsWithoutRef, ForwardedRef, forwardRef, Ref, useEffect, useState } from 'react'\nimport {\n DateValue,\n ElementIDValue,\n FontValue,\n GapXValue,\n ResponsiveIconRadioGroupValue,\n ResponsiveValue,\n TextInputValue,\n} from '../../../prop-controllers/descriptors'\nimport { ResponsiveColor } from '../../../runtimes/react/controls'\nimport { useStyle } from '../../../runtimes/react/use-style'\nimport { colorToString } from '../../utils/colorToString'\nimport { responsiveStyle } from '../../utils/responsive-style'\nimport { ColorValue as Color } from '../../utils/types'\n\ntype Props = {\n id?: ElementIDValue\n date?: DateValue\n variant?: ResponsiveIconRadioGroupValue<\n 'filled' | 'filled-split' | 'outline' | 'outline-split' | 'clear'\n >\n shape?: ResponsiveIconRadioGroupValue<'pill' | 'rounded' | 'square'>\n size?: ResponsiveIconRadioGroupValue<'small' | 'medium' | 'large'>\n gap?: GapXValue\n numberFont?: FontValue\n numberColor?: ResponsiveColor | null\n blockColor?: ResponsiveColor | null\n labelFont?: FontValue\n labelColor?: ResponsiveColor | null\n width?: string\n margin?: string\n daysLabel?: TextInputValue\n hoursLabel?: TextInputValue\n minutesLabel?: TextInputValue\n secondsLabel?: TextInputValue\n}\n\nconst BLOCK_CLASS_NAME = 'block'\n\ntype BlockProps = ComponentPropsWithoutRef<'div'>\n\nfunction Block({ className, ...restOfProps }: BlockProps) {\n return (\n <div\n {...restOfProps}\n className={cx(\n BLOCK_CLASS_NAME,\n useStyle({ display: 'block', padding: '0.5em', fontSize: '1em' }),\n className,\n )}\n />\n )\n}\n\nconst LABEL_CLASS_NAME = 'label'\n\ntype LabelProps = ComponentPropsWithoutRef<'div'>\n\nfunction Label({ className, ...restOfProps }: LabelProps) {\n return (\n <div\n {...restOfProps}\n className={cx(LABEL_CLASS_NAME, useStyle({ marginTop: '0.25em' }), className)}\n />\n )\n}\n\nconst SEGMENT_CLASS_NAME = 'segment'\n\ntype SegmentProps = ComponentPropsWithoutRef<'div'>\n\nfunction Segment({ className, ...restOfProps }: SegmentProps) {\n return (\n <div\n {...restOfProps}\n className={cx(SEGMENT_CLASS_NAME, useStyle({ flex: 1, textAlign: 'center' }), className)}\n />\n )\n}\n\ntype ContainerBaseProps = {\n width?: string\n margin?: string\n variant: Props['variant']\n size: Props['size']\n shape: Props['shape']\n gap: Props['gap']\n labelColor?: ResponsiveValue<Color> | null\n numberFont?: ResponsiveValue<string>\n numberColor?: ResponsiveValue<Color> | null\n blockColor?: ResponsiveValue<Color> | null\n labelFont?: ResponsiveValue<string>\n}\n\ntype ContainerProps = ContainerBaseProps &\n Omit<ComponentPropsWithoutRef<'div'>, keyof ContainerBaseProps>\n\nconst Container = forwardRef(function Container(\n {\n className,\n width,\n margin,\n variant,\n size,\n shape,\n gap,\n labelColor,\n numberFont,\n numberColor,\n blockColor,\n labelFont,\n ...restOfProps\n }: ContainerProps,\n ref: ForwardedRef<HTMLDivElement>,\n) {\n return (\n <div\n {...restOfProps}\n ref={ref}\n className={cx(\n useStyle({ display: 'flex' }),\n width,\n margin,\n useStyle(\n responsiveStyle([size] as const, ([size = 'medium']) => {\n switch (size) {\n case 'small':\n return { fontSize: 18, [`.${LABEL_CLASS_NAME}`]: { fontSize: 14 } }\n\n case 'large':\n return { fontSize: 32, [`.${LABEL_CLASS_NAME}`]: { fontSize: 18 } }\n\n default:\n return { fontSize: 24, [`.${LABEL_CLASS_NAME}`]: { fontSize: 16 } }\n }\n }),\n ),\n useStyle({\n [`.${SEGMENT_CLASS_NAME}`]: responsiveStyle([gap] as const, ([gap]) => ({\n margin: `0 ${gap == null ? 0 : `${gap.value / 2}${gap.unit}`}`,\n\n '&:first-child': {\n marginLeft: 0,\n },\n\n '&:last-child': {\n marginRight: 0,\n },\n })),\n }),\n useStyle({\n [`.${BLOCK_CLASS_NAME}`]: responsiveStyle([shape] as const, ([shape = 'rounded']) => {\n switch (shape) {\n case 'pill':\n return { borderRadius: 500 }\n\n case 'rounded':\n return { borderRadius: 6 }\n\n default:\n return { borderRadius: 0 }\n }\n }),\n }),\n useStyle({\n [`.${BLOCK_CLASS_NAME}`]: responsiveStyle(\n [variant, blockColor, numberColor, numberFont] as const,\n ([\n variant = 'filled',\n blockColor = { swatch: { hue: 0, saturation: 0, lightness: 0 }, alpha: 1 },\n numberColor = { swatch: { hue: 0, saturation: 0, lightness: 100 }, alpha: 1 },\n numberFont = 'sans-serif',\n ]) => {\n switch (variant) {\n case 'filled':\n return {\n fontFamily: numberFont,\n color: colorToString(numberColor),\n background: colorToString(blockColor),\n }\n\n case 'filled-split':\n return {\n position: 'relative',\n color: colorToString(numberColor),\n fontFamily: numberFont,\n\n '> span': {\n position: 'relative',\n zIndex: 1,\n },\n\n '::before': {\n content: '\"\"',\n position: 'absolute',\n top: 0,\n left: 0,\n right: 0,\n bottom: 'calc(50% + 1px)',\n borderTopLeftRadius: 'inherit',\n borderTopRightRadius: 'inherit',\n background: colorToString(blockColor),\n },\n\n '::after': {\n content: '\"\"',\n position: 'absolute',\n left: 0,\n right: 0,\n top: 'calc(50% + 1px)',\n bottom: 0,\n borderBottomLeftRadius: 'inherit',\n borderBottomRightRadius: 'inherit',\n background: colorToString(blockColor),\n },\n }\n\n case 'outline':\n return {\n fontFamily: numberFont,\n color: colorToString(numberColor),\n background: 'transparent',\n border: `2px solid ${colorToString(blockColor)}`,\n }\n\n case 'outline-split':\n return {\n position: 'relative',\n fontFamily: numberFont,\n color: colorToString(numberColor),\n border: `2px solid ${colorToString(blockColor)}`,\n\n '> span': {\n position: 'relative',\n zIndex: 1,\n },\n\n '::before': {\n content: '\"\"',\n position: 'absolute',\n top: '50%',\n left: 0,\n right: 0,\n height: 2,\n marginTop: -1,\n background: colorToString(blockColor),\n },\n }\n\n default:\n return {\n fontFamily: numberFont,\n background: 'transparent',\n color: colorToString(numberColor),\n paddingTop: 0,\n paddingBottom: 0,\n }\n }\n },\n ),\n }),\n useStyle({\n [`.${LABEL_CLASS_NAME}`]: responsiveStyle(\n [labelColor, labelFont] as const,\n ([\n labelColor = { swatch: { hue: 0, saturation: 0, lightness: 0 }, alpha: 1 },\n labelFont = 'sans-serif',\n ]) => ({\n fontFamily: labelFont,\n color: colorToString(labelColor),\n }),\n ),\n }),\n className,\n )}\n />\n )\n})\n\nconst getRemaining = (date: Props['date'] | null | undefined) => {\n if (date == null) return { days: '0', hours: '0', minutes: '0', seconds: '0' }\n\n const timeDiff = new Date(date).getTime() - Date.now()\n\n if (timeDiff <= 0) return { days: 0, hours: 0, minutes: 0, seconds: 0 }\n\n let delta = Math.abs(timeDiff) / 1000\n\n const days = Math.floor(delta / 86400)\n delta -= days * 86400\n\n const hours = Math.floor(delta / 3600) % 24\n delta -= hours * 3600\n\n const minutes = Math.floor(delta / 60) % 60\n delta -= minutes * 60\n\n const seconds = parseInt(String(delta % 60), 10)\n\n return {\n days: days.toString(),\n hours: hours.toString(),\n minutes: minutes.toString(),\n seconds: seconds.toString(),\n }\n}\n\nconst Countdown = forwardRef(function Countdown(\n {\n id,\n margin,\n width,\n date,\n variant,\n size,\n shape,\n gap,\n labelColor,\n labelFont,\n numberColor,\n numberFont,\n blockColor,\n daysLabel,\n hoursLabel,\n minutesLabel,\n secondsLabel,\n }: Props,\n ref: Ref<HTMLDivElement>,\n) {\n const [{ days, hours, minutes, seconds }, setRemaining] = useState(getRemaining(null))\n\n useEffect(() => {\n setRemaining(getRemaining(date))\n\n const intervalId = setInterval(() => {\n setRemaining(getRemaining(date))\n }, 1000)\n\n return () => clearInterval(intervalId)\n }, [date])\n\n return (\n <Container\n ref={ref}\n id={id}\n width={width}\n margin={margin}\n variant={variant}\n size={size}\n shape={shape}\n labelColor={labelColor}\n labelFont={labelFont}\n numberColor={numberColor}\n numberFont={numberFont}\n blockColor={blockColor}\n gap={gap}\n >\n <Segment>\n <Block>\n <span>{days}</span>\n </Block>\n <Label>{daysLabel == null ? 'Days' : daysLabel}</Label>\n </Segment>\n <Segment>\n <Block>\n <span>{hours}</span>\n </Block>\n <Label>{hoursLabel == null ? 'Hours' : hoursLabel}</Label>\n </Segment>\n <Segment>\n <Block>\n <span>{minutes}</span>\n </Block>\n <Label>{minutesLabel == null ? 'Minutes' : minutesLabel}</Label>\n </Segment>\n <Segment>\n <Block>\n <span>{seconds}</span>\n </Block>\n <Label>{secondsLabel == null ? 'Seconds' : secondsLabel}</Label>\n </Segment>\n </Container>\n )\n})\n\nexport default Countdown\n"],"names":["BLOCK_CLASS_NAME","className","restOfProps","cx","useStyle","display","padding","fontSize","LABEL_CLASS_NAME","marginTop","SEGMENT_CLASS_NAME","flex","textAlign","Container","forwardRef","ref","width","margin","variant","size","shape","gap","labelColor","numberFont","numberColor","blockColor","labelFont","responsiveStyle","value","unit","marginLeft","marginRight","borderRadius","swatch","hue","saturation","lightness","alpha","fontFamily","color","colorToString","background","position","zIndex","content","top","left","right","bottom","borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius","border","height","paddingTop","paddingBottom","getRemaining","date","days","hours","minutes","seconds","timeDiff","Date","getTime","now","delta","Math","abs","floor","parseInt","String","toString","Countdown","id","daysLabel","hoursLabel","minutesLabel","secondsLabel","setRemaining","useState","useEffect","intervalId","setInterval","clearInterval","_jsxs","_jsx"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuCA,MAAMA,mBAAmB;AAIzB,eAAe,IAA2C;AAA3C,eAAEC;AAAAA;AAAAA,MAAF,IAAgBC,wBAAhB,IAAgBA;AAAAA,IAAdD;AAAAA;AACf,qEAEQC;IACJ,WAAWC,GACTH,kBACAI,SAAS;AAAA,MAAEC,SAAS;AAAA,MAASC,SAAS;AAAA,MAASC,UAAU;AAAA,IAAjD,CAAA,GACRN,SAHW;AAAA,EAAA,EAHjB;AAUD;AAED,MAAMO,mBAAmB;AAIzB,eAAe,IAA2C;AAA3C,eAAEP;AAAAA;AAAAA,MAAF,IAAgBC,wBAAhB,IAAgBA;AAAAA,IAAdD;AAAAA;AACf,qEAEQC;IACJ,WAAWC,GAAGK,kBAAkBJ,SAAS;AAA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AqBEU,qBAAC,SAAD;AAAA,MAAA,UAAA,CACEC,oBAAC,OAAD;AAAA,QACE,8BAAA,QAAA;AAAA,UAAO3B,UAAAA;AAAAA,QAAAA,CAAP;AAAA,MAAA,CAFJ,GAIE2B,oBAAC,OAAD;AAAA,QAAA,UAAQV,cAAc,OAAO,UAAUA;AAAAA,MAAAA,CAJzC,CAAA;AAAA,IAAA,CArBF,GA2BES,qBAAC,SAAD;AAAA,MAAA,UAAA,CACEC,oBAAC,OAAD;AAAA,QACE,8BAAA,QAAA;AAAA,UAAO1B,UAAAA;AAAAA,QAAAA,CAAP;AAAA,MAAA,CAFJ,GAIE0B,oBAAC,OAAD;AAAA,QAAA,UAAQT,gBAAgB,OAAO,YAAYA;AAAAA,MAAAA,CAJ7C,CAAA;AAAA,IAAA,CA3BF,GAiCEQ,qBAAC,SAAD;AAAA,MAAA,UAAA,CACEC,oBAAC,OAAD;AAAA,QACE,8BAAA,QAAA;AAAA,UAAOzB,UAAAA;AAAAA,QAAAA,CAAP;AAAA,MAAA,CAFJ,GAIEyB,oBAAC,OAAD;AAAA,QAAA,UAAQR,gBAAgB,OAAO,YAAYA;AAAAA,MAAAA,CAJ7C,CAAA;AAAA,IAAA,CAjCF,CAAA;AAAA,EAAA,CADF;AA0CD,CA5E2B;;"}
1
+ {"version":3,"file":"Countdown.es.js","sources":["../src/components/builtin/Countdown/Countdown.tsx"],"sourcesContent":["import { cx } from '@emotion/css'\nimport { ComponentPropsWithoutRef, ForwardedRef, forwardRef, Ref, useEffect, useState } from 'react'\nimport {\n DateValue,\n ElementIDValue,\n FontValue,\n GapXValue,\n ResponsiveIconRadioGroupValue,\n ResponsiveValue,\n TextInputValue,\n} from '../../../prop-controllers/descriptors'\nimport { ResponsiveColor } from '../../../runtimes/react/controls'\nimport { useStyle } from '../../../runtimes/react/use-style'\nimport { colorToString } from '../../utils/colorToString'\nimport { responsiveStyle } from '../../utils/responsive-style'\nimport { ColorValue as Color } from '../../utils/types'\n\ntype Props = {\n id?: ElementIDValue\n date?: DateValue\n variant?: ResponsiveIconRadioGroupValue<\n 'filled' | 'filled-split' | 'outline' | 'outline-split' | 'clear'\n >\n shape?: ResponsiveIconRadioGroupValue<'pill' | 'rounded' | 'square'>\n size?: ResponsiveIconRadioGroupValue<'small' | 'medium' | 'large'>\n gap?: GapXValue\n numberFont?: FontValue\n numberColor?: ResponsiveColor | null\n blockColor?: ResponsiveColor | null\n labelFont?: FontValue\n labelColor?: ResponsiveColor | null\n width?: string\n margin?: string\n daysLabel?: TextInputValue\n hoursLabel?: TextInputValue\n minutesLabel?: TextInputValue\n secondsLabel?: TextInputValue\n}\n\nconst BLOCK_CLASS_NAME = 'block'\n\ntype BlockProps = ComponentPropsWithoutRef<'div'>\n\nfunction Block({ className, ...restOfProps }: BlockProps) {\n return (\n <div\n {...restOfProps}\n className={cx(\n BLOCK_CLASS_NAME,\n useStyle({ display: 'block', padding: '0.5em', fontSize: '1em' }),\n className,\n )}\n />\n )\n}\n\nconst LABEL_CLASS_NAME = 'label'\n\ntype LabelProps = ComponentPropsWithoutRef<'div'>\n\nfunction Label({ className, ...restOfProps }: LabelProps) {\n return (\n <div\n {...restOfProps}\n className={cx(LABEL_CLASS_NAME, useStyle({ marginTop: '0.25em' }), className)}\n />\n )\n}\n\nconst SEGMENT_CLASS_NAME = 'segment'\n\ntype SegmentProps = ComponentPropsWithoutRef<'div'>\n\nfunction Segment({ className, ...restOfProps }: SegmentProps) {\n return (\n <div\n {...restOfProps}\n className={cx(SEGMENT_CLASS_NAME, useStyle({ flex: 1, textAlign: 'center' }), className)}\n />\n )\n}\n\ntype ContainerBaseProps = {\n width?: string\n margin?: string\n variant: Props['variant']\n size: Props['size']\n shape: Props['shape']\n gap: Props['gap']\n labelColor?: ResponsiveValue<Color> | null\n numberFont?: ResponsiveValue<string>\n numberColor?: ResponsiveValue<Color> | null\n blockColor?: ResponsiveValue<Color> | null\n labelFont?: ResponsiveValue<string>\n}\n\ntype ContainerProps = ContainerBaseProps &\n Omit<ComponentPropsWithoutRef<'div'>, keyof ContainerBaseProps>\n\nconst Container = forwardRef(function Container(\n {\n className,\n width,\n margin,\n variant,\n size,\n shape,\n gap,\n labelColor,\n numberFont,\n numberColor,\n blockColor,\n labelFont,\n ...restOfProps\n }: ContainerProps,\n ref: ForwardedRef<HTMLDivElement>,\n) {\n return (\n <div\n {...restOfProps}\n ref={ref}\n className={cx(\n useStyle({ display: 'flex' }),\n width,\n margin,\n useStyle(\n responsiveStyle([size] as const, ([size = 'medium']) => {\n switch (size) {\n case 'small':\n return { fontSize: 18, [`.${LABEL_CLASS_NAME}`]: { fontSize: 14 } }\n\n case 'large':\n return { fontSize: 32, [`.${LABEL_CLASS_NAME}`]: { fontSize: 18 } }\n\n default:\n return { fontSize: 24, [`.${LABEL_CLASS_NAME}`]: { fontSize: 16 } }\n }\n }),\n ),\n useStyle({\n [`.${SEGMENT_CLASS_NAME}`]: responsiveStyle([gap] as const, ([gap]) => ({\n margin: `0 ${gap == null ? 0 : `${gap.value / 2}${gap.unit}`}`,\n\n '&:first-child': {\n marginLeft: 0,\n },\n\n '&:last-child': {\n marginRight: 0,\n },\n })),\n }),\n useStyle({\n [`.${BLOCK_CLASS_NAME}`]: responsiveStyle([shape] as const, ([shape = 'rounded']) => {\n switch (shape) {\n case 'pill':\n return { borderRadius: 500 }\n\n case 'rounded':\n return { borderRadius: 6 }\n\n default:\n return { borderRadius: 0 }\n }\n }),\n }),\n useStyle({\n [`.${BLOCK_CLASS_NAME}`]: responsiveStyle(\n [variant, blockColor, numberColor, numberFont] as const,\n ([\n variant = 'filled',\n blockColor = { swatch: { hue: 0, saturation: 0, lightness: 0 }, alpha: 1 },\n numberColor = { swatch: { hue: 0, saturation: 0, lightness: 100 }, alpha: 1 },\n numberFont = 'sans-serif',\n ]) => {\n switch (variant) {\n case 'filled':\n return {\n fontFamily: `\"${numberFont}\"`,\n color: colorToString(numberColor),\n background: colorToString(blockColor),\n }\n\n case 'filled-split':\n return {\n position: 'relative',\n color: colorToString(numberColor),\n fontFamily: `\"${numberFont}\"`,\n\n '> span': {\n position: 'relative',\n zIndex: 1,\n },\n\n '::before': {\n content: '\"\"',\n position: 'absolute',\n top: 0,\n left: 0,\n right: 0,\n bottom: 'calc(50% + 1px)',\n borderTopLeftRadius: 'inherit',\n borderTopRightRadius: 'inherit',\n background: colorToString(blockColor),\n },\n\n '::after': {\n content: '\"\"',\n position: 'absolute',\n left: 0,\n right: 0,\n top: 'calc(50% + 1px)',\n bottom: 0,\n borderBottomLeftRadius: 'inherit',\n borderBottomRightRadius: 'inherit',\n background: colorToString(blockColor),\n },\n }\n\n case 'outline':\n return {\n fontFamily: `\"${numberFont}\"`,\n color: colorToString(numberColor),\n background: 'transparent',\n border: `2px solid ${colorToString(blockColor)}`,\n }\n\n case 'outline-split':\n return {\n position: 'relative',\n fontFamily: `\"${numberFont}\"`,\n color: colorToString(numberColor),\n border: `2px solid ${colorToString(blockColor)}`,\n\n '> span': {\n position: 'relative',\n zIndex: 1,\n },\n\n '::before': {\n content: '\"\"',\n position: 'absolute',\n top: '50%',\n left: 0,\n right: 0,\n height: 2,\n marginTop: -1,\n background: colorToString(blockColor),\n },\n }\n\n default:\n return {\n fontFamily: `\"${numberFont}\"`,\n background: 'transparent',\n color: colorToString(numberColor),\n paddingTop: 0,\n paddingBottom: 0,\n }\n }\n },\n ),\n }),\n useStyle({\n [`.${LABEL_CLASS_NAME}`]: responsiveStyle(\n [labelColor, labelFont] as const,\n ([\n labelColor = { swatch: { hue: 0, saturation: 0, lightness: 0 }, alpha: 1 },\n labelFont = 'sans-serif',\n ]) => ({\n fontFamily: `\"${labelFont}\"`,\n color: colorToString(labelColor),\n }),\n ),\n }),\n className,\n )}\n />\n )\n})\n\nconst getRemaining = (date: Props['date'] | null | undefined) => {\n if (date == null) return { days: '0', hours: '0', minutes: '0', seconds: '0' }\n\n const timeDiff = new Date(date).getTime() - Date.now()\n\n if (timeDiff <= 0) return { days: 0, hours: 0, minutes: 0, seconds: 0 }\n\n let delta = Math.abs(timeDiff) / 1000\n\n const days = Math.floor(delta / 86400)\n delta -= days * 86400\n\n const hours = Math.floor(delta / 3600) % 24\n delta -= hours * 3600\n\n const minutes = Math.floor(delta / 60) % 60\n delta -= minutes * 60\n\n const seconds = parseInt(String(delta % 60), 10)\n\n return {\n days: days.toString(),\n hours: hours.toString(),\n minutes: minutes.toString(),\n seconds: seconds.toString(),\n }\n}\n\nconst Countdown = forwardRef(function Countdown(\n {\n id,\n margin,\n width,\n date,\n variant,\n size,\n shape,\n gap,\n labelColor,\n labelFont,\n numberColor,\n numberFont,\n blockColor,\n daysLabel,\n hoursLabel,\n minutesLabel,\n secondsLabel,\n }: Props,\n ref: Ref<HTMLDivElement>,\n) {\n const [{ days, hours, minutes, seconds }, setRemaining] = useState(getRemaining(null))\n\n useEffect(() => {\n setRemaining(getRemaining(date))\n\n const intervalId = setInterval(() => {\n setRemaining(getRemaining(date))\n }, 1000)\n\n return () => clearInterval(intervalId)\n }, [date])\n\n return (\n <Container\n ref={ref}\n id={id}\n width={width}\n margin={margin}\n variant={variant}\n size={size}\n shape={shape}\n labelColor={labelColor}\n labelFont={labelFont}\n numberColor={numberColor}\n numberFont={numberFont}\n blockColor={blockColor}\n gap={gap}\n >\n <Segment>\n <Block>\n <span>{days}</span>\n </Block>\n <Label>{daysLabel == null ? 'Days' : daysLabel}</Label>\n </Segment>\n <Segment>\n <Block>\n <span>{hours}</span>\n </Block>\n <Label>{hoursLabel == null ? 'Hours' : hoursLabel}</Label>\n </Segment>\n <Segment>\n <Block>\n <span>{minutes}</span>\n </Block>\n <Label>{minutesLabel == null ? 'Minutes' : minutesLabel}</Label>\n </Segment>\n <Segment>\n <Block>\n <span>{seconds}</span>\n </Block>\n <Label>{secondsLabel == null ? 'Seconds' : secondsLabel}</Label>\n </Segment>\n </Container>\n )\n})\n\nexport default Countdown\n"],"names":["BLOCK_CLASS_NAME","className","restOfProps","cx","useStyle","display","padding","fontSize","LABEL_CLASS_NAME","marginTop","SEGMENT_CLASS_NAME","flex","textAlign","Container","forwardRef","ref","width","margin","variant","size","shape","gap","labelColor","numberFont","numberColor","blockColor","labelFont","responsiveStyle","value","unit","marginLeft","marginRight","borderRadius","swatch","hue","saturation","lightness","alpha","fontFamily","color","colorToString","background","position","zIndex","content","top","left","right","bottom","borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius","border","height","paddingTop","paddingBottom","getRemaining","date","days","hours","minutes","seconds","timeDiff","Date","getTime","now","delta","Math","abs","floor","parseInt","String","toString","Countdown","id","daysLabel","hoursLabel","minutesLabel","secondsLabel","setRemaining","useState","useEffect","intervalId","setInterval","clearInterval","_jsxs","_jsx"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuCA,MAAMA,mBAAmB;AAIzB,eAAe,IAA2C;AAA3C,eAAEC;AAAAA;AAAAA,MAAF,IAAgBC,wBAAhB,IAAgBA;AAAAA,IAAdD;AAAAA;AACf,qEAEQC;IACJ,WAAWC,GACTH,kBACAI,SAAS;AAAA,MAAEC,SAAS;AAAA,MAASC,SAAS;AAAA,MAASC,UAAU;AAAA,IAAjD,CAAA,GACRN,SAHW;AAAA,EAAA,EAHjB;AAUD;AAED,MAAMO,mBAAmB;AAIzB,eAAe,IAA2C;AAA3C,eAAEP;AAAAA;AAAAA,MAAF,IAAgBC,wBAAhB,IAAgBA;AAAAA,IAAdD;AAAAA;AACf,qEAEQC;IACJ,WAAWC,GAAGK,kBAAkBJ,SAAS;AAAA,MAAEK,WAAW;AAAA,IAAd,CAAA,GAA2BR,SAAtD;AAAA,EAAA,EAHjB;AAMD;AAED,MAAMS,qBAAqB;AAI3B,iBAAiB,IAA6C;AAA7C,eAAET;AAAAA;AAAAA,MAAF,IAAgBC,wBAAhB,IAAgBA;AAAAA,IAAdD;AAAAA;AACjB,qEAEQC;IACJ,WAAWC,GAAGO,oBAAoBN,SAAS;AAAA,MAAEO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AJzC,CAAA;AAAA,IAAA,CArBF,GA2BES,qBAAC,SAAD;AAAA,MAAA,UAAA,CACEC,oBAAC,OAAD;AAAA,QACE,8BAAA,QAAA;AAAA,UAAO1B,UAAAA;AAAAA,QAAAA,CAAP;AAAA,MAAA,CAFJ,GAIE0B,oBAAC,OAAD;AAAA,QAAA,UAAQT,gBAAgB,OAAO,YAAYA;AAAAA,MAAAA,CAJ7C,CAAA;AAAA,IAAA,CA3BF,GAiCEQ,qBAAC,SAAD;AAAA,MAAA,UAAA,CACEC,oBAAC,OAAD;AAAA,QACE,8BAAA,QAAA;AAAA,UAAOzB,UAAAA;AAAAA,QAAAA,CAAP;AAAA,MAAA,CAFJ,GAIEyB,oBAAC,OAAD;AAAA,QAAA,UAAQR,gBAAgB,OAAO,YAAYA;AAAAA,MAAAA,CAJ7C,CAAA;AAAA,IAAA,CAjCF,CAAA;AAAA,EAAA,CADF;AA0CD,CA5E2B;;"}
package/dist/index.cjs.js CHANGED
@@ -1001,7 +1001,7 @@ function useCachedSite(siteId) {
1001
1001
  const site = shim.useSyncExternalStore(client.subscribe, getSnapshot, getSnapshot);
1002
1002
  return site;
1003
1003
  }
1004
- const version = "0.7.3";
1004
+ const version = "0.7.4";
1005
1005
  class Makeswift {
1006
1006
  constructor(apiKey, { apiOrigin = "https://api.makeswift.com" } = {}) {
1007
1007
  __publicField(this, "apiKey");
@@ -3231,7 +3231,7 @@ function responsiveTextStyle(value) {
3231
3231
  letterSpacing,
3232
3232
  fontFamily
3233
3233
  } = textStyle;
3234
- return __spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues({}, fontFamily == null ? {} : { fontFamily }), fontWeight == null ? {} : { fontWeight }), letterSpacing == null ? {} : { letterSpacing }), fontSize == null ? {} : { fontSize: `${fontSize.value}${fontSize.unit}` }), textTransform.includes("uppercase") ? { textTransform: "uppercase" } : {}), fontStyle.includes("italic") ? { fontStyle: "italic" } : {});
3234
+ return __spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues({}, fontFamily == null ? {} : { fontFamily: `"${fontFamily}"` }), fontWeight == null ? {} : { fontWeight }), letterSpacing == null ? {} : { letterSpacing }), fontSize == null ? {} : { fontSize: `${fontSize.value}${fontSize.unit}` }), textTransform.includes("uppercase") ? { textTransform: "uppercase" } : {}), fontStyle.includes("italic") ? { fontStyle: "italic" } : {});
3235
3235
  });
3236
3236
  }
3237
3237
  const defaultMargin = {
@@ -3271,7 +3271,7 @@ function useStyleControlCssObject(style, controlDefinition) {
3271
3271
  borderTopRightRadius: (_g = borderRadiusToString(borderRadius == null ? void 0 : borderRadius.borderTopRightRadius)) != null ? _g : 0,
3272
3272
  borderBottomRightRadius: (_h = borderRadiusToString(borderRadius == null ? void 0 : borderRadius.borderBottomRightRadius)) != null ? _h : 0,
3273
3273
  borderBottomLeftRadius: (_i = borderRadiusToString(borderRadius == null ? void 0 : borderRadius.borderBottomLeftRadius)) != null ? _i : 0
3274
- }), properties.includes(richText.StyleControlProperty.TextStyle) && __spreadProps(__spreadValues(__spreadValues(__spreadValues(__spreadValues({}, (textStyle == null ? void 0 : textStyle.fontFamily) && { fontFamily: textStyle.fontFamily }), (textStyle == null ? void 0 : textStyle.letterSpacing) && { letterSpacing: textStyle.letterSpacing }), (textStyle == null ? void 0 : textStyle.fontSize) && { fontSize: fontSizeToString(textStyle.fontSize) }), (textStyle == null ? void 0 : textStyle.fontWeight) && { fontWeight: textStyle.fontWeight }), {
3274
+ }), properties.includes(richText.StyleControlProperty.TextStyle) && __spreadProps(__spreadValues(__spreadValues(__spreadValues(__spreadValues({}, (textStyle == null ? void 0 : textStyle.fontFamily) && { fontFamily: `"${textStyle.fontFamily}"` }), (textStyle == null ? void 0 : textStyle.letterSpacing) && { letterSpacing: textStyle.letterSpacing }), (textStyle == null ? void 0 : textStyle.fontSize) && { fontSize: fontSizeToString(textStyle.fontSize) }), (textStyle == null ? void 0 : textStyle.fontWeight) && { fontWeight: textStyle.fontWeight }), {
3275
3275
  textTransform: (_j = textStyle == null ? void 0 : textStyle.textTransform) != null ? _j : [],
3276
3276
  fontStyle: (_k = textStyle == null ? void 0 : textStyle.fontStyle) != null ? _k : []
3277
3277
  }));