@chayns-components/date 5.0.0-beta.466 → 5.0.0-beta.470

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.
@@ -1,6 +1,18 @@
1
1
  import { FC } from 'react';
2
2
  import type { OnChange, OnTimeAdd, OpeningTime, Weekday } from '../../types/openingTimes';
3
3
  export type OpeningTimesProps = {
4
+ /**
5
+ * The text that should be displayed when a day is closed.
6
+ */
7
+ closedText?: string;
8
+ /**
9
+ * If set just the current day is displayed and the whole week in a tooltip.
10
+ */
11
+ currentDayId?: OpeningTime['id'];
12
+ /**
13
+ * Whether the opening times can be edited.
14
+ */
15
+ editMode?: boolean;
4
16
  /**
5
17
  * Function to be executed when a time is changed or a day is enabled/disabled.
6
18
  * @param openingTimes
@@ -1,9 +1,12 @@
1
- import React, { useCallback, useEffect, useMemo, useState } from 'react';
2
- import { Checkbox } from '@chayns-components/core';
1
+ import { Checkbox, Tooltip, useElementSize } from '@chayns-components/core';
2
+ import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
3
3
  import OpeningInputs from './opening-inputs/OpeningInputs';
4
- import { StyledOpeningTimes, StyledOpeningTimesWrapper } from './OpeningTimes.styles';
4
+ import { StyledOpeningTimes, StyledOpeningTimesTooltipContent, StyledOpeningTimesWeekDay, StyledOpeningTimesWrapper } from './OpeningTimes.styles';
5
5
  const OpeningTimes = _ref => {
6
6
  let {
7
+ closedText = 'closed',
8
+ currentDayId,
9
+ editMode = false,
7
10
  openingTimes,
8
11
  weekdays,
9
12
  onChange,
@@ -11,6 +14,7 @@ const OpeningTimes = _ref => {
11
14
  onTimeRemove
12
15
  } = _ref;
13
16
  const [newOpeningTimes, setNewOpeningTimes] = useState();
17
+ const ref = useRef(null);
14
18
  useEffect(() => {
15
19
  setNewOpeningTimes(openingTimes);
16
20
  }, [openingTimes]);
@@ -105,21 +109,62 @@ const OpeningTimes = _ref => {
105
109
  }
106
110
  items.push( /*#__PURE__*/React.createElement(StyledOpeningTimesWrapper, {
107
111
  key: `openingTimes__${id}`
108
- }, /*#__PURE__*/React.createElement(Checkbox, {
112
+ }, editMode ? /*#__PURE__*/React.createElement(Checkbox, {
109
113
  isChecked: !isDisabled,
110
114
  onChange: () => handleCheckBoxChange(id)
111
- }, weekday), /*#__PURE__*/React.createElement(OpeningInputs, {
115
+ }, weekday) : /*#__PURE__*/React.createElement(StyledOpeningTimesWeekDay, null, weekday), /*#__PURE__*/React.createElement(OpeningInputs, {
116
+ closedText: closedText,
112
117
  id: id,
113
118
  times: times,
114
119
  isDisabled: isDisabled,
115
120
  onChange: newTime => handleChange(newTime, id),
116
121
  onRemove: handleRemove,
117
- onAdd: handleAdd
122
+ onAdd: handleAdd,
123
+ editMode: editMode
118
124
  })));
119
125
  });
120
126
  return items;
121
- }, [handleAdd, handleChange, handleCheckBoxChange, handleRemove, newOpeningTimes, weekdays]);
122
- return useMemo(() => /*#__PURE__*/React.createElement(StyledOpeningTimes, null, content), [content]);
127
+ }, [closedText, editMode, handleAdd, handleChange, handleCheckBoxChange, handleRemove, newOpeningTimes, weekdays]);
128
+ const size = useElementSize(ref);
129
+ const displayedContent = useMemo(() => {
130
+ if (!currentDayId || editMode) {
131
+ return content;
132
+ }
133
+ const singleDay = newOpeningTimes?.find(_ref3 => {
134
+ let {
135
+ id
136
+ } = _ref3;
137
+ return id === currentDayId;
138
+ });
139
+ if (!singleDay) {
140
+ return content;
141
+ }
142
+ const {
143
+ id,
144
+ times,
145
+ weekdayId
146
+ } = singleDay;
147
+ const weekday = weekdays.find(weekDay => weekDay.id === weekdayId)?.name;
148
+ const element = /*#__PURE__*/React.createElement(StyledOpeningTimesWrapper, {
149
+ key: `currentDay__${currentDayId}`,
150
+ style: size && {
151
+ width: size.width
152
+ }
153
+ }, /*#__PURE__*/React.createElement(StyledOpeningTimesWeekDay, null, weekday), /*#__PURE__*/React.createElement(OpeningInputs, {
154
+ closedText: closedText,
155
+ id: id,
156
+ times: times,
157
+ editMode: editMode
158
+ }));
159
+ return /*#__PURE__*/React.createElement(Tooltip, {
160
+ item: /*#__PURE__*/React.createElement(StyledOpeningTimesTooltipContent, {
161
+ key: "opening-time-tooltip"
162
+ }, content)
163
+ }, element);
164
+ }, [closedText, content, currentDayId, editMode, newOpeningTimes, weekdays, size]);
165
+ return useMemo(() => /*#__PURE__*/React.createElement(StyledOpeningTimes, {
166
+ ref: ref
167
+ }, displayedContent), [displayedContent]);
123
168
  };
124
169
  OpeningTimes.displayName = 'OpeningTimes';
125
170
  export default OpeningTimes;
