@mappedin/viewer 0.35.2-3613294.0 → 0.35.2-50f0fde.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -7704,6 +7704,31 @@ const m7e = "Loading...", y7e = "Stairs", C7e = "Elevator", v7e = "Connection",
7704
7704
  "context-menu": {
7705
7705
  "directions-to-point": "Directions to this point",
7706
7706
  "share-point": "Share this point"
7707
+ },
7708
+ "operation-hours": {
7709
+ midnight: "midnight",
7710
+ noon: "noon",
7711
+ "open-24-hours": "Open 24 hours",
7712
+ closed: "Closed",
7713
+ "open-now": "Open now",
7714
+ "opening-soon": "Opening soon",
7715
+ "closing-soon": "Closing soon",
7716
+ "opens-at": "Opens {{time}}",
7717
+ "closes-at": "Closes {{time}}",
7718
+ "sunday-short": "Sun",
7719
+ "monday-short": "Mon",
7720
+ "tuesday-short": "Tue",
7721
+ "wednesday-short": "Wed",
7722
+ "thursday-short": "Thu",
7723
+ "friday-short": "Fri",
7724
+ "saturday-short": "Sat",
7725
+ "sunday-time": "{{time}} Sun",
7726
+ "monday-time": "{{time}} Mon",
7727
+ "tuesday-time": "{{time}} Tue",
7728
+ "wednesday-time": "{{time}} Wed",
7729
+ "thursday-time": "{{time}} Thu",
7730
+ "friday-time": "{{time}} Fri",
7731
+ "saturday-time": "{{time}} Sat"
7707
7732
  }
