@enigmax/primitives 0.19.0 → 0.19.1
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.
- package/dist/{chunk-AU3H5WIY.js → chunk-T4F3BWR5.js} +1 -1
- package/dist/{chunk-XNNQRA35.js → chunk-XPKWJD5O.js} +2 -1
- package/dist/{flags-BBJc9unY.d.ts → flags-fLwIl2hG.d.ts} +6 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/next/index.d.ts +1 -1
- package/dist/next/index.js +2 -2
- package/dist/react/flag.d.ts +1 -1
- package/dist/react/flag.js +2 -2
- package/dist/react/index.d.ts +1 -1
- package/dist/react/index.js +2 -2
- package/dist/react-router/index.d.ts +1 -1
- package/dist/react-router/index.js +2 -2
- package/package.json +1 -1
- package/src/core/flags.ts +7 -1
- package/src/react/flag.tsx +3 -0
|
@@ -100,7 +100,7 @@ function flagAttributes(code, options = {}) {
|
|
|
100
100
|
"data-enigma-flag": "",
|
|
101
101
|
"data-flag-code": view.code,
|
|
102
102
|
"data-flag-shape": view.shape,
|
|
103
|
-
...label ? {} : { "aria-hidden": "true" }
|
|
103
|
+
...label ? { title: label } : { "aria-hidden": "true" }
|
|
104
104
|
};
|
|
105
105
|
}
|
|
106
106
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { flagView } from './chunk-
|
|
1
|
+
import { flagView } from './chunk-T4F3BWR5.js';
|
|
2
2
|
import { jsx } from 'react/jsx-runtime';
|
|
3
3
|
|
|
4
4
|
function Flag({ code, label, decorative = false, locale, shape, format, source, basePath, size, fallback = null, ...rest }) {
|
|
@@ -14,6 +14,7 @@ function Flag({ code, label, decorative = false, locale, shape, format, source,
|
|
|
14
14
|
{
|
|
15
15
|
src: view.src,
|
|
16
16
|
alt: name,
|
|
17
|
+
title: name || void 0,
|
|
17
18
|
width: view.width,
|
|
18
19
|
height: view.height,
|
|
19
20
|
loading: "lazy",
|
|
@@ -127,6 +127,12 @@ interface FlagAttributeOptions extends FlagOptions {
|
|
|
127
127
|
* `Intl.DisplayNames`. `label` replaces it and `decorative` drops it. Nothing is ever
|
|
128
128
|
* invented - a subdivision the platform cannot name, or a runtime without `Intl`, renders
|
|
129
129
|
* as decoration rather than putting a bare "ES" into a screen reader.
|
|
130
|
+
*
|
|
131
|
+
* The name goes on `title` as well as `alt`, because those two do different jobs and only
|
|
132
|
+
* one of them is visible: `alt` is what a screen reader reads and what shows when the image
|
|
133
|
+
* fails, while a POINTER tooltip comes from `title` and from nothing else. A flag with a
|
|
134
|
+
* name nobody can see on hover is the common complaint, and it is not an accessibility
|
|
135
|
+
* nicety - the flag is often the only thing in a cell. A decorative flag gets neither.
|
|
130
136
|
*/
|
|
131
137
|
declare function flagAttributes(code: string | null | undefined, options?: FlagAttributeOptions): Record<string, string | number> | null;
|
|
132
138
|
|
package/dist/index.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ export { E as EstimateOptions, G as GeneratePasswordOptions, P as PasswordAlphab
|
|
|
6
6
|
export { N as Notification, a as NotificationAction, b as NotificationInput, c as NotificationTone, d as Notifications, e as NotificationsOptions, P as PromiseMessages, f as createNotifications } from './notifications-BpVV6sel.js';
|
|
7
7
|
export { N as NetworkMonitor, a as NetworkState, S as SERVER_NETWORK_STATE, c as createNetworkMonitor } from './network-D2LsBG_k.js';
|
|
8
8
|
export { R as RelativeTimeFormat, a as RelativeTimeOptions, b as RelativeTimePrecision, c as RelativeTimeStyle, d as RelativeTimeTense, e as RelativeTimeView, f as ensureZone, n as normalizeDate, p as parseDuration, r as relativeTimeAttributes, g as relativeTimeView } from './relative-time-YpRTG7YH.js';
|
|
9
|
-
export { F as FLAG_CDN, a as FLAG_RATIO, b as FlagConfig, c as FlagFormat, d as FlagOptions, e as FlagShape, f as FlagSource, g as FlagView, h as configureFlags, i as flagAttributes, j as flagConfig, k as flagName, l as flagSrc, m as flagView, n as normalizeFlagCode, r as resetFlagConfig } from './flags-
|
|
9
|
+
export { F as FLAG_CDN, a as FLAG_RATIO, b as FlagConfig, c as FlagFormat, d as FlagOptions, e as FlagShape, f as FlagSource, g as FlagView, h as configureFlags, i as flagAttributes, j as flagConfig, k as flagName, l as flagSrc, m as flagView, n as normalizeFlagCode, r as resetFlagConfig } from './flags-fLwIl2hG.js';
|
|
10
10
|
export { P as PaletteKey, a as PositionedRow, R as RecentEntry, b as RecentStore, c as RecentStoreOptions, d as RowGroup, e as createRecentStore, g as groupRows, i as isPaletteShortcut, m as moveActive, r as recentKey, s as shortcutLabel } from './palette-D7iuQh_T.js';
|
|
11
11
|
|
|
12
12
|
/**
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { createInput } from './chunk-KJINGUQN.js';
|
|
2
2
|
export { estimatePasswordStrength, generatePassword } from './chunk-HC2ME5PU.js';
|
|
3
|
-
export { FLAG_CDN, FLAG_RATIO, configureFlags, flagAttributes, flagConfig, flagName, flagSrc, flagView, normalizeFlagCode, resetFlagConfig } from './chunk-
|
|
3
|
+
export { FLAG_CDN, FLAG_RATIO, configureFlags, flagAttributes, flagConfig, flagName, flagSrc, flagView, normalizeFlagCode, resetFlagConfig } from './chunk-T4F3BWR5.js';
|
|
4
4
|
export { createMarquee } from './chunk-UOSSNUSC.js';
|
|
5
5
|
export { SERVER_NETWORK_STATE, createNetworkMonitor } from './chunk-2QFTRNAZ.js';
|
|
6
6
|
export { createNotifications } from './chunk-SNYUBXWQ.js';
|
package/dist/next/index.d.ts
CHANGED
|
@@ -18,7 +18,7 @@ export { RelativeTime, RelativeTimeProps } from '../react/relative-time.js';
|
|
|
18
18
|
export { R as RelativeTimeFormat, a as RelativeTimeOptions, b as RelativeTimePrecision, c as RelativeTimeStyle, d as RelativeTimeTense } from '../relative-time-YpRTG7YH.js';
|
|
19
19
|
export { N as Notification, a as NotificationAction, b as NotificationInput, c as NotificationTone, e as NotificationsOptions } from '../notifications-BpVV6sel.js';
|
|
20
20
|
export { Flag, FlagProps } from '../react/flag.js';
|
|
21
|
-
export { c as FlagFormat, d as FlagOptions, e as FlagShape, f as FlagSource, h as configureFlags, i as flagAttributes, k as flagName, l as flagSrc, m as flagView, n as normalizeFlagCode } from '../flags-
|
|
21
|
+
export { c as FlagFormat, d as FlagOptions, e as FlagShape, f as FlagSource, h as configureFlags, i as flagAttributes, k as flagName, l as flagSrc, m as flagView, n as normalizeFlagCode } from '../flags-fLwIl2hG.js';
|
|
22
22
|
export { PaletteContent, PaletteContextValue, PaletteField, PaletteFooter, PaletteItem, PaletteList, PaletteListProps, PaletteRoot, PaletteRootProps, PaletteRow, PaletteSection, PaletteTrigger, SearchPalette, SearchPaletteProps, usePaletteContext } from '../react/palette.js';
|
|
23
23
|
export { R as RecentEntry, b as RecentStore, e as createRecentStore, g as groupRows, i as isPaletteShortcut, m as moveActive, r as recentKey, s as shortcutLabel } from '../palette-D7iuQh_T.js';
|
|
24
24
|
|
package/dist/next/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
export { useInput } from '../chunk-U3V4EHOB.js';
|
|
3
3
|
export { PasswordStrength } from '../chunk-XQHCZAPJ.js';
|
|
4
|
-
export { Flag } from '../chunk-
|
|
4
|
+
export { Flag } from '../chunk-XPKWJD5O.js';
|
|
5
5
|
export { Toaster } from '../chunk-ZCUFYBPB.js';
|
|
6
6
|
export { useMarquee } from '../chunk-ZWR2EXHQ.js';
|
|
7
7
|
export { useSearch } from '../chunk-QQFNAKMY.js';
|
|
@@ -10,7 +10,7 @@ export { createNotificationQueue, defaultQueue, useNotifications } from '../chun
|
|
|
10
10
|
export { RelativeTime } from '../chunk-OCMI7R6H.js';
|
|
11
11
|
import '../chunk-KJINGUQN.js';
|
|
12
12
|
export { estimatePasswordStrength, generatePassword } from '../chunk-HC2ME5PU.js';
|
|
13
|
-
export { configureFlags, flagAttributes, flagName, flagSrc, flagView, normalizeFlagCode } from '../chunk-
|
|
13
|
+
export { configureFlags, flagAttributes, flagName, flagSrc, flagView, normalizeFlagCode } from '../chunk-T4F3BWR5.js';
|
|
14
14
|
import '../chunk-UOSSNUSC.js';
|
|
15
15
|
import '../chunk-2QFTRNAZ.js';
|
|
16
16
|
import '../chunk-SNYUBXWQ.js';
|
package/dist/react/flag.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ImgHTMLAttributes, ReactNode } from 'react';
|
|
2
|
-
import { e as FlagShape, c as FlagFormat, f as FlagSource } from '../flags-
|
|
2
|
+
import { e as FlagShape, c as FlagFormat, f as FlagSource } from '../flags-fLwIl2hG.js';
|
|
3
3
|
|
|
4
4
|
interface FlagProps extends Omit<ImgHTMLAttributes<HTMLImageElement>, "src" | "alt" | "width" | "height"> {
|
|
5
5
|
/** `es`, `ES`, `en-GB`, `gb-eng`, or the emoji flag you are replacing. */
|
package/dist/react/flag.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
export { Flag } from '../chunk-
|
|
3
|
-
import '../chunk-
|
|
2
|
+
export { Flag } from '../chunk-XPKWJD5O.js';
|
|
3
|
+
import '../chunk-T4F3BWR5.js';
|
package/dist/react/index.d.ts
CHANGED
|
@@ -20,7 +20,7 @@ export { RelativeTime, RelativeTimeProps } from './relative-time.js';
|
|
|
20
20
|
export { R as RelativeTimeFormat, a as RelativeTimeOptions, b as RelativeTimePrecision, c as RelativeTimeStyle, d as RelativeTimeTense } from '../relative-time-YpRTG7YH.js';
|
|
21
21
|
export { N as Notification, a as NotificationAction, b as NotificationInput, c as NotificationTone, e as NotificationsOptions } from '../notifications-BpVV6sel.js';
|
|
22
22
|
export { Flag, FlagProps } from './flag.js';
|
|
23
|
-
export { c as FlagFormat, d as FlagOptions, e as FlagShape, f as FlagSource, h as configureFlags, i as flagAttributes, k as flagName, l as flagSrc, m as flagView, n as normalizeFlagCode } from '../flags-
|
|
23
|
+
export { c as FlagFormat, d as FlagOptions, e as FlagShape, f as FlagSource, h as configureFlags, i as flagAttributes, k as flagName, l as flagSrc, m as flagView, n as normalizeFlagCode } from '../flags-fLwIl2hG.js';
|
|
24
24
|
export { PaletteContent, PaletteContextValue, PaletteField, PaletteFooter, PaletteItem, PaletteList, PaletteListProps, PaletteRoot, PaletteRootProps, PaletteRow, PaletteSection, PaletteTrigger, SearchPalette, SearchPaletteProps, usePaletteContext } from './palette.js';
|
|
25
25
|
export { R as RecentEntry, b as RecentStore, e as createRecentStore, g as groupRows, i as isPaletteShortcut, m as moveActive, r as recentKey, s as shortcutLabel } from '../palette-D7iuQh_T.js';
|
|
26
26
|
|
package/dist/react/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
export { useInput } from '../chunk-U3V4EHOB.js';
|
|
3
3
|
export { PasswordStrength } from '../chunk-XQHCZAPJ.js';
|
|
4
|
-
export { Flag } from '../chunk-
|
|
4
|
+
export { Flag } from '../chunk-XPKWJD5O.js';
|
|
5
5
|
export { Toaster } from '../chunk-ZCUFYBPB.js';
|
|
6
6
|
export { useMarquee } from '../chunk-ZWR2EXHQ.js';
|
|
7
7
|
export { useSearch } from '../chunk-QQFNAKMY.js';
|
|
@@ -10,7 +10,7 @@ export { createNotificationQueue, defaultQueue, useNotifications } from '../chun
|
|
|
10
10
|
export { RelativeTime } from '../chunk-OCMI7R6H.js';
|
|
11
11
|
import '../chunk-KJINGUQN.js';
|
|
12
12
|
export { estimatePasswordStrength, generatePassword } from '../chunk-HC2ME5PU.js';
|
|
13
|
-
export { configureFlags, flagAttributes, flagName, flagSrc, flagView, normalizeFlagCode } from '../chunk-
|
|
13
|
+
export { configureFlags, flagAttributes, flagName, flagSrc, flagView, normalizeFlagCode } from '../chunk-T4F3BWR5.js';
|
|
14
14
|
import '../chunk-UOSSNUSC.js';
|
|
15
15
|
import '../chunk-2QFTRNAZ.js';
|
|
16
16
|
import '../chunk-SNYUBXWQ.js';
|
|
@@ -18,7 +18,7 @@ export { RelativeTime, RelativeTimeProps } from '../react/relative-time.js';
|
|
|
18
18
|
export { R as RelativeTimeFormat, a as RelativeTimeOptions, b as RelativeTimePrecision, c as RelativeTimeStyle, d as RelativeTimeTense } from '../relative-time-YpRTG7YH.js';
|
|
19
19
|
export { N as Notification, a as NotificationAction, b as NotificationInput, c as NotificationTone, e as NotificationsOptions } from '../notifications-BpVV6sel.js';
|
|
20
20
|
export { Flag, FlagProps } from '../react/flag.js';
|
|
21
|
-
export { c as FlagFormat, d as FlagOptions, e as FlagShape, f as FlagSource, h as configureFlags, i as flagAttributes, k as flagName, l as flagSrc, m as flagView, n as normalizeFlagCode } from '../flags-
|
|
21
|
+
export { c as FlagFormat, d as FlagOptions, e as FlagShape, f as FlagSource, h as configureFlags, i as flagAttributes, k as flagName, l as flagSrc, m as flagView, n as normalizeFlagCode } from '../flags-fLwIl2hG.js';
|
|
22
22
|
export { PaletteContent, PaletteContextValue, PaletteField, PaletteFooter, PaletteItem, PaletteList, PaletteListProps, PaletteRoot, PaletteRootProps, PaletteRow, PaletteSection, PaletteTrigger, SearchPalette, SearchPaletteProps, usePaletteContext } from '../react/palette.js';
|
|
23
23
|
export { R as RecentEntry, b as RecentStore, e as createRecentStore, g as groupRows, i as isPaletteShortcut, m as moveActive, r as recentKey, s as shortcutLabel } from '../palette-D7iuQh_T.js';
|
|
24
24
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
export { useInput } from '../chunk-U3V4EHOB.js';
|
|
3
3
|
export { PasswordStrength } from '../chunk-XQHCZAPJ.js';
|
|
4
|
-
export { Flag } from '../chunk-
|
|
4
|
+
export { Flag } from '../chunk-XPKWJD5O.js';
|
|
5
5
|
export { Toaster } from '../chunk-ZCUFYBPB.js';
|
|
6
6
|
export { useMarquee } from '../chunk-ZWR2EXHQ.js';
|
|
7
7
|
export { useSearch } from '../chunk-QQFNAKMY.js';
|
|
@@ -10,7 +10,7 @@ export { createNotificationQueue, defaultQueue, useNotifications } from '../chun
|
|
|
10
10
|
export { RelativeTime } from '../chunk-OCMI7R6H.js';
|
|
11
11
|
import '../chunk-KJINGUQN.js';
|
|
12
12
|
export { estimatePasswordStrength, generatePassword } from '../chunk-HC2ME5PU.js';
|
|
13
|
-
export { configureFlags, flagAttributes, flagName, flagSrc, flagView, normalizeFlagCode } from '../chunk-
|
|
13
|
+
export { configureFlags, flagAttributes, flagName, flagSrc, flagView, normalizeFlagCode } from '../chunk-T4F3BWR5.js';
|
|
14
14
|
import '../chunk-UOSSNUSC.js';
|
|
15
15
|
import '../chunk-2QFTRNAZ.js';
|
|
16
16
|
import '../chunk-SNYUBXWQ.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@enigmax/primitives",
|
|
3
|
-
"version": "0.19.
|
|
3
|
+
"version": "0.19.1",
|
|
4
4
|
"description": "Headless components: the behaviour, the timing and the accessibility, with no styles of their own. Framework-agnostic core plus thin adapters.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": [
|
package/src/core/flags.ts
CHANGED
|
@@ -246,6 +246,12 @@ export interface FlagAttributeOptions extends FlagOptions {
|
|
|
246
246
|
* `Intl.DisplayNames`. `label` replaces it and `decorative` drops it. Nothing is ever
|
|
247
247
|
* invented - a subdivision the platform cannot name, or a runtime without `Intl`, renders
|
|
248
248
|
* as decoration rather than putting a bare "ES" into a screen reader.
|
|
249
|
+
*
|
|
250
|
+
* The name goes on `title` as well as `alt`, because those two do different jobs and only
|
|
251
|
+
* one of them is visible: `alt` is what a screen reader reads and what shows when the image
|
|
252
|
+
* fails, while a POINTER tooltip comes from `title` and from nothing else. A flag with a
|
|
253
|
+
* name nobody can see on hover is the common complaint, and it is not an accessibility
|
|
254
|
+
* nicety - the flag is often the only thing in a cell. A decorative flag gets neither.
|
|
249
255
|
*/
|
|
250
256
|
export function flagAttributes(code: string | null | undefined, options: FlagAttributeOptions = {}): Record<string, string | number> | null {
|
|
251
257
|
const view = flagView(code, options);
|
|
@@ -261,6 +267,6 @@ export function flagAttributes(code: string | null | undefined, options: FlagAtt
|
|
|
261
267
|
"data-enigma-flag": "",
|
|
262
268
|
"data-flag-code": view.code,
|
|
263
269
|
"data-flag-shape": view.shape,
|
|
264
|
-
...(label ? {} : { "aria-hidden": "true" })
|
|
270
|
+
...(label ? { title: label } : { "aria-hidden": "true" })
|
|
265
271
|
};
|
|
266
272
|
}
|
package/src/react/flag.tsx
CHANGED
|
@@ -52,6 +52,9 @@ export function Flag({ code, label, decorative = false, locale, shape, format, s
|
|
|
52
52
|
<img
|
|
53
53
|
src={view.src}
|
|
54
54
|
alt={name}
|
|
55
|
+
// `alt` is read; `title` is what a pointer shows. Only one of them is visible,
|
|
56
|
+
// and a flag whose name never appears on hover is the thing people report.
|
|
57
|
+
title={name || undefined}
|
|
55
58
|
width={view.width}
|
|
56
59
|
height={view.height}
|
|
57
60
|
loading="lazy"
|