@@ -1 +1 @@
1
- {"version":3,"file":"OpeningTimes.js","names":["React","useCallback","useEffect","useMemo","useState","Checkbox","OpeningInputs","StyledOpeningTimes","StyledOpeningTimesWrapper","OpeningTimes","_ref","openingTimes","weekdays","onChange","onTimeAdd","onTimeRemove","newOpeningTimes","setNewOpeningTimes","handleCheckBoxChange","id","prevOpeningTimes","updatedOpeningTimes","map","openingTime","isDisabled","enabledDays","filter","item","handleChange","newTime","newTimes","times","time","handleAdd","dayId","handleRemove","content","items","forEach","_ref2","weekdayId","weekday","find","weekDay","name","push","createElement","key","isChecked","onRemove","onAdd","displayName"],"sources":["../../../src/components/opening-times/OpeningTimes.tsx"],"sourcesContent":["import React, { FC, useCallback, useEffect, useMemo, useState, type ReactElement } from 'react';\nimport type { OnChange, OnTimeAdd, OpeningTime, Time, Weekday } from '../../types/openingTimes';\nimport { Checkbox } from '@chayns-components/core';\nimport OpeningInputs from './opening-inputs/OpeningInputs';\nimport { StyledOpeningTimes, StyledOpeningTimesWrapper } from './OpeningTimes.styles';\n\nexport type OpeningTimesProps = {\n /**\n * Function to be executed when a time is changed or a day is enabled/disabled.\n * @param openingTimes\n */\n onChange?: ({ time, enabledDays }: OnChange) => void;\n /**\n * Function to be executed when a time is added.\n */\n onTimeAdd?: ({ time, dayId }: OnTimeAdd) => void;\n /**\n * Function to be executed when a time is removed.\n */\n onTimeRemove?: (id: string) => void;\n /**\n * The opening times corresponding to its weekday.\n */\n openingTimes: OpeningTime[];\n /**\n * The weekdays that should be displayed.\n */\n weekdays: Weekday[];\n};\n\nconst OpeningTimes: FC<OpeningTimesProps> = ({\n openingTimes,\n weekdays,\n onChange,\n onTimeAdd,\n onTimeRemove,\n}) => {\n const [newOpeningTimes, setNewOpeningTimes] = useState<OpeningTime[]>();\n\n useEffect(() => {\n setNewOpeningTimes(openingTimes);\n }, [openingTimes]);\n\n const handleCheckBoxChange = useCallback(\n (id: string) => {\n setNewOpeningTimes((prevOpeningTimes) => {\n const updatedOpeningTimes = (prevOpeningTimes ?? []).map((openingTime) => {\n if (openingTime.id === id) {\n return { ...openingTime, isDisabled: !openingTime.isDisabled };\n }\n return openingTime;\n });\n\n if (typeof onChange === 'function') {\n onChange({\n enabledDays: updatedOpeningTimes\n .filter((item) => !item.isDisabled)\n .map((item) => item.id),\n });\n }\n\n return updatedOpeningTimes;\n });\n },\n [onChange],\n );\n\n const handleChange = useCallback(\n (newTime: Time, id: string) => {\n setNewOpeningTimes((prevOpeningTimes) => {\n const updatedOpeningTimes = (prevOpeningTimes ?? []).map((openingTime) => {\n if (openingTime.id === id) {\n const newTimes = openingTime.times.map((time) => {\n if (time.id === newTime.id) {\n return newTime;\n }\n\n return time;\n });\n\n return { ...openingTime, times: newTimes };\n }\n return openingTime;\n });\n\n if (typeof onChange === 'function') {\n onChange({ time: newTime });\n }\n\n return updatedOpeningTimes;\n });\n },\n [onChange],\n );\n\n const handleAdd = useCallback(\n (time: Time, id: string) => {\n setNewOpeningTimes((prevOpeningTimes) =>\n (prevOpeningTimes ?? []).map((openingTime) => {\n if (openingTime.id === id) {\n return { ...openingTime, times: [...openingTime.times, time] };\n }\n return openingTime;\n }),\n );\n\n if (typeof onTimeAdd === 'function') {\n onTimeAdd({ dayId: id, time });\n }\n },\n [onTimeAdd],\n );\n\n const handleRemove = useCallback(\n (id: string) => {\n setNewOpeningTimes((prevOpeningTimes) =>\n (prevOpeningTimes ?? []).map((openingTime) => {\n const newTimes = openingTime.times.filter((time) => time.id !== id);\n\n return { ...openingTime, times: newTimes };\n }),\n );\n\n if (typeof onTimeRemove === 'function') {\n onTimeRemove(id);\n }\n },\n [onTimeRemove],\n );\n\n const content = useMemo(() => {\n const items: ReactElement[] = [];\n\n if (!newOpeningTimes) {\n return items;\n }\n\n newOpeningTimes.forEach(({ times, id, weekdayId, isDisabled }) => {\n const weekday = weekdays.find((weekDay) => weekDay.id === weekdayId)?.name;\n\n if (!weekday) {\n return;\n }\n\n items.push(\n <StyledOpeningTimesWrapper key={`openingTimes__${id}`}>\n <Checkbox isChecked={!isDisabled} onChange={() => handleCheckBoxChange(id)}>\n {weekday}\n </Checkbox>\n <OpeningInputs\n id={id}\n times={times}\n isDisabled={isDisabled}\n onChange={(newTime) => handleChange(newTime, id)}\n onRemove={handleRemove}\n onAdd={handleAdd}\n />\n </StyledOpeningTimesWrapper>,\n );\n });\n\n return items;\n }, [handleAdd, handleChange, handleCheckBoxChange, handleRemove, newOpeningTimes, weekdays]);\n\n return useMemo(() => <StyledOpeningTimes>{content}</StyledOpeningTimes>, [content]);\n};\n\nOpeningTimes.displayName = 'OpeningTimes';\n\nexport default OpeningTimes;\n"],"mappings":"AAAA,OAAOA,KAAK,IAAQC,WAAW,EAAEC,SAAS,EAAEC,OAAO,EAAEC,QAAQ,QAA2B,OAAO;AAE/F,SAASC,QAAQ,QAAQ,yBAAyB;AAClD,OAAOC,aAAa,MAAM,gCAAgC;AAC1D,SAASC,kBAAkB,EAAEC,yBAAyB,QAAQ,uBAAuB;AA0BrF,MAAMC,YAAmC,GAAGC,IAAA,IAMtC;EAAA,IANuC;IACzCC,YAAY;IACZC,QAAQ;IACRC,QAAQ;IACRC,SAAS;IACTC;EACJ,CAAC,GAAAL,IAAA;EACG,MAAM,CAACM,eAAe,EAAEC,kBAAkB,CAAC,GAAGb,QAAQ,CAAgB,CAAC;EAEvEF,SAAS,CAAC,MAAM;IACZe,kBAAkB,CAACN,YAAY,CAAC;EACpC,CAAC,EAAE,CAACA,YAAY,CAA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C,CAAC;AACvF,CAAC;AAED3B,YAAY,CAAC0C,WAAW,GAAG,cAAc;AAEzC,eAAe1C,YAAY"}
1
+ {"version":3,"file":"OpeningTimes.js","names":["Checkbox","Tooltip","useElementSize","React","useCallback","useEffect","useMemo","useRef","useState","OpeningInputs","StyledOpeningTimes","StyledOpeningTimesTooltipContent","StyledOpeningTimesWeekDay","StyledOpeningTimesWrapper","OpeningTimes","_ref","closedText","currentDayId","editMode","openingTimes","weekdays","onChange","onTimeAdd","onTimeRemove","newOpeningTimes","setNewOpeningTimes","ref","handleCheckBoxChange","id","prevOpeningTimes","updatedOpeningTimes","map","openingTime","isDisabled","enabledDays","filter","item","handleChange","newTime","newTimes","times","time","handleAdd","dayId","handleRemove","content","items","forEach","_ref2","weekdayId","weekday","find","weekDay","name","push","createElement","key","isChecked","onRemove","onAdd","size","displayedContent","singleDay","_ref3","element","style","width","displayName"],"sources":["../../../src/components/opening-times/OpeningTimes.tsx"],"sourcesContent":["import { Checkbox, Tooltip, useElementSize } from '@chayns-components/core';\nimport React, {\n FC,\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n type ReactElement,\n} from 'react';\nimport type { OnChange, OnTimeAdd, OpeningTime, Time, Weekday } from '../../types/openingTimes';\nimport OpeningInputs from './opening-inputs/OpeningInputs';\nimport {\n StyledOpeningTimes,\n StyledOpeningTimesTooltipContent,\n StyledOpeningTimesWeekDay,\n StyledOpeningTimesWrapper,\n} from './OpeningTimes.styles';\n\nexport type OpeningTimesProps = {\n /**\n * The text that should be displayed when a day is closed.\n */\n closedText?: string;\n /**\n * If set just the current day is displayed and the whole week in a tooltip.\n */\n currentDayId?: OpeningTime['id'];\n /**\n * Whether the opening times can be edited.\n */\n editMode?: boolean;\n /**\n * Function to be executed when a time is changed or a day is enabled/disabled.\n * @param openingTimes\n */\n onChange?: ({ time, enabledDays }: OnChange) => void;\n /**\n * Function to be executed when a time is added.\n */\n onTimeAdd?: ({ time, dayId }: OnTimeAdd) => void;\n /**\n * Function to be executed when a time is removed.\n */\n onTimeRemove?: (id: string) => void;\n /**\n * The opening times corresponding to its weekday.\n */\n openingTimes: OpeningTime[];\n /**\n * The weekdays that should be displayed.\n */\n weekdays: Weekday[];\n};\n\nconst OpeningTimes: FC<OpeningTimesProps> = ({\n closedText = 'closed',\n currentDayId,\n editMode = false,\n openingTimes,\n weekdays,\n onChange,\n onTimeAdd,\n onTimeRemove,\n}) => {\n const [newOpeningTimes, setNewOpeningTimes] = useState<OpeningTime[]>();\n\n const ref = useRef<HTMLDivElement>(null);\n\n useEffect(() => {\n setNewOpeningTimes(openingTimes);\n }, [openingTimes]);\n\n const handleCheckBoxChange = useCallback(\n (id: string) => {\n setNewOpeningTimes((prevOpeningTimes) => {\n const updatedOpeningTimes = (prevOpeningTimes ?? []).map((openingTime) => {\n if (openingTime.id === id) {\n return { ...openingTime, isDisabled: !openingTime.isDisabled };\n }\n return openingTime;\n });\n\n if (typeof onChange === 'function') {\n onChange({\n enabledDays: updatedOpeningTimes\n .filter((item) => !item.isDisabled)\n .map((item) => item.id),\n });\n }\n\n return updatedOpeningTimes;\n });\n },\n [onChange],\n );\n\n const handleChange = useCallback(\n (newTime: Time, id: string) => {\n setNewOpeningTimes((prevOpeningTimes) => {\n const updatedOpeningTimes = (prevOpeningTimes ?? []).map((openingTime) => {\n if (openingTime.id === id) {\n const newTimes = openingTime.times.map((time) => {\n if (time.id === newTime.id) {\n return newTime;\n }\n\n return time;\n });\n\n return { ...openingTime, times: newTimes };\n }\n return openingTime;\n });\n\n if (typeof onChange === 'function') {\n onChange({ time: newTime });\n }\n\n return updatedOpeningTimes;\n });\n },\n [onChange],\n );\n\n const handleAdd = useCallback(\n (time: Time, id: string) => {\n setNewOpeningTimes((prevOpeningTimes) =>\n (prevOpeningTimes ?? []).map((openingTime) => {\n if (openingTime.id === id) {\n return { ...openingTime, times: [...openingTime.times, time] };\n }\n return openingTime;\n }),\n );\n\n if (typeof onTimeAdd === 'function') {\n onTimeAdd({ dayId: id, time });\n }\n },\n [onTimeAdd],\n );\n\n const handleRemove = useCallback(\n (id: string) => {\n setNewOpeningTimes((prevOpeningTimes) =>\n (prevOpeningTimes ?? []).map((openingTime) => {\n const newTimes = openingTime.times.filter((time) => time.id !== id);\n\n return { ...openingTime, times: newTimes };\n }),\n );\n\n if (typeof onTimeRemove === 'function') {\n onTimeRemove(id);\n }\n },\n [onTimeRemove],\n );\n\n const content = useMemo(() => {\n const items: ReactElement[] = [];\n\n if (!newOpeningTimes) {\n return items;\n }\n\n newOpeningTimes.forEach(({ times, id, weekdayId, isDisabled }) => {\n const weekday = weekdays.find((weekDay) => weekDay.id === weekdayId)?.name;\n\n if (!weekday) {\n return;\n }\n\n items.push(\n <StyledOpeningTimesWrapper key={`openingTimes__${id}`}>\n {editMode ? (\n <Checkbox isChecked={!isDisabled} onChange={() => handleCheckBoxChange(id)}>\n {weekday}\n </Checkbox>\n ) : (\n <StyledOpeningTimesWeekDay>{weekday}</StyledOpeningTimesWeekDay>\n )}\n <OpeningInputs\n closedText={closedText}\n id={id}\n times={times}\n isDisabled={isDisabled}\n onChange={(newTime) => handleChange(newTime, id)}\n onRemove={handleRemove}\n onAdd={handleAdd}\n editMode={editMode}\n />\n </StyledOpeningTimesWrapper>,\n );\n });\n\n return items;\n }, [\n closedText,\n editMode,\n handleAdd,\n handleChange,\n handleCheckBoxChange,\n handleRemove,\n newOpeningTimes,\n weekdays,\n ]);\n\n const size = useElementSize(ref);\n\n const displayedContent = useMemo(() => {\n if (!currentDayId || editMode) {\n return content;\n }\n\n const singleDay = newOpeningTimes?.find(({ id }) => id === currentDayId);\n\n if (!singleDay) {\n return content;\n }\n\n const { id, times, weekdayId } = singleDay;\n\n const weekday = weekdays.find((weekDay) => weekDay.id === weekdayId)?.name;\n\n const element = (\n <StyledOpeningTimesWrapper\n key={`currentDay__${currentDayId}`}\n style={size && { width: size.width }}\n >\n <StyledOpeningTimesWeekDay>{weekday}</StyledOpeningTimesWeekDay>\n <OpeningInputs closedText={closedText} id={id} times={times} editMode={editMode} />\n </StyledOpeningTimesWrapper>\n );\n\n return (\n <Tooltip\n item={\n <StyledOpeningTimesTooltipContent key=\"opening-time-tooltip\">\n {content}\n </StyledOpeningTimesTooltipContent>\n }\n >\n {element}\n </Tooltip>\n );\n }, [closedText, content, currentDayId, editMode, newOpeningTimes, weekdays, size]);\n\n return useMemo(\n () => <StyledOpeningTimes ref={ref}>{displayedContent}</StyledOpeningTimes>,\n [displayedContent],\n );\n};\n\nOpeningTimes.displayName = 'OpeningTimes';\n\nexport default OpeningTimes;\n"],"mappings":"AAAA,SAASA,QAAQ,EAAEC,OAAO,EAAEC,cAAc,QAAQ,yBAAyB;AAC3E,OAAOC,KAAK,IAERC,WAAW,EACXC,SAAS,EACTC,OAAO,EACPC,MAAM,EACNC,QAAQ,QAEL,OAAO;AAEd,OAAOC,aAAa,MAAM,gCAAgC;AAC1D,SACIC,kBAAkB,EAClBC,gCAAgC,EAChCC,yBAAyB,EACzBC,yBAAyB,QACtB,uBAAuB;AAsC9B,MAAMC,YAAmC,GAAGC,IAAA,IAStC;EAAA,IATuC;IACzCC,UAAU,GAAG,QAAQ;IACrBC,YAAY;IACZC,QAAQ,GAAG,KAAK;IAChBC,YAAY;IACZC,QAAQ;IACRC,QAAQ;IACRC,SAAS;IACTC;EACJ,CAAC,GAAAR,IAAA;EACG,MAAM,CAACS,eAAe,EAAEC,kBAAkB,CAAC,GAAGjB,QAAQ,CAAgB,CAAC;EAEvE,MAAMkB,GAAG,GAAGnB,MAAM,CAAiB,IAAI,CAAC;EAExCF,SAAS,CAAC,MAAM;IACZoB,kBAAkB,CAACN,YAAY,CAAC;EACpC,CAAC,EAAE,CAACA,YAAY,CAAC,CAAC;EAElB,MAAMQ,oBAAoB,GAAGvB,WAAW,CACnCwB,EAAU,IAAK;IACZH,kBAAkB,CAAEI,gBAAgB,IAAK;MACrC,MAAMC,mBAAmB,GAAG,CAACD,gBAAgB,IAAI,EAAE,EAAEE,GAAG,CAAEC,WA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CAAC7C,kBAAkB;IAACgB,GAAG,EAAEA;EAAI,GAAEmC,gBAAqC,CAAC,EAC3E,CAACA,gBAAgB,CACrB,CAAC;AACL,CAAC;AAED/C,YAAY,CAACqD,WAAW,GAAG,cAAc;AAEzC,eAAerD,YAAY"}
@@ -5,4 +5,8 @@ type StyledSliderButtonProps = WithTheme<{
5
5
  }>;
