plass-ui 1.1.0 → 1.3.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.
Files changed (190) hide show
  1. package/CHANGELOG.md +98 -0
  2. package/dist/components/accordion/PlAccordion.js +1 -1
  3. package/dist/components/alert/PlAlert.js +1 -1
  4. package/dist/components/animate-headline/PlAnimateHeadline.js +1 -1
  5. package/dist/components/animate-lighting/PlAnimateLighting.js +1 -1
  6. package/dist/components/animate-typing/PlAnimateTyping.js +1 -1
  7. package/dist/components/aspect-ratio/PlAspectRatio.js +1 -1
  8. package/dist/components/avatar/PlAvatar.js +1 -1
  9. package/dist/components/avatar-group/PlAvatarGroup.js +1 -1
  10. package/dist/components/back-top/PlBackTop.d.ts +55 -0
  11. package/dist/components/back-top/PlBackTop.js +1 -0
  12. package/dist/components/back-top/index.d.ts +2 -0
  13. package/dist/components/back-top/index.js +1 -0
  14. package/dist/components/badge/PlBadge.js +1 -1
  15. package/dist/components/blockquote/PlBlockquote.js +1 -1
  16. package/dist/components/bottom-navigation/PlBottomNavigation.js +1 -1
  17. package/dist/components/box/PlBox.js +1 -1
  18. package/dist/components/breadcrumb/PlBreadcrumb.js +1 -1
  19. package/dist/components/button/PlButton.js +1 -1
  20. package/dist/components/calendar/PlCalendar.d.ts +104 -0
  21. package/dist/components/calendar/PlCalendar.js +1 -0
  22. package/dist/components/calendar/index.d.ts +2 -0
  23. package/dist/components/calendar/index.js +1 -0
  24. package/dist/components/card/PlCard.js +1 -1
  25. package/dist/components/carousel/PlCarousel.js +1 -1
  26. package/dist/components/chat-bubble/PlChatBubble.js +1 -1
  27. package/dist/components/checkbox/PlCheckbox.d.ts +3 -1
  28. package/dist/components/checkbox/PlCheckbox.js +1 -1
  29. package/dist/components/chip/PlChip.js +1 -1
  30. package/dist/components/collapsible/PlCollapsible.js +1 -1
  31. package/dist/components/color-picker/PlColorPicker.js +1 -1
  32. package/dist/components/combobox/PlCombobox.d.ts +13 -2
  33. package/dist/components/combobox/PlCombobox.js +1 -1
  34. package/dist/components/command-palette/PlCommandPalette.d.ts +8 -2
  35. package/dist/components/command-palette/PlCommandPalette.js +1 -1
  36. package/dist/components/confirm/PlConfirmProvider.d.ts +100 -0
  37. package/dist/components/confirm/PlConfirmProvider.js +1 -0
  38. package/dist/components/confirm/index.d.ts +2 -0
  39. package/dist/components/confirm/index.js +1 -0
  40. package/dist/components/container/PlContainer.js +1 -1
  41. package/dist/components/date-picker/PlDatePicker.d.ts +41 -2
  42. package/dist/components/date-picker/PlDatePicker.js +1 -1
  43. package/dist/components/date-range-picker/PlDateRangePicker.js +1 -1
  44. package/dist/components/date-time-picker/PlDateTimePicker.js +1 -1
  45. package/dist/components/divider/PlDivider.js +1 -1
  46. package/dist/components/drawer/PlDrawer.d.ts +4 -2
  47. package/dist/components/drawer/PlDrawer.js +1 -1
  48. package/dist/components/empty/PlEmpty.d.ts +47 -0
  49. package/dist/components/empty/PlEmpty.js +1 -0
  50. package/dist/components/empty/index.d.ts +2 -0
  51. package/dist/components/empty/index.js +1 -0
  52. package/dist/components/file-picker/PlFilePicker.js +1 -1
  53. package/dist/components/floating-bottom-navigation/PlFloatingBottomNavigation.js +1 -1
  54. package/dist/components/footer/PlFooter.js +1 -1
  55. package/dist/components/header/PlHeader.js +1 -1
  56. package/dist/components/highlight/PlHighlight.js +1 -1
  57. package/dist/components/hot-keys/PlHotKeys.js +1 -1
  58. package/dist/components/image/PlImage.d.ts +72 -0
  59. package/dist/components/image/PlImage.js +1 -0
  60. package/dist/components/image/index.d.ts +2 -0
  61. package/dist/components/image/index.js +1 -0
  62. package/dist/components/list/PlList.js +1 -1
  63. package/dist/components/menu/PlMenu.d.ts +6 -4
  64. package/dist/components/menu/PlMenu.js +1 -1
  65. package/dist/components/menubar/PlMenubar.d.ts +5 -1
  66. package/dist/components/menubar/PlMenubar.js +1 -1
  67. package/dist/components/modal/PlModal.d.ts +4 -2
  68. package/dist/components/modal/PlModal.js +1 -1
  69. package/dist/components/navigation-menu/PlNavigationMenu.d.ts +5 -1
  70. package/dist/components/navigation-menu/PlNavigationMenu.js +1 -1
  71. package/dist/components/number-field/PlNumberField.d.ts +13 -2
  72. package/dist/components/number-field/PlNumberField.js +1 -1
  73. package/dist/components/otp-field/PlOtpField.d.ts +12 -1
  74. package/dist/components/otp-field/PlOtpField.js +1 -1
  75. package/dist/components/overlay/PlOverlay.d.ts +4 -2
  76. package/dist/components/overlay/PlOverlay.js +1 -1
  77. package/dist/components/page-layout/PlPageLayout.js +1 -1
  78. package/dist/components/pagination/PlPagination.js +1 -1
  79. package/dist/components/panes/PlPanes.js +1 -1
  80. package/dist/components/pill/PlPill.js +1 -1
  81. package/dist/components/popconfirm/PlPopconfirm.d.ts +61 -0
  82. package/dist/components/popconfirm/PlPopconfirm.js +1 -0
  83. package/dist/components/popconfirm/index.d.ts +2 -0
  84. package/dist/components/popconfirm/index.js +1 -0
  85. package/dist/components/popover/PlPopover.d.ts +1 -1
  86. package/dist/components/popover/PlPopover.js +1 -1
  87. package/dist/components/progress-box/PlProgressBox.js +1 -1
  88. package/dist/components/progress-circular/PlProgressCircular.js +1 -1
  89. package/dist/components/progress-linear/PlProgressLinear.js +1 -1
  90. package/dist/components/radio-group/PlRadioGroup.d.ts +3 -1
  91. package/dist/components/radio-group/PlRadioGroup.js +1 -1
  92. package/dist/components/rating/PlRating.js +1 -1
  93. package/dist/components/scroll-zone/PlScrollZone.js +1 -1
  94. package/dist/components/segmented-button/PlSegmentedButton.js +1 -1
  95. package/dist/components/select/PlSelect.d.ts +12 -1
  96. package/dist/components/select/PlSelect.js +1 -1
  97. package/dist/components/sidebar/PlSidebar.js +1 -1
  98. package/dist/components/skeleton/PlSkeleton.js +1 -1
  99. package/dist/components/slider/PlSlider.js +1 -1
  100. package/dist/components/spoiler/PlSpoiler.js +1 -1
  101. package/dist/components/stat/PlStat.d.ts +66 -0
  102. package/dist/components/stat/PlStat.js +1 -0
  103. package/dist/components/stat/index.d.ts +2 -0
  104. package/dist/components/stat/index.js +1 -0
  105. package/dist/components/stepper/PlStepper.d.ts +86 -0
  106. package/dist/components/stepper/PlStepper.js +1 -0
  107. package/dist/components/stepper/index.d.ts +2 -0
  108. package/dist/components/stepper/index.js +1 -0
  109. package/dist/components/switch/PlSwitch.d.ts +3 -1
  110. package/dist/components/switch/PlSwitch.js +1 -1
  111. package/dist/components/tabs/PlTabs.js +1 -1
  112. package/dist/components/text-field/PlTextField.d.ts +12 -1
  113. package/dist/components/text-field/PlTextField.js +1 -1
  114. package/dist/components/time-picker/PlTimePicker.js +1 -1
  115. package/dist/components/timeline/PlTimeline.d.ts +5 -8
  116. package/dist/components/timeline/PlTimeline.js +1 -1
  117. package/dist/components/toast/PlToast.d.ts +11 -1
  118. package/dist/components/toast/PlToast.js +1 -1
  119. package/dist/components/toggle/PlToggle.js +1 -1
  120. package/dist/components/toolbar/PlToolbar.js +1 -1
  121. package/dist/components/tooltip/PlTooltip.d.ts +1 -1
  122. package/dist/components/tooltip/PlTooltip.js +1 -1
  123. package/dist/components/transfer/PlTransfer.js +1 -1
  124. package/dist/components/tree/PlTree.d.ts +67 -0
  125. package/dist/components/tree/PlTree.js +1 -0
  126. package/dist/components/tree/index.d.ts +2 -0
  127. package/dist/components/tree/index.js +1 -0
  128. package/dist/components/visually-hidden/PlVisuallyHidden.d.ts +46 -0
  129. package/dist/components/visually-hidden/PlVisuallyHidden.js +1 -0
  130. package/dist/components/visually-hidden/index.d.ts +2 -0
  131. package/dist/components/visually-hidden/index.js +1 -0
  132. package/dist/css/back-top.css +2 -0
  133. package/dist/css/calendar.css +2 -0
  134. package/dist/css/confirm.css +2 -0
  135. package/dist/css/empty.css +2 -0
  136. package/dist/css/image.css +2 -0
  137. package/dist/css/popconfirm.css +2 -0
  138. package/dist/css/stat.css +2 -0
  139. package/dist/css/stepper.css +2 -0
  140. package/dist/css/tree.css +2 -0
  141. package/dist/css/visually-hidden.css +2 -0
  142. package/dist/hooks/index.d.ts +7 -0
  143. package/dist/hooks/index.js +1 -0
  144. package/dist/hooks/usePlBreakpoint.d.ts +38 -0
  145. package/dist/hooks/usePlBreakpoint.js +1 -0
  146. package/dist/hooks/usePlColorScheme.d.ts +66 -0
  147. package/dist/hooks/usePlColorScheme.js +1 -0
  148. package/dist/hooks/usePlHotKeys.d.ts +81 -0
  149. package/dist/hooks/usePlHotKeys.js +1 -0
  150. package/dist/hooks/usePlMediaQuery.d.ts +22 -0
  151. package/dist/hooks/usePlMediaQuery.js +1 -0
  152. package/dist/hooks/usePlReducedMotion.d.ts +22 -0
  153. package/dist/hooks/usePlReducedMotion.js +1 -0
  154. package/dist/index.d.ts +12 -0
  155. package/dist/index.js +1 -1
  156. package/dist/internal/animate.d.ts +0 -1
  157. package/dist/internal/animate.js +1 -1
  158. package/dist/internal/calendar.d.ts +25 -3
  159. package/dist/internal/calendar.js +1 -1
  160. package/dist/internal/color-scheme.d.ts +23 -0
  161. package/dist/internal/color-scheme.js +1 -0
  162. package/dist/internal/date.d.ts +21 -0
  163. package/dist/internal/date.js +1 -1
  164. package/dist/internal/defaults.d.ts +69 -0
  165. package/dist/internal/defaults.js +1 -0
  166. package/dist/internal/direction.d.ts +4 -0
  167. package/dist/internal/direction.js +1 -0
  168. package/dist/internal/grid.d.ts +2 -0
  169. package/dist/internal/grid.js +1 -1
  170. package/dist/internal/keys.d.ts +93 -0
  171. package/dist/internal/keys.js +1 -0
  172. package/dist/internal/media.d.ts +26 -0
  173. package/dist/internal/media.js +1 -0
  174. package/dist/internal/page-layout.d.ts +6 -6
  175. package/dist/internal/page-layout.js +1 -1
  176. package/dist/internal/picker.d.ts +4 -2
  177. package/dist/internal/picker.js +1 -1
  178. package/dist/internal/steps.d.ts +76 -0
  179. package/dist/internal/steps.js +1 -0
  180. package/dist/provider/PlColorSchemeScript.d.ts +40 -0
  181. package/dist/provider/PlColorSchemeScript.js +1 -0
  182. package/dist/provider/PlassProvider.d.ts +39 -0
  183. package/dist/provider/PlassProvider.js +1 -0
  184. package/dist/provider/index.d.ts +5 -0
  185. package/dist/provider/index.js +1 -0
  186. package/dist/styles.css +1 -1
  187. package/dist/tailwind.css +29 -1
  188. package/dist/tokens.css +29 -1
  189. package/dist/types.d.ts +89 -0
  190. package/package.json +17 -1
