@microbit/ui 0.1.0-alpha.3 → 0.1.0-alpha.30

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 (114) hide show
  1. package/LICENSE.md +40 -0
  2. package/README.md +256 -26
  3. package/lang/ui.ca.json +43 -3
  4. package/lang/ui.cy.json +62 -0
  5. package/lang/ui.de.json +62 -0
  6. package/lang/ui.en-us.json +40 -0
  7. package/lang/ui.en.json +40 -0
  8. package/lang/ui.es-es.json +43 -3
  9. package/lang/ui.fr.json +44 -4
  10. package/lang/ui.ga-ie.json +62 -0
  11. package/lang/ui.it.json +62 -0
  12. package/lang/ui.ja.json +44 -4
  13. package/lang/ui.ko.json +44 -4
  14. package/lang/ui.lo.json +62 -0
  15. package/lang/ui.lol.json +40 -0
  16. package/lang/ui.nl.json +44 -4
  17. package/lang/ui.pl.json +44 -4
  18. package/lang/ui.pt-br.json +44 -4
  19. package/lang/ui.vi.json +62 -0
  20. package/lang/ui.zh-cn.json +62 -0
  21. package/lang/ui.zh-tw.json +44 -4
  22. package/package.json +19 -10
  23. package/postcss-legacy-safari.cjs +96 -0
  24. package/reset.css +35 -0
  25. package/src/Avatar.recipe.ts +166 -0
  26. package/src/Avatar.tsx +278 -0
  27. package/src/Breadcrumb.recipe.ts +39 -0
  28. package/src/Breadcrumb.tsx +114 -0
  29. package/src/Button.recipe.ts +88 -50
  30. package/src/Button.tsx +64 -26
  31. package/src/ButtonGroup.tsx +37 -15
  32. package/src/Card.recipe.ts +1 -2
  33. package/src/Card.tsx +2 -1
  34. package/src/Checkbox.recipe.ts +49 -14
  35. package/src/Checkbox.tsx +111 -32
  36. package/src/CheckboxGroup.tsx +70 -0
  37. package/src/CloseButton.tsx +3 -3
  38. package/src/CloseIcon.tsx +6 -4
  39. package/src/Code.tsx +20 -0
  40. package/src/Collapse.tsx +179 -0
  41. package/src/ComboBox.tsx +246 -0
  42. package/src/Divider.tsx +72 -8
  43. package/src/Drawer.recipe.ts +4 -5
  44. package/src/Drawer.tsx +3 -4
  45. package/src/ExternalLink.tsx +43 -0
  46. package/src/Fade.tsx +62 -0
  47. package/src/Field.recipe.ts +114 -0
  48. package/src/Field.tsx +187 -0
  49. package/src/GridList.recipe.ts +57 -0
  50. package/src/GridList.tsx +81 -0
  51. package/src/Heading.recipe.ts +20 -1
  52. package/src/Heading.tsx +3 -3
  53. package/src/Icon.tsx +23 -7
  54. package/src/IconButton.tsx +7 -12
  55. package/src/Image.tsx +1 -1
  56. package/src/Input.recipe.ts +41 -28
  57. package/src/Input.tsx +23 -7
  58. package/src/InputGroup.tsx +21 -8
  59. package/src/Kbd.tsx +26 -0
  60. package/src/Link.tsx +3 -3
  61. package/src/LinkBox.tsx +2 -3
  62. package/src/LinkButton.tsx +81 -0
  63. package/src/List.tsx +8 -6
  64. package/src/ListBox.recipe.ts +43 -0
  65. package/src/ListBox.tsx +88 -0
  66. package/src/Menu.recipe.ts +51 -17
  67. package/src/Menu.tsx +117 -2
  68. package/src/Modal.recipe.ts +14 -9
  69. package/src/Modal.tsx +137 -24
  70. package/src/MoreMenuButton.tsx +63 -0
  71. package/src/NativeSelect.tsx +39 -12
  72. package/src/NativeSelectField.tsx +84 -0
  73. package/src/NumberField.recipe.ts +108 -0
  74. package/src/NumberField.tsx +138 -0
  75. package/src/PopoverArrow.tsx +19 -5
  76. package/src/ProgressBar.tsx +3 -5
  77. package/src/Radio.recipe.ts +108 -0
  78. package/src/Radio.tsx +62 -0
  79. package/src/RadioGroup.tsx +68 -0
  80. package/src/Select.recipe.ts +211 -0
  81. package/src/Select.tsx +194 -0
  82. package/src/SharedUIProvider.tsx +51 -7
  83. package/src/Skeleton.tsx +146 -0
  84. package/src/Slide.tsx +2 -2
  85. package/src/Slider.recipe.ts +24 -15
  86. package/src/Slider.tsx +65 -5
  87. package/src/Spinner.tsx +11 -9
  88. package/src/Svg.tsx +2 -3
  89. package/src/Switch.recipe.ts +58 -13
  90. package/src/Switch.tsx +39 -7
  91. package/src/Text.recipe.ts +26 -0
  92. package/src/Text.tsx +6 -2
  93. package/src/TextField.tsx +54 -40
  94. package/src/Toast.recipe.ts +49 -12
  95. package/src/Toast.tsx +151 -46
  96. package/src/Tooltip.recipe.ts +32 -0
  97. package/src/Tooltip.tsx +51 -28
  98. package/src/TooltipButton.tsx +229 -0
  99. package/src/UnmountCallback.tsx +2 -2
  100. package/src/VisuallyHidden.tsx +1 -1
  101. package/src/base-preset.ts +336 -84
  102. package/src/{chakra-tokens.ts → base-tokens.ts} +7 -7
  103. package/src/button-icon.ts +22 -0
  104. package/src/data-attrs.ts +16 -0
  105. package/src/dense-preset.ts +107 -0
  106. package/src/hooks/useBreakpointValue.ts +4 -4
  107. package/src/hooks/useClipboard.ts +63 -0
  108. package/src/hooks/useDisclosure.ts +31 -0
  109. package/src/hooks/useMediaQuery.ts +27 -0
  110. package/src/hooks/usePrevious.ts +15 -0
  111. package/src/index.ts +29 -3
  112. package/src/rac-locale.ts +33 -0
  113. package/src/system.ts +22 -1
  114. package/src/TextField.recipe.ts +0 -54