6
6
  export declare const StyledOpeningTimes: import("styled-components").IStyledComponent<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, StyledSliderButtonProps>>;
7
7
  export declare const StyledOpeningTimesWrapper: import("styled-components").IStyledComponent<"web", import("styled-components/dist/types").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>>;
8
+ export declare const StyledOpeningTimesTooltipContent: import("styled-components").IStyledComponent<"web", import("styled-components/dist/types").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>>;
9
+ export declare const StyledOpeningTimesWeekDay: import("styled-components").IStyledComponent<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
10
+ theme: import("@chayns-components/core/lib/components/color-scheme-provider/ColorSchemeProvider").Theme;
11
+ }>>;
8
12
  export {};
@@ -8,5 +8,17 @@ export const StyledOpeningTimesWrapper = styled.div`
8
8
  display: flex;
9
9
  align-items: baseline;
10
10
  justify-content: space-between;
11
+ gap: 16px;
12
+ `;
13
+ export const StyledOpeningTimesTooltipContent = styled.div`
14
+ padding: 8px;
15
+ `;
16
+ export const StyledOpeningTimesWeekDay = styled.div`
17
+ color: ${_ref => {
18
+ let {
19
+ theme
20
+ } = _ref;
21
+ return theme.text;
22
+ }};
11
23
  `;
