@primer/styled-react 0.0.0-20260325190039 → 0.0.0-20260325221512

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 (141) hide show
  1. package/dist/_virtual/_commonjsHelpers.js +5 -0
  2. package/dist/_virtual/cjs.js +7 -0
  3. package/dist/_virtual/focus-visible.js +3 -0
  4. package/dist/_virtual/focus-visible2.js +3 -0
  5. package/dist/components.json +0 -4
  6. package/dist/node_modules/clsx/dist/clsx.js +3 -0
  7. package/dist/node_modules/deepmerge/dist/cjs.js +142 -0
  8. package/dist/node_modules/focus-visible/dist/focus-visible.js +324 -0
  9. package/dist/{components → packages/styled-react/src/components}/BaseStyles.js +2 -2
  10. package/dist/{components → packages/styled-react/src/components}/ThemeProvider.js +82 -40
  11. package/dist/{index.js → packages/styled-react/src/index.js} +1 -3
  12. package/dist/{sx.js → packages/styled-react/src/sx.js} +1 -1
  13. package/package.json +4 -4
  14. package/dist/components/ActionList.d.ts +0 -44
  15. package/dist/components/ActionList.d.ts.map +0 -1
  16. package/dist/components/ActionMenu.d.ts +0 -13
  17. package/dist/components/ActionMenu.d.ts.map +0 -1
  18. package/dist/components/Avatar.d.ts +0 -13
  19. package/dist/components/Avatar.d.ts.map +0 -1
  20. package/dist/components/Avatar.js +0 -14
  21. package/dist/components/BaseStyles.d.ts +0 -17
  22. package/dist/components/BaseStyles.d.ts.map +0 -1
  23. package/dist/components/Box.d.ts +0 -19
  24. package/dist/components/Box.d.ts.map +0 -1
  25. package/dist/components/Breadcrumbs.d.ts +0 -18
  26. package/dist/components/Breadcrumbs.d.ts.map +0 -1
  27. package/dist/components/Button.d.ts +0 -12
  28. package/dist/components/Button.d.ts.map +0 -1
  29. package/dist/components/Button.stories.d.ts +0 -8
  30. package/dist/components/Button.stories.d.ts.map +0 -1
  31. package/dist/components/CounterLabel.d.ts +0 -11
  32. package/dist/components/CounterLabel.d.ts.map +0 -1
  33. package/dist/components/DataTable.d.ts +0 -11
  34. package/dist/components/DataTable.d.ts.map +0 -1
  35. package/dist/components/Dialog.d.ts +0 -30
  36. package/dist/components/Dialog.d.ts.map +0 -1
  37. package/dist/components/Flash.d.ts +0 -8
  38. package/dist/components/Flash.d.ts.map +0 -1
  39. package/dist/components/FormControl.d.ts +0 -13
  40. package/dist/components/FormControl.d.ts.map +0 -1
  41. package/dist/components/Header.d.ts +0 -11
  42. package/dist/components/Header.d.ts.map +0 -1
  43. package/dist/components/Heading.d.ts +0 -8
  44. package/dist/components/Heading.d.ts.map +0 -1
  45. package/dist/components/IconButton.d.ts +0 -10
  46. package/dist/components/IconButton.d.ts.map +0 -1
  47. package/dist/components/Label.d.ts +0 -9
  48. package/dist/components/Label.d.ts.map +0 -1
  49. package/dist/components/Link.d.ts +0 -7
  50. package/dist/components/Link.d.ts.map +0 -1
  51. package/dist/components/LinkButton.d.ts +0 -8
  52. package/dist/components/LinkButton.d.ts.map +0 -1
  53. package/dist/components/Overlay.d.ts +0 -8
  54. package/dist/components/Overlay.d.ts.map +0 -1
  55. package/dist/components/PageHeader.d.ts +0 -31
  56. package/dist/components/PageHeader.d.ts.map +0 -1
  57. package/dist/components/SegmentedControl.d.ts +0 -19
  58. package/dist/components/SegmentedControl.d.ts.map +0 -1
  59. package/dist/components/Spinner.d.ts +0 -5
  60. package/dist/components/Spinner.d.ts.map +0 -1
  61. package/dist/components/Text.d.ts +0 -15
  62. package/dist/components/Text.d.ts.map +0 -1
  63. package/dist/components/TextInput.d.ts +0 -15
  64. package/dist/components/TextInput.d.ts.map +0 -1
  65. package/dist/components/Textarea.d.ts +0 -9
  66. package/dist/components/Textarea.d.ts.map +0 -1
  67. package/dist/components/Textarea.js +0 -26
  68. package/dist/components/ThemeProvider.d.ts +0 -30
  69. package/dist/components/ThemeProvider.d.ts.map +0 -1
  70. package/dist/components/Timeline.d.ts +0 -26
  71. package/dist/components/Timeline.d.ts.map +0 -1
  72. package/dist/components/ToggleSwitch.d.ts +0 -6
  73. package/dist/components/ToggleSwitch.d.ts.map +0 -1
  74. package/dist/components/Token.d.ts +0 -8
  75. package/dist/components/Token.d.ts.map +0 -1
  76. package/dist/components/Tooltip.d.ts +0 -7
  77. package/dist/components/Tooltip.d.ts.map +0 -1
  78. package/dist/components/Truncate.d.ts +0 -7
  79. package/dist/components/Truncate.d.ts.map +0 -1
  80. package/dist/components/UnderlineNav.d.ts +0 -11
  81. package/dist/components/UnderlineNav.d.ts.map +0 -1
  82. package/dist/components/deprecated/ActionList.d.ts +0 -23
  83. package/dist/components/deprecated/ActionList.d.ts.map +0 -1
  84. package/dist/components/deprecated/DialogV1.d.ts +0 -11
  85. package/dist/components/deprecated/DialogV1.d.ts.map +0 -1
  86. package/dist/components/deprecated/Octicon.d.ts +0 -17
  87. package/dist/components/deprecated/Octicon.d.ts.map +0 -1
  88. package/dist/components/deprecated/TabNav.d.ts +0 -9
  89. package/dist/components/deprecated/TabNav.d.ts.map +0 -1
  90. package/dist/components/deprecated/Tooltip.d.ts +0 -13
  91. package/dist/components/deprecated/Tooltip.d.ts.map +0 -1
  92. package/dist/deprecated.d.ts +0 -76
  93. package/dist/deprecated.d.ts.map +0 -1
  94. package/dist/experimental.d.ts +0 -100
  95. package/dist/experimental.d.ts.map +0 -1
  96. package/dist/index.d.ts +0 -461
  97. package/dist/index.d.ts.map +0 -1
  98. package/dist/polymorphic.d.ts +0 -39
  99. package/dist/polymorphic.d.ts.map +0 -1
  100. package/dist/styled-props.d.ts +0 -4
  101. package/dist/styled-props.d.ts.map +0 -1
  102. package/dist/sx.d.ts +0 -26
  103. package/dist/sx.d.ts.map +0 -1
  104. package/dist/theme-get.d.ts +0 -2
  105. package/dist/theme-get.d.ts.map +0 -1
  106. /package/dist/{components → packages/styled-react/src/components}/ActionList.js +0 -0
  107. /package/dist/{components → packages/styled-react/src/components}/ActionMenu.js +0 -0
  108. /package/dist/{components → packages/styled-react/src/components}/Box.js +0 -0
  109. /package/dist/{components → packages/styled-react/src/components}/Breadcrumbs.js +0 -0
  110. /package/dist/{components → packages/styled-react/src/components}/Button.js +0 -0
  111. /package/dist/{components → packages/styled-react/src/components}/CounterLabel.js +0 -0
  112. /package/dist/{components → packages/styled-react/src/components}/DataTable.js +0 -0
  113. /package/dist/{components → packages/styled-react/src/components}/Dialog.js +0 -0
  114. /package/dist/{components → packages/styled-react/src/components}/Flash.js +0 -0
  115. /package/dist/{components → packages/styled-react/src/components}/FormControl.js +0 -0
  116. /package/dist/{components → packages/styled-react/src/components}/Header.js +0 -0
  117. /package/dist/{components → packages/styled-react/src/components}/Heading.js +0 -0
  118. /package/dist/{components → packages/styled-react/src/components}/IconButton.js +0 -0
  119. /package/dist/{components → packages/styled-react/src/components}/Label.js +0 -0
  120. /package/dist/{components → packages/styled-react/src/components}/Link.js +0 -0
  121. /package/dist/{components → packages/styled-react/src/components}/LinkButton.js +0 -0
  122. /package/dist/{components → packages/styled-react/src/components}/Overlay.js +0 -0
  123. /package/dist/{components → packages/styled-react/src/components}/PageHeader.js +0 -0
  124. /package/dist/{components → packages/styled-react/src/components}/SegmentedControl.js +0 -0
  125. /package/dist/{components → packages/styled-react/src/components}/Spinner.js +0 -0
  126. /package/dist/{components → packages/styled-react/src/components}/Text.js +0 -0
  127. /package/dist/{components → packages/styled-react/src/components}/TextInput.js +0 -0
  128. /package/dist/{components → packages/styled-react/src/components}/Timeline.js +0 -0
  129. /package/dist/{components → packages/styled-react/src/components}/ToggleSwitch.js +0 -0
  130. /package/dist/{components → packages/styled-react/src/components}/Token.js +0 -0
  131. /package/dist/{components → packages/styled-react/src/components}/Tooltip.js +0 -0
  132. /package/dist/{components → packages/styled-react/src/components}/Truncate.js +0 -0
  133. /package/dist/{components → packages/styled-react/src/components}/UnderlineNav.js +0 -0
  134. /package/dist/{components → packages/styled-react/src/components}/deprecated/ActionList.js +0 -0
  135. /package/dist/{components → packages/styled-react/src/components}/deprecated/DialogV1.js +0 -0
  136. /package/dist/{components → packages/styled-react/src/components}/deprecated/Octicon.js +0 -0
  137. /package/dist/{components → packages/styled-react/src/components}/deprecated/TabNav.js +0 -0
  138. /package/dist/{components → packages/styled-react/src/components}/deprecated/Tooltip.js +0 -0
  139. /package/dist/{deprecated.js → packages/styled-react/src/deprecated.js} +0 -0
  140. /package/dist/{experimental.js → packages/styled-react/src/experimental.js} +0 -0
  141. /package/dist/{theme-get.js → packages/styled-react/src/theme-get.js} +0 -0
