govuk-react 1.0.0-alpha.1 → 1.0.0-alpha.3
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/README.md +3 -2
- package/dist/components/accordion/index.d.ts +1 -1
- package/dist/components/accordion/index.js.map +1 -1
- package/dist/components/character-count/index.js +1 -1
- package/dist/components/character-count/index.js.map +1 -1
- package/dist/components/checkboxes/index.d.ts +0 -2
- package/dist/components/checkboxes/index.js +1 -10
- package/dist/components/checkboxes/index.js.map +1 -1
- package/dist/components/exit-this-page/index.js +2 -2
- package/dist/components/exit-this-page/index.js.map +1 -1
- package/dist/components/file-upload/enhanced.d.ts +2 -2
- package/dist/components/file-upload/enhanced.js +2 -2
- package/dist/components/file-upload/enhanced.js.map +1 -1
- package/dist/components/loading-box/index.d.ts +0 -2
- package/dist/components/loading-box/index.js +0 -16
- package/dist/components/loading-box/index.js.map +1 -1
- package/dist/components/modal/index.d.ts +0 -2
- package/dist/components/modal/index.js +1 -11
- package/dist/components/modal/index.js.map +1 -1
- package/dist/components/password-input/index.js +1 -1
- package/dist/components/password-input/index.js.map +1 -1
- package/dist/components/radios/index.d.ts +0 -2
- package/dist/components/radios/index.js +1 -10
- package/dist/components/radios/index.js.map +1 -1
- package/dist/components/related-items/index.d.ts +0 -2
- package/dist/components/related-items/index.js +1 -5
- package/dist/components/related-items/index.js.map +1 -1
- package/dist/components/search-box/index.d.ts +1 -3
- package/dist/components/search-box/index.js +4 -44
- package/dist/components/search-box/index.js.map +1 -1
- package/dist/components/service-navigation/index.d.ts +1 -3
- package/dist/components/service-navigation/index.js +4 -13
- package/dist/components/service-navigation/index.js.map +1 -1
- package/dist/components/tabs/index.d.ts +4 -8
- package/dist/components/tabs/index.js +6 -6
- package/dist/components/tabs/index.js.map +1 -1
- package/dist/styles.css +350 -0
- package/package.json +7 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/tabs/index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,GAAG,MAAA,YAAY,aAAZ,YAAY,cAAZ,YAAY,GAAI,MAAA,KAAK,CAAC,CAAC,CAAC,0CAAE,EAAE,mCAAI,EAAE,CAAC;IACnD,OAAO,CACL,oBAAC,UAAU,OAAK,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,YAAY,EAAE,OAAO;QACxD,oBAAC,MAAM,CAAC,KAAK,QAAE,KAAK,CAAgB;QACpC,oBAAC,IAAI,QACF,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CACnB,oBAAC,QAAQ,IAAC,GAAG,EAAE,IAAI,CAAC,EAAE,EAAE,KAAK,EAAE,IAAI,CAAC,EAAE;YACpC,oBAAC,QAAQ,IAAC,KAAK,EAAE,IAAI,CAAC,EAAE,IAAG,IAAI,CAAC,KAAK,CAAY,CACxC,CACZ,CAAC,CACG;QACN,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CACnB,oBAAC,UAAU,IAAC,GAAG,EAAE,IAAI,CAAC,EAAE,EAAE,KAAK,EAAE,IAAI,CAAC,EAAE,IACrC,IAAI,CAAC,KAAK,CACA,CACd,CAAC,CACS,CACd,CAAC;AACJ,CAAC","sourcesContent":["import * as React from 'react';\nimport { createContext, useContext } from 'react';\nimport type { ReactNode } from 'react';\nimport * as Primitives from '@govuk-react/primitives/tabs';\nimport * as Markup from 'govuk-frontend-react/tabs';\n\n/*\n * govuk-frontend-react's Tabs markup, with the tab behaviour from @govuk-react/primitives. The\n * behaviour matches govuk-frontend's: tabs from tablet width up, and a list of links to every\n * panel below it or without JavaScript. With `RadiosRoot`, tabs switch without JavaScript too.\n */\n\n// Fills in defaults only: in an island without a Root, pass `selected` to the parts.\nconst TabsContext = createContext<{ selected?: string }>({});\n\n/** govuk-frontend's tablet breakpoint, where its tabs start. */\nconst tablet = '(min-width: 40.0625em)';\n\ntype BaseRootProps = Omit<Markup.RootProps, 'defaultValue' | 'onChange'> & {\n /** Called when the user selects a tab. */\n onValueChange?: (value: string) => void;\n /**\n * When controlled, what happens to a tab the user picked before hydration: \"ignore\" keeps\n * `value`, \"report\" calls `onValueChange` with the pick so you can adopt it.\n */\n preHydration?: 'ignore' | 'report';\n /** The panels' radio group name. Defaults to a generated one. */\n name?: string;\n};\n\nexport type RootProps = BaseRootProps & {\n /** The selected tab's value, to control the tabs. */\n value?: string;\n /** The tab selected at first, when uncontrolled. Defaults to the first tab. */\n defaultValue?: string;\n};\n\n// The classes govuk-frontend's styles key off.\nconst classes = {\n media: tablet,\n // govuk-frontend styles tabs under `govuk-frontend-supported`, which its JavaScript adds to the body.\n upgradedClass: 'govuk-frontend-supported',\n activeItemClass: 'govuk-tabs__list-item--selected',\n hiddenContentClass: 'govuk-tabs__panel--hidden',\n};\n\n/**\n * Tabs can be a helpful way of letting users quickly switch between related information.\n *\n * As in govuk-frontend, without JavaScript the tabs are a list of links to every panel. Use `Tab`\n * and `Panel` inside it. Each tab's `value` is its panel's id.\n *\n * @see https://design-system.service.gov.uk/components/tabs/\n */\nexport function Root({ value, defaultValue, onValueChange, preHydration, name, ...props }: RootProps) {\n return (\n <TabsContext.Provider value={{ selected: value ?? defaultValue }}>\n <Primitives.Root\n value={value}\n defaultValue={defaultValue}\n onValueChange={onValueChange}\n preHydration={preHydration}\n name={name}\n {...classes}\n >\n <Markup.Root {...props} />\n </Primitives.Root>\n </TabsContext.Provider>\n );\n}\n\nexport type RadiosRootProps = BaseRootProps &\n // Without JavaScript only the checked radio's panel shows, so one must be selected from the start.\n ({ value: string; defaultValue?: string } | { value?: string; defaultValue: string });\n\n/**\n * Tabs that switch panels without JavaScript too, through a hidden radio in each panel. Use\n * `RadioTab` and `RadioPanel` inside it. Each tab's `value` is its panel's id.\n *\n * @see https://design-system.service.gov.uk/components/tabs/\n */\nexport function RadiosRoot({ value, defaultValue, onValueChange, preHydration, name, ...props }: RadiosRootProps) {\n const selection: Pick<Primitives.RadiosRootProps, 'value' | 'defaultValue'> &\n ({ value: string } | { defaultValue: string }) =\n value !== undefined ? { value, defaultValue } : { defaultValue: defaultValue ?? '' };\n return (\n <TabsContext.Provider value={{ selected: value ?? defaultValue }}>\n <Primitives.RadiosRoot\n {...selection}\n onValueChange={onValueChange}\n preHydration={preHydration}\n name={name}\n {...classes}\n >\n <Markup.Root {...props} />\n </Primitives.RadiosRoot>\n </TabsContext.Provider>\n );\n}\n\nexport { Title, type TitleProps } from 'govuk-frontend-react/tabs';\n\nexport type ListProps = Markup.ListProps;\n\nexport function List(props: ListProps) {\n return (\n <Primitives.List asChild>\n <Markup.List {...props} />\n </Primitives.List>\n );\n}\n\nfunction useSelected(value: string, selected: boolean | undefined) {\n const context = useContext(TabsContext);\n // With no value set, the first tab is selected, which the parts can't know: the element selects it.\n return selected ?? value === context.selected;\n}\n\nexport type ListItemProps = Markup.ListItemProps & {\n /** The value of the tab inside it. */\n value: string;\n};\n\nexport function ListItem({ value, selected, ...props }: ListItemProps) {\n return (\n <Primitives.Item value={value} asChild>\n <Markup.ListItem selected={useSelected(value, selected)} {...props} />\n </Primitives.Item>\n );\n}\n\nexport type TabProps = Omit<Markup.TabProps, 'href' | 'asChild'> & {\n /** Its panel's value, which is the panel's id. */\n value: string;\n};\n\n/** A tab in a `Root`: a link to its panel. */\nexport function Tab({ value, children, ...props }: TabProps) {\n return (\n <Primitives.Trigger value={value} asChild>\n <Markup.Tab {...props}>{children}</Markup.Tab>\n </Primitives.Trigger>\n );\n}\n\nexport type RadioTabProps = TabProps & {\n /** The panels' radio group name. Set by RadiosRoot: pass it to a tab rendered without one, such as in an island. */\n name?: string;\n};\n\n/** A tab in a `RadiosRoot`: a label for its panel's radio. */\nexport function RadioTab({ value, name, children, ...props }: RadioTabProps) {\n return (\n <Primitives.RadioTrigger value={value} name={name} asChild>\n <Markup.Tab asChild {...props}>\n <label>{children}</label>\n </Markup.Tab>\n </Primitives.RadioTrigger>\n );\n}\n\nexport type PanelProps = Omit<Markup.PanelProps, 'id'> & {\n /** Its tab's value, which is the panel's id. */\n value: string;\n /** The panels' radio group name. Set by Root: pass it to a panel rendered without one, such as in an island. */\n name?: string;\n};\n\n/** A panel in a `Root`. */\nexport function Panel({ value, selected, name, ...props }: PanelProps) {\n const isSelected = useSelected(value, selected);\n return (\n <Primitives.Content value={value} name={name} defaultSelected={isSelected} asChild>\n <Markup.Panel selected={isSelected} {...props} />\n </Primitives.Content>\n );\n}\n\nexport type RadioPanelProps = PanelProps;\n\n/** A panel in a `RadiosRoot`, shown without JavaScript only while its tab is chosen. */\nexport function RadioPanel({ value, selected, name, ...props }: RadioPanelProps) {\n const isSelected = useSelected(value, selected);\n return (\n <Primitives.RadioContent value={value} name={name} defaultSelected={isSelected} asChild>\n <Markup.Panel selected={isSelected} {...props} />\n </Primitives.RadioContent>\n );\n}\n\nexport type CompositeItem = {\n /** The panel's id, and the tab's value. */\n id: string;\n label: ReactNode;\n panel: ReactNode;\n};\n\nexport type CompositeProps = Omit<RootProps, 'title'> & {\n /** The heading shown above the list of links when the tabs aren't shown. Defaults to \"Contents\". */\n title?: ReactNode;\n items: CompositeItem[];\n};\n\n/** The tabs, with a tab and panel for each item. Without JavaScript, a list of links to every panel. */\nexport function Composite({ title, items, value, defaultValue, ...props }: CompositeProps) {\n // As in govuk-frontend, the first tab is selected unless another is.\n const initial = value === undefined ? (defaultValue ?? items[0]?.id) : defaultValue;\n return (\n <Root {...props} value={value} defaultValue={initial}>\n <Markup.Title>{title}</Markup.Title>\n <List>\n {items.map((item) => (\n <ListItem key={item.id} value={item.id}>\n <Tab value={item.id}>{item.label}</Tab>\n </ListItem>\n ))}\n </List>\n {items.map((item) => (\n <Panel key={item.id} value={item.id}>\n {item.panel}\n </Panel>\n ))}\n </Root>\n );\n}\n\nexport type RadiosCompositeProps = Omit<BaseRootProps, 'title'> & {\n /** The heading shown above the list of tabs when they aren't styled as tabs. Defaults to \"Contents\". */\n title?: ReactNode;\n items: CompositeItem[];\n /** The selected tab's value, to control the tabs. */\n value?: string;\n /** The tab selected at first, when uncontrolled. Defaults to the first tab. */\n defaultValue?: string;\n};\n\n/** The tabs, with a tab and panel for each item. They switch panels without JavaScript too. */\nexport function RadiosComposite({ title, items, value, defaultValue, ...props }: RadiosCompositeProps) {\n const initial = defaultValue ?? items[0]?.id ?? '';\n return (\n <RadiosRoot {...props} value={value} defaultValue={initial}>\n <Markup.Title>{title}</Markup.Title>\n <List>\n {items.map((item) => (\n <ListItem key={item.id} value={item.id}>\n <RadioTab value={item.id}>{item.label}</RadioTab>\n </ListItem>\n ))}\n </List>\n {items.map((item) => (\n <RadioPanel key={item.id} value={item.id}>\n {item.panel}\n </RadioPanel>\n ))}\n </RadiosRoot>\n );\n}\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/tabs/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAElD,OAAO,KAAK,UAAU,MAAM,8BAA8B,CAAC;AAC3D,OAAO,KAAK,MAAM,MAAM,2BAA2B,CAAC;AAEpD;;;;GAIG;AAEH,qFAAqF;AACrF,MAAM,WAAW,GAAG,aAAa,CAAwB,EAAE,CAAC,CAAC;AAE7D,gEAAgE;AAChE,MAAM,MAAM,GAAG,wBAAwB,CAAC;AAgBxC,+CAA+C;AAC/C,MAAM,OAAO,GAAG;IACd,KAAK,EAAE,MAAM;IACb,sGAAsG;IACtG,aAAa,EAAE,0BAA0B;IACzC,eAAe,EAAE,iCAAiC;IAClD,kBAAkB,EAAE,2BAA2B;CAChD,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,UAAU,IAAI,CAAC,EAAE,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,IAAI,EAAE,GAAG,KAAK,EAAa;IACpF,OAAO,CACL,oBAAC,WAAW,CAAC,QAAQ,IAAC,KAAK,EAAE,EAAE,QAAQ,EAAE,KAAK,aAAL,KAAK,cAAL,KAA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IAAI,CAAC,KAAK,CAAO,CAC9B,CACZ,CAAC,CACG;QACN,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CACnB,oBAAC,KAAK,IAAC,GAAG,EAAE,IAAI,CAAC,EAAE,EAAE,KAAK,EAAE,IAAI,CAAC,EAAE,IAChC,IAAI,CAAC,KAAK,CACL,CACT,CAAC,CACG,CACR,CAAC;AACJ,CAAC;AAYD,+FAA+F;AAC/F,MAAM,UAAU,eAAe,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,YAAY,EAAE,GAAG,KAAK,EAAwB;;IACnG,MAAM,OAAO,GAAG,MAAA,YAAY,aAAZ,YAAY,cAAZ,YAAY,GAAI,MAAA,KAAK,CAAC,CAAC,CAAC,0CAAE,EAAE,mCAAI,EAAE,CAAC;IACnD,OAAO,CACL,oBAAC,UAAU,OAAK,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,YAAY,EAAE,OAAO;QACxD,oBAAC,MAAM,CAAC,KAAK,QAAE,KAAK,CAAgB;QACpC,oBAAC,IAAI,QACF,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CACnB,oBAAC,QAAQ,IAAC,GAAG,EAAE,IAAI,CAAC,EAAE,EAAE,KAAK,EAAE,IAAI,CAAC,EAAE;YACpC,oBAAC,QAAQ,IAAC,KAAK,EAAE,IAAI,CAAC,EAAE,IAAG,IAAI,CAAC,KAAK,CAAY,CACxC,CACZ,CAAC,CACG;QACN,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CACnB,oBAAC,UAAU,IAAC,GAAG,EAAE,IAAI,CAAC,EAAE,EAAE,KAAK,EAAE,IAAI,CAAC,EAAE,IACrC,IAAI,CAAC,KAAK,CACA,CACd,CAAC,CACS,CACd,CAAC;AACJ,CAAC","sourcesContent":["import * as React from 'react';\nimport { createContext, useContext } from 'react';\nimport type { ReactNode } from 'react';\nimport * as Primitives from '@govuk-react/primitives/tabs';\nimport * as Markup from 'govuk-frontend-react/tabs';\n\n/*\n * govuk-frontend-react's Tabs markup, with the tab behaviour from @govuk-react/primitives. The\n * behaviour matches govuk-frontend's: tabs from tablet width up, and a list of links to every\n * panel below it or without JavaScript. With `RadiosRoot`, tabs switch without JavaScript too.\n */\n\n// Fills in defaults only: in an island without a Root, pass `selected` to the parts.\nconst TabsContext = createContext<{ selected?: string }>({});\n\n/** govuk-frontend's tablet breakpoint, where its tabs start. */\nconst tablet = '(min-width: 40.0625em)';\n\ntype BaseRootProps = Omit<Markup.RootProps, 'defaultValue' | 'onChange'> & {\n /** Called when the user selects a tab. */\n onValueChange?: (value: string, details: Primitives.ChangeDetails) => void;\n /** The panels' radio group name. Defaults to a generated one. */\n name?: string;\n};\n\nexport type RootProps = BaseRootProps & {\n /** The selected tab's value, to control the tabs. */\n value?: string;\n /** The tab selected at first, when uncontrolled. Defaults to the first tab. */\n defaultValue?: string;\n};\n\n// The classes govuk-frontend's styles key off.\nconst classes = {\n media: tablet,\n // govuk-frontend styles tabs under `govuk-frontend-supported`, which its JavaScript adds to the body.\n upgradedClass: 'govuk-frontend-supported',\n activeItemClass: 'govuk-tabs__list-item--selected',\n hiddenContentClass: 'govuk-tabs__panel--hidden',\n};\n\n/**\n * Tabs can be a helpful way of letting users quickly switch between related information.\n *\n * As in govuk-frontend, without JavaScript the tabs are a list of links to every panel. Use `Tab`\n * and `Panel` inside it. Each tab's `value` is its panel's id.\n *\n * @see https://design-system.service.gov.uk/components/tabs/\n */\nexport function Root({ value, defaultValue, onValueChange, name, ...props }: RootProps) {\n return (\n <TabsContext.Provider value={{ selected: value ?? defaultValue }}>\n <Primitives.Root value={value} defaultValue={defaultValue} onValueChange={onValueChange} name={name} {...classes}>\n <Markup.Root {...props} />\n </Primitives.Root>\n </TabsContext.Provider>\n );\n}\n\nexport type RadiosRootProps = BaseRootProps &\n // Without JavaScript only the checked radio's panel shows, so one must be selected from the start.\n ({ value: string; defaultValue?: string } | { value?: string; defaultValue: string });\n\n/**\n * Tabs that switch panels without JavaScript too, through a hidden radio in each panel. Use\n * `RadioTab` and `RadioPanel` inside it. Each tab's `value` is its panel's id.\n *\n * @see https://design-system.service.gov.uk/components/tabs/\n */\nexport function RadiosRoot({ value, defaultValue, onValueChange, name, ...props }: RadiosRootProps) {\n const selection: Pick<Primitives.RadiosRootProps, 'value' | 'defaultValue'> &\n ({ value: string } | { defaultValue: string }) =\n value !== undefined ? { value, defaultValue } : { defaultValue: defaultValue ?? '' };\n return (\n <TabsContext.Provider value={{ selected: value ?? defaultValue }}>\n <Primitives.RadiosRoot {...selection} onValueChange={onValueChange} name={name} {...classes}>\n <Markup.Root {...props} />\n </Primitives.RadiosRoot>\n </TabsContext.Provider>\n );\n}\n\nexport { Title, type TitleProps } from 'govuk-frontend-react/tabs';\n\nexport type ListProps = Markup.ListProps;\n\nexport function List(props: ListProps) {\n return (\n <Primitives.List asChild>\n <Markup.List {...props} />\n </Primitives.List>\n );\n}\n\nfunction useSelected(value: string, selected: boolean | undefined) {\n const context = useContext(TabsContext);\n // With no value set, the first tab is selected, which the parts can't know: the element selects it.\n return selected ?? value === context.selected;\n}\n\nexport type ListItemProps = Markup.ListItemProps & {\n /** The value of the tab inside it. */\n value: string;\n};\n\nexport function ListItem({ value, selected, ...props }: ListItemProps) {\n return (\n <Primitives.Item value={value} asChild>\n <Markup.ListItem selected={useSelected(value, selected)} {...props} />\n </Primitives.Item>\n );\n}\n\nexport type TabProps = Omit<Markup.TabProps, 'href' | 'asChild'> & {\n /** Its panel's value, which is the panel's id. */\n value: string;\n};\n\n/** A tab in a `Root`: a link to its panel. */\nexport function Tab({ value, children, ...props }: TabProps) {\n return (\n <Primitives.Trigger value={value} asChild>\n <Markup.Tab {...props}>{children}</Markup.Tab>\n </Primitives.Trigger>\n );\n}\n\nexport type RadioTabProps = TabProps & {\n /** The panels' radio group name. Set by RadiosRoot: pass it to a tab rendered without one, such as in an island. */\n name?: string;\n};\n\n/** A tab in a `RadiosRoot`: a label for its panel's radio. */\nexport function RadioTab({ value, name, children, ...props }: RadioTabProps) {\n return (\n <Primitives.RadiosTrigger value={value} name={name} asChild>\n <Markup.Tab asChild {...props}>\n <label>{children}</label>\n </Markup.Tab>\n </Primitives.RadiosTrigger>\n );\n}\n\nexport type PanelProps = Omit<Markup.PanelProps, 'id'> & {\n /** Its tab's value, which is the panel's id. */\n value: string;\n /** The panels' radio group name. Set by Root: pass it to a panel rendered without one, such as in an island. */\n name?: string;\n};\n\n/** A panel in a `Root`. */\nexport function Panel({ value, selected, name, ...props }: PanelProps) {\n const isSelected = useSelected(value, selected);\n return (\n <Primitives.Content value={value} name={name} defaultSelected={isSelected} asChild>\n <Markup.Panel selected={isSelected} {...props} />\n </Primitives.Content>\n );\n}\n\nexport type RadioPanelProps = PanelProps;\n\n/** A panel in a `RadiosRoot`, shown without JavaScript only while its tab is chosen. */\nexport function RadioPanel({ value, selected, name, ...props }: RadioPanelProps) {\n const isSelected = useSelected(value, selected);\n return (\n <Primitives.RadiosContent value={value} name={name} defaultSelected={isSelected} asChild>\n <Markup.Panel selected={isSelected} {...props} />\n </Primitives.RadiosContent>\n );\n}\n\nexport type CompositeItem = {\n /** The panel's id, and the tab's value. */\n id: string;\n label: ReactNode;\n panel: ReactNode;\n};\n\nexport type CompositeProps = Omit<RootProps, 'title'> & {\n /** The heading shown above the list of links when the tabs aren't shown. Defaults to \"Contents\". */\n title?: ReactNode;\n items: CompositeItem[];\n};\n\n/** The tabs, with a tab and panel for each item. Without JavaScript, a list of links to every panel. */\nexport function Composite({ title, items, value, defaultValue, ...props }: CompositeProps) {\n // As in govuk-frontend, the first tab is selected unless another is.\n const initial = value === undefined ? (defaultValue ?? items[0]?.id) : defaultValue;\n return (\n <Root {...props} value={value} defaultValue={initial}>\n <Markup.Title>{title}</Markup.Title>\n <List>\n {items.map((item) => (\n <ListItem key={item.id} value={item.id}>\n <Tab value={item.id}>{item.label}</Tab>\n </ListItem>\n ))}\n </List>\n {items.map((item) => (\n <Panel key={item.id} value={item.id}>\n {item.panel}\n </Panel>\n ))}\n </Root>\n );\n}\n\nexport type RadiosCompositeProps = Omit<BaseRootProps, 'title'> & {\n /** The heading shown above the list of tabs when they aren't styled as tabs. Defaults to \"Contents\". */\n title?: ReactNode;\n items: CompositeItem[];\n /** The selected tab's value, to control the tabs. */\n value?: string;\n /** The tab selected at first, when uncontrolled. Defaults to the first tab. */\n defaultValue?: string;\n};\n\n/** The tabs, with a tab and panel for each item. They switch panels without JavaScript too. */\nexport function RadiosComposite({ title, items, value, defaultValue, ...props }: RadiosCompositeProps) {\n const initial = defaultValue ?? items[0]?.id ?? '';\n return (\n <RadiosRoot {...props} value={value} defaultValue={initial}>\n <Markup.Title>{title}</Markup.Title>\n <List>\n {items.map((item) => (\n <ListItem key={item.id} value={item.id}>\n <RadioTab value={item.id}>{item.label}</RadioTab>\n </ListItem>\n ))}\n </List>\n {items.map((item) => (\n <RadioPanel key={item.id} value={item.id}>\n {item.panel}\n </RadioPanel>\n ))}\n </RadiosRoot>\n );\n}\n"]}
|
package/dist/styles.css
ADDED
|
@@ -0,0 +1,350 @@
|
|
|
1
|
+
/* Rules the primitives' fallbacks need. They set no look, only `display`. */
|
|
2
|
+
|
|
3
|
+
/* Tabs: the radios fallback shows only the checked tab's panel, until the element upgrades. */
|
|
4
|
+
govuk-react-tabs:not([data-upgraded]) [data-tabs-content]:has(> input[data-tabs-fallback]):not(:has(> input:checked)) {
|
|
5
|
+
display: none;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
/* Accordion: `hidden` wins over a display set on a fallback heading, trigger or controls. */
|
|
9
|
+
govuk-react-accordion :is([data-accordion-fallback], [data-accordion-trigger], [data-accordion-controls])[hidden] {
|
|
10
|
+
display: none !important;
|
|
11
|
+
}
|
|
12
|
+
/*
|
|
13
|
+
* Styles for govuk-react's own components, which govuk-frontend has no classes for. Load after
|
|
14
|
+
* govuk-frontend's CSS. The published file starts with @govuk-react/primitives' styles.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
/* Checkboxes: shows a reveal only while its checkbox is checked, before or without JavaScript. */
|
|
18
|
+
.govuk-checkboxes__item:has(> .govuk-checkboxes__input:not(:checked)) + .govuk-checkboxes__conditional {
|
|
19
|
+
display: none;
|
|
20
|
+
}
|
|
21
|
+
.govuk-checkboxes__item:has(> .govuk-checkboxes__input:checked) + .govuk-checkboxes__conditional {
|
|
22
|
+
display: block;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/* Radios: shows a reveal only while its radio is checked, before or without JavaScript. */
|
|
26
|
+
.govuk-radios__item:has(> .govuk-radios__input:not(:checked)) + .govuk-radios__conditional {
|
|
27
|
+
display: none;
|
|
28
|
+
}
|
|
29
|
+
.govuk-radios__item:has(> .govuk-radios__input:checked) + .govuk-radios__conditional {
|
|
30
|
+
display: block;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/* Loading box */
|
|
34
|
+
.govuk-react-loading-box {
|
|
35
|
+
position: relative;
|
|
36
|
+
padding-bottom: 2px;
|
|
37
|
+
min-height: 10px;
|
|
38
|
+
}
|
|
39
|
+
.govuk-react-loading-box__overlay {
|
|
40
|
+
position: absolute;
|
|
41
|
+
inset: 0;
|
|
42
|
+
z-index: 100;
|
|
43
|
+
display: flex;
|
|
44
|
+
justify-content: center;
|
|
45
|
+
visibility: hidden;
|
|
46
|
+
transition: visibility 0s linear var(--govuk-react-loading-box-time-out);
|
|
47
|
+
}
|
|
48
|
+
.govuk-react-loading-box__backdrop {
|
|
49
|
+
position: absolute;
|
|
50
|
+
inset: 0;
|
|
51
|
+
background-color: var(--govuk-react-loading-box-background-colour);
|
|
52
|
+
opacity: 0;
|
|
53
|
+
transition: opacity var(--govuk-react-loading-box-time-out) ease-in-out;
|
|
54
|
+
}
|
|
55
|
+
.govuk-react-loading-box__spinner {
|
|
56
|
+
position: absolute;
|
|
57
|
+
z-index: 1;
|
|
58
|
+
display: block;
|
|
59
|
+
width: 50px;
|
|
60
|
+
height: 100%;
|
|
61
|
+
max-height: calc(50vh + 100px);
|
|
62
|
+
opacity: 0;
|
|
63
|
+
transition: opacity var(--govuk-react-loading-box-time-out) ease-in-out;
|
|
64
|
+
}
|
|
65
|
+
.govuk-react-loading-box__spinner rect {
|
|
66
|
+
animation: govuk-react-loading-box-fade 1s infinite linear;
|
|
67
|
+
}
|
|
68
|
+
.govuk-react-loading-box--loading > .govuk-react-loading-box__overlay {
|
|
69
|
+
visibility: visible;
|
|
70
|
+
transition-delay: 0s;
|
|
71
|
+
}
|
|
72
|
+
.govuk-react-loading-box--loading > .govuk-react-loading-box__overlay > .govuk-react-loading-box__backdrop {
|
|
73
|
+
opacity: var(--govuk-react-loading-box-background-opacity);
|
|
74
|
+
transition-duration: var(--govuk-react-loading-box-time-in);
|
|
75
|
+
}
|
|
76
|
+
.govuk-react-loading-box--loading > .govuk-react-loading-box__overlay > .govuk-react-loading-box__spinner {
|
|
77
|
+
opacity: 1;
|
|
78
|
+
transition-duration: var(--govuk-react-loading-box-time-in);
|
|
79
|
+
transition-delay: calc(var(--govuk-react-loading-box-time-in) / 2);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.govuk-react-loading-box__text {
|
|
83
|
+
display: none;
|
|
84
|
+
position: absolute;
|
|
85
|
+
z-index: 1;
|
|
86
|
+
margin: 0;
|
|
87
|
+
padding-top: 20px;
|
|
88
|
+
}
|
|
89
|
+
@media (prefers-reduced-motion: reduce) {
|
|
90
|
+
.govuk-react-loading-box__overlay,
|
|
91
|
+
.govuk-react-loading-box__backdrop,
|
|
92
|
+
.govuk-react-loading-box__spinner {
|
|
93
|
+
transition: none;
|
|
94
|
+
}
|
|
95
|
+
.govuk-react-loading-box__spinner {
|
|
96
|
+
display: none;
|
|
97
|
+
}
|
|
98
|
+
.govuk-react-loading-box__text {
|
|
99
|
+
display: block;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
@keyframes govuk-react-loading-box-fade {
|
|
103
|
+
0% {
|
|
104
|
+
opacity: 0.250075;
|
|
105
|
+
}
|
|
106
|
+
.01% {
|
|
107
|
+
opacity: 0.25;
|
|
108
|
+
}
|
|
109
|
+
.03% {
|
|
110
|
+
opacity: 1;
|
|
111
|
+
}
|
|
112
|
+
100% {
|
|
113
|
+
opacity: 0.250075;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/* Modal */
|
|
118
|
+
.govuk-react-modal {
|
|
119
|
+
box-sizing: border-box;
|
|
120
|
+
width: calc(100% - 30px);
|
|
121
|
+
max-width: 640px;
|
|
122
|
+
max-height: calc(100% - 30px);
|
|
123
|
+
padding: 30px;
|
|
124
|
+
border: 5px solid var(--govuk-text-colour, #0b0c0c);
|
|
125
|
+
background: var(--govuk-body-background-colour, #fff);
|
|
126
|
+
color: var(--govuk-text-colour, #0b0c0c);
|
|
127
|
+
}
|
|
128
|
+
.govuk-react-modal:focus {
|
|
129
|
+
outline: 3px solid var(--govuk-focus-colour, #fd0);
|
|
130
|
+
outline-offset: 0;
|
|
131
|
+
}
|
|
132
|
+
.govuk-react-modal::backdrop {
|
|
133
|
+
background: rgb(11 12 12 / 0.8);
|
|
134
|
+
}
|
|
135
|
+
.govuk-react-modal > :last-child {
|
|
136
|
+
margin-bottom: 0;
|
|
137
|
+
}
|
|
138
|
+
@media (max-width: 40.0525em) {
|
|
139
|
+
.govuk-react-modal {
|
|
140
|
+
padding: 15px;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/* Related items */
|
|
145
|
+
.govuk-react-related-items {
|
|
146
|
+
border-top: 2px solid var(--govuk-brand-colour, #1d70b8);
|
|
147
|
+
padding-top: 10px;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
/* Search box, based on GOV.UK’s search component */
|
|
151
|
+
.govuk-react-search-box__wrapper {
|
|
152
|
+
display: flex;
|
|
153
|
+
background-color: #fff;
|
|
154
|
+
}
|
|
155
|
+
.govuk-react-search-box__input {
|
|
156
|
+
margin: 0;
|
|
157
|
+
-webkit-appearance: none;
|
|
158
|
+
appearance: none;
|
|
159
|
+
}
|
|
160
|
+
.govuk-react-search-box__input:focus {
|
|
161
|
+
z-index: 1;
|
|
162
|
+
}
|
|
163
|
+
.govuk-react-search-box__button {
|
|
164
|
+
position: relative;
|
|
165
|
+
flex: 0 0 auto;
|
|
166
|
+
width: 2.5rem;
|
|
167
|
+
height: 2.5rem;
|
|
168
|
+
margin: 0;
|
|
169
|
+
padding: 0;
|
|
170
|
+
border: 0;
|
|
171
|
+
border-radius: 0;
|
|
172
|
+
outline: 2px solid transparent;
|
|
173
|
+
outline-offset: 0;
|
|
174
|
+
cursor: pointer;
|
|
175
|
+
background-color: var(--govuk-brand-colour, #1d70b8);
|
|
176
|
+
color: #fff;
|
|
177
|
+
}
|
|
178
|
+
.govuk-react-search-box__button:hover {
|
|
179
|
+
background-color: color-mix(in srgb, var(--govuk-brand-colour, #1d70b8) 75%, #000);
|
|
180
|
+
}
|
|
181
|
+
.govuk-react-search-box__button:focus {
|
|
182
|
+
z-index: 1;
|
|
183
|
+
outline: 3px solid var(--govuk-focus-colour, #fd0);
|
|
184
|
+
box-shadow: inset 0 0 0 4px #0b0c0c;
|
|
185
|
+
}
|
|
186
|
+
.govuk-react-search-box__icon {
|
|
187
|
+
position: absolute;
|
|
188
|
+
inset: 0;
|
|
189
|
+
width: 100%;
|
|
190
|
+
height: 100%;
|
|
191
|
+
transform: scale(0.5);
|
|
192
|
+
pointer-events: none;
|
|
193
|
+
}
|
|
194
|
+
.govuk-react-search-box:not(.govuk-react-search-box--inverse) .govuk-react-search-box__input {
|
|
195
|
+
border-right-width: 0;
|
|
196
|
+
}
|
|
197
|
+
.govuk-react-search-box:not(.govuk-react-search-box--inverse) .govuk-react-search-box__input:focus {
|
|
198
|
+
border-right-width: 2px;
|
|
199
|
+
}
|
|
200
|
+
.govuk-react-search-box--inverse .govuk-react-search-box__label {
|
|
201
|
+
color: #fff;
|
|
202
|
+
}
|
|
203
|
+
.govuk-react-search-box--inverse .govuk-react-search-box__input {
|
|
204
|
+
border-width: 0;
|
|
205
|
+
}
|
|
206
|
+
.govuk-react-search-box--inverse .govuk-react-search-box__button {
|
|
207
|
+
background-color: color-mix(in srgb, var(--govuk-brand-colour, #1d70b8) 20%, #fff);
|
|
208
|
+
color: var(--govuk-brand-colour, #1d70b8);
|
|
209
|
+
}
|
|
210
|
+
.govuk-react-search-box--inverse .govuk-react-search-box__button:hover {
|
|
211
|
+
background-color: color-mix(in srgb, var(--govuk-brand-colour, #1d70b8) 5%, #fff);
|
|
212
|
+
}
|
|
213
|
+
.govuk-react-search-box--large .govuk-react-search-box__input {
|
|
214
|
+
height: 3.125rem;
|
|
215
|
+
}
|
|
216
|
+
.govuk-react-search-box--large .govuk-react-search-box__button {
|
|
217
|
+
width: 3.125rem;
|
|
218
|
+
height: 3.125rem;
|
|
219
|
+
}
|
|
220
|
+
.govuk-react-search-box--large .govuk-react-search-box__icon {
|
|
221
|
+
transform: scale(0.4);
|
|
222
|
+
}
|
|
223
|
+
.govuk-react-search-box__autocomplete {
|
|
224
|
+
display: block;
|
|
225
|
+
position: relative;
|
|
226
|
+
}
|
|
227
|
+
.govuk-react-search-box__menu {
|
|
228
|
+
position: absolute;
|
|
229
|
+
z-index: 100;
|
|
230
|
+
top: 100%;
|
|
231
|
+
left: 0;
|
|
232
|
+
right: 0;
|
|
233
|
+
margin: 0;
|
|
234
|
+
padding: 0;
|
|
235
|
+
list-style: none;
|
|
236
|
+
overflow-x: hidden;
|
|
237
|
+
background-color: #fff;
|
|
238
|
+
border: 1px solid #b1b4b6;
|
|
239
|
+
border-top: 0;
|
|
240
|
+
}
|
|
241
|
+
.govuk-react-search-box--inverse .govuk-react-search-box__menu {
|
|
242
|
+
border-top: 1px solid #b1b4b6;
|
|
243
|
+
}
|
|
244
|
+
.govuk-react-search-box__option {
|
|
245
|
+
cursor: pointer;
|
|
246
|
+
font-family: 'GDS Transport', arial, sans-serif;
|
|
247
|
+
-webkit-font-smoothing: antialiased;
|
|
248
|
+
-moz-osx-font-smoothing: grayscale;
|
|
249
|
+
font-size: 1rem;
|
|
250
|
+
line-height: 1.25;
|
|
251
|
+
color: #0b0c0c;
|
|
252
|
+
}
|
|
253
|
+
@media (min-width: 40.0625em) {
|
|
254
|
+
.govuk-react-search-box__option {
|
|
255
|
+
font-size: 1.1875rem;
|
|
256
|
+
line-height: 1.3157894737;
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
.govuk-react-search-box__option > * {
|
|
260
|
+
pointer-events: none;
|
|
261
|
+
}
|
|
262
|
+
.govuk-react-search-box__option[data-focused],
|
|
263
|
+
.govuk-react-search-box__option:hover,
|
|
264
|
+
.govuk-react-search-box__option:focus-visible {
|
|
265
|
+
background-color: #f3f3f3;
|
|
266
|
+
outline: none;
|
|
267
|
+
text-decoration: underline;
|
|
268
|
+
text-decoration-thickness: max(3px, 0.1875rem, 0.12em);
|
|
269
|
+
text-underline-offset: 0.1578em;
|
|
270
|
+
}
|
|
271
|
+
.govuk-react-search-box__option:focus-visible .govuk-react-search-box__suggestion-text {
|
|
272
|
+
background-color: var(--govuk-focus-colour, #fd0);
|
|
273
|
+
}
|
|
274
|
+
.govuk-react-search-box__option[hidden] {
|
|
275
|
+
display: none;
|
|
276
|
+
}
|
|
277
|
+
.govuk-react-search-box__option-wrapper {
|
|
278
|
+
display: flex;
|
|
279
|
+
align-items: center;
|
|
280
|
+
margin: 0 15px;
|
|
281
|
+
padding: 5px 0;
|
|
282
|
+
}
|
|
283
|
+
.govuk-react-search-box__option:not([hidden])
|
|
284
|
+
~ .govuk-react-search-box__option:not([hidden])
|
|
285
|
+
.govuk-react-search-box__option-wrapper {
|
|
286
|
+
border-top: 1px solid #b1b4b6;
|
|
287
|
+
}
|
|
288
|
+
.govuk-react-search-box__suggestion-icon {
|
|
289
|
+
flex: none;
|
|
290
|
+
width: 20px;
|
|
291
|
+
height: 2.5rem;
|
|
292
|
+
margin-right: 10px;
|
|
293
|
+
background-color: #505a5f;
|
|
294
|
+
-webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 27 27'%3E%3Ccircle cx='12' cy='11' r='8.5' fill='none' stroke='%23000' stroke-width='3'/%3E%3Cpath d='m17.9 17.4 8.5 8.5' stroke='%23000' stroke-width='3'/%3E%3C/svg%3E")
|
|
295
|
+
center/contain no-repeat;
|
|
296
|
+
mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 27 27'%3E%3Ccircle cx='12' cy='11' r='8.5' fill='none' stroke='%23000' stroke-width='3'/%3E%3Cpath d='m17.9 17.4 8.5 8.5' stroke='%23000' stroke-width='3'/%3E%3C/svg%3E")
|
|
297
|
+
center/contain no-repeat;
|
|
298
|
+
}
|
|
299
|
+
.govuk-react-search-box__option[data-focused] .govuk-react-search-box__suggestion-icon,
|
|
300
|
+
.govuk-react-search-box__option:hover .govuk-react-search-box__suggestion-icon,
|
|
301
|
+
.govuk-react-search-box__option:focus-visible .govuk-react-search-box__suggestion-icon {
|
|
302
|
+
background-color: #0b0c0c;
|
|
303
|
+
}
|
|
304
|
+
.govuk-react-search-box__suggestion-text {
|
|
305
|
+
font-weight: 700;
|
|
306
|
+
}
|
|
307
|
+
.govuk-react-search-box__suggestion-highlight {
|
|
308
|
+
font-weight: 400;
|
|
309
|
+
background: none;
|
|
310
|
+
color: inherit;
|
|
311
|
+
}
|
|
312
|
+
.govuk-react-search-box--large .govuk-react-search-box__option {
|
|
313
|
+
min-height: 3.125rem;
|
|
314
|
+
}
|
|
315
|
+
@media (forced-colors: active) {
|
|
316
|
+
.govuk-react-search-box__menu {
|
|
317
|
+
border-color: FieldText;
|
|
318
|
+
}
|
|
319
|
+
.govuk-react-search-box__option[data-focused],
|
|
320
|
+
.govuk-react-search-box__option:hover {
|
|
321
|
+
forced-color-adjust: none;
|
|
322
|
+
background-color: Highlight;
|
|
323
|
+
color: HighlightText;
|
|
324
|
+
}
|
|
325
|
+
.govuk-react-search-box__suggestion-icon {
|
|
326
|
+
background-color: currentcolor;
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
/* Service navigation: the details menu */
|
|
331
|
+
.govuk-react-service-navigation__details > summary {
|
|
332
|
+
list-style: none;
|
|
333
|
+
}
|
|
334
|
+
.govuk-react-service-navigation__details > summary::-webkit-details-marker {
|
|
335
|
+
display: none;
|
|
336
|
+
}
|
|
337
|
+
.govuk-react-service-navigation__details[open] > summary::after {
|
|
338
|
+
transform: rotate(180deg);
|
|
339
|
+
}
|
|
340
|
+
@supports selector(::details-content) {
|
|
341
|
+
@media (min-width: 40.0625em) {
|
|
342
|
+
.govuk-react-service-navigation__details > summary {
|
|
343
|
+
display: none;
|
|
344
|
+
}
|
|
345
|
+
.govuk-react-service-navigation__details::details-content {
|
|
346
|
+
content-visibility: visible;
|
|
347
|
+
display: contents;
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "govuk-react",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.3",
|
|
4
4
|
"description": "govuk-react: React components for the GOV.UK Design System, built on govuk-frontend-react.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
"types": "./dist/index.d.ts",
|
|
10
10
|
"default": "./dist/index.js"
|
|
11
11
|
},
|
|
12
|
+
"./styles.css": "./dist/styles.css",
|
|
12
13
|
"./*": {
|
|
13
14
|
"types": "./dist/components/*/index.d.ts",
|
|
14
15
|
"default": "./dist/components/*/index.js"
|
|
@@ -18,14 +19,16 @@
|
|
|
18
19
|
"files": [
|
|
19
20
|
"dist"
|
|
20
21
|
],
|
|
21
|
-
"sideEffects":
|
|
22
|
+
"sideEffects": [
|
|
23
|
+
"./dist/styles.css"
|
|
24
|
+
],
|
|
22
25
|
"scripts": {
|
|
23
|
-
"build": "rm -rf dist && tsc -p tsconfig.build.json && pnpm copy-readme",
|
|
26
|
+
"build": "rm -rf dist && tsc -p tsconfig.build.json && cat ../primitives/src/styles.css src/styles.css > dist/styles.css && pnpm copy-readme",
|
|
24
27
|
"copy-readme": "cp ../../README.md ../../LICENSE ."
|
|
25
28
|
},
|
|
26
29
|
"dependencies": {
|
|
27
30
|
"@govuk-react/icon-crown": "0.1.0",
|
|
28
|
-
"@govuk-react/primitives": "0.
|
|
31
|
+
"@govuk-react/primitives": "0.4.0",
|
|
29
32
|
"clsx": "^2.1.1",
|
|
30
33
|
"govuk-frontend-react": "1.0.0-alpha.6"
|
|
31
34
|
},
|