@alveole/components 2.0.0-alpha.14 → 2.0.0-alpha.16

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 (77) hide show
  1. package/dist/core/AnchorHeading/AnchorHeading.d.ts +6 -2
  2. package/dist/core/AnchorHeading/AnchorHeading.d.ts.map +1 -1
  3. package/dist/core/AnchorHeading/AnchorHeading.js +1 -1
  4. package/dist/core/AnchorHeading/AnchorHeading.stories.d.ts +2 -1
  5. package/dist/core/AnchorHeading/AnchorHeading.stories.d.ts.map +1 -1
  6. package/dist/core/AnchorHeading/AnchorHeading.stories.js +1 -0
  7. package/dist/core/AnchorHeading/AnchorHeading.stories.sources.d.ts +2 -0
  8. package/dist/core/AnchorHeading/AnchorHeading.stories.sources.d.ts.map +1 -1
  9. package/dist/core/AnchorHeading/AnchorHeading.stories.sources.js +2 -0
  10. package/dist/core/AnchorHeading/AnchorHeading.web.d.ts +1 -1
  11. package/dist/core/AnchorHeading/AnchorHeading.web.d.ts.map +1 -1
  12. package/dist/core/AnchorHeading/AnchorHeading.web.js +7 -4
  13. package/dist/core/AnchorHeading/slug.d.ts +3 -0
  14. package/dist/core/AnchorHeading/slug.d.ts.map +1 -1
  15. package/dist/core/AnchorHeading/slug.js +11 -0
  16. package/dist/core/Heading/Heading.d.ts +8 -0
  17. package/dist/core/Heading/Heading.d.ts.map +1 -0
  18. package/dist/core/Heading/Heading.js +15 -0
  19. package/dist/core/Heading/Heading.stories.d.ts +13 -0
  20. package/dist/core/Heading/Heading.stories.d.ts.map +1 -0
  21. package/dist/core/Heading/Heading.stories.js +13 -0
  22. package/dist/core/Heading/Heading.stories.sources.d.ts +8 -0
  23. package/dist/core/Heading/Heading.stories.sources.d.ts.map +1 -0
  24. package/dist/core/Heading/Heading.stories.sources.js +8 -0
  25. package/dist/core/Heading/index.d.ts +2 -0
  26. package/dist/core/Heading/index.d.ts.map +1 -0
  27. package/dist/core/Heading/index.js +1 -0
  28. package/dist/core/MarkdownDescription/markdownComponents.d.ts.map +1 -1
  29. package/dist/core/MarkdownDescription/markdownComponents.js +6 -4
  30. package/dist/core/index.d.ts +1 -0
  31. package/dist/core/index.d.ts.map +1 -1
  32. package/dist/core/index.js +1 -0
  33. package/dist/generated/version.d.ts +1 -1
  34. package/dist/generated/version.js +1 -1
  35. package/dist/stories/index.d.ts +1 -0
  36. package/dist/stories/index.d.ts.map +1 -1
  37. package/dist/stories/index.js +1 -0
  38. package/dist/ui/PriceInput/PriceInput.js +1 -1
  39. package/dist/ui/PriceInput/PriceInput.stories.d.ts +17 -1
  40. package/dist/ui/PriceInput/PriceInput.stories.d.ts.map +1 -1
  41. package/dist/ui/PriceInput/PriceInput.stories.js +1 -0
  42. package/dist/ui/PriceInput/PriceInput.stories.sources.d.ts +2 -0
  43. package/dist/ui/PriceInput/PriceInput.stories.sources.d.ts.map +1 -1
  44. package/dist/ui/PriceInput/PriceInput.stories.sources.js +2 -0
  45. package/dist/ui/PriceInput/PriceInput.styles.d.ts +16 -1
  46. package/dist/ui/PriceInput/PriceInput.styles.d.ts.map +1 -1
  47. package/dist/ui/PriceInput/PriceInput.styles.js +20 -6
  48. package/dist/ui/PriceInput/PriceInput.web.d.ts +0 -1
  49. package/dist/ui/PriceInput/PriceInput.web.d.ts.map +1 -1
  50. package/dist/ui/PriceInput/PriceInput.web.js +9 -10
  51. package/dist/ui/PriceInput/cadrePrix.d.ts +17 -0
  52. package/dist/ui/PriceInput/cadrePrix.d.ts.map +1 -0
  53. package/dist/ui/PriceInput/cadrePrix.js +9 -0
  54. package/dist/ui/PriceInput/useSaisieMontant.d.ts +5 -0
  55. package/dist/ui/PriceInput/useSaisieMontant.d.ts.map +1 -0
  56. package/dist/ui/PriceInput/useSaisieMontant.js +19 -0
  57. package/dist/ui/Select/Select.stories.js +1 -1
  58. package/dist/ui/Sidebar/Sidebar.stories.js +1 -1
  59. package/dist/ui/Sidebar/Sidebar.stories.sources.d.ts.map +1 -1
  60. package/dist/ui/Sidebar/Sidebar.stories.sources.js +1 -1
  61. package/dist/ui/Sidebar/SidebarItem.d.ts +8 -2
  62. package/dist/ui/Sidebar/SidebarItem.d.ts.map +1 -1
  63. package/dist/ui/Sidebar/SidebarItem.js +5 -2
  64. package/dist/ui/Tabs/Tabs.d.ts +6 -0
  65. package/dist/ui/Tabs/Tabs.d.ts.map +1 -1
  66. package/dist/ui/Tabs/Tabs.js +2 -2
  67. package/dist/ui/Tabs/Tabs.stories.d.ts +1 -0
  68. package/dist/ui/Tabs/Tabs.stories.d.ts.map +1 -1
  69. package/dist/ui/Tabs/Tabs.stories.js +13 -1
  70. package/dist/ui/Tabs/Tabs.stories.sources.d.ts +2 -0
  71. package/dist/ui/Tabs/Tabs.stories.sources.d.ts.map +1 -1
  72. package/dist/ui/Tabs/Tabs.stories.sources.js +2 -0
  73. package/dist/ui/Tabs/useTabsState.d.ts +1 -1
  74. package/dist/ui/Tabs/useTabsState.d.ts.map +1 -1
  75. package/dist/ui/Tabs/useTabsState.js +6 -3
  76. package/package.json +2 -2
  77. package/dist/ui/PriceInput/PriceInput.css +0 -9
@@ -1,8 +1,12 @@
1
+ import type { HeadingLevel } from '../Heading';
1
2
  import type { TypographyProps } from '../Typography';
2
3
  export type AnchorHeadingProps = {
3
- children: string;
4
+ children: React.ReactNode;
4
5
  style?: TypographyProps['style'];
6
+ color?: TypographyProps['color'];
7
+ /** Sur le web, rend un `Heading` : vraie balise, taille et couleur de titre. */
8
+ as?: HeadingLevel;
5
9
  scrollMarginTop?: number;
6
10
  };
7
- export declare const AnchorHeading: ({ children, style }: AnchorHeadingProps) => import("react").JSX.Element;
11
+ export declare const AnchorHeading: ({ children, style, color }: AnchorHeadingProps) => import("react").JSX.Element;
8
12
  //# sourceMappingURL=AnchorHeading.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"AnchorHeading.d.ts","sourceRoot":"","sources":["../../../src/core/AnchorHeading/AnchorHeading.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAGrD,MAAM,MAAM,kBAAkB,GAAG;IAC/B,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,eAAe,CAAC,OAAO,CAAC,CAAC;IACjC,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B,CAAC;AAEF,eAAO,MAAM,aAAa,GAAI,qBAAqB,kBAAkB,gCAEpE,CAAC"}