12
24
  //# sourceMappingURL=OpeningTimes.styles.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"OpeningTimes.styles.js","names":["styled","StyledOpeningTimes","div","StyledOpeningTimesWrapper"],"sources":["../../../src/components/opening-times/OpeningTimes.styles.ts"],"sourcesContent":["import type { WithTheme } from '@chayns-components/core';\nimport styled from 'styled-components';\n\ntype StyledSliderButtonProps = WithTheme<{ $isDisabled?: boolean }>;\n\nexport const StyledOpeningTimes = styled.div<StyledSliderButtonProps>`\n display: flex;\n flex-direction: column;\n gap: 8px;\n`;\n\nexport const StyledOpeningTimesWrapper = styled.div`\n display: flex;\n align-items: baseline;\n justify-content: space-between;\n`;\n"],"mappings":"AACA,OAAOA,MAAM,MAAM,mBAAmB;AAItC,OAAO,MAAMC,kBAAkB,GAAGD,MAAM,CAACE,GAA6B;AACtE;AACA;AACA;AACA,CAAC;AAED,OAAO,MAAMC,yBAAyB,GAAGH,MAAM,CAACE,GAAI;AACpD;AACA;AACA;AACA,CAAC"}
1
+ {"version":3,"file":"OpeningTimes.styles.js","names":["styled","StyledOpeningTimes","div","StyledOpeningTimesWrapper","StyledOpeningTimesTooltipContent","StyledOpeningTimesWeekDay","_ref","theme","text"],"sources":["../../../src/components/opening-times/OpeningTimes.styles.ts"],"sourcesContent":["import type { WithTheme } from '@chayns-components/core';\nimport styled from 'styled-components';\n\ntype StyledSliderButtonProps = WithTheme<{ $isDisabled?: boolean }>;\n\nexport const StyledOpeningTimes = styled.div<StyledSliderButtonProps>`\n display: flex;\n flex-direction: column;\n gap: 8px;\n`;\n\nexport const StyledOpeningTimesWrapper = styled.div`\n display: flex;\n align-items: baseline;\n justify-content: space-between;\n gap: 16px;\n`;\n\nexport const StyledOpeningTimesTooltipContent = styled.div`\n padding: 8px;\n`;\n\ntype StyledOpeningTimesWeekDayProps = WithTheme<unknown>;\n\nexport const StyledOpeningTimesWeekDay = styled.div<StyledOpeningTimesWeekDayProps>`\n color: ${({ theme }: StyledOpeningTimesWeekDayProps) => theme.text};\n`;\n"],"mappings":"AACA,OAAOA,MAAM,MAAM,mBAAmB;AAItC,OAAO,MAAMC,kBAAkB,GAAGD,MAAM,CAACE,GAA6B;AACtE;AACA;AACA;AACA,CAAC;AAED,OAAO,MAAMC,yBAAyB,GAAGH,MAAM,CAACE,GAAI;AACpD;AACA;AACA;AACA;AACA,CAAC;AAED,OAAO,MAAME,gCAAgC,GAAGJ,MAAM,CAACE,GAAI;AAC3D;AACA,CAAC;AAID,OAAO,MAAMG,yBAAyB,GAAGL,MAAM,CAACE,GAAoC;AACpF,aAAaI,IAAA;EAAA,IAAC;IAAEC;EAAsC,CAAC,GAAAD,IAAA;EAAA,OAAKC,KAAK,CAACC,IAAI;AAAA,CAAC;AACvE,CAAC"}
@@ -3,10 +3,12 @@ import { type Time } from '../../../types/openingTimes';
3
3
  export type OpeningInputsProps = {
4
4
  times: Time[];
5
5
  isDisabled?: boolean;
6
- onChange: (time: Time) => void;
7
- onAdd: (time: Time, id: string) => void;
8
- onRemove: (id: Time['id']) => void;
6
+ onChange?: (time: Time) => void;
7
+ onAdd?: (time: Time, id: string) => void;
8
+ onRemove?: (id: Time['id']) => void;
9
9
  id: string;
10
+ editMode: boolean;
11
+ closedText: string;
10
12
  };
