rei-kit 0.10.1 → 0.11.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/README.md CHANGED
@@ -16,41 +16,31 @@ That is the whole trick, and everything else follows from it.
16
16
 
17
17
  ### What gets to be in here
18
18
 
19
- The kit is not built from what its current apps happen to need. It is built to
20
- be the thing the next app starts from. So the rule depends on what kind of
21
- thing is being added — and conflating the two cost this package three releases
22
- that shipped parts nobody could use.
23
-
24
- **Primitives are complete by construction.** A button, a field, a toast, a
25
- modal. There is no uncertainty about whether the next app will want one, so
26
- they do not wait for a second consumer: waiting means every new app begins by
27
- copying, which is the thing this package exists to prevent. A primitive is
28
- finished when two checkable things are true:
29
-
30
- - **It covers every role the design system declares.** `tokens.css` names five
31
- colour roles while `BaseButton` exposed two, so an app that wanted a
32
- success-coloured action hand-wrote the button. A component that cannot use a
33
- role its own token file declares is not being careful; it is incomplete.
34
- - **The app can take the behaviour without the appearance.** `variant="unstyled"`
35
- exists because 58 raw `<button>` elements sat in 24 files that already
36
- imported `BaseButton`. A picker cell, a chip, a calendar day: the surface is
37
- the app's and should be, but the element, the focus ring, the disabled
38
- handling and the `aria-pressed` bookkeeping are not and they were being
39
- rewritten every time, usually without the focus ring.
40
-
41
- **Composed components wait for two apps.** A `PriceCard`, a `TourShell`, a
42
- `DangerZone`. These carry a shape, and a shape designed from one example is
43
- designed wrong. Here the measure is `diff`, not taste: **a file that is 90%
44
- identical in two apps is a kit candidate.**
45
-
46
- **Both kinds:** no new required peer — anything needing a library goes behind
47
- its own entry point or stays in the app — and no product decision. No colour,
48
- no copy, no icon. Those arrive as props and slots.
49
-
50
- **And one test worth more than the rule:** a raw `<button>` in a file that
51
- already imports `BaseButton` is a bug in the kit, not in the app. That grep
52
- found every gap closed between 0.5.0 and 0.7.0, and it found them after those
53
- releases had claimed to be finished.
19
+ **This is a kit. It is built for the ecosystem, not for the apps that happen to
20
+ exist today.**
21
+
22
+ A part belongs here if it is a piece of user interface at all — a button, a
23
+ field, a toast, a modal, a shell. There is no waiting for a second consumer and
24
+ no counting of call sites: an app that needs something the kit does not have is
25
+ a gap in the kit, and the kit is what changes. Waiting means the next app
26
+ begins by copying, and a kit whose parts arrive after the apps that needed them
27
+ is a library of things nobody reached for.
28
+
29
+ A part is finished when three things are true:
30
+
31
+ 1. **It covers every role the design system declares.** `tokens.css` names five
32
+ colour roles; a button that exposes two of them is incomplete, whatever the
33
+ apps currently use.
34
+ 2. **The app can take the behaviour without the appearance.** `variant="unstyled"`
35
+ is the last resort, not the first: if several apps paint the same shape by
36
+ hand, that shape is a variant the kit is missing.
37
+ 3. **It carries no product decision** no colour value, no copy, no icon.
38
+ Those arrive as props and slots, which is what lets three apps that look
39
+ nothing alike share one part.
40
+
41
+ **The test that finds the gaps:** a hand-written control in a file that already
42
+ imports the kit's version of it. That is a bug in the kit, every time. Not in
43
+ the app, and not a matter of taste.
54
44
 
55
45
  ## Status
56
46
 
