UNPKG

@chayns-components/date

Version:

A set of beautiful React components for developing your own applications with chayns.

128 lines (124 loc) 4.13 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.StyledDayNumber = exports.StyledDayCategoryWrapper = exports.StyledDay = exports.StyledCurrentDay = void 0; var _styledComponents = _interopRequireWildcard(require("styled-components")); function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); } const StyledDay = exports.StyledDay = _styledComponents.default.div` position: relative; cursor: ${({ $isSameMonth, $isDisabled }) => $isSameMonth && !$isDisabled ? 'pointer' : 'default'}; color: ${({ theme }) => theme.text}; opacity: ${({ $isSameMonth, $isDisabled }) => { if ($isSameMonth && !$isDisabled) { return '1'; } if ($isDisabled) { return '0.2'; } return '0.5'; }}; display: flex; flex-direction: column; align-items: center; justify-content: center; aspect-ratio: 1; pointer-events: ${({ $isSameMonth, $isDisabled }) => $isSameMonth && !$isDisabled ? 'auto' : 'none'}; ${({ $backgroundColor, $textColor }) => $backgroundColor && $textColor && (0, _styledComponents.css)` color: ${$textColor}; background-color: ${$backgroundColor}; `} `; const StyledDayNumber = exports.StyledDayNumber = _styledComponents.default.div` border-radius: 50%; display: flex; align-items: center; justify-content: center; width: 80%; height: 80%; font-size: 90%; z-index: 2; ${({ $isSelected, $isIntervalEnd, $isIntervalStart, $isWithinIntervalSelection, $customThumbColors, theme }) => !!($isSelected || $isIntervalStart || $isIntervalEnd || $isWithinIntervalSelection) && (0, _styledComponents.css)` background-color: ${($customThumbColors === null || $customThumbColors === void 0 ? void 0 : $customThumbColors.mainBackgroundColor) ?? theme['404']}; color: ${($customThumbColors === null || $customThumbColors === void 0 ? void 0 : $customThumbColors.mainTextColor) ?? theme['409']}; `} ${({ $isIntervalStart, $isIntervalEnd, $isWithinIntervalSelection, $customThumbColors, theme }) => { if ($isIntervalStart && $isIntervalEnd) { return (0, _styledComponents.css)` border-radius: 5px; width: 100%; `; } if ($isIntervalStart) { return (0, _styledComponents.css)` border-radius: 5px 0 0 5px; width: 100%; `; } if ($isIntervalEnd) { return (0, _styledComponents.css)` border-radius: 0 5px 5px 0; width: 100%; `; } if ($isWithinIntervalSelection) { return (0, _styledComponents.css)` border-radius: 0; width: 100%; background-color: ${($customThumbColors === null || $customThumbColors === void 0 ? void 0 : $customThumbColors.secondaryBackgroundColor) ?? theme['403']}; `; } return ''; }} `; const StyledDayCategoryWrapper = exports.StyledDayCategoryWrapper = _styledComponents.default.div` display: flex; align-items: center; justify-content: center; gap: 6%; width: 100%; position: absolute; bottom: 2px; `; const StyledCurrentDay = exports.StyledCurrentDay = _styledComponents.default.div` display: flex; align-items: center; justify-content: center; gap: 6%; width: 90%; height: 90%; position: absolute; z-index: 1; border-radius: 50%; background-color: ${({ $backgroundColor }) => $backgroundColor}; `; //# sourceMappingURL=Day.styles.js.map