package/lang/ui.pl.json CHANGED
@@ -1,22 +1,62 @@
1
1
  {
2
+ "ui.breadcrumb": {
3
+ "defaultMessage": "Ścieżka nawigacji",
4
+ "description": "Accessible label for the breadcrumb navigation trail (the WAI-ARIA APG's conventional name)"
5
+ },
2
6
  "ui.close-action": {
3
7
  "defaultMessage": "Zamknij",
4
8
  "description": "Close button text or label"
5
9
  },
10
+ "ui.combobox-listbox": {
11
+ "defaultMessage": "Sugestie",
12
+ "description": "Accessible label for a ComboBox's dropdown list of suggestions"
13
+ },
14
+ "ui.combobox-trigger": {
15
+ "defaultMessage": "Pokaż sugestie",
16
+ "description": "Accessible label for the button that opens a ComboBox's suggestions dropdown"
17
+ },
18
+ "ui.loading": {
19
+ "defaultMessage": "Ładowanie",
20
+ "description": "Announced by screen readers for a button showing a loading spinner"
21
+ },
22
+ "ui.new-tab-notice": {
23
+ "defaultMessage": "opens in a new tab",
24
+ "description": "Visually hidden suffix on links that open a new tab, announced by screen readers"
25
+ },
26
+ "ui.numberfield-decrease": {
27
+ "defaultMessage": "Zmniejsz {fieldLabel}",
28
+ "description": "Accessible label for a number field's decrement stepper; fieldLabel is the field's label and may be empty"
29
+ },
30
+ "ui.numberfield-increase": {
31
+ "defaultMessage": "Zwiększ {fieldLabel}",
32
+ "description": "Accessible label for a number field's increment stepper; fieldLabel is the field's label and may be empty"
33
+ },
34
+ "ui.select-placeholder": {
35
+ "defaultMessage": "Wybierz element",
36
+ "description": "Shown in a Select's trigger while nothing is chosen and the app supplies no placeholder"
37
+ },
38
+ "ui.select-row-action": {
39
+ "defaultMessage": "Wybierz",
40
+ "description": "Accessible label for a row-selection checkbox in a list or table; screen readers read it together with the row's content"
41
+ },
42
+ "ui.toast-region": {
43
+ "defaultMessage": "{count, plural, one {# powiadomienie} few {# powiadomienia} many {# powiadomień} other {# powiadomienia}}.",
44
+ "description": "Accessible label for the notifications area; count is the number of notifications showing"
45
+ },
6
46
  "ui.toast-status-error": {
7
- "defaultMessage": "Error",
47
+ "defaultMessage": "Błąd",
8
48
  "description": "Announced by screen readers before an error notification"
9
49
  },
10
50
  "ui.toast-status-info": {
11
- "defaultMessage": "Information",
51
+ "defaultMessage": "Informacja",
12
52
  "description": "Announced by screen readers before an informational notification"
13
53
  },
14
54
  "ui.toast-status-success": {
15
- "defaultMessage": "Success",
55
+ "defaultMessage": "Sukces",
16
56
  "description": "Announced by screen readers before a success notification"
17
57
  },
18
58
  "ui.toast-status-warning": {
19
- "defaultMessage": "Warning",
59
+ "defaultMessage": "Ostrzeżenie",
20
60
  "description": "Announced by screen readers before a warning notification"
21
61
  }
22
62
  }
