@planningcenter/tapestry 4.15.0-rc.0 → 4.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/DataTable/ActiveFilterInstance.d.ts +6 -0
- package/dist/components/DataTable/ActiveFilterInstance.d.ts.map +1 -1
- package/dist/components/DataTable/ActiveFilterInstance.js +13 -0
- package/dist/components/DataTable/ActiveFilterInstance.js.map +1 -1
- package/dist/components/DataTable/CollectionEditorsLazy.d.ts +1 -1
- package/dist/components/DataTable/CollectionEditorsLazy.d.ts.map +1 -1
- package/dist/components/DataTable/CollectionEditorsLazy.js +2 -2
- package/dist/components/DataTable/CollectionEditorsLazy.js.map +1 -1
- package/dist/components/DataTable/CollectionEditorsShared.d.ts +4 -8
- package/dist/components/DataTable/CollectionEditorsShared.d.ts.map +1 -1
- package/dist/components/DataTable/CollectionEditorsShared.js +2 -2
- package/dist/components/DataTable/CollectionEditorsShared.js.map +1 -1
- package/dist/components/DataTable/CollectionEditorsStatic.d.ts +4 -5
- package/dist/components/DataTable/CollectionEditorsStatic.d.ts.map +1 -1
- package/dist/components/DataTable/CollectionEditorsStatic.js +9 -9
- package/dist/components/DataTable/CollectionEditorsStatic.js.map +1 -1
- package/dist/components/DataTable/DataTable.d.ts +27 -5
- package/dist/components/DataTable/DataTable.d.ts.map +1 -1
- package/dist/components/DataTable/DataTable.js +13 -2
- package/dist/components/DataTable/DataTable.js.map +1 -1
- package/dist/components/DataTable/DataTableRow.d.ts +2 -0
- package/dist/components/DataTable/DataTableRow.d.ts.map +1 -1
- package/dist/components/DataTable/DataTableRow.js.map +1 -1
- package/dist/components/DataTable/RowActions.d.ts +7 -3
- package/dist/components/DataTable/RowActions.d.ts.map +1 -1
- package/dist/components/DataTable/RowActions.js +7 -2
- package/dist/components/DataTable/RowActions.js.map +1 -1
- package/dist/components/DataTable/collectionFilter.js +1 -1
- package/dist/components/DataTable/collectionFilter.js.map +1 -1
- package/dist/components/DataTable/dateFilter.js +5 -5
- package/dist/components/DataTable/dateFilter.js.map +1 -1
- package/dist/components/DataTable/dayFilter.js +4 -3
- package/dist/components/DataTable/dayFilter.js.map +1 -1
- package/dist/components/DataTable/index.d.ts +1 -1
- package/dist/components/DataTable/index.d.ts.map +1 -1
- package/dist/components/DataTable/numberFilter.js +3 -2
- package/dist/components/DataTable/numberFilter.js.map +1 -1
- package/dist/components/DataTable/scopedFilter.js +5 -1
- package/dist/components/DataTable/scopedFilter.js.map +1 -1
- package/dist/components/DataTable/textFilter.js +1 -1
- package/dist/components/DataTable/textFilter.js.map +1 -1
- package/dist/components/button/ActionsDropdownIconButton.js +2 -2
- package/dist/components/button/ActionsDropdownIconButton.js.map +1 -1
- package/dist/components/button/BaseButton.js +4 -4
- package/dist/components/button/BaseButton.js.map +1 -1
- package/dist/components/button/Button.js +2 -2
- package/dist/components/button/Button.js.map +1 -1
- package/dist/components/button/DropdownButton.js +3 -3
- package/dist/components/button/DropdownButton.js.map +1 -1
- package/dist/components/button/DropdownIconButton.js +2 -2
- package/dist/components/button/DropdownIconButton.js.map +1 -1
- package/dist/components/button/IconButton.js +4 -4
- package/dist/components/button/IconButton.js.map +1 -1
- package/dist/components/button/LoadingButton.js +2 -2
- package/dist/components/button/LoadingButton.js.map +1 -1
- package/dist/components/button/PageHeaderActionsDropdownButton.js +3 -3
- package/dist/components/button/PageHeaderActionsDropdownButton.js.map +1 -1
- package/dist/components/combo-box/ComboBox.js +31 -31
- package/dist/components/combo-box/ComboBox.js.map +1 -1
- package/dist/components/date-picker/DatePicker.js +42 -42
- package/dist/components/date-picker/DatePicker.js.map +1 -1
- package/dist/components/dropdown/Dropdown.js +13 -13
- package/dist/components/dropdown/Dropdown.js.map +1 -1
- package/dist/components/field/Field.js +5 -5
- package/dist/components/field/Field.js.map +1 -1
- package/dist/components/internal/LoadingSpinner.js +2 -2
- package/dist/components/internal/LoadingSpinner.js.map +1 -1
- package/dist/components/internal/tooltip/Tooltip.js +8 -8
- package/dist/components/internal/tooltip/Tooltip.js.map +1 -1
- package/dist/components/link/BaseLink.js +3 -3
- package/dist/components/link/BaseLink.js.map +1 -1
- package/dist/components/link/IconLink.js +4 -4
- package/dist/components/link/IconLink.js.map +1 -1
- package/dist/components/link/Link.js +2 -2
- package/dist/components/link/Link.js.map +1 -1
- package/dist/components/number-stepper/NumberStepper.js +11 -11
- package/dist/components/number-stepper/NumberStepper.js.map +1 -1
- package/dist/components/page-header/PageHeader.js +10 -10
- package/dist/components/page-header/PageHeader.js.map +1 -1
- package/dist/components/search-input/SearchInput.js +6 -6
- package/dist/components/search-input/SearchInput.js.map +1 -1
- package/dist/components/select/Select.js +6 -6
- package/dist/components/select/Select.js.map +1 -1
- package/dist/components/select/SelectNative.js +6 -6
- package/dist/components/select/SelectNative.js.map +1 -1
- package/dist/components/select/SelectOptions.js +9 -9
- package/dist/components/select/SelectOptions.js.map +1 -1
- package/dist/components/select/SelectPopover.js +14 -14
- package/dist/components/select/SelectPopover.js.map +1 -1
- package/dist/components/sidenav/Sidenav.js +6 -6
- package/dist/components/sidenav/Sidenav.js.map +1 -1
- package/dist/components/sidenav/SidenavItem.js +2 -2
- package/dist/components/sidenav/SidenavItem.js.map +1 -1
- package/dist/components/sidenav/SidenavSection.js +7 -7
- package/dist/components/sidenav/SidenavSection.js.map +1 -1
- package/dist/components/sidenav/private/SidenavResponsiveHeader.js +6 -6
- package/dist/components/sidenav/private/SidenavResponsiveHeader.js.map +1 -1
- package/dist/components/sidenav/private/withSlotChildrenAsActions.js +7 -7
- package/dist/components/sidenav/private/withSlotChildrenAsActions.js.map +1 -1
- package/dist/components/time-field/TimeField.js +8 -8
- package/dist/components/time-field/TimeField.js.map +1 -1
- package/dist/packages/tapestry-render/dist/buildComponent-DzY2PDMT.js +4 -4
- package/dist/packages/tapestry-render/dist/buildComponent-DzY2PDMT.js.map +1 -1
- package/dist/reactRender.css +696 -657
- package/dist/reactRender.css.map +1 -1
- package/dist/reactRenderLegacy.css +696 -657
- package/dist/reactRenderLegacy.css.map +1 -1
- package/dist/tapestryMount.css +696 -657
- package/dist/tapestryMount.css.map +1 -1
- package/dist/tapestryMountLegacy.css +696 -657
- package/dist/tapestryMountLegacy.css.map +1 -1
- package/dist/unstable.css +45 -6
- package/dist/unstable.css.map +1 -1
- package/dist/utilities/Icon.js +2 -2
- package/dist/utilities/Icon.js.map +1 -1
- package/dist/utilities/buttonLinkShared.js +2 -2
- package/dist/utilities/buttonLinkShared.js.map +1 -1
- package/dist/utilities/locale.js +34 -5
- package/dist/utilities/locale.js.map +1 -1
- package/docs/components/DataTable.md +23 -5
- package/package.json +3 -3
package/dist/utilities/Icon.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import general from '@planningcenter/icons/sprites/general.svg';
|
|
2
2
|
import { Symbol } from '@planningcenter/icons/symbol';
|
|
3
|
-
import
|
|
3
|
+
import React__default from 'react';
|
|
4
4
|
|
|
5
5
|
// Registry of valid sprite sheet collections
|
|
6
6
|
// We will add the other collections here when we / if we make this more publicly available
|
|
@@ -16,7 +16,7 @@ function Icon({ symbol: s, className, ...props }) {
|
|
|
16
16
|
throw new Error(`Unknown icon collection: ${collection}. Available collections: ${Object.keys(validCollections).join(", ")}`);
|
|
17
17
|
}
|
|
18
18
|
const spriteSheet = validCollections[collection];
|
|
19
|
-
return (
|
|
19
|
+
return (React__default.createElement(Symbol, { symbol: `${spriteSheet}#${symbol}`, className: className, ...props }));
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
export { Icon as default };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Icon.js","sources":["../../src/utilities/Icon.tsx"],"sourcesContent":["import general from \"@planningcenter/icons/sprites/general.svg\"\nimport { Symbol } from \"@planningcenter/icons/symbol\"\nimport React, { HTMLAttributes } from \"react\"\n\n// Registry of valid sprite sheet collections\n// We will add the other collections here when we / if we make this more publicly available\nconst validCollections = {\n general,\n} as const\n\ntype CollectionName = keyof typeof validCollections\n\nfunction isValidCollection(collection: string): collection is CollectionName {\n return collection in validCollections\n}\n\nfunction Icon({\n symbol: s,\n className,\n ...props\n}: { symbol: string } & HTMLAttributes<SVGSVGElement>) {\n const [collection, symbol] = s.split(\"#\") as [CollectionName, string]\n\n if (!isValidCollection(collection)) {\n throw new Error(\n `Unknown icon collection: ${collection}. Available collections: ${Object.keys(validCollections).join(\", \")}`\n )\n }\n\n const spriteSheet = validCollections[collection]\n return (\n <Symbol\n symbol={`${spriteSheet}#${symbol}`}\n className={className}\n {...props}\n />\n )\n}\n\nexport default Icon\n"],"names":[],"mappings":";;;;AAIA;AACA;AACA,MAAM,gBAAgB,GAAG;IACvB,OAAO;CACC;AAIV,SAAS,iBAAiB,CAAC,UAAkB,EAAA;IAC3C,OAAO,UAAU,IAAI,gBAAgB;AACvC;AAEA,SAAS,IAAI,CAAC,EACZ,MAAM,EAAE,CAAC,EACT,SAAS,EACT,GAAG,KAAK,EAC2C,EAAA;AACnD,IAAA,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,GAAG,CAA6B;AAErE,IAAA,IAAI,CAAC,iBAAiB,CAAC,UAAU,CAAC,EAAE;AAClC,QAAA,MAAM,IAAI,KAAK,CACb,4BAA4B,UAAU,CAAA,yBAAA,EAA4B,MAAM,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA,CAAE,CAC7G;IACH;AAEA,IAAA,MAAM,WAAW,GAAG,gBAAgB,CAAC,UAAU,CAAC;AAChD,IAAA,
|
|
1
|
+
{"version":3,"file":"Icon.js","sources":["../../src/utilities/Icon.tsx"],"sourcesContent":["import general from \"@planningcenter/icons/sprites/general.svg\"\nimport { Symbol } from \"@planningcenter/icons/symbol\"\nimport React, { HTMLAttributes } from \"react\"\n\n// Registry of valid sprite sheet collections\n// We will add the other collections here when we / if we make this more publicly available\nconst validCollections = {\n general,\n} as const\n\ntype CollectionName = keyof typeof validCollections\n\nfunction isValidCollection(collection: string): collection is CollectionName {\n return collection in validCollections\n}\n\nfunction Icon({\n symbol: s,\n className,\n ...props\n}: { symbol: string } & HTMLAttributes<SVGSVGElement>) {\n const [collection, symbol] = s.split(\"#\") as [CollectionName, string]\n\n if (!isValidCollection(collection)) {\n throw new Error(\n `Unknown icon collection: ${collection}. Available collections: ${Object.keys(validCollections).join(\", \")}`\n )\n }\n\n const spriteSheet = validCollections[collection]\n return (\n <Symbol\n symbol={`${spriteSheet}#${symbol}`}\n className={className}\n {...props}\n />\n )\n}\n\nexport default Icon\n"],"names":["React"],"mappings":";;;;AAIA;AACA;AACA,MAAM,gBAAgB,GAAG;IACvB,OAAO;CACC;AAIV,SAAS,iBAAiB,CAAC,UAAkB,EAAA;IAC3C,OAAO,UAAU,IAAI,gBAAgB;AACvC;AAEA,SAAS,IAAI,CAAC,EACZ,MAAM,EAAE,CAAC,EACT,SAAS,EACT,GAAG,KAAK,EAC2C,EAAA;AACnD,IAAA,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,GAAG,CAA6B;AAErE,IAAA,IAAI,CAAC,iBAAiB,CAAC,UAAU,CAAC,EAAE;AAClC,QAAA,MAAM,IAAI,KAAK,CACb,4BAA4B,UAAU,CAAA,yBAAA,EAA4B,MAAM,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA,CAAE,CAC7G;IACH;AAEA,IAAA,MAAM,WAAW,GAAG,gBAAgB,CAAC,UAAU,CAAC;AAChD,IAAA,QACEA,cAAA,CAAA,aAAA,CAAC,MAAM,IACL,MAAM,EAAE,GAAG,WAAW,CAAA,CAAA,EAAI,MAAM,CAAA,CAAE,EAClC,SAAS,EAAE,SAAS,KAChB,KAAK,EAAA,CACT;AAEN;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React__default from 'react';
|
|
2
2
|
|
|
3
3
|
const COMPONENT_KIND_CLASS_MAP = {
|
|
4
4
|
delete: "tds-btn--delete",
|
|
@@ -25,7 +25,7 @@ const COMPONENT_SIZE_CLASS_MAP = {
|
|
|
25
25
|
xs: "tds-btn--xs",
|
|
26
26
|
};
|
|
27
27
|
function wrapStringWithSpan(content) {
|
|
28
|
-
return typeof content === "string" ?
|
|
28
|
+
return typeof content === "string" ? React__default.createElement("span", null, content) : content;
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
export { COMPONENT_KIND_CLASS_MAP, COMPONENT_SIZE_CLASS_MAP, wrapStringWithSpan };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buttonLinkShared.js","sources":["../../src/utilities/buttonLinkShared.tsx"],"sourcesContent":["import React from \"react\"\n\nexport const COMPONENT_KIND_CLASS_MAP = {\n delete: \"tds-btn--delete\",\n ghost: \"tds-btn--ghost-neutral\",\n \"ghost-delete\": \"tds-btn--ghost-delete\",\n \"ghost-interaction\": \"tds-btn--ghost-interaction\",\n \"inline-text\": \"tds-btn--inline-text\",\n neutral: \"tds-btn--neutral\",\n \"neutral-inline\": \"tds-btn--neutral-inline\",\n pill: \"tds-btn--pill\",\n primary: \"tds-btn--interaction\",\n \"primary-page-header\": \"tds-btn--primary-page-header\",\n secondary: \"tds-btn--outline-neutral\",\n \"secondary-delete\": \"tds-btn--outline-delete\",\n \"secondary-interaction\": \"tds-btn--outline-interaction\",\n \"secondary-page-header\": \"tds-btn--secondary-page-header\",\n \"staff-only\": \"tds-btn--staff-only\",\n} as const\n\nexport const COMPONENT_SIZE_CLASS_MAP = {\n lg: \"tds-btn--lg\",\n md: \"\",\n sm: \"tds-btn--sm\",\n xl: \"tds-btn--xl\",\n xs: \"tds-btn--xs\",\n} as const\n\nexport type ComponentSize = keyof typeof COMPONENT_SIZE_CLASS_MAP\n\nexport type ComponentKind = keyof typeof COMPONENT_KIND_CLASS_MAP\n\nexport interface BaseComponentProps {\n /** Whether the component should take the full width of its container. */\n fullWidth?: boolean\n /** The visual style of the component. */\n kind?: ComponentKind\n /** A React node to display before the component's content. Set via story args for non-primitive values. */\n prefix?: React.ReactNode\n /** The size of the component. */\n size?: ComponentSize\n /** A React node to display after the component's content. Set via story args for non-primitive values. */\n suffix?: React.ReactNode\n}\n\nexport function wrapStringWithSpan(content: React.ReactNode): React.ReactNode {\n return typeof content === \"string\" ? <span>{content}</span> : content\n}\n"],"names":[],"mappings":";;AAEO,MAAM,wBAAwB,GAAG;AACtC,IAAA,MAAM,EAAE,iBAAiB;AACzB,IAAA,KAAK,EAAE,wBAAwB;AAC/B,IAAA,cAAc,EAAE,uBAAuB;AACvC,IAAA,mBAAmB,EAAE,4BAA4B;AACjD,IAAA,aAAa,EAAE,sBAAsB;AACrC,IAAA,OAAO,EAAE,kBAAkB;AAC3B,IAAA,gBAAgB,EAAE,yBAAyB;AAC3C,IAAA,IAAI,EAAE,eAAe;AACrB,IAAA,OAAO,EAAE,sBAAsB;AAC/B,IAAA,qBAAqB,EAAE,8BAA8B;AACrD,IAAA,SAAS,EAAE,0BAA0B;AACrC,IAAA,kBAAkB,EAAE,yBAAyB;AAC7C,IAAA,uBAAuB,EAAE,8BAA8B;AACvD,IAAA,uBAAuB,EAAE,gCAAgC;AACzD,IAAA,YAAY,EAAE,qBAAqB;;AAG9B,MAAM,wBAAwB,GAAG;AACtC,IAAA,EAAE,EAAE,aAAa;AACjB,IAAA,EAAE,EAAE,EAAE;AACN,IAAA,EAAE,EAAE,aAAa;AACjB,IAAA,EAAE,EAAE,aAAa;AACjB,IAAA,EAAE,EAAE,aAAa;;AAoBb,SAAU,kBAAkB,CAAC,OAAwB,EAAA;AACzD,IAAA,OAAO,OAAO,OAAO,KAAK,QAAQ,
|
|
1
|
+
{"version":3,"file":"buttonLinkShared.js","sources":["../../src/utilities/buttonLinkShared.tsx"],"sourcesContent":["import React from \"react\"\n\nexport const COMPONENT_KIND_CLASS_MAP = {\n delete: \"tds-btn--delete\",\n ghost: \"tds-btn--ghost-neutral\",\n \"ghost-delete\": \"tds-btn--ghost-delete\",\n \"ghost-interaction\": \"tds-btn--ghost-interaction\",\n \"inline-text\": \"tds-btn--inline-text\",\n neutral: \"tds-btn--neutral\",\n \"neutral-inline\": \"tds-btn--neutral-inline\",\n pill: \"tds-btn--pill\",\n primary: \"tds-btn--interaction\",\n \"primary-page-header\": \"tds-btn--primary-page-header\",\n secondary: \"tds-btn--outline-neutral\",\n \"secondary-delete\": \"tds-btn--outline-delete\",\n \"secondary-interaction\": \"tds-btn--outline-interaction\",\n \"secondary-page-header\": \"tds-btn--secondary-page-header\",\n \"staff-only\": \"tds-btn--staff-only\",\n} as const\n\nexport const COMPONENT_SIZE_CLASS_MAP = {\n lg: \"tds-btn--lg\",\n md: \"\",\n sm: \"tds-btn--sm\",\n xl: \"tds-btn--xl\",\n xs: \"tds-btn--xs\",\n} as const\n\nexport type ComponentSize = keyof typeof COMPONENT_SIZE_CLASS_MAP\n\nexport type ComponentKind = keyof typeof COMPONENT_KIND_CLASS_MAP\n\nexport interface BaseComponentProps {\n /** Whether the component should take the full width of its container. */\n fullWidth?: boolean\n /** The visual style of the component. */\n kind?: ComponentKind\n /** A React node to display before the component's content. Set via story args for non-primitive values. */\n prefix?: React.ReactNode\n /** The size of the component. */\n size?: ComponentSize\n /** A React node to display after the component's content. Set via story args for non-primitive values. */\n suffix?: React.ReactNode\n}\n\nexport function wrapStringWithSpan(content: React.ReactNode): React.ReactNode {\n return typeof content === \"string\" ? <span>{content}</span> : content\n}\n"],"names":["React"],"mappings":";;AAEO,MAAM,wBAAwB,GAAG;AACtC,IAAA,MAAM,EAAE,iBAAiB;AACzB,IAAA,KAAK,EAAE,wBAAwB;AAC/B,IAAA,cAAc,EAAE,uBAAuB;AACvC,IAAA,mBAAmB,EAAE,4BAA4B;AACjD,IAAA,aAAa,EAAE,sBAAsB;AACrC,IAAA,OAAO,EAAE,kBAAkB;AAC3B,IAAA,gBAAgB,EAAE,yBAAyB;AAC3C,IAAA,IAAI,EAAE,eAAe;AACrB,IAAA,OAAO,EAAE,sBAAsB;AAC/B,IAAA,qBAAqB,EAAE,8BAA8B;AACrD,IAAA,SAAS,EAAE,0BAA0B;AACrC,IAAA,kBAAkB,EAAE,yBAAyB;AAC7C,IAAA,uBAAuB,EAAE,8BAA8B;AACvD,IAAA,uBAAuB,EAAE,gCAAgC;AACzD,IAAA,YAAY,EAAE,qBAAqB;;AAG9B,MAAM,wBAAwB,GAAG;AACtC,IAAA,EAAE,EAAE,aAAa;AACjB,IAAA,EAAE,EAAE,EAAE;AACN,IAAA,EAAE,EAAE,aAAa;AACjB,IAAA,EAAE,EAAE,aAAa;AACjB,IAAA,EAAE,EAAE,aAAa;;AAoBb,SAAU,kBAAkB,CAAC,OAAwB,EAAA;AACzD,IAAA,OAAO,OAAO,OAAO,KAAK,QAAQ,GAAGA,cAAA,CAAA,aAAA,CAAA,MAAA,EAAA,IAAA,EAAO,OAAO,CAAQ,GAAG,OAAO;AACvE;;;;"}
|
package/dist/utilities/locale.js
CHANGED
|
@@ -1,10 +1,39 @@
|
|
|
1
|
-
import { createContext, useContext } from 'react';
|
|
2
|
-
import { useLocale } from 'react-aria/I18nProvider';
|
|
1
|
+
import React__default, { createContext, useContext } from 'react';
|
|
2
|
+
import { useLocale, I18nProvider as I18nProvider$1 } from 'react-aria/I18nProvider';
|
|
3
3
|
|
|
4
|
+
let globalLocale;
|
|
5
|
+
/**
|
|
6
|
+
* Sets the locale DataTable, DatePicker and TimeField format dates with,
|
|
7
|
+
* app-wide. Call once at boot, before the first render; later calls don't
|
|
8
|
+
* re-render mounted components. An `I18nProvider` overrides it for its
|
|
9
|
+
* subtree. Pass `undefined` to fall back to the browser locale.
|
|
10
|
+
*/
|
|
11
|
+
function setLocale(locale) {
|
|
12
|
+
globalLocale = locale;
|
|
13
|
+
}
|
|
4
14
|
function canonicalLocale(locale) {
|
|
5
|
-
|
|
15
|
+
if (!locale)
|
|
16
|
+
return undefined;
|
|
17
|
+
try {
|
|
18
|
+
return Intl.getCanonicalLocales(locale)[0];
|
|
19
|
+
}
|
|
20
|
+
catch {
|
|
21
|
+
return undefined;
|
|
22
|
+
}
|
|
6
23
|
}
|
|
7
24
|
const LocaleContext = createContext(undefined);
|
|
25
|
+
/**
|
|
26
|
+
* Sets the locale for a subtree, overriding `setLocale`. Use this instead of
|
|
27
|
+
* importing `I18nProvider` from `react-aria`: Tapestry can't see a provider
|
|
28
|
+
* from a separately installed copy. An invalid locale is ignored.
|
|
29
|
+
*/
|
|
30
|
+
function I18nProvider({ children, locale }) {
|
|
31
|
+
const validLocale = canonicalLocale(locale);
|
|
32
|
+
if (!validLocale)
|
|
33
|
+
return React__default.createElement(React__default.Fragment, null, children);
|
|
34
|
+
return (React__default.createElement(LocaleContext.Provider, { value: validLocale },
|
|
35
|
+
React__default.createElement(I18nProvider$1, { locale: validLocale }, children)));
|
|
36
|
+
}
|
|
8
37
|
/**
|
|
9
38
|
* Resolves the nearest `I18nProvider`, then `setLocale`, then the browser
|
|
10
39
|
* locale. An invalid locale falls through to the next one.
|
|
@@ -12,8 +41,8 @@ const LocaleContext = createContext(undefined);
|
|
|
12
41
|
function useTapestryLocale() {
|
|
13
42
|
const providerLocale = useContext(LocaleContext);
|
|
14
43
|
const { locale: defaultLocale } = useLocale();
|
|
15
|
-
return providerLocale ?? canonicalLocale() ?? defaultLocale;
|
|
44
|
+
return providerLocale ?? canonicalLocale(globalLocale) ?? defaultLocale;
|
|
16
45
|
}
|
|
17
46
|
|
|
18
|
-
export { useTapestryLocale };
|
|
47
|
+
export { I18nProvider, setLocale, useTapestryLocale };
|
|
19
48
|
//# sourceMappingURL=locale.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"locale.js","sources":["../../src/utilities/locale.tsx"],"sourcesContent":["import React, { createContext, type ReactNode, useContext } from \"react\"\nimport {\n I18nProvider as AriaI18nProvider,\n useLocale,\n} from \"react-aria/I18nProvider\"\n\nlet globalLocale: string | undefined\n\n/**\n * Sets the locale DataTable, DatePicker and TimeField format dates with,\n * app-wide. Call once at boot, before the first render; later calls don't\n * re-render mounted components. An `I18nProvider` overrides it for its\n * subtree. Pass `undefined` to fall back to the browser locale.\n */\nexport function setLocale(locale: string | undefined) {\n globalLocale = locale\n}\n\nfunction canonicalLocale(locale: string | undefined) {\n if (!locale) return undefined\n try {\n return Intl.getCanonicalLocales(locale)[0]\n } catch {\n return undefined\n }\n}\n\nconst LocaleContext = createContext<string | undefined>(undefined)\n\nexport interface I18nProviderProps {\n children: ReactNode\n /** A BCP 47 language tag, e.g. `en-GB`. */\n locale: string\n}\n\n/**\n * Sets the locale for a subtree, overriding `setLocale`. Use this instead of\n * importing `I18nProvider` from `react-aria`: Tapestry can't see a provider\n * from a separately installed copy. An invalid locale is ignored.\n */\nexport function I18nProvider({ children, locale }: I18nProviderProps) {\n const validLocale = canonicalLocale(locale)\n if (!validLocale) return <>{children}</>\n\n return (\n <LocaleContext.Provider value={validLocale}>\n <AriaI18nProvider locale={validLocale}>{children}</AriaI18nProvider>\n </LocaleContext.Provider>\n )\n}\n\n/**\n * Resolves the nearest `I18nProvider`, then `setLocale`, then the browser\n * locale. An invalid locale falls through to the next one.\n */\nexport function useTapestryLocale() {\n const providerLocale = useContext(LocaleContext)\n const { locale: defaultLocale } = useLocale()\n return providerLocale ?? canonicalLocale(globalLocale) ?? defaultLocale\n}\n"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"locale.js","sources":["../../src/utilities/locale.tsx"],"sourcesContent":["import React, { createContext, type ReactNode, useContext } from \"react\"\nimport {\n I18nProvider as AriaI18nProvider,\n useLocale,\n} from \"react-aria/I18nProvider\"\n\nlet globalLocale: string | undefined\n\n/**\n * Sets the locale DataTable, DatePicker and TimeField format dates with,\n * app-wide. Call once at boot, before the first render; later calls don't\n * re-render mounted components. An `I18nProvider` overrides it for its\n * subtree. Pass `undefined` to fall back to the browser locale.\n */\nexport function setLocale(locale: string | undefined) {\n globalLocale = locale\n}\n\nfunction canonicalLocale(locale: string | undefined) {\n if (!locale) return undefined\n try {\n return Intl.getCanonicalLocales(locale)[0]\n } catch {\n return undefined\n }\n}\n\nconst LocaleContext = createContext<string | undefined>(undefined)\n\nexport interface I18nProviderProps {\n children: ReactNode\n /** A BCP 47 language tag, e.g. `en-GB`. */\n locale: string\n}\n\n/**\n * Sets the locale for a subtree, overriding `setLocale`. Use this instead of\n * importing `I18nProvider` from `react-aria`: Tapestry can't see a provider\n * from a separately installed copy. An invalid locale is ignored.\n */\nexport function I18nProvider({ children, locale }: I18nProviderProps) {\n const validLocale = canonicalLocale(locale)\n if (!validLocale) return <>{children}</>\n\n return (\n <LocaleContext.Provider value={validLocale}>\n <AriaI18nProvider locale={validLocale}>{children}</AriaI18nProvider>\n </LocaleContext.Provider>\n )\n}\n\n/**\n * Resolves the nearest `I18nProvider`, then `setLocale`, then the browser\n * locale. An invalid locale falls through to the next one.\n */\nexport function useTapestryLocale() {\n const providerLocale = useContext(LocaleContext)\n const { locale: defaultLocale } = useLocale()\n return providerLocale ?? canonicalLocale(globalLocale) ?? defaultLocale\n}\n"],"names":["React","AriaI18nProvider"],"mappings":";;;AAMA,IAAI,YAAgC;AAEpC;;;;;AAKG;AACG,SAAU,SAAS,CAAC,MAA0B,EAAA;IAClD,YAAY,GAAG,MAAM;AACvB;AAEA,SAAS,eAAe,CAAC,MAA0B,EAAA;AACjD,IAAA,IAAI,CAAC,MAAM;AAAE,QAAA,OAAO,SAAS;AAC7B,IAAA,IAAI;QACF,OAAO,IAAI,CAAC,mBAAmB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;IAC5C;AAAE,IAAA,MAAM;AACN,QAAA,OAAO,SAAS;IAClB;AACF;AAEA,MAAM,aAAa,GAAG,aAAa,CAAqB,SAAS,CAAC;AAQlE;;;;AAIG;SACa,YAAY,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAqB,EAAA;AAClE,IAAA,MAAM,WAAW,GAAG,eAAe,CAAC,MAAM,CAAC;AAC3C,IAAA,IAAI,CAAC,WAAW;QAAE,OAAOA,cAAA,CAAA,aAAA,CAAAA,cAAA,CAAA,QAAA,EAAA,IAAA,EAAG,QAAQ,CAAI;IAExC,QACEA,6BAAC,aAAa,CAAC,QAAQ,EAAA,EAAC,KAAK,EAAE,WAAW,EAAA;QACxCA,cAAA,CAAA,aAAA,CAACC,cAAgB,EAAA,EAAC,MAAM,EAAE,WAAW,IAAG,QAAQ,CAAoB,CAC7C;AAE7B;AAEA;;;AAGG;SACa,iBAAiB,GAAA;AAC/B,IAAA,MAAM,cAAc,GAAG,UAAU,CAAC,aAAa,CAAC;IAChD,MAAM,EAAE,MAAM,EAAE,aAAa,EAAE,GAAG,SAAS,EAAE;IAC7C,OAAO,cAAc,IAAI,eAAe,CAAC,YAAY,CAAC,IAAI,aAAa;AACzE;;;;"}
|
|
@@ -10,7 +10,7 @@ use_when:
|
|
|
10
10
|
## Rules
|
|
11
11
|
|
|
12
12
|
- **Do** show every filter that narrows the results as a filter chip, including the filters a default view applies, so people can see why rows are missing.
|
|
13
|
-
- **Do**
|
|
13
|
+
- **Do** Give a table that opens filtered a system view with the id `"initial"` that holds those filters, like “Active”. It’s the default view, and after Clear filters it’s the one-click way back.
|
|
14
14
|
- **Do** Make the row the way to open its item (`getRowLink` or `onRowClick`). Put every other action in `rowActions`.
|
|
15
15
|
- **Do** Name the records with `resultNoun`, like `["person", "people"]`. It labels the count (“1,240 people”), the table and the pagination for screen readers.
|
|
16
16
|
- **Do** Write an `emptyState` that says why the table is empty and, when it helps, how to change that.
|
|
@@ -73,12 +73,14 @@ A view is a named set of filters, sort and visible columns, so people can get ba
|
|
|
73
73
|
>
|
|
74
74
|
> Same thing. Design calls them system views; the prop, the code and the API docs call them static views.
|
|
75
75
|
|
|
76
|
-
- **“All”
|
|
77
|
-
- **Default views can have filters.** When most people come to the table for a subset, make that subset the default rather than making everyone filter it each visit.
|
|
78
|
-
- **
|
|
76
|
+
- **“All” comes first unless the table opens filtered.** The table adds an “All” view with the id `"initial"`, the default view, so the full set is one click away. A system view with the id `"initial"` replaces it.
|
|
77
|
+
- **Default views can have filters.** When most people come to the table for a subset, like active people or current background checks, make that subset the default rather than making everyone filter it each visit.
|
|
78
|
+
- **A table that opens filtered needs a system view for those filters.** Add them to `staticViews` as a view with the id `"initial"`. It replaces “All” and is the default view without setting `initialDefaultViewId`. Its filters show as chips like any other filters. Clear filters removes them all to show the full set; it doesn’t go back to the defaults, so this view is how people get back in one click. Add it even when it’s the only system view. Without it, getting back means adding each filter again.
|
|
79
|
+
- **Name the default view for what it shows,** like “Active” or “Current”, not “Default view” or “Initial”. Each product picks the name that fits its records.
|
|
79
80
|
- **Load the default view’s results on first render.** The table doesn’t apply the default view; it only selects it when the first `activeFilters`, sort and visible columns match it. Load the page with the default view’s filters so the view and the rows agree.
|
|
80
81
|
- **Name views for what they show,** 1–3 words in sentence case, like “Active” or “Joined this year”. Don’t name them for who uses them or what they’re for; people pick a view by what they expect to see.
|
|
81
82
|
- **Keep system views few.** Add one when many people need the same subset. Leave narrower subsets to saved views, so the views bar stays short.
|
|
83
|
+
- **A changed system view isn’t selected.** People can’t update or discard changes to a system view, so once its filters, sort or columns change, the views bar stops showing it as selected. Picking it again puts its filters back.
|
|
82
84
|
|
|
83
85
|
How people manage saved views:
|
|
84
86
|
|
|
@@ -109,9 +111,25 @@ How people manage saved views:
|
|
|
109
111
|
| Open a related item, like a household’s primary contact | A row action, or a link on the opened item |
|
|
110
112
|
|
|
111
113
|
- Prefer `getRowLink` over `onRowClick` when the item has its own page, so people can open it in a new tab.
|
|
112
|
-
- One row action shows as a button. Two or more go in a menu. Put destructive actions last, with `kind="destructive"`.
|
|
114
|
+
- One row action shows as a button. Two or more go in a menu on every row, even a row that hides all but one, so actions stay in the same place down the column. Put destructive actions last, with `kind="destructive"`.
|
|
115
|
+
- Use `hidden: true` for an action the person can’t use on any row, like one they don’t have permission for. Use a `hidden` function only when it depends on the row; otherwise every row gets a menu with a single item.
|
|
113
116
|
- Table actions are icon buttons, so give each a short `label`. It becomes the tooltip and the accessible name.
|
|
114
117
|
|
|
118
|
+
### Row appearance
|
|
119
|
+
|
|
120
|
+
`getRowAppearance` gives a row one of a few fixed looks. Tapestry owns how each looks, so the same meaning looks the same across Planning Center.
|
|
121
|
+
|
|
122
|
+
| Need | Use |
|
|
123
|
+
| --------------------------------------------------------- | --------- |
|
|
124
|
+
| Point to rows after an action elsewhere, like a date pick | `reveal` |
|
|
125
|
+
| Mark a row that needs attention | `flagged` |
|
|
126
|
+
| Call out a recently added row | `new` |
|
|
127
|
+
| Play down a less relevant row, like an inactive one | `muted` |
|
|
128
|
+
|
|
129
|
+
- Give flagged and new rows a visible indicator in a cell too, like an icon or a badge. Color can’t be the only signal.
|
|
130
|
+
- A reveal doesn’t move focus. When it matters, announce it in a status message, like “3 events on November 9”.
|
|
131
|
+
- Don’t style rows with your own classes; ask for a new appearance when the fixed set doesn’t fit.
|
|
132
|
+
|
|
115
133
|
### Selection
|
|
116
134
|
|
|
117
135
|
- `selectable` adds a checkbox to each row and a select-all checkbox in the header. The header checkbox selects only the rows on this page.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@planningcenter/tapestry",
|
|
3
|
-
"version": "4.15.0
|
|
3
|
+
"version": "4.15.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -96,7 +96,7 @@
|
|
|
96
96
|
"autoprefixer": "^10.4.21",
|
|
97
97
|
"concurrently": "^9.1.2",
|
|
98
98
|
"diffable-html": "^4.1.0",
|
|
99
|
-
"glob": "^
|
|
99
|
+
"glob": "^14.0.2",
|
|
100
100
|
"jest-axe": "^11.0.0",
|
|
101
101
|
"jest-image-snapshot": "^6.4.0",
|
|
102
102
|
"jsdom": "^25.0.0",
|
|
@@ -143,5 +143,5 @@
|
|
|
143
143
|
"react-stately": "3.49.0",
|
|
144
144
|
"use-sync-external-store": "^1.7.0"
|
|
145
145
|
},
|
|
146
|
-
"gitHead": "
|
|
146
|
+
"gitHead": "b83f176c5918f3e5750a4c398b5cf7f1deab62a6"
|
|
147
147
|
}
|