11
13
  declare const OpeningInputs: FC<OpeningInputsProps>;
12
14
  export default OpeningInputs;
@@ -3,7 +3,7 @@ import React, { useCallback, useEffect, useMemo, useState } from 'react';
3
3
  import { v4 as uuidV4 } from 'uuid';
4
4
  import { OpeningTimesButtonType } from '../../../types/openingTimes';
5
5
  import OpeningInput from './opening-input/OpeningInput';
6
- import { StyledOpeningInputs } from './OpeningInputs.styles';
6
+ import { StyledOpeningInputPreview, StyledOpeningInputs } from './OpeningInputs.styles';
7
7
  const OpeningInputs = _ref => {
8
8
  let {
9
9
  times,
@@ -11,7 +11,9 @@ const OpeningInputs = _ref => {
11
11
  onRemove,
12
12
  onAdd,
13
13
  id,
14
- onChange
14
+ onChange,
15
+ editMode,
16
+ closedText
15
17
  } = _ref;
16
18
  const [newTimes, setNewTimes] = useState();
17
19
  useEffect(() => {
@@ -24,11 +26,15 @@ const OpeningInputs = _ref => {
24
26
  id: uuidV4()
25
27
  };
26
28
  setNewTimes(prevState => prevState ? [...prevState, defaultTime] : [defaultTime]);
27
- onAdd(defaultTime, id);
29
+ if (typeof onAdd === 'function') {
30
+ onAdd(defaultTime, id);
31
+ }
28
32
  }, [id, onAdd]);
29
33
  const handleRemove = useCallback(timeId => {
30
34
  setNewTimes(prevState => (prevState ?? []).filter(time => time.id !== timeId));
31
- onRemove(timeId);
35
+ if (typeof onRemove === 'function') {
36
+ onRemove(timeId);
37
+ }
32
38
  }, [onRemove]);
33
39
  const handleChange = useCallback(newTime => {
34
40
  setNewTimes(prevState => {
@@ -38,7 +44,9 @@ const OpeningInputs = _ref => {
38
44
  }
39
45
  return time;
40
46
  });
41
- onChange(newTime);
47
+ if (typeof onChange === 'function') {
48
+ onChange(newTime);
49
+ }
42
50
  return updatedTimes;
43
51
  });
44
52
  }, [onChange]);
