@7shifts/sous-chef 4.6.0 → 4.6.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.
@@ -1,5 +1,7 @@
1
1
  import React from 'react';
2
2
  import type { Props as TextFieldProps } from '../TextField/TextField';
3
- type Props = Omit<TextFieldProps, 'suffix' | 'prefix' | 'autoComplete' | 'defaultValue' | 'maxLength'>;
4
- declare const ColorField: React.ForwardRefExoticComponent<Props & React.RefAttributes<HTMLInputElement>>;
3
+ declare const ColorField: React.ForwardRefExoticComponent<{
4
+ /** When true, allows the user to select a custom color */
5
+ allowCustomColor?: boolean | undefined;
6
+ } & Omit<TextFieldProps, "suffix" | "prefix" | "autoComplete" | "defaultValue" | "maxLength"> & React.RefAttributes<HTMLInputElement>>;
5
7
  export default ColorField;
@@ -1,9 +1,12 @@
1
1
  import React from 'react';
2
+ import { SequentialColor } from '../constants';
2
3
  type Props = {
3
4
  onClose: () => void;
4
5
  triggerRef: React.RefObject<HTMLElement>;
5
- selectedColor?: string;
6
+ selectedColor?: SequentialColor;
6
7
  onSelect: (color: string) => void;
8
+ onCustomColor: () => void;
9
+ allowCustomColor?: boolean;
7
10
  };
8
11
  declare const ColorsOverlay: (props: Props) => React.JSX.Element;
9
12
  export default ColorsOverlay;
@@ -1,4 +1,5 @@
1
- export declare const useColorKeyboardNavigation: (selectedColor: string) => {
1
+ export declare const CUSTOM_COLOR_INDEX: 20;
2
+ export declare const useColorKeyboardNavigation: (selectedColor: string, allowCustomColor?: boolean) => {
2
3
  selectedColorIndex: number | null;
3
4
  setSelectedColorIndex: import("react").Dispatch<import("react").SetStateAction<number | null>>;
4
5
  };
@@ -0,0 +1,18 @@
1
+ import React from 'react';
2
+ export type CustomColorPickerHandle = {
3
+ /** Open the native color picker at the field's current color. */
4
+ open: () => void;
5
+ };
6
+ type Props = {
7
+ /** The current field color; the picker opens seeded with this value. */
8
+ color?: string;
9
+ /** Called with the committed hex once the user closes the picker. */
10
+ onSelect: (color: string) => void;
11
+ };
12
+ /**
13
+ * A visually hidden native color input. It is kept mounted on the field (not
14
+ * inside the swatch overlay) so the browser's picker survives the overlay
15
+ * closing, and it is opened imperatively via the `open` handle.
16
+ */
17
+ declare const CustomColorPicker: React.ForwardRefExoticComponent<Props & React.RefAttributes<CustomColorPickerHandle>>;
18
+ export default CustomColorPicker;
@@ -0,0 +1,2 @@
1
+ export { default } from './CustomColorPicker';
2
+ export type { CustomColorPickerHandle } from './CustomColorPicker';
@@ -1 +1,2 @@
1
1
  export declare const SEQUENTIAL_COLORS: readonly ["seq-18", "seq-4", "seq-7", "seq-16", "seq-12", "seq-6", "seq-9", "seq-3", "seq-11", "seq-1", "seq-13", "seq-10", "seq-14", "seq-8", "seq-19", "seq-20", "seq-2", "seq-17", "seq-15", "seq-5"];
2
+ export type SequentialColor = (typeof SEQUENTIAL_COLORS)[number];
@@ -0,0 +1,14 @@
1
+ import { SequentialColor } from './constants';
2
+ export declare const isSeqToken: (value: string) => value is "seq-18" | "seq-4" | "seq-7" | "seq-16" | "seq-12" | "seq-6" | "seq-9" | "seq-3" | "seq-11" | "seq-1" | "seq-13" | "seq-10" | "seq-14" | "seq-8" | "seq-19" | "seq-20" | "seq-2" | "seq-17" | "seq-15" | "seq-5";
3
+ /**
4
+ * Whether a value is a 6-digit hex color, which is the only format the native
5
+ * color picker accepts.
6
+ */
7
+ export declare const isHexColor: (value: string | undefined) => value is string;
8
+ /**
9
+ * Resolves a stored field value to the sequential color token it represents.
10
+ * Accepts both a token name directly (e.g. `seq-1`) and a hex color string so
11
+ * that fields migrated from hex storage continue to resolve correctly.
12
+ */
13
+ export declare const findSeqToken: (value: string | undefined) => SequentialColor | undefined;
14
+ export declare const findSeqTokenByHex: (value: string | undefined) => SequentialColor | undefined;
@@ -82,3 +82,49 @@ export declare const COLOR_CODES: {
82
82
  readonly 'seq-19': " #2f80ed";
83
83
  readonly 'seq-20': " #be3434";
84
84
  };
85
+ export declare const SEQUENTIAL_COLOR_CODES: {
86
+ readonly light: {
87
+ readonly 'seq-1': "#00b5d8";
88
+ readonly 'seq-2': "#f9922b";
89
+ readonly 'seq-3': "#28cc6d";
90
+ readonly 'seq-4': "#d83f87";
91
+ readonly 'seq-5': "#4359ce";
92
+ readonly 'seq-6': "#ff6f61";
93
+ readonly 'seq-7': "#35e5c6";
94
+ readonly 'seq-8': "#a966e7";
95
+ readonly 'seq-9': "#905642";
96
+ readonly 'seq-10': "#ffb300";
97
+ readonly 'seq-11': "#708238";
98
+ readonly 'seq-12': "#4fc3f7";
99
+ readonly 'seq-13': "#e94057";
100
+ readonly 'seq-14': "#00a896";
101
+ readonly 'seq-15': "#6a4c93";
102
+ readonly 'seq-16': "#a3cb38";
103
+ readonly 'seq-17': "#546e7a";
104
+ readonly 'seq-18': "#fc9999";
105
+ readonly 'seq-19': "#2f80ed";
106
+ readonly 'seq-20': "#be3434";
107
+ };
108
+ readonly dark: {
109
+ readonly 'seq-1': "#28d2f3";
110
+ readonly 'seq-2': "#f9ad61";
111
+ readonly 'seq-3': "#31e17b";
112
+ readonly 'seq-4': "#ef5ca1";
113
+ readonly 'seq-5': "#7288ff";
114
+ readonly 'seq-6': "#ff867a";
115
+ readonly 'seq-7': "#43f2d3";
116
+ readonly 'seq-8': "#cb93ff";
117
+ readonly 'seq-9': "#b66d54";
118
+ readonly 'seq-10': "#ffc437";
119
+ readonly 'seq-11': "#8a9c52";
120
+ readonly 'seq-12': "#8adbff";
121
+ readonly 'seq-13': "#fa5c71";
122
+ readonly 'seq-14': "#15c7b4";
123
+ readonly 'seq-15': "#a978ec";
124
+ readonly 'seq-16': "#aed83e";
125
+ readonly 'seq-17': "#82adc0";
126
+ readonly 'seq-18': "#ffa9a9";
127
+ readonly 'seq-19': "#4594ff";
128
+ readonly 'seq-20': "#e45555";
129
+ };
130
+ };
@@ -62,5 +62,8 @@
62
62
  },