@@ -21,7 +21,7 @@ type __VLS_Props = {
21
21
  * height and no padding: giving it either would make it a ghost button,
22
22
  * which is a different thing and was already here.
23
23
  */
24
- variant?: 'primary' | 'secondary' | 'ghost' | 'quiet' | 'danger' | 'positive' | 'warning' | 'accent' | 'link' | 'unstyled' | undefined;
24
+ variant?: 'primary' | 'secondary' | 'ghost' | 'quiet' | 'destructive' | 'row' | 'danger' | 'positive' | 'warning' | 'accent' | 'link' | 'unstyled' | undefined;
25
25
  /** `xs` is the action inside a prompt or a nudge, not on a page. */
26
26
  size?: 'xs' | 'sm' | 'md' | 'lg' | undefined;
27
27
  loading?: boolean | undefined;
package/dist/index.js CHANGED
@@ -954,6 +954,8 @@ var BaseButton_default = /* @__PURE__ */ defineComponent({
954
954
  primary: "bg-primary text-white hover:bg-primary/90",
955
955
  secondary: "border-hair bg-surface text-ink border hover:bg-muted",
956
956
  ghost: "bg-transparent text-ink hover:bg-muted",
957
+ destructive: "bg-transparent text-ink-soft hover:text-negative",
958
+ row: "w-full justify-start text-left bg-transparent text-ink hover:bg-muted",
957
959
  quiet: "bg-transparent text-ink-soft hover:text-ink",
958
960
  danger: "bg-negative text-white hover:bg-negative/90",
959
961
  positive: "bg-positive text-white hover:bg-positive/90",
@@ -974,6 +976,12 @@ var BaseButton_default = /* @__PURE__ */ defineComponent({
974
976
  md: "size-11 text-base",
975
977
  lg: "size-14 text-lg"
976
978
  };
979
+ const ROW_SIZE_CLASS = {
980
+ xs: "px-2 py-1.5 text-xs",
981
+ sm: "px-3 py-2 text-sm",
982
+ md: "px-3 py-2.5 text-base",
983
+ lg: "px-4 py-3 text-lg"
984
+ };
977
985
  const LINK_SIZE_CLASS = {
978
986
  xs: "text-xs",
979
987
  sm: "text-sm",
@@ -983,6 +991,7 @@ var BaseButton_default = /* @__PURE__ */ defineComponent({
983
991
  const sizing = computed(() => {
984
992
  if (__props.variant === "unstyled") return "";
985
993
  if (__props.variant === "link") return LINK_SIZE_CLASS[__props.size];
994
+ if (__props.variant === "row") return ROW_SIZE_CLASS[__props.size];
986
995
  return __props.icon ? ICON_SIZE_CLASS[__props.size] : SIZE_CLASS[__props.size];
987
996
  });
988
997
  const PRESSED_CLASS = {
@@ -992,9 +1001,16 @@ var BaseButton_default = /* @__PURE__ */ defineComponent({
992
1001
  };
993
1002
  const surface = computed(() => {
994
1003
  if (__props.pressed === true) return PRESSED_CLASS[__props.variant] ?? VARIANT_CLASS[__props.variant];
1004
+ if (__props.variant === "quiet" && __props.icon) return `${VARIANT_CLASS.quiet} hover:bg-muted`;
1005
+ if (__props.variant === "destructive" && __props.icon) return `${VARIANT_CLASS.destructive} hover:bg-negative/10`;
995
1006
  return VARIANT_CLASS[__props.variant];
996
1007
  });
997
- const shell = computed(() => __props.variant === "unstyled" ? "" : "inline-flex items-center justify-center gap-2 font-medium transition-[transform,color,background-color,border-color] duration-100 select-none active:scale-95");
1008
+ const shell = computed(() => {
1009
+ if (__props.variant === "unstyled") return "";
1010
+ const feel = "transition-[transform,color,background-color,border-color] duration-100 select-none";
1011
+ if (__props.variant === "row") return `inline-flex items-center gap-2 font-medium ${feel}`;
1012
+ return `inline-flex items-center justify-center gap-2 font-medium ${feel} active:scale-95`;
1013
+ });
998
1014
  const radius = computed(() => {
999
1015
  if (__props.variant === "unstyled") return "";
1000
1016
  if (__props.variant === "link") return "rounded-xs";
@@ -2397,7 +2413,7 @@ function createI18nRuntime(options) {
2397
2413
  *
2398
2414
  * The fallback keeps `vitest` and `vite dev` honest, where no define runs.
2399
2415
  */
2400
- var VERSION = "0.10.1";
2416
+ var VERSION = "0.11.1";
2401
2417
  //#endregion
2402
2418
  export { AppError, BaseAlert_default as BaseAlert, BaseBadge_default as BaseBadge, BaseButton_default as BaseButton, BaseCard_default as BaseCard, BaseCheckbox_default as BaseCheckbox, BaseInput_default as BaseInput, BaseRadioGroup_default as BaseRadioGroup, BaseSelect_default as BaseSelect, BaseSheet_default as BaseSheet, BaseTextarea_default as BaseTextarea, EmptyState_default as EmptyState, ErrorBoundary_default as ErrorBoundary, FormField_default as FormField, GoogleButton_default as GoogleButton, LocaleLinks_default as LocaleLinks, PageContainer_default as PageContainer, PageHeader_default as PageHeader, PriceCard_default as PriceCard, ProgressBar_default as ProgressBar, SectionHeading_default as SectionHeading, SegmentedControl_default as SegmentedControl, SettingsGroup_default as SettingsGroup, SettingsRow_default as SettingsRow, SkeletonList_default as SkeletonList, StatCard_default as StatCard, TabBar_default as TabBar, ToastHost_default as ToastHost, ToneDot_default as ToneDot, VERSION, addDays, applyTheme, createI18nRuntime, downloadJson, eachDayOfYear, formatDate, fromDateKey, isApplePortable, isInstalled, isThemePreference, lastNDays, leadingBlanks, needsIosInstall, readStoredTheme, registerErrorMapper, relativeDayLabel, safeRedirect, setFormatLocale, setThemeStorageKey, startOfWeek, tapFeedback, toAppError, toDateKey, todayKey, useDebouncedCallback, useDragScroll, useMediaQuery, useOnline, useTheme, useToast, useToday, useVisualViewport };
2403
2419