@xds/react 0.0.0-stage → 0.1.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 (100) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +19 -2
  3. package/dist/Accordion.d.ts +20 -0
  4. package/dist/Accordion.js +39 -0
  5. package/dist/Avatar.d.ts +9 -0
  6. package/dist/Avatar.js +10 -0
  7. package/dist/AvatarStack.d.ts +8 -0
  8. package/dist/AvatarStack.js +10 -0
  9. package/dist/Badge.d.ts +13 -0
  10. package/dist/Badge.js +9 -0
  11. package/dist/Banner.d.ts +23 -0
  12. package/dist/Banner.js +10 -0
  13. package/dist/Button.d.ts +14 -0
  14. package/dist/Button.js +31 -0
  15. package/dist/Card.d.ts +18 -0
  16. package/dist/Card.js +14 -0
  17. package/dist/Checkbox.d.ts +10 -0
  18. package/dist/Checkbox.js +5 -0
  19. package/dist/Chip.d.ts +12 -0
  20. package/dist/Chip.js +7 -0
  21. package/dist/ChipBar.d.ts +12 -0
  22. package/dist/ChipBar.js +5 -0
  23. package/dist/CountBadge.d.ts +12 -0
  24. package/dist/CountBadge.js +11 -0
  25. package/dist/DatePicker.d.ts +20 -0
  26. package/dist/DatePicker.js +33 -0
  27. package/dist/DateRangePicker.d.ts +24 -0
  28. package/dist/DateRangePicker.js +48 -0
  29. package/dist/Defaults.d.ts +17 -0
  30. package/dist/Defaults.js +13 -0
  31. package/dist/Dialog.d.ts +20 -0
  32. package/dist/Dialog.js +33 -0
  33. package/dist/Divider.d.ts +4 -0
  34. package/dist/Divider.js +5 -0
  35. package/dist/EmptyState.d.ts +12 -0
  36. package/dist/EmptyState.js +6 -0
  37. package/dist/Icon.d.ts +9 -0
  38. package/dist/Icon.js +9 -0
  39. package/dist/IconButton.d.ts +12 -0
  40. package/dist/IconButton.js +24 -0
  41. package/dist/ListRow.d.ts +21 -0
  42. package/dist/ListRow.js +15 -0
  43. package/dist/MediaCard.d.ts +20 -0
  44. package/dist/MediaCard.js +17 -0
  45. package/dist/Menu.d.ts +18 -0
  46. package/dist/Menu.js +68 -0
  47. package/dist/ProgressBar.d.ts +8 -0
  48. package/dist/ProgressBar.js +6 -0
  49. package/dist/RadioGroup.d.ts +15 -0
  50. package/dist/RadioGroup.js +15 -0
  51. package/dist/SearchField.d.ts +15 -0
  52. package/dist/SearchField.js +20 -0
  53. package/dist/SectionHeader.d.ts +14 -0
  54. package/dist/SectionHeader.js +8 -0
  55. package/dist/SegmentedControl.d.ts +12 -0
  56. package/dist/SegmentedControl.js +7 -0
  57. package/dist/Select.d.ts +18 -0
  58. package/dist/Select.js +66 -0
  59. package/dist/Sidebar.d.ts +21 -0
  60. package/dist/Sidebar.js +27 -0
  61. package/dist/Skeleton.d.ts +11 -0
  62. package/dist/Skeleton.js +8 -0
  63. package/dist/Slider.d.ts +13 -0
  64. package/dist/Slider.js +44 -0
  65. package/dist/Spinner.d.ts +9 -0
  66. package/dist/Spinner.js +8 -0
  67. package/dist/Switch.d.ts +13 -0
  68. package/dist/Switch.js +5 -0
  69. package/dist/Tabs.d.ts +14 -0
  70. package/dist/Tabs.js +21 -0
  71. package/dist/Text.d.ts +10 -0
  72. package/dist/Text.js +8 -0
  73. package/dist/TextField.d.ts +22 -0
  74. package/dist/TextField.js +30 -0
  75. package/dist/Thumbnail.d.ts +9 -0
  76. package/dist/Thumbnail.js +13 -0
  77. package/dist/Toast.d.ts +14 -0
  78. package/dist/Toast.js +33 -0
  79. package/dist/Tooltip.d.ts +26 -0
  80. package/dist/Tooltip.js +32 -0
  81. package/dist/index.d.ts +39 -0
  82. package/dist/index.js +39 -0
  83. package/dist/modal-popover.d.ts +7 -0
  84. package/dist/modal-popover.js +15 -0
  85. package/dist/picture.d.ts +11 -0
  86. package/dist/picture.js +21 -0
  87. package/dist/portal.d.ts +9 -0
  88. package/dist/portal.js +7 -0
  89. package/dist/presence.d.ts +6 -0
  90. package/dist/presence.js +13 -0
  91. package/dist/preview.d.ts +6 -0
  92. package/dist/preview.js +82 -0
  93. package/dist/root.d.ts +12 -0
  94. package/dist/root.js +0 -0
  95. package/dist/trigger.d.ts +17 -0
  96. package/dist/trigger.js +14 -0
  97. package/package.json +61 -4
  98. package/page.css +20 -0
  99. package/styles.css +3252 -0
  100. package/tailwind.css +2665 -0