@@ -1,22 +1,62 @@
1
1
  {
2
+ "ui.breadcrumb": {
3
+ "defaultMessage": "Trilha de navegação",
4
+ "description": "Accessible label for the breadcrumb navigation trail (the WAI-ARIA APG's conventional name)"
5
+ },
2
6
  "ui.close-action": {
3
7
  "defaultMessage": "Fechar",
4
8
  "description": "Close button text or label"
5
9
  },
10
+ "ui.combobox-listbox": {
11
+ "defaultMessage": "Sugestões",
12
+ "description": "Accessible label for a ComboBox's dropdown list of suggestions"
13
+ },
14
+ "ui.combobox-trigger": {
15
+ "defaultMessage": "Mostrar sugestões",
16
+ "description": "Accessible label for the button that opens a ComboBox's suggestions dropdown"
17
+ },
18
+ "ui.loading": {
19
+ "defaultMessage": "Carregando",
20
+ "description": "Announced by screen readers for a button showing a loading spinner"
21
+ },
22
+ "ui.new-tab-notice": {
23
+ "defaultMessage": "opens in a new tab",
24
+ "description": "Visually hidden suffix on links that open a new tab, announced by screen readers"
25
+ },
26
+ "ui.numberfield-decrease": {
27
+ "defaultMessage": "Diminuir {fieldLabel}",
28
+ "description": "Accessible label for a number field's decrement stepper; fieldLabel is the field's label and may be empty"
29
+ },
30
+ "ui.numberfield-increase": {
31
+ "defaultMessage": "Aumentar {fieldLabel}",
32
+ "description": "Accessible label for a number field's increment stepper; fieldLabel is the field's label and may be empty"
33
+ },
34
+ "ui.select-placeholder": {
35
+ "defaultMessage": "Selecione um item",
36
+ "description": "Shown in a Select's trigger while nothing is chosen and the app supplies no placeholder"
37
+ },
38
+ "ui.select-row-action": {
39
+ "defaultMessage": "Seleciona",
40
+ "description": "Accessible label for a row-selection checkbox in a list or table; screen readers read it together with the row's content"
41
+ },
42
+ "ui.toast-region": {
43
+ "defaultMessage": "{count, plural, one {# notificação} other {# notificações}}.",
44
+ "description": "Accessible label for the notifications area; count is the number of notifications showing"
45
+ },
6
46
  "ui.toast-status-error": {
7
- "defaultMessage": "Error",
47
+ "defaultMessage": "Erro",
8
48
  "description": "Announced by screen readers before an error notification"
9
49
  },
10
50
  "ui.toast-status-info": {
11
- "defaultMessage": "Information",
51
+ "defaultMessage": "Informações",
12
52
  "description": "Announced by screen readers before an informational notification"
13
53
  },
14
54
  "ui.toast-status-success": {
15
- "defaultMessage": "Success",
55
+ "defaultMessage": "Sucesso",
16
56
  "description": "Announced by screen readers before a success notification"
17
57
  },
18
58
  "ui.toast-status-warning": {
19
- "defaultMessage": "Warning",
59
+ "defaultMessage": "Atenção",
20
60
  "description": "Announced by screen readers before a warning notification"
21
61
  }
22
62
  }