1
+ {"version":3,"file":"AnchorHeading.d.ts","sourceRoot":"","sources":["../../../src/core/AnchorHeading/AnchorHeading.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC/C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAGrD,MAAM,MAAM,kBAAkB,GAAG;IAC/B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,KAAK,CAAC,EAAE,eAAe,CAAC,OAAO,CAAC,CAAC;IACjC,KAAK,CAAC,EAAE,eAAe,CAAC,OAAO,CAAC,CAAC;IACjC,gFAAgF;IAChF,EAAE,CAAC,EAAE,YAAY,CAAC;IAClB,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B,CAAC;AAEF,eAAO,MAAM,aAAa,GAAI,4BAA4B,kBAAkB,gCAI3E,CAAC"}
@@ -1,3 +1,3 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { Typography } from '../Typography';
3
- export const AnchorHeading = ({ children, style }) => (_jsx(Typography, { style: style, children: children }));
3
+ export const AnchorHeading = ({ children, style, color }) => (_jsx(Typography, { style: style, color: color, children: children }));
@@ -4,10 +4,11 @@ declare const _default: {
4
4
  experimental: true;
5
5
  webOnly: true;
6
6
  description: string;
7
- component: ({ children, style }: import("./AnchorHeading").AnchorHeadingProps) => import("react").JSX.Element;
7
+ component: ({ children, style, color }: import("./AnchorHeading").AnchorHeadingProps) => import("react").JSX.Element;
8
8
  styleFn: () => {};
9
9
  };
10
10
  export default _default;
11
11
  export declare const Default: () => import("react").JSX.Element;
12
+ export declare const AvecNiveau: () => import("react").JSX.Element;
12
13
  export * as Sources from './AnchorHeading.stories.sources';
13
14
  //# sourceMappingURL=AnchorHeading.stories.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"AnchorHeading.stories.d.ts","sourceRoot":"","sources":["../../../src/core/AnchorHeading/AnchorHeading.stories.tsx"],"names":[],"mappings":";;;;;;;;;AAIA,wBAQkB;AAElB,eAAO,MAAM,OAAO,mCAGnB,CAAC;AAEF,OAAO,KAAK,OAAO,MAAM,iCAAiC,CAAC"}
1
+ {"version":3,"file":"AnchorHeading.stories.d.ts","sourceRoot":"","sources":["../../../src/core/AnchorHeading/AnchorHeading.stories.tsx"],"names":[],"mappings":";;;;;;;;;AAIA,wBAQkB;AAElB,eAAO,MAAM,OAAO,mCAGnB,CAAC;AAEF,eAAO,MAAM,UAAU,mCAAmE,CAAC;AAE3F,OAAO,KAAK,OAAO,MAAM,iCAAiC,CAAC"}
@@ -14,4 +14,5 @@ export const Default = () => {
14
14
  const { text } = useTheme();
15
15
  return _jsx(AnchorHeading, { style: text.Titres['H5 - XS'], children: "Mon exemple de titre" });
16
16
  };
17
+ export const AvecNiveau = () => _jsx(AnchorHeading, { as: "h2", children: "Titre h2 avec ancre" });
17
18
  export * as Sources from './AnchorHeading.stories.sources';
@@ -1,6 +1,8 @@
1
1
  export declare const Default: () => string;
2
+ export declare const AvecNiveau: () => string;
2
3
  export declare const storySources: {
3
4
  readonly Default: () => string;
5
+ readonly AvecNiveau: () => string;
4
6
  };
5
7
  export type StorySourceName = keyof typeof storySources;
6
8
  //# sourceMappingURL=AnchorHeading.stories.sources.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"AnchorHeading.stories.sources.d.ts","sourceRoot":"","sources":["../../../src/core/AnchorHeading/AnchorHeading.stories.sources.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,OAAO,cAA2K,CAAC;AAEhM,eAAO,MAAM,YAAY;;CAEf,CAAC;AAEX,MAAM,MAAM,eAAe,GAAG,MAAM,OAAO,YAAY,CAAC"}
1
+ {"version":3,"file":"AnchorHeading.stories.sources.d.ts","sourceRoot":"","sources":["../../../src/core/AnchorHeading/AnchorHeading.stories.sources.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,OAAO,cAA2K,CAAC;AAEhM,eAAO,MAAM,UAAU,cAAwG,CAAC;AAEhI,eAAO,MAAM,YAAY;;;CAGf,CAAC;AAEX,MAAM,MAAM,eAAe,GAAG,MAAM,OAAO,YAAY,CAAC"}
@@ -1,6 +1,8 @@
1
1
  // This file is generated. Do not edit manually.
2
2
  // Source: src/core/AnchorHeading/AnchorHeading.stories.tsx
3
3
  export const Default = () => "export const Default = () => {\n const { text } = useTheme();\n return <AnchorHeading style={text.Titres['H5 - XS']}>Mon exemple de titre</AnchorHeading>;\n};";
4
+ export const AvecNiveau = () => "export const AvecNiveau = () => <AnchorHeading as=\"h2\">Titre h2 avec ancre</AnchorHeading>;";
4
5
  export const storySources = {
5
6
  Default,
7
+ AvecNiveau,
6
8
  };
@@ -1,3 +1,3 @@
1
1
  import type { AnchorHeadingProps } from './AnchorHeading';
2
- export declare const AnchorHeading: ({ children, style, scrollMarginTop }: AnchorHeadingProps) => import("react").JSX.Element;
2
+ export declare const AnchorHeading: ({ children, style, color: couleur, as, scrollMarginTop }: AnchorHeadingProps) => import("react").JSX.Element;
3
3
  //# sourceMappingURL=AnchorHeading.web.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"AnchorHeading.web.d.ts","sourceRoot":"","sources":["../../../src/core/AnchorHeading/AnchorHeading.web.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAG1D,eAAO,MAAM,aAAa,GAAI,sCAAsC,kBAAkB,gCAgDrF,CAAC"}
1
+ {"version":3,"file":"AnchorHeading.web.d.ts","sourceRoot":"","sources":["../../../src/core/AnchorHeading/AnchorHeading.web.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAG1D,eAAO,MAAM,aAAa,GAAI,0DAA0D,kBAAkB,gCA0DzG,CAAC"}
@@ -2,9 +2,10 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { FOCUS_ATTRIBUTE, useTheme } from '@alveole/theme';
3
3
  import { useState } from 'react';
4
4
  import { LucideIcon } from '../../ui/LucideIcon';
5
+ import { Heading } from '../Heading';
5
6
  import { Typography } from '../Typography';
6
- import { toSlug } from './slug';
7
- export const AnchorHeading = ({ children, style, scrollMarginTop }) => {
7
+ import { texteDe, toSlug } from './slug';
8
+ export const AnchorHeading = ({ children, style, color: couleur, as, scrollMarginTop }) => {
8
9
  const { color } = useTheme();
9
10
  const [hovered, setHovered] = useState(false);
10
11
  const [iconHovered, setIconHovered] = useState(false);
@@ -12,14 +13,16 @@ export const AnchorHeading = ({ children, style, scrollMarginTop }) => {
12
13
  // Un state convient ici, contrairement a la bague : montrer le lien quelle que soit la
13
14
  // provenance du focus est inoffensif, l'afficher est precisement ce qu'on veut.
14
15
  const [focused, setFocused] = useState(false);
15
- const slug = toSlug(children);
16
+ const texte = texteDe(children);
17
+ // shortcut: deux titres identiques partagent le meme id, suffixer si une page en a besoin.
18
+ const slug = toSlug(texte);
16
19
  return (_jsxs("div", { id: slug, style: {
17
20
  display: 'flex',
18
21
  flexDirection: 'row',
19
22
  alignItems: 'center',
20
23
  gap: 6,
21
24
  ...(scrollMarginTop != null ? { scrollMarginTop } : null),
22
- }, onMouseEnter: () => setHovered(true), onMouseLeave: () => setHovered(false), children: [_jsx(Typography, { style: style, children: children }), _jsx("a", { href: `#${slug}`, "aria-label": `Lien vers la section ${children}`, [FOCUS_ATTRIBUTE]: 'ring', style: {
25
+ }, onMouseEnter: () => setHovered(true), onMouseLeave: () => setHovered(false), children: [as ? (_jsx(Heading, { as: as, style: style, color: couleur, children: children })) : (_jsx(Typography, { style: style, color: couleur, children: children })), _jsx("a", { href: `#${slug}`, "aria-label": `Lien vers la section ${texte}`, [FOCUS_ATTRIBUTE]: 'ring', style: {
23
26
  opacity: hovered || focused ? 1 : 0,
24
27
  transition: 'opacity 0.15s',
25
28
  display: 'flex',
@@ -1,6 +1,9 @@
1
+ import React from 'react';
1
2
  /**
2
3
  * L'ancre d'un titre. Extrait de AnchorHeading pour que ce qui pointe vers une ancre la
3
4
  * calcule de la meme facon : un sommaire qui slugifie autrement renvoie dans le vide.
4
5
  */
5
6
  export declare const toSlug: (value: string) => string;
7
+ /** Le texte brut d'un titre, gras ou code compris : de quoi en tirer l'ancre et le nom du lien. */
8
+ export declare const texteDe: (node: React.ReactNode) => string;
6
9
  //# sourceMappingURL=slug.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"slug.d.ts","sourceRoot":"","sources":["../../../src/core/AnchorHeading/slug.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,eAAO,MAAM,MAAM,GAAI,OAAO,MAAM,WAML,CAAC"}
1
+ {"version":3,"file":"slug.d.ts","sourceRoot":"","sources":["../../../src/core/AnchorHeading/slug.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B;;;GAGG;AACH,eAAO,MAAM,MAAM,GAAI,OAAO,MAAM,WAML,CAAC;AAEhC,mGAAmG;AACnG,eAAO,MAAM,OAAO,GAAI,MAAM,KAAK,CAAC,SAAS,KAAG,MAK/C,CAAC"}
@@ -1,3 +1,4 @@
1
+ import React from 'react';
1
2
  /**
2
3
  * L'ancre d'un titre. Extrait de AnchorHeading pour que ce qui pointe vers une ancre la
3
4
  * calcule de la meme facon : un sommaire qui slugifie autrement renvoie dans le vide.
@@ -8,3 +9,13 @@ export const toSlug = (value) => value
8
9
  .replace(/[̀-ͯ]/g, '')
9
10
  .replace(/\s+/g, '-')
10
11
  .replace(/[^a-z0-9-]/g, '');
12
+ /** Le texte brut d'un titre, gras ou code compris : de quoi en tirer l'ancre et le nom du lien. */
13
+ export const texteDe = (node) => {
14
+ if (typeof node === 'string' || typeof node === 'number')
15
+ return String(node);
16
+ if (Array.isArray(node))
17
+ return node.map(texteDe).join('');
18
+ if (React.isValidElement(node))
19
+ return texteDe(node.props.children);
20
+ return '';
21
+ };
@@ -0,0 +1,8 @@
1
+ import { TypographyProps } from '../Typography';
2
+ export type HeadingLevel = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
3
+ export type HeadingProps = Omit<TypographyProps, 'tag'> & {
4
+ /** Balise rendue, qui fixe aussi la taille par defaut. */
5
+ as?: HeadingLevel;
6
+ };
7
+ export declare const Heading: ({ as, style, color, ...props }: HeadingProps) => import("react").JSX.Element;
8
+ //# sourceMappingURL=Heading.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Heading.d.ts","sourceRoot":"","sources":["../../../src/core/Heading/Heading.tsx"],"names":[],"mappings":"AACA,OAAO,EAAc,eAAe,EAAE,MAAM,eAAe,CAAC;AAE5D,MAAM,MAAM,YAAY,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAEnE,MAAM,MAAM,YAAY,GAAG,IAAI,CAAC,eAAe,EAAE,KAAK,CAAC,GAAG;IACxD,0DAA0D;IAC1D,EAAE,CAAC,EAAE,YAAY,CAAC;CACnB,CAAC;AAWF,eAAO,MAAM,OAAO,GAAI,gCAAuC,YAAY,gCAU1E,CAAC"}
@@ -0,0 +1,15 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { useTheme } from '@alveole/theme';
3
+ import { Typography } from '../Typography';
4
+ const STYLE_PAR_NIVEAU = {
5
+ h1: 'H1 - XL',
6
+ h2: 'H2 - LG',
7
+ h3: 'H3 - MD',
8
+ h4: 'H4 - SM',
9
+ h5: 'H5 - XS',
10
+ h6: 'H6 - XXS',
11
+ };
12
+ export const Heading = ({ as = 'h2', style, color, ...props }) => {
13
+ const theme = useTheme();
14
+ return (_jsx(Typography, { tag: as, style: [theme.text.Titres[STYLE_PAR_NIVEAU[as]], style], color: color ?? theme.color.light.text['title-grey'], ...props }));
15
+ };
@@ -0,0 +1,13 @@
1
+ declare const _default: {
2
+ title: string;
3
+ tags: "core"[];
4
+ experimental: true;
5
+ description: string;
6
+ component: ({ as, style, color, ...props }: import("./Heading").HeadingProps) => import("react").JSX.Element;
7
+ styleFn: () => {};
8
+ };
9
+ export default _default;
10
+ export declare const Default: () => import("react").JSX.Element;
11
+ export declare const Niveaux: () => import("react").JSX.Element;
12
+ export * as Sources from './Heading.stories.sources';
13
+ //# sourceMappingURL=Heading.stories.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Heading.stories.d.ts","sourceRoot":"","sources":["../../../src/core/Heading/Heading.stories.tsx"],"names":[],"mappings":";;;;;;;;AAGA,wBAOkB;AAElB,eAAO,MAAM,OAAO,mCAA6C,CAAC;AAElE,eAAO,MAAM,OAAO,mCASnB,CAAC;AAEF,OAAO,KAAK,OAAO,MAAM,2BAA2B,CAAC"}
@@ -0,0 +1,13 @@
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Heading } from './Heading';
3
+ export default {
4
+ title: 'Heading',
5
+ tags: ['core'],
6
+ experimental: true,
7
+ description: 'Titre de section : `as` fixe la balise (h1 a h6) et sa taille par defaut.',
8
+ component: Heading,
9
+ styleFn: () => ({}),
10
+ };
11
+ export const Default = () => _jsx(Heading, { children: "Titre de niveau 2" });
12
+ export const Niveaux = () => (_jsxs(_Fragment, { children: [_jsx(Heading, { as: "h1", children: "Titre h1" }), _jsx(Heading, { as: "h2", children: "Titre h2" }), _jsx(Heading, { as: "h3", children: "Titre h3" }), _jsx(Heading, { as: "h4", children: "Titre h4" }), _jsx(Heading, { as: "h5", children: "Titre h5" }), _jsx(Heading, { as: "h6", children: "Titre h6" })] }));
13
+ export * as Sources from './Heading.stories.sources';
@@ -0,0 +1,8 @@
1
+ export declare const Default: () => string;
2
+ export declare const Niveaux: () => string;
3
+ export declare const storySources: {
4
+ readonly Default: () => string;
5
+ readonly Niveaux: () => string;
6
+ };
7
+ export type StorySourceName = keyof typeof storySources;
8
+ //# sourceMappingURL=Heading.stories.sources.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Heading.stories.sources.d.ts","sourceRoot":"","sources":["../../../src/core/Heading/Heading.stories.sources.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,OAAO,cAA6E,CAAC;AAElG,eAAO,MAAM,OAAO,cAA4T,CAAC;AAEjV,eAAO,MAAM,YAAY;;;CAGf,CAAC;AAEX,MAAM,MAAM,eAAe,GAAG,MAAM,OAAO,YAAY,CAAC"}
@@ -0,0 +1,8 @@
1
+ // This file is generated. Do not edit manually.
2
+ // Source: src/core/Heading/Heading.stories.tsx
3
+ export const Default = () => "export const Default = () => <Heading>Titre de niveau 2</Heading>;";
4
+ export const Niveaux = () => "export const Niveaux = () => (\n <>\n <Heading as=\"h1\">Titre h1</Heading>\n <Heading as=\"h2\">Titre h2</Heading>\n <Heading as=\"h3\">Titre h3</Heading>\n <Heading as=\"h4\">Titre h4</Heading>\n <Heading as=\"h5\">Titre h5</Heading>\n <Heading as=\"h6\">Titre h6</Heading>\n </>\n);";
5
+ export const storySources = {
6
+ Default,
7
+ Niveaux,
8
+ };
@@ -0,0 +1,2 @@
1
+ export * from './Heading';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/Heading/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC"}
@@ -0,0 +1 @@
1
+ export * from './Heading';
@@ -1 +1 @@
1
- {"version":3,"file":"markdownComponents.d.ts","sourceRoot":"","sources":["../../../src/core/MarkdownDescription/markdownComponents.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAmB,KAAK,EAAE,MAAM,gBAAgB,CAAC;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AAC;AAGH,eAAO,MAAM,uBAAuB,GAAI,QAAQ,KAAK,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,EAAE,YAAY,MAAM;0BACnE,WAAW;0BAKX,WAAW;0BAKX,WAAW;0BAKX,WAAW;CAKjC,CAAC;AA+HH,eAAO,MAAM,wBAAwB,GAAI,QAAQ,wBAAwB,KAAG,UAQ1E,CAAC"}
@@ -1,5 +1,6 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { FOCUS_ATTRIBUTE } from '@alveole/theme';
3
+ import { AnchorHeading } from '../AnchorHeading';
3
4
  import { Box } from '../Box';
4
5
  import { Code } from '../Code';
5
6
  import { Highlight } from '../Highlight';
@@ -23,11 +24,12 @@ export const createTextComponents = ({ bodyStyle, boldStyle, textColor }) => ({
23
24
  strong: ({ children: c }) => (_jsx(Typography, { style: boldStyle, color: textColor, children: c })),
24
25
  em: ({ children: c }) => (_jsx(Typography, { style: [bodyStyle, { fontStyle: 'italic' }], color: textColor, children: c })),
25
26
  });
27
+ // La balise suit le niveau markdown ; la taille est decalee de deux crans, ces titres vivant sous ceux de la page.
26
28
  export const createHeadingComponents = (titres, titleColor) => ({
27
- h1: ({ children: c }) => (_jsx(Typography, { style: titres['H3 - MD'], color: titleColor, children: c })),
28
- h2: ({ children: c }) => (_jsx(Typography, { style: titres['H4 - SM'], color: titleColor, children: c })),
29
- h3: ({ children: c }) => (_jsx(Typography, { style: titres['H5 - XS'], color: titleColor, children: c })),
30
- h4: ({ children: c }) => (_jsx(Typography, { style: titres['H6 - XXS'], color: titleColor, children: c })),
29
+ h1: ({ children: c }) => (_jsx(AnchorHeading, { as: "h1", style: titres['H3 - MD'], color: titleColor, children: c })),
30
+ h2: ({ children: c }) => (_jsx(AnchorHeading, { as: "h2", style: titres['H4 - SM'], color: titleColor, children: c })),
31
+ h3: ({ children: c }) => (_jsx(AnchorHeading, { as: "h3", style: titres['H5 - XS'], color: titleColor, children: c })),
32
+ h4: ({ children: c }) => (_jsx(AnchorHeading, { as: "h4", style: titres['H6 - XXS'], color: titleColor, children: c })),
31
33
  });
32
34
  const createListComponents = (bodyStyle) => ({
33
35
  ul: ({ children: c }) => (_jsx(Box, { display: "flex", gap: 4, children: c })),
@@ -6,6 +6,7 @@ export * from './Box';
6
6
  export * from './Code';
7
7
  export * from './Form';
8
8
  export * from './Grid';
9
+ export * from './Heading';
9
10
  export * from './Highlight';
10
11
  export * from './Image';
11
12
  export * from './Lottie';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA,cAAc,KAAK,CAAC;AACpB,cAAc,SAAS,CAAC;AACxB,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC;AACpC,cAAc,OAAO,CAAC;AACtB,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC;AACvB,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,OAAO,CAAC;AACtB,cAAc,uBAAuB,CAAC;AACtC,cAAc,YAAY,CAAC;AAC3B,cAAc,QAAQ,CAAC;AACvB,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,kBAAkB,CAAC;AACjC,cAAc,WAAW,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA,cAAc,KAAK,CAAC;AACpB,cAAc,SAAS,CAAC;AACxB,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC;AACpC,cAAc,OAAO,CAAC;AACtB,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC;AACvB,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,OAAO,CAAC;AACtB,cAAc,uBAAuB,CAAC;AACtC,cAAc,YAAY,CAAC;AAC3B,cAAc,QAAQ,CAAC;AACvB,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,kBAAkB,CAAC;AACjC,cAAc,WAAW,CAAC"}
@@ -6,6 +6,7 @@ export * from './Box';
6
6
  export * from './Code';
7
7
  export * from './Form';
8
8
  export * from './Grid';
9
+ export * from './Heading';
9
10
  export * from './Highlight';
10
11
  export * from './Image';
11
12
  export * from './Lottie';
@@ -1,2 +1,2 @@
1
- export declare const ALVEOLE_COMPONENTS_VERSION: "2.0.0-alpha.14";
1
+ export declare const ALVEOLE_COMPONENTS_VERSION: "2.0.0-alpha.16";
2
2
  //# sourceMappingURL=version.d.ts.map
@@ -1 +1 @@
1
- export const ALVEOLE_COMPONENTS_VERSION = "2.0.0-alpha.14";
1
+ export const ALVEOLE_COMPONENTS_VERSION = "2.0.0-alpha.16";
@@ -4,6 +4,7 @@ export * as AppUpdateProviderStories from '../core/AppUpdateProvider/AppUpdatePr
4
4
  export * as BoxStory from '../core/Box/Box.stories';
5
5
  export * as CodeStory from '../core/Code/Code.stories';
6
6
  export * as GridStory from '../core/Grid/Grid.stories';
7
+ export * as HeadingStory from '../core/Heading/Heading.stories';
7
8
  export * as Highlight from '../core/Highlight/Highlight.stories';
8
9
  export * as ImageStory from '../core/Image/Image.stories';
9
10
  export * as LottieStory from '../core/Lottie/Lottie.stories';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/stories/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,MAAM,qBAAqB,CAAC;AAC9C,OAAO,KAAK,kBAAkB,MAAM,6CAA6C,CAAC;AAClF,OAAO,KAAK,wBAAwB,MAAM,qDAAqD,CAAC;AAChG,OAAO,KAAK,QAAQ,MAAM,y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,KAAK,qBAAqB,MAAM,iDAAiD,CAAC;AACzF,OAAO,KAAK,eAAe,MAAM,qCAAqC,CAAC"}
@@ -5,6 +5,7 @@ export * as AppUpdateProviderStories from '../core/AppUpdateProvider/AppUpdatePr
5
5
  export * as BoxStory from '../core/Box/Box.stories';
6
6
  export * as CodeStory from '../core/Code/Code.stories';
7
7
  export * as GridStory from '../core/Grid/Grid.stories';
8
+ export * as HeadingStory from '../core/Heading/Heading.stories';
8
9
  export * as Highlight from '../core/Highlight/Highlight.stories';
9
10
  export * as ImageStory from '../core/Image/Image.stories';
10
11
  export * as LottieStory from '../core/Lottie/Lottie.stories';
@@ -10,7 +10,7 @@ export const PriceInput = React.forwardRef(function PriceInput(props, ref) {
10
10
  const styles = useStyles();
11
11
  const champ = useFieldFocus({ disabled: props.disabled, readOnly: props.readOnly });
12
12
  const numberLength = value ? String(value).length : 1;
13
- return (_jsx(Box, { tag: "price-input", style: { ...styles.container, ...(champ.focus ? styles.containerFocused : {}) }, children: _jsxs(Box, { tag: "price-input-container", style: styles.priceInputContainer, children: [_jsx(ReactNativeTextInput, { ref: ref, style: {
13
+ return (_jsx(Box, { tag: "price-input", style: { ...styles.container, ...(champ.focus ? styles.inputFocused : {}) }, children: _jsxs(Box, { tag: "price-input-container", style: styles.priceInputContainer, children: [_jsx(ReactNativeTextInput, { ref: ref, style: {
14
14
  ...styles.input,
15
15
  minWidth: numberLength * 36,
16
16
  }, ...inputProps, value: Number.isNaN(value) || value == null ? '' : String(value), onChangeText: e => {
@@ -18,9 +18,23 @@ declare const _default: {
18
18
  borderBottomColor: string;
19
19
  paddingBottom: string | number;
20
20
  };
21
- containerFocused: {
21
+ inputFocused: {
22
22
  borderBottomWidth: number;
23
23
  borderBottomColor: string;
24
+ borderRadius: import("@alveole/theme").Radius;
25
+ outlineWidth?: number;
26
+ outlineStyle?: "solid";
27
+ outlineColor?: string;
28
+ outlineOffset?: number;
29
+ };
30
+ inputError: {
31
+ borderBottomColor: string;
32
+ };
33
+ inputSuccess: {
34
+ borderBottomColor: string;
35
+ };
36
+ inputDisabled: {
37
+ borderBottomColor: string;
24
38
  };
25
39
  priceInputContainer: {
26
40
  display: "flex";
@@ -30,6 +44,7 @@ declare const _default: {
30
44
  input: {
31
45
  outline: string;
32
46
  borderWidth: number;
47
+ backgroundColor: "transparent";
33
48
  textAlign: "center";
34
49
  color: string;
35
50
  fontFamily: string;
@@ -54,5 +69,6 @@ declare const _default: {
54
69
  };
55
70
  export default _default;
56
71
  export declare const Default: () => import("react").JSX.Element;
72
+ export declare const States: () => import("react").JSX.Element;
57
73
  export * as Sources from './PriceInput.stories.sources';
58
74
  //# sourceMappingURL=PriceInput.stories.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"PriceInput.stories.d.ts","sourceRoot":"","sources":["../../../src/ui/PriceInput/PriceInput.stories.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAOA,wBASkB;AAElB,eAAO,MAAM,OAAO,mCAYnB,CAAC;AAEF,OAAO,KAAK,OAAO,MAAM,8BAA8B,CAAC"}
1
+ {"version":3,"file":"PriceInput.stories.d.ts","sourceRoot":"","sources":["../../../src/ui/PriceInput/PriceInput.stories.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAOA,wBASkB;AAElB,eAAO,MAAM,OAAO,mCAYnB,CAAC;AAEF,eAAO,MAAM,MAAM,mCAYlB,CAAC;AAEF,OAAO,KAAK,OAAO,MAAM,8BAA8B,CAAC"}
@@ -17,4 +17,5 @@ export const Default = () => {
17
17
  const [value, setValue] = useState(null);
18
18
  return (_jsxs(Box, { display: "flex", flexDirection: "column", gap: 24, children: [_jsx(FormControl, { label: "Montant", children: _jsx(PriceInput, { value: value, onChange: setValue }) }), _jsx(FormControl, { label: "Montant saisi", children: _jsx(PriceInput, { value: 1250, onChange: () => { } }) })] }));
19
19
  };
20
+ export const States = () => (_jsxs(Box, { display: "flex", flexDirection: "column", gap: 24, children: [_jsx(FormControl, { label: "Erreur", error: "Montant requis", children: _jsx(PriceInput, { value: null, error: "Montant requis", onChange: () => { } }) }), _jsx(FormControl, { label: "Succ\u00E8s", success: "Enregistr\u00E9", children: _jsx(PriceInput, { value: 1250, success: "Enregistr\u00E9", onChange: () => { } }) }), _jsx(FormControl, { label: "D\u00E9sactiv\u00E9", disabled: true, children: _jsx(PriceInput, { value: 1250, disabled: true, onChange: () => { } }) })] }));
20
21
  export * as Sources from './PriceInput.stories.sources';
@@ -1,6 +1,8 @@
1
1
  export declare const Default: () => string;
2
+ export declare const States: () => string;
2
3
  export declare const storySources: {
3
4
  readonly Default: () => string;
5
+ readonly States: () => string;
4
6
  };
5
7
  export type StorySourceName = keyof typeof storySources;
6
8
  //# sourceMappingURL=PriceInput.stories.sources.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"PriceInput.stories.sources.d.ts","sourceRoot":"","sources":["../../../src/ui/PriceInput/PriceInput.stories.sources.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,OAAO,cAAwb,CAAC;AAE7c,eAAO,MAAM,YAAY;;CAEf,CAAC;AAEX,MAAM,MAAM,eAAe,GAAG,MAAM,OAAO,YAAY,CAAC"}
1
+ {"version":3,"file":"PriceInput.stories.sources.d.ts","sourceRoot":"","sources":["../../../src/ui/PriceInput/PriceInput.stories.sources.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,OAAO,cAAwb,CAAC;AAE7c,eAAO,MAAM,MAAM,cAAojB,CAAC;AAExkB,eAAO,MAAM,YAAY;;;CAGf,CAAC;AAEX,MAAM,MAAM,eAAe,GAAG,MAAM,OAAO,YAAY,CAAC"}
@@ -1,6 +1,8 @@
1
1
  // This file is generated. Do not edit manually.
2
2
  // Source: src/ui/PriceInput/PriceInput.stories.tsx
3
3
  export const Default = () => "export const Default = () => {\n const [value, setValue] = useState<number | null>(null);\n return (\n <Box display=\"flex\" flexDirection=\"column\" gap={24}>\n <FormControl label=\"Montant\">\n <PriceInput value={value} onChange={setValue} />\n </FormControl>\n <FormControl label=\"Montant saisi\">\n <PriceInput value={1250} onChange={() => {}} />\n </FormControl>\n </Box>\n );\n};";
4
+ export const States = () => "export const States = () => (\n <Box display=\"flex\" flexDirection=\"column\" gap={24}>\n <FormControl label=\"Erreur\" error=\"Montant requis\">\n <PriceInput value={null} error=\"Montant requis\" onChange={() => {}} />\n </FormControl>\n <FormControl label=\"Succès\" success=\"Enregistré\">\n <PriceInput value={1250} success=\"Enregistré\" onChange={() => {}} />\n </FormControl>\n <FormControl label=\"Désactivé\" disabled>\n <PriceInput value={1250} disabled onChange={() => {}} />\n </FormControl>\n </Box>\n);";
4
5
  export const storySources = {
5
6
  Default,
7
+ States,
6
8
  };
@@ -7,9 +7,23 @@ export declare const useStyles: () => {
7
7
  borderBottomColor: string;
8
8
  paddingBottom: string | number;
9
9
  };
10
- containerFocused: {
10
+ inputFocused: {
11
11
  borderBottomWidth: number;
12
12
  borderBottomColor: string;
13
+ borderRadius: import("@alveole/theme").Radius;
14
+ outlineWidth?: number;
15
+ outlineStyle?: "solid";
16
+ outlineColor?: string;
17
+ outlineOffset?: number;
18
+ };
19
+ inputError: {
20
+ borderBottomColor: string;
21
+ };
22
+ inputSuccess: {
23
+ borderBottomColor: string;
24
+ };
25
+ inputDisabled: {
26
+ borderBottomColor: string;
13
27
  };
14
28
  priceInputContainer: {
15
29
  display: "flex";
@@ -19,6 +33,7 @@ export declare const useStyles: () => {
19
33
  input: {
20
34
  outline: string;
21
35
  borderWidth: number;
36
+ backgroundColor: "transparent";
22
37
  textAlign: "center";
23
38
  color: string;
24
39
  fontFamily: string;
@@ -1 +1 @@
1
- {"version":3,"file":"PriceInput.styles.d.ts","sourceRoot":"","sources":["../../../src/ui/PriceInput/PriceInput.styles.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuCnB,CAAC"}
1
+ {"version":3,"file":"PriceInput.styles.d.ts","sourceRoot":"","sources":["../../../src/ui/PriceInput/PriceInput.styles.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqDnB,CAAC"}
@@ -1,5 +1,5 @@
1
1
  import { focusBorder, makeStyles } from '@alveole/theme';
2
- export const useStyles = makeStyles(({ text, color, spacing }) => ({
2
+ export const useStyles = makeStyles(({ text, color, spacing, radius }) => ({
3
3
  container: {
4
4
  display: 'flex',
5
5
  flexDirection: 'column',
@@ -8,11 +8,23 @@ export const useStyles = makeStyles(({ text, color, spacing }) => ({
8
8
  borderBottomColor: color.light.border['plain-grey'],
9
9
  paddingBottom: spacing('1W'),
10
10
  },
11
- // Le champ de prix n'a qu'un trait sous le montant en guise de cadre : c'est donc lui que
12
- // le focus recolore, avec la meme definition que la bordure complete des autres champs.
13
- containerFocused: {
14
- borderBottomWidth: focusBorder().borderWidth,
15
- borderBottomColor: focusBorder().borderColor,
11
+ // Le champ de prix n'a qu'un trait sous le montant en guise de cadre : le focus le recolore,
12
+ // et l'anneau encastre des autres champs (ADR 0017) entoure la zone du montant.
13
+ inputFocused: (({ borderWidth, borderColor, ...anneau }) => ({
14
+ ...anneau,
15
+ borderBottomWidth: borderWidth,
16
+ borderBottomColor: borderColor,
17
+ // Au focus seulement : au repos, un rayon courberait les extremites du seul trait visible.
18
+ borderRadius: radius('md'),
19
+ }))(focusBorder()),
20
+ inputError: {
21
+ borderBottomColor: color.light.border['plain-error'],
22
+ },
23
+ inputSuccess: {
24
+ borderBottomColor: color.light.border['plain-success'],
25
+ },
26
+ inputDisabled: {
27
+ borderBottomColor: color.light.border['disabled-grey'],
16
28
  },
17
29
  priceInputContainer: {
18
30
  display: 'flex',
@@ -22,6 +34,8 @@ export const useStyles = makeStyles(({ text, color, spacing }) => ({
22
34
  input: {
23
35
  outline: 'none',
24
36
  borderWidth: 0,
37
+ // Le blanc par defaut d'un <input> recouvrirait l'anneau encastre du cadre.
38
+ backgroundColor: 'transparent',
25
39
  textAlign: 'center',
26
40
  color: color.light.text['title-grey'],
27
41
  fontFamily: text['Titres alternatifs'].MD.fontFamily,
@@ -1,5 +1,4 @@
1
1
  import React from 'react';
2
- import './PriceInput.css';
3
2
  export declare const PriceInput: React.ForwardRefExoticComponent<import("..").NumberInputProps & {
4
3
  autoFocus?: boolean;
5
4
  devise?: "\u20AC";
@@ -1 +1 @@
1
- {"version":3,"file":"PriceInput.web.d.ts","sourceRoot":"","sources":["../../../src/ui/PriceInput/PriceInput.web.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAM1B,OAAO,kBAAkB,CAAC;AAK1B,eAAO,MAAM,UAAU;;;;0CAuCrB,CAAC"}
1
+ {"version":3,"file":"PriceInput.web.d.ts","sourceRoot":"","sources":["../../../src/ui/PriceInput/PriceInput.web.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAU1B,eAAO,MAAM,UAAU;;;;0CAwCrB,CAAC"}
@@ -4,22 +4,21 @@ import { Box } from '../../core/Box';
4
4
  import { Typography } from '../../core/Typography';
5
5
  import { useFieldId } from '../FormControl';
6
6
  import { useFieldFocus } from '../FormControl/useFieldFocus';
7
- import './PriceInput.css';
7
+ import { cadrePrix } from './cadrePrix';
8
8
  import { useStyles } from './PriceInput.styles';
9
- const MAX_VALUE = 99999999;
9
+ import { useSaisieMontant } from './useSaisieMontant';
10
10
  export const PriceInput = React.forwardRef(function PriceInput(props, ref) {
11
- const { devise, autoFocus, value, disabled, readOnly, onChange } = props;
11
+ const { devise, autoFocus, value, disabled, readOnly, error, success, onChange } = props;
12
12
  const styles = useStyles();
13
13
  const champ = useFieldFocus({ disabled, readOnly });
14
- const numberLength = value ? String(value).length : 1;
15
- return (_jsx(Box, { tag: "price-input", style: { ...styles.container, ...(champ.focus ? styles.containerFocused : {}) }, children: _jsxs(Box, { tag: "price-input-container", style: styles.priceInputContainer, children: [_jsx("input", { ref: ref, id: useFieldId(), autoFocus: autoFocus, className: "alveole-price-input", style: {
14
+ const { affichage, saisir } = useSaisieMontant(value, onChange);
15
+ // Avec des chiffres tabulaires, un caractère occupe au plus 1 ch.
16
+ const largeur = `${affichage.length || 1}ch`;
17
+ return (_jsx(Box, { tag: "price-input", style: cadrePrix(styles, { focus: champ.focus, disabled, error, success }), children: _jsxs(Box, { tag: "price-input-container", style: styles.priceInputContainer, children: [_jsx("input", { ref: ref, id: useFieldId(), autoFocus: autoFocus, disabled: disabled, readOnly: readOnly, className: "alveole-price-input", style: {
16
18
  ...styles.input,
17
19
  fontVariantNumeric: 'tabular-nums',
18
- width: numberLength * 36,
20
+ width: largeur,
19
21
  lineHeight: 'inherit',
20
22
  maxWidth: '100%',
21
- }, value: value ?? '', placeholder: "0", onChange: e => {
22
- const newValue = e.target.value;
23
- onChange?.(newValue === '' ? null : Number(newValue));
24
- }, onFocus: champ.handleFocus, onBlur: champ.handleBlur, type: "number", max: MAX_VALUE }), _jsx(Typography, { style: styles.inputDevise, children: devise || '€' })] }) }));
23
+ }, value: affichage, placeholder: "0", onChange: e => saisir(e.target.value), onFocus: champ.handleFocus, onBlur: champ.handleBlur, type: "text", inputMode: "decimal" }), _jsx(Typography, { style: styles.inputDevise, children: devise || '€' })] }) }));
25
24
  });
@@ -0,0 +1,17 @@
1
+ import { FieldBorderState } from '../FormControl/fieldBorderState';
2
+ import { useStyles } from './PriceInput.styles';
3
+ type Styles = ReturnType<typeof useStyles>;
4
+ /**
5
+ * Le trait sous le montant tient lieu de cadre au champ de prix : il prend les etats de tous
6
+ * les champs, dans la priorite commune de l'ADR 0012.
7
+ */
8
+ export declare const cadrePrix: (styles: Styles, state: FieldBorderState) => {
9
+ borderBottomColor: string;
10
+ display: "flex";
11
+ flexDirection: "column";
12
+ width: "100%";
13
+ borderBottomWidth: number;
14
+ paddingBottom: string | number;
15
+ };
16
+ export {};
17
+ //# sourceMappingURL=cadrePrix.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cadrePrix.d.ts","sourceRoot":"","sources":["../../../src/ui/PriceInput/cadrePrix.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAoB,MAAM,iCAAiC,CAAC;AACrF,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAEhD,KAAK,MAAM,GAAG,UAAU,CAAC,OAAO,SAAS,CAAC,CAAC;AAE3C;;;GAGG;AACH,eAAO,MAAM,SAAS,GAAI,QAAQ,MAAM,EAAE,OAAO,gBAAgB;;;;;;;CAG/D,CAAC"}
@@ -0,0 +1,9 @@
1
+ import { fieldBorderState } from '../FormControl/fieldBorderState';
2
+ /**
3
+ * Le trait sous le montant tient lieu de cadre au champ de prix : il prend les etats de tous
4
+ * les champs, dans la priorite commune de l'ADR 0012.
5
+ */
6
+ export const cadrePrix = (styles, state) => ({
7
+ ...styles.container,
8
+ ...fieldBorderState(styles, state),
9
+ });
@@ -0,0 +1,5 @@
1
+ export declare const useSaisieMontant: (montant: number | null | undefined, onChange?: (montant: number | null) => void) => {
2
+ affichage: string;
3
+ saisir: (texte: string) => void;
4
+ };
5
+ //# sourceMappingURL=useSaisieMontant.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useSaisieMontant.d.ts","sourceRoot":"","sources":["../../../src/ui/PriceInput/useSaisieMontant.ts"],"names":[],"mappings":"AAUA,eAAO,MAAM,gBAAgB,GAAI,SAAS,MAAM,GAAG,IAAI,GAAG,SAAS,EAAE,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI;;oBAKvF,MAAM;CAO9B,CAAC"}
@@ -0,0 +1,19 @@
1
+ import { useState } from 'react';
2
+ // Des chiffres, puis au plus un séparateur décimal (virgule ou point) et deux décimales.
3
+ const MONTANT = /^\d*([.,]\d{0,2})?$/;
4
+ // La virgule est le séparateur décimal en français ; Number ne lit que le point.
5
+ const lireMontant = (texte) => (texte === '' ? null : Number(texte.replace(',', '.')));
6
+ // Le texte tapé reste affiché tant qu'il vaut le montant reçu : « 12, » attend sa décimale
7
+ // au lieu de redevenir « 12 ». Un montant imposé par le parent reprend la main.
8
+ export const useSaisieMontant = (montant, onChange) => {
9
+ const texteDuMontant = montant == null ? '' : String(montant);
10
+ const [saisie, setSaisie] = useState(texteDuMontant);
11
+ const affichage = lireMontant(saisie) === (montant ?? null) ? saisie : texteDuMontant;
12
+ const saisir = (texte) => {
13
+ if (!MONTANT.test(texte))
14
+ return;
15
+ setSaisie(texte);
16
+ onChange?.(lireMontant(texte));
17
+ };
18
+ return { affichage, saisir };
19
+ };
@@ -21,7 +21,7 @@ export default {
21
21
  'Le composant reste **strictement contrôlé**, y compris pour la création d’option : `onCreateOption` reçoit',
22
22
  'la saisie, à l’appelant d’ajouter l’option à `options` puis de mettre `value` à jour.',
23
23
  '',
24
- '### Migration depuis `Autocomplete`',
24
+ '## Migration depuis `Autocomplete`',
25
25
  '',
26
26
  // Cellules en texte brut : le rendu Markdown du catalogue échoue sur du code
27
27
  // inline dans un tableau.
@@ -23,7 +23,7 @@ export default {
23
23
  };
24
24
  export const ExampleUsage = () => {
25
25
  const controller = useSidebar();
26
- return (_jsxs(Sidebar, { controller: controller, logo: _jsx(Typography, { fontSize: 16, style: { fontWeight: '700' }, children: "Mon Application" }), footer: _jsx(SidebarItem, { pressable: true, leading: "LogOut", title: "Se d\u00E9connecter", onPress: console.log }), children: [_jsx(SidebarItem, { pressable: true, title: "Item 1", onPress: console.log }), _jsx(SidebarItem, { pressable: true, title: "Item 2", onPress: console.log }), _jsxs(SidebarGroup, { title: "Groupe", children: [_jsx(SidebarItem, { pressable: true, title: "Item group 1", onPress: console.log }), _jsx(SidebarItem, { pressable: true, title: "Item group 2", onPress: console.log })] })] }));
26
+ return (_jsxs(Sidebar, { controller: controller, logo: _jsx(Typography, { fontSize: 16, style: { fontWeight: '700' }, children: "Mon Application" }), footer: _jsx(SidebarItem, { pressable: true, leading: "LogOut", title: "Se d\u00E9connecter", onPress: console.log }), children: [_jsx(SidebarItem, { pressable: true, title: "Item 1", onPress: console.log }), _jsx(SidebarItem, { pressable: true, title: "Item 2", counter: 3, onPress: console.log }), _jsxs(SidebarGroup, { title: "Groupe", children: [_jsx(SidebarItem, { pressable: true, title: "Item group 1", onPress: console.log }), _jsx(SidebarItem, { pressable: true, title: "Item group 2", onPress: console.log })] })] }));
27
27
  };
28
28
  // Faute de logo publie pour Alveole, une forme generee tient lieu de logo.
29
29
  const organisations = [
@@ -1 +1 @@
1
- {"version":3,"file":"Sidebar.stories.sources.d.ts","sourceRoot":"","sources":["../../../src/ui/Sidebar/Sidebar.stories.sources.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,YAAY,cAAqxB,CAAC;AAE/yB,eAAO,MAAM,kBAAkB,cAA2/D,CAAC;AAE3hE,eAAO,MAAM,YAAY;;;CAGf,CAAC;AAEX,MAAM,MAAM,eAAe,GAAG,MAAM,OAAO,YAAY,CAAC"}
1
+ {"version":3,"file":"Sidebar.stories.sources.d.ts","sourceRoot":"","sources":["../../../src/ui/Sidebar/Sidebar.stories.sources.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,YAAY,cAAiyB,CAAC;AAE3zB,eAAO,MAAM,kBAAkB,cAA2/D,CAAC;AAE3hE,eAAO,MAAM,YAAY;;;CAGf,CAAC;AAEX,MAAM,MAAM,eAAe,GAAG,MAAM,OAAO,YAAY,CAAC"}
@@ -1,6 +1,6 @@
1
1
  // This file is generated. Do not edit manually.
2
2
  // Source: src/ui/Sidebar/Sidebar.stories.tsx
3
- export const ExampleUsage = () => "export const ExampleUsage = () => {\n const controller = useSidebar();\n\n return (\n <Sidebar\n controller={controller}\n logo={\n <Typography fontSize={16} style={{ fontWeight: '700' }}>\n Mon Application\n </Typography>\n }\n footer={<SidebarItem pressable leading=\"LogOut\" title=\"Se déconnecter\" onPress={console.log} />}\n >\n <SidebarItem pressable title=\"Item 1\" onPress={console.log} />\n <SidebarItem pressable title=\"Item 2\" onPress={console.log} />\n\n <SidebarGroup title=\"Groupe\">\n <SidebarItem pressable title=\"Item group 1\" onPress={console.log} />\n <SidebarItem pressable title=\"Item group 2\" onPress={console.log} />\n </SidebarGroup>\n </Sidebar>\n );\n};";
3
+ export const ExampleUsage = () => "export const ExampleUsage = () => {\n const controller = useSidebar();\n\n return (\n <Sidebar\n controller={controller}\n logo={\n <Typography fontSize={16} style={{ fontWeight: '700' }}>\n Mon Application\n </Typography>\n }\n footer={<SidebarItem pressable leading=\"LogOut\" title=\"Se déconnecter\" onPress={console.log} />}\n >\n <SidebarItem pressable title=\"Item 1\" onPress={console.log} />\n <SidebarItem pressable title=\"Item 2\" counter={3} onPress={console.log} />\n\n <SidebarGroup title=\"Groupe\">\n <SidebarItem pressable title=\"Item group 1\" onPress={console.log} />\n <SidebarItem pressable title=\"Item group 2\" onPress={console.log} />\n </SidebarGroup>\n </Sidebar>\n );\n};";
4
4
  export const AvecHeaderEtFooter = () => "export const AvecHeaderEtFooter = () => {\n const [orga, setOrga] = useState('Alveole');\n\n const logo = (\n <ActionMenu\n placement=\"bottom-start\"\n renderTrigger={() => (\n <Button\n variant=\"tertiary\"\n size=\"md\"\n contentAlign=\"start\"\n title={orga}\n leading={<LogoDOrganisation nom={orga} />}\n trailing=\"ChevronDown\"\n />\n )}\n >\n {organisations.map(({ nom }) => (\n <ActionMenu.Item\n key={nom}\n title={nom}\n leading={<LogoDOrganisation nom={nom} />}\n selected={nom === orga}\n onPress={() => setOrga(nom)}\n />\n ))}\n </ActionMenu>\n );\n\n const footer = (\n <ActionMenu\n placement=\"top-start\"\n renderTrigger={() => (\n <Button\n variant=\"tertiary\"\n size=\"lg\"\n contentAlign=\"start\"\n title=\"Clément Prod'homme\"\n leading={<Avatar size=\"sm\" src=\"https://www.loremfaces.net/96/id/1.jpg\" fallbackText=\"Clément Prod'homme\" />}\n />\n )}\n >\n <ActionMenu.Item title=\"Mon profil\" leading=\"User\" />\n <ActionMenu.Item title=\"Paramètres\" leading=\"Settings\" />\n <ActionMenu.Item title=\"Aide\" leading=\"HelpCircle\" />\n <ActionMenu.Item title=\"Se déconnecter\" leading=\"LogOut\" />\n </ActionMenu>\n );\n\n return (\n <Sidebar logo={logo} footer={footer}>\n <SidebarItem pressable leading=\"LayoutDashboard\" title=\"Tableau de bord\" onPress={console.log} />\n <SidebarItem pressable leading=\"Users\" title=\"Utilisateurs\" onPress={console.log} />\n <SidebarItem pressable leading=\"FileText\" title=\"Rapports\" onPress={console.log} />\n\n <SidebarDivider />\n\n <SidebarItem pressable leading=\"Settings\" title=\"Configuration\" onPress={console.log} />\n <SidebarItem pressable leading=\"Bell\" title=\"Notifications\" onPress={console.log} />\n </Sidebar>\n );\n};";
5
5
  export const storySources = {
6
6
  ExampleUsage,
@@ -1,7 +1,12 @@
1
1
  import React from 'react';
2
2
  import { AProps } from '../../core/A';
3
+ import { CounterProps } from '../Counter';
3
4
  import { Leading } from '../Leading';
4
- export type SidebarItemNavigable = {
5
+ type SidebarItemCompteur = {
6
+ counter?: number;
7
+ counterVariant?: CounterProps['variant'];
8
+ };
9
+ export type SidebarItemNavigable = SidebarItemCompteur & {
5
10
  pressable?: undefined;
6
11
  title: string;
7
12
  leading?: Leading;
@@ -9,7 +14,7 @@ export type SidebarItemNavigable = {
9
14
  direction?: AProps['direction'];
10
15
  routeName?: string;
11
16
  };
12
- export type SidebarItemPressable = {
17
+ export type SidebarItemPressable = SidebarItemCompteur & {
13
18
  pressable: true;
14
19
  title: string;
15
20
  leading?: Leading;
@@ -17,4 +22,5 @@ export type SidebarItemPressable = {
17
22
  };
18
23
  export type SidebarItemProps = SidebarItemNavigable | SidebarItemPressable;
19
24
  export declare const SidebarItem: (props: SidebarItemProps) => React.JSX.Element;
25
+ export {};
20
26
  //# sourceMappingURL=SidebarItem.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"SidebarItem.d.ts","sourceRoot":"","sources":["../../../src/ui/Sidebar/SidebarItem.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAK,MAAM,EAAE,MAAM,cAAc,CAAC;AAIzC,OAAO,EAAE,OAAO,EAAe,MAAM,YAAY,CAAC;AAGlD,MAAM,MAAM,oBAAoB,GAAG;IACjC,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC,WAAW,CAAC,CAAC;IAChC,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG;IACjC,SAAS,EAAE,IAAI,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG,oBAAoB,GAAG,oBAAoB,CAAC;AA+G3E,eAAO,MAAM,WAAW,GAAI,OAAO,gBAAgB,sBAIlD,CAAC"}
1
+ {"version":3,"file":"SidebarItem.d.ts","sourceRoot":"","sources":["../../../src/ui/Sidebar/SidebarItem.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAK,MAAM,EAAE,MAAM,cAAc,CAAC;AAIzC,OAAO,EAAW,YAAY,EAAE,MAAM,YAAY,CAAC;AACnD,OAAO,EAAE,OAAO,EAAe,MAAM,YAAY,CAAC;AAGlD,KAAK,mBAAmB,GAAG;IACzB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,cAAc,CAAC,EAAE,YAAY,CAAC,SAAS,CAAC,CAAC;CAC1C,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG,mBAAmB,GAAG;IACvD,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC,WAAW,CAAC,CAAC;IAChC,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG,mBAAmB,GAAG;IACvD,SAAS,EAAE,IAAI,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG,oBAAoB,GAAG,oBAAoB,CAAC;AAoI3E,eAAO,MAAM,WAAW,GAAI,OAAO,gBAAgB,sBAIlD,CAAC"}
@@ -7,6 +7,7 @@ import { A } from '../../core/A';
7
7
  import { Box } from '../../core/Box';
8
8
  import { fondAuSurvol } from '../../core/styleTamagui/fondAuSurvol';
9
9
  import { Typography } from '../../core/Typography';
10
+ import { Counter } from '../Counter';
10
11
  import { LeadingSlot } from '../Leading';
11
12
  import { useStyles } from './Sidebar.styles';
12
13
  // Un item mène quelque part ou déclenche quelque chose : dans un cas c'est un lien, dans
@@ -21,6 +22,8 @@ const IndicateurPageCourante = () => {
21
22
  const styles = useStyles();
22
23
  return (_jsx(Box, { tag: "sidebar-item-indicator", style: styles.sidebarItemSelectedIndicator, children: _jsx(Box, { style: styles.sidebarItemSelectedIndicatorContent }) }));
23
24
  };
25
+ // Un compteur à zéro ne compte rien : on ne l'affiche pas.
26
+ const CompteurDItem = ({ counter, counterVariant = 'default' }) => counter != null && counter > 0 ? (_jsx(Box, { mt: "auto", mb: "auto", children: _jsx(Counter, { variant: counterVariant, count: counter }) })) : null;
24
27
  const SidebarItemDesktop = (props) => {
25
28
  const { title, leading } = props;
26
29
  const styles = useStyles();
@@ -31,7 +34,7 @@ const SidebarItemDesktop = (props) => {
31
34
  // La ligne courante se survole comme ses voisines : elle est un lien au même titre, et
32
35
  // lui réserver une teinte propre n'ajoutait qu'un cas particulier. Son fond de repos
33
36
  // étant plus sombre, le survol commun l'éclaircit - la direction que prend Primer.
34
- backgroundColor: fond, children: [_jsx(LeadingSlot, { contenu: leading, apparence: { size: 'sm' } }), _jsx(Typography, { style: { ...styles.sidebarItemTitleDesktop, ...titleStyleSelected }, children: title })] })] }) }));
37
+ backgroundColor: fond, children: [_jsx(LeadingSlot, { contenu: leading, apparence: { size: 'sm' } }), _jsx(Typography, { style: { ...styles.sidebarItemTitleDesktop, ...titleStyleSelected, flex: 1, textAlign: 'left' }, numberOfLines: 1, children: title }), _jsx(CompteurDItem, { ...props })] })] }) }));
35
38
  };
36
39
  const SidebarItemMobile = (props) => {
37
40
  const { title, leading } = props;
@@ -49,7 +52,7 @@ const SidebarItemMobile = (props) => {
49
52
  color: isCurrentPage
50
53
  ? styles.sidebarItemTitleSelectedMobile.color
51
54
  : styles.sidebarItemTitleSelectedMobile.stroke,
52
- } }), _jsx(Typography, { style: titre, color: { default: couleurDuTitre, hover: couleurAuSurvol }, children: title })] })] }) }));
55
+ } }), _jsx(Typography, { style: { ...titre, flex: 1, textAlign: 'left' }, color: { default: couleurDuTitre, hover: couleurAuSurvol }, numberOfLines: 1, children: title }), _jsx(CompteurDItem, { ...props })] })] }) }));
53
56
  };
54
57
  export const SidebarItem = (props) => {
55
58
  const { isVariant } = useTheme();
@@ -12,6 +12,12 @@ export type TabsProps = Omit<BoxProps, 'children' | 'onChange'> & {
12
12
  renderAction?: () => React.ReactNode;
13
13
  }[];
14
14
  defaultValue?: string;
15
+ /**
16
+ * L'onglet actif, impose par le parent : `Tabs` devient controle. Un clic sur un onglet appelle
17
+ * toujours `onChange`, au parent de mettre `value` a jour. Absent, `Tabs` garde l'onglet actif
18
+ * pour lui, a partir de `defaultValue`.
19
+ */
20
+ value?: string;
15
21
  onChange?: (index: number) => void;
16
22
  /**
17
23
  * Active l'Anchor Sync (voir ADR 0022) : au clic, l'onglet actif est ecrit dans l'etat
@@ -1 +1 @@
1
- {"version":3,"file":"Tabs.d.ts","sourceRoot":"","sources":["../../../src/ui/Tabs/Tabs.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,EAAO,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAOrC,MAAM,MAAM,SAAS,GAAG,IAAI,CAAC,QAAQ,EAAE,UAAU,GAAG,UAAU,CAAC,GAAG;IAChE,IAAI,EAAE;QACJ,KAAK,EAAE,MAAM,CAAC;QACd,OAAO,CAAC,EAAE,OAAO,CAAC;QAClB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,KAAK,EAAE,MAAM,CAAC;QACd,OAAO,EAAE,KAAK,CAAC,SAAS,CAAC;QACzB,UAAU,CAAC,EAAE,OAAO,CAAC;QACrB,YAAY,CAAC,EAAE,MAAM,KAAK,CAAC,SAAS,CAAC;KACtC,EAAE,CAAC;IACJ,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC;;;;;;OAMG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B,CAAC;AAEF,eAAO,MAAM,IAAI,GAAI,OAAO,SAAS,sBAkEpC,CAAC"}
1
+ {"version":3,"file":"Tabs.d.ts","sourceRoot":"","sources":["../../../src/ui/Tabs/Tabs.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,EAAO,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAOrC,MAAM,MAAM,SAAS,GAAG,IAAI,CAAC,QAAQ,EAAE,UAAU,GAAG,UAAU,CAAC,GAAG;IAChE,IAAI,EAAE;QACJ,KAAK,EAAE,MAAM,CAAC;QACd,OAAO,CAAC,EAAE,OAAO,CAAC;QAClB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,KAAK,EAAE,MAAM,CAAC;QACd,OAAO,EAAE,KAAK,CAAC,SAAS,CAAC;QACzB,UAAU,CAAC,EAAE,OAAO,CAAC;QACrB,YAAY,CAAC,EAAE,MAAM,KAAK,CAAC,SAAS,CAAC;KACtC,EAAE,CAAC;IACJ,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC;;;;;;OAMG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B,CAAC;AAEF,eAAO,MAAM,IAAI,GAAI,OAAO,SAAS,sBAkEpC,CAAC"}
@@ -9,10 +9,10 @@ import { TabsTab } from './TabsTab';
9
9
  import { useAnchorSync } from './useAnchorSync';
10
10
  import { useTabsState } from './useTabsState';
11
11
  export const Tabs = (props) => {
12
- const { tabs, defaultValue = '', onChange, urlAnchorPrefix, style, ...boxProps } = props;
12
+ const { tabs, defaultValue = '', value, onChange, urlAnchorPrefix, style, ...boxProps } = props;
13
13
  const styles = useStyles();
14
14
  const initialValue = defaultValue || tabs[0]?.value || '';
15
- const { currentTab, etatDeLOnglet, setCurrentTab, restoreCurrentTab, setHoverTab, handleOnInteraction } = useTabsState(initialValue, onChange);
15
+ const { currentTab, etatDeLOnglet, setCurrentTab, restoreCurrentTab, setHoverTab, handleOnInteraction } = useTabsState(initialValue, onChange, value);
16
16
  const { persist } = useAnchorSync(urlAnchorPrefix, anchor => {
17
17
  const tab = tabs.find(t => toSlug(t.label) === anchor);
18
18
  if (tab)
@@ -121,5 +121,6 @@ declare const _default: {
121
121
  };
122
122
  export default _default;
123
123
  export declare const Example: () => React.JSX.Element;
124
+ export declare const Controle: () => React.JSX.Element;
124
125
  export * as Sources from './Tabs.stories.sources';
125
126
  //# sourceMappingURL=Tabs.stories.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Tabs.stories.d.ts","sourceRoot":"","sources":["../../../src/ui/Tabs/Tabs.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAO1B,wBAQkB;AAElB,eAAO,MAAM,OAAO,yBAuBnB,CAAC;AAEF,OAAO,KAAK,OAAO,MAAM,wBAAwB,CAAC"}
1
+ {"version":3,"file":"Tabs.stories.d.ts","sourceRoot":"","sources":["../../../src/ui/Tabs/Tabs.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAQ1B,wBAQkB;AAElB,eAAO,MAAM,OAAO,yBAuBnB,CAAC;AAIF,eAAO,MAAM,QAAQ,yBAiBpB,CAAC;AAEF,OAAO,KAAK,OAAO,MAAM,wBAAwB,CAAC"}
@@ -1,7 +1,8 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import React from 'react';
3
3
  import { Box } from '../../core/Box';
4
4
  import { Typography } from '../../core/Typography';
5
+ import { Button } from '../Button';
5
6
  import { Tabs } from './Tabs';
6
7
  import { useStyles } from './Tabs.styles';
7
8
  export default {
@@ -27,4 +28,15 @@ export const Example = () => {
27
28
  },
28
29
  ] }) }));
29
30
  };
31
+ // `value` rend les Tabs controles : le parent choisit l'onglet actif, par exemple depuis un
32
+ // bouton ou une carte cliquee, et le suit depuis `onChange` quand l'utilisateur clique un onglet.
33
+ export const Controle = () => {
34
+ const onglets = [
35
+ { label: 'Onglet 1', value: 'onglet-1', content: _jsx(Typography, { children: "Contenu de onglet 1" }) },
36
+ { label: 'Onglet 2', value: 'onglet-2', content: _jsx(Typography, { children: "Contenu de onglet 2" }) },
37
+ { label: 'Onglet 3', value: 'onglet-3', content: _jsx(Typography, { children: "Contenu de onglet 3" }) },
38
+ ];
39
+ const [ongletActif, setOngletActif] = React.useState('onglet-1');
40
+ return (_jsxs(Box, { width: '100%', gap: 16, children: [_jsxs(Box, { flexDirection: "row", gap: 8, children: [_jsx(Button, { title: "Aller \u00E0 l\u2019onglet 1", variant: "secondary", onPress: () => setOngletActif('onglet-1') }), _jsx(Button, { title: "Aller \u00E0 l\u2019onglet 3", variant: "secondary", onPress: () => setOngletActif('onglet-3') })] }), _jsx(Tabs, { value: ongletActif, onChange: index => setOngletActif(onglets[index].value), tabs: onglets })] }));
41
+ };
30
42
  export * as Sources from './Tabs.stories.sources';
@@ -1,6 +1,8 @@
1
1
  export declare const Example: () => string;
2
+ export declare const Controle: () => string;
2
3
  export declare const storySources: {
3
4
  readonly Example: () => string;
5
+ readonly Controle: () => string;
4
6
  };
5
7
  export type StorySourceName = keyof typeof storySources;
6
8
  //# sourceMappingURL=Tabs.stories.sources.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Tabs.stories.sources.d.ts","sourceRoot":"","sources":["../../../src/ui/Tabs/Tabs.stories.sources.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,OAAO,cAAk1B,CAAC;AAEv2B,eAAO,MAAM,YAAY;;CAEf,CAAC;AAEX,MAAM,MAAM,eAAe,GAAG,MAAM,OAAO,YAAY,CAAC"}
1
+ {"version":3,"file":"Tabs.stories.sources.d.ts","sourceRoot":"","sources":["../../../src/ui/Tabs/Tabs.stories.sources.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,OAAO,cAAk1B,CAAC;AAEv2B,eAAO,MAAM,QAAQ,cAA44B,CAAC;AAEl6B,eAAO,MAAM,YAAY;;;CAGf,CAAC;AAEX,MAAM,MAAM,eAAe,GAAG,MAAM,OAAO,YAAY,CAAC"}
@@ -1,6 +1,8 @@
1
1
  // This file is generated. Do not edit manually.
2
2
  // Source: src/ui/Tabs/Tabs.stories.tsx
3
3
  export const Example = () => "export const Example = () => {\n const [_activeTab, setActiveTab] = React.useState(0);\n\n return (\n <Box width={'100%'}>\n <Tabs\n defaultValue={'onglet-1'}\n onChange={setActiveTab}\n urlAnchorPrefix=\"tabs-story\"\n tabs={[\n { label: 'Onglet 1', value: 'onglet-1', content: <Typography>Contenu de onglet 1</Typography> },\n { label: 'Onglet 2', counter: 12, value: 'onglet-2', content: <Typography>Contenu de onglet 2</Typography> },\n { label: 'Onglet 3', value: 'onglet-3', content: <Typography>Contenu de onglet 3</Typography> },\n {\n label: 'Onglet 4',\n leading: 'Settings',\n value: 'onglet-4',\n content: <Typography>Contenu de onglet 4</Typography>,\n },\n ]}\n />\n </Box>\n );\n};";
4
+ export const Controle = () => "export const Controle = () => {\n const onglets = [\n { label: 'Onglet 1', value: 'onglet-1', content: <Typography>Contenu de onglet 1</Typography> },\n { label: 'Onglet 2', value: 'onglet-2', content: <Typography>Contenu de onglet 2</Typography> },\n { label: 'Onglet 3', value: 'onglet-3', content: <Typography>Contenu de onglet 3</Typography> },\n ];\n const [ongletActif, setOngletActif] = React.useState('onglet-1');\n\n return (\n <Box width={'100%'} gap={16}>\n <Box flexDirection=\"row\" gap={8}>\n <Button title=\"Aller à l’onglet 1\" variant=\"secondary\" onPress={() => setOngletActif('onglet-1')} />\n <Button title=\"Aller à l’onglet 3\" variant=\"secondary\" onPress={() => setOngletActif('onglet-3')} />\n </Box>\n <Tabs value={ongletActif} onChange={index => setOngletActif(onglets[index].value)} tabs={onglets} />\n </Box>\n );\n};";
4
5
  export const storySources = {
5
6
  Example,
7
+ Controle,
6
8
  };
@@ -1,6 +1,6 @@
1
1
  import { TabLayout } from 'tamagui';
2
2
  import { EtatDeLOnglet } from './Tabs.apparence';
3
- export declare const useTabsState: (initialValue: string, onChange?: (index: number) => void) => {
3
+ export declare const useTabsState: (initialValue: string, onChange?: (index: number) => void, value?: string) => {
4
4
  currentTab: string;
5
5
  etatDeLOnglet: (tabValue: string) => EtatDeLOnglet;
6
6
  setCurrentTab: (currentTab: string, index: number) => void;
@@ -1 +1 @@
1
- {"version":3,"file":"useTabsState.d.ts","sourceRoot":"","sources":["../../../src/ui/Tabs/useTabsState.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAgB,MAAM,SAAS,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAgBjD,eAAO,MAAM,YAAY,GAAI,cAAc,MAAM,EAAE,WAAW,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI;;8BA+BlD,MAAM,KAAG,aAAa;gCAtBpB,MAAM,SAAS,MAAM;oCAOjB,MAAM;4BAKd,MAAM,GAAG,IAAI;;CAuB7C,CAAC"}
1
+ {"version":3,"file":"useTabsState.d.ts","sourceRoot":"","sources":["../../../src/ui/Tabs/useTabsState.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAgB,MAAM,SAAS,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAkBjD,eAAO,MAAM,YAAY,GAAI,cAAc,MAAM,EAAE,WAAW,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,EAAE,QAAQ,MAAM;;8BAiClE,MAAM,KAAG,aAAa;gCAxBpB,MAAM,SAAS,MAAM;oCAOjB,MAAM;4BAKd,MAAM,GAAG,IAAI;;CAyB7C,CAAC"}
@@ -5,7 +5,9 @@ import React from 'react';
5
5
  //
6
6
  // Le focus n'en fait pas partie : il est rendu par la regle CSS `:focus-visible` du theme, la
7
7
  // seule qui distingue le clavier de la souris. Suivi en React, il s'affichait aussi au clic.
8
- export const useTabsState = (initialValue, onChange) => {
8
+ // `value`, quand le parent la donne, fait foi sur l'onglet retenu en interne : `Tabs` est alors
9
+ // controle, et c'est au parent de la mettre a jour depuis `onChange`.
10
+ export const useTabsState = (initialValue, onChange, value) => {
9
11
  const [tabState, setTabState] = React.useState({
10
12
  activeAt: null,
11
13
  currentTab: initialValue,
@@ -32,12 +34,13 @@ export const useTabsState = (initialValue, onChange) => {
32
34
  setTabState(state => ({ ...state, intentAt: layout }));
33
35
  }
34
36
  };
37
+ const currentTab = value ?? tabState.currentTab;
35
38
  const etatDeLOnglet = (tabValue) => ({
36
- actif: tabState.currentTab === tabValue,
39
+ actif: currentTab === tabValue,
37
40
  survole: tabState.hoverTab === tabValue,
38
41
  });
39
42
  return {
40
- currentTab: tabState.currentTab,
43
+ currentTab,
41
44
  etatDeLOnglet,
42
45
  setCurrentTab,
43
46
  restoreCurrentTab,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alveole/components",
3
- "version": "2.0.0-alpha.14",
3
+ "version": "2.0.0-alpha.16",
4
4
  "description": "Shared UI components.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -40,7 +40,7 @@
40
40
  "expo-asset": "57.0.20",
41
41
  "expo-document-picker": "57.0.3",
42
42
  "expo-image-picker": "57.0.20",
43
- "expo-in-app-updates": "0.12.0",
43
+ "expo-in-app-updates": "0.13.0",
44
44
  "expo-linear-gradient": "57.0.2",
45
45
  "expo-modules-core": "57.0.23",
46
46
  "expo-router": "57.0.28",
@@ -1,9 +0,0 @@
1
- .alveole-price-input::-webkit-inner-spin-button,
2
- .alveole-price-input::-webkit-outer-spin-button {
3
- -webkit-appearance: none;
4
- margin: 0;
5
- }
6
-
7
- .alveole-price-input {
8
- -moz-appearance: textfield;
9
- }