63
63
  "PhoneField": {
64
64
  "malformedPhoneNumber": "Please enter a valid phone number."
65
+ },
66
+ "ColorField": {
67
+ "customColorButtonLabel": "Custom color"
65
68
  }
66
69
  }
@@ -62,5 +62,8 @@
62
62
  },
63
63
  "PhoneField": {
64
64
  "malformedPhoneNumber": "Por favor, ingresa un número de teléfono válido."
65
+ },
66
+ "ColorField": {
67
+ "customColorButtonLabel": "Color personalizado"
65
68
  }
66
69
  }
@@ -62,5 +62,8 @@
62
62
  },
63
63
  "PhoneField": {
64
64
  "malformedPhoneNumber": "Veuillez entrer un numéro de téléphone valide."
65
+ },
66
+ "ColorField": {
67
+ "customColorButtonLabel": "Couleur personnalisée"
65
68
  }
66
69
  }
package/dist/index.css CHANGED
@@ -5743,11 +5743,29 @@ input._TEU6N {
5743
5743
  ._M-8rP:hover:not(._o92fv)::after {
5744
5744
  border-color: var(--color-outline);
5745
5745
  }
5746
+ ._iQoTb {
5747
+ grid-column: 1/-1;
5748
+ }
5746
5749
  ._UUuiJ {
5747
5750
  border-radius: 100%;
5748
5751
  width: 16px;
5749
5752
  height: 16px;
5750
5753
  }
5754
+ ._OHgPk {
5755
+ position: absolute;
5756
+ left: 0;
5757
+ bottom: 0;
5758
+ width: 100%;
5759
+ height: 0;
5760
+ margin: 0;
5761
+ padding: 0;
5762
+ border: 0;
5763
+ opacity: 0;
5764
+ pointer-events: none;
5765
+ }
5766
+ ._KJawn {
5767
+ position: relative;
5768
+ }
5751
5769
  ._V1U8v {
5752
5770
  display: flex;
5753
5771
  justify-content: center;
@@ -5844,7 +5862,7 @@ input._TEU6N {
5844
5862
  color: var(--color-neutral-on-container);
5845
5863
  }
5846
5864
  ._e3zFF {
5847
- gap: 4px;
5865
+ gap: 6px;
5848
5866
  display: flex;
5849
5867
  align-items: center;
5850
5868
  flex-shrink: 0;
@@ -5898,6 +5916,13 @@ input._TEU6N {
5898
5916
  ._vOTWZ::first-letter {
5899
5917
  text-transform: capitalize;
5900
5918
  }
5919
+ ._fCrWy {
5920
+ gap: 6px;
5921
+ display: flex;
5922
+ align-items: center;
5923
+ flex-shrink: 0;
5924
+ flex-grow: 0;
5925
+ }
5901
5926
  ._j2h8A {
5902
5927
  background-color: var(--color-neutral-container);
5903
5928
  color: var(--color-neutral-on-container);
@@ -6260,6 +6285,85 @@ input._TEU6N {
6260
6285
  border-top: 1px solid var(--nav-foreground-color);
6261
6286
  transition: box-shadow 0.4s ease-in-out;
6262
6287
  }
6288
+ ._j3-Gu {
6289
+ display: flex;
6290
+ flex-direction: row;
6291
+ gap: 8px;
6292
+ border-bottom: 1px solid var(--color-outline);
6293
+ list-style: none;
6294
+ margin: 0;
6295
+ padding: 0;
6296
+ }
6297
+ ._-BgMZ {
6298
+ font-family: var(--font-family-body);
6299
+ font-size: var(--font-size-200);
6300
+ line-height: var(--font-line-height-200);
6301
+ font-weight: var(--p-font-weight-normal);
6302
+ display: inline-flex;
6303
+ align-items: center;
6304
+ gap: 8px;
6305
+ height: 42px;
6306
+ padding: 0 20px;
6307
+ border-radius: var(--border-radius-400) var(--border-radius-400) 0 0;
6308
+ border: none;
6309
+ border-bottom: 2px solid transparent;
6310
+ background: transparent;
6311
+ color: var(--color-surface-on-color-subtle);
6312
+ cursor: pointer;
6313
+ white-space: nowrap;
6314
+ box-sizing: border-box;
6315
+ text-decoration: none;
6316
+ }
6317
+ ._-BgMZ:hover {
6318
+ color: var(--color-surface-on-color-bold);
6319
+ }
6320
+ ._-BgMZ:focus-visible {
6321
+ outline: 2px solid var(--color-primary-color);
6322
+ outline-offset: -2px;
6323
+ border-radius: var(--border-radius-400) var(--border-radius-400) 0 0;
6324
+ }
6325
+ ._tZ-HE {
6326
+ background: var(--color-neutral-container-variant);
6327
+ border-bottom-color: var(--color-surface-inverse);
6328
+ color: var(--color-surface-on-color-bold);
6329
+ font-family: var(--font-family-body);
6330
+ font-size: var(--font-size-200);
6331
+ line-height: var(--font-line-height-200);
6332
+ font-weight: var(--p-font-weight-normal);
6333
+ font-weight: var(--p-font-weight-bold);
6334
+ }
6335
+ ._AyUHY {
6336
+ color: var(--color-surface-on-container-disabled);
6337
+ cursor: default;
6338
+ pointer-events: none;
6339
+ }
6340
+ ._WVws4 {
6341
+ display: flex;
6342
+ flex-direction: column;
6343
+ align-items: flex-start;
6344
+ overflow: hidden;
6345
+ }
6346
+ ._WVws4::after {
6347
+ content: attr(data-text);
6348
+ font-weight: var(--p-font-weight-bold);
6349
+ height: 0;
6350
+ visibility: hidden;
6351
+ pointer-events: none;
6352
+ -webkit-user-select: none;
6353
+ -moz-user-select: none;
6354
+ user-select: none;
6355
+ }
6356
+ ._nQB7q {
6357
+ display: inline-flex;
6358
+ align-items: center;
6359
+ flex-shrink: 0;
6360
+ }
6361
+ ._GW3Wi {
6362
+ padding: 16px;
6363
+ }
6364
+ ._DVRRE {
6365
+ display: none;
6366
+ }
6263
6367
  ._mhyqH {
6264
6368
  display: flex;
6265
6369
  flex-direction: row;