@@ -0,0 +1,62 @@
1
+ {
2
+ "ui.breadcrumb": {
3
+ "defaultMessage": "Đường dẫn",
4
+ "description": "Accessible label for the breadcrumb navigation trail (the WAI-ARIA APG's conventional name)"
5
+ },
6
+ "ui.close-action": {
7
+ "defaultMessage": "Đóng",
8
+ "description": "Close button text or label"
9
+ },
10
+ "ui.combobox-listbox": {
11
+ "defaultMessage": "Gợi ý",
12
+ "description": "Accessible label for a ComboBox's dropdown list of suggestions"
13
+ },
14
+ "ui.combobox-trigger": {
15
+ "defaultMessage": "Hiển thị gợi ý",
16
+ "description": "Accessible label for the button that opens a ComboBox's suggestions dropdown"
17
+ },
18
+ "ui.loading": {
19
+ "defaultMessage": "Đang tải",
20
+ "description": "Announced by screen readers for a button showing a loading spinner"
21
+ },
22
+ "ui.new-tab-notice": {
23
+ "defaultMessage": "opens in a new tab",
24
+ "description": "Visually hidden suffix on links that open a new tab, announced by screen readers"
25
+ },
26
+ "ui.numberfield-decrease": {
27
+ "defaultMessage": "Giảm {fieldLabel}",
28
+ "description": "Accessible label for a number field's decrement stepper; fieldLabel is the field's label and may be empty"
29
+ },
30
+ "ui.numberfield-increase": {
31
+ "defaultMessage": "Tăng {fieldLabel}",
32
+ "description": "Accessible label for a number field's increment stepper; fieldLabel is the field's label and may be empty"
33
+ },
34
+ "ui.select-placeholder": {
35
+ "defaultMessage": "Chọn một mục",
36
+ "description": "Shown in a Select's trigger while nothing is chosen and the app supplies no placeholder"
37
+ },
38
+ "ui.select-row-action": {
39
+ "defaultMessage": "Lựa chọn",
40
+ "description": "Accessible label for a row-selection checkbox in a list or table; screen readers read it together with the row's content"
41
+ },
42
+ "ui.toast-region": {
43
+ "defaultMessage": "{count, plural, other {# thông báo}}.",
44
+ "description": "Accessible label for the notifications area; count is the number of notifications showing"
45
+ },
46
+ "ui.toast-status-error": {
47
+ "defaultMessage": "Lỗi",
48
+ "description": "Announced by screen readers before an error notification"
49
+ },
50
+ "ui.toast-status-info": {
51
+ "defaultMessage": "Thông tin",
52
+ "description": "Announced by screen readers before an informational notification"
53
+ },
54
+ "ui.toast-status-success": {
55
+ "defaultMessage": "Thành công",
56
+ "description": "Announced by screen readers before a success notification"
57
+ },
58
+ "ui.toast-status-warning": {
59
+ "defaultMessage": "Cảnh báo",
60
+ "description": "Announced by screen readers before a warning notification"
61
+ }
62
+ }
@@ -0,0 +1,62 @@
1
+ {
2
+ "ui.breadcrumb": {
3
+ "defaultMessage": "痕迹导航",
4
+ "description": "Accessible label for the breadcrumb navigation trail (the WAI-ARIA APG's conventional name)"
5
+ },
6
+ "ui.close-action": {
7
+ "defaultMessage": "关闭",
8
+ "description": "Close button text or label"
9
+ },
10
+ "ui.combobox-listbox": {
11
+ "defaultMessage": "建议",
12
+ "description": "Accessible label for a ComboBox's dropdown list of suggestions"
13
+ },
14
+ "ui.combobox-trigger": {
15
+ "defaultMessage": "显示建议",
16
+ "description": "Accessible label for the button that opens a ComboBox's suggestions dropdown"
17
+ },
18
+ "ui.loading": {
19
+ "defaultMessage": "正在加载",
20
+ "description": "Announced by screen readers for a button showing a loading spinner"
21
+ },
22
+ "ui.new-tab-notice": {
23
+ "defaultMessage": "opens in a new tab",
24
+ "description": "Visually hidden suffix on links that open a new tab, announced by screen readers"
25
+ },
26
+ "ui.numberfield-decrease": {
27
+ "defaultMessage": "降低 {fieldLabel}",
28
+ "description": "Accessible label for a number field's decrement stepper; fieldLabel is the field's label and may be empty"
29
+ },
30
+ "ui.numberfield-increase": {
31
+ "defaultMessage": "提高 {fieldLabel}",
32
+ "description": "Accessible label for a number field's increment stepper; fieldLabel is the field's label and may be empty"
33
+ },
34
+ "ui.select-placeholder": {
35
+ "defaultMessage": "选择一个项目",
36
+ "description": "Shown in a Select's trigger while nothing is chosen and the app supplies no placeholder"
37
+ },
38
+ "ui.select-row-action": {
39
+ "defaultMessage": "选择",
40
+ "description": "Accessible label for a row-selection checkbox in a list or table; screen readers read it together with the row's content"
41
+ },
42
+ "ui.toast-region": {
43
+ "defaultMessage": "{count, plural, one {# 个通知} other {# 个通知}}。",
44
+ "description": "Accessible label for the notifications area; count is the number of notifications showing"
45
+ },
46
+ "ui.toast-status-error": {
47
+ "defaultMessage": "错误",
48
+ "description": "Announced by screen readers before an error notification"
49
+ },
50
+ "ui.toast-status-info": {
51
+ "defaultMessage": "信息",
52
+ "description": "Announced by screen readers before an informational notification"
53
+ },
54
+ "ui.toast-status-success": {
55
+ "defaultMessage": "成功",
56
+ "description": "Announced by screen readers before a success notification"
57
+ },
58
+ "ui.toast-status-warning": {
59
+ "defaultMessage": "警告",
60
+ "description": "Announced by screen readers before a warning notification"
61
+ }
62
+ }
@@ -1,22 +1,62 @@
1
1
  {
2
+ "ui.breadcrumb": {
3
+ "defaultMessage": "巡覽路徑",
4
+ "description": "Accessible label for the breadcrumb navigation trail (the WAI-ARIA APG's conventional name)"
5
+ },
2
6
  "ui.close-action": {
3
7
  "defaultMessage": "關閉",
4
8
  "description": "Close button text or label"
5
9
  },
10
+ "ui.combobox-listbox": {
11
+ "defaultMessage": "建議",
12
+ "description": "Accessible label for a ComboBox's dropdown list of suggestions"
13
+ },
14
+ "ui.combobox-trigger": {
15
+ "defaultMessage": "顯示建議",
16
+ "description": "Accessible label for the button that opens a ComboBox's suggestions dropdown"
17
+ },
18
+ "ui.loading": {
19
+ "defaultMessage": "正在載入",
20
+ "description": "Announced by screen readers for a button showing a loading spinner"
21
+ },
22
+ "ui.new-tab-notice": {
23
+ "defaultMessage": "opens in a new tab",
24
+ "description": "Visually hidden suffix on links that open a new tab, announced by screen readers"
25
+ },
26
+ "ui.numberfield-decrease": {
27
+ "defaultMessage": "縮小 {fieldLabel}",
28
+ "description": "Accessible label for a number field's decrement stepper; fieldLabel is the field's label and may be empty"
29
+ },
30
+ "ui.numberfield-increase": {
31
+ "defaultMessage": "放大 {fieldLabel}",
32
+ "description": "Accessible label for a number field's increment stepper; fieldLabel is the field's label and may be empty"
33
+ },
34
+ "ui.select-placeholder": {
35
+ "defaultMessage": "選取項目",
36
+ "description": "Shown in a Select's trigger while nothing is chosen and the app supplies no placeholder"
37
+ },
38
+ "ui.select-row-action": {
39
+ "defaultMessage": "選擇",
40
+ "description": "Accessible label for a row-selection checkbox in a list or table; screen readers read it together with the row's content"
41
+ },
42
+ "ui.toast-region": {
43
+ "defaultMessage": "{count, plural, one {# 個通知} other {# 個通知}}。",
44
+ "description": "Accessible label for the notifications area; count is the number of notifications showing"
45
+ },
6
46
  "ui.toast-status-error": {
7
- "defaultMessage": "Error",
47
+ "defaultMessage": "錯誤",
8
48
  "description": "Announced by screen readers before an error notification"
9
49
  },
10
50
  "ui.toast-status-info": {
11
- "defaultMessage": "Information",
51
+ "defaultMessage": "資訊",
12
52
  "description": "Announced by screen readers before an informational notification"
13
53
  },
14
54
  "ui.toast-status-success": {
15
- "defaultMessage": "Success",
55
+ "defaultMessage": "成功",
16
56
  "description": "Announced by screen readers before a success notification"
17
57
  },
18
58
  "ui.toast-status-warning": {
19
- "defaultMessage": "Warning",
59
+ "defaultMessage": "警告",
20
60
  "description": "Announced by screen readers before a warning notification"
21
61
  }
22
62
  }