package/dist/root.d.ts ADDED
@@ -0,0 +1,12 @@
1
+ import type { CSSProperties } from "react";
2
+ /**
3
+ * What every component takes for its root element, its outermost one, or the surface of an
4
+ * overlay: the panel of a Dialog, a Menu, a Tooltip or a Toast. The element always has its root
5
+ * part `xds-<name>` as well, the stable handle for an app's own styles.
6
+ */
7
+ export type RootProps = {
8
+ /** Classes for the root element, after the component's own. */
9
+ className?: string;
10
+ /** An inline style for the root element. What it sets wins over the component's own. */
11
+ style?: CSSProperties;
12
+ };
package/dist/root.js ADDED
File without changes
@@ -0,0 +1,17 @@
1
+ /** The props an overlay's machine has for the control that opens it. */
2
+ export type TriggerProps = Record<string, unknown>;
3
+ /** Not exported from the package: only this package's controls and overlays use it. */
4
+ export declare const TriggerContext: import("react").Context<TriggerProps | null>;
5
+ /**
6
+ * For an overlay: its trigger props, joined with those of any overlay around it, to provide as
7
+ * `<TriggerContext value={...}>` around the control. A Tooltip around a Menu's button gives the
8
+ * button both sets; the handlers of both run.
9
+ */
10
+ export declare function useProvideTrigger(own: TriggerProps): TriggerProps;
11
+ /**
12
+ * For a control that can open an overlay: its own props, after those of the overlays it opens.
13
+ * Its own attributes win, its own handlers run first, and its class is added to theirs. While
14
+ * `inert` is true, as for a loading button, the overlays get none of its events and so do not
15
+ * open. Spread the result on the element.
16
+ */
17
+ export declare function useTrigger<T extends object>(own: T, inert?: boolean): T;
@@ -0,0 +1,14 @@
1
+ import { mergeProps } from "@zag-js/react";
2
+ import { createContext, useContext } from "react";
3
+ export const TriggerContext = createContext(null);
4
+ export function useProvideTrigger(own) {
5
+ const outer = useContext(TriggerContext);
6
+ return mergeProps(outer ?? {}, own);
7
+ }
8
+ export function useTrigger(own, inert = false) {
9
+ const trigger = useContext(TriggerContext) ?? {};
10
+ const overlays = inert
11
+ ? Object.fromEntries(Object.entries(trigger).filter(([key]) => !key.startsWith("on")))
12
+ : trigger;
13
+ return mergeProps(overlays, own);
14
+ }
package/package.json CHANGED
@@ -1,6 +1,63 @@
1
1
  {
2
2
  "name": "@xds/react",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.1.0",
4
+ "description": "The xds design system's components for React.",
5
+ "keywords": [
6
+ "design-system",
7
+ "design-tokens",
8
+ "components",
9
+ "react"
10
+ ],
11
+ "license": "MIT",
12
+ "homepage": "https://github.com/kjmin-dev/xds/blob/main/docs/library.md",
13
+ "bugs": "https://github.com/kjmin-dev/xds/issues",
14
+ "repository": {
15
+ "type": "git",
16
+ "url": "git+https://github.com/kjmin-dev/xds.git",
17
+ "directory": "packages/ui"
18
+ },
19
+ "type": "module",
20
+ "sideEffects": [
21
+ "*.css"
22
+ ],
23
+ "exports": {
24
+ ".": {
25
+ "types": "./dist/index.d.ts",
26
+ "default": "./dist/index.js"
27
+ },
28
+ "./preview": {
29
+ "types": "./dist/preview.d.ts",
30
+ "default": "./dist/preview.js"
31
+ },
32
+ "./styles.css": "./styles.css",
33
+ "./tailwind.css": "./tailwind.css",
34
+ "./page.css": "./page.css",
35
+ "./package.json": "./package.json"
36
+ },
37
+ "files": [
38
+ "dist",
39
+ "styles.css",
40
+ "tailwind.css",
41
+ "page.css"
42
+ ],
43
+ "dependencies": {
44
+ "@xds/tokens": "0.1.0",
45
+ "@xds/core": "0.1.0",
46
+ "@internationalized/date": "3.12.4",
47
+ "@zag-js/accordion": "2.0.0-next.4",
48
+ "@zag-js/aria-hidden": "2.0.0-next.4",
49
+ "@zag-js/date-picker": "2.0.0-next.4",
50
+ "@zag-js/dialog": "2.0.0-next.4",
51
+ "@zag-js/menu": "2.0.0-next.4",
52
+ "@zag-js/react": "2.0.0-next.4",
53
+ "@zag-js/remove-scroll": "2.0.0-next.4",
54
+ "@zag-js/select": "2.0.0-next.4",
55
+ "@zag-js/slider": "2.0.0-next.4",
56
+ "@zag-js/tabs": "2.0.0-next.4",
57
+ "@zag-js/tooltip": "2.0.0-next.4"
58
+ },
59
+ "peerDependencies": {
60
+ "react": "^19.3.0",
61
+ "react-dom": "^19.3.0"
62
+ }
63
+ }
package/page.css ADDED
@@ -0,0 +1,20 @@
1
+ /* The page itself: its font and how its text breaks, and the body's colors and text. An app
2
+ that takes the components as a library may leave these to its own page. */
3
+
4
+ @layer xds.base {
5
+ :root {
6
+ font-family: var(--xds-font-family-sans);
7
+ /* Korean breaks between words, not between syllables. */
8
+ word-break: keep-all;
9
+ /* Long unbroken strings (URLs, email addresses) still wrap instead of overflowing. */
10
+ overflow-wrap: anywhere;
11
+ }
12
+
13
+ body {
14
+ margin: 0;
15
+ background-color: var(--xds-color-background-base);
16
+ color: var(--xds-color-text-primary);
17
+ font-size: var(--xds-typography-body-size);
18
+ line-height: var(--xds-typography-body-line-height);
19
+ }
20
+ }