@@ -53,6 +61,13 @@ const OpeningInputs = _ref => {
53
61
  start,
54
62
  id: timeId
55
63
  } = _ref2;
64
+ if (!editMode) {
65
+ const text = isDisabled ? closedText : `${start} - ${end}`;
66
+ items.push( /*#__PURE__*/React.createElement(StyledOpeningInputPreview, {
67
+ key: `opening-times-preview__${id}.${timeId}`
68
+ }, text));
69
+ return;
70
+ }
56
71
  if (index > 1) {
57
72
  return;
58
73
  }
@@ -75,7 +90,7 @@ const OpeningInputs = _ref => {
75
90
  }));
76
91
  });
77
92
  return items;
78
- }, [handleAdd, handleChange, handleRemove, id, isDisabled, newTimes, times.length]);
93
+ }, [closedText, editMode, handleAdd, handleChange, handleRemove, id, isDisabled, newTimes, times.length]);
79
94
  return useMemo(() => /*#__PURE__*/React.createElement(StyledOpeningInputs, null, /*#__PURE__*/React.createElement(AnimatePresence, {
80
95
  initial: false
81
96
  }, content)), [content]);
@@ -1 +1 @@
1
- {"version":3,"file":"OpeningInputs.js","names":["AnimatePresence","React","useCallback","useEffect","useMemo","useState","v4","uuidV4","OpeningTimesButtonType","OpeningInput","StyledOpeningInputs","OpeningInputs","_ref","times","isDisabled","onRemove","onAdd","id","onChange","newTimes","setNewTimes","handleAdd","defaultTime","start","end","prevState","handleRemove","timeId","filter","time","handleChange","newTime","updatedTimes","map","content","items","forEach","_ref2","index","buttonType","NONE","length","ADD","REMOVE","push","createElement","key","initial","displayName"],"sources":["../../../../src/components/opening-times/opening-inputs/OpeningInputs.tsx"],"sourcesContent":["import { AnimatePresence } from 'framer-motion';\nimport React, { FC, useCallback, useEffect, useMemo, useState, type ReactElement } from 'react';\nimport { v4 as uuidV4 } from 'uuid';\nimport { OpeningTimesButtonType, type Time } from '../../../types/openingTimes';\nimport OpeningInput from './opening-input/OpeningInput';\nimport { StyledOpeningInputs } from './OpeningInputs.styles';\n\nexport type OpeningInputsProps = {\n times: Time[];\n isDisabled?: boolean;\n onChange: (time: Time) => void;\n onAdd: (time: Time, id: string) => void;\n onRemove: (id: Time['id']) => void;\n id: string;\n};\n\nconst OpeningInputs: FC<OpeningInputsProps> = ({\n times,\n isDisabled,\n onRemove,\n onAdd,\n id,\n onChange,\n}) => {\n const [newTimes, setNewTimes] = useState<Time[]>();\n\n useEffect(() => {\n setNewTimes(times);\n }, [times]);\n\n const handleAdd = useCallback(() => {\n const defaultTime: Time = { start: '08:00', end: '18:00', id: uuidV4() };\n\n setNewTimes((prevState) => (prevState ? [...prevState, defaultTime] : [defaultTime]));\n\n onAdd(defaultTime, id);\n }, [id, onAdd]);\n\n const handleRemove = useCallback(\n (timeId: string) => {\n setNewTimes((prevState) => (prevState ?? []).filter((time) => time.id !== timeId));\n\n onRemove(timeId);\n },\n [onRemove],\n );\n\n const handleChange = useCallback(\n (newTime: Time) => {\n setNewTimes((prevState) => {\n const updatedTimes = (prevState ?? []).map((time) => {\n if (time.id === newTime.id) {\n return newTime;\n }\n return time;\n });\n\n onChange(newTime);\n\n return updatedTimes;\n });\n },\n [onChange],\n );\n\n const content = useMemo(() => {\n const items: ReactElement[] = [];\n\n if (!newTimes) {\n return items;\n }\n\n newTimes.forEach(({ end, start, id: timeId }, index) => {\n if (index > 1) {\n return;\n }\n\n let buttonType = OpeningTimesButtonType.NONE;\n\n if (index === 0 && times.length === 1 && !isDisabled) {\n buttonType = OpeningTimesButtonType.ADD;\n } else if (index === 1 && !isDisabled) {\n buttonType = OpeningTimesButtonType.REMOVE;\n }\n\n items.push(\n <OpeningInput\n key={`opening-times-input__${id}.${timeId}`}\n start={start}\n id={timeId}\n end={end}\n isDisabled={isDisabled}\n buttonType={buttonType}\n onAdd={handleAdd}\n onChange={(time) => handleChange(time)}\n onRemove={() => handleRemove(timeId)}\n />,\n );\n });\n\n return items;\n }, [handleAdd, handleChange, handleRemove, id, isDisabled, newTimes, times.length]);\n\n return useMemo(\n () => (\n <StyledOpeningInputs>\n <AnimatePresence initial={false}>{content}</AnimatePresence>\n </StyledOpeningInputs>\n ),\n [content],\n );\n};\n\nOpeningInputs.displayName = 'OpeningInputs';\n\nexport default OpeningInputs;\n"],"mappings":"AAAA,SAASA,eAAe,QAAQ,eAAe;AAC/C,OAAOC,KAAK,IAAQC,WAAW,EAAEC,SAAS,EAAEC,OAAO,EAAEC,QAAQ,QAA2B,OAAO;AAC/F,SAASC,EAAE,IAAIC,MAAM,QAAQ,MAAM;AACnC,SAASC,sBAAsB,QAAmB,6BAA6B;AAC/E,OAAOC,YAAY,MAAM,8BAA8B;AACvD,SAASC,mBAAmB,QAAQ,wBAAwB;AAW5D,MAAMC,aAAqC,GAAGC,IAAA,IAOxC;EAAA,IAPyC;IAC3CC,KAAK;IACLC,UAAU;IACVC,QAAQ;IACRC,KAAK;IACLC,EAAE;IACFC;EACJ,CAAC,GAAAN,IAAA;EACG,MAAM,CAACO,QAAQ,EAAEC,WAAW,CAAC,GAAGf,QAAQ,CAAS,CAAC;EAElDF,SAAS,CAAC,MAAM;IACZiB,WAAW,CAACP,KAAK,CAAC;EACtB,CAAC,EAAE,CAACA,KAAK,CAAC,CAAC;EAEX,MAAMQ,SAAS,GAAGnB,WAAW,CAAC,MAAM;IAChC,MAAMo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ACqC,WAAW,GAAG,eAAe;AAE3C,eAAerC,aAAa"}
1
+ {"version":3,"file":"OpeningInputs.js","names":["AnimatePresence","React","useCallback","useEffect","useMemo","useState","v4","uuidV4","OpeningTimesButtonType","OpeningInput","StyledOpeningInputPreview","StyledOpeningInputs","OpeningInputs","_ref","times","isDisabled","onRemove","onAdd","id","onChange","editMode","closedText","newTimes","setNewTimes","handleAdd","defaultTime","start","end","prevState","handleRemove","timeId","filter","time","handleChange","newTime","updatedTimes","map","content","items","forEach","_ref2","index","text","push","createElement","key","buttonType","NONE","length","ADD","REMOVE","initial","displayName"],"sources":["../../../../src/components/opening-times/opening-inputs/OpeningInputs.tsx"],"sourcesContent":["import { AnimatePresence } from 'framer-motion';\nimport React, { FC, useCallback, useEffect, useMemo, useState, type ReactElement } from 'react';\nimport { v4 as uuidV4 } from 'uuid';\nimport { OpeningTimesButtonType, type Time } from '../../../types/openingTimes';\nimport OpeningInput from './opening-input/OpeningInput';\nimport { StyledOpeningInputPreview, StyledOpeningInputs } from './OpeningInputs.styles';\n\nexport type OpeningInputsProps = {\n times: Time[];\n isDisabled?: boolean;\n onChange?: (time: Time) => void;\n onAdd?: (time: Time, id: string) => void;\n onRemove?: (id: Time['id']) => void;\n id: string;\n editMode: boolean;\n closedText: string;\n};\n\nconst OpeningInputs: FC<OpeningInputsProps> = ({\n times,\n isDisabled,\n onRemove,\n onAdd,\n id,\n onChange,\n editMode,\n closedText,\n}) => {\n const [newTimes, setNewTimes] = useState<Time[]>();\n\n useEffect(() => {\n setNewTimes(times);\n }, [times]);\n\n const handleAdd = useCallback(() => {\n const defaultTime: Time = { start: '08:00', end: '18:00', id: uuidV4() };\n\n setNewTimes((prevState) => (prevState ? [...prevState, defaultTime] : [defaultTime]));\n\n if (typeof onAdd === 'function') {\n onAdd(defaultTime, id);\n }\n }, [id, onAdd]);\n\n const handleRemove = useCallback(\n (timeId: string) => {\n setNewTimes((prevState) => (prevState ?? []).filter((time) => time.id !== timeId));\n\n if (typeof onRemove === 'function') {\n onRemove(timeId);\n }\n },\n [onRemove],\n );\n\n const handleChange = useCallback(\n (newTime: Time) => {\n setNewTimes((prevState) => {\n const updatedTimes = (prevState ?? []).map((time) => {\n if (time.id === newTime.id) {\n return newTime;\n }\n return time;\n });\n\n if (typeof onChange === 'function') {\n onChange(newTime);\n }\n\n return updatedTimes;\n });\n },\n [onChange],\n );\n\n const content = useMemo(() => {\n const items: ReactElement[] = [];\n\n if (!newTimes) {\n return items;\n }\n\n newTimes.forEach(({ end, start, id: timeId }, index) => {\n if (!editMode) {\n const text = isDisabled ? closedText : `${start} - ${end}`;\n\n items.push(\n <StyledOpeningInputPreview key={`opening-times-preview__${id}.${timeId}`}>\n {text}\n </StyledOpeningInputPreview>,\n );\n\n return;\n }\n\n if (index > 1) {\n return;\n }\n\n let buttonType = OpeningTimesButtonType.NONE;\n\n if (index === 0 && times.length === 1 && !isDisabled) {\n buttonType = OpeningTimesButtonType.ADD;\n } else if (index === 1 && !isDisabled) {\n buttonType = OpeningTimesButtonType.REMOVE;\n }\n\n items.push(\n <OpeningInput\n key={`opening-times-input__${id}.${timeId}`}\n start={start}\n id={timeId}\n end={end}\n isDisabled={isDisabled}\n buttonType={buttonType}\n onAdd={handleAdd}\n onChange={(time) => handleChange(time)}\n onRemove={() => handleRemove(timeId)}\n />,\n );\n });\n\n return items;\n }, [\n closedText,\n editMode,\n handleAdd,\n handleChange,\n handleRemove,\n id,\n isDisabled,\n newTimes,\n times.length,\n ]);\n\n return useMemo(\n () => (\n <StyledOpeningInputs>\n <AnimatePresence initial={false}>{content}</AnimatePresence>\n </StyledOpeningInputs>\n ),\n [content],\n );\n};\n\nOpeningInputs.displayName = 'OpeningInputs';\n\nexport default OpeningInputs;\n"],"mappings":"AAAA,SAASA,eAAe,QAAQ,eAAe;AAC/C,OAAOC,KAAK,IAAQC,WAAW,EAAEC,SAAS,EAAEC,OAAO,EAAEC,QAAQ,QAA2B,OAAO;AAC/F,SAASC,EAAE,IAAIC,MAAM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,GAAGtC,sBAAsB,CAACyC,GAAG;MAC3C,CAAC,MAAM,IAAIR,KAAK,KAAK,CAAC,IAAI,CAAC1B,UAAU,EAAE;QACnC+B,UAAU,GAAGtC,sBAAsB,CAAC0C,MAAM;MAC9C;MAEAZ,KAAK,CAACK,IAAI,eACN1C,KAAA,CAAA2C,aAAA,CAACnC,YAAY;QACToC,GAAG,EAAG,wBAAuB3B,EAAG,IAAGY,MAAO,EAAE;QAC5CJ,KAAK,EAAEA,KAAM;QACbR,EAAE,EAAEY,MAAO;QACXH,GAAG,EAAEA,GAAI;QACTZ,UAAU,EAAEA,UAAW;QACvB+B,UAAU,EAAEA,UAAW;QACvB7B,KAAK,EAAEO,SAAU;QACjBL,QAAQ,EAAGa,IAAI,IAAKC,YAAY,CAACD,IAAI,CAAE;QACvChB,QAAQ,EAAEA,CAAA,KAAMa,YAAY,CAACC,MAAM;MAAE,CACxC,CACL,CAAC;IACL,CAAC,CAAC;IAEF,OAAOQ,KAAK;EAChB,CAAC,EAAE,CACCjB,UAAU,EACVD,QAAQ,EACRI,SAAS,EACTS,YAAY,EACZJ,YAAY,EACZX,EAAE,EACFH,UAAU,EACVO,QAAQ,EACRR,KAAK,CAACkC,MAAM,CACf,CAAC;EAEF,OAAO5C,OAAO,CACV,mBACIH,KAAA,CAAA2C,aAAA,CAACjC,mBAAmB,qBAChBV,KAAA,CAAA2C,aAAA,CAAC5C,eAAe;IAACmD,OAAO,EAAE;EAAM,GAAEd,OAAyB,CAC1C,CACxB,EACD,CAACA,OAAO,CACZ,CAAC;AACL,CAAC;AAEDzB,aAAa,CAACwC,WAAW,GAAG,eAAe;AAE3C,eAAexC,aAAa"}
@@ -1,2 +1,3 @@
1
1
  /// <reference types="react" />