package/package.json CHANGED
@@ -1,34 +1,38 @@
1
1
  {
2
2
  "name": "@microbit/ui",
3
- "version": "0.1.0-alpha.3",
4
- "description": "micro:bit design-system primitives: react-aria-components + Panda CSS with a Chakra v2 design language. Ships as source; see README for the consumption setup.",
3
+ "version": "0.1.0-alpha.30",
4
+ "description": "micro:bit design-system primitives: react-aria-components + Panda CSS with a design language ported from Chakra UI v2. Ships as source; see README for the consumption setup.",
5
5
  "license": "MIT",
6
6
  "type": "module",
7
7
  "exports": {
8
8
  ".": "./src/index.ts",
9
9
  "./base-preset": "./src/base-preset.ts",
10
- "./chakra-tokens": "./src/chakra-tokens.ts",
10
+ "./base-tokens": "./src/base-tokens.ts",
11
+ "./dense-preset": "./src/dense-preset.ts",
11
12
  "./messages": "./src/messages.ts",
13
+ "./postcss-legacy-safari": "./postcss-legacy-safari.cjs",
14
+ "./reset.css": "./reset.css",
12
15
  "./lang/*": "./lang/*"
13
16
  },
14
17
  "files": [
15
18
  "src",
16
19
  "lang",
20
+ "postcss-legacy-safari.cjs",
21
+ "reset.css",
17
22
  "README.md",
18
23
  "LICENSE.md"
19
24
  ],
20
25
  "sideEffects": false,
21
26
  "scripts": {
22
- "panda": "panda codegen && panda cssgen --outfile styled-system.css",
27
+ "panda": "panda codegen",
23
28
  "typecheck": "npm run panda && tsc --noEmit",
24
- "prestorybook": "npm run panda",
25
- "storybook": "storybook dev -p 6006 --no-open",
26
- "prebuild-storybook": "npm run panda",
27
- "build-storybook": "storybook build"
29
+ "pretest": "npm run panda",
30
+ "test": "vitest run"
28
31
  },
29
32
  "peerDependencies": {
30
33
  "@pandacss/dev": "^1.11.4",
31
34
  "react": "^18.3.1",
35
+ "react-aria": "^3.50.0",
32
36
  "react-aria-components": "^1.19.0",
33
37
  "react-icons": "^4.12.0 || ^5.0.0",
34
38
  "react-intl": "^6.6.8 || ^7.0.0"
@@ -36,17 +40,22 @@
36
40
  "devDependencies": {
37
41
  "@pandacss/dev": "^1.11.4",
38
42
  "@storybook/react-vite": "^10.5.2",
43
+ "@testing-library/react": "^16.3.2",
44
+ "@testing-library/user-event": "^14.6.1",
45
+ "@types/node": "^26.1.1",
39
46
  "@types/react": "^18.3.3",
40
47
  "@types/react-dom": "^18.3.0",
41
48
  "@vitejs/plugin-react": "^4.5.2",
49
+ "jsdom": "^29.1.1",
42
50
  "react": "^18.3.1",
51
+ "react-aria": "^3.50.0",
43
52
  "react-aria-components": "^1.19.0",
44
53
  "react-dom": "^18.3.1",
45
54
  "react-icons": "^4.12.0",
46
55
  "react-intl": "^6.6.8",
47
- "storybook": "^10.5.2",
48
56
  "typescript": "^5.4.2",
49
- "vite": "^6.3.5"
57
+ "vite": "^6.3.5",
58
+ "vitest": "^4.1.10"
50
59
  },
51
60
  "publishConfig": {
52
61
  "tag": "alpha"
@@ -0,0 +1,96 @@
1
+ /*
2
+ * (c) 2026, Micro:bit Educational Foundation and contributors
3
+ *
4
+ * SPDX-License-Identifier: MIT
5
+ *
6
+ * TEMPORARY compatibility shim for consuming apps that still support Safari
7
+ * below 15. Delete this file (and the app-side wiring — see the README) once
8
+ * every consuming app has raised its support floor past the affected browsers.
9
+ *
10
+ * The bug: Safari 14.x silently drops logical *shorthands* whose value
11
+ * contains var() — `padding-inline: var(--spacing-2)` applies nothing, even
12
+ * though `padding-inline: 10px` (literal) and `padding-inline-start:
13
+ * var(--spacing-2)` (longhand) both work. Panda emits these shorthands for its
14
+ * px/py/mx/my utilities, so the bug removes most token-based spacing.
15
+ *
16
+ * The fix: rewrite the inline/block logical shorthands into their -start/-end
17
+ * longhands. Kept logical (not physical left/right) so RTL still flips.
18
+ *
19
+ * This is one of TWO legacy concerns for the same era of browsers; the other
20
+ * is @layer, which those browsers drop wholesale. Apps also run
21
+ * @csstools/postcss-cascade-layers (de-layering) and pin build.cssTarget — see
22
+ * the "Legacy browser support" section of the README. All of it is expected to
23
+ * be removed together when the floor rises.
24
+ *
25
+ * Exposed as a PostCSS plugin factory:
26
+ * const { expandLogicalShorthands } = require("@microbit/ui/postcss-legacy-safari");
27
+ * module.exports = { plugins: [expandLogicalShorthands(), ...] };
28
+ */
29
+
30
+ // Logical shorthands whose value is `<start> <end>` (one value applies to
31
+ // both). NOT included: border-inline / border-block — those are compound
32
+ // (`width style color`) and duplicate the whole value to each side rather than
33
+ // splitting, so they would need different handling. Add them explicitly if a
34
+ // consuming app ever emits them.
35
+ const LOGICAL_SHORTHANDS = {
36
+ "padding-inline": ["padding-inline-start", "padding-inline-end"],
37
+ "padding-block": ["padding-block-start", "padding-block-end"],
38
+ "margin-inline": ["margin-inline-start", "margin-inline-end"],
39
+ "margin-block": ["margin-block-start", "margin-block-end"],
40
+ "inset-inline": ["inset-inline-start", "inset-inline-end"],
41
+ "inset-block": ["inset-block-start", "inset-block-end"],
42
+ "scroll-margin-inline": [
43
+ "scroll-margin-inline-start",
44
+ "scroll-margin-inline-end",
45
+ ],
46
+ "scroll-margin-block": [
47
+ "scroll-margin-block-start",
48
+ "scroll-margin-block-end",
49
+ ],
50
+ "scroll-padding-inline": [
51
+ "scroll-padding-inline-start",
52
+ "scroll-padding-inline-end",
53
+ ],
54
+ "scroll-padding-block": [
55
+ "scroll-padding-block-start",
56
+ "scroll-padding-block-end",
57
+ ],
58
+ };
59
+
60
+ // Split a value on top-level whitespace, ignoring spaces inside parens so
61
+ // var() fallbacks stay intact. One value applies to both sides; two map to
62
+ // start then end (per the CSS shorthand rules).
63
+ const splitTopLevel = (value) => {
64
+ const parts = [];
65
+ let depth = 0;
66
+ let current = "";
67
+ for (const ch of value) {
68
+ if (ch === "(") depth++;
69
+ else if (ch === ")") depth--;
70
+ if (depth === 0 && /\s/.test(ch)) {
71
+ if (current.trim()) parts.push(current.trim());
72
+ current = "";
73
+ } else {
74
+ current += ch;
75
+ }
76
+ }
77
+ if (current.trim()) parts.push(current.trim());
78
+ return parts;
79
+ };
80
+
81
+ const expandLogicalShorthands = () => ({
82
+ postcssPlugin: "microbit-ui-expand-logical-shorthands",
83
+ Declaration(decl) {
84
+ const longhands = LOGICAL_SHORTHANDS[decl.prop.toLowerCase()];
85
+ if (!longhands) return;
86
+ const parts = splitTopLevel(decl.value);
87
+ if (parts.length === 0) return;
88
+ const [start, end = start] = parts;
89
+ decl.cloneBefore({ prop: longhands[0], value: start });
90
+ decl.cloneBefore({ prop: longhands[1], value: end });
91
+ decl.remove();
92
+ },
93
+ });
94
+ expandLogicalShorthands.postcss = true;
95
+
96
+ module.exports = { expandLogicalShorthands };
package/reset.css ADDED
@@ -0,0 +1,35 @@
1
+ /**
2
+ * (c) 2026, Micro:bit Educational Foundation and contributors
3
+ *
4
+ * SPDX-License-Identifier: MIT
5
+ *
6
+ * Chakra-reset parity that must live in the `reset` cascade layer: import
7
+ * from the app's layers.css with
8
+ *
9
+ * @import "@microbit/ui/reset.css" layer(reset);
10
+ *
11
+ * Deliberately not in the preset's globalCss: globalCss emits into the
12
+ * `base` layer, and the legacy-Safari cascade-layer flattening
13
+ * specificity-boosts base+ rules above CSS it can't see (runtime-injected
14
+ * styles such as CodeMirror themes, and other per-file-processed app CSS).
15
+ * A reset must stay at the bottom of the cascade in production exactly as
16
+ * it is in dev — see playbook gotcha #28.
17
+ */
18
+ *,
19
+ *::before,
20
+ *::after {
21
+ border-color: var(--colors-gray-200);
22
+ word-wrap: break-word;
23
+ }
24
+
25
+ /*
26
+ * Panda's preflight (base layer) beats the rule above with
27
+ * `border-color: var(--global-color-border, currentcolor)`. The currentcolor
28
+ * fallback poisons `border-color: inherit` chains (inherit copies the
29
+ * currentcolor KEYWORD, which then resolves against the child's own `color`
30
+ * — e.g. white on the checkbox/radio control). Defining the hook keeps the
31
+ * default border colour a real colour, as Chakra's global reset did.
32
+ */
33
+ :root {
34
+ --global-color-border: var(--colors-gray-200);
35
+ }