@scopetickets/checkout 0.2.0 → 0.4.1

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/pickers.cjs CHANGED
@@ -104,15 +104,28 @@ var RAMP = [
104
104
  [HIGH_FROM, 67],
105
105
  [1, 100]
106
106
  ];
107
- function availabilityColor(remaining) {
108
- const stop = (suffix) => `var(--scopetickets-island-availability-${suffix})`;
109
- if (remaining === null || !Number.isFinite(remaining) || remaining <= 0) return stop(0);
110
- if (remaining >= 1) return stop(100);
107
+ function availabilityMix(remaining) {
108
+ const flat = (stop) => ({
109
+ from: stop,
110
+ to: stop,
111
+ towards: 100
112
+ });
113
+ if (remaining === null || !Number.isFinite(remaining) || remaining <= 0) return flat(0);
114
+ if (remaining >= 1) return flat(100);
111
115
  const top = RAMP.findIndex(([at]) => remaining <= at);
112
116
  const [lowAt, lowStop] = RAMP[top - 1];
113
117
  const [highAt, highStop] = RAMP[top];
114
- const towards = Math.round((remaining - lowAt) / (highAt - lowAt) * 100);
115
- return `color-mix(in srgb, ${stop(highStop)} ${towards}%, ${stop(lowStop)})`;
118
+ return {
119
+ from: lowStop,
120
+ to: highStop,
121
+ towards: Math.round((remaining - lowAt) / (highAt - lowAt) * 100)
122
+ };
123
+ }
124
+ function availabilityColor(remaining) {
125
+ const stop = (suffix) => `var(--scopetickets-island-availability-${suffix})`;
126
+ const { from, to, towards } = availabilityMix(remaining);
127
+ if (from === to) return stop(from);
128
+ return `color-mix(in srgb, ${stop(to)} ${towards}%, ${stop(from)})`;
116
129
  }
117
130
  function isDatePickerCellSelectable(state) {
118
131
  return state === "AVAILABLE" || state === "SELECTED";
@@ -809,12 +822,37 @@ var PARTY_COPY = {
809
822
  remove: (name) => `Remove one ${name}`,
810
823
  add: (name) => `Add one ${name}`,
811
824
  count: (count, name) => `${count} ${name}. Change the number`,
812
- field: (name) => `Number of ${name}`
825
+ field: (name) => `Number of ${name}`,
826
+ /**
827
+ * AND WHAT AN UNDIFFERENTIATED PARTY IS CALLED — a run selling a single UserType has no
828
+ * name worth showing per row, so the one line it draws names the whole party.
829
+ *
830
+ * A PROP DEFAULT ON THE WEB IS INVISIBLE TO THE OTHER RENDERER, which is why this is
831
+ * here: `PartyStepper`'s own `soloName = 'Guests'` could not be read from native, so
832
+ * native re-typed it.
833
+ */
834
+ soloName: "Guests"
813
835
  };
814
836
  var ISLAND_COPY = {
815
837
  order: "Your order",
816
838
  runWeeks: "Weeks of the run"
817
839
  };
840
+ var TIMESLOT_COPY = {
841
+ /**
842
+ * WHAT A SLOT WITH NOTHING LEFT SAYS, IN WORDS. The ring is a reading of how full a
843
+ * slot is, and at zero it draws nothing — an arc of no length is an absence, not a
844
+ * statement, and a buyer scanning a column for a time cannot be asked to notice an
845
+ * opacity.
846
+ */
847
+ soldOut: "Sold Out",
848
+ /**
849
+ * AND WHAT QUALIFIES THE PRICE — IN THE ROW'S NAME ONLY, not on its face. A column of
850
+ * forty rows each repeating the word says it forty times and the figure once. A screen
851
+ * reader gets one row at a time and no column, so a bare "€17.90" beside a time is a
852
+ * price with no qualifier at all.
853
+ */
854
+ from: "From"
855
+ };
818
856
 
819
857
  // src/island/DayPicker.tsx
820
858
  var import_jsx_runtime7 = require("react/jsx-runtime");
@@ -1139,8 +1177,7 @@ var REMAINING_SIZE = "var(--scopetickets-island-space-4)";
1139
1177
  var SELECTED_ARC = "var(--scopetickets-island-timeslot-ring-selected)";
1140
1178
  var TRACK = "var(--scopetickets-island-timeslot-track)";
1141
1179
  var SELECTED_TRACK = "var(--scopetickets-island-timeslot-track-selected)";
1142
- var SOLD_OUT = "Sold Out";
1143
- var FROM = "From";
1180
+ var { soldOut: SOLD_OUT, from: FROM } = TIMESLOT_COPY;
1144
1181
  function Timeslot({ cell, accessory, onSelect }) {
1145
1182
  if (isDatePickerCellSelectable(cell.state)) {
1146
1183
  return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(TimeslotButton, { cell, accessory, onSelect });
@@ -1740,7 +1777,7 @@ function PartyStepper({
1740
1777
  counts,
1741
1778
  onChange,
1742
1779
  max,
1743
- soloName = "Guests",
1780
+ soloName = PARTY_COPY.soloName,
1744
1781
  onRefuse,
1745
1782
  refused = null
1746
1783
  }) {