2
2
  export declare const StyledOpeningInputs: import("styled-components").IStyledComponent<"web", import("styled-components/dist/types").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>>;
3
+ export declare const StyledOpeningInputPreview: import("styled-components").IStyledComponent<"web", import("styled-components/dist/types").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>>;
@@ -3,4 +3,5 @@ export const StyledOpeningInputs = styled.div`
3
3
  display: flex;
4
4
  flex-direction: column;
5
5
  `;
6
+ export const StyledOpeningInputPreview = styled.div``;
6
7
  //# sourceMappingURL=OpeningInputs.styles.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"OpeningInputs.styles.js","names":["styled","StyledOpeningInputs","div"],"sources":["../../../../src/components/opening-times/opening-inputs/OpeningInputs.styles.ts"],"sourcesContent":["import styled from 'styled-components';\n\nexport const StyledOpeningInputs = styled.div`\n display: flex;\n flex-direction: column;\n`;\n"],"mappings":"AAAA,OAAOA,MAAM,MAAM,mBAAmB;AAEtC,OAAO,MAAMC,mBAAmB,GAAGD,MAAM,CAACE,GAAI;AAC9C;AACA;AACA,CAAC"}
1
+ {"version":3,"file":"OpeningInputs.styles.js","names":["styled","StyledOpeningInputs","div","StyledOpeningInputPreview"],"sources":["../../../../src/components/opening-times/opening-inputs/OpeningInputs.styles.ts"],"sourcesContent":["import styled from 'styled-components';\n\nexport const StyledOpeningInputs = styled.div`\n display: flex;\n flex-direction: column;\n`;\n\nexport const StyledOpeningInputPreview = styled.div``;\n"],"mappings":"AAAA,OAAOA,MAAM,MAAM,mBAAmB;AAEtC,OAAO,MAAMC,mBAAmB,GAAGD,MAAM,CAACE,GAAI;AAC9C;AACA;AACA,CAAC;AAED,OAAO,MAAMC,yBAAyB,GAAGH,MAAM,CAACE,GAAI,EAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chayns-components/date",
3
- "version": "5.0.0-beta.466",
3
+ "version": "5.0.0-beta.470",
4
4
  "description": "A set of beautiful React components for developing your own applications with chayns.",
5
5
  "sideEffects": false,
6
6
  "browserslist": [
@@ -57,8 +57,9 @@
57
57
  "typescript": "^5.3.3"
58
58
  },
59
59
  "dependencies": {
60
- "@chayns-components/core": "^5.0.0-beta.466",
61
- "date-fns": "^2.30.0"
60
+ "@chayns-components/core": "^5.0.0-beta.470",
61
+ "date-fns": "^2.30.0",
62
+ "uuid": "^9.0.1"
62
63
  },
63
64
  "peerDependencies": {
64
65
  "chayns-api": ">=1.0.50",
@@ -70,5 +71,5 @@
70
71
  "publishConfig": {
71
72
  "access": "public"
72
73
  },
73
- "gitHead": "a6c6f033e364471eb8d4d7b06de02071b1f01b11"
74
+ "gitHead": "23402f3f25399df243dc2d4daa89fe50020953a0"
74
75
  }