@@ -0,0 +1,5 @@
1
+ function getDefaultExportFromCjs (x) {
2
+ return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
3
+ }
4
+
5
+ export { getDefaultExportFromCjs };
@@ -0,0 +1,7 @@
1
+ import { getDefaultExportFromCjs } from './_commonjsHelpers.js';
2
+ import { __require as requireCjs } from '../node_modules/deepmerge/dist/cjs.js';
3
+
4
+ var cjsExports = requireCjs();
5
+ var deepmerge = /*@__PURE__*/getDefaultExportFromCjs(cjsExports);
6
+
7
+ export { deepmerge as default };
@@ -0,0 +1,3 @@
1
+ import { __require as requireFocusVisible } from '../node_modules/focus-visible/dist/focus-visible.js';
2
+
3
+ requireFocusVisible();
@@ -0,0 +1,3 @@
1
+ var focusVisible = {exports: {}};
2
+
3
+ export { focusVisible as __module };
@@ -2,7 +2,6 @@
2
2
  "components": [
3
3
  "ActionList",
4
4
  "ActionMenu",
5
- "Avatar",
6
5
  "BaseStyles",
7
6
  "Box",
8
7
  "Breadcrumb",
@@ -26,7 +25,6 @@
26
25
  "Table",
27
26
  "TabNav",
28
27
  "Text",
29
- "Textarea",
30
28
  "TextInput",
31
29
  "ThemeProvider",
32
30
  "Timeline",
@@ -45,7 +43,6 @@
45
43
  "ActionListProps",
46
44
  "ActionListTrailingActionProps",
47
45
  "ActionListTrailingVisualProps",
48
- "AvatarProps",
49
46
  "BaseStylesProps",
50
47
  "BetterSystemStyleObject",
51
48
  "BoxProps",
@@ -82,7 +79,6 @@
82
79
  "TableTitleProps",
83
80
  "TabNavLinkProps",
84
81
  "TabNavProps",
85
- "TextareaProps",
86
82
  "TextInputActionProps",
87
83
  "TextInputProps",
88
84
  "TextProps",
@@ -0,0 +1,3 @@
1
+ function r(e){var t,f,n="";if("string"==typeof e||"number"==typeof e)n+=e;else if("object"==typeof e)if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(f=r(e[t]))&&(n&&(n+=" "),n+=f);}else for(f in e)e[f]&&(n&&(n+=" "),n+=f);return n}function clsx(){for(var e,t,f=0,n="",o=arguments.length;f<o;f++)(e=arguments[f])&&(t=r(e))&&(n&&(n+=" "),n+=t);return n}
2
+
3
+ export { clsx };
@@ -0,0 +1,142 @@
1
+ var cjs;
2
+ var hasRequiredCjs;
3
+
4
+ function requireCjs () {
5
+ if (hasRequiredCjs) return cjs;
6
+ hasRequiredCjs = 1;
7
+
8
+ var isMergeableObject = function isMergeableObject(value) {
9
+ return isNonNullObject(value)
10
+ && !isSpecial(value)
11
+ };
12
+
13
+ function isNonNullObject(value) {
14
+ return !!value && typeof value === 'object'
15
+ }
16
+
17
+ function isSpecial(value) {
18
+ var stringValue = Object.prototype.toString.call(value);
19
+
20
+ return stringValue === '[object RegExp]'
21
+ || stringValue === '[object Date]'
22
+ || isReactElement(value)
23
+ }
24
+
25
+ // see https://github.com/facebook/react/blob/b5ac963fb791d1298e7f396236383bc955f916c1/src/isomorphic/classic/element/ReactElement.js#L21-L25
26
+ var canUseSymbol = typeof Symbol === 'function' && Symbol.for;
27
+ var REACT_ELEMENT_TYPE = canUseSymbol ? Symbol.for('react.element') : 0xeac7;
28
+
29
+ function isReactElement(value) {
30
+ return value.$$typeof === REACT_ELEMENT_TYPE
31
+ }
32
+
33
+ function emptyTarget(val) {
34
+ return Array.isArray(val) ? [] : {}
35
+ }
36
+
37
+ function cloneUnlessOtherwiseSpecified(value, options) {
38
+ return (options.clone !== false && options.isMergeableObject(value))
39
+ ? deepmerge(emptyTarget(value), value, options)
40
+ : value
41
+ }
42
+
43
+ function defaultArrayMerge(target, source, options) {
44
+ return target.concat(source).map(function(element) {
45
+ return cloneUnlessOtherwiseSpecified(element, options)
46
+ })
47
+ }
48
+
49
+ function getMergeFunction(key, options) {
50
+ if (!options.customMerge) {
51
+ return deepmerge
52
+ }
53
+ var customMerge = options.customMerge(key);
54
+ return typeof customMerge === 'function' ? customMerge : deepmerge
55
+ }
56
+
57
+ function getEnumerableOwnPropertySymbols(target) {
58
+ return Object.getOwnPropertySymbols
59
+ ? Object.getOwnPropertySymbols(target).filter(function(symbol) {
60
+ return Object.propertyIsEnumerable.call(target, symbol)
61
+ })
62
+ : []
63
+ }
64
+
65
+ function getKeys(target) {
66
+ return Object.keys(target).concat(getEnumerableOwnPropertySymbols(target))
67
+ }
68
+
69
+ function propertyIsOnObject(object, property) {
70
+ try {
71
+ return property in object
72
+ } catch(_) {
73
+ return false
74
+ }
75
+ }
76
+
77
+ // Protects from prototype poisoning and unexpected merging up the prototype chain.
78
+ function propertyIsUnsafe(target, key) {
79
+ return propertyIsOnObject(target, key) // Properties are safe to merge if they don't exist in the target yet,
80
+ && !(Object.hasOwnProperty.call(target, key) // unsafe if they exist up the prototype chain,
81
+ && Object.propertyIsEnumerable.call(target, key)) // and also unsafe if they're nonenumerable.
82
+ }
83
+
84
+ function mergeObject(target, source, options) {
85
+ var destination = {};
86
+ if (options.isMergeableObject(target)) {
87
+ getKeys(target).forEach(function(key) {
88
+ destination[key] = cloneUnlessOtherwiseSpecified(target[key], options);
89
+ });
90
+ }
91
+ getKeys(source).forEach(function(key) {
92
+ if (propertyIsUnsafe(target, key)) {
93
+ return
94
+ }
95
+
96
+ if (propertyIsOnObject(target, key) && options.isMergeableObject(source[key])) {
97
+ destination[key] = getMergeFunction(key, options)(target[key], source[key], options);
98
+ } else {
99
+ destination[key] = cloneUnlessOtherwiseSpecified(source[key], options);
100
+ }
101
+ });
102
+ return destination
103
+ }
104
+
105
+ function deepmerge(target, source, options) {
106
+ options = options || {};
107
+ options.arrayMerge = options.arrayMerge || defaultArrayMerge;
108
+ options.isMergeableObject = options.isMergeableObject || isMergeableObject;
109
+ // cloneUnlessOtherwiseSpecified is added to `options` so that custom arrayMerge()
110
+ // implementations can use it. The caller may not replace it.
111
+ options.cloneUnlessOtherwiseSpecified = cloneUnlessOtherwiseSpecified;
112
+
113
+ var sourceIsArray = Array.isArray(source);
114
+ var targetIsArray = Array.isArray(target);
115
+ var sourceAndTargetTypesMatch = sourceIsArray === targetIsArray;
116
+
117
+ if (!sourceAndTargetTypesMatch) {
118
+ return cloneUnlessOtherwiseSpecified(source, options)
119
+ } else if (sourceIsArray) {
120
+ return options.arrayMerge(target, source, options)
121
+ } else {
122
+ return mergeObject(target, source, options)
123
+ }
124
+ }
125
+
126
+ deepmerge.all = function deepmergeAll(array, options) {
127
+ if (!Array.isArray(array)) {
128
+ throw new Error('first argument should be an array')
129
+ }
130
+
131
+ return array.reduce(function(prev, next) {
132
+ return deepmerge(prev, next, options)
133
+ }, {})
134
+ };
135
+
136
+ var deepmerge_1 = deepmerge;
137
+
138
+ cjs = deepmerge_1;
139
+ return cjs;
140
+ }
141
+
142
+ export { requireCjs as __require };
@@ -0,0 +1,324 @@
1
+ import { __module as focusVisible$1 } from '../../../_virtual/focus-visible2.js';
2
+
3
+ var focusVisible = focusVisible$1.exports;
4
+
5
+ var hasRequiredFocusVisible;
6
+
7
+ function requireFocusVisible () {
8
+ if (hasRequiredFocusVisible) return focusVisible$1.exports;
9
+ hasRequiredFocusVisible = 1;
10
+ (function (module, exports$1) {
11
+ (function (global, factory) {
12
+ factory() ;
13
+ }(focusVisible, (function () {
14
+ /**
15
+ * Applies the :focus-visible polyfill at the given scope.
16
+ * A scope in this case is either the top-level Document or a Shadow Root.
17
+ *
18
+ * @param {(Document|ShadowRoot)} scope
19
+ * @see https://github.com/WICG/focus-visible
20
+ */
21
+ function applyFocusVisiblePolyfill(scope) {
22
+ var hadKeyboardEvent = true;
23
+ var hadFocusVisibleRecently = false;
24
+ var hadFocusVisibleRecentlyTimeout = null;
25
+
26
+ var inputTypesAllowlist = {
27
+ text: true,
28
+ search: true,
29
+ url: true,
30
+ tel: true,
31
+ email: true,
32
+ password: true,
33
+ number: true,
34
+ date: true,
35
+ month: true,
36
+ week: true,
37
+ time: true,
38
+ datetime: true,
39
+ 'datetime-local': true
40
+ };
41
+
42
+ /**
43
+ * Helper function for legacy browsers and iframes which sometimes focus
44
+ * elements like document, body, and non-interactive SVG.
45
+ * @param {Element} el
46
+ */
47
+ function isValidFocusTarget(el) {
48
+ if (
49
+ el &&
50
+ el !== document &&
51
+ el.nodeName !== 'HTML' &&
52
+ el.nodeName !== 'BODY' &&
53
+ 'classList' in el &&
54
+ 'contains' in el.classList
55
+ ) {
56
+ return true;
57
+ }
58
+ return false;
59
+ }
60
+
61
+ /**
62
+ * Computes whether the given element should automatically trigger the
63
+ * `focus-visible` class being added, i.e. whether it should always match
64
+ * `:focus-visible` when focused.
65
+ * @param {Element} el
66
+ * @return {boolean}
67
+ */
68
+ function focusTriggersKeyboardModality(el) {
69
+ var type = el.type;
70
+ var tagName = el.tagName;
71
+
72
+ if (tagName === 'INPUT' && inputTypesAllowlist[type] && !el.readOnly) {
73
+ return true;
74
+ }
75
+
76
+ if (tagName === 'TEXTAREA' && !el.readOnly) {
77
+ return true;
78
+ }
79
+
80
+ if (el.isContentEditable) {
81
+ return true;
82
+ }
83
+
84
+ return false;
85
+ }
86
+
87
+ /**
88
+ * Add the `focus-visible` class to the given element if it was not added by
89
+ * the author.
90
+ * @param {Element} el
91
+ */
92
+ function addFocusVisibleClass(el) {
93
+ if (el.classList.contains('focus-visible')) {
94
+ return;
95
+ }
96
+ el.classList.add('focus-visible');
97
+ el.setAttribute('data-focus-visible-added', '');
98
+ }
99
+
100
+ /**
101
+ * Remove the `focus-visible` class from the given element if it was not
102
+ * originally added by the author.
103
+ * @param {Element} el
104
+ */
105
+ function removeFocusVisibleClass(el) {
106
+ if (!el.hasAttribute('data-focus-visible-added')) {
107
+ return;
108
+ }
109
+ el.classList.remove('focus-visible');
110
+ el.removeAttribute('data-focus-visible-added');
111
+ }
112
+
113
+ /**
114
+ * If the most recent user interaction was via the keyboard;
115
+ * and the key press did not include a meta, alt/option, or control key;
116
+ * then the modality is keyboard. Otherwise, the modality is not keyboard.
117
+ * Apply `focus-visible` to any current active element and keep track
118
+ * of our keyboard modality state with `hadKeyboardEvent`.
119
+ * @param {KeyboardEvent} e
120
+ */
121
+ function onKeyDown(e) {
122
+ if (e.metaKey || e.altKey || e.ctrlKey) {
123
+ return;
124
+ }
125
+
126
+ if (isValidFocusTarget(scope.activeElement)) {
127
+ addFocusVisibleClass(scope.activeElement);
128
+ }
129
+
130
+ hadKeyboardEvent = true;
131
+ }
132
+
133
+ /**
134
+ * If at any point a user clicks with a pointing device, ensure that we change
135
+ * the modality away from keyboard.
136
+ * This avoids the situation where a user presses a key on an already focused
137
+ * element, and then clicks on a different element, focusing it with a
138
+ * pointing device, while we still think we're in keyboard modality.
139
+ * @param {Event} e
140
+ */
141
+ function onPointerDown(e) {
142
+ hadKeyboardEvent = false;
143
+ }
144
+
145
+ /**
146
+ * On `focus`, add the `focus-visible` class to the target if:
147
+ * - the target received focus as a result of keyboard navigation, or
148
+ * - the event target is an element that will likely require interaction
149
+ * via the keyboard (e.g. a text box)
150
+ * @param {Event} e
151
+ */
152
+ function onFocus(e) {
153
+ // Prevent IE from focusing the document or HTML element.
154
+ if (!isValidFocusTarget(e.target)) {
155
+ return;
156
+ }
157
+
158
+ if (hadKeyboardEvent || focusTriggersKeyboardModality(e.target)) {
159
+ addFocusVisibleClass(e.target);
160
+ }
161
+ }
162
+
163
+ /**
164
+ * On `blur`, remove the `focus-visible` class from the target.
165
+ * @param {Event} e
166
+ */
167
+ function onBlur(e) {
168
+ if (!isValidFocusTarget(e.target)) {
169
+ return;
170
+ }
171
+
172
+ if (
173
+ e.target.classList.contains('focus-visible') ||
174
+ e.target.hasAttribute('data-focus-visible-added')
175
+ ) {
176
+ // To detect a tab/window switch, we look for a blur event followed
177
+ // rapidly by a visibility change.
178
+ // If we don't see a visibility change within 100ms, it's probably a
179
+ // regular focus change.
180
+ hadFocusVisibleRecently = true;
181
+ window.clearTimeout(hadFocusVisibleRecentlyTimeout);
182
+ hadFocusVisibleRecentlyTimeout = window.setTimeout(function() {
183
+ hadFocusVisibleRecently = false;
184
+ }, 100);
185
+ removeFocusVisibleClass(e.target);
186
+ }
187
+ }
188
+
189
+ /**
190
+ * If the user changes tabs, keep track of whether or not the previously
191
+ * focused element had .focus-visible.
192
+ * @param {Event} e
193
+ */
194
+ function onVisibilityChange(e) {
195
+ if (document.visibilityState === 'hidden') {
196
+ // If the tab becomes active again, the browser will handle calling focus
197
+ // on the element (Safari actually calls it twice).
198
+ // If this tab change caused a blur on an element with focus-visible,
199
+ // re-apply the class when the user switches back to the tab.
200
+ if (hadFocusVisibleRecently) {
201
+ hadKeyboardEvent = true;
202
+ }
203
+ addInitialPointerMoveListeners();
204
+ }
205
+ }
206
+
207
+ /**
208
+ * Add a group of listeners to detect usage of any pointing devices.
209
+ * These listeners will be added when the polyfill first loads, and anytime
210
+ * the window is blurred, so that they are active when the window regains
211
+ * focus.
212
+ */
213
+ function addInitialPointerMoveListeners() {
214
+ document.addEventListener('mousemove', onInitialPointerMove);
215
+ document.addEventListener('mousedown', onInitialPointerMove);
216
+ document.addEventListener('mouseup', onInitialPointerMove);
217
+ document.addEventListener('pointermove', onInitialPointerMove);
218
+ document.addEventListener('pointerdown', onInitialPointerMove);
219
+ document.addEventListener('pointerup', onInitialPointerMove);
220
+ document.addEventListener('touchmove', onInitialPointerMove);
221
+ document.addEventListener('touchstart', onInitialPointerMove);
222
+ document.addEventListener('touchend', onInitialPointerMove);
223
+ }
224
+
225
+ function removeInitialPointerMoveListeners() {
226
+ document.removeEventListener('mousemove', onInitialPointerMove);
227
+ document.removeEventListener('mousedown', onInitialPointerMove);
228
+ document.removeEventListener('mouseup', onInitialPointerMove);
229
+ document.removeEventListener('pointermove', onInitialPointerMove);
230
+ document.removeEventListener('pointerdown', onInitialPointerMove);
231
+ document.removeEventListener('pointerup', onInitialPointerMove);
232
+ document.removeEventListener('touchmove', onInitialPointerMove);
233
+ document.removeEventListener('touchstart', onInitialPointerMove);
234
+ document.removeEventListener('touchend', onInitialPointerMove);
235
+ }
236
+
237
+ /**
238
+ * When the polfyill first loads, assume the user is in keyboard modality.
239
+ * If any event is received from a pointing device (e.g. mouse, pointer,
240
+ * touch), turn off keyboard modality.
241
+ * This accounts for situations where focus enters the page from the URL bar.
242
+ * @param {Event} e
243
+ */
244
+ function onInitialPointerMove(e) {
245
+ // Work around a Safari quirk that fires a mousemove on <html> whenever the
246
+ // window blurs, even if you're tabbing out of the page. ¯\_(ツ)_/¯
247
+ if (e.target.nodeName && e.target.nodeName.toLowerCase() === 'html') {
248
+ return;
249
+ }
250
+
251
+ hadKeyboardEvent = false;
252
+ removeInitialPointerMoveListeners();
253
+ }
254
+
255
+ // For some kinds of state, we are interested in changes at the global scope
256
+ // only. For example, global pointer input, global key presses and global
257
+ // visibility change should affect the state at every scope:
258
+ document.addEventListener('keydown', onKeyDown, true);
259
+ document.addEventListener('mousedown', onPointerDown, true);
260
+ document.addEventListener('pointerdown', onPointerDown, true);
261
+ document.addEventListener('touchstart', onPointerDown, true);
262
+ document.addEventListener('visibilitychange', onVisibilityChange, true);
263
+
264
+ addInitialPointerMoveListeners();
265
+
266
+ // For focus and blur, we specifically care about state changes in the local
267
+ // scope. This is because focus / blur events that originate from within a
268
+ // shadow root are not re-dispatched from the host element if it was already
269
+ // the active element in its own scope:
270
+ scope.addEventListener('focus', onFocus, true);
271
+ scope.addEventListener('blur', onBlur, true);
272
+
273
+ // We detect that a node is a ShadowRoot by ensuring that it is a
274
+ // DocumentFragment and also has a host property. This check covers native
275
+ // implementation and polyfill implementation transparently. If we only cared
276
+ // about the native implementation, we could just check if the scope was
277
+ // an instance of a ShadowRoot.
278
+ if (scope.nodeType === Node.DOCUMENT_FRAGMENT_NODE && scope.host) {
279
+ // Since a ShadowRoot is a special kind of DocumentFragment, it does not
280
+ // have a root element to add a class to. So, we add this attribute to the
281
+ // host element instead:
282
+ scope.host.setAttribute('data-js-focus-visible', '');
283
+ } else if (scope.nodeType === Node.DOCUMENT_NODE) {
284
+ document.documentElement.classList.add('js-focus-visible');
285
+ document.documentElement.setAttribute('data-js-focus-visible', '');
286
+ }
287
+ }
288
+
289
+ // It is important to wrap all references to global window and document in
290
+ // these checks to support server-side rendering use cases
291
+ // @see https://github.com/WICG/focus-visible/issues/199
292
+ if (typeof window !== 'undefined' && typeof document !== 'undefined') {
293
+ // Make the polyfill helper globally available. This can be used as a signal
294
+ // to interested libraries that wish to coordinate with the polyfill for e.g.,
295
+ // applying the polyfill to a shadow root:
296
+ window.applyFocusVisiblePolyfill = applyFocusVisiblePolyfill;
297
+
298
+ // Notify interested libraries of the polyfill's presence, in case the
299
+ // polyfill was loaded lazily:
300
+ var event;
301
+
302
+ try {
303
+ event = new CustomEvent('focus-visible-polyfill-ready');
304
+ } catch (error) {
305
+ // IE11 does not support using CustomEvent as a constructor directly:
306
+ event = document.createEvent('CustomEvent');
307
+ event.initCustomEvent('focus-visible-polyfill-ready', false, false, {});
308
+ }
309
+
310
+ window.dispatchEvent(event);
311
+ }
312
+
313
+ if (typeof document !== 'undefined') {
314
+ // Apply the polyfill to the global document, so that no JavaScript
315
+ // coordination is required to use the polyfill in the top-level document:
316
+ applyFocusVisiblePolyfill(document);
317
+ }
318
+
319
+ })));
320
+ } ());
321
+ return focusVisible$1.exports;
322
+ }
323
+
324
+ export { requireFocusVisible as __require };
@@ -1,6 +1,6 @@
1
- import { clsx } from 'clsx';
1
+ import { clsx } from '../../../../node_modules/clsx/dist/clsx.js';
2
2
  import { useTheme } from './ThemeProvider.js';
3
- import 'focus-visible';
3
+ import '../../../../_virtual/focus-visible.js';
4
4
  import { createGlobalStyle } from 'styled-components';
5
5
  import { jsxs, jsx } from 'react/jsx-runtime';
6
6