package/dist/types.d.ts CHANGED
@@ -145,6 +145,95 @@ export interface PlassStyleProps {
145
145
  /** @default 'default' */
146
146
  density?: PlassDensity;
147
147
  }
148
+ /**
149
+ * The parts of a labelled control a `className` does not reach.
150
+ *
151
+ * A field is four things stacked, and only the stack itself is addressable
152
+ * otherwise: `className` lands on the wrapper that holds the label, the control
153
+ * and the two lines of text under it. That is right for the layout — a
154
+ * `w-full`, a margin, a grid position — and it is the wrong element for every
155
+ * other override a caller reaches for.
156
+ *
157
+ * `control` is the part a reader acts on: the box a `PlTextField` is typed
158
+ * into, the button a `PlSelect` opens, the tick, the track, the row of radios.
159
+ * It is the one of the four that is worth naming even when the other three are
160
+ * not there.
161
+ */
162
+ export interface PlassFieldClassNames {
163
+ /** The text above the control. */
164
+ label?: string;
165
+ /** The part a reader acts on. */
166
+ control?: string;
167
+ /** The helper text below it. */
168
+ description?: string;
169
+ /** The message below it, shown when the field is invalid. */
170
+ error?: string;
171
+ }
172
+ /**
173
+ * Chords a control answers to, in the vocabulary `PlHotKeys` draws.
174
+ *
175
+ * The key is a shortcut written the way a key cap is written — `'Enter'`,
176
+ * `'Escape'`, `'Mod+Enter'`, `'Shift+Enter'` — and `Mod` resolves per platform,
177
+ * so one entry is ⌘ on a Mac and Ctrl everywhere else. It is deliberately the
178
+ * *same* string a `PlHotKeys` beside the field would print: a shortcut a
179
+ * component displays and a shortcut it binds have to be spelled one way, or the
180
+ * cap on the screen is a claim nobody checked.
181
+ *
182
+ * A chord that matches is **consumed** — the handler runs and the key goes no
183
+ * further, so `Escape` bound on a field does not also close the dialog around
184
+ * it and `Enter` does not also submit the form. That is what binding a key
185
+ * means, and it is why these are chords rather than letters: `hotKeys={{ a }}`
186
+ * is a field that cannot type an `a`.
187
+ */
188
+ export type PlassHotKeys = Record<string, () => void>;
189
+ /** The parts of a portalled surface a `className` does not reach. */
190
+ export interface PlassPortalClassNames {
191
+ /**
192
+ * The sheet drawn over the page behind the surface — the scrim, the blur, and
193
+ * the thing a click outside the surface lands on.
194
+ */
195
+ backdrop?: string;
196
+ }
197
+ /**
198
+ * The twelve slots a colour family is cut into.
199
+ *
200
+ * Not a vocabulary a caller invents in: these are the names `styles.css`
201
+ * declares six times over, once per family, and a component reads them through
202
+ * its `--p-*` locals rather than by name. They are spelled out here so that
203
+ * `PlassToken` can be a real union rather than a string.
204
+ */
205
+ export type PlassColorSlot = 'accent' | 'fill' | 'line' | 'line-hover' | 'on-solid' | 'ring' | 'soft' | 'soft-hover' | 'soft-press' | 'solid' | 'solid-to' | 'tint';
206
+ /**
207
+ * Every design token a caller may set, by name.
208
+ *
209
+ * The `--p-*` locals a component writes onto itself are **not** here on
210
+ * purpose. Those are the library talking to itself — which family this control
211
+ * resolved to, what its shadow costs at this `elevation` — and a caller who
212
+ * sets one is setting the answer rather than the question. `color`, `variant`
213
+ * and `elevation` are the props that decide them.
214
+ */
215
+ export type PlassToken = `--plass-${PlassColor}-${PlassColorSlot}` | `--plass-radius-${PlassSize}` | `--plass-shadow-${0 | 1 | 2 | 3 | 4}` | '--plass-shadow-ambient' | '--plass-bg-from' | '--plass-bg-to' | '--plass-blur' | '--plass-border' | '--plass-divider' | '--plass-duration' | '--plass-duration-slow' | '--plass-ease' | '--plass-fg' | '--plass-flash-on-fill' | '--plass-glass' | '--plass-glass-hover' | '--plass-glass-line' | '--plass-glass-press' | '--plass-gloss-glass' | '--plass-glow-angle' | '--plass-glow-on-fill' | '--plass-muted-fg' | '--plass-scrim' | '--plass-stripe' | '--plass-surface' | '--plass-tint-strength' | '--plass-track' | '--plass-well' | '--plass-z-portal';
216
+ /**
217
+ * A set of token overrides, on its own.
218
+ *
219
+ * Not a `style` object — deliberately. The augmentation below widens
220
+ * `CSSProperties` to accept any `--plass-*` key, which is what makes the
221
+ * channel usable at all but also means a typo inside a `style` is a
222
+ * declaration nobody reads rather than an error. This type is not widened, so
223
+ * a name that is not a token fails to compile: write the theme here, once, and
224
+ * spread it into as many `style` props as it applies to.
225
+ */
226
+ export type PlassTokens = Partial<Record<PlassToken, string | number>>;
227
+ declare module 'react' {
228
+ interface CSSProperties {
229
+ /**
230
+ * A Plass design token. See `PlassToken` for the names, and
231
+ * [the token reference](https://plass.cdget.com/design/color) for what each
232
+ * one paints.
233
+ */
234
+ [token: `--plass-${string}`]: string | number | undefined;
235
+ }
236
+ }
148
237
  /**
149
238
  * The six effects the `PlAnimate*` components are built out of.
150
239
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "plass-ui",
3
- "version": "1.1.0",
3
+ "version": "1.3.0",
4
4
  "description": "A React UI component library made of glass and gradients — smooth tinted surfaces, shadows in their own colour, and light that follows the pointer. Accessible and themeable, ESM only, types included, dark mode built in.",
5
5
  "type": "module",
6
6
  "types": "dist/index.d.ts",
@@ -45,6 +45,16 @@
45
45
  "module": "./dist/types.js",
46
46
  "default": "./dist/types.js"
47
47
  },
48
+ "./hooks": {
49
+ "types": "./dist/hooks/index.d.ts",
50
+ "module": "./dist/hooks/index.js",
51
+ "default": "./dist/hooks/index.js"
52
+ },
53
+ "./provider": {
54
+ "types": "./dist/provider/index.d.ts",
55
+ "module": "./dist/provider/index.js",
56
+ "default": "./dist/provider/index.js"
57
+ },
48
58
  "./styles.css": "./dist/styles.css",
49
59
  "./tailwind.css": "./dist/tailwind.css",
50
60
  "./tokens.css": "./dist/tokens.css",
@@ -61,6 +71,12 @@
61
71
  "types": [
62
72
  "dist/types.d.ts"
63
73
  ],
74
+ "hooks": [
75
+ "dist/hooks/index.d.ts"
76
+ ],
77
+ "provider": [
78
+ "dist/provider/index.d.ts"
79
+ ],
64
80
  "*": [
65
81
  "dist/components/*/index.d.ts"
66
82
  ]