@zukhruf/shadcn 0.8.46 → 0.8.47

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.
Files changed (3) hide show
  1. package/README.md +4 -2
  2. package/package.json +1 -1
  3. package/styles.css +20 -0
package/README.md CHANGED
@@ -81,7 +81,7 @@ The `@theme inline` block of `theme.css` maps these variables to Tailwind CSS co
81
81
 
82
82
  The preset is fixed. The class strings of each component contain the preset, for example the rounded corners and the spacing of the dialog. Thus an app cannot change the preset. An app changes only the theme. See [ADR 0004](./docs/adr/0004-the-components-use-base-ui-and-the-nova-preset.md).
83
83
 
84
- The theme also covers the density of the controls: `--control-height`, `--control-height-sm` and `--control-background` (see [what the stylesheet adds](#what-the-stylesheet-adds-to-stock-shadcnui)). Set a token, not a `className` restyle such as `h-10 bg-card` on each control. A subtree can set a second value, for example taller controls on the auth pages. See [ADR 0006](./docs/adr/0006-a-host-gets-its-looks-through-theme-tokens-and-data-attribute-patches.md).
84
+ The theme also covers the density of the controls and the field labels: `--control-height`, `--control-height-sm`, `--control-background`, `--field-label-foreground` and `--field-label-font-size` (see [what the stylesheet adds](#what-the-stylesheet-adds-to-stock-shadcnui)). Set a token, not a `className` restyle such as `h-10 bg-card` on each control. A subtree can set a second value, for example taller controls on the auth pages. See [ADR 0006](./docs/adr/0006-a-host-gets-its-looks-through-theme-tokens-and-data-attribute-patches.md).
85
85
 
86
86
  ## The open state of the sidebar
87
87
 
@@ -123,7 +123,7 @@ Not fixed: the mobile sidebar has a hidden title and description in English (`Si
123
123
 
124
124
  ## What the stylesheet adds to stock shadcn/ui
125
125
 
126
- The stylesheet has seven patches:
126
+ The stylesheet has eight patches:
127
127
 
128
128
  - **A pointer cursor on enabled buttons.** In Tailwind CSS 4, a button has the default cursor of the browser, not the pointer. The upgrade guide of Tailwind CSS gives a rule that sets the pointer again. The patch is that rule, in `@layer base`.
129
129
  - **A cap on the height of a dialog.** A dialog is never taller than the window minus `2rem`, and it scrolls when its content is taller. Thus the buttons at the bottom of a tall dialog stay on the screen. The rule is `max-height: calc(100dvh - 2rem); overflow-y: auto` on `[data-slot="dialog-content"]`. The patch is in `@layer components`.
@@ -135,6 +135,8 @@ The stylesheet has seven patches:
135
135
 
136
136
  - **The controls take their height and background from the theme.** `--control-height` sets the height of `Input`, `SelectTrigger` at `data-size="default"`, `InputGroup` and `Button` at the default size, and the minimum height of `Textarea` and `ComboboxChips`. `--control-height-sm` sets the height of `Button` at `size="sm"`. The button rules are keyed on the `group/button` class of `buttonVariants()`, so a link with the classes of a button takes them too. `--control-background` sets the background of `Input`, `Textarea`, `SelectTrigger`, `InputGroup` and `ComboboxChips`. Without a value, each rule falls back to nova: 32px (64px for `Textarea`), 28px, and `transparent` (`input/30` under `.dark`). Each rule is keyed on the nova class that it replaces, for example `[data-slot='input'].h-8`, so a class of the app that tailwind-merge swaps in for that class turns the rule off. A disabled control, an `InputGroup` with a textarea or a block-aligned addon, a hovered dark `SelectTrigger` and a button of an `InputGroup` keep their nova styles. The patch is in `@layer utilities`. See [ADR 0006](./docs/adr/0006-a-host-gets-its-looks-through-theme-tokens-and-data-attribute-patches.md).
137
137
 
138
+ - **The field labels take their colour and size from the theme.** `FieldLabel` and `FieldTitle` both write `data-slot="field-label"`. `--field-label-foreground` sets their colour and `--field-label-font-size` their size. Without a value, a label inherits its colour and keeps nova's `text-sm`, 14px. A label in a `Field` with `data-invalid="true"` keeps the `text-destructive` it inherits from the `Field`. The size rule is keyed on `text-sm`; nova gives a label no colour class, so the colour rule has no specificity and any `text-*` class of the app wins over it. The patch is in `@layer utilities`. See [ADR 0006](./docs/adr/0006-a-host-gets-its-looks-through-theme-tokens-and-data-attribute-patches.md).
139
+
138
140
  The cursor, the cap, the shortcut and the select popup are in layers before `utilities`. Thus a utility class of the app, for example `cursor-wait` or `max-h-none`, still changes them.
139
141
 
140
142
  The width patch is in `@layer utilities`, because only a rule in that layer wins over a utility class. Its selector has three attributes, so it wins over the two parts of `data-[side=left]:w-3/4`. The sidebar does not give its `className` to the mobile `Sheet`, so a utility class of the app cannot get to that element. To change the mobile width, write a rule outside of a layer.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zukhruf/shadcn",
3
- "version": "0.8.46",
3
+ "version": "0.8.47",
4
4
  "description": "Each shadcn/ui component for Base UI with the nova preset, in one package. An app imports the components from one entry and the styles from one stylesheet. The shadcn CLI writes the source, and nobody edits it by hand.",
5
5
  "license": "MIT",
6
6
  "repository": {
package/styles.css CHANGED
@@ -134,3 +134,23 @@
134
134
  );
135
135
  }
136
136
  }
137
+
138
+ /*
139
+ * The tone and size of a field label are theme tokens too (ADR 0006).
140
+ * FieldLabel and FieldTitle both write data-slot="field-label". nova gives
141
+ * neither a colour class, so the colour patch has no specificity, as the input
142
+ * group's background has: any text-* class of the host wins over it. A label
143
+ * of an invalid Field keeps the text-destructive it inherits from the Field.
144
+ * The size is keyed on the text-sm both carry.
145
+ */
146
+ @layer utilities {
147
+ :where(
148
+ [data-slot='field-label']:not([data-slot='field'][data-invalid='true'] *)
149
+ ) {
150
+ color: var(--field-label-foreground, currentcolor);
151
+ }
152
+
153
+ [data-slot='field-label'].text-sm {
154
+ font-size: var(--field-label-font-size, var(--text-sm));
155
+ }
156
+ }