7708
7733
  }, N7e = {
7709
7734
  "access-features": "Access Features",
@@ -9673,6 +9698,7 @@ const t2 = new Zde("[Mappedin Viewer]"), cS = {}, q2e = (t) => t.startsWith("htt
9673
9698
  placeholder: "#BFBFBF",
9674
9699
  inverted: "#FFFFFF",
9675
9700
  error: "#D46B08",
9701
+ error2: "#CF1322",
9676
9702
  link: "#1890FF"
9677
9703
  },
9678
9704
  map: {
@@ -9712,7 +9738,8 @@ const t2 = new Zde("[Mappedin Viewer]"), cS = {}, q2e = (t) => t.startsWith("htt
9712
9738
  small: 14,
9713
9739
  normal: 16,
9714
9740
  large: 18,
9715
- xlarge: 20
9741
+ xlarge: 20,
9742
+ title: 22
9716
9743
  },
9717
9744
  borderRadius: {
9718
9745
  primary: 4,
@@ -9753,7 +9780,8 @@ const t2 = new Zde("[Mappedin Viewer]"), cS = {}, q2e = (t) => t.startsWith("htt
9753
9780
  small: 12,
9754
9781
  normal: 14,
9755
9782
  large: 16,
9756
- xlarge: 18
9783
+ xlarge: 18,
9784
+ title: 20
9757
9785
  }, Kde = (t) => ({
9758
9786
  ...t,
9759
9787
  fontSize: Xde
@@ -9778,6 +9806,7 @@ const t2 = new Zde("[Mappedin Viewer]"), cS = {}, q2e = (t) => t.startsWith("htt
9778
9806
  tertiary: "#7E7D7D",
9779
9807
  quaternary: "#6A9FA0",
9780
9808
  error: "#C47947",
9809
+ error2: "#BE5050",
9781
9810
  highlight: "#65ADAE",
9782
9811
  link: "#6A9FA0"
9783
9812
  },
@@ -9838,6 +9867,7 @@ const t2 = new Zde("[Mappedin Viewer]"), cS = {}, q2e = (t) => t.startsWith("htt
9838
9867
  tertiary: "#969EA8",
9839
9868
  quaternary: "#C7C7C7",
9840
9869
  error: "#DA9D70",
9870
+ error2: "#BA5959",
9841
9871
  highlight: "#6ABBEE",
9842
9872
  placeholder: "#969EA8",
9843
9873
  link: "#649CBE"
@@ -9901,6 +9931,7 @@ const t2 = new Zde("[Mappedin Viewer]"), cS = {}, q2e = (t) => t.startsWith("htt
9901
9931
  tertiary: "#AAA9A9",
9902
9932
  quaternary: "#46A7BD",
9903
9933
  error: "#D17C43",
9934
+ error2: "#C24C4C",
9904
9935
  highlight: "#46A7BD",
9905
9936
  link: "#46A7BD"
9906
9937
  },
@@ -9963,6 +9994,7 @@ const t2 = new Zde("[Mappedin Viewer]"), cS = {}, q2e = (t) => t.startsWith("htt
9963
9994
  highlight: "#6A8EFF",
9964
9995
  placeholder: "#989A9E",
9965
9996
  error: "#D19D87",
9997
+ error2: "#BB5E5E",
9966
9998
  link: "#7991DC"
9967
9999
  },
9968
10000
  map: {
@@ -10028,6 +10060,7 @@ const t2 = new Zde("[Mappedin Viewer]"), cS = {}, q2e = (t) => t.startsWith("htt
10028
10060
  highlight: "#6A8EFF",
10029
10061
  placeholder: "#989A9E",
10030
10062
  error: "#D19D87",
10063
+ error2: "#BB5E5E",
10031
10064
  link: "#cc6b2b"
10032
10065
  },
10033
10066
  map: {
@@ -10089,6 +10122,7 @@ const t2 = new Zde("[Mappedin Viewer]"), cS = {}, q2e = (t) => t.startsWith("htt
10089
10122
  tertiary: "#AAA9A9",
10090
10123
  quaternary: "#C14D4D",
10091
10124
  error: "#D17C43",
10125
+ error2: "#C24C4C",
10092
10126
  highlight: "#C14D4D",
10093
10127
  link: "#C14D4D"
10094
10128
  },
@@ -68749,6 +68783,16 @@ const oce = /* @__PURE__ */ new Map([
68749
68783
  }
68750
68784
  ) })
68751
68785
  ],
68786
+ [
68787
+ "clock-32x32",
68788
+ /* @__PURE__ */ Z.jsx("svg", { viewBox: "0 0 32 32", stroke: "none", children: /* @__PURE__ */ Z.jsx(
68789
+ "path",
68790
+ {
68791
+ d: "M16 0C12.8355 0 9.74207 0.938383 7.11088 2.69649C4.4797 4.45459 2.42894 6.95344 1.21793 9.87706C0.00693255 12.8007 -0.309921 16.0177 0.307443 19.1214C0.924806 22.2251 2.44866 25.0761 4.6863 27.3137C6.92394 29.5513 9.77486 31.0752 12.8786 31.6926C15.9823 32.3099 19.1993 31.9931 22.1229 30.7821C25.0466 29.5711 27.5454 27.5203 29.3035 24.8891C31.0616 22.2579 32 19.1645 32 16C31.9955 11.7579 30.3084 7.69085 27.3088 4.69124C24.3092 1.69163 20.2421 0.00447972 16 0ZM16 29.5385C13.3223 29.5385 10.7048 28.7444 8.47844 27.2568C6.25205 25.7692 4.51679 23.6548 3.4921 21.1809C2.4674 18.7071 2.1993 15.985 2.72168 13.3588C3.24407 10.7326 4.53348 8.32025 6.42687 6.42686C8.32026 4.53347 10.7326 3.24406 13.3588 2.72168C15.985 2.19929 18.7071 2.4674 21.1809 3.49209C23.6548 4.51679 25.7692 6.25204 27.2568 8.47843C28.7444 10.7048 29.5385 13.3223 29.5385 16C29.5344 19.5894 28.1067 23.0306 25.5686 25.5686C23.0306 28.1067 19.5894 29.5344 16 29.5385ZM25.8462 16C25.8462 16.3264 25.7165 16.6395 25.4857 16.8703C25.2549 17.1011 24.9418 17.2308 24.6154 17.2308H16C15.6736 17.2308 15.3605 17.1011 15.1297 16.8703C14.8989 16.6395 14.7692 16.3264 14.7692 16V7.38461C14.7692 7.05819 14.8989 6.74514 15.1297 6.51433C15.3605 6.28351 15.6736 6.15384 16 6.15384C16.3264 6.15384 16.6395 6.28351 16.8703 6.51433C17.1011 6.74514 17.2308 7.05819 17.2308 7.38461V14.7692H24.6154C24.9418 14.7692 25.2549 14.8989 25.4857 15.1297C25.7165 15.3605 25.8462 15.6736 25.8462 16Z",
68792
+ stroke: "none"
68793
+ }
68794
+ ) })
68795
+ ],
68752
68796
  [
68753
68797
  "star-40x40",
68754
68798
  /* @__PURE__ */ Z.jsx("svg", { viewBox: "0 0 40 40", stroke: "none", children: /* @__PURE__ */ Z.jsx(
@@ -76442,7 +76486,10 @@ const Stt = (t) => {
76442
76486
  `, ME = ct(L0)`
76443
76487
  padding: 16px;
76444
76488
  background-color: transparent;
76445
- `, Ftt = ct.div.attrs({ id: "image-carousel" })`
76489
+ `, Ftt = ct.div.attrs({
76490
+ id: "image-carousel",
76491
+ $outlineOffset: -4
76492
+ })`
76446
76493
  position: relative;
76447
76494
  overflow: hidden;
76448
76495
 
@@ -0,0 +1,2 @@
1
+ import { Story } from '@ladle/react';
2
+ export declare const Default: Story;
@@ -0,0 +1,6 @@
1
+ import { Area } from '../../lib/sdk';
2
+ type TAreaMarkerProps = {
3
+ area: Area;
4
+ };
5
+ declare const AreaMarker: React.FC<TAreaMarkerProps>;
6
+ export default AreaMarker;
@@ -1,6 +1,7 @@
1
1
  import { ComponentProps } from 'react';
2
2
  import { TOnClickOrPressPayload } from '../button';
3
3
  import SocialsItem from '../socials-item';
4
+ import OpeningHours from '../../lib/time/opening-hours';
4
5
  export declare const METADATA_CARD_WIDTH = 320;
5
6
  export declare const METADATA_CARD_PADDING = 20;
6
7
  export declare const HERO_IMAGE_HEIGHT = 200;
@@ -50,6 +51,10 @@ export type TMetadataCardProps = {
50
51
  id: string;
51
52
  name: string;
52
53
  }[];
54
+ /**
55
+ * Opening hours to show in the card.
56
+ */
57
+ hours?: OpeningHours;
53
58
  /**
54
59
  * URL to show on a button just above the directions button.
55
60
  */
@@ -0,0 +1,9 @@
1
+ import OpeningHours from '../../lib/time/opening-hours';
2
+ import React from 'react';
3
+ export declare const HOURS_LIST_HEIGHT = 24;
4
+ type THoursListProps = {
5
+ hours: OpeningHours;
6
+ date?: Date;
7
+ };
8
+ declare const HoursList: React.FC<THoursListProps>;
9
+ export default HoursList;
@@ -0,0 +1,7 @@
1
+ import OpeningHours from '../../lib/time/opening-hours';
2
+ type TOperationHoursProps = {
3
+ hours: OpeningHours;
4
+ date?: Date;
5
+ };
6
+ declare const OperationHours: React.FC<TOperationHoursProps>;
7
+ export default OperationHours;
@@ -0,0 +1,9 @@
1
+ import OpeningHours from '../../lib/time/opening-hours';
2
+ type TOpenStatusProps = {
3
+ hours: OpeningHours;
4
+ onClick?: () => void;
5
+ chevron?: 'right' | 'down';
6
+ date?: Date;
7
+ };
8
+ declare const OpenStatus: React.FC<TOpenStatusProps>;
9
+ export default OpenStatus;
@@ -0,0 +1,4 @@
1
+ import { Story } from '@ladle/react';
2
+ export declare const Default: Story;
3
+ export declare const Hours: Story;
4
+ export declare const Status: Story;
@@ -0,0 +1,72 @@
1
+ import Time from './time';
2
+ import { TOpeningHours } from './types';
3
+ /**
4
+ * Class with a time and day of the week.
5
+ */
6
+ declare class TimeOfWeek {
7
+ #private;
8
+ constructor(time: Time, day: number);
9
+ get day(): number;
10
+ get time(): Time;
11
+ toLocaleString(locale: string, options?: Partial<{
12
+ includeDay: boolean;
13
+ }>): string;
14
+ }
15
+ /**
16
+ * A set of opening hours for a location defined in local time within a specific timezone.
17
+ */
18
+ declare class OpeningHours {
19
+ #private;
20
+ /**
21
+ * Create a new OpeningHours object.
22
+ */
23
+ constructor(openingHours: TOpeningHours, tz: string);
24
+ /**
25
+ * Return a {@link Time} object in the store's timezone. Defaults to the current date.
26
+ */
27
+ getTime(date?: Date): Time;
28
+ /**
29
+ * Return a day of the week as a number in the store's timezone. Defaults to the current date.
30
+ */
31
+ getDay(date?: Date): number;
32
+ /**
33
+ * Return an array of localized, formatted string representations of the opening hours for each
34
+ * day of the week. The first entry in the array is the provided date's opening hours. If no
35
+ * date is provided, the current date is used.
36
+ */
37
+ toLocaleStrings(locale: string, date?: Date): (readonly [string, string])[];
38
+ /**
39
+ * Return true if the opening hours are open 24/7.
40
+ */
41
+ isOpen247(): boolean;
42
+ /**
43
+ * Return true if the opening hours are always closed.
44
+ */
45
+ isClosed247(): boolean;
46
+ /**
47
+ * Returns true if a given {@link Date} is within the opening hours. Defaults to checking the
48
+ * current date.
49
+ */
50
+ isOpen(date?: Date): boolean;
51
+ /**
52
+ * Return true if a given {@link Date} is within 1 hour of the opening hours. Returns false if
53
+ * the store is already open. Defaults to checking the current date.
54
+ */
55
+ isOpeningSoon(date?: Date): boolean;
56
+ /**
57
+ * Return true if a given {@link Date} is within 1 hour of the closing hours. Returns false if
58
+ * the store is already closed. Defaults to checking the current date.
59
+ */
60
+ isClosingSoon(date?: Date): boolean;
61
+ /**
62
+ * Returns the next time the store will open from a given date. Defaults to checking the current
63
+ * date.
64
+ */
65
+ opensAt(date?: Date): TimeOfWeek | null;
66
+ /**
67
+ * Returns the next time the store will close from a given date. Defaults to checking the current
68
+ * date.
69
+ */
70
+ closesAt(date?: Date): TimeOfWeek | null;
71
+ }
72
+ export default OpeningHours;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,66 @@
1
+ declare const customInspectSymbol: unique symbol;
2
+ /**
3
+ * A time in minutes and hours, without a date.
4
+ */
5
+ declare class Time {
6
+ #private;
7
+ /**
8
+ * Create a new Time object. If no arguments are provided, the current time is used.
9
+ * If a Date is provided, the time is set to the time of the provided date. If two
10
+ * numbers are provided, the time is set to the given hours and minutes.
11
+ */
12
+ constructor();
13
+ constructor(date: Date);
14
+ constructor(hour: number, minute: number);
15
+ /**
16
+ * Get the hours of this time.
17
+ */
18
+ get hours(): number;
19
+ /**
20
+ * Get the minutes of this time.
21
+ */
22
+ get minutes(): number;
23
+ [customInspectSymbol](): string;
24
+ /**
25
+ * Returns true if this time is midnight. This can be either 00:00 or 24:00.
26
+ */
27
+ isMidnight(): boolean;
28
+ /**
29
+ * Returns true if this time is noon.
30
+ */
31
+ isNoon(): boolean;
32
+ /**
33
+ * Returns true if this time is equal to another time. 00:00 and 24:00 are considered
34
+ * to be equal.
35
+ */
36
+ isEqual(other: Time): boolean;
37
+ /**
38
+ * Returns true if this time is later than another time, assuming the times are on the
39
+ * same day. 00:00 is considered to be earlier than any other time; 24:00 is considered
40
+ * to be later than any other time.
41
+ */
42
+ isLaterThan(other: Time): boolean;
43
+ /**
44
+ * Returns true if this time is later than or equal to another time. Unlike {@link isLaterThan},
45
+ * 00:00 is considered to be equal to 24:00.
46
+ */
47
+ isLaterThanOrEqual(other: Time): boolean;
48
+ /**
49
+ * Returns true if the given time is between the start and end time, inclusive.
50
+ *
51
+ * Assumes the start time is on the same day. If the end time is earlier than the start time,
52
+ * it is assumed to be on the next day. If the start time is equal to the end time, it is
53
+ * assumed to include the entire day and this function will always return true.
54
+ */
55
+ isBetween(start: Time, end: Time): boolean;
56
+ /**
57
+ * Return the number of minutes forward in time required to reach another time. If the
58
+ * other time is earlier than this time, it is assumed to be on the next day.
59
+ */
60
+ minutesTo(other: Time): number;
61
+ /**
62
+ * Return a localized, formatted string representation of the time.
63
+ */
64
+ toLocaleString(locale?: string, options?: Intl.DateTimeFormatOptions): string;
65
+ }
66
+ export default Time;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,33 @@
1
+ /**
2
+ * An array representing a time range in hours and minutes. If the second time is earlier
3
+ * than the first time, it is assumed to be on the next day.
4
+ */
5
+ export type TTimeRange = [number, number, number, number];
6
+ /**
7
+ * Opening hours for a single day. For a store with hours, it is either a {@link TTimeRange}
8
+ * or a pair of {@link TTimeRange}s, or null if the store is closed for the day. The second
9
+ * time range, if specified, must begin after the first time range ends. Otherwise, the meaning
10
+ * is undefined.
11
+ */
12
+ export type TSingleDayOpeningHours = [TTimeRange] | [TTimeRange, TTimeRange] | null;
13
+ /**
14
+ * A collection of {@link TSingleDayOpeningHours} for Sunday to Saturday.
15
+ */
16
+ export type TRegularOpeningHours = [
17
+ TSingleDayOpeningHours,
18
+ TSingleDayOpeningHours,
19
+ TSingleDayOpeningHours,
20
+ TSingleDayOpeningHours,
21
+ TSingleDayOpeningHours,
22
+ TSingleDayOpeningHours,
23
+ TSingleDayOpeningHours
24
+ ];
25
+ /**
26
+ * A collection of {@link TSingleDayOpeningHours} for every day of the week and for
27
+ * holidays. The first entry is for Sunday, the second for Monday, etc. The last entry
28
+ * is for holidays.
29
+ */
30
+ export type TOpeningHours = TRegularOpeningHours | [
31
+ ...TRegularOpeningHours,
32
+ TSingleDayOpeningHours
33
+ ];
@@ -0,0 +1,34 @@
1
+ import Time from './time';
2
+ import { TSingleDayOpeningHours, TTimeRange } from './types';
3
+ /**
4
+ * Returns true if the given locale uses a 24-hour time format.
5
+ */
6
+ export declare const is24HourTime: (locale: string) => boolean;
7
+ /**
8
+ * Convert the name of a day of the week to a number between 0 and 6. Returns -1 if the day is not
9
+ * valid.
10
+ */
11
+ export declare const dayOfWeekNum: (day: string) => number;
12
+ /**
13
+ * Get the current timezone of the client.
14
+ */
15
+ export declare const getTZ: () => string;
16
+ /**
17
+ * Given a timezone and a date, return the hours, minutes, and day of week in that timezone.
18
+ * Day of week is 0-6, where 0 is Sunday. If no timezone is specified, uses the client's local
19
+ * timezone. If no date is specified, uses the current date.
20
+ */
21
+ export declare const getTimePartsAtTZ: (tz: string, date: Date) => {
22
+ hours: number;
23
+ minutes: number;
24
+ dayOfWeek: number;
25
+ };
26
+ /**
27
+ * Given a single day's opening hours, return the start and end times. If the opening
28
+ * hours are a pair of time ranges, return the start and end times for both ranges.
29
+ * Returns null if the store is closed for the day.
30
+ */
31
+ export declare function singleDayOpeningHoursTimes(hours: null): null;
32
+ export declare function singleDayOpeningHoursTimes(hours: [TTimeRange]): [Time, Time];
33
+ export declare function singleDayOpeningHoursTimes(hours: [TTimeRange, TTimeRange]): [Time, Time, Time, Time];
34
+ export declare function singleDayOpeningHoursTimes(hours: TSingleDayOpeningHours): [Time, Time] | [Time, Time, Time, Time] | null;
@@ -0,0 +1 @@
1
+ export {};
@@ -37,6 +37,7 @@ export type TTheme = {
37
37
  inverted: string;
38
38
  link: string;
39
39
  error: string;
40
+ error2: string;
40
41
  };
41
42
  map: {
42
43
  labels: {
@@ -81,6 +82,7 @@ export type TTheme = {
81
82
  normal: number;
82
83
  large: number;
83
84
  xlarge: number;
85
+ title: number;
84
86
  };
85
87
  fontWeight: {
86
88
  light: number;
@@ -0,0 +1 @@
1
+ export declare const getLocale: (locale?: string) => string;
@@ -58,6 +58,7 @@ declare class UIStore {
58
58
  inverted: string;
59
59
  link: string;
60
60
  error: string;
61
+ error2: string;
61
62
  }>;
62
63
  map: Partial<{
63
64
  labels: Partial<{
@@ -102,6 +103,7 @@ declare class UIStore {
102
103
  normal: number;
103
104
  large: number;
104
105
  xlarge: number;
106
+ title: number;
105
107
  }>;
106
108
  fontWeight: Partial<{
107
109
  light: number;
@@ -0,0 +1,25 @@
1
+ /**
2
+ * A set of given and expected values for testing.
3
+ */
4
+ export type TTestCondition<Given, Expected> = readonly [Given, Expected];
5
+ /**
6
+ * A test case with a name and a {@link TTestCondition}s.
7
+ */
8
+ export type TTestCase<Given, Expected> = [string, readonly TTestCondition<Given, Expected>[]];
9
+ /**
10
+ * A suite of {@link TTestCase}s.
11
+ */
12
+ export type TTestSuite<Given, Expected> = readonly TTestCase<Given, Expected>[];
13
+ /**
14
+ * A callback for running tests in a {@link TTestSuite}.
15
+ */
16
+ export type TTestSuiteCallback<Given, Expected> = (testName: string, value: TTestCondition<Given, Expected>) => void;
17
+ /**
18
+ * Run a callback with tests for each {@link TTestCase} in a {@link TTestSuite}. This is useful for
19
+ * running many tests with the same exact format, where the input and output can be easily abstracted.
20
+ */
21
+ declare const testSuite: {
22
+ <Given, Expected>(name: string, config: TTestSuite<Given, Expected>, cb: TTestSuiteCallback<Given, Expected>): void;
23
+ only: <Given, Expected>(name: string, config: TTestSuite<Given, Expected>, cb: TTestSuiteCallback<Given, Expected>) => void;
24
+ };
25
+ export default testSuite;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mappedin/viewer",
3
- "version": "0.35.2-3613294.0",
3
+ "version": "0.35.2-50f0fde.0",
4
4
  "type": "module",
5
5
  "browser": "./dist/index.js",
6
6
  "license